queueFStart.vue 16 KB

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