queueFStart.vue 18 KB

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