ADMINISTRATORS1.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. // 采购内转需求
  2. <template>
  3. <div class="admin">
  4. <template>
  5. <div class="admin1">
  6. <el-tabs v-model="activeName">
  7. <el-tab-pane label="补录计量实绩" name="first">
  8. <div class="switch">
  9. <el-switch
  10. v-model="switchValue"
  11. active-text="二次过磅"
  12. inactive-text="首次过磅"
  13. @change="onchange"
  14. >
  15. </el-switch>
  16. </div>
  17. <div class="admin2">
  18. <div class="carrier from">
  19. <el-form
  20. :inline="true"
  21. class="demo-form-inline"
  22. label-width="80px"
  23. >
  24. <el-form-item label="车牌号:">
  25. <el-autocomplete
  26. class="inline-input"
  27. v-model="capacityName"
  28. :fetch-suggestions="querySearchCapacity"
  29. placeholder="车牌号"
  30. :trigger-on-focus="false"
  31. @select="handleSelectCapacity"
  32. >
  33. <template slot-scope="{ item }">
  34. <div class="name">{{ item.capacityNumber }}</div>
  35. </template>
  36. </el-autocomplete>
  37. </el-form-item>
  38. </el-form>
  39. </div>
  40. <div class="material from">
  41. <span class="text">物资:</span>
  42. <el-select v-model="materialId" placeholder="请选择">
  43. <el-option
  44. v-for="item in materialList"
  45. :key="item.materialId"
  46. :label="item.materialName"
  47. :value="item.materialId"
  48. >
  49. </el-option>
  50. </el-select>
  51. </div>
  52. <div class="block" v-if="first">
  53. <span class="text">首次称重时间:</span>
  54. <el-date-picker
  55. v-model="value1"
  56. type="datetime"
  57. placeholder="选择日期时间"
  58. >
  59. </el-date-picker>
  60. </div>
  61. <div class="firstWeight from " v-if="first">
  62. <span class="text">首次称重重量(吨):</span>
  63. <el-input v-model="firstWeight"></el-input>
  64. </div>
  65. <div class="truckCalFirst from" v-if="first">
  66. <span class="text">首次汽车衡:</span>
  67. <el-select
  68. v-model="truckCalFirst"
  69. placeholder="请选择"
  70. @change="onchange1"
  71. >
  72. <el-option
  73. v-for="item in truckCalFirstList"
  74. :key="item.value"
  75. :label="item.label"
  76. :value="item.value"
  77. >
  78. </el-option>
  79. </el-select>
  80. </div>
  81. <div class="block" v-if="second">
  82. <span class="text">二次称重时间:</span>
  83. <el-date-picker
  84. v-model="value2"
  85. type="datetime"
  86. placeholder="选择日期时间"
  87. >
  88. </el-date-picker>
  89. </div>
  90. <div class="secondWeight from" v-if="second">
  91. <span class="text">二次称重重量(吨):</span>
  92. <el-input v-model="secondWeight"></el-input>
  93. </div>
  94. <div class="truckCalSecond from" v-if="second">
  95. <span class="text">二次汽车衡:</span>
  96. <el-select
  97. v-model="truckCalSecond"
  98. placeholder="请选择"
  99. @change="onchange2"
  100. >
  101. <el-option
  102. v-for="item in truckCalSecondList"
  103. :key="item.value"
  104. :label="item.label"
  105. :value="item.value"
  106. >
  107. </el-option>
  108. </el-select>
  109. </div>
  110. </div>
  111. <div class="button_box">
  112. <el-button @click="onClickCancel">返回</el-button>
  113. <el-button
  114. type="primary"
  115. @click="onClickConfirm"
  116. :disabled="disabled"
  117. >确认</el-button
  118. >
  119. </div>
  120. </el-tab-pane>
  121. <el-tab-pane label="修改路段顺序" name="second">
  122. <div class="admin2">
  123. <div class="carrier from">
  124. <el-form
  125. :inline="true"
  126. class="demo-form-inline"
  127. label-width="80px"
  128. >
  129. <el-form-item label="车牌号:">
  130. <el-autocomplete
  131. class="inline-input"
  132. v-model="capacityName"
  133. :fetch-suggestions="querySearchCapacity"
  134. placeholder="车牌号"
  135. :trigger-on-focus="false"
  136. @select="handleSelectCapacity"
  137. >
  138. <template slot-scope="{ item }">
  139. <div class="name">{{ item.capacityNumber }}</div>
  140. </template>
  141. </el-autocomplete>
  142. </el-form-item>
  143. </el-form>
  144. </div>
  145. <div class="poundNo from">
  146. <span class="text">运输订单号:</span>
  147. <el-input v-model="orderNumber" disabled></el-input>
  148. </div>
  149. <div class="poundNo from">
  150. <span class="text">路段顺序号:</span>
  151. <el-input v-model="lineQuence" @input="oninput"></el-input>
  152. </div>
  153. <div class="button_box">
  154. <el-button
  155. type="primary"
  156. @click="updateLineSqe"
  157. :disabled="disabled"
  158. >确认</el-button
  159. >
  160. </div>
  161. </div>
  162. </el-tab-pane>
  163. <el-tab-pane label="删除多余实绩" name="third">
  164. <div class="admin2">
  165. <div class="carrier from">
  166. <el-form
  167. :inline="true"
  168. class="demo-form-inline"
  169. label-width="80px"
  170. >
  171. <el-form-item label="车牌号:">
  172. <el-autocomplete
  173. class="inline-input"
  174. v-model="capacityName"
  175. :fetch-suggestions="querySearchCapacity"
  176. placeholder="车牌号"
  177. :trigger-on-focus="false"
  178. @select="handleSelectCapacity"
  179. >
  180. <template slot-scope="{ item }">
  181. <div class="name">{{ item.capacityNumber }}</div>
  182. </template>
  183. </el-autocomplete>
  184. </el-form-item>
  185. </el-form>
  186. </div>
  187. <div class="poundNo from">
  188. <span class="text">运输订单号:</span>
  189. <el-input v-model="orderNumber" disabled></el-input>
  190. </div>
  191. <div class="button_box">
  192. <el-button
  193. type="primary"
  194. @click="deleteMoreResult"
  195. :disabled="disabled"
  196. >确认</el-button
  197. >
  198. </div>
  199. </div>
  200. </el-tab-pane>
  201. <el-tab-pane label="手动车辆排队" name="fourth">
  202. <div class="admin2">
  203. <div class="carrier from">
  204. <el-form
  205. :inline="true"
  206. class="demo-form-inline"
  207. label-width="80px"
  208. >
  209. <el-form-item label="车牌号:">
  210. <el-autocomplete
  211. class="inline-input"
  212. v-model="capacityName"
  213. :fetch-suggestions="querySearchCapacity"
  214. placeholder="车牌号"
  215. :trigger-on-focus="false"
  216. @select="handleSelectCapacity"
  217. >
  218. <template slot-scope="{ item }">
  219. <div class="name">{{ item.capacityNumber }}</div>
  220. </template>
  221. </el-autocomplete>
  222. </el-form-item>
  223. </el-form>
  224. </div>
  225. <div class="poundNo from">
  226. <span class="text">运输订单号:</span>
  227. <el-input v-model="orderNumber" disabled></el-input>
  228. </div>
  229. <div class="button_box">
  230. <el-button
  231. type="primary"
  232. @click="queueClick"
  233. :disabled="disabled"
  234. >确认</el-button
  235. >
  236. </div>
  237. </div>
  238. </el-tab-pane>
  239. <el-tab-pane label="钢材车辆手动放行" name="fifth">
  240. <div class="admin2">
  241. <div class="carrier from">
  242. <el-form
  243. :inline="true"
  244. class="demo-form-inline"
  245. label-width="80px"
  246. >
  247. <el-form-item label="车牌号:">
  248. <el-autocomplete
  249. class="inline-input"
  250. v-model="capacityName"
  251. :fetch-suggestions="querySearchCapacity"
  252. placeholder="车牌号"
  253. :trigger-on-focus="false"
  254. @select="handleSelectCapacity"
  255. >
  256. <template slot-scope="{ item }">
  257. <div class="name">{{ item.capacityNumber }}</div>
  258. </template>
  259. </el-autocomplete>
  260. </el-form-item>
  261. </el-form>
  262. </div>
  263. <div class="poundNo from">
  264. <span class="text">运输订单号:</span>
  265. <el-input v-model="orderNumber" disabled></el-input>
  266. </div>
  267. <div class="button_box">
  268. <el-button
  269. type="primary"
  270. @click="allowEnfactoryClick"
  271. :disabled="disabled"
  272. >确认</el-button
  273. >
  274. </div>
  275. </div>
  276. </el-tab-pane>
  277. </el-tabs>
  278. </div>
  279. </template>
  280. </div>
  281. </template>
  282. <script>
  283. import { toDateString, toDateNo } from "../app.js";
  284. export default {
  285. data() {
  286. return {
  287. orderNumber: null,
  288. first: true,
  289. second: true,
  290. activeName: "first",
  291. capacityName: null,
  292. stateCapacity: null,
  293. materialList: [],
  294. capacityId: null,
  295. materialId: null,
  296. value1: null,
  297. value2: null,
  298. disabled: false,
  299. orderId: null,
  300. firstWeight: null,
  301. secondWeight: null,
  302. netWeight: null,
  303. poundNo: null,
  304. truckCalFirstList: [],
  305. truckCalSecondList: [],
  306. truckCalFirst: null,
  307. truckCalSecond: null,
  308. switchValue: true,
  309. truckCalFirstNum: null,
  310. truckCalSecondNum: null,
  311. lineQuence: null
  312. };
  313. },
  314. created() {
  315. this.value1 = new Date();
  316. this.value2 = new Date();
  317. },
  318. mounted() {
  319. this.information();
  320. },
  321. methods: {
  322. allowEnfactoryClick() {},
  323. queueClick() {
  324. this.axios
  325. .post("/api/v1/qms/addQueueResult?vno=" + this.capacityName)
  326. .then(res => {
  327. if (res.data.code == 200) {
  328. this.$message.success("操作成功");
  329. this.$router.go(0);
  330. }
  331. });
  332. },
  333. deleteMoreResult() {
  334. console.log(this.orderNumber);
  335. this.axios
  336. .post("/api/v1/bp/deleteErrorResult?orderNumber=" + this.orderNumber)
  337. .then(res => {
  338. if (res.data.code == "200") {
  339. this.$message.success("删除成功");
  340. }
  341. });
  342. },
  343. updateLineSqe() {
  344. let map = {
  345. orderId: this.orderId,
  346. orderLineSqe: this.lineQuence
  347. };
  348. this.axios.post("/api/v1/uc/updateLineSqe", map).then(res => {
  349. console.log(res.data);
  350. if (res.data.code == "200") {
  351. this.$message.success("修改路段顺序号成功");
  352. this.$router.go(0);
  353. }
  354. });
  355. },
  356. oninput() {},
  357. onchange() {
  358. if (this.switchValue) {
  359. this.first = true;
  360. this.second = true;
  361. } else {
  362. this.second = false;
  363. }
  364. },
  365. onchange1() {
  366. console.log(this.truckCalFirst);
  367. this.truckCalFirstList.forEach(e => {
  368. if (this.truckCalFirst == e.value) {
  369. this.truckCalFirstNum = e.label;
  370. }
  371. });
  372. },
  373. onchange2() {
  374. this.truckCalSecondList.forEach(e => {
  375. if (this.truckCalSecond == e.value) {
  376. this.truckCalSecondNum = e.label;
  377. }
  378. });
  379. },
  380. //运力弹出层
  381. handleSelectCapacity(item) {
  382. this.capacityId = item.capacityId;
  383. this.capacityName = item.capacityNumber;
  384. this.axios
  385. .get("/api/v1/uc/getOrderNumber?capacityId=" + this.capacityId)
  386. .then(res => {
  387. if (res.data.code == "200") {
  388. this.orderId = res.data.data.orderId;
  389. this.orderNumber = res.data.data.orderNumber;
  390. this.axios
  391. .get("/api/v1/uc/getMaterialIdByOrderId?orderId=" + this.orderId)
  392. .then(res => {
  393. if (res.data.code == "200") {
  394. this.materialList = res.data.data;
  395. }
  396. });
  397. }
  398. });
  399. },
  400. //以下是运力边输边查搜索
  401. querySearchCapacity(queryString, cb) {
  402. if (queryString.length < 3) {
  403. return;
  404. }
  405. this.axios
  406. .get("/api/v1/uc/getCapacityNumber?index=" + queryString)
  407. .then(res => {
  408. if (res.data.code == "200") {
  409. var restaurantsCarrier = res.data.data;
  410. console.log(restaurantsCarrier, "restaurantsCarrier");
  411. var results = queryString
  412. ? restaurantsCarrier.filter(this.createFilterCarrier(queryString))
  413. : restaurantsCarrier;
  414. // 调用 callback 返回建议列表的数据
  415. cb(results);
  416. }
  417. });
  418. },
  419. createFilterCarrier(queryString) {
  420. return restaurantsCarrier => {
  421. return (
  422. restaurantsCarrier.capacityNumber
  423. .toLowerCase()
  424. .indexOf(queryString.toLowerCase()) > -1
  425. );
  426. };
  427. },
  428. //以上是承运商边输边查搜索
  429. information() {
  430. this.axios.get("/api/v1/uc/getAllCalculateMes").then(res => {
  431. this.truckCalFirstList = res.data;
  432. this.truckCalSecondList = res.data;
  433. });
  434. },
  435. onClickConfirm() {
  436. this.poundNo = "jlbl" + toDateNo(new Date());
  437. if (this.switchValue) {
  438. if (
  439. this.orderNumber == null ||
  440. this.truckCalFirst == null ||
  441. this.truckCalSecond == null ||
  442. this.firstWeight == null ||
  443. this.secondWeight == null ||
  444. this.value1 == null ||
  445. this.value2 == null ||
  446. this.materialId == null
  447. ) {
  448. this.$message.warning("请填写所有值!!!");
  449. return;
  450. }
  451. } else {
  452. if (
  453. this.orderNumber == null ||
  454. this.truckCalFirst == null ||
  455. this.firstWeight == null ||
  456. this.value1 == null ||
  457. this.materialId == null
  458. ) {
  459. this.$message.warning("请填写所有值!!!");
  460. return;
  461. }
  462. }
  463. let mapFirst = {
  464. orderNumber: this.orderNumber,
  465. resultTareCalculateNumber: this.truckCalFirstNum,
  466. resultTareWeight: this.firstWeight + "",
  467. resultTareWeightTime: toDateString(this.value1),
  468. resultPoundNo: this.poundNo,
  469. materialId: this.materialId + ""
  470. };
  471. //如果首次大于二次,那么是先毛后皮,首次放在毛重上面,二次放在皮重上面
  472. if (this.firstWeight >= this.secondWeight) {
  473. var mapSecond = {
  474. orderNumber: this.orderNumber,
  475. resultTareCalculateNumber: this.truckCalSecondNum,
  476. resultCrossCalculateNumber: this.truckCalFirstNum,
  477. resultTareWeight: this.secondWeight + "",
  478. resultCrossWeight: this.firstWeight + "",
  479. resultNetWeight:
  480. Math.abs(this.firstWeight - this.secondWeight).toFixed(2) + "",
  481. resultTareWeightTime: toDateString(this.value2),
  482. resultCrossWeightTime: toDateString(this.value1),
  483. resultPoundNo: this.poundNo,
  484. materialId: this.materialId + ""
  485. };
  486. } else {
  487. //如果首次小于二次,那么是先皮后毛,首次放在皮重上面,二次放在毛重上面
  488. var mapSecond = {
  489. orderNumber: this.orderNumber,
  490. resultTareCalculateNumber: this.truckCalFirstNum,
  491. resultCrossCalculateNumber: this.truckCalSecondNum,
  492. resultTareWeight: this.firstWeight + "",
  493. resultCrossWeight: this.secondWeight + "",
  494. resultNetWeight:
  495. Math.abs(this.secondWeight - this.firstWeight).toFixed(2) + "",
  496. resultTareWeightTime: toDateString(this.value1),
  497. resultCrossWeightTime: toDateString(this.value2),
  498. resultPoundNo: this.poundNo,
  499. materialId: this.materialId + ""
  500. };
  501. }
  502. var arr = [];
  503. if (this.switchValue) {
  504. arr.push(mapSecond);
  505. } else {
  506. arr.push(mapFirst);
  507. }
  508. this.axios.post("/api/v1/uc/recordingWeightResult", arr).then(res => {
  509. this.$message.success("补录计量实绩成功");
  510. this.$router.go(0);
  511. });
  512. },
  513. onClickCancel() {}
  514. }
  515. };
  516. </script>
  517. <style lang="scss">
  518. .admin {
  519. .admin1 {
  520. margin-top: 40px;
  521. margin-left: 40px;
  522. .switch {
  523. display: flex;
  524. justify-content: center;
  525. align-items: center;
  526. margin-top: 20px;
  527. color: aqua;
  528. }
  529. .button_box {
  530. display: flex;
  531. justify-content: center;
  532. align-items: center;
  533. width: 100%;
  534. height: 100px;
  535. }
  536. .admin2 {
  537. margin-top: 40px;
  538. .from {
  539. display: flex;
  540. align-items: center;
  541. justify-content: center;
  542. margin-top: 20px;
  543. margin-bottom: 20px;
  544. }
  545. .carrier {
  546. display: flex;
  547. justify-content: center;
  548. align-items: center;
  549. .el-form-item {
  550. text-align: right;
  551. }
  552. .el-autocomplete {
  553. width: 250px;
  554. }
  555. }
  556. .material {
  557. display: flex;
  558. justify-content: center;
  559. margin-top: 20px;
  560. margin-right: 100px;
  561. .text {
  562. display: inline-block;
  563. width: 170px;
  564. text-align: right;
  565. }
  566. .el-input {
  567. width: 250px;
  568. }
  569. }
  570. .poundNo {
  571. display: flex;
  572. justify-content: center;
  573. align-items: center;
  574. margin-top: 20px;
  575. margin-right: 100px;
  576. .text {
  577. display: inline-block;
  578. width: 170px;
  579. text-align: right;
  580. }
  581. .el-input {
  582. width: 250px;
  583. }
  584. }
  585. .block {
  586. display: flex;
  587. justify-content: center;
  588. align-items: center;
  589. margin-top: 20px;
  590. margin-right: 100px;
  591. .el-input {
  592. width: 250px;
  593. }
  594. .text {
  595. display: inline-block;
  596. width: 170px;
  597. text-align: right;
  598. }
  599. }
  600. .truckCalFirst {
  601. display: flex;
  602. justify-content: center;
  603. margin-top: 20px;
  604. margin-right: 100px;
  605. .text {
  606. display: inline-block;
  607. width: 170px;
  608. text-align: right;
  609. }
  610. .el-input {
  611. width: 250px;
  612. }
  613. }
  614. .truckCalSecond {
  615. display: flex;
  616. justify-content: center;
  617. margin-top: 20px;
  618. margin-right: 100px;
  619. .text {
  620. display: inline-block;
  621. width: 170px;
  622. text-align: right;
  623. }
  624. .el-input {
  625. width: 250px;
  626. }
  627. }
  628. .secondWeight {
  629. display: flex;
  630. justify-content: center;
  631. align-items: center;
  632. margin-top: 20px;
  633. margin-right: 100px;
  634. .text {
  635. display: inline-block;
  636. width: 170px;
  637. text-align: right;
  638. }
  639. .el-input {
  640. width: 250px;
  641. }
  642. }
  643. .firstWeight {
  644. display: flex;
  645. justify-content: center;
  646. align-items: center;
  647. margin-top: 20px;
  648. margin-right: 100px;
  649. .text {
  650. display: inline-block;
  651. width: 170px;
  652. text-align: right;
  653. }
  654. .el-input {
  655. width: 250px;
  656. }
  657. }
  658. .netWeight {
  659. display: flex;
  660. justify-content: center;
  661. align-items: center;
  662. margin-top: 20px;
  663. margin-right: 100px;
  664. .text {
  665. display: inline-block;
  666. width: 170px;
  667. text-align: right;
  668. }
  669. .el-input {
  670. width: 250px;
  671. }
  672. }
  673. }
  674. }
  675. }
  676. </style>