list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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.state>1"
  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: 99 },
  196. { label: '未下计划', value: 0 },
  197. { label: '计划中', value: 1 },
  198. { label: '计划完成', value: 2 },
  199. ]
  200. },
  201. { title: '下单日期范围', name: 'Input', start_server: 'start_time', end_server: 'end_time', start_value: '', end_value: '', isDate: true, serverName: 'id2', start_placeholder: '开始日期', end_placeholder: '结束日期' },
  202. ]
  203. }
  204. },
  205. methods: {
  206. init (row) {
  207. // row.page_index = this.page_index;
  208. // row.page_size = this.page_size;
  209. if (this.firstEnter == 1) {
  210. this.corssPageData = JSON.parse(localStorage.getItem('corssPageData'))
  211. row = this.corssPageData
  212. this.proxyObj = row
  213. this.searchData(row)
  214. } else {
  215. this.page_index = 1
  216. row.page_index = this.page_index;
  217. row.page_size = this.page_size;
  218. this.proxyObj = row
  219. this.getData(row)
  220. }
  221. },
  222. searchData (row) {
  223. if (this.firstEnter == 1) {
  224. this.page_index = this.corssPageData.page_index;
  225. this.page_size = this.corssPageData.page_size;
  226. this.set_list[0].value = this.corssPageData.order_no
  227. this.set_list[1].value = this.corssPageData.type
  228. this.set_list[2].value = this.corssPageData.client_name
  229. this.set_list[3].value = this.corssPageData.mobile
  230. this.set_list[4].value = this.corssPageData.warning_state
  231. this.set_list[5].value = this.corssPageData.state
  232. this.set_list[6].start_value = this.corssPageData.start_time ? this.corssPageData.start_time : ''
  233. this.set_list[6].end_value = this.corssPageData.end_time ? this.corssPageData.end_time : ''
  234. this.corssPageData.type = this.$route.query.type
  235. this.getData(this.corssPageData)
  236. } else {
  237. this.page_index = 1
  238. row.page_index = this.page_index;
  239. row.page_size = this.page_size;
  240. this.corssPageData.order_no = this.set_list[0].value
  241. this.corssPageData.type = this.set_list[1].value
  242. this.corssPageData.client_name = this.set_list[2].value
  243. this.corssPageData.mobile = this.set_list[3].value
  244. this.corssPageData.warning_state = this.set_list[4].value
  245. this.corssPageData.state = this.set_list[5].value
  246. this.corssPageData.start_time = this.func.setDate(this.set_list[6].start_value)
  247. this.corssPageData.end_time = this.func.setDate(this.set_list[6].end_value)
  248. this.proxyObj = row
  249. this.getData(row)
  250. }
  251. },
  252. changePage (e) {
  253. this.page_index = e;
  254. this.proxyObj.page_index = this.page_index;
  255. this.getData(this.proxyObj)
  256. },
  257. changeSize (e) {
  258. this.page_size = e;
  259. this.proxyObj.page_size = this.page_size;
  260. this.getData(this.proxyObj)
  261. },
  262. getData (row) {
  263. this.axios('/api/orders_produce_order_list', { params: row }).then(res => {
  264. this.tableData = res.data.data;
  265. this.firstEnter++
  266. this.total = res.data.total;
  267. this.tableheaders = res.data.tableSet || []
  268. })
  269. },
  270. goDetial (row) {
  271. this.$router.push({
  272. path: '/cms/productionorderlist/productionsorder/Decorationlist',
  273. query: {
  274. order_no: row.order_no,
  275. type: 'produce'
  276. }
  277. })
  278. },
  279. openModal (row) {
  280. if (Array.isArray(row)) {
  281. if (row.length < 1) { return this.$Message.warning('请选择一项') }
  282. this.planInfo.order_no = row.reduce((pre, cur, idx) => `${pre}${cur.order_no}${idx == row.length - 1 ? '' : ','}`, '')
  283. } else {
  284. this.planInfo.order_no = row.order_no;
  285. }
  286. this.downProduction({
  287. title: '下生产计划',
  288. type: 1,
  289. params: this.planInfo,
  290. then: (e) => { this.getData(this.proxyObj) },
  291. cancel: (e) => { },
  292. })
  293. },
  294. goOriginalPage (row) {
  295. this.$router.push({
  296. path: '/cms/rawmateria/index',
  297. query: {
  298. order_no: row.order_no,
  299. type: 4,
  300. residential_name: row.residential_name
  301. }
  302. })
  303. },
  304. selectTable (e) {
  305. this.selects = e;
  306. },
  307. setupTableHeader () {
  308. this.tableheaders.length < 1 ? this.tableheaders = this.tableColums.reduce((pre, cur) => pre.concat(cur.key), []) : ''
  309. this.$setTableheader({
  310. list: this.tableColums,
  311. selects: this.tableheaders,
  312. then: (result) => {
  313. this.tableheaders = result
  314. this.axios.post('/api/update/table', { id: this.$route.query.id, result }).then(res => {
  315. if (res.code == 200) {
  316. this.$Message.success(res.msg)
  317. }
  318. })
  319. }
  320. })
  321. },
  322. }
  323. }
  324. </script>
  325. <style lang="scss" scoped>
  326. .pageSlotStyle {
  327. display: flex;
  328. justify-content: center;
  329. margin-top: 40px;
  330. }
  331. </style>