matchCheck.vue 14 KB

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