matchCheck.vue 17 KB

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