confirm.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <div>
  3. <FullPage
  4. title='查看详情'
  5. :list='list'
  6. :logList='logList'
  7. @init="init"
  8. @searchData="search"
  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. >
  18. <div slot='titleButton'>
  19. <Button @click="back" style="margin-right:10px;">返回</Button>
  20. <Button @click="batchPrint" type="primary" style="margin-right:10px;" ghost>打印派工单</Button>
  21. <Button @click="del(selectIds,2)" type="error" style="margin-right:10px;" ghost>批量删除</Button>
  22. <Button @click="finish(selectIds,1)" type="success" ghost>批量完成</Button>
  23. </div>
  24. <template slot='set' slot-scope='{row}'>
  25. <div>
  26. <a v-if="row.sub_state<3" class="map-margin" style="color:#32C800" @click="finish(row,1)">完成</a>
  27. <a class="map-margin" style="color:#ed4014" @click="del(row,1)">删除</a>
  28. </div>
  29. </template>
  30. </FullPage>
  31. </div>
  32. </template>
  33. <script>
  34. export default {
  35. data(){
  36. return {
  37. form_modal:{
  38. nickname:[],
  39. user_id:'',
  40. rework_reason:'',
  41. id:[],
  42. procedure:[],
  43. procedure_title:[],
  44. },
  45. type:1,
  46. logList:[{title:'系统单号',value:'10998765'}],
  47. tableColums:[
  48. {type:'selection',fixed:'left',width:'90',align:'center'},
  49. {title:'房间号',align:'center',key:'number_detail',minWidth:150,
  50. render:(h,params)=>{
  51. const {row} = params
  52. return h('span',`${row.house}-${row.unit}-${row.layer}-${row.number_detail}`)
  53. }
  54. },
  55. {title:'产品',align:'center',minWidth:150,key:'product_title'},
  56. {title:'图号',align:'center',minWidth:150,key:'url_number'},
  57. {title:'位置',align:'center',minWidth:150,key:'position'},
  58. {title:'部件',align:'center',minWidth:150,key:'part_title'},
  59. {title:'零部件',align:'center',minWidth:150,key:'part_detail_title'},
  60. {title:'部件是否贴标签',align:'center',minWidth:150,
  61. render:(h,params)=>h('span',{},params.row.label == '1' ? '是' : '否')
  62. },
  63. // {title:'贴标签零部件',align:'center',minWidth:150,key:'sub_part'},
  64. {title:'工序分类',align:'center',minWidth:150,key:'basic_title'},
  65. {title:'工序',align:'center',minWidth:150,key:'procedure_title'},
  66. {title:'班组',align:'center',minWidth:150,key:'nickname'},
  67. {title:'测量尺寸',align:'center',minWidth:150,key:'measure'},
  68. {title:'单位',align:'center',minWidth:100,key:'company'},
  69. {title:'芯片编号',align:'center',minWidth:150,key:'chip'},
  70. {title:'完工状态',align:'center',minWidth:100,
  71. render:(h,params)=>h('span',{},params.row.state == 1 ? '已完工' : '未完工')
  72. },
  73. {title:'返工原因',align:'center',minWidth:150,key:'rework_reason'},
  74. {title:'操作',align:'center',slot:'set',fixed:'right',width:'150'},
  75. ],
  76. tableData:[],
  77. pageIndex:1,
  78. pageSize:10,
  79. total:0,
  80. selectIds:[],
  81. tag:[],
  82. produce_id:[],
  83. id:[],
  84. modal8:false,
  85. proxyObj:{...this.$route.query},
  86. house_list:[], //工序分类
  87. unit_list:[], //工序
  88. room_list:[
  89. {label:'已完工',value:'1'},
  90. {label:'未完工',value:'0'}
  91. ], //完工状态
  92. house:[], //楼幢
  93. unit:[], //单元
  94. storey:[], //楼层
  95. room_number:[], //房号
  96. produce:[], //产品
  97. url_number:[], //图号
  98. parts:[], //部件
  99. tip_state:[
  100. {label:'是',value:'1'},
  101. {label:'否',value:'0'}
  102. ], //部件时候贴标签
  103. }
  104. },
  105. computed:{
  106. list() {
  107. const array = [
  108. {
  109. title: "楼幢",
  110. filterable: true,
  111. name: "Select",
  112. value: "",
  113. serverName: "house",
  114. optionName: "house",
  115. optionValue: "house",
  116. option: this.house,
  117. },
  118. {
  119. title: "单元",
  120. filterable: true,
  121. name: "Select",
  122. value: "",
  123. serverName: "unit",
  124. optionName: "unit",
  125. optionValue: "unit",
  126. option: this.unit,
  127. },
  128. {
  129. title: "楼层",
  130. filterable: true,
  131. name: "Select",
  132. value: "",
  133. serverName: "layer",
  134. optionName: "layer",
  135. optionValue: "layer",
  136. option: this.storey,
  137. },
  138. {
  139. title: "房号",
  140. filterable: true,
  141. name: "Select",
  142. value: "",
  143. serverName: "number_detail",
  144. optionName: "number",
  145. optionValue: "number",
  146. option: this.room_number,
  147. },
  148. {
  149. title: "产品",
  150. filterable: true,
  151. name: "Select",
  152. value: "",
  153. serverName: "product_title",
  154. optionName: "title",
  155. optionValue: "title",
  156. option: this.produce,
  157. },
  158. {
  159. title: "图号",
  160. filterable: true,
  161. name: "Select",
  162. value: "",
  163. serverName: "url_number",
  164. optionName: "url_number",
  165. optionValue: "url_number",
  166. option: this.url_number,
  167. },
  168. {
  169. title: "部件",
  170. filterable: true,
  171. name: "Select",
  172. value: "",
  173. serverName: "part_title",
  174. optionName: "title",
  175. optionValue: "title",
  176. option: this.parts,
  177. },
  178. {
  179. title: "部件是否贴标签",
  180. filterable: true,
  181. name: "Select",
  182. value: "",
  183. serverName: "label",
  184. option: this.tip_state,
  185. },
  186. {
  187. title: "工序分类",
  188. filterable: true,
  189. name: "Select",
  190. value: "",
  191. serverName: "basic_title",
  192. optionName: "title",
  193. optionValue: "id",
  194. option: this.house_list,
  195. },
  196. {
  197. title: "工序",
  198. filterable: true,
  199. name: "Select",
  200. value: "",
  201. serverName: "procedure_title",
  202. optionName: "title",
  203. optionValue: "id",
  204. option: this.unit_list,
  205. },
  206. {
  207. title: "完工状态",
  208. filterable: true,
  209. name: "Select",
  210. value: '',
  211. serverName: "state",
  212. option: this.room_list,
  213. }
  214. ];
  215. return array;
  216. },
  217. },
  218. mounted(){
  219. this.getData(this.$route.query)
  220. },
  221. methods:{
  222. search(row){
  223. console.log(row)
  224. row.page_size = this.pageSize
  225. row.page_index = this.pageIndex
  226. Object.assign(row, this.$route.query);
  227. this.axios('/api/orders_rework_detail',{params:row}).then(res=>{
  228. if(res.code == 200){
  229. console.log(res)
  230. this.tableData = res.data.list;
  231. this.logList = res.data.detail;
  232. this.total = res.data.total
  233. }
  234. })
  235. },
  236. init(row){
  237. this.pageIndex = 1;
  238. row.page_size = this.pageSize;
  239. row.page_index = this.pageIndex;
  240. Object.assign(row, this.$route.query);
  241. this.getData(row);
  242. },
  243. del(row,type){
  244. switch(type){
  245. case 1:
  246. let id = [];
  247. id.push(row.id)
  248. console.log(this.tableData)
  249. this.confirmDelete({
  250. content: "确认删除么?",
  251. then: () => {
  252. this.axios
  253. .post("/api/orders_rework_del", {
  254. order_no:this.logList[0].value,
  255. produce_id:this.produce_id,
  256. id:id
  257. })
  258. .then((res) => {
  259. if (res.code == 200) {
  260. this.$Message.success(res.msg);
  261. this.getData({order_no:this.logList[0].value,
  262. produce_id:this.produce_id
  263. });
  264. }
  265. });
  266. },
  267. });
  268. break;
  269. case 2:
  270. if(row.length == 0){
  271. this.$Message.error('请选择要删除的产品')
  272. }else{ this.confirmDelete({
  273. content: "确认删除么?",
  274. then: () => {
  275. this.axios
  276. .post("/api/orders_rework_del", {
  277. order_no:this.logList[0].value,
  278. produce_id:this.produce_id,
  279. id:this.id
  280. })
  281. .then((res) => {
  282. if (res.code == 200) {
  283. this.$Message.success(res.msg);
  284. this.getData({order_no:this.logList[0].value,
  285. produce_id:this.produce_id});
  286. }
  287. });
  288. },
  289. });}
  290. }
  291. },
  292. back(){
  293. this.$router.go(-1)
  294. },
  295. getData(row){
  296. row.page_size = this.pageSize
  297. row.page_index = this.pageIndex
  298. this.axios('/api/orders_rework_detail',{params:row}).then(res=>{
  299. if(res.code == 200){
  300. console.log(res)
  301. this.tableData = res.data.list;
  302. this.logList = res.data.detail;
  303. this.total = res.data.total;
  304. this.produce_id = res.data.produce_id;
  305. this.house = res.data.house;
  306. this.unit = res.data.unit;
  307. this.storey = res.data.layer
  308. this.room_number = res.data.number_detail
  309. this.produce = res.data.product_title
  310. this.url_number = res.data.url_number
  311. this.parts = res.data.part_title
  312. this.house_list = res.data.basic_title
  313. this.unit_list = res.data.procedure_title
  314. }
  315. })
  316. },
  317. postData(data,type){
  318. let url = type == 1 ? '/api/orders_dispatch_confirm' : '/api/orders_plan_cancer'
  319. this.axios.post(url,data).then(res=>{
  320. if(res.code == 200){
  321. this.$Message.success(res.msg);
  322. this.getData(this.$route.query)
  323. }
  324. })
  325. },
  326. finish(row,type){
  327. if(!row||row.length<1){return this.$Message.warning('请至少选择一项')}
  328. let str = Array.isArray(row) ? row.join(',') : row.id
  329. this.confirmDelete({
  330. content:type == 1 ? '是否手动操作此订单生产完成' : '确认驳回?',
  331. title:type == 1 ? '生产完成' : '驳回',
  332. type:type == 1 ? 'primary' : 'error',
  333. then:()=>{
  334. this.postData({id:str},type)
  335. },
  336. cancel:()=>{}
  337. })
  338. },
  339. selectTable(e){
  340. let id = [];
  341. let result = [];
  342. e.map(v=>{
  343. result.push(v.id)
  344. id.push(v.id)
  345. });
  346. this.selectIds = result;
  347. this.id =id;
  348. console.log(this.id);
  349. },
  350. changePage(e){
  351. this.pageIndex = e;
  352. this.proxyObj.page_index = this.pageIndex;
  353. this.getData(this.proxyObj)
  354. },
  355. changeSize(e){
  356. this.pageSize = e;
  357. this.proxyObj.page_size = this.page_size;
  358. this.getData(this.proxyObj)
  359. },
  360. batchPrint(){
  361. this.confirmForm({
  362. title:'批量打印派工单',
  363. forms:[
  364. {name:'Select',title:'模板',value:'',serverName:'template_id',placeholder:'请选择模板',
  365. option:[
  366. {label:'木工',value:1},
  367. {label:'开料',value:2},
  368. {label:'贴皮',value:3},
  369. {label:'油漆',value:4},
  370. {label:'接、拼板',value:6}
  371. ]
  372. },
  373. ],
  374. then:(result)=>{
  375. this.axios('/api/produce_export',{params:{...result,...this.$route.query}}).then(res=>{
  376. if(res.code == 200){
  377. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`
  378. location.href = url
  379. }
  380. })
  381. }
  382. })
  383. }
  384. }
  385. }
  386. </script>
  387. <style lang="scss" scoped>
  388. .log-list{display: flex;flex-wrap:wrap;padding:10px 0;}
  389. </style>