index.vue 7.3 KB

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