matchCheck.vue 17 KB

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