HXYMatchCheck.vue 20 KB

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