details.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. <template>
  2. <div>
  3. <FullPage
  4. title="查看详情"
  5. :list="list"
  6. @init="init"
  7. @searchData="search"
  8. :logList="logList"
  9. @selectTable="selectTable"
  10. @changePage="changePage"
  11. @changeSize="changeSize"
  12. :tableColums="tableColums"
  13. :tableData="tableData"
  14. :pageIndex="pageIndex"
  15. :pageSize="pageSize"
  16. :total="total"
  17. @changeSelected="changeSelected"
  18. >
  19. <div slot="titleButton">
  20. <Button @click="back" style="margin-right:10px;">返回</Button>
  21. <Button
  22. v-if="export_state"
  23. @click="leadingOut"
  24. type="primary"
  25. style="margin-right:10px;"
  26. ghost
  27. >导出</Button
  28. >
  29. <Button
  30. @click="batchPrint"
  31. type="primary"
  32. style="margin-right:10px;"
  33. ghost
  34. >打印派工单</Button
  35. >
  36. <Button
  37. @click="workoveragain(selectIds, 2)"
  38. type="error"
  39. style="margin-right:10px;"
  40. ghost
  41. >批量返工</Button
  42. >
  43. <Button @click="finish(selectIds, 1)" type="success" ghost
  44. >批量完成</Button
  45. >
  46. </div>
  47. <template slot="set" slot-scope="{ row }">
  48. <div>
  49. <a
  50. v-if="row.sub_state < 3"
  51. class="map-margin"
  52. style="color:#32C800"
  53. @click="finish(row, 1)"
  54. >完成</a
  55. >
  56. <a
  57. class="map-margin"
  58. style="color:#ed4014"
  59. v-if="row.sub_state == 3"
  60. @click="workoveragain(row, 1)"
  61. >返工</a
  62. >
  63. <a
  64. class="map-margin"
  65. v-if="NC_state"
  66. @click="download"
  67. >
  68. NC下载
  69. </a>
  70. </div>
  71. </template>
  72. <div slot="text-list" class="nickname">
  73. <Button
  74. type="primary"
  75. style="margin-left:10px;"
  76. ghost
  77. size="small"
  78. @click="updata"
  79. >修改班组</Button
  80. >
  81. <Select v-model="nickname_list" style="width:160px" size="small">
  82. <Option
  83. v-for="item in username_list"
  84. :value="item.id"
  85. :key="item.value"
  86. >{{ item.nickname }}</Option
  87. >
  88. </Select>
  89. </div>
  90. </FullPage>
  91. <div>
  92. <Modal
  93. title="返工"
  94. v-model="modal8"
  95. :mask-closable="false"
  96. width="800"
  97. @on-ok="onOk"
  98. >
  99. <Form :model="form_modal" inline :label-width="80">
  100. <div v-for="(item, index) in form_modal.return_list" :key="index">
  101. <FormItem :label="'返工工序' + (index + 1) + ':'">
  102. <Select v-model="item.procedure_id" style="width:180px">
  103. <Option
  104. :value="item.id"
  105. v-for="item in form_modal.procedure"
  106. :key="item.id"
  107. >{{ item.title }}</Option
  108. >
  109. </Select>
  110. </FormItem>
  111. <FormItem label="返工班组:">
  112. <Select v-model="item.user_id" style="width:180px">
  113. <Option
  114. :value="item.id"
  115. v-for="(item, index) in form_modal.nickname"
  116. :key="index"
  117. >{{ item.nickname }}</Option
  118. >
  119. </Select>
  120. </FormItem>
  121. <FormItem>
  122. <Icon
  123. @click="add()"
  124. style="'margin:0 10px"
  125. color="#32C800"
  126. size="20"
  127. type="ios-add-circle"
  128. />
  129. <Icon
  130. v-show="form_modal.return_list.length != 1"
  131. @click="remove(index)"
  132. style="'margin:0 10px"
  133. color="#FF5E5C"
  134. size="20"
  135. type="ios-remove-circle"
  136. />
  137. </FormItem>
  138. </div>
  139. <FormItem label="返工原因:">
  140. <Input
  141. v-model="form_modal.rework_reason"
  142. type="textarea"
  143. :autosize="{ minRows: 2, maxRows: 5 }"
  144. placeholder="请输入返工原因"
  145. />
  146. </FormItem>
  147. <!-- <FormItem>
  148. <Select v-model="formItem.select">
  149. <Option value="beijing">New York</Option>
  150. <Option value="shanghai">London</Option>
  151. <Option value="shenzhen">Sydney</Option>
  152. </Select>
  153. </FormItem>
  154. <FormItem>
  155. <Select v-model="formItem.select">
  156. <Option value="beijing">New York</Option>
  157. <Option value="shanghai">London</Option>
  158. <Option value="shenzhen">Sydney</Option>
  159. </Select>
  160. </FormItem> -->
  161. </Form>
  162. </Modal>
  163. <Modal
  164. title="返工"
  165. v-model="finish_modal"
  166. width="400"
  167. @on-ok="finish_Ok">
  168. <Form>
  169. <FormItem label="返工班组:">
  170. <Select v-model="finish_nickname" style="width:180px">
  171. <Option
  172. :value="item.id"
  173. v-for="(item, index) in username_list"
  174. :key="index"
  175. >{{ item.nickname }}</Option
  176. >
  177. </Select>
  178. </FormItem>
  179. </Form>
  180. </Modal>
  181. </div>
  182. </div>
  183. </template>
  184. <script>
  185. export default {
  186. data() {
  187. return {
  188. finish_modal:false,
  189. finish_nickname:'',
  190. formData:{
  191. house:'',
  192. unit:'',
  193. layer:'',
  194. number_detail:'',
  195. product_title:'',
  196. url_number:'',
  197. part_title:'',
  198. label:'',
  199. basic_title:'',
  200. procedure_title:'',
  201. state:''
  202. },
  203. form_modal: {
  204. return_list: [
  205. {
  206. procedure_id: "",
  207. user_id: "",
  208. },
  209. ],
  210. // nickname:[],
  211. // user_id:'',
  212. rework_reason: "",
  213. tag: [],
  214. procedure: [],
  215. },
  216. type: 1,
  217. logList: [{ title: "系统单号", value: "10998765" }],
  218. tableColums: [
  219. { type: "selection", fixed: "left", width: "90", align: "center" },
  220. {
  221. title: "房间号",
  222. align: "center",
  223. key: "number_detail",
  224. minWidth: 150,
  225. render: (h, params) => {
  226. const { row } = params;
  227. return h(
  228. "span",
  229. `${row.house}-${row.unit}-${row.layer}-${row.number_detail}`
  230. );
  231. },
  232. },
  233. { title: "产品", align: "center", minWidth: 150, key: "product_title" },
  234. { title: "图号", align: "center", minWidth: 150, key: "url_number" },
  235. { title: "位置", align: "center", minWidth: 150, key: "position" },
  236. { title: "部件", align: "center", minWidth: 150, key: "part_title" },
  237. {
  238. title: "零部件",
  239. align: "center",
  240. minWidth: 150,
  241. key: "part_detail_title",
  242. },
  243. {
  244. title: "部件是否贴标签",
  245. align: "center",
  246. minWidth: 150,
  247. render: (h, params) =>
  248. h("span", {}, params.row.label == "1" ? "是" : "否"),
  249. },
  250. // {title:'贴标签零部件',align:'center',minWidth:150,key:'sub_part'},
  251. {
  252. title: "工序分类",
  253. align: "center",
  254. minWidth: 150,
  255. key: "basic_title",
  256. },
  257. {
  258. title: "工序",
  259. align: "center",
  260. minWidth: 150,
  261. key: "procedure_title",
  262. },
  263. { title: "派工班组", align: "center", minWidth: 150, key: "nickname" },
  264. { title: "完工班组", align: "center", minWidth: 150, key: "finish_nickname" },
  265. { title: "测量尺寸", align: "center", minWidth: 150, key: "measure" },
  266. { title: "单位", align: "center", minWidth: 100, key: "company" },
  267. { title: "芯片编号", align: "center", minWidth: 150, key: "chip" },
  268. {
  269. title: "完工状态",
  270. align: "center",
  271. minWidth: 100,
  272. render: (h, params) =>
  273. h("span", {}, params.row.sub_state == 3 ? "已完工" : "未完工"),
  274. },
  275. {
  276. title: "操作",
  277. align: "center",
  278. slot: "set",
  279. fixed: "right",
  280. width: "150",
  281. },
  282. ],
  283. nickname_list: "",
  284. username_list: [],
  285. export_state:false,
  286. NC_state:false,
  287. tableData: [],
  288. pageIndex: 1,
  289. pageSize: 10,
  290. total: 0,
  291. selectIds: [],
  292. tag: [],
  293. procedure_id: [],
  294. state: [],
  295. modal8: false,
  296. proxyObj: { ...this.$route.query },
  297. house_list: [], //工序分类
  298. unit_list: [], //工序
  299. room_list: [
  300. { label: "已完工", value: "1" },
  301. { label: "未完工", value: "0" },
  302. ], //完工状态
  303. house: [], //楼幢
  304. unit: [], //单元
  305. storey: [], //楼层
  306. room_number: [], //房号
  307. produce: [], //产品
  308. url_number:[],//图号
  309. parts: [], //部件
  310. tip_state: [
  311. { label: "是", value: "1" },
  312. { label: "否", value: "0" },
  313. ], //部件时候贴标签
  314. };
  315. },
  316. created(){
  317. this.axios.get('/api/basics_config_list').then(res=>{
  318. res.data.forEach(element => {
  319. if(element.id == 3){
  320. element.content.forEach(v=>{
  321. if(v.title === '详情导出'){
  322. this.export_state = v.state;
  323. }else if(v.title === 'NC下载'){
  324. this.NC_state = v.state;
  325. }
  326. })
  327. }
  328. });
  329. })
  330. },
  331. computed: {
  332. list() {
  333. const array = [
  334. {
  335. title: "楼幢",
  336. filterable: true,
  337. name: "Select",
  338. value: "",
  339. change:true,
  340. serverName: "house",
  341. optionName: "house",
  342. optionValue: "house",
  343. option: this.house,
  344. },
  345. {
  346. title: "单元",
  347. filterable: true,
  348. name: "Select",
  349. value: "",
  350. change:true,
  351. serverName: "unit",
  352. optionName: "unit",
  353. optionValue: "unit",
  354. option: this.unit,
  355. },
  356. {
  357. title: "楼层",
  358. filterable: true,
  359. name: "Select",
  360. value: "",
  361. change:true,
  362. serverName: "layer",
  363. optionName: "layer",
  364. optionValue: "layer",
  365. option: this.storey,
  366. },
  367. {
  368. title: "房号",
  369. filterable: true,
  370. name: "Select",
  371. value: "",
  372. change:true,
  373. serverName: "number_detail",
  374. optionName: "number",
  375. optionValue: "number",
  376. option: this.room_number,
  377. },
  378. {
  379. title: "产品",
  380. filterable: true,
  381. name: "Select",
  382. value: "",
  383. change:true,
  384. serverName: "product_title",
  385. optionName: "title",
  386. optionValue: "title",
  387. option: this.produce,
  388. },
  389. {
  390. title: "图号",
  391. filterable: true,
  392. name: "Select",
  393. value: "",
  394. change:true,
  395. serverName: "url_number",
  396. optionName: "url_number",
  397. optionValue: "url_number",
  398. option: this.url_number,
  399. },
  400. {
  401. title: "部件",
  402. filterable: true,
  403. name: "Select",
  404. value: "",
  405. change:true,
  406. serverName: "part_title",
  407. optionName: "title",
  408. optionValue: "title",
  409. option: this.parts,
  410. },
  411. {
  412. title: "部件是否贴标签",
  413. filterable: true,
  414. name: "Select",
  415. value: "",
  416. change:true,
  417. serverName: "label",
  418. option: this.tip_state,
  419. },
  420. {
  421. title: "工序分类",
  422. filterable: true,
  423. name: "Select",
  424. value: "",
  425. change:true,
  426. serverName: "basic_title",
  427. optionName: "title",
  428. optionValue: "id",
  429. option: this.house_list,
  430. },
  431. {
  432. title: "工序",
  433. filterable: true,
  434. name: "Select",
  435. value: "",
  436. change:true,
  437. serverName: "procedure_title",
  438. optionName: "title",
  439. optionValue: "id",
  440. option: this.unit_list,
  441. },
  442. {
  443. title: "完工状态",
  444. filterable: true,
  445. name: "Select",
  446. value: "",
  447. change:true,
  448. serverName: "state",
  449. option: this.room_list,
  450. },
  451. ];
  452. return array;
  453. },
  454. },
  455. mounted() {
  456. this.axios("/api/orders_dispatch_detail",
  457. { params: {page_size:this.pageSize,page_index:this.pageIndex,...this.$route.query} }).then((res) => {
  458. if (res.code == 200) {
  459. console.log(res);
  460. this.tableData = res.data.list;
  461. this.logList = res.data.detail;
  462. this.total = res.data.total;
  463. this.produce_id = res.data.produce_id;
  464. this.house = res.data.house;
  465. this.unit = res.data.unit;
  466. this.storey = res.data.layer;
  467. this.room_number = res.data.number_detail;
  468. this.produce = res.data.product_title;
  469. this.url_number = res.data.url_number;
  470. this.parts = res.data.part_title;
  471. this.house_list = res.data.basic_title;
  472. this.unit_list = res.data.procedure_title;
  473. }
  474. });
  475. this.axios("/api/employee_list").then((res) => {
  476. console.log(res);
  477. this.username_list = res.data;
  478. });
  479. },
  480. methods: {
  481. finish_Ok(){
  482. },
  483. download(){
  484. this.axios.get('/api/nc_export').then(res=>{
  485. if (res.code == 200) {
  486. let url = `${this.$store.state.ip}/${res.data.file}`;
  487. location.href = url;
  488. }
  489. })
  490. },
  491. leadingOut(){
  492. this.axios.get('/api/dispatch_produce_export',{params:{...this.$route.query}}).then(res=>{
  493. if (res.code == 200) {
  494. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  495. location.href = url;
  496. }
  497. })
  498. },
  499. changeSelected(row){
  500. this.formData.house = row[0].value;
  501. this.formData.unit = row[1].value;
  502. this.formData. layer = row[2].value;
  503. this.formData. number_detail = row[3].value;
  504. this.formData.product_title = row[4].value;
  505. this.formData.url_number = row[5].value;
  506. this.formData.part_title = row[6].value;
  507. this.formData.label = row[7].value;
  508. this.formData.basic_title = row[8].value;
  509. this.formData.procedure_title = row[9].value;
  510. this.formData.state = row[10].value;
  511. },
  512. updata() {
  513. if (this.selectIds == "") {
  514. this.$Message.warning("请选择产品!");
  515. } else {
  516. this.axios.post("/api/orders_dispatch_username", {
  517. id: this.selectIds,
  518. user_id: this.nickname_list,
  519. produce_id: this.$route.query.produce_id,
  520. order_no: this.$route.query.order_no,
  521. });
  522. this.getData(this.$route.query);
  523. }
  524. },
  525. search(row) {
  526. row.page_size = this.pageSize;
  527. row.page_index = this.pageIndex;
  528. Object.assign(row, this.$route.query);
  529. this.axios("/api/orders_dispatch_detail", { params: row }).then((res) => {
  530. if (res.code == 200) {
  531. console.log(res);
  532. this.tableData = res.data.list;
  533. this.logList = res.data.detail;
  534. this.total = res.data.total;
  535. }
  536. });
  537. },
  538. init(row) {
  539. this.pageIndex = 1;
  540. row.page_size = this.pageSize;
  541. row.page_index = this.pageIndex;
  542. Object.assign(row, this.$route.query);
  543. this.getData(row);
  544. },
  545. onOk() {
  546. this.axios
  547. .post("/api/orders_plan_cancer", {
  548. rework_reason: this.form_modal.rework_reason,
  549. return_list: this.form_modal.return_list,
  550. tag: this.tag,
  551. order_no: this.$route.query.order_no,
  552. })
  553. .then((res) => {
  554. if (res.code == 200) {
  555. this.$Message.success(res.msg);
  556. this.getData(this.$route.query);
  557. }
  558. });
  559. },
  560. add() {
  561. this.form_modal.return_list.push({
  562. procedure_id: "",
  563. user_id: "",
  564. });
  565. },
  566. remove(index) {
  567. this.form_modal.return_list.splice(index, 1);
  568. },
  569. workoveragain(row, type) {
  570. this.form_modal.rework_reason = "";
  571. let id = [];
  572. this.modal8 = true;
  573. this.form_modal.id = [];
  574. this.form_modal.procedure_title = [];
  575. console.log(row);
  576. this.form_modal.user_id = row.user_id;
  577. this.form_modal.id.push(row.id);
  578. id.push(row.id);
  579. switch (type) {
  580. //返工
  581. case 1:
  582. this.tag = [row.chip];
  583. this.axios.get("/api/employee_list").then((res) => {
  584. if (res.code == 200) {
  585. // this.$Message.success(res.msg);
  586. // this.getData(this.$route.query)
  587. this.form_modal.nickname = res.data;
  588. }
  589. });
  590. this.axios
  591. .post("/api/orders_dispatch_procedure", { id })
  592. .then((res) => {
  593. if (res.code == 200) {
  594. // this.$Message.success(res.msg);
  595. // this.getData(this.$route.query)
  596. this.form_modal.procedure = res.data;
  597. }
  598. });
  599. break;
  600. //批量返工
  601. case 2:
  602. //若没有选择产品
  603. if (row.length == 0) {
  604. this.$Message.warning("请选择产品!");
  605. } else {
  606. this.form_modal.procedure_title = [];
  607. //选择了请求班组数据
  608. this.axios.get("/api/employee_list").then((res) => {
  609. if (res.code == 200) {
  610. this.form_modal.nickname = res.data;
  611. }
  612. });
  613. //请求产品数据,此时的row是选择产品id的数组
  614. this.axios
  615. .post("/api/orders_dispatch_procedure", { id: row })
  616. .then((res) => {
  617. if (res.code == 200) {
  618. this.modal8 = true;
  619. // this.$Message.success(res.msg);
  620. // this.getData(this.$route.query)
  621. this.form_modal.procedure = res.data;
  622. this.form_modal.user_id = this.tableData[0].user_id;
  623. // this.form_modal.procedure_title.push(this.procedure_id[0])
  624. this.form_modal.id = row;
  625. } else {
  626. }
  627. });
  628. }
  629. }
  630. },
  631. back() {
  632. this.$router.go(-1);
  633. },
  634. getData(row) {
  635. row.page_size = this.pageSize;
  636. row.page_index = this.pageIndex;
  637. this.axios("/api/orders_dispatch_detail", { params: row }).then((res) => {
  638. if (res.code == 200) {
  639. console.log(res);
  640. this.tableData = res.data.list;
  641. this.logList = res.data.detail;
  642. this.total = res.data.total;
  643. // this.produce_id = res.data.produce_id;
  644. // this.house = res.data.house;
  645. // this.unit = res.data.unit;
  646. // this.storey = res.data.layer;
  647. // this.room_number = res.data.number_detail;
  648. // this.produce = res.data.product_title;
  649. // this.url_number = res.data.url_number;
  650. // this.parts = res.data.part_title;
  651. // this.house_list = res.data.basic_title;
  652. // this.unit_list = res.data.procedure_title;
  653. }
  654. });
  655. },
  656. postData(data, type) {
  657. let url =
  658. type == 1 ? "/api/orders_dispatch_confirm" : "/api/orders_plan_cancer";
  659. this.axios.post(url, data).then((res) => {
  660. if (res.code == 200) {
  661. this.$Message.success(res.msg);
  662. let data = {};
  663. data = {...this.formData,...this.$route.query};
  664. this.getData(data);
  665. }
  666. });
  667. },
  668. finish(row, type) {
  669. if (!row || row.length < 1) {
  670. return this.$Message.warning("请至少选择一项");
  671. }
  672. let str = Array.isArray(row) ? row.join(",") : row.id;
  673. this.finish_modal = true;
  674. },
  675. selectTable(e) {
  676. let result = [];
  677. let tag = [];
  678. let procedure_id = [];
  679. let state = [];
  680. e.map((v) => {
  681. result.push(v.id);
  682. tag.push(v.chip);
  683. procedure_id.push(v.procedure_id);
  684. state.push(v.sub_state);
  685. });
  686. this.selectIds = result;
  687. this.tag = tag;
  688. this.procedure_id = procedure_id;
  689. this.state = state;
  690. console.log("this.tag :>> ", this.tag);
  691. },
  692. changePage(e) {
  693. this.pageIndex = e;
  694. this.proxyObj.page_index = this.pageIndex;
  695. let data = {};
  696. data = {...this.formData,...this.proxyObj}
  697. this.getData(data);
  698. },
  699. changeSize(e) {
  700. this.pageSize = e;
  701. this.proxyObj.page_size = this.page_size;
  702. let data = {};
  703. data = {...this.formData,...this.proxyObj}
  704. this.getData(data);
  705. },
  706. batchPrint() {
  707. this.confirmForm({
  708. title: "批量打印派工单",
  709. forms: [
  710. {
  711. name: "Select",
  712. title: "模板",
  713. value: "",
  714. serverName: "template_id",
  715. placeholder: "请选择模板",
  716. option: [
  717. { label: "木工", value: 1 },
  718. { label: "开料", value: 2 },
  719. { label: "贴皮", value: 3 },
  720. { label: "油漆", value: 4 },
  721. { label: "接、拼板", value: 6 },
  722. ],
  723. },
  724. ],
  725. then: (result) => {
  726. this.axios("/api/produce_export", {
  727. params: { ...result, ...this.$route.query },
  728. }).then((res) => {
  729. if (res.code == 200) {
  730. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  731. location.href = url;
  732. }
  733. });
  734. },
  735. });
  736. },
  737. },
  738. };
  739. </script>
  740. <style lang="scss" scoped>
  741. .nickname {
  742. display: flex;
  743. flex-direction: row-reverse;
  744. margin-right: 10px;
  745. margin-bottom: 6px;
  746. }
  747. .log-list {
  748. display: flex;
  749. flex-wrap: wrap;
  750. padding: 10px 0;
  751. }
  752. </style>