queueFStart.vue 20 KB

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