matchCheck.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  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: "remark", minWidth: 80 },
  380. ], //匹配表头
  381. processModal: false,
  382. process_man: "",
  383. processManList: [],
  384. process_start_time: "",
  385. process_end_time: "",
  386. process_control: false,
  387. cut_order_product_ids: [],
  388. matchedSelectedList: [],
  389. };
  390. },
  391. // 生命周期 - 创建完成(可以访问当前this实例)
  392. created() {
  393. this.axios("/api/user").then(
  394. (res) => (this.processManList = res.data.data)
  395. );
  396. },
  397. // 生命周期 - 挂载完成(可以访问DOM元素)
  398. mounted() {
  399. this.initData();
  400. },
  401. methods: {
  402. handleMatchedSelectAll() {
  403. this.isMatchedSelectAll = !this.isMatchedSelectAll;
  404. this.matchedList.map((v) => {
  405. if (v.produce_status == 0) {
  406. v.isSelect = this.isMatchedSelectAll;
  407. }
  408. });
  409. },
  410. handleMatchedSelect(row, e) {
  411. row.isSelect = e;
  412. console.log(row);
  413. let flag = true;
  414. this.matchedSelectedList = [];
  415. this.matchedList.map((v) => {
  416. if (v.produce_status == 0) {
  417. if (v.isSelect) {
  418. this.matchedSelectedList.push(v.id);
  419. } else {
  420. flag = false;
  421. }
  422. }
  423. });
  424. this.isMatchedSelectAll = flag;
  425. this.cut_order_product_ids = this.matchedSelectedList;
  426. console.log(this.cut_order_product_ids);
  427. },
  428. back() {
  429. this.$router.go(-1);
  430. },
  431. handleGoProduction(type, row) {
  432. if (this.matchedSelectedList.length == 0) {
  433. return this.$Message.warning("请选择");
  434. }
  435. if (type === 2) {
  436. this.cut_order_product_ids = [row.id];
  437. } else {
  438. this.cut_order_product_ids = this.matchedSelectedList;
  439. }
  440. this.processModal = true;
  441. },
  442. handleProcess() {
  443. this.process_control = true;
  444. console.log(this.cut_order_product_ids);
  445. this.axios({
  446. method: "post",
  447. url: "/api/bst_pull",
  448. data: {
  449. cut_order_product_ids: this.cut_order_product_ids,
  450. process_man: this.process_man,
  451. process_start_time: this.func.replaceDateNoHMS(
  452. this.process_start_time
  453. ),
  454. process_end_time: this.func.replaceDateNoHMS(this.process_end_time),
  455. },
  456. }).then((res) => {
  457. if (res.code == 200) {
  458. this.$Message.success(res.msg);
  459. this.processModal = false;
  460. this.matchedSelectedList = [];
  461. this.initData();
  462. }
  463. setTimeout(() => {
  464. this.process_control = false;
  465. }, 500);
  466. });
  467. },
  468. initData() {
  469. this.axios
  470. .get("/api/bst_matching_on_list", {
  471. params: {
  472. id: this.matchedInfo.id,
  473. image_number: this.matchedInfo.image_number,
  474. product_name: this.matchedInfo.product_name,
  475. },
  476. })
  477. .then((res) => {
  478. this.matchedList = [];
  479. res.data.list.map((v) => {
  480. v.isCurrenct = false;
  481. });
  482. this.urlMatchedList = res.data.image_number;
  483. this.productMatchedList = res.data.product_name;
  484. // this.matchedList = res.data.list;
  485. res.data.list.forEach((v, index) => {
  486. if (v.matching_status == 2) {
  487. this.matchedList.push(v);
  488. }
  489. });
  490. console.log(this.matchedList);
  491. });
  492. },
  493. handleHiddenMatchedDetail(row) {
  494. if (row.isHidden) {
  495. row.isHidden = !row.isHidden;
  496. } else {
  497. row.isHidden = true;
  498. }
  499. this.$forceUpdate();
  500. },
  501. handleShowCurrencyMatched(row) {
  502. if (row.isCurrenct) {
  503. row.isCurrenct = !row.isCurrenct;
  504. } else {
  505. this.matchedList.map((v) => (v.isCurrenct = false));
  506. row.isCurrenct = true;
  507. }
  508. this.getMatchedDetailList(row);
  509. },
  510. getMatchedDetailList(row) {
  511. row.isCurrenct &&
  512. this.axios
  513. .post("/api/bst_matching_on_detail", {
  514. cut_order_product_id: row.id,
  515. id: this.matchedInfo.id,
  516. number: this.matchedInfo.number,
  517. part_name: this.matchedInfo.part_name,
  518. region: this.matchedInfo.region,
  519. })
  520. .then((res) => {
  521. this.regionMatchedList = res.data.region;
  522. this.numberMatchedList = res.data.number;
  523. this.partNameMatchedList = res.data.part_name;
  524. this.matchedDetailList = res.data.list;
  525. });
  526. },
  527. },
  528. // 监听属性 类似于data概念
  529. computed: {},
  530. // 监控data中的数据变化
  531. watch: {},
  532. beforeCreate() {}, // 生命周期 - 创建之前
  533. beforeMount() {}, // 生命周期 - 挂载之前
  534. beforeUpdate() {}, // 生命周期 - 更新之前
  535. updated() {}, // 生命周期 - 更新之后
  536. beforeDestroy() {}, // 生命周期 - 销毁之前
  537. destroyed() {}, // 生命周期 - 销毁完成
  538. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  539. };
  540. </script>
  541. <style lang="scss" scoped>
  542. .context-tabs {
  543. position: relative;
  544. max-height: 650px;
  545. overflow: hidden;
  546. overflow-y: auto;
  547. padding: 15px;
  548. margin: 10px;
  549. margin-bottom: 30px;
  550. border-radius: 5px;
  551. box-shadow: 1px 1px 5px 1px #999;
  552. }
  553. .matched-block {
  554. padding: 15px;
  555. margin-bottom: 30px;
  556. background-color: #e9ecef;
  557. border-radius: 5px;
  558. }
  559. .process_modal {
  560. display: flex;
  561. justify-content: center;
  562. align-items: center;
  563. padding: 10px;
  564. }
  565. </style>