matchCheck.vue 15 KB

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