matchCheck.vue 15 KB

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