index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div>
  3. <FullPage title='安装订单列表'
  4. :list='set_list'
  5. @init='init'
  6. :loading='loading'
  7. @searchData='init'
  8. @changePage='changePage'
  9. @changeSize='changeSize'
  10. :tableColums='computedTable'
  11. :tableData='tableData'
  12. :pageIndex='pageIndex'
  13. :total='total'>
  14. <!-- <div slot='titleButton'>
  15. <Button v-if='persimissionData["批量确认"]||persimissionData.all' @click="setupTableHeader" type="primary" ghost>批量确认</Button>
  16. </div> -->
  17. <div slot='navButton'>
  18. <Button v-if='persimissionData["表头设置"]||persimissionData.all'
  19. @click="setupTableHeader"
  20. type="primary"
  21. ghost
  22. icon='ios-cog'>表头设置</Button>
  23. </div>
  24. <template slot='set'
  25. slot-scope='{row}'>
  26. <div>
  27. <a v-if='persimissionData["详情"]||persimissionData.all'
  28. style="margin:0 5px"
  29. @click="goPage(row)">详情</a>
  30. <a style="margin:0 5px"
  31. @click="goUnusualPage(row)">查看异常</a>
  32. </div>
  33. </template>
  34. </FullPage>
  35. </div>
  36. </template>
  37. <script>
  38. import { mapState } from 'vuex'
  39. export default {
  40. data () {
  41. let _this = this;
  42. return {
  43. title: '',
  44. tableColums: [
  45. { title: '订单编号', align: 'center', key: 'order_no', fixed: 'left', width: '200' },
  46. {
  47. title: '订单类型', align: 'center', key: 'type', minWidth: 150,
  48. render: (h, params) => h('span', {}, params.row.type == 1 ? '工装' : '家装')
  49. },
  50. { title: '客户', align: 'center', key: 'client_name', minWidth: 150 },
  51. { title: '手机号', align: 'center', key: 'mobile', minWidth: 150 },
  52. { title: '地址', align: 'center', key: 'address', minWidth: 150 },
  53. { title: '项目名称', align: 'center', key: 'residential_name', minWidth: 200 },
  54. {
  55. title: '出库时间', align: 'center', key: 'predict_time', minWidth: 200,
  56. render: (h, params) => h('span', {}, this.func.replaceDate(params.row.transport_start_time))
  57. },
  58. {
  59. title: '运输时间', align: 'center', key: 'crt_time', minWidth: 200,
  60. render: (h, params) => h('span', {}, this.func.replaceDate(params.row.transport_end_time))
  61. },
  62. { title: '操作', align: 'center', slot: 'set', fixed: 'right', width: '150' },
  63. ],
  64. tableData: [],
  65. pageIndex: 1,
  66. total: 0,
  67. pageSize: 10,
  68. loading: false,
  69. tableheaders: [],
  70. warningList: []
  71. }
  72. },
  73. created () {
  74. // 获取紧急程度
  75. this.axios.get('/api/warning_list').then(res => { this.warningList = res.data.data })
  76. },
  77. mounted () {
  78. },
  79. watch: {
  80. $route (to, from) {
  81. this.type = to.query.type ? to.query.type : '';
  82. this.getData(this.proxyObj)
  83. }
  84. },
  85. computed: {
  86. ...mapState(['persimissionData']),
  87. computedTable () {
  88. if (this.tableheaders.length < 1) {
  89. return this.tableColums
  90. }
  91. return this.func.computedHeader(this.tableheaders, this.tableColums)
  92. },
  93. set_list () {
  94. return [
  95. { title: '订单编号', name: 'Input', serverName: 'order_no', placeholder: '请输入订单编号', value: '' },
  96. {
  97. title: '订单类型', name: 'Select', placeholder: '请选择', serverName: 'type', value: '',
  98. option: [
  99. { label: '工装', value: 1 },
  100. { label: '家装', value: 0 },
  101. ]
  102. },
  103. { title: '紧急程度', name: 'Select', serverName: 'warning_state', placeholder: '请选择', value: '', optionName: 'title', optionValue: 'id', option: this.warningList },
  104. { title: '项目名称', name: 'Input', serverName: 'residential_name', placeholder: '项目名称', value: '' },
  105. { title: '客户', name: 'Input', serverName: 'client_name', placeholder: '客户', value: '' },
  106. { title: '手机号', name: 'Input', serverName: 'mobile', placeholder: '手机号', value: '' },
  107. { title: '出库时间', name: 'Input', start_server: 'start_out_storage_time', end_server: 'end_out_storage_time', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期' },
  108. { title: '运输时间', name: 'Input', start_server: 'start_transport_time', end_server: 'end_transport_time', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期' },
  109. { title: '下单日期范围', name: 'Input', start_server: 'start_time', end_server: 'end_time', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期' },
  110. ]
  111. }
  112. },
  113. methods: {
  114. init (row) {
  115. this.pageIndex = 1
  116. row.page_index = this.pageIndex;
  117. row.page_size = this.pageSize;
  118. this.proxyObj = row
  119. this.getData(row)
  120. },
  121. changePage (e) {
  122. this.pageIndex = e;
  123. this.proxyObj.page_index = this.pageIndex;
  124. this.getData(this.proxyObj)
  125. },
  126. changeSize (e) {
  127. this.pageSize = e;
  128. this.proxyObj.page_size = this.pageSize;
  129. this.getData(this.proxyObj)
  130. },
  131. getData (row) {
  132. this.loading = true;
  133. this.axios('/api/orders_install_list', { params: row }).then(res => {
  134. this.loading = false;
  135. if (res.code == 200) {
  136. this.tableData = res.data.data;
  137. this.total = res.data.total;
  138. this.tableheaders = res.data.tableSet || []
  139. }
  140. })
  141. },
  142. goPage (row) {
  143. this.$router.push({
  144. path: '/cms/mountorder/details',
  145. query: {
  146. order_no: row.order_no,
  147. type: 3
  148. }
  149. })
  150. },
  151. goUnusualPage (row) {
  152. this.$router.push({
  153. path: '/cms/mountorder/unusual',
  154. query: {
  155. order_no: row.order_no,
  156. type: 3
  157. }
  158. })
  159. },
  160. setupTableHeader () {
  161. this.tableheaders.length < 1 ? this.tableheaders = this.tableColums.reduce((pre, cur) => pre.concat(cur.key), []) : ''
  162. this.$setTableheader({
  163. list: this.tableColums,
  164. selects: this.tableheaders,
  165. then: (result) => {
  166. this.tableheaders = result
  167. this.axios.post('/api/update/table', { id: this.$route.query.id, result }).then(res => {
  168. if (res.code == 200) {
  169. this.$Message.success(res.msg)
  170. }
  171. })
  172. }
  173. })
  174. },
  175. }
  176. }
  177. </script>
  178. <style lang="scss" scoped>
  179. </style>