matchCheck.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <template>
  2. <div>
  3. <Toptitle title="查看">
  4. <Button
  5. @click="handleMatchedSelectAll()"
  6. type="primary"
  7. :ghost="!isMatchedSelectAll"
  8. style="margin-right: 10px"
  9. >{{ isMatchedSelectAll ? "取消选中" : "全部选中" }}</Button
  10. >
  11. <Button
  12. @click="handleGoProduction(1)"
  13. type="primary"
  14. style="margin-right: 10px"
  15. >下生产</Button
  16. >
  17. <Button @click="back" type="primary" ghost style="margin-right: 10px"
  18. >返回</Button
  19. >
  20. </Toptitle>
  21. <Row style="padding: 10px;font-size: 18px;">
  22. <Col span="6">
  23. <span>项目编号:</span><span>{{ project_number }}</span>
  24. </Col>
  25. <Col span="6">
  26. <span>项目名称:</span><span>{{ project_name }}</span>
  27. </Col>
  28. </Row>
  29. <div class="context-tabs">
  30. <Row type="flex" align="middle" style="padding:10px 0">
  31. <Col span="5">
  32. <span>图号:</span>
  33. <span>
  34. <Select
  35. filterable
  36. multiple
  37. filter-by-label
  38. clearable
  39. transfer
  40. v-model="matchedInfo.image_number"
  41. :max-tag-count="2"
  42. size="small"
  43. style="width: 150px"
  44. >
  45. <Option
  46. v-for="(item, index) in urlMatchedList"
  47. :key="index"
  48. :label="item"
  49. :value="item"
  50. ></Option>
  51. </Select>
  52. </span>
  53. </Col>
  54. <Col span="5">
  55. <span>产品名称:</span>
  56. <span>
  57. <Select
  58. filterable
  59. multiple
  60. filter-by-label
  61. clearable
  62. transfer
  63. v-model="matchedInfo.product_name"
  64. :max-tag-count="2"
  65. size="small"
  66. style="width: 150px"
  67. >
  68. <Option
  69. v-for="(item, index) in productMatchedList"
  70. :key="index"
  71. :label="item"
  72. :value="item"
  73. ></Option>
  74. </Select>
  75. </span>
  76. </Col>
  77. <Col span="2">
  78. <Button @click="initData" size="small" type="primary">
  79. 搜索
  80. </Button>
  81. </Col>
  82. </Row>
  83. <div
  84. v-for="matched_info in matchedList"
  85. :key="matched_info.number"
  86. class="matched-block"
  87. >
  88. <Row type="flex" justify="space-between" align="top">
  89. <Col style="display:flex;justify-content: space-around;">
  90. <div v-if="matched_info.matching_status == 2">
  91. <Checkbox
  92. v-show="matched_info.produce_status == 0"
  93. v-model="matched_info.isSelect"
  94. @on-change="(e) => handleMatchedSelect(matched_info, e)"
  95. >选择</Checkbox
  96. >
  97. </div>
  98. <span>图号:{{ matched_info.image_number }}</span>
  99. </Col>
  100. <Col span="3">
  101. <span>产品名称:{{ matched_info.product_name }}</span>
  102. </Col>
  103. <Col span="3">
  104. <span>区域:{{ matched_info.region }}</span>
  105. </Col>
  106. <Col span="2">
  107. <span>{{
  108. matched_info.matching_status == 0
  109. ? "未匹配"
  110. : matched_info.matching_status == 1
  111. ? "匹配中"
  112. : "匹配完成"
  113. }}</span>
  114. </Col>
  115. <Col style="display:flex;justify-content: space-between;" span="6">
  116. <span v-if="matched_info.matching_status == 2">
  117. <Button
  118. @click="handleGoProduction(2, matched_info)"
  119. type="primary"
  120. size="small"
  121. :disabled="matched_info.produce_status != 0"
  122. >下生产</Button
  123. >
  124. </span>
  125. <div>
  126. 总计
  127. <span style="color:red">{{ matched_info.num }}</span>
  128. 条数据
  129. </div>
  130. <div>
  131. <Button
  132. @click="handleShowCurrencyMatched(matched_info)"
  133. size="small"
  134. type="text"
  135. >{{ matched_info.isCurrenct ? "收缩" : "展开" }}</Button
  136. >
  137. <Icon
  138. size="20"
  139. :type="
  140. matched_info.isCurrenct
  141. ? 'md-arrow-dropdown'
  142. : 'md-arrow-dropright'
  143. "
  144. style="vertical-align: middle;"
  145. />
  146. </div>
  147. </Col>
  148. </Row>
  149. <Row style="margin-top:20px" v-if="matched_info.isCurrenct">
  150. <Col span="4">
  151. <span>区域名称:</span>
  152. <span>
  153. <Select
  154. filterable
  155. multiple
  156. transfer
  157. clearable
  158. filter-by-label
  159. v-model="matchedInfo.region"
  160. :max-tag-count="2"
  161. size="small"
  162. style="width: 150px"
  163. >
  164. <Option
  165. v-for="(item, index) in regionMatchedList"
  166. :key="index"
  167. :label="item"
  168. :value="item"
  169. ></Option>
  170. </Select>
  171. </span>
  172. </Col>
  173. <Col span="4">
  174. <span>房号:</span>
  175. <span>
  176. <Select
  177. filterable
  178. multiple
  179. transfer
  180. clearable
  181. filter-by-label
  182. v-model="matchedInfo.number"
  183. :max-tag-count="2"
  184. size="small"
  185. style="width: 150px"
  186. >
  187. <Option
  188. v-for="(item, index) in numberMatchedList"
  189. :key="index"
  190. :label="item"
  191. :value="item"
  192. ></Option>
  193. </Select>
  194. </span>
  195. </Col>
  196. <Col span="4">
  197. <span>部件名称:</span>
  198. <span>
  199. <Select
  200. filterable
  201. multiple
  202. transfer
  203. clearable
  204. filter-by-label
  205. v-model="matchedInfo.part_name"
  206. :max-tag-count="2"
  207. size="small"
  208. style="width: 150px"
  209. >
  210. <Option
  211. v-for="(item, index) in partNameMatchedList"
  212. :key="index"
  213. :label="item"
  214. :value="item"
  215. ></Option>
  216. </Select>
  217. </span>
  218. </Col>
  219. <Col span="2">
  220. <Button
  221. @click="getMatchedDetailList(matched_info)"
  222. size="small"
  223. type="primary"
  224. >
  225. 搜索
  226. </Button>
  227. </Col>
  228. </Row>
  229. <div v-if="matched_info.isCurrenct">
  230. <div
  231. v-for="(matched_detail, index) in matchedDetailList"
  232. :key="index"
  233. >
  234. <Row type="flex" align="middle">
  235. <Col span="10" style="padding:10px 0">
  236. <span>匹配信息:</span>
  237. <span
  238. v-for="(matched_info, index) in matched_detail.special"
  239. :key="index"
  240. >
  241. {{ matched_info.key }}:{{ matched_info.value }}
  242. </span>
  243. <span>{{ matched_detail.num }}组</span>
  244. </Col>
  245. <Col span="2" offset="12" style="padding:10px 0">
  246. <Button
  247. @click="handleHiddenMatchedDetail(matched_detail)"
  248. size="small"
  249. type="text"
  250. >
  251. {{ matched_detail.isHidden ? "展开" : "收缩" }}
  252. </Button>
  253. </Col>
  254. </Row>
  255. <Table
  256. v-show="!matched_detail.isHidden"
  257. :columns="matchedSheetTableColumns"
  258. border
  259. :max-height="500"
  260. :data="matched_detail.detail"
  261. >
  262. </Table>
  263. </div>
  264. </div>
  265. </div>
  266. </div>
  267. <Modal v-model="processModal" title="下生产">
  268. <div>
  269. <div class="process_modal">
  270. <span>生产人员:</span>
  271. <Select
  272. v-model="process_man"
  273. filterable
  274. filter-by-label
  275. clearable
  276. style="width: 150px"
  277. >
  278. <Option
  279. v-for="item in processManList"
  280. :key="item.id"
  281. :label="item.nickname"
  282. :value="item.id"
  283. ></Option>
  284. </Select>
  285. </div>
  286. <div class="process_modal">
  287. <span>选择时间:</span>
  288. <DatePicker
  289. type="date"
  290. v-model="process_start_time"
  291. placeholder="年/月/日"
  292. style="width: 150px"
  293. ></DatePicker>
  294. <DatePicker
  295. type="date"
  296. v-model="process_end_time"
  297. placeholder="年/月/日"
  298. style="width: 150px"
  299. ></DatePicker>
  300. </div>
  301. </div>
  302. <div slot="footer">
  303. <Button
  304. @click="processModal = false"
  305. type="primary"
  306. ghost
  307. style="margin-right: 10px"
  308. >取消</Button
  309. >
  310. <Button
  311. @click="handleProcess"
  312. type="primary"
  313. style="margin-right: 10px"
  314. :disabled="process_control"
  315. >确定</Button
  316. >
  317. </div>
  318. </Modal>
  319. </div>
  320. </template>
  321. <script>
  322. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  323. // 例如:import 《组件名称》 from '《组件路径》';
  324. export default {
  325. name: "",
  326. components: {},
  327. props: {},
  328. // import引入的组件需要注入到对象中才能使用
  329. data() {
  330. // 这里存放数据
  331. return {
  332. project_number: this.$route.query.project_number,
  333. project_name: this.$route.query.project_name,
  334. isMatchedSelectAll: false,
  335. matchedInfo: {
  336. id: this.$route.query.id,
  337. image_number: "",
  338. product_name: "",
  339. region: [],
  340. number: [],
  341. part_name: [],
  342. },
  343. urlMatchedList: [],
  344. productMatchedList: [],
  345. regionMatchedList: [],
  346. numberMatchedList: [],
  347. partNameMatchedList: [],
  348. matchedDetailList: [],
  349. matchedList: [],
  350. matchedSheetTableColumns: [
  351. { title: "序号", align: "center", type: "index", resizable: true,
  352. width: 100 },
  353. { title: "区域名称", align: "center", key: "region", resizable: true,
  354. width: 160 },
  355. { title: "房号", align: "center", key: "house_number", resizable: true,
  356. width: 160 },
  357. { title: "部件名称", align: "center", key: "part_name", resizable: true,
  358. width: 180 },
  359. { title: "行号", align: "center", key: "line", resizable: true,
  360. width: 170 },
  361. { title: "木皮1", align: "center", key: "skin1", resizable: true,
  362. width: 160 },
  363. {
  364. title: "原材料",
  365. align: "center",
  366. resizable: true,
  367. width: 150,
  368. render: (h, params) => {
  369. return h("span", {}, params.row.board1 +';'+params.row.board2);
  370. },
  371. },
  372. { title: "木皮2", align: "center", key: "skin2", resizable: true,
  373. width: 150 },
  374. { title: "毛料尺寸", align: "center", key: "wool_size", resizable: true,
  375. width: 150 },
  376. {
  377. title: "原料数量",
  378. align: "center",
  379. key: "wool_number",
  380. resizable: true,
  381. width: 100,
  382. },
  383. { title: "精裁尺寸", align: "center", key: "cut_size", resizable: true,
  384. width: 100 },
  385. {
  386. title: "零部件数量",
  387. align: "center",
  388. key: "num",
  389. resizable: true,
  390. width: 100,
  391. },
  392. { title: "贴皮面积", align: "center", key: "stick", resizable: true,
  393. width: 140 },
  394. { title: "精裁面积", align: "center", key: "cut", resizable: true,
  395. width: 140 },
  396. { title: "是否打印", align: "center", key: "chip_state", resizable: true,
  397. width: 80 , render: (h, params) => {
  398. return h("span", {}, params.row.chip_state==0?'否':'是');
  399. }},
  400. { title: "工艺要求", align: "center", key: "remark", minWidth: 180 },
  401. ], //匹配表头
  402. processModal: false,
  403. process_man: "",
  404. processManList: [],
  405. process_start_time: "",
  406. process_end_time: "",
  407. process_control: false,
  408. cut_order_product_ids: [],
  409. matchedSelectedList: [],
  410. };
  411. },
  412. // 生命周期 - 创建完成(可以访问当前this实例)
  413. created() {
  414. this.axios("/api/user").then(
  415. (res) => (this.processManList = res.data.data)
  416. );
  417. },
  418. // 生命周期 - 挂载完成(可以访问DOM元素)
  419. mounted() {
  420. this.initData();
  421. },
  422. methods: {
  423. handleMatchedSelectAll(){
  424. this.isMatchedSelectAll = !this.isMatchedSelectAll;
  425. this.matchedSelectedList = [];
  426. this.matchedList.map((v) => {
  427. if (v.produce_status == 0) {
  428. v.isSelect = this.isMatchedSelectAll;
  429. if(v.isSelect){
  430. this.matchedSelectedList.push(v.id)
  431. }
  432. }
  433. });
  434. },
  435. handleMatchedSelect(row, e) {
  436. row.isSelect = e;
  437. console.log(row);
  438. let flag = true;
  439. this.matchedSelectedList = [];
  440. this.matchedList.map((v) => {
  441. if (v.produce_status == 0) {
  442. if (v.isSelect) {
  443. this.matchedSelectedList.push(v.id);
  444. } else {
  445. flag = false;
  446. }
  447. }
  448. });
  449. this.isMatchedSelectAll = flag;
  450. this.cut_order_product_ids = this.matchedSelectedList;
  451. console.log(this.cut_order_product_ids);
  452. },
  453. back() {
  454. this.$router.go(-1);
  455. },
  456. handleGoProduction(type, row) {
  457. if (this.matchedSelectedList.length == 0) {
  458. return this.$Message.warning("请选择");
  459. }
  460. if (type === 2) {
  461. this.cut_order_product_ids = [row.id];
  462. } else {
  463. this.cut_order_product_ids = this.matchedSelectedList;
  464. }
  465. this.processModal = true;
  466. },
  467. handleProcess() {
  468. this.process_control = true;
  469. console.log(this.cut_order_product_ids);
  470. this.axios({
  471. method: "post",
  472. url: "/api/bst_pull",
  473. data: {
  474. cut_order_product_ids: this.cut_order_product_ids,
  475. process_man: this.process_man,
  476. process_start_time: this.func.replaceDateNoHMS(
  477. this.process_start_time
  478. ),
  479. process_end_time: this.func.replaceDateNoHMS(this.process_end_time),
  480. },
  481. }).then((res) => {
  482. if (res.code == 200) {
  483. this.$Message.success(res.msg);
  484. this.processModal = false;
  485. this.matchedSelectedList = [];
  486. this.initData();
  487. }
  488. setTimeout(() => {
  489. this.process_control = false;
  490. }, 500);
  491. });
  492. },
  493. initData() {
  494. this.axios
  495. .get("/api/bst_matching_on_list", {
  496. params: {
  497. id: this.matchedInfo.id,
  498. image_number: this.matchedInfo.image_number,
  499. product_name: this.matchedInfo.product_name,
  500. },
  501. })
  502. .then((res) => {
  503. this.matchedList = [];
  504. res.data.list.map((v) => {
  505. v.isCurrenct = false;
  506. });
  507. this.urlMatchedList = res.data.image_number;
  508. this.productMatchedList = res.data.product_name;
  509. // this.matchedList = res.data.list;
  510. res.data.list.forEach((v, index) => {
  511. if (v.matching_status == 2) {
  512. this.matchedList.push(v);
  513. }
  514. });
  515. });
  516. },
  517. handleHiddenMatchedDetail(row) {
  518. if (row.isHidden) {
  519. row.isHidden = !row.isHidden;
  520. } else {
  521. row.isHidden = true;
  522. }
  523. this.$forceUpdate();
  524. },
  525. handleShowCurrencyMatched(row) {
  526. if (row.isCurrenct) {
  527. row.isCurrenct = !row.isCurrenct;
  528. } else {
  529. this.matchedList.map((v) => (v.isCurrenct = false));
  530. row.isCurrenct = true;
  531. }
  532. this.getMatchedDetailList(row);
  533. },
  534. getMatchedDetailList(row) {
  535. row.isCurrenct &&
  536. this.axios
  537. .post("/api/bst_matching_on_detail", {
  538. cut_order_product_id: row.id,
  539. id: this.matchedInfo.id,
  540. number: this.matchedInfo.number,
  541. part_name: this.matchedInfo.part_name,
  542. region: this.matchedInfo.region,
  543. })
  544. .then((res) => {
  545. this.regionMatchedList = res.data.region;
  546. this.numberMatchedList = res.data.number;
  547. this.partNameMatchedList = res.data.part_name;
  548. this.matchedDetailList = res.data.list;
  549. });
  550. },
  551. },
  552. // 监听属性 类似于data概念
  553. computed: {},
  554. // 监控data中的数据变化
  555. watch: {},
  556. beforeCreate() {}, // 生命周期 - 创建之前
  557. beforeMount() {}, // 生命周期 - 挂载之前
  558. beforeUpdate() {}, // 生命周期 - 更新之前
  559. updated() {}, // 生命周期 - 更新之后
  560. beforeDestroy() {}, // 生命周期 - 销毁之前
  561. destroyed() {}, // 生命周期 - 销毁完成
  562. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  563. };
  564. </script>
  565. <style lang="scss" scoped>
  566. .context-tabs {
  567. position: relative;
  568. max-height: 650px;
  569. overflow: hidden;
  570. overflow-y: auto;
  571. padding: 15px;
  572. margin: 10px;
  573. margin-bottom: 30px;
  574. border-radius: 5px;
  575. box-shadow: 1px 1px 5px 1px #999;
  576. }
  577. .matched-block {
  578. padding: 15px;
  579. margin-bottom: 30px;
  580. background-color: #e9ecef;
  581. border-radius: 5px;
  582. }
  583. .process_modal {
  584. display: flex;
  585. justify-content: center;
  586. align-items: center;
  587. padding: 10px;
  588. }
  589. </style>