HXYMatchCheck.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. <template>
  2. <div>
  3. <Toptitle title="查看">
  4. <Button
  5. @click="handelDel"
  6. type="primary"
  7. style="margin-right: 10px"
  8. >强制删除</Button
  9. >
  10. <Button
  11. @click="handleMatchedSelectAll()"
  12. type="primary"
  13. :ghost="!isMatchedSelectAll"
  14. style="margin-right: 10px"
  15. >{{ isMatchedSelectAll ? "取消选中" : "全部选中" }}</Button
  16. >
  17. <Button
  18. @click="handleGoProduction(1)"
  19. type="primary"
  20. style="margin-right: 10px"
  21. >下生产</Button
  22. >
  23. <Button @click="back" type="primary" ghost style="margin-right: 10px"
  24. >返回</Button
  25. >
  26. </Toptitle>
  27. <Row style="padding: 10px;font-size: 18px;">
  28. <Col span="6">
  29. <span>项目编号:</span><span>{{ project_number }}</span>
  30. </Col>
  31. <Col span="6">
  32. <span>项目名称:</span><span>{{ project_name }}</span>
  33. </Col>
  34. </Row>
  35. <div class="context-tabs">
  36. <Row type="flex" align="middle" style="padding:10px 0">
  37. <Col span="5">
  38. <span>图号:</span>
  39. <span>
  40. <Select
  41. filterable
  42. multiple
  43. filter-by-label
  44. clearable
  45. transfer
  46. v-model="matchedInfo.image_number"
  47. :max-tag-count="2"
  48. size="small"
  49. style="width: 150px"
  50. >
  51. <Option
  52. v-for="(item, index) in urlMatchedList"
  53. :key="index"
  54. :label="item"
  55. :value="item"
  56. ></Option>
  57. </Select>
  58. </span>
  59. </Col>
  60. <Col span="5">
  61. <span>产品名称:</span>
  62. <span>
  63. <Select
  64. filterable
  65. multiple
  66. filter-by-label
  67. clearable
  68. transfer
  69. v-model="matchedInfo.product_name"
  70. :max-tag-count="2"
  71. size="small"
  72. style="width: 150px"
  73. >
  74. <Option
  75. v-for="(item, index) in productMatchedList"
  76. :key="index"
  77. :label="item"
  78. :value="item"
  79. ></Option>
  80. </Select>
  81. </span>
  82. </Col>
  83. <Col span="5">
  84. <span>批次:</span>
  85. <span>
  86. <Select
  87. filterable
  88. multiple
  89. filter-by-label
  90. clearable
  91. transfer
  92. v-model="matchedInfo.numbers"
  93. :max-tag-count="2"
  94. size="small"
  95. style="width: 150px"
  96. >
  97. <Option
  98. v-for="(item, index) in numberList"
  99. :key="index"
  100. :label="item"
  101. :value="item"
  102. ></Option>
  103. </Select>
  104. </span>
  105. </Col>
  106. <Col span="5">
  107. <span>生产通知单号:</span>
  108. <span>
  109. <Input v-model="matchedInfo.product_no" clearable placeholder="请输入生产通知单号" style="width: 150px" size="small"/>
  110. </span>
  111. </Col>
  112. <Col span="2">
  113. <Button @click="initData" size="small" type="primary">
  114. 搜索
  115. </Button>
  116. </Col>
  117. </Row>
  118. <div
  119. v-for="matched_info in matchedList"
  120. :key="matched_info.number"
  121. class="matched-block"
  122. >
  123. <Row type="flex" justify="space-between" align="top">
  124. <Col style="display:flex;justify-content: space-around;">
  125. <div v-if="matched_info.matching_status == 2">
  126. <Checkbox
  127. v-show="matched_info.produce_status == 0"
  128. v-model="matched_info.isSelect"
  129. @on-change="(e) => handleMatchedSelect(matched_info, e)"
  130. >选择</Checkbox
  131. >
  132. <Checkbox
  133. v-show="matched_info.produce_status != 0"
  134. v-model="matched_info.del_isSelect"
  135. @on-change="(e) => MatchedSelect(matched_info, e)"
  136. class="del_check"
  137. >选择</Checkbox
  138. >
  139. </div>
  140. <span>图号:{{ matched_info.image_number }}</span>
  141. </Col>
  142. <Col span="2">
  143. <span>批次:{{ matched_info.numbers }}</span>
  144. </Col>
  145. <Col span="3">
  146. <span>产品名称:{{ matched_info.product_name }}</span>
  147. </Col>
  148. <Col span="3">
  149. <span>区域:{{ matched_info.region }}</span>
  150. </Col>
  151. <Col span="3">
  152. <span>生产通知单号:{{ matched_info.product_no }}</span>
  153. </Col>
  154. <Col span="2">
  155. <span>{{
  156. matched_info.matching_status == 0
  157. ? "未匹配"
  158. : matched_info.matching_status == 1
  159. ? "匹配中"
  160. : "匹配完成"
  161. }}</span>
  162. </Col>
  163. <Col style="display:flex;justify-content: space-between;" span="6">
  164. <span v-if="matched_info.matching_status == 2">
  165. <Button
  166. @click="handleGoProduction(2, matched_info)"
  167. type="primary"
  168. size="small"
  169. :disabled="matched_info.produce_status != 0"
  170. >下生产</Button
  171. >
  172. </span>
  173. <div>
  174. 总计
  175. <span style="color:red">{{ matched_info.num }}</span>
  176. 条数据
  177. </div>
  178. <div>
  179. <Button
  180. @click="handleShowCurrencyMatched(matched_info)"
  181. size="small"
  182. type="text"
  183. >{{ matched_info.isCurrenct ? "收缩" : "展开" }}</Button
  184. >
  185. <Icon
  186. size="20"
  187. :type="
  188. matched_info.isCurrenct
  189. ? 'md-arrow-dropdown'
  190. : 'md-arrow-dropright'
  191. "
  192. style="vertical-align: middle;"
  193. />
  194. </div>
  195. </Col>
  196. </Row>
  197. <Row style="margin-top:20px" v-if="matched_info.isCurrenct">
  198. <Col span="4">
  199. <span>区域名称:</span>
  200. <span>
  201. <Select
  202. filterable
  203. multiple
  204. transfer
  205. clearable
  206. filter-by-label
  207. v-model="matchedInfo.region"
  208. :max-tag-count="2"
  209. size="small"
  210. style="width: 150px"
  211. >
  212. <Option
  213. v-for="(item, index) in regionMatchedList"
  214. :key="index"
  215. :label="item"
  216. :value="item"
  217. ></Option>
  218. </Select>
  219. </span>
  220. </Col>
  221. <Col span="4">
  222. <span>房号:</span>
  223. <span>
  224. <Select
  225. filterable
  226. multiple
  227. transfer
  228. clearable
  229. filter-by-label
  230. v-model="matchedInfo.number"
  231. :max-tag-count="2"
  232. size="small"
  233. style="width: 150px"
  234. >
  235. <Option
  236. v-for="(item, index) in numberMatchedList"
  237. :key="index"
  238. :label="item"
  239. :value="item"
  240. ></Option>
  241. </Select>
  242. </span>
  243. </Col>
  244. <Col span="4">
  245. <span>部件名称:</span>
  246. <span>
  247. <Select
  248. filterable
  249. multiple
  250. transfer
  251. clearable
  252. filter-by-label
  253. v-model="matchedInfo.part_name"
  254. :max-tag-count="2"
  255. size="small"
  256. style="width: 150px"
  257. >
  258. <Option
  259. v-for="(item, index) in partNameMatchedList"
  260. :key="index"
  261. :label="item"
  262. :value="item"
  263. ></Option>
  264. </Select>
  265. </span>
  266. </Col>
  267. <Col span="2">
  268. <Button
  269. @click="getMatchedDetailList(matched_info)"
  270. size="small"
  271. type="primary"
  272. >
  273. 搜索
  274. </Button>
  275. </Col>
  276. </Row>
  277. <div v-if="matched_info.isCurrenct">
  278. <div
  279. v-for="(matched_detail, index) in matchedDetailList"
  280. :key="index"
  281. >
  282. <Row type="flex" align="middle">
  283. <Col span="10" style="padding:10px 0">
  284. <span>匹配信息:</span>
  285. <span
  286. v-for="(matched_info, index) in matched_detail.special"
  287. :key="index"
  288. >
  289. {{ matched_info.key }}:{{ matched_info.value }}
  290. </span>
  291. </Col>
  292. <Col span="2" offset="12" style="padding:10px 0">
  293. <Button
  294. @click="handleHiddenMatchedDetail(matched_detail)"
  295. size="small"
  296. type="text"
  297. >
  298. {{ matched_detail.isHidden ? "展开" : "收缩" }}
  299. </Button>
  300. </Col>
  301. </Row>
  302. <Table
  303. v-show="!matched_detail.isHidden"
  304. :columns="matchedSheetTableColumns"
  305. border
  306. :max-height="500"
  307. :data="matched_detail.detail"
  308. >
  309. </Table>
  310. </div>
  311. </div>
  312. </div>
  313. </div>
  314. <Modal v-model="processModal" title="下生产">
  315. <div>
  316. <div class="process_modal">
  317. <span>生产人员:</span>
  318. <Select
  319. v-model="process_man"
  320. filterable
  321. filter-by-label
  322. clearable
  323. style="width: 150px"
  324. >
  325. <Option
  326. v-for="item in processManList"
  327. :key="item.id"
  328. :label="item.nickname"
  329. :value="item.id"
  330. ></Option>
  331. </Select>
  332. </div>
  333. <div class="process_modal">
  334. <span>选择时间:</span>
  335. <DatePicker
  336. type="date"
  337. :options='options'
  338. v-model="process_start_time"
  339. placeholder="年/月/日"
  340. style="width: 150px"
  341. ></DatePicker>
  342. <DatePicker
  343. type="date"
  344. :options='options'
  345. v-model="process_end_time"
  346. placeholder="年/月/日"
  347. style="width: 150px"
  348. ></DatePicker>
  349. </div>
  350. </div>
  351. <div slot="footer">
  352. <Button
  353. @click="processModal = false"
  354. type="primary"
  355. ghost
  356. style="margin-right: 10px"
  357. >取消</Button
  358. >
  359. <Button
  360. @click="handleProcess"
  361. type="primary"
  362. style="margin-right: 10px"
  363. :disabled="process_control"
  364. >确定</Button
  365. >
  366. </div>
  367. </Modal>
  368. <Modal v-model="showDel" title="" @on-ok='important_del' :closable='false' style="text-align:center" :width='30'>
  369. <div style="margin-top:30px"><span style="margin-right:10px">用户姓名:</span><Input v-model="delData.user_name" style="width:70%"></Input></div>
  370. <div style="margin-top:30px"><span style="margin:0 10px 0 23px">密码:</span><Input v-model="delData.password" style="width:70%"></Input></div>
  371. </Modal>
  372. </div>
  373. </template>
  374. <script>
  375. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  376. // 例如:import 《组件名称》 from '《组件路径》';
  377. export default {
  378. name: "",
  379. components: {},
  380. props: {},
  381. // import引入的组件需要注入到对象中才能使用
  382. data() {
  383. // 这里存放数据
  384. return {
  385. numberList:[],
  386. delData:{
  387. user_name:'',
  388. password:'',
  389. },
  390. options:{},
  391. project_number: this.$route.query.project_number,
  392. project_name: this.$route.query.project_name,
  393. isMatchedSelectAll: false,
  394. matchedInfo: {
  395. id: this.$route.query.id,
  396. image_number: "",
  397. product_name: "",
  398. region: [],
  399. number: [],
  400. part_name: [],
  401. numbers:[],
  402. product_no:''
  403. },
  404. urlMatchedList: [],
  405. productMatchedList: [],
  406. regionMatchedList: [],
  407. numberMatchedList: [],
  408. partNameMatchedList: [],
  409. matchedDetailList: [],
  410. matchedList: [],
  411. matchedSheetTableColumns: [
  412. { title: "序号", align: "center", type: "index", minWidth: 80 },
  413. { title: "楼栋", align: "center",minWidth: 100,key:'house' },
  414. { title: "单元", align: "center",minWidth: 100,key:'unit' },
  415. { title: "楼层", align: "center", minWidth: 100,key:'layer'},
  416. { title: "区域", align: "center", minWidth: 100,key:'region'},
  417. { title: "户型", align: "center", minWidth: 100,key:'household'},
  418. { title: "房号", align: "center", minWidth: 100,key:'house_number'},
  419. { title: "生产数量", align: "center", minWidth: 100,key:'product_num'},
  420. { title: "行号", align: "center", minWidth: 100,key:'line'},
  421. { title: "组合名称", align: "center", key: "compose_name", minWidth: 100 },
  422. { title: "部件名称", align: "center", key: "part_name", minWidth: 100 },
  423. {
  424. title: "产品材料",
  425. align: "center",
  426. minWidth: 100,
  427. key:'material_remark'
  428. },
  429. { title: "饰面名称", align: "center", key: "finish_remark", minWidth: 100 },
  430. { title: "毛料尺寸", align: "center", key: "wool_size", minWidth: 100 },
  431. { title: "精裁尺寸", align: "center", key: "cut_size", minWidth: 100 },
  432. {
  433. title: "数量",
  434. align: "center",
  435. key: "num",
  436. minWidth: 80,
  437. },
  438. {
  439. title: "贴皮方式",
  440. align: "center",
  441. key: "skin",
  442. minWidth: 90,
  443. render:(h,params)=>{
  444. return h('span',{},params.row.skin==1?'单':params.row.skin ==2?'双':params.row.skin==0?'素板':params.row.skin)
  445. }
  446. },
  447. {
  448. title: "封边",
  449. align: "center",
  450. key: "band",
  451. minWidth: 90,
  452. },
  453. { title: "贴皮面积", align: "center", key: "skin_area", minWidth: 100 },
  454. { title: "精裁面积", align: "center", key: "cut_area", minWidth: 100 },
  455. { title: "备注", align: "center", key: "remark", minWidth: 80 },
  456. { title: "打印芯片", align: "center", key: "", minWidth: 100,render:(h,params)=>{
  457. const {row} = params;
  458. return h('span',{},row.chip_state==1?'是':'否')
  459. } },
  460. ], //匹配表头
  461. processModal: false,
  462. process_man: "",
  463. processManList: [],
  464. process_start_time: "",
  465. process_end_time: "",
  466. process_control: false,
  467. cut_order_product_ids: [],
  468. matchedSelectedList: [],
  469. delList:[],
  470. showDel:false,
  471. };
  472. },
  473. // 生命周期 - 创建完成(可以访问当前this实例)
  474. created() {
  475. this.axios("/api/user").then(
  476. (res) => (this.processManList = res.data.data)
  477. );
  478. },
  479. // 生命周期 - 挂载完成(可以访问DOM元素)
  480. mounted() {
  481. this.initData();
  482. },
  483. methods: {
  484. important_del(){
  485. this.axios.post('/api/delete_cut_order_product',{id:[...this.delList],...this.delData}).then(res=>{
  486. if(res.code == 200){
  487. this.$Message.success(res.msg);
  488. this.delList = [];
  489. this.isMatchedSelectAll=false;
  490. this.initData();
  491. }
  492. })
  493. },
  494. handelDel(){
  495. if(this.delList.length == 0){
  496. return this.$Message.warning('请选择要删除的数据')
  497. }
  498. this.confirmDelete({
  499. content: '强制删除么?',
  500. then: () => {
  501. this.showDel = true;
  502. }
  503. })
  504. },
  505. handleMatchedSelectAll(){
  506. this.isMatchedSelectAll = !this.isMatchedSelectAll;
  507. this.matchedSelectedList = [];
  508. this.matchedList.map((v) => {
  509. if (v.produce_status == 0) {
  510. v.isSelect = this.isMatchedSelectAll;
  511. if(v.isSelect){
  512. this.matchedSelectedList.push(v.id)
  513. }
  514. }
  515. });
  516. },
  517. handleMatchedSelect(row, e) {
  518. row.isSelect = e;
  519. console.log(row);
  520. let flag = true;
  521. this.matchedSelectedList = [];
  522. this.matchedList.map((v) => {
  523. if (v.produce_status == 0) {
  524. if (v.isSelect) {
  525. this.matchedSelectedList.push(v.id);
  526. } else {
  527. flag = false;
  528. }
  529. }
  530. });
  531. this.isMatchedSelectAll = flag;
  532. this.cut_order_product_ids = this.matchedSelectedList;
  533. console.log(this.cut_order_product_ids);
  534. },
  535. MatchedSelect(row,e){
  536. row.del_isSelect = e;
  537. console.log(row);
  538. console.log(this.matchedList)
  539. this.delList = [];
  540. this.matchedList.forEach(v=>{
  541. if(v.del_isSelect){
  542. this.delList.push(v.id);
  543. }
  544. })
  545. },
  546. back() {
  547. this.$router.go(-1);
  548. },
  549. handleGoProduction(type, row) {
  550. if (this.matchedSelectedList.length == 0&&type==1) {
  551. return this.$Message.warning("请选择");
  552. }
  553. if (type === 2) {
  554. this.cut_order_product_ids = [row.id];
  555. } else {
  556. this.cut_order_product_ids = this.matchedSelectedList;
  557. }
  558. this.axios.post('/api/bst_get_plan_time',{type:-1,id:this.cut_order_product_ids,order_no:this.$route.query.project_number}).then(res=>{
  559. if(res.code == 200){
  560. this.processModal = true;
  561. let time = [];
  562. res.data.forEach(v=>{
  563. time.push(v*1000);
  564. })
  565. // console.log(Date.parse(new Date()))
  566. this.options = {
  567. disabledDate(date) {
  568. return date && (date.valueOf() < time[0]||date.valueOf()>time[1]);
  569. }
  570. }
  571. }
  572. })
  573. },
  574. handleProcess() {
  575. this.process_control = true;
  576. console.log(this.cut_order_product_ids);
  577. this.axios({
  578. method: "post",
  579. url: "/api/bst_pull",
  580. data: {
  581. cut_order_product_ids: this.cut_order_product_ids,
  582. process_man: this.process_man,
  583. process_start_time: this.func.replaceDateNoHMS(
  584. this.process_start_time
  585. ),
  586. process_end_time: this.func.replaceDateNoHMS(this.process_end_time),
  587. },
  588. }).then((res) => {
  589. if (res.code == 200) {
  590. this.$Message.success(res.msg);
  591. this.processModal = false;
  592. this.matchedSelectedList = [];
  593. this.initData();
  594. }
  595. setTimeout(() => {
  596. this.process_control = false;
  597. }, 500);
  598. });
  599. },
  600. initData() {
  601. this.axios
  602. .post("/api/bst_matching_on_list", {
  603. id: this.matchedInfo.id,
  604. image_number: this.matchedInfo.image_number,
  605. product_name: this.matchedInfo.product_name,
  606. numbers:this.matchedInfo.numbers,
  607. product_no:this.matchedInfo.product_no
  608. })
  609. .then((res) => {
  610. this.matchedList = [];
  611. res.data.list.map((v) => {
  612. v.isCurrenct = false;
  613. });
  614. this.urlMatchedList = res.data.image_number;
  615. this.productMatchedList = res.data.product_name;
  616. this.numberList =res.data.numbers;
  617. // this.matchedList = res.data.list;
  618. res.data.list.forEach((v, index) => {
  619. if (v.matching_status == 2) {
  620. this.matchedList.push(v);
  621. }
  622. });
  623. });
  624. },
  625. handleHiddenMatchedDetail(row) {
  626. if (row.isHidden) {
  627. row.isHidden = !row.isHidden;
  628. } else {
  629. row.isHidden = true;
  630. }
  631. this.$forceUpdate();
  632. },
  633. handleShowCurrencyMatched(row) {
  634. if (row.isCurrenct) {
  635. row.isCurrenct = !row.isCurrenct;
  636. } else {
  637. this.matchedList.map((v) => (v.isCurrenct = false));
  638. row.isCurrenct = true;
  639. }
  640. this.getMatchedDetailList(row);
  641. },
  642. getMatchedDetailList(row) {
  643. row.isCurrenct &&
  644. this.axios
  645. .post("/api/bst_matching_on_detail_2", {
  646. cut_order_product_id: row.id,
  647. id: this.matchedInfo.id,
  648. number: this.matchedInfo.number,
  649. part_name: this.matchedInfo.part_name,
  650. region: this.matchedInfo.region,
  651. })
  652. .then((res) => {
  653. this.regionMatchedList = res.data.region;
  654. this.numberMatchedList = res.data.number;
  655. this.partNameMatchedList = res.data.part_name;
  656. this.matchedDetailList = res.data.list;
  657. });
  658. },
  659. },
  660. // 监听属性 类似于data概念
  661. computed: {},
  662. // 监控data中的数据变化
  663. watch: {},
  664. beforeCreate() {}, // 生命周期 - 创建之前
  665. beforeMount() {}, // 生命周期 - 挂载之前
  666. beforeUpdate() {}, // 生命周期 - 更新之前
  667. updated() {}, // 生命周期 - 更新之后
  668. beforeDestroy() {}, // 生命周期 - 销毁之前
  669. destroyed() {}, // 生命周期 - 销毁完成
  670. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  671. };
  672. </script>
  673. <style lang="scss" scoped>
  674. .context-tabs {
  675. position: relative;
  676. max-height: 650px;
  677. overflow: hidden;
  678. overflow-y: auto;
  679. padding: 15px;
  680. margin: 10px;
  681. margin-bottom: 30px;
  682. border-radius: 5px;
  683. box-shadow: 1px 1px 5px 1px #999;
  684. }
  685. .matched-block {
  686. padding: 15px;
  687. margin-bottom: 30px;
  688. background-color: #e9ecef;
  689. border-radius: 5px;
  690. }
  691. .process_modal {
  692. display: flex;
  693. justify-content: center;
  694. align-items: center;
  695. padding: 10px;
  696. }
  697. /deep/.del_check .ivu-checkbox .ivu-checkbox-inner{
  698. border-radius: 50%;
  699. }
  700. </style>