queueFStart.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. // 排队开始
  2. <template>
  3. <div class="sale">
  4. <div class="top">
  5. <el-form :inline="true" style="margin-top: 1rem;">
  6. <el-form-item>
  7. <el-input
  8. v-model.trim="capacityNo"
  9. style="width:250px"
  10. placeholder="输入车牌号查询"
  11. clearable
  12. >
  13. </el-input>
  14. <el-button
  15. type="primary"
  16. class="btn"
  17. @click="onclick"
  18. style="margin-left: 4px;"
  19. clearable
  20. ><i class="el-icon-search"></i>查询车辆</el-button
  21. >
  22. </el-form-item>
  23. <el-form-item>
  24. <el-button
  25. type="primary"
  26. class="btn"
  27. @click="onclickMaterial"
  28. style="margin-left: 4px;"
  29. clearable
  30. ><i class="el-icon-search"></i>查询物资</el-button
  31. >
  32. </el-form-item>
  33. <el-form-item>
  34. <el-badge :value="redDotNum" class="item">
  35. <el-button type="primary" class="btn" @click="refresh">
  36. <i class="el-icon-refresh"></i>刷新
  37. </el-button>
  38. </el-badge>
  39. </el-form-item>
  40. <el-form-item
  41. ><el-button type="primary" class="btn" @click="allow">
  42. <i class="el-icon-d-arrow-right"></i>放行
  43. </el-button></el-form-item
  44. >
  45. <el-form-item
  46. ><el-button type="primary" class="btn" disabled>
  47. 厂内钢材车辆总数
  48. </el-button>
  49. <el-input disabled style="width:100px" v-model="steelOrderNum">
  50. </el-input>
  51. </el-form-item>
  52. </el-form>
  53. </div>
  54. <!-- 物资选择模态框 -->
  55. <el-drawer
  56. title="选择物资信息"
  57. :visible.sync="table1"
  58. direction="rtl"
  59. size="90%"
  60. :show-close="true"
  61. >
  62. <el-form :inline="true" style="margin-top: 0.5rem;">
  63. <el-form-item>
  64. <label class="el-form-item__label" style="width: auto;"
  65. >物资名称</label
  66. >
  67. </el-form-item>
  68. <el-form-item>
  69. <el-input
  70. placeholder="请输入内容"
  71. v-model="materialNameText"
  72. clearable
  73. ></el-input>
  74. </el-form-item>
  75. <el-form-item>
  76. <label class="el-form-item__label" style="width: auto;">规格</label>
  77. </el-form-item>
  78. <el-form-item>
  79. <el-input
  80. placeholder="请输入内容"
  81. v-model="materialSpecificationText"
  82. clearable
  83. ><template slot="prepend">Φ</template></el-input
  84. >
  85. </el-form-item>
  86. <el-button
  87. type="primary"
  88. class="btn"
  89. @click="onclickMaterial1"
  90. style="margin-left: 4px;"
  91. ><i class="el-icon-search"></i>查询</el-button
  92. >
  93. <el-button type="primary" @click="makeSureMaterial"
  94. ><i class="el-icon-check"></i>确定</el-button
  95. >
  96. </el-form>
  97. <div class="tablecls">
  98. <!-- 查询所有的物资 -->
  99. <dilTable
  100. v-bind.sync="optionMa"
  101. @selection-change="selectionChange2"
  102. @rowDbClick="rowDbClick"
  103. >
  104. </dilTable>
  105. </div>
  106. </el-drawer>
  107. <div class="tabs">
  108. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  109. <el-tab-pane label="单拼车辆排队链表" name="first">
  110. <el-table
  111. ref="mutiData"
  112. :data="tableData1"
  113. border
  114. :row-key="getRowKey"
  115. style="width: 100%; margin-top: 20px"
  116. @selection-change="handleSelectionChange"
  117. max-height="600px"
  118. >
  119. <el-table-column
  120. type="selection"
  121. width="55"
  122. :selectable="selectInit"
  123. reserve-selection
  124. ></el-table-column>
  125. <el-table-column type="index" width="50"> </el-table-column>
  126. <el-table-column prop="capacityNumber" label="车牌号" fit>
  127. </el-table-column>
  128. <el-table-column prop="consigneeName" label="客户" fit>
  129. </el-table-column>
  130. <el-table-column prop="materialName" label="物资名称">
  131. </el-table-column>
  132. <el-table-column prop="steelMeter" label="钢材长度">
  133. </el-table-column>
  134. <el-table-column prop="materialSpecification" label="规格型号">
  135. </el-table-column>
  136. <el-table-column prop="materialNumber" label="物资件数">
  137. </el-table-column>
  138. <el-table-column label="装货点" width="100">
  139. <template slot-scope="scope">
  140. <el-select size="mini" v-model="scope.row.id"
  141. @change="changePriority($event,scope.row.id)">
  142. <el-option
  143. v-for="item in option"
  144. :key="item.id"
  145. :label="item.value"
  146. :value="item.id"
  147. >
  148. </el-option>
  149. </el-select>
  150. </template>
  151. </el-table-column>
  152. <el-table-column prop="resultStartTime" label="排队开始时间">
  153. </el-table-column>
  154. <el-table-column
  155. prop="listNodeOrder"
  156. label="序号"
  157. ></el-table-column>
  158. <el-table-column prop="driverTel" label="司机电话号码">
  159. </el-table-column>
  160. <el-table-column prop="sureTime" label="可进厂确认时间">
  161. </el-table-column>
  162. <el-table-column prop="gatepostName" label="进厂门岗">
  163. </el-table-column>
  164. <el-table-column fixed="right" label="操作" width="180">
  165. <template slot-scope="scope">
  166. <el-button
  167. type="text"
  168. size="mini"
  169. @click="ctrlZQueueAllow(scope)"
  170. >
  171. 撤销放行
  172. </el-button>
  173. <el-button type="text" size="mini" @click="updateBill(scope)">
  174. 修改提货单
  175. </el-button>
  176. </template>
  177. </el-table-column>
  178. </el-table>
  179. </el-tab-pane>
  180. <el-tab-pane label="多拼车辆排队链表" name="second">
  181. <el-table
  182. :data="tableData"
  183. :span-method="objectSpanMethod"
  184. border
  185. style="width: 100%; margin-top: 20px"
  186. @selection-change="handleSelectionChange"
  187. max-height="500px"
  188. >
  189. <el-table-column type="selection" width="55"></el-table-column>
  190. <el-table-column prop="capacityNumber" label="车牌号" fit>
  191. </el-table-column>
  192. <el-table-column prop="consigneeName" label="客户" fit>
  193. </el-table-column>
  194. <el-table-column prop="materialName" label="物资名称">
  195. </el-table-column>
  196. <el-table-column prop="steelMeter" label="钢材长度">
  197. </el-table-column>
  198. <el-table-column prop="materialSpecification" label="规格型号">
  199. </el-table-column>
  200. <el-table-column prop="materialNumber" label="物资件数">
  201. </el-table-column>
  202. <el-table-column label="装货点" width="100">
  203. <template slot-scope="scope">
  204. <el-select size="mini" v-model="scope.row.id">
  205. <el-option
  206. v-for="item in option"
  207. :key="item.id"
  208. :label="item.value"
  209. :value="item.id"
  210. >
  211. </el-option>
  212. </el-select>
  213. </template>
  214. </el-table-column>
  215. <el-table-column prop="grid" label="拼数" fit> </el-table-column>
  216. <el-table-column prop="resultStartTime" label="排队开始时间">
  217. </el-table-column>
  218. <el-table-column
  219. prop="listNodeOrder"
  220. label="序号"
  221. ></el-table-column>
  222. <el-table-column prop="driverTel" label="司机电话号码">
  223. </el-table-column>
  224. <el-table-column prop="gatepostName" label="进厂门岗">
  225. </el-table-column>
  226. <el-table-column prop="sureTime" label="可进厂确认时间">
  227. </el-table-column>
  228. <el-table-column fixed="right" label="操作" width="180">
  229. <template slot-scope="scope">
  230. <el-button
  231. type="text"
  232. size="mini"
  233. @click="ctrlZQueueAllow(scope)"
  234. >
  235. 撤销放行
  236. </el-button>
  237. <el-button type="text" size="mini" @click="updateBill(scope)">
  238. 修改提货单
  239. </el-button>
  240. </template>
  241. </el-table-column>
  242. </el-table>
  243. </el-tab-pane>
  244. <el-tab-pane label="仓库排队列表" name="third">
  245. <el-table
  246. :data="tableData3"
  247. border
  248. style="width: 100%; margin-top: 20px"
  249. max-height="500px"
  250. >
  251. <el-table-column prop="warehouseName" label="仓库" fit></el-table-column>
  252. <el-table-column prop="carQueue" label="排队车辆"></el-table-column>
  253. </el-table>
  254. </el-tab-pane>
  255. </el-tabs>
  256. </div>
  257. </div>
  258. </template>
  259. <script>
  260. import { getCookie } from "@/utils/util.js";
  261. export default {
  262. data() {
  263. return {
  264. capacityNo: "",
  265. inputText: "",
  266. option1: {
  267. // 表格请求数据的地址
  268. requestUrl: "",
  269. selectionType: "select"
  270. },
  271. optionMa: {
  272. // 表格请求数据的地址
  273. requestUrl: "",
  274. // 控制显示多选列
  275. selectionType: "select"
  276. },
  277. activeName: "first",
  278. tableData: [],
  279. tableData1: [],
  280. tableData3: [],
  281. //存放每一行记录的合并数
  282. spanArr: [],
  283. maplist: [],
  284. id: null,
  285. option: [],
  286. filterArr1: [],
  287. table1: false,
  288. //物资选中表格
  289. materialList: [],
  290. //物资选中暂存
  291. materialList1: [],
  292. //物资信息查询内容
  293. materialNameText: null,
  294. materialSpecificationText: null,
  295. materialModelText: null,
  296. timer: null,
  297. totalQueueNum: null,
  298. redDotNum: null,
  299. i: 0,
  300. totalQueueNumFirst: null,
  301. //厂内钢材车辆总数
  302. steelOrderNum: 0
  303. };
  304. },
  305. mounted() {
  306. this.i = 0;
  307. this.infomation();
  308. this.getSpellingArray();
  309. this.getNoSpellingArray();
  310. this.getStoreArray();
  311. this.getSteelOrderNum();
  312. this.wantEnfactory();
  313. this.start();
  314. },
  315. computed: {
  316. wantS() {
  317. return this.totalQueueNum;
  318. }
  319. },
  320. beforeDestroy() {
  321. this.timer;
  322. },
  323. watch: {
  324. wantS() {
  325. if (this.totalQueueNum - this.totalQueueNumFirst > 0) {
  326. this.redDotNum = this.totalQueueNum - this.totalQueueNumFirst;
  327. }
  328. }
  329. },
  330. methods: {
  331. ctrlZQueueAllow(scope) {
  332. let map = {
  333. listId: scope.row.listId,
  334. resultTotalId: scope.row.resultTotalId
  335. };
  336. console.log(map);
  337. this.axios.post("/api/v1/qms/ctrlZQueueAllow", map).then(res => {
  338. if (res.data.code == 200) {
  339. this.$message.success("撤销成功");
  340. this.getNoSpellingArray();
  341. this.getSpellingArray();
  342. } else {
  343. this.$message.error("撤单失败");
  344. }
  345. });
  346. },
  347. wantEnfactory() {
  348. this.axios.get("/api/v1/uc/getQueueCount").then(res => {
  349. this.totalQueueNum = res.data.data;
  350. console.log(this.totalQueueNum, "totalQueueNum");
  351. if (this.i == 0) {
  352. this.totalQueueNumFirst = this.totalQueueNum;
  353. }
  354. this.i++;
  355. });
  356. },
  357. start() {
  358. this.timer = setInterval(this.wantEnfactory, 60000);
  359. },
  360. refresh() {
  361. this.getSpellingArray();
  362. this.getNoSpellingArray();
  363. this.getSteelOrderNum();
  364. this.getStoreArray();
  365. this.redDotNum = null;
  366. this.totalQueueNum = null;
  367. this.totalQueueNumFirst = null;
  368. this.i = 0;
  369. clearInterval(this.timer);
  370. this.start();
  371. },
  372. getSteelOrderNum() {
  373. this.axios.get("/api/v1/uc/getSteelOrderNum").then(res => {
  374. this.steelOrderNum = res.data.data;
  375. });
  376. },
  377. getRowKey(row) {
  378. return row.ROW_ID;
  379. },
  380. selectInit(row) {
  381. if (this.maplist.length == 0) {
  382. if (row.ROW_ID == 1) {
  383. return true;
  384. } else {
  385. return false;
  386. }
  387. } else {
  388. if (
  389. this.maplist.some(e => {
  390. return e.ROW_ID == row.ROW_ID || e.ROW_ID + 1 == row.ROW_ID;
  391. })
  392. ) {
  393. return true;
  394. } else {
  395. return false;
  396. }
  397. }
  398. },
  399. rowDbClick(row) {
  400. this.materialList = [];
  401. this.materialList.push(row);
  402. this.makeSureMaterial();
  403. },
  404. //物资模态框查询
  405. onclickMaterial1() {
  406. this.optionMa.requestUrl =
  407. "/api/v1/uc/getSteelMaterial?apiId=244&materialNameText=" +
  408. this.materialNameText +
  409. "&materialSpecificationText=" +
  410. this.materialSpecificationText;
  411. },
  412. onclickMaterial() {
  413. this.table1 = true;
  414. this.optionMa.requestUrl =
  415. "/api/v1/uc/getSteelMaterial?apiId=244&i=" + new Date();
  416. },
  417. //返回选中的物资信息
  418. selectionChange2(selection) {
  419. this.materialList1 = [];
  420. this.materialList1 = selection;
  421. this.materialList = this.materialList.concat(this.materialList1);
  422. },
  423. makeSureMaterial() {
  424. console.log(this.materialList);
  425. var materialIdList = [];
  426. this.materialList.forEach(e => {
  427. if (materialIdList.indexOf(e.materialId) == -1) {
  428. materialIdList.push(e.materialId);
  429. }
  430. });
  431. let map = {
  432. materialList: materialIdList
  433. };
  434. this.materialList = [];
  435. this.materialList1 = [];
  436. if (this.activeName == "first") {
  437. this.axios
  438. .post("/api/v1/qms/getQueueListByQueueUp?isSpelling=0", map)
  439. .then(res => {
  440. this.tableData1 = res.data.data;
  441. });
  442. } else {
  443. this.axios
  444. .post("/api/v1/qms/getQueueListByQueueUp?apiId=473&isSpelling=1", map)
  445. .then(res => {
  446. this.tableData = res.data.data;
  447. this.getSpanArr(this.tableData);
  448. });
  449. }
  450. this.table1 = false;
  451. },
  452. infomation() {
  453. this.axios.get("/api/v1/uc/getSteelWarehouse").then(res => {
  454. console.log(res.data);
  455. this.option = res.data;
  456. });
  457. },
  458. //记录每一行的合并数
  459. getSpanArr(data) {
  460. //每次调用方法初始化
  461. this.spanArr = [];
  462. for (var i = 0; i < data.length; i++) {
  463. if (i === 0) {
  464. this.spanArr.push(1);
  465. this.pos = 0;
  466. } else {
  467. // 判断当前元素与上一个元素是否相同
  468. if (data[i].resultTotalId === data[i - 1].resultTotalId) {
  469. this.spanArr[this.pos] += 1;
  470. this.spanArr.push(0);
  471. } else {
  472. this.spanArr.push(1);
  473. this.pos = i;
  474. }
  475. }
  476. }
  477. },
  478. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  479. if (
  480. columnIndex === 0 ||
  481. columnIndex === 1 ||
  482. columnIndex === 2 ||
  483. columnIndex === 8 ||
  484. columnIndex === 9 ||
  485. columnIndex === 10 ||
  486. columnIndex === 11 ||
  487. columnIndex === 12 ||
  488. columnIndex === 13 ||
  489. columnIndex === 14
  490. ) {
  491. const _row = this.spanArr[rowIndex];
  492. const _col = _row > 0 ? 1 : 0;
  493. return {
  494. rowspan: _row,
  495. colspan: _col
  496. };
  497. }
  498. },
  499. handleClick() {
  500. this.redDotNum = null;
  501. this.totalQueueNum = null;
  502. this.totalQueueNumFirst = null;
  503. this.i = 0;
  504. if (this.activeName == "first") {
  505. this.getNoSpellingArray();
  506. } else if(this.activeName == "second") {
  507. this.getSpellingArray();
  508. } else {
  509. this.getStoreArray();
  510. }
  511. },
  512. getNoSpellingArray() {
  513. this.axios
  514. .post("/api/v1/qms/getQueueListByQueueUp?isSpelling=0&i=" + new Date())
  515. .then(res => {
  516. this.tableData1 = res.data.data;
  517. console.log(this.tableData1);
  518. });
  519. },
  520. getSpellingArray() {
  521. this.axios
  522. .post(
  523. "/api/v1/qms/getQueueListByQueueUp?apiId=473&isSpelling=1&i=" +
  524. new Date()
  525. )
  526. .then(res => {
  527. this.tableData = res.data.data;
  528. console.log(this.tableData);
  529. this.getSpanArr(this.tableData);
  530. });
  531. },
  532. getStoreArray() {
  533. this.axios
  534. .post(
  535. "/api/v1/qms/getStoreQueueList"
  536. )
  537. .then(res => {
  538. this.tableData3 = res.data.data;
  539. console.log("getStoreArray "+JSON.stringify(this.tableData3));
  540. });
  541. },
  542. onclick() {
  543. if (this.activeName == "first") {
  544. this.axios
  545. .post(
  546. "/api/v1/qms/getQueueListByQueueUp?isSpelling=0&i=" +
  547. new Date() +
  548. "&capacityNumber=" +
  549. this.capacityNo
  550. )
  551. .then(res => {
  552. this.tableData1 = res.data.data;
  553. });
  554. console.log("wzxxx");
  555. } else {
  556. this.axios
  557. .post(
  558. "/api/v1/qms/getQueueListByQueueUp?apiId=473&isSpelling=1&i=" +
  559. new Date() +
  560. "&capacityNumber=" +
  561. this.capacityNo
  562. )
  563. .then(res => {
  564. this.tableData = res.data.data;
  565. this.getSpanArr(this.tableData);
  566. });
  567. }
  568. },
  569. handleSelectionChange(selection) {
  570. this.maplist = [];
  571. this.maplist = selection;
  572. for (let i = 0; i < this.maplist.length; i++) {
  573. if (i + 1 < this.maplist.length) {
  574. if (this.maplist[i].ROW_ID + 1 != this.maplist[i + 1].ROW_ID) {
  575. this.$refs.mutiData.clearSelection();
  576. }
  577. }
  578. }
  579. if (
  580. !this.maplist.some(e => {
  581. return e.ROW_ID == 1;
  582. })
  583. ) {
  584. this.$refs.mutiData.clearSelection();
  585. }
  586. },
  587. updateBill(scope) {
  588. console.log(scope.row.capacityId);
  589. this.$router.push(
  590. `/editBill/${scope.row.capacityId}/${scope.row.capacityNumber}`
  591. );
  592. },
  593. filterArr(resultId) {
  594. console.log("fdhjsaj");
  595. this.filterArr1 = this.filterArr1.concat(
  596. this.tableData.filter(ele => ele.resultId == resultId)
  597. );
  598. },
  599. allow() {
  600. if (this.maplist.length == 0) {
  601. this.$message.error("请选择需要放行的车辆");
  602. return;
  603. }
  604. for (let i = 0; i < this.maplist.length; i++) {
  605. console.log(typeof this.maplist[i].id);
  606. if (
  607. typeof this.maplist[i].id == "undefined" ||
  608. this.maplist[i].id == null ||
  609. this.maplist[i].id == "null"
  610. ) {
  611. this.$message.error("请选择装货点");
  612. return;
  613. }
  614. this.filterArr(this.maplist[i].resultId);
  615. }
  616. var filterArr2 = [];
  617. this.filterArr1.forEach(e => {
  618. if (filterArr2.indexOf(e) === -1) {
  619. filterArr2.push(e);
  620. }
  621. });
  622. let map = {
  623. ssoId: getCookie("userId"),
  624. mapList: filterArr2
  625. };
  626. if (this.activeName == "first") {
  627. map.mapList = this.maplist;
  628. }
  629. this.axios.post("/api/v1/qms/allowEnFactory", map).then(res => {
  630. if (res.data.code == "200") {
  631. this.$message.success("放行成功,等待进厂");
  632. this.maplist = [];
  633. this.$refs.mutiData.clearSelection();
  634. this.getNoSpellingArray();
  635. this.getSpellingArray();
  636. this.getStoreArray();
  637. this.redDotNum = null;
  638. this.totalQueueNum = null;
  639. this.totalQueueNumFirst = null;
  640. this.i = 0;
  641. clearInterval(this.timer);
  642. this.start();
  643. } else {
  644. this.$message.error("请按顺序勾选");
  645. this.maplist = [];
  646. this.$refs.mutiData.clearSelection();
  647. this.getNoSpellingArray();
  648. this.getSpellingArray();
  649. this.getStoreArray();
  650. this.redDotNum = null;
  651. this.totalQueueNum = null;
  652. this.totalQueueNumFirst = null;
  653. this.i = 0;
  654. clearInterval(this.timer);
  655. this.start();
  656. }
  657. });
  658. },
  659. changePriority(value,s){
  660. console.log("装货点:"+value)
  661. console.log("数据第几行:"+s)
  662. //this.axios.post("")
  663. }
  664. }
  665. };
  666. </script>
  667. <style lang="scss" scoped>
  668. .sale {
  669. .top {
  670. width: 100%;
  671. height: 80px;
  672. display: flex;
  673. align-items: center;
  674. padding-left: 40px;
  675. .el-form {
  676. display: flex;
  677. justify-content: center;
  678. align-items: center;
  679. .el-form-item__label {
  680. align-items: center;
  681. line-height: 80px;
  682. }
  683. }
  684. }
  685. .input {
  686. width: 250px;
  687. margin-right: 20px;
  688. }
  689. .tabs {
  690. margin-left: 20px;
  691. margin-top: 10px;
  692. .tabs /deep/ .el-tabs__nav {
  693. font-size: 40px;
  694. }
  695. }
  696. }
  697. </style>