confirm.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div>
  3. <FullPage
  4. title='派工单详情列表'
  5. :list='list'
  6. @init='init'
  7. @searchData='init'
  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. >
  18. <div slot='titleButton'>
  19. <Button @click="back" style="margin-right:10px;">返回</Button>
  20. <Button @click="finish(selectIds,1)" type="success" ghost>批量完成</Button>
  21. </div>
  22. <template slot='set' slot-scope='{row}'>
  23. <div>
  24. <a class="map-margin" @click="goOriginalPage(row)">原材料预算</a>
  25. <a v-if="row.state != 3" class="map-margin" style="color:#32C800" @click="finish(row,1)">完成</a>
  26. <a class="map-margin" @click="goDetial(row,1)">查看详情</a>
  27. </div>
  28. </template>
  29. </FullPage>
  30. </div>
  31. </template>
  32. <script>
  33. export default {
  34. data(){
  35. return {
  36. type:1,
  37. logList:[{title:'系统单号',value:'10998765'}],
  38. tableColums:[
  39. {type:'selection',fixed:'left',width:'90',align:'center'},
  40. {title:'工序分类',align:'center',minWidth:150,key:'basic_title'},
  41. {title:'工序',align:'center',minWidth:150,key:'procedure_title'},
  42. {title:'班组信息',align:'center',minWidth:150,key:'username'},
  43. {title:'完工状态',align:'center',minWidth:100,
  44. render:(h,params)=>h('span',{},params.row.state == 3 ? '已完工' : '未完工')
  45. },
  46. {title:'完工百分比',align:'center',minWidth:120,
  47. render(h,params){
  48. return h('span',{},parseInt(params.row.complete_rate*100)+'%')
  49. },
  50. },
  51. {title:'派工时间',align:'center',minWidth:200,
  52. render:(h,params)=>h('span',{},this.func.replaceDate(params.row.produce_time*1))
  53. },
  54. {title:'操作',align:'center',slot:'set',fixed:'right',width:'250'},
  55. ],
  56. tableData:[{residential_name:'dlaskdsad',state:0,id:99}],
  57. pageIndex:1,
  58. pageSize:10,
  59. total:0,
  60. selectIds:[],
  61. proxyObj:{order_no:this.$route.query.order_no},
  62. produces:[],
  63. users:[],
  64. }
  65. },
  66. created(){
  67. this.axios('/api/procedure_index').then(res=>this.produces = res.data.data)
  68. this.axios('/api/employee_list').then(res=>this.users = res.data)
  69. },
  70. computed:{
  71. list(){
  72. const array = [
  73. {title:'工序',filterable:true,name:'Select',value:'',serverName:'produce_id',optionName:'title',optionValue:'id',option:this.produces},
  74. {title:'班组信息',filterable:true,name:'Select',value:'',optionName:'nickname',optionValue:'id',serverName:'user_id',option:this.users},
  75. {title:'完工状态',name:'Select',value:'',serverName:'produce',option:[
  76. {label:'未完工',value:1},
  77. {label:'已完工',value:3},
  78. ]},
  79. {title:'派工时间',name:'Input',start_server:'start_time',end_server:'end_time',start_value:'',end_value:'',isDate:true,serverName:'id2',start_placeholder:'开始日期',end_placeholder:'结束日期'},
  80. ]
  81. return array
  82. }
  83. },
  84. methods:{
  85. init(row){
  86. this.pageIndex = 1
  87. row.page_size = this.pageSize
  88. row.page_index = this.pageIndex
  89. Object.assign(row,this.$route.query)
  90. this.getData(row)
  91. },
  92. back(){
  93. this.$router.go(-1)
  94. },
  95. getData(row){
  96. row.page_size = this.pageSize
  97. row.page_index = this.pageIndex
  98. this.axios('/api/orders_dispatch_produce_list',{params:row}).then(res=>{
  99. if(res.code == 200){
  100. this.tableData = res.data.list;
  101. this.logList = res.data.detail;
  102. this.total = res.data.total
  103. }
  104. })
  105. },
  106. postData(data,type){
  107. let url = type == 1 ? '/api/orders_dispatch_confirm' : '/api/orders_plan_cancer'
  108. this.axios.post(url,data).then(res=>{
  109. if(res.code == 200){
  110. this.$Message.success(res.msg);
  111. this.getData(this.$route.query)
  112. }
  113. })
  114. },
  115. finish(row,type){
  116. if(!row||row.length<1){return this.$Message.warning('请至少选择一项')}
  117. let params = {
  118. order_no:Array.isArray(row) ? row.reduce((pre,cur,n)=>`${pre}${cur.order_no}${n==row.length-1 ? '' : ','}`,'') : row.order_no,
  119. produce_id:Array.isArray(row) ? row.reduce((pre,cur,n)=>`${pre}${cur.produce_id}${n==row.length-1 ? '' : ','}`,'') : row.produce_id,
  120. produce_time:Array.isArray(row) ? row.reduce((pre,cur,n)=>`${pre}${cur.produce_time}${n==row.length-1 ? '' : ','}`,'') : row.produce_time,
  121. }
  122. this.confirmDelete({
  123. content:'是否手动操作此订单生产完成',
  124. title:'生产完成',
  125. type:'primary',
  126. then:()=>{
  127. this.postData(params,type)
  128. },
  129. cancel:()=>{}
  130. })
  131. },
  132. selectTable(e){
  133. this.selectIds = e;
  134. },
  135. changePage(e){
  136. this.pageIndex = e;
  137. this.proxyObj.page_index = this.pageIndex;
  138. this.getData(this.proxyObj)
  139. },
  140. changeSize(e){
  141. this.pageSize = e;
  142. this.proxyObj.page_size = this.page_size;
  143. this.getData(this.proxyObj)
  144. },
  145. goDetial(row){
  146. this.$router.push({
  147. path:'/cms/productionorderlist/dispatchlist/details',
  148. query:{
  149. order_no:this.$route.query.order_no,
  150. produce_id:row.produce_id,
  151. produce_time:row.produce_time
  152. }
  153. })
  154. },
  155. goOriginalPage(row){
  156. this.$router.push({
  157. path:'/cms/rawmateria/index',
  158. query:{
  159. order_no:row.order_no,
  160. type:9,
  161. residential_name:row.residential_name,
  162. produce_id:row.produce_id,
  163. produce_time:row.produce_time
  164. }
  165. })
  166. },
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. .log-list{display: flex;flex-wrap:wrap;padding:10px 0;}
  172. </style>