queueFStart.vue 20 KB

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