workOrderList.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <el-dialog
  3. title="选择工单"
  4. custom-class="ele-dialog-form long-dialog-form"
  5. :visible.sync="visible"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. top="5vh"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. width="70%"
  12. >
  13. <el-card shadow="never">
  14. <workSearch @search="reload"></workSearch>
  15. <ele-pro-table
  16. ref="table"
  17. :columns="columns"
  18. :datasource="datasource"
  19. row-key="id"
  20. height="calc(100vh - 460px)"
  21. class="dict-table"
  22. @cell-click="cellClick"
  23. >
  24. <!-- 表头工具栏 -->
  25. <template v-slot:action="{ row }">
  26. <el-radio class="radio" v-model="radio" :label="row.id">
  27. <i></i>
  28. </el-radio>
  29. </template>
  30. </ele-pro-table>
  31. </el-card>
  32. <div slot="footer">
  33. <el-button type="primary" size="small" @click="selected">选择</el-button>
  34. <el-button size="small" @click="handleClose">关闭</el-button>
  35. </div>
  36. </el-dialog>
  37. </template>
  38. <script>
  39. import { getSalesWorkOrder } from '@/api/salesServiceManagement/index';
  40. import workSearch from './workSearch.vue';
  41. // import AssetTree from '@/components/AssetTree';
  42. export default {
  43. components: {
  44. workSearch
  45. // AssetTree
  46. },
  47. props: {
  48. classType: {
  49. type: Number | String,
  50. default: 1
  51. }
  52. },
  53. data() {
  54. return {
  55. visible: false,
  56. workOrderStatus: [
  57. { code: 0, label: '待接收' },
  58. { code: 1, label: '已接收' },
  59. { code: 2, label: '执行中' },
  60. { code: 3, label: '待验收' },
  61. { code: 4, label: '待评价' },
  62. { code: 5, label: '已完成' },
  63. { code: 6, label: '验收不通过' }
  64. ],
  65. columns: [
  66. {
  67. action: 'action',
  68. slot: 'action',
  69. align: 'center',
  70. label: '选择'
  71. },
  72. {
  73. columnKey: 'index',
  74. label: '序号',
  75. type: 'index',
  76. width: 55,
  77. align: 'center',
  78. showOverflowTooltip: true,
  79. fixed: 'left'
  80. },
  81. {
  82. prop: 'code',
  83. slot: 'code',
  84. label: '工单编号',
  85. align: 'center',
  86. showOverflowTooltip: true,
  87. minWidth: 150
  88. },
  89. {
  90. prop: 'planCode',
  91. label: '计划单号',
  92. align: 'center',
  93. showOverflowTooltip: true,
  94. minWidth: 110
  95. },
  96. {
  97. prop: 'planName',
  98. label: '计划名称',
  99. align: 'center',
  100. showOverflowTooltip: true,
  101. minWidth: 110
  102. },
  103. {
  104. prop: 'executeUserName',
  105. label: '报工人',
  106. align: 'center',
  107. showOverflowTooltip: true,
  108. minWidth: 110
  109. },
  110. {
  111. prop: 'accepterUserName',
  112. label: '验收人',
  113. align: 'center',
  114. showOverflowTooltip: true,
  115. minWidth: 110
  116. },
  117. {
  118. prop: 'accepterTime',
  119. label: '验收时间',
  120. align: 'center',
  121. showOverflowTooltip: true,
  122. minWidth: 110
  123. },
  124. {
  125. prop: 'acceptTime',
  126. label: '开始时间',
  127. align: 'center',
  128. showOverflowTooltip: true,
  129. minWidth: 110
  130. },
  131. {
  132. prop: 'finishTime',
  133. label: '结束时间',
  134. align: 'center',
  135. showOverflowTooltip: true,
  136. minWidth: 110
  137. },
  138. {
  139. prop: 'planFinishTime',
  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.finishTime && row.acceptTime) {
  154. return parseInt(
  155. (new Date(row.finishTime).getTime() -
  156. new Date(row.acceptTime).getTime()) /
  157. 60000
  158. );
  159. }
  160. }
  161. },
  162. {
  163. prop: 'orderStatus',
  164. label: '状态',
  165. align: 'center',
  166. showOverflowTooltip: true,
  167. formatter: (row) => {
  168. return this.workOrderStatus.find(
  169. (item) => item.code == row.orderStatus
  170. )?.label;
  171. }
  172. }
  173. ],
  174. radio: null,
  175. current: {}
  176. };
  177. },
  178. watch: {},
  179. methods: {
  180. open(item) {
  181. if (item) {
  182. this.radio = item.id;
  183. this.current = item;
  184. }
  185. this.visible = true;
  186. },
  187. /* 表格数据源 */
  188. datasource({ page, limit, where, order }) {
  189. return getSalesWorkOrder({
  190. pageNum: page,
  191. size: limit,
  192. // orderStatus: 5,
  193. ...where
  194. });
  195. },
  196. /* 刷新表格 */
  197. reload(where) {
  198. where = {
  199. ...where,
  200. };
  201. this.$refs.table.reload({ page: 1, where });
  202. },
  203. // 单击获取id
  204. cellClick(row) {
  205. this.current = row;
  206. this.radio = row.id;
  207. },
  208. handleClose() {
  209. this.visible = false;
  210. this.current = null;
  211. this.radio = '';
  212. },
  213. selected() {
  214. if (!this.current) {
  215. return this.$message.warning('请选择工单');
  216. }
  217. this.$emit('changeSelect', this.current);
  218. this.handleClose();
  219. }
  220. }
  221. };
  222. </script>
  223. <style lang="scss" scoped></style>