queueFStart.vue 13 KB

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