details.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767
  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)" 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)"
  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. select_nickname:'',
  189. finish_modal:false,
  190. finish_nickname:'',
  191. formData:{
  192. house:'',
  193. unit:'',
  194. layer:'',
  195. number_detail:'',
  196. product_title:'',
  197. url_number:'',
  198. part_title:'',
  199. label:'',
  200. basic_title:'',
  201. procedure_title:'',
  202. state:''
  203. },
  204. form_modal: {
  205. return_list: [
  206. {
  207. procedure_id: "",
  208. user_id: "",
  209. },
  210. ],
  211. // nickname:[],
  212. // user_id:'',
  213. rework_reason: "",
  214. tag: [],
  215. procedure: [],
  216. },
  217. type: 1,
  218. logList: [{ title: "系统单号", value: "10998765" }],
  219. tableColums: [
  220. { type: "selection", fixed: "left", width: "90", align: "center" },
  221. {
  222. title: "房间号",
  223. align: "center",
  224. key: "number_detail",
  225. minWidth: 150,
  226. render: (h, params) => {
  227. const { row } = params;
  228. return h(
  229. "span",
  230. `${row.house}-${row.unit}-${row.layer}-${row.number_detail}`
  231. );
  232. },
  233. },
  234. { title: "产品", align: "center", minWidth: 150, key: "product_title" },
  235. { title: "图号", align: "center", minWidth: 150, key: "url_number" },
  236. { title: "位置", align: "center", minWidth: 150, key: "position" },
  237. { title: "部件", align: "center", minWidth: 150, key: "part_title" },
  238. {
  239. title: "零部件",
  240. align: "center",
  241. minWidth: 150,
  242. key: "part_detail_title",
  243. },
  244. {
  245. title: "部件是否贴标签",
  246. align: "center",
  247. minWidth: 150,
  248. render: (h, params) =>
  249. h("span", {}, params.row.label == "1" ? "是" : "否"),
  250. },
  251. // {title:'贴标签零部件',align:'center',minWidth:150,key:'sub_part'},
  252. {
  253. title: "工序分类",
  254. align: "center",
  255. minWidth: 150,
  256. key: "basic_title",
  257. },
  258. {
  259. title: "工序",
  260. align: "center",
  261. minWidth: 150,
  262. key: "procedure_title",
  263. },
  264. { title: "派工班组", align: "center", minWidth: 150, key: "nickname" },
  265. { title: "完工班组", align: "center", minWidth: 150, key: "finish_nickname" },
  266. { title: "测量尺寸", align: "center", minWidth: 150, key: "measure" },
  267. { title: "单位", align: "center", minWidth: 100, key: "company" },
  268. { title: "芯片编号", align: "center", minWidth: 150, key: "chip" },
  269. {
  270. title: "完工状态",
  271. align: "center",
  272. minWidth: 100,
  273. render: (h, params) =>
  274. h("span", {}, params.row.sub_state == 3 ? "已完工" : "未完工"),
  275. },
  276. {
  277. title: "操作",
  278. align: "center",
  279. slot: "set",
  280. fixed: "right",
  281. width: "150",
  282. },
  283. ],
  284. nickname_list: "",
  285. username_list: [],
  286. export_state:false,
  287. NC_state:false,
  288. tableData: [],
  289. pageIndex: 1,
  290. pageSize: 10,
  291. total: 0,
  292. selectIds: [],
  293. tag: [],
  294. procedure_id: [],
  295. state: [],
  296. modal8: false,
  297. proxyObj: { ...this.$route.query },
  298. house_list: [], //工序分类
  299. unit_list: [], //工序
  300. room_list: [
  301. { label: "已完工", value: "1" },
  302. { label: "未完工", value: "0" },
  303. ], //完工状态
  304. house: [], //楼幢
  305. unit: [], //单元
  306. storey: [], //楼层
  307. room_number: [], //房号
  308. produce: [], //产品
  309. url_number:[],//图号
  310. parts: [], //部件
  311. tip_state: [
  312. { label: "是", value: "1" },
  313. { label: "否", value: "0" },
  314. ], //部件时候贴标签
  315. };
  316. },
  317. created(){
  318. this.axios.get('/api/basics_config_list').then(res=>{
  319. res.data.forEach(element => {
  320. if(element.id == 3){
  321. element.content.forEach(v=>{
  322. if(v.title === '详情导出'){
  323. this.export_state = v.state;
  324. }else if(v.title === 'NC下载'){
  325. this.NC_state = v.state;
  326. }
  327. })
  328. }
  329. });
  330. })
  331. },
  332. computed: {
  333. list() {
  334. const array = [
  335. {
  336. title: "楼幢",
  337. filterable: true,
  338. name: "Select",
  339. value: "",
  340. change:true,
  341. serverName: "house",
  342. optionName: "house",
  343. optionValue: "house",
  344. option: this.house,
  345. },
  346. {
  347. title: "单元",
  348. filterable: true,
  349. name: "Select",
  350. value: "",
  351. change:true,
  352. serverName: "unit",
  353. optionName: "unit",
  354. optionValue: "unit",
  355. option: this.unit,
  356. },
  357. {
  358. title: "楼层",
  359. filterable: true,
  360. name: "Select",
  361. value: "",
  362. change:true,
  363. serverName: "layer",
  364. optionName: "layer",
  365. optionValue: "layer",
  366. option: this.storey,
  367. },
  368. {
  369. title: "房号",
  370. filterable: true,
  371. name: "Select",
  372. value: "",
  373. change:true,
  374. serverName: "number_detail",
  375. optionName: "number",
  376. optionValue: "number",
  377. option: this.room_number,
  378. },
  379. {
  380. title: "产品",
  381. filterable: true,
  382. name: "Select",
  383. value: "",
  384. change:true,
  385. serverName: "product_title",
  386. optionName: "title",
  387. optionValue: "title",
  388. option: this.produce,
  389. },
  390. {
  391. title: "图号",
  392. filterable: true,
  393. name: "Select",
  394. value: "",
  395. change:true,
  396. serverName: "url_number",
  397. optionName: "url_number",
  398. optionValue: "url_number",
  399. option: this.url_number,
  400. },
  401. {
  402. title: "部件",
  403. filterable: true,
  404. name: "Select",
  405. value: "",
  406. change:true,
  407. serverName: "part_title",
  408. optionName: "title",
  409. optionValue: "title",
  410. option: this.parts,
  411. },
  412. {
  413. title: "部件是否贴标签",
  414. filterable: true,
  415. name: "Select",
  416. value: "",
  417. change:true,
  418. serverName: "label",
  419. option: this.tip_state,
  420. },
  421. {
  422. title: "工序分类",
  423. filterable: true,
  424. name: "Select",
  425. value: "",
  426. change:true,
  427. serverName: "basic_title",
  428. optionName: "title",
  429. optionValue: "id",
  430. option: this.house_list,
  431. },
  432. {
  433. title: "工序",
  434. filterable: true,
  435. name: "Select",
  436. value: "",
  437. change:true,
  438. serverName: "procedure_title",
  439. optionName: "title",
  440. optionValue: "id",
  441. option: this.unit_list,
  442. },
  443. {
  444. title: "完工状态",
  445. filterable: true,
  446. name: "Select",
  447. value: "",
  448. change:true,
  449. serverName: "state",
  450. option: this.room_list,
  451. },
  452. ];
  453. return array;
  454. },
  455. },
  456. mounted() {
  457. this.axios("/api/orders_dispatch_detail",
  458. { params: {page_size:this.pageSize,page_index:this.pageIndex,...this.$route.query} }).then((res) => {
  459. if (res.code == 200) {
  460. console.log(res);
  461. this.tableData = res.data.list;
  462. this.logList = res.data.detail;
  463. this.total = res.data.total;
  464. this.produce_id = res.data.produce_id;
  465. this.house = res.data.house;
  466. this.unit = res.data.unit;
  467. this.storey = res.data.layer;
  468. this.room_number = res.data.number_detail;
  469. this.produce = res.data.product_title;
  470. this.url_number = res.data.url_number;
  471. this.parts = res.data.part_title;
  472. this.house_list = res.data.basic_title;
  473. this.unit_list = res.data.procedure_title;
  474. }
  475. });
  476. this.axios("/api/employee_list").then((res) => {
  477. console.log(res);
  478. this.username_list = res.data;
  479. });
  480. },
  481. methods: {
  482. finish_Ok(){
  483. if(!this.finish_nickname){
  484. this.$Message.warning('请选择班组')
  485. }else{
  486. this.postData({id:this.select_nickname,...this.$route.query,team_id:this.finish_nickname},1)
  487. }
  488. },
  489. download(){
  490. this.axios.get('/api/nc_export').then(res=>{
  491. if (res.code == 200) {
  492. let url = `${this.$store.state.ip}/${res.data.file}`;
  493. location.href = url;
  494. }
  495. })
  496. },
  497. leadingOut(){
  498. this.axios.get('/api/dispatch_produce_export',{params:{...this.$route.query}}).then(res=>{
  499. if (res.code == 200) {
  500. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  501. location.href = url;
  502. }
  503. })
  504. },
  505. changeSelected(row){
  506. this.formData.house = row[0].value;
  507. this.formData.unit = row[1].value;
  508. this.formData. layer = row[2].value;
  509. this.formData. number_detail = row[3].value;
  510. this.formData.product_title = row[4].value;
  511. this.formData.url_number = row[5].value;
  512. this.formData.part_title = row[6].value;
  513. this.formData.label = row[7].value;
  514. this.formData.basic_title = row[8].value;
  515. this.formData.procedure_title = row[9].value;
  516. this.formData.state = row[10].value;
  517. },
  518. updata() {
  519. if (this.selectIds == "") {
  520. this.$Message.warning("请选择产品!");
  521. } else {
  522. this.axios.post("/api/orders_dispatch_username", {
  523. id: this.selectIds,
  524. user_id: this.nickname_list,
  525. produce_id: this.$route.query.produce_id,
  526. order_no: this.$route.query.order_no,
  527. });
  528. this.getData(this.$route.query);
  529. }
  530. },
  531. search(row) {
  532. row.page_size = this.pageSize;
  533. row.page_index = this.pageIndex;
  534. Object.assign(row, this.$route.query);
  535. this.axios("/api/orders_dispatch_detail", { params: row }).then((res) => {
  536. if (res.code == 200) {
  537. console.log(res);
  538. this.tableData = res.data.list;
  539. this.logList = res.data.detail;
  540. this.total = res.data.total;
  541. }
  542. });
  543. },
  544. init(row) {
  545. this.pageIndex = 1;
  546. row.page_size = this.pageSize;
  547. row.page_index = this.pageIndex;
  548. Object.assign(row, this.$route.query);
  549. this.getData(row);
  550. },
  551. onOk() {
  552. this.axios
  553. .post("/api/orders_plan_cancer", {
  554. rework_reason: this.form_modal.rework_reason,
  555. return_list: this.form_modal.return_list,
  556. tag: this.tag,
  557. order_no: this.$route.query.order_no,
  558. })
  559. .then((res) => {
  560. if (res.code == 200) {
  561. this.$Message.success(res.msg);
  562. this.getData(this.$route.query);
  563. }
  564. });
  565. },
  566. add() {
  567. this.form_modal.return_list.push({
  568. procedure_id: "",
  569. user_id: "",
  570. });
  571. },
  572. remove(index) {
  573. this.form_modal.return_list.splice(index, 1);
  574. },
  575. workoveragain(row, type) {
  576. this.form_modal.rework_reason = "";
  577. let id = [];
  578. this.modal8 = true;
  579. this.form_modal.id = [];
  580. this.form_modal.procedure_title = [];
  581. console.log(row);
  582. this.form_modal.user_id = row.user_id;
  583. this.form_modal.id.push(row.id);
  584. id.push(row.id);
  585. switch (type) {
  586. //返工
  587. case 1:
  588. this.tag = [row.chip];
  589. this.axios.get("/api/employee_list").then((res) => {
  590. if (res.code == 200) {
  591. // this.$Message.success(res.msg);
  592. // this.getData(this.$route.query)
  593. this.form_modal.nickname = res.data;
  594. }
  595. });
  596. this.axios
  597. .post("/api/orders_dispatch_procedure", { id })
  598. .then((res) => {
  599. if (res.code == 200) {
  600. // this.$Message.success(res.msg);
  601. // this.getData(this.$route.query)
  602. this.form_modal.procedure = res.data;
  603. }
  604. });
  605. break;
  606. //批量返工
  607. case 2:
  608. //若没有选择产品
  609. if (row.length == 0) {
  610. this.$Message.warning("请选择产品!");
  611. this.modal8 = false;
  612. } else {
  613. this.form_modal.procedure_title = [];
  614. //选择了请求班组数据
  615. this.axios.get("/api/employee_list").then((res) => {
  616. if (res.code == 200) {
  617. this.form_modal.nickname = res.data;
  618. }
  619. });
  620. //请求产品数据,此时的row是选择产品id的数组
  621. this.axios
  622. .post("/api/orders_dispatch_procedure", { id: row })
  623. .then((res) => {
  624. if (res.code == 200) {
  625. this.modal8 = true;
  626. // this.$Message.success(res.msg);
  627. // this.getData(this.$route.query)
  628. this.form_modal.procedure = res.data;
  629. this.form_modal.user_id = this.tableData[0].user_id;
  630. // this.form_modal.procedure_title.push(this.procedure_id[0])
  631. this.form_modal.id = row;
  632. } else {
  633. }
  634. });
  635. }
  636. }
  637. },
  638. back() {
  639. this.$router.go(-1);
  640. },
  641. getData(row) {
  642. row.page_size = this.pageSize;
  643. row.page_index = this.pageIndex;
  644. this.axios("/api/orders_dispatch_detail", { params: row }).then((res) => {
  645. if (res.code == 200) {
  646. console.log(res);
  647. this.tableData = res.data.list;
  648. this.logList = res.data.detail;
  649. this.total = res.data.total;
  650. // this.produce_id = res.data.produce_id;
  651. // this.house = res.data.house;
  652. // this.unit = res.data.unit;
  653. // this.storey = res.data.layer;
  654. // this.room_number = res.data.number_detail;
  655. // this.produce = res.data.product_title;
  656. // this.url_number = res.data.url_number;
  657. // this.parts = res.data.part_title;
  658. // this.house_list = res.data.basic_title;
  659. // this.unit_list = res.data.procedure_title;
  660. }
  661. });
  662. },
  663. postData(data, type) {
  664. let url =
  665. type == 1 ? "/api/orders_dispatch_confirm" : "/api/orders_plan_cancer";
  666. this.axios.post(url, data).then((res) => {
  667. if (res.code == 200) {
  668. this.$Message.success(res.msg);
  669. let data = {};
  670. data = {...this.formData,...this.$route.query};
  671. this.getData(data);
  672. this.selectIds = [];
  673. }
  674. });
  675. },
  676. finish(row) {
  677. if (!row || row.length < 1) {
  678. return this.$Message.warning("请至少选择一项");
  679. }
  680. let str = Array.isArray(row) ? row.join(",") : row.id;
  681. this.select_nickname = str;
  682. console.log(this.select_nickname)
  683. this.finish_modal = true;
  684. },
  685. selectTable(e) {
  686. let result = [];
  687. let tag = [];
  688. let procedure_id = [];
  689. let state = [];
  690. e.map((v) => {
  691. result.push(v.id);
  692. tag.push(v.chip);
  693. procedure_id.push(v.procedure_id);
  694. state.push(v.sub_state);
  695. });
  696. this.selectIds = result;
  697. this.tag = tag;
  698. this.procedure_id = procedure_id;
  699. this.state = state;
  700. console.log("this.tag :>> ", this.tag);
  701. },
  702. changePage(e) {
  703. this.pageIndex = e;
  704. this.proxyObj.page_index = this.pageIndex;
  705. let data = {};
  706. data = {...this.formData,...this.proxyObj}
  707. this.getData(data);
  708. },
  709. changeSize(e) {
  710. this.pageSize = e;
  711. this.proxyObj.page_size = this.page_size;
  712. let data = {};
  713. data = {...this.formData,...this.proxyObj}
  714. this.getData(data);
  715. },
  716. batchPrint() {
  717. this.confirmForm({
  718. title: "批量打印派工单",
  719. forms: [
  720. {
  721. name: "Select",
  722. title: "模板",
  723. value: "",
  724. serverName: "template_id",
  725. placeholder: "请选择模板",
  726. option: [
  727. { label: "木工", value: 1 },
  728. { label: "开料", value: 2 },
  729. { label: "贴皮", value: 3 },
  730. { label: "油漆", value: 4 },
  731. { label: "接、拼板", value: 6 },
  732. ],
  733. },
  734. ],
  735. then: (result) => {
  736. this.axios("/api/produce_export", {
  737. params: { ...result, ...this.$route.query },
  738. }).then((res) => {
  739. if (res.code == 200) {
  740. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  741. location.href = url;
  742. }
  743. });
  744. },
  745. });
  746. },
  747. },
  748. };
  749. </script>
  750. <style lang="scss" scoped>
  751. .nickname {
  752. display: flex;
  753. flex-direction: row-reverse;
  754. margin-right: 10px;
  755. margin-bottom: 6px;
  756. }
  757. .log-list {
  758. display: flex;
  759. flex-wrap: wrap;
  760. padding: 10px 0;
  761. }
  762. </style>