maintenance.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <PageWrapper contentBackground>
  3. <template #footer>
  4. <a-tabs v-model:activeKey="tableType" @change="changeTable">
  5. <a-tab-pane :key="0" :tab="t('routes.spares.tableType.0')" />
  6. <a-tab-pane :key="1" :tab="t('routes.spares.tableType.21')" />
  7. <a-tab-pane :key="2" :tab="t('routes.spares.tableType.22')" />
  8. </a-tabs></template
  9. >
  10. <div class="desc-wrap-BasicTable">
  11. <BasicTable @register="registerTable">
  12. <template #action="{ record }">
  13. <TableAction
  14. stopButtonPropagation
  15. :actions="[
  16. {
  17. label: '详情',
  18. ifShow:getCheckPerm('work_detail'),
  19. onClick: handleDetail.bind(null, record),
  20. },
  21. {
  22. label: '添加备件',
  23. ifShow:getCheckPerm('maintenance_add') && tableType == 1 && record.status != 6,
  24. onClick: handleAdd.bind(null, record),
  25. },
  26. {
  27. label: '完成维修',
  28. ifShow:getCheckPerm('maintenance_finish') && tableType == 1,
  29. onClick: handleOut.bind(null, record),
  30. },
  31. {
  32. label: '检测登记',
  33. ifShow:getCheckPerm('maintenance_testing') && tableType == 0,
  34. onClick: handleRecover.bind(null, record),
  35. },
  36. ]"
  37. />
  38. </template>
  39. </BasicTable>
  40. <checkModel @update="reload" @register="registerRecovery" />
  41. <addAccessoryModel @update="reload" @register="registerAdd" />
  42. <outModal @update="reload" @register="registerOut" />
  43. <!-- ifShow: getCheckPerm('device-out') && !Boolean(record.outType), -->
  44. </div>
  45. </PageWrapper>
  46. </template>
  47. <script lang="ts">
  48. import { defineComponent, onMounted, ref } from 'vue';
  49. import { PageWrapper } from '/@/components/Page';
  50. import {
  51. BasicTable,
  52. useTable,
  53. TableAction,
  54. BasicColumn,
  55. TableImg,
  56. FormProps,
  57. } from '/@/components/Table';
  58. import { Tabs } from 'ant-design-vue';
  59. import { operateSceneList } from '/@/api/operate';
  60. import { useI18n } from '/@/hooks/web/useI18n';
  61. import { usePermissionStore } from '/@/store/modules/permission';
  62. import checkModel from './checkModel.vue';
  63. import outModal from './outModal.vue';
  64. import addAccessoryModel from './addAccessoryModel.vue';
  65. import { useModal } from '/@/components/Modal';
  66. import { useRouter } from 'vue-router'
  67. import { saleOrderList, repairOrderList } from '/@/api/spares';
  68. export default defineComponent({
  69. components: {
  70. BasicTable,
  71. TableAction,
  72. TableImg,
  73. checkModel,
  74. outModal,
  75. PageWrapper,
  76. addAccessoryModel,
  77. [Tabs.name]: Tabs,
  78. [Tabs.TabPane.name]: Tabs.TabPane,
  79. },
  80. setup() {
  81. const { t } = useI18n();
  82. const permissionStore = usePermissionStore();
  83. const router = useRouter()
  84. const { getCheckPerm } = permissionStore;
  85. const tableType = ref<number>(0); //0 待接单,1待跟进,2已完结
  86. onMounted(() => {
  87. // console.log(router.currentRoute.value.params.id);
  88. });
  89. const columns: BasicColumn[] = [
  90. {
  91. title: '报修日期',
  92. dataIndex: 'createTime',
  93. width: 180,
  94. },
  95. {
  96. title: '客户名称',
  97. dataIndex: 'addrId',
  98. width: 80,
  99. },
  100. {
  101. title: '产品类型',
  102. dataIndex: 'cameraType',
  103. width: 80,
  104. customRender: ({ record }) => {
  105. return t(`routes.device.type.${record.operationType || 1}`);
  106. },
  107. },
  108. {
  109. title: '产品SN码',
  110. dataIndex: 'cameraSnCode',
  111. width: 100,
  112. },
  113. {
  114. title: '故障描述',
  115. dataIndex: 'faultMsg',
  116. width: 100,
  117. },
  118. {
  119. title: '售后工程师',
  120. dataIndex: 'saleName',
  121. width: 100,
  122. },
  123. {
  124. title: '接单日期',
  125. dataIndex: 'orderReceivingTime',
  126. width: 100,
  127. },
  128. {
  129. title: '状态',
  130. dataIndex: 'status',
  131. width: 100,
  132. customRender: ({ record }) => {
  133. return t(`routes.spares.tableType.${record.status || 0}`);
  134. },
  135. },
  136. {
  137. title: '工单号',
  138. dataIndex: 'repairId',
  139. width: 150,
  140. },
  141. {
  142. title: t('common.operating'),
  143. dataIndex: 'action',
  144. slots: { customRender: 'action' },
  145. ifShow: true,
  146. fixed: 'right',
  147. flag: 'ACTION',
  148. width: 200,
  149. },
  150. ];
  151. const searchForm: Partial<FormProps> = {
  152. labelWidth: 120,
  153. schemas: [
  154. {
  155. field: 'type',
  156. label: '设备类型',
  157. component: 'Select',
  158. componentProps: {
  159. options: [
  160. {
  161. label: t('routes.scene.tableType.0'),
  162. value: '0',
  163. },{
  164. label: t('routes.scene.tableType.1'),
  165. value: '1',
  166. },{
  167. label: t('routes.scene.tableType.2'),
  168. value: '2',
  169. },
  170. ],
  171. },
  172. colProps: {
  173. xl: 6,
  174. xxl: 6,
  175. },
  176. },
  177. {
  178. field: 'cameraSnCode',
  179. component: 'Input',
  180. label: t('routes.device.snCode'),
  181. colProps: {
  182. xl: 7,
  183. xxl: 7,
  184. },
  185. },
  186. ],
  187. };
  188. const [registerRecovery, { openModal }] = useModal();
  189. const [registerOut, { openModal:openOutModal }] = useModal();
  190. const [registerAdd, { openModal:openAddModal }] = useModal();
  191. const [registerTable, { reload }] = useTable({
  192. api: repairOrderList,
  193. columns: columns,
  194. useSearchForm: true,
  195. searchInfo: { statusParam: tableType },
  196. formConfig: searchForm,
  197. showTableSetting: true,
  198. showIndexColumn: false,
  199. fetchSetting: {
  200. pageField: 'pageNum',
  201. sizeField: 'pageSize',
  202. listField: 'list',
  203. totalField: 'total',
  204. },
  205. canResize: false,
  206. });
  207. async function handleDetail(record: Recordable) {
  208. console.log('record', record);
  209. router.push({path:`detail/${record.repairId||'20230215174919387'}`})
  210. }
  211. async function handleRecover(record: Recordable) {
  212. openModal(true, record);
  213. }
  214. function handleAdd(record: Recordable) {
  215. openAddModal(true,record);
  216. }
  217. function handleOut(record: Recordable) {
  218. openOutModal(true,record);
  219. }
  220. function handleOrder() {
  221. openModal(true);
  222. }
  223. function changeTable(val: string) {
  224. tableType.value = val;
  225. reload();
  226. }
  227. return {
  228. registerTable,
  229. reload,
  230. t,
  231. tableType,
  232. openAddModal,
  233. registerOut,
  234. registerAdd,
  235. changeTable,
  236. handleOrder,
  237. getCheckPerm,
  238. handleDetail,
  239. handleAdd,
  240. handleOut,
  241. handleRecover,
  242. registerRecovery,
  243. };
  244. },
  245. });
  246. </script>
  247. <style lang="less" scoped>
  248. .desc-wrap-BasicTable {
  249. background-color: #f0f2f5;
  250. .vben-basic-table-form-container {
  251. padding: 0;
  252. }
  253. }
  254. </style>