queueFStart.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  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. },
  265. created() {
  266. // this.myWebsocket();
  267. },
  268. mounted() {
  269. this.i = 0;
  270. this.infomation();
  271. this.getSpellingArray();
  272. this.getNoSpellingArray();
  273. this.wantEnfactory();
  274. this.start();
  275. },
  276. computed: {
  277. wantS() {
  278. return this.totalQueueNum;
  279. }
  280. },
  281. beforeDestroy() {
  282. this.timer;
  283. },
  284. watch: {
  285. wantS() {
  286. if (this.totalQueueNum - this.totalQueueNumFirst > 0) {
  287. this.redDotNum = this.totalQueueNum - this.totalQueueNumFirst;
  288. }
  289. }
  290. },
  291. methods: {
  292. wantEnfactory() {
  293. this.axios.get("/api/v1/uc/getQueueCount").then(res => {
  294. this.totalQueueNum = res.data.data;
  295. console.log(this.totalQueueNum, "totalQueueNum");
  296. if (this.i == 0) {
  297. this.totalQueueNumFirst = this.totalQueueNum;
  298. console.log(this.totalQueueNumFirst, "totalQueuefIRST");
  299. }
  300. this.i++;
  301. });
  302. },
  303. start() {
  304. this.timer = setInterval(this.wantEnfactory, 60000);
  305. },
  306. refresh() {
  307. this.getSpellingArray();
  308. this.getNoSpellingArray();
  309. this.redDotNum = null;
  310. this.totalQueueNumFirst = this.totalQueueNum;
  311. clearInterval(this.timer);
  312. this.start();
  313. },
  314. getRowKey(row) {
  315. return row.ROW_ID;
  316. },
  317. selectInit(row) {
  318. if (this.maplist.length == 0) {
  319. if (row.ROW_ID == 1) {
  320. return true;
  321. } else {
  322. return false;
  323. }
  324. } else {
  325. if (
  326. this.maplist.some(e => {
  327. return e.ROW_ID == row.ROW_ID || e.ROW_ID + 1 == row.ROW_ID;
  328. })
  329. ) {
  330. return true;
  331. } else {
  332. return false;
  333. }
  334. }
  335. },
  336. rowDbClick(row) {
  337. this.materialList = [];
  338. this.materialList.push(row);
  339. this.makeSureMaterial();
  340. },
  341. //物资模态框查询
  342. onclickMaterial1() {
  343. this.optionMa.requestUrl =
  344. "/api/v1/uc/getSteelMaterial?apiId=244&materialNameText=" +
  345. this.materialNameText +
  346. "&materialSpecificationText=" +
  347. this.materialSpecificationText;
  348. },
  349. onclickMaterial() {
  350. this.table1 = true;
  351. this.optionMa.requestUrl =
  352. "/api/v1/uc/getSteelMaterial?apiId=244&i=" + new Date();
  353. },
  354. //返回选中的物资信息
  355. selectionChange2(selection) {
  356. this.materialList1 = [];
  357. this.materialList1 = selection;
  358. this.materialList = this.materialList.concat(this.materialList1);
  359. },
  360. makeSureMaterial() {
  361. console.log(this.materialList);
  362. var materialIdList = [];
  363. this.materialList.forEach(e => {
  364. if (materialIdList.indexOf(e.materialId) == -1) {
  365. materialIdList.push(e.materialId);
  366. }
  367. });
  368. let map = {
  369. materialList: materialIdList
  370. };
  371. this.materialList = [];
  372. this.materialList1 = [];
  373. if (this.activeName == "first") {
  374. this.axios
  375. .post("/api/v1/qms/getQueueListByQueueUp?isSpelling=0", map)
  376. .then(res => {
  377. this.tableData1 = res.data.data;
  378. });
  379. } else {
  380. this.axios
  381. .post("/api/v1/qms/getQueueListByQueueUp?apiId=473&isSpelling=1", map)
  382. .then(res => {
  383. this.tableData = res.data.data;
  384. this.getSpanArr(this.tableData);
  385. });
  386. }
  387. this.table1 = false;
  388. },
  389. infomation() {
  390. this.axios.get("/api/v1/uc/getSteelWarehouse").then(res => {
  391. console.log(res.data);
  392. this.option = res.data;
  393. });
  394. },
  395. //记录每一行的合并数
  396. getSpanArr(data) {
  397. //每次调用方法初始化
  398. this.spanArr = [];
  399. for (var i = 0; i < data.length; i++) {
  400. if (i === 0) {
  401. this.spanArr.push(1);
  402. this.pos = 0;
  403. } else {
  404. // 判断当前元素与上一个元素是否相同
  405. if (data[i].resultTotalId === data[i - 1].resultTotalId) {
  406. this.spanArr[this.pos] += 1;
  407. this.spanArr.push(0);
  408. } else {
  409. this.spanArr.push(1);
  410. this.pos = i;
  411. }
  412. }
  413. }
  414. },
  415. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  416. if (
  417. columnIndex === 0 ||
  418. columnIndex === 1 ||
  419. columnIndex === 2 ||
  420. columnIndex === 3 ||
  421. columnIndex === 4 ||
  422. columnIndex === 9 ||
  423. columnIndex === 10 ||
  424. columnIndex === 13
  425. ) {
  426. const _row = this.spanArr[rowIndex];
  427. const _col = _row > 0 ? 1 : 0;
  428. return {
  429. rowspan: _row,
  430. colspan: _col
  431. };
  432. }
  433. },
  434. handleClick() {
  435. if (this.activeName == "first") {
  436. this.getNoSpellingArray();
  437. } else {
  438. this.getSpellingArray();
  439. }
  440. },
  441. getNoSpellingArray() {
  442. this.axios
  443. .post("/api/v1/qms/getQueueListByQueueUp?isSpelling=0&i=" + new Date())
  444. .then(res => {
  445. this.tableData1 = res.data.data;
  446. });
  447. },
  448. getSpellingArray() {
  449. this.axios
  450. .post(
  451. "/api/v1/qms/getQueueListByQueueUp?apiId=473&isSpelling=1&i=" +
  452. new Date()
  453. )
  454. .then(res => {
  455. this.tableData = res.data.data;
  456. console.log(this.tableData);
  457. this.getSpanArr(this.tableData);
  458. });
  459. },
  460. onclick() {
  461. console.log("我到了这里");
  462. console.log(this.capacityNo);
  463. if (this.activeName == "first") {
  464. this.axios
  465. .post(
  466. "/api/v1/qms/getQueueListByQueueUp?isSpelling=0&i=" +
  467. new Date() +
  468. "&capacityNumber=" +
  469. this.capacityNo
  470. )
  471. .then(res => {
  472. this.tableData1 = res.data.data;
  473. });
  474. console.log("wzxxx");
  475. } else {
  476. this.axios
  477. .post(
  478. "/api/v1/qms/getQueueListByQueueUp?apiId=473&isSpelling=1&i=" +
  479. new Date() +
  480. "&capacityNumber=" +
  481. this.capacityNo
  482. )
  483. .then(res => {
  484. this.tableData = res.data.data;
  485. this.getSpanArr(this.tableData);
  486. });
  487. }
  488. },
  489. handleSelectionChange(selection) {
  490. this.maplist = [];
  491. this.maplist = selection;
  492. for (let i = 0; i < this.maplist.length; i++) {
  493. if (i + 1 < this.maplist.length) {
  494. if (this.maplist[i].ROW_ID + 1 != this.maplist[i + 1].ROW_ID) {
  495. this.$refs.mutiData.clearSelection();
  496. }
  497. }
  498. }
  499. if (
  500. !this.maplist.some(e => {
  501. return e.ROW_ID == 1;
  502. })
  503. ) {
  504. this.$refs.mutiData.clearSelection();
  505. }
  506. },
  507. updateBill(scope) {
  508. console.log(scope.row.capacityId);
  509. this.$router.push(
  510. `/editBill/${scope.row.capacityId}/${scope.row.capacityNumber}`
  511. );
  512. },
  513. filterArr(resultId) {
  514. console.log("fdhjsaj");
  515. this.filterArr1 = this.filterArr1.concat(
  516. this.tableData.filter(ele => ele.resultId == resultId)
  517. );
  518. },
  519. allow() {
  520. if (this.maplist.length == 0) {
  521. this.$message.error("请选择需要放行的车辆");
  522. return;
  523. }
  524. for (let i = 0; i < this.maplist.length; i++) {
  525. console.log(typeof this.maplist[i].id);
  526. if (
  527. typeof this.maplist[i].id == "undefined" ||
  528. this.maplist[i].id == null ||
  529. this.maplist[i].id == "null"
  530. ) {
  531. this.$message.error("请选择装货点");
  532. return;
  533. }
  534. this.filterArr(this.maplist[i].resultId);
  535. }
  536. var filterArr2 = [];
  537. this.filterArr1.forEach(e => {
  538. if (filterArr2.indexOf(e) === -1) {
  539. filterArr2.push(e);
  540. }
  541. });
  542. let map = {
  543. ssoId: getCookie("userId"),
  544. mapList: filterArr2
  545. };
  546. if (this.activeName == "first") {
  547. map.mapList = this.maplist;
  548. }
  549. this.axios.post("/api/v1/qms/allowEnFactory", map).then(res => {
  550. if (res.data.code == "200") {
  551. this.$message.success("放行成功,等待进厂");
  552. this.maplist = [];
  553. this.$refs.mutiData.clearSelection();
  554. this.getNoSpellingArray();
  555. this.getSpellingArray();
  556. } else {
  557. this.$message.error("请按顺序勾选");
  558. this.maplist = [];
  559. this.$refs.mutiData.clearSelection();
  560. this.getNoSpellingArray();
  561. this.getSpellingArray();
  562. }
  563. });
  564. }
  565. }
  566. };
  567. </script>
  568. <style lang="scss" scoped>
  569. .sale {
  570. .top {
  571. width: 100%;
  572. height: 80px;
  573. display: flex;
  574. align-items: center;
  575. padding-left: 40px;
  576. .el-form {
  577. display: flex;
  578. justify-content: center;
  579. align-items: center;
  580. .el-form-item__label {
  581. align-items: center;
  582. line-height: 80px;
  583. }
  584. }
  585. }
  586. .input {
  587. width: 250px;
  588. margin-right: 20px;
  589. }
  590. .tabs {
  591. margin-left: 20px;
  592. margin-top: 10px;
  593. .tabs /deep/ .el-tabs__nav {
  594. font-size: 40px;
  595. }
  596. }
  597. }
  598. </style>