list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <div>
  3. <FullPage title='生产订单列表'
  4. :list='set_list'
  5. @init='init'
  6. @searchData='searchData'
  7. @changePage='changePage'
  8. @changeSize='changeSize'
  9. @selectTable='selectTable'
  10. :tableColums='computedTable'
  11. :showPage='false'
  12. :tableData='tableData'
  13. :page_index='page_index'
  14. :total='total'>
  15. <div slot='titleButton'>
  16. <!-- <Button v-if='persimissionData["批量打印二维码"]||persimissionData.all'
  17. type="primary"
  18. style="margin-right:10px"
  19. ghost>批量打印二维码</Button> -->
  20. <Button @click="openModal(selects)"
  21. type="primary"
  22. ghost>批量下生产排产</Button>
  23. </div>
  24. <div slot='navButton'>
  25. <!-- <Button @click="setupTableHeader"
  26. v-if='persimissionData["表头设置"]||persimissionData.all'
  27. type="primary"
  28. ghost
  29. icon='ios-cog'>表头设置</Button> -->
  30. </div>
  31. <template slot="basicTypeSet"
  32. slot-scope="{row}">
  33. <div>
  34. <span v-for="item in warningList"
  35. :key="item.id"
  36. :style="{color:item.color}"
  37. v-show="item.id==row.warning_state">{{item.title}}</span>
  38. </div>
  39. </template>
  40. <template slot='set'
  41. slot-scope='{row}'>
  42. <div>
  43. <!-- <a v-if='persimissionData["原材料预算"]||persimissionData.all'
  44. style="margin:0 5px"
  45. @click="goOriginalPage(row)">原材料预算</a> -->
  46. <!-- <a v-if='persimissionData["打印二维码"]||persimissionData.all'
  47. style="margin:0 5px">打印二维码</a> -->
  48. <a v-if='persimissionData["详情"]||persimissionData.all'
  49. style="margin:0 5px"
  50. @click="goDetial(row)">详情</a>
  51. <a v-if='persimissionData["下生产计划"]||persimissionData.all'
  52. style="margin:0 5px"
  53. :disabled="row.is_plan==2"
  54. @click="openModal(row)">下生产排产</a>
  55. </div>
  56. </template>
  57. <template slot="pageSlot">
  58. <div class="pageSlotStyle">
  59. <Page :page-size-opts="[10, 20, 30, 40,100,1000]"
  60. @on-page-size-change='changeSize'
  61. @on-change='changePage'
  62. :current='page_index'
  63. show-total
  64. :total="total"
  65. show-sizer
  66. :page-size='page_size' />
  67. </div>
  68. </template>
  69. </FullPage>
  70. </div>
  71. </template>
  72. <script>
  73. import { mapState } from 'vuex'
  74. export default {
  75. data () {
  76. return {
  77. tableColums: [
  78. { type: 'selection', key: 'selection', title: '全选', fixed: 'left', width: 90, align: 'center' },
  79. { title: '订单编号', align: 'center', key: 'order_no', width: '200' },
  80. {
  81. title: '订单类型', align: 'center', key: 'order_type', width: '200',
  82. render: (h, params) => {
  83. return h('span', {}, params.row.order_type == 1 ? '工装' : '家装')
  84. }
  85. },
  86. // {
  87. // title: '生产订单编号', align: 'center', key: 'oa_order_no', minWidth: 200,
  88. // render: (h, params) => h('span', {}, params.row.oa_order_no || params.row.order_no)
  89. // },
  90. {
  91. title: '生产状态', align: 'center', key: 'state', minWidth: 150,
  92. render: (h, params) => h('span', {},
  93. params.row.state == 0 ? '未下计划'
  94. : (params.row.state == 1 ? '计划中'
  95. : (params.row.state >= 2 ? '计划完成' : '全部'))
  96. )
  97. },
  98. { title: '项目名称', align: 'center', key: 'residential_name', minWidth: 200 },
  99. { title: '地址', align: 'center', key: 'address', minWidth: 200 },
  100. { title: '客户姓名', align: 'center', key: 'client_name', minWidth: 200 },
  101. { title: '手机号', align: 'center', key: 'mobile', minWidth: 200 },
  102. // { title: '测量人员', align: 'center', key: 'nickname', minWidth: 200 },
  103. { title: '紧急程度', align: 'center', key: 'warning_state', minWidth: 100, slot: 'basicTypeSet', },
  104. {
  105. title: '下单日期', align: 'center', minWidth: 200, key: 'crt_time',
  106. render: (h, params) => h('span', {}, this.func.replaceDate(params.row.crt_time * 1))
  107. },
  108. // {
  109. // title: '测量开始日期', align: 'center', minWidth: 200, key: 'measure_start_time',
  110. // render: (h, params) => h('span', {}, this.func.replaceDate(params.row.measure_start_time * 1, 1))
  111. // },
  112. // {
  113. // title: '测量结束日期', align: 'center', minWidth: 200, key: 'measure_end_time',
  114. // render: (h, params) => h('span', {}, this.func.replaceDate(params.row.measure_end_time * 1, 1))
  115. // },
  116. // {
  117. // title: '实际测量时间', align: 'center', minWidth: 200, key: 'measure_time',
  118. // render: (h, params) => h('span', {}, this.func.replaceDate(params.row.measure_time * 1))
  119. // },
  120. { title: '操作', align: 'center', key: 'set', slot: 'set', fixed: 'right', width: '320' },
  121. ],
  122. tableData: [],
  123. page_index: 1,
  124. page_size: 10,
  125. total: 0,
  126. planInfo: {
  127. order_no: null,
  128. start_time: '',
  129. end_time: '',
  130. state: 3,
  131. },
  132. selects: [],
  133. tableheaders: [],
  134. //详情页返回保留搜索数据
  135. corssPageData: localStorage.getItem('corssPageData') ? JSON.parse(localStorage.getItem('corssPageData')) : {},
  136. userList: [],
  137. warningList: [],
  138. }
  139. },
  140. beforeRouteEnter (to, from, next) {
  141. next(vm => {
  142. if (from.path != '/cms/productionorderlist/productionsorder/Decorationlist') {
  143. localStorage.removeItem('corssPageData')
  144. } else {
  145. vm.firstEnter = 1
  146. }
  147. });
  148. },
  149. beforeRouteLeave (to, from, next) {
  150. if (to.path == '/cms/productionorderlist/productionsorder/Decorationlist') {
  151. this.corssPageData.page_index = this.page_index,
  152. this.corssPageData.page_size = this.page_size,
  153. localStorage.setItem('corssPageData', JSON.stringify(this.corssPageData))
  154. } else {
  155. localStorage.removeItem('corssPageData')
  156. }
  157. next(vm => {
  158. });
  159. },
  160. created () {
  161. // 获取用户列表
  162. this.axios({ method: 'get', url: '/api/user', }).then((res) => { this.userList = res.data.data }).catch((err) => { });
  163. // 获取紧急程度
  164. this.axios.get('/api/warning_list').then(res => { this.warningList = res.data.data })
  165. },
  166. computed: {
  167. ...mapState(['persimissionData']),
  168. computedTable () {
  169. // if (this.tableheaders.length < 1) {
  170. return this.tableColums
  171. // }
  172. // return this.func.computedHeader(this.tableheaders, this.tableColums)
  173. },
  174. set_list () {
  175. return [
  176. { title: '订单编号', name: 'Input', serverName: 'order_no', placeholder: '请输入订单编号', value: '' },
  177. { title: '项目名称', name: 'Input', serverName: 'residential_name', placeholder: '请输入项目名称', value: '' },
  178. {
  179. title: '订单类型', name: 'Select', serverName: 'order_type', placeholder: '请选择', value: '',
  180. option: [
  181. { label: '工装', value: 1 },
  182. { label: '家装', value: 0 }
  183. ]
  184. },
  185. {
  186. title: '测量人员', name: 'Select', serverName: 'type', optionName: 'nickname', optionValue: 'id', placeholder: '请选择', value: '',
  187. option: this.userList
  188. },
  189. { title: '客户名字', name: 'Input', serverName: 'client_name', placeholder: '请输入', value: '' },
  190. { title: '手机号', name: 'Input', serverName: 'mobile', placeholder: '请输入', value: '' },
  191. { title: '紧急程度', name: 'Select', serverName: 'warning_state', placeholder: '请选择', value: '', optionName: 'title', optionValue: 'id', option: this.warningList },
  192. {
  193. title: '生产状态', name: 'Select', placeholder: '请选择', serverName: 'state', value: '',
  194. option: [
  195. { label: '未下计划', value: 0 },
  196. { label: '计划中', value: 1 },
  197. { label: '计划完成', value: 2 },
  198. ]
  199. },
  200. { title: '下单日期范围', name: 'Input', start_server: 'start_time', end_server: 'end_time', start_value: '', end_value: '', isDate: true, serverName: 'id2', start_placeholder: '开始日期', end_placeholder: '结束日期' },
  201. ]
  202. }
  203. },
  204. methods: {
  205. init (row) {
  206. // row.page_index = this.page_index;
  207. // row.page_size = this.page_size;
  208. if (this.firstEnter == 1) {
  209. this.corssPageData = JSON.parse(localStorage.getItem('corssPageData'))
  210. row = this.corssPageData
  211. this.proxyObj = row
  212. this.searchData(row)
  213. } else {
  214. this.page_index = 1
  215. row.page_index = this.page_index;
  216. row.page_size = this.page_size;
  217. this.proxyObj = row
  218. this.getData(row)
  219. }
  220. },
  221. searchData (row) {
  222. if (this.firstEnter == 1) {
  223. this.page_index = this.corssPageData.page_index;
  224. this.page_size = this.corssPageData.page_size;
  225. this.set_list[0].value = this.corssPageData.order_no
  226. this.set_list[1].value = this.corssPageData.type
  227. this.set_list[2].value = this.corssPageData.client_name
  228. this.set_list[3].value = this.corssPageData.mobile
  229. this.set_list[4].value = this.corssPageData.warning_state
  230. this.set_list[5].value = this.corssPageData.state
  231. this.set_list[6].start_value = this.corssPageData.start_time ? this.corssPageData.start_time : ''
  232. this.set_list[6].end_value = this.corssPageData.end_time ? this.corssPageData.end_time : ''
  233. this.corssPageData.type = this.$route.query.type
  234. this.getData(this.corssPageData)
  235. } else {
  236. this.page_index = 1
  237. row.page_index = this.page_index;
  238. row.page_size = this.page_size;
  239. this.corssPageData.order_no = this.set_list[0].value
  240. this.corssPageData.type = this.set_list[1].value
  241. this.corssPageData.client_name = this.set_list[2].value
  242. this.corssPageData.mobile = this.set_list[3].value
  243. this.corssPageData.warning_state = this.set_list[4].value
  244. this.corssPageData.state = this.set_list[5].value
  245. this.corssPageData.start_time = this.func.setDate(this.set_list[6].start_value)
  246. this.corssPageData.end_time = this.func.setDate(this.set_list[6].end_value)
  247. this.proxyObj = row
  248. this.getData(row)
  249. }
  250. },
  251. changePage (e) {
  252. this.page_index = e;
  253. this.proxyObj.page_index = this.page_index;
  254. this.getData(this.proxyObj)
  255. },
  256. changeSize (e) {
  257. this.page_size = e;
  258. this.proxyObj.page_size = this.page_size;
  259. this.getData(this.proxyObj)
  260. },
  261. getData (row) {
  262. this.axios('/api/orders_produce_order_list', { params: row }).then(res => {
  263. this.tableData = res.data.data;
  264. this.firstEnter++
  265. this.total = res.data.total;
  266. this.tableheaders = res.data.tableSet || []
  267. })
  268. },
  269. goDetial (row) {
  270. this.$router.push({
  271. path: '/cms/productionorderlist/productionsorder/Decorationlist',
  272. query: {
  273. order_no: row.order_no,
  274. type: 'produce'
  275. }
  276. })
  277. },
  278. openModal (row) {
  279. if (Array.isArray(row)) {
  280. if (row.length < 1) { return this.$Message.warning('请选择一项') }
  281. this.planInfo.order_no = row.reduce((pre, cur, idx) => `${pre}${cur.order_no}${idx == row.length - 1 ? '' : ','}`, '')
  282. } else {
  283. this.planInfo.order_no = row.order_no;
  284. }
  285. this.downProduction({
  286. title: '下生产排产',
  287. type: 1,
  288. params: this.planInfo,
  289. then: (e) => { this.getData(this.proxyObj) },
  290. cancel: (e) => { },
  291. })
  292. },
  293. goOriginalPage (row) {
  294. this.$router.push({
  295. path: '/cms/rawmateria/index',
  296. query: {
  297. order_no: row.order_no,
  298. type: 4,
  299. residential_name: row.residential_name
  300. }
  301. })
  302. },
  303. selectTable (e) {
  304. this.selects = e;
  305. },
  306. setupTableHeader () {
  307. this.tableheaders.length < 1 ? this.tableheaders = this.tableColums.reduce((pre, cur) => pre.concat(cur.key), []) : ''
  308. this.$setTableheader({
  309. list: this.tableColums,
  310. selects: this.tableheaders,
  311. then: (result) => {
  312. this.tableheaders = result
  313. this.axios.post('/api/update/table', { id: this.$route.query.id, result }).then(res => {
  314. if (res.code == 200) {
  315. this.$Message.success(res.msg)
  316. }
  317. })
  318. }
  319. })
  320. },
  321. }
  322. }
  323. </script>
  324. <style lang="scss" scoped>
  325. .pageSlotStyle {
  326. display: flex;
  327. justify-content: center;
  328. margin-top: 40px;
  329. }
  330. </style>