ADMINISTRATORS1.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  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-tab-pane label="车辆手动进厂" name="sixth">
  278. <div class="admin2">
  279. <div class="carrier from">
  280. <el-form
  281. :inline="true"
  282. class="demo-form-inline"
  283. label-width="80px"
  284. >
  285. <el-form-item label="车牌号:">
  286. <el-autocomplete
  287. class="inline-input"
  288. v-model="capacityName"
  289. :fetch-suggestions="querySearchCapacity"
  290. placeholder="车牌号"
  291. :trigger-on-focus="false"
  292. @select="handleSelectCapacity"
  293. >
  294. <template slot-scope="{ item }">
  295. <div class="name">{{ item.capacityNumber }}</div>
  296. </template>
  297. </el-autocomplete>
  298. </el-form-item>
  299. </el-form>
  300. </div>
  301. <div class="poundNo from">
  302. <span class="text">运输订单号:</span>
  303. <el-input v-model="orderNumber" disabled></el-input>
  304. </div>
  305. <span class="text">进厂门岗:</span>
  306. <el-select
  307. v-model="enFactoryGatepost"
  308. placeholder="请选择"
  309. @change="onchangeGatepost(enFactoryGatepost)"
  310. >
  311. <el-option
  312. v-for="item in gatePostList"
  313. :key="item.gatepostId"
  314. :label="item.gatepostName"
  315. :value="item.gatepostName"
  316. >
  317. </el-option>
  318. </el-select>
  319. <div class="button_box">
  320. <el-button
  321. type="primary"
  322. @click="enFactoryResultByPDA"
  323. :disabled="disabled"
  324. >确认</el-button
  325. >
  326. </div>
  327. </div>
  328. </el-tab-pane>
  329. </el-tabs>
  330. </div>
  331. </template>
  332. </div>
  333. </template>
  334. <script>
  335. import { toDateString, toDateNo } from "../app.js";
  336. export default {
  337. data() {
  338. return {
  339. orderNumber: null,
  340. first: true,
  341. second: true,
  342. activeName: "first",
  343. capacityName: null,
  344. stateCapacity: null,
  345. materialList: [],
  346. capacityId: null,
  347. materialId: null,
  348. value1: null,
  349. value2: null,
  350. disabled: false,
  351. orderId: null,
  352. firstWeight: null,
  353. secondWeight: null,
  354. netWeight: null,
  355. poundNo: null,
  356. truckCalFirstList: [],
  357. truckCalSecondList: [],
  358. truckCalFirst: null,
  359. truckCalSecond: null,
  360. switchValue: true,
  361. truckCalFirstNum: null,
  362. truckCalSecondNum: null,
  363. lineQuence: null,
  364. gatePostList: [],
  365. enFactoryGatepost: null,
  366. gatePostId: null
  367. };
  368. },
  369. created() {
  370. this.value1 = new Date();
  371. this.value2 = new Date();
  372. },
  373. mounted() {
  374. this.information();
  375. },
  376. methods: {
  377. onchangeGatepost(value) {
  378. console.log(value);
  379. this.gatePostList.forEach(e => {
  380. if (e.gatepostName == value) {
  381. this.gatePostId = e.gatePostId;
  382. }
  383. });
  384. },
  385. enFactoryResultByPDA() {
  386. let map = {
  387. orderNumber: this.orderNumber + " ",
  388. gatepostId: this.gatePostId
  389. };
  390. this.axios.post("");
  391. },
  392. allowEnfactoryClick() {},
  393. queueClick() {
  394. this.axios
  395. .post("/api/v1/qms/addQueueResult?vno=" + this.capacityName + "_")
  396. .then(res => {
  397. if (res.data.code == 200) {
  398. this.$message.success("操作成功");
  399. this.$router.go(0);
  400. }
  401. });
  402. },
  403. deleteMoreResult() {
  404. console.log(this.orderNumber);
  405. this.axios
  406. .post("/api/v1/bp/deleteErrorResult?orderNumber=" + this.orderNumber)
  407. .then(res => {
  408. if (res.data.code == "200") {
  409. this.$message.success("删除成功");
  410. }
  411. });
  412. },
  413. updateLineSqe() {
  414. let map = {
  415. orderId: this.orderId,
  416. orderLineSqe: this.lineQuence
  417. };
  418. this.axios.post("/api/v1/uc/updateLineSqe", map).then(res => {
  419. console.log(res.data);
  420. if (res.data.code == "200") {
  421. this.$message.success("修改路段顺序号成功");
  422. this.$router.go(0);
  423. }
  424. });
  425. },
  426. oninput() {},
  427. onchange() {
  428. if (this.switchValue) {
  429. this.first = true;
  430. this.second = true;
  431. } else {
  432. this.second = false;
  433. }
  434. },
  435. onchange1() {
  436. console.log(this.truckCalFirst);
  437. this.truckCalFirstList.forEach(e => {
  438. if (this.truckCalFirst == e.value) {
  439. this.truckCalFirstNum = e.label;
  440. }
  441. });
  442. },
  443. onchange2() {
  444. this.truckCalSecondList.forEach(e => {
  445. if (this.truckCalSecond == e.value) {
  446. this.truckCalSecondNum = e.label;
  447. }
  448. });
  449. },
  450. //运力弹出层
  451. handleSelectCapacity(item) {
  452. this.capacityId = item.capacityId;
  453. this.capacityName = item.capacityNumber;
  454. this.axios
  455. .get("/api/v1/uc/getOrderNumber?capacityId=" + this.capacityId)
  456. .then(res => {
  457. if (res.data.code == "200") {
  458. this.orderId = res.data.data.orderId;
  459. this.orderNumber = res.data.data.orderNumber;
  460. this.axios
  461. .get("/api/v1/uc/getMaterialIdByOrderId?orderId=" + this.orderId)
  462. .then(res => {
  463. if (res.data.code == "200") {
  464. this.materialList = res.data.data;
  465. }
  466. });
  467. }
  468. });
  469. },
  470. //以下是运力边输边查搜索
  471. querySearchCapacity(queryString, cb) {
  472. if (queryString.length < 3) {
  473. return;
  474. }
  475. this.axios
  476. .get("/api/v1/uc/getCapacityNumber?index=" + queryString)
  477. .then(res => {
  478. if (res.data.code == "200") {
  479. var restaurantsCarrier = res.data.data;
  480. console.log(restaurantsCarrier, "restaurantsCarrier");
  481. var results = queryString
  482. ? restaurantsCarrier.filter(this.createFilterCarrier(queryString))
  483. : restaurantsCarrier;
  484. // 调用 callback 返回建议列表的数据
  485. cb(results);
  486. }
  487. });
  488. },
  489. createFilterCarrier(queryString) {
  490. return restaurantsCarrier => {
  491. return (
  492. restaurantsCarrier.capacityNumber
  493. .toLowerCase()
  494. .indexOf(queryString.toLowerCase()) > -1
  495. );
  496. };
  497. },
  498. //以上是承运商边输边查搜索
  499. information() {
  500. this.axios.get("/api/v1/uc/getAllCalculateMes").then(res => {
  501. this.truckCalFirstList = res.data;
  502. this.truckCalSecondList = res.data;
  503. });
  504. this.axios.get("/api/v1/uc/getAllGatepost").then(res => {
  505. console.log(res);
  506. this.gatePostList = res.data;
  507. });
  508. },
  509. onClickConfirm() {
  510. this.poundNo = "jlbl" + toDateNo(new Date());
  511. if (this.switchValue) {
  512. if (
  513. this.orderNumber == null ||
  514. this.truckCalFirst == null ||
  515. this.truckCalSecond == null ||
  516. this.firstWeight == null ||
  517. this.secondWeight == null ||
  518. this.value1 == null ||
  519. this.value2 == null ||
  520. this.materialId == null
  521. ) {
  522. this.$message.warning("请填写所有值!!!");
  523. return;
  524. }
  525. } else {
  526. if (
  527. this.orderNumber == null ||
  528. this.truckCalFirst == null ||
  529. this.firstWeight == null ||
  530. this.value1 == null ||
  531. this.materialId == null
  532. ) {
  533. this.$message.warning("请填写所有值!!!");
  534. return;
  535. }
  536. }
  537. let mapFirst = {
  538. orderNumber: this.orderNumber,
  539. resultTareCalculateNumber: this.truckCalFirstNum,
  540. resultTareWeight: this.firstWeight + "",
  541. resultTareWeightTime: toDateString(this.value1),
  542. resultPoundNo: this.poundNo,
  543. materialId: this.materialId + ""
  544. };
  545. //如果首次大于二次,那么是先毛后皮,首次放在毛重上面,二次放在皮重上面
  546. if (this.firstWeight >= this.secondWeight) {
  547. var mapSecond = {
  548. orderNumber: this.orderNumber,
  549. resultTareCalculateNumber: this.truckCalSecondNum,
  550. resultCrossCalculateNumber: this.truckCalFirstNum,
  551. resultTareWeight: this.secondWeight + "",
  552. resultCrossWeight: this.firstWeight + "",
  553. resultNetWeight:
  554. Math.abs(this.firstWeight - this.secondWeight).toFixed(2) + "",
  555. resultTareWeightTime: toDateString(this.value2),
  556. resultCrossWeightTime: toDateString(this.value1),
  557. resultPoundNo: this.poundNo,
  558. materialId: this.materialId + ""
  559. };
  560. } else {
  561. //如果首次小于二次,那么是先皮后毛,首次放在皮重上面,二次放在毛重上面
  562. var mapSecond = {
  563. orderNumber: this.orderNumber,
  564. resultTareCalculateNumber: this.truckCalFirstNum,
  565. resultCrossCalculateNumber: this.truckCalSecondNum,
  566. resultTareWeight: this.firstWeight + "",
  567. resultCrossWeight: this.secondWeight + "",
  568. resultNetWeight:
  569. Math.abs(this.secondWeight - this.firstWeight).toFixed(2) + "",
  570. resultTareWeightTime: toDateString(this.value1),
  571. resultCrossWeightTime: toDateString(this.value2),
  572. resultPoundNo: this.poundNo,
  573. materialId: this.materialId + ""
  574. };
  575. }
  576. var arr = [];
  577. if (this.switchValue) {
  578. arr.push(mapSecond);
  579. } else {
  580. arr.push(mapFirst);
  581. }
  582. this.axios.post("/api/v1/uc/recordingWeightResult", arr).then(res => {
  583. this.$message.success("补录计量实绩成功");
  584. this.$router.go(0);
  585. });
  586. },
  587. onClickCancel() {}
  588. }
  589. };
  590. </script>
  591. <style lang="scss">
  592. .admin {
  593. .admin1 {
  594. margin-top: 40px;
  595. margin-left: 40px;
  596. .switch {
  597. display: flex;
  598. justify-content: center;
  599. align-items: center;
  600. margin-top: 20px;
  601. color: aqua;
  602. }
  603. .button_box {
  604. display: flex;
  605. justify-content: center;
  606. align-items: center;
  607. width: 100%;
  608. height: 100px;
  609. }
  610. .admin2 {
  611. margin-top: 40px;
  612. .from {
  613. display: flex;
  614. align-items: center;
  615. justify-content: center;
  616. margin-top: 20px;
  617. margin-bottom: 20px;
  618. }
  619. .carrier {
  620. display: flex;
  621. justify-content: center;
  622. align-items: center;
  623. .el-form-item {
  624. text-align: right;
  625. }
  626. .el-autocomplete {
  627. width: 250px;
  628. }
  629. }
  630. .material {
  631. display: flex;
  632. justify-content: center;
  633. margin-top: 20px;
  634. margin-right: 100px;
  635. .text {
  636. display: inline-block;
  637. width: 170px;
  638. text-align: right;
  639. }
  640. .el-input {
  641. width: 250px;
  642. }
  643. }
  644. .poundNo {
  645. display: flex;
  646. justify-content: center;
  647. align-items: center;
  648. margin-top: 20px;
  649. margin-right: 100px;
  650. .text {
  651. display: inline-block;
  652. width: 170px;
  653. text-align: right;
  654. }
  655. .el-input {
  656. width: 250px;
  657. }
  658. }
  659. .block {
  660. display: flex;
  661. justify-content: center;
  662. align-items: center;
  663. margin-top: 20px;
  664. margin-right: 100px;
  665. .el-input {
  666. width: 250px;
  667. }
  668. .text {
  669. display: inline-block;
  670. width: 170px;
  671. text-align: right;
  672. }
  673. }
  674. .truckCalFirst {
  675. display: flex;
  676. justify-content: center;
  677. margin-top: 20px;
  678. margin-right: 100px;
  679. .text {
  680. display: inline-block;
  681. width: 170px;
  682. text-align: right;
  683. }
  684. .el-input {
  685. width: 250px;
  686. }
  687. }
  688. .truckCalSecond {
  689. display: flex;
  690. justify-content: center;
  691. margin-top: 20px;
  692. margin-right: 100px;
  693. .text {
  694. display: inline-block;
  695. width: 170px;
  696. text-align: right;
  697. }
  698. .el-input {
  699. width: 250px;
  700. }
  701. }
  702. .secondWeight {
  703. display: flex;
  704. justify-content: center;
  705. align-items: center;
  706. margin-top: 20px;
  707. margin-right: 100px;
  708. .text {
  709. display: inline-block;
  710. width: 170px;
  711. text-align: right;
  712. }
  713. .el-input {
  714. width: 250px;
  715. }
  716. }
  717. .firstWeight {
  718. display: flex;
  719. justify-content: center;
  720. align-items: center;
  721. margin-top: 20px;
  722. margin-right: 100px;
  723. .text {
  724. display: inline-block;
  725. width: 170px;
  726. text-align: right;
  727. }
  728. .el-input {
  729. width: 250px;
  730. }
  731. }
  732. .netWeight {
  733. display: flex;
  734. justify-content: center;
  735. align-items: center;
  736. margin-top: 20px;
  737. margin-right: 100px;
  738. .text {
  739. display: inline-block;
  740. width: 170px;
  741. text-align: right;
  742. }
  743. .el-input {
  744. width: 250px;
  745. }
  746. }
  747. }
  748. }
  749. }
  750. </style>