saleOderAftersalesList.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <div class="ele-body" style="width: 100%">
  3. <ele-pro-table
  4. ref="table"
  5. style="width: 100%"
  6. :columns="columns"
  7. :datasource="datasource"
  8. cache-key="systemRoleTable"
  9. :pageSize="20"
  10. :initLoad="false"
  11. >
  12. </ele-pro-table>
  13. </div>
  14. </template>
  15. <script>
  16. import {
  17. getSalesWorkOrder,
  18. getSalesWorkOrderById
  19. } from '@/api/salesServiceManagement/index';
  20. import { getByCode } from '@/api/system/dictionary-data';
  21. import { init } from 'echarts';
  22. export default {
  23. props: {
  24. contactData: {
  25. type: Object,
  26. default: () => ({})
  27. }
  28. },
  29. data() {
  30. return {
  31. columns: [
  32. {
  33. columnKey: 'index',
  34. label: '序号',
  35. type: 'index',
  36. width: 55,
  37. align: 'center',
  38. showOverflowTooltip: true,
  39. fixed: 'left'
  40. },
  41. {
  42. prop: 'code',
  43. slot: 'code',
  44. label: '工单编号',
  45. align: 'center',
  46. showOverflowTooltip: true,
  47. minWidth: 150
  48. },
  49. {
  50. prop: 'planCode',
  51. label: '计划单号',
  52. align: 'center',
  53. showOverflowTooltip: true,
  54. minWidth: 110
  55. },
  56. {
  57. prop: 'planName',
  58. label: '计划名称',
  59. align: 'center',
  60. showOverflowTooltip: true,
  61. minWidth: 110
  62. },
  63. {
  64. prop: 'executeUserName',
  65. label: '报工人',
  66. align: 'center',
  67. showOverflowTooltip: true,
  68. minWidth: 110
  69. },
  70. {
  71. prop: 'accepterUserName',
  72. label: '验收人',
  73. align: 'center',
  74. showOverflowTooltip: true,
  75. minWidth: 110
  76. },
  77. {
  78. slot: 'faultLevel',
  79. prop: 'faultLevel',
  80. label: '故障等级',
  81. align: 'center',
  82. showOverflowTooltip: true,
  83. formatter: (row) => this.levelData[row.faultLevel] || ''
  84. },
  85. {
  86. prop: 'contactName',
  87. label: '客户名称',
  88. align: 'center',
  89. showOverflowTooltip: true,
  90. minWidth: 110
  91. },
  92. {
  93. prop: 'categoryName',
  94. label: '设备名称',
  95. align: 'center',
  96. minWidth: 110,
  97. showOverflowTooltip: true,
  98. formatter: (row) => {
  99. if (!row.deviceDetails) return '';
  100. let str = '';
  101. row.deviceDetails.map((el, idx) => {
  102. str +=
  103. idx + 1 === row.deviceDetails.length
  104. ? el.categoryName
  105. : `${el.categoryName},`;
  106. });
  107. return str;
  108. }
  109. },
  110. {
  111. prop: 'accepterTime',
  112. label: '验收时间',
  113. align: 'center',
  114. showOverflowTooltip: true,
  115. minWidth: 110
  116. },
  117. {
  118. prop: 'acceptTime',
  119. label: '开始时间',
  120. align: 'center',
  121. showOverflowTooltip: true,
  122. minWidth: 110
  123. },
  124. {
  125. prop: 'finishTime',
  126. label: '结束时间',
  127. align: 'center',
  128. showOverflowTooltip: true,
  129. minWidth: 110
  130. },
  131. {
  132. prop: 'planFinishTime',
  133. label: '计划完成时间',
  134. align: 'center',
  135. showOverflowTooltip: true,
  136. minWidth: 110
  137. },
  138. {
  139. prop: 'totalCost',
  140. label: '费用( 元 )',
  141. align: 'center',
  142. showOverflowTooltip: true,
  143. minWidth: 110
  144. },
  145. {
  146. columnKey: 'inFactDuration',
  147. label: '工时',
  148. align: 'center',
  149. resizable: false,
  150. showOverflowTooltip: true,
  151. minWidth: 120,
  152. formatter: (row) => {
  153. if (row.inFactDuration || row.inFactDuration === 0) {
  154. return `${((row.inFactDuration - 0) / 60).toFixed(1)} 小时`;
  155. }
  156. }
  157. },
  158. {
  159. prop: 'orderStatus',
  160. label: '状态',
  161. align: 'center',
  162. showOverflowTooltip: true,
  163. formatter: (row) => {
  164. return this.workOrderStatus.find(
  165. (item) => item.code === row.orderStatus
  166. )?.label;
  167. }
  168. }
  169. ],
  170. workOrderStatus: [
  171. { code: 0, label: '待执行' },
  172. { code: 1, label: '已接收' },
  173. { code: 2, label: '执行中' },
  174. { code: 3, label: '待验收' },
  175. { code: 4, label: '待评价' },
  176. { code: 5, label: '已完成' },
  177. { code: 6, label: '验收不通过' }
  178. ],
  179. levelData: {}
  180. };
  181. },
  182. created() {
  183. this.getLevelCode('fault_level');
  184. },
  185. methods: {
  186. init(){
  187. this.$refs.table.reload({ page: 1 });
  188. },
  189. async getLevelCode(code) {
  190. const res = await getByCode(code);
  191. if (res?.code === '0') {
  192. const obj = {};
  193. res.data.forEach((el) => {
  194. const key = Object.keys(el)[0];
  195. const value = Object.values(el)[0];
  196. obj[key] = value;
  197. });
  198. this.levelData = obj;
  199. }
  200. },
  201. datasource({ page, limit, where, order }) {
  202. console.log('where', this.contactData.id);
  203. // let isDispatch = '1';
  204. return getSalesWorkOrder({
  205. pageNum: page,
  206. size: limit,
  207. ...where,
  208. contactId: this.contactData.id
  209. });
  210. }
  211. // async declarationForm(row, type) {
  212. // if (type === 'view') {
  213. // const detailRes = await getSalesWorkOrderById(row.id);
  214. // console.log('工单详情数据:', detailRes);
  215. // }
  216. // }
  217. }
  218. };
  219. </script>
  220. <style lang="scss" scoped>
  221. ::v-deep .ele-pro-table {
  222. .el-link {
  223. cursor: pointer;
  224. }
  225. }
  226. </style>