maintenance.vue 6.7 KB

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