Showing
9 changed files
with
546 additions
and
1 deletions
1 | +export default { | |
2 | + listText: '故障类型列表', | |
3 | + nameText: '故障类型名称', | |
4 | + deviceNameText: '设备名称', | |
5 | + nameCode: '报修单号', | |
6 | + themeText: '报修单号', | |
7 | + reportText: '报修人', | |
8 | + departmentText: '所属部门', | |
9 | + reportDate: '报修时间', | |
10 | + faultDate: '故障时间', | |
11 | + faultLevel: '故障等级', | |
12 | + faultType: '故障类型', | |
13 | + serviceStatus: '是否停机', | |
14 | + deviceCodeText: '设备编号', | |
15 | + modelText: '规格型号', | |
16 | + deviceTypeText: '设备类型', | |
17 | + storageLocationText: '存放位置', | |
18 | + useDepartmentText: '使用部门', | |
19 | + // faultDescription: '故障描述', | |
20 | + // faultPicture: '故障图片', | |
21 | + // faultVideo: '故障视频', | |
22 | + // faultAudio: '故障音频', | |
23 | + // faultFile: '故障文件', | |
24 | + // faultAddress: '故障地址', | |
25 | + // faultStatus: '故障状态', | |
26 | + // faultRepair: '故障维修', | |
27 | + // faultRepairDate: '故障维修时间', | |
28 | + // faultRepairPerson: '故障维修人', | |
29 | + // faultRepairDescription: '故障维修描述', | |
30 | + | |
31 | + enableText: '启用', | |
32 | + disableText: '停用', | |
33 | + status: '状态', | |
34 | + remarks: '备注', | |
35 | + specifications: '规格型号', | |
36 | + typeText: '故障类型', | |
37 | + unitText: '单位', | |
38 | + factoryText: '生产厂商', | |
39 | + operatorText: '操作人', | |
40 | + creatorText: '创建人', | |
41 | + creatorDate: '创建时间', | |
42 | + operaDate: '操作时间', | |
43 | + createCategoryText: '创建设备报修', | |
44 | + editOrderText: '编辑设备报修', | |
45 | + batchActionText: '批量删除', | |
46 | +} | ... | ... |
src/locales/lang/zh-CN/faultReport/types.ts
0 → 100644
1 | +export default { | |
2 | + listText: '故障类型列表', | |
3 | + nameText: '故障类型名称', | |
4 | + nameCode: '故障编码', | |
5 | + enableText: '启用', | |
6 | + disableText: '停用', | |
7 | + status: '状态', | |
8 | + remarks: '备注', | |
9 | + specifications: '规格型号', | |
10 | + typeText: '故障类型', | |
11 | + unitText: '单位', | |
12 | + factoryText: '生产厂商', | |
13 | + operatorText: '操作人', | |
14 | + creatorText: '创建人', | |
15 | + creatorDate: '创建时间', | |
16 | + operaDate: '操作时间', | |
17 | + createCategoryText: '创建故障类型', | |
18 | + editOrderText: '编辑故障类型', | |
19 | + batchActionText: '批量删除', | |
20 | +} | ... | ... |
src/views/faultReport/facility/index.ts
0 → 100644
1 | +import {BasicColumn, FormSchema} from "/@/components/Table"; | |
2 | +import {useI18n} from "/@/hooks/web/useI18n"; | |
3 | +const { t } = useI18n(); | |
4 | +const statusOptions = [ | |
5 | + | |
6 | +]; | |
7 | +export const columns: BasicColumn[] = [ | |
8 | + { | |
9 | + title: t('faultReport.facility.nameCode'), | |
10 | + dataIndex: 'code', | |
11 | + }, | |
12 | + { | |
13 | + title: t('faultReport.facility.themeText'), | |
14 | + dataIndex: 'name', | |
15 | + }, | |
16 | + { | |
17 | + title: t('faultReport.facility.status'), | |
18 | + dataIndex: 'status', | |
19 | + slots: { customRender: 'status' }, | |
20 | + }, | |
21 | + { | |
22 | + title: t('faultReport.facility.reportText'), | |
23 | + dataIndex: 'reportText', | |
24 | + slots: { customRender: 'reportText' }, | |
25 | + }, | |
26 | + { | |
27 | + title: t('faultReport.facility.departmentText'), | |
28 | + dataIndex: 'departmentText', | |
29 | + slots: { customRender: 'departmentText' }, | |
30 | + }, | |
31 | + { | |
32 | + title: t('faultReport.facility.remarks'), | |
33 | + dataIndex: 'remarks', | |
34 | + slots: { customRender: 'remarks' }, | |
35 | + }, | |
36 | + { | |
37 | + title: t('faultReport.facility.creatorText'), | |
38 | + dataIndex: 'creator', | |
39 | + slots: { customRender: 'creator' }, | |
40 | + }, | |
41 | + { | |
42 | + title: t('faultReport.facility.creatorDate'), | |
43 | + dataIndex: 'creatorDate', | |
44 | + } | |
45 | +]; | |
46 | + | |
47 | +export const searchFormSchema: FormSchema[] = [ | |
48 | + { | |
49 | + field: 'deviceNameText', | |
50 | + label: t('faultReport.facility.nameText'), | |
51 | + component: 'Input', | |
52 | + colProps: { span: 6 }, | |
53 | + }, | |
54 | + { | |
55 | + field: 'nameCode', | |
56 | + label: t('faultReport.facility.nameCode'), | |
57 | + component: 'Input', | |
58 | + colProps: { span: 6 }, | |
59 | + }, | |
60 | + { | |
61 | + field: 'nameText', | |
62 | + label: t('faultReport.facility.nameText'), | |
63 | + component: 'Input', | |
64 | + colProps: { span: 6 }, | |
65 | + }, | |
66 | + { | |
67 | + field: 'status', | |
68 | + label: t('faultReport.facility.status'), | |
69 | + component: 'Select', | |
70 | + colProps: { span: 6 }, | |
71 | + componentProps: { | |
72 | + options: statusOptions, | |
73 | + }, | |
74 | + }, | |
75 | +]; | ... | ... |
src/views/faultReport/facility/index.vue
0 → 100644
1 | +<template> | |
2 | + <div> | |
3 | + <BasicTable @register="registerTable" style="flex: auto"> | |
4 | + | |
5 | + </BasicTable> | |
6 | + </div> | |
7 | +</template> | |
8 | +<script lang="ts" setup> | |
9 | +import {getPlanList} from "/@/api/equipment/chenkPlan"; | |
10 | +import {columns, searchFormSchema} from "./index"; | |
11 | +import {DeviceModel} from "/@/api/device/model/deviceModel"; | |
12 | +import {useI18n} from "/@/hooks/web/useI18n"; | |
13 | +const { t } = useI18n(); | |
14 | +import {BasicTable, useTable} from "/@/components/Table"; | |
15 | + | |
16 | +const [ | |
17 | + registerTable, | |
18 | + { reload, setLoading, setSelectedRowKeys, getForm, getSelectRowKeys, getRowSelection }, | |
19 | +] = useTable({ | |
20 | + title: t('faultReport.facility.listText'), | |
21 | + api: getPlanList, | |
22 | + columns, | |
23 | + formConfig: { | |
24 | + labelWidth: 100, | |
25 | + schemas: searchFormSchema, | |
26 | + }, | |
27 | + immediate: true, | |
28 | + useSearchForm: true, | |
29 | + showTableSetting: true, | |
30 | + bordered: true, | |
31 | + showIndexColumn: false, | |
32 | + clickToRowSelect: false, | |
33 | + rowKey: 'id', | |
34 | + actionColumn: { | |
35 | + width: 230, | |
36 | + title: t('common.actionText'), | |
37 | + slots: { customRender: 'action' }, | |
38 | + fixed: 'right', | |
39 | + }, | |
40 | + rowSelection: { | |
41 | + type: 'checkbox', | |
42 | + getCheckboxProps: (record: DeviceModel) => { | |
43 | + return {disabled: !!record.customerId && record.customerName !== 'Public'}; | |
44 | + }, | |
45 | + } | |
46 | +}); | |
47 | +</script> | ... | ... |
1 | +<template> | |
2 | + <div> | |
3 | + <BasicModal | |
4 | + v-bind="$attrs" | |
5 | + width="35rem" | |
6 | + @register="register" | |
7 | + :title="getTitle" | |
8 | + | |
9 | + > | |
10 | +<!-- @cancel="handleCancel"--> | |
11 | +<!-- @ok="handleSubmit"--> | |
12 | + <div> | |
13 | + <BasicForm @register="registerForm" > | |
14 | + | |
15 | + </BasicForm> | |
16 | + </div> | |
17 | + </BasicModal> | |
18 | + </div> | |
19 | +</template> | |
20 | +<script setup lang="ts"> | |
21 | +import {BasicModal, useModalInner} from "/@/components/Modal"; | |
22 | +import {computed, ref, unref} from "vue"; | |
23 | +import {useI18n} from "/@/hooks/web/useI18n"; | |
24 | +import {BasicForm, useForm} from "/@/components/Form"; | |
25 | +import {schemas} from "../index"; | |
26 | +const { t } = useI18n(); | |
27 | +const isUpdate = ref<Boolean>(false); | |
28 | +const getTitle = computed(() => | |
29 | + !unref(isUpdate) ? t('faultReport.types.createOrderText') : t('faultReport.types.editOrderText') | |
30 | +); | |
31 | +const [register, { closeModal, setModalProps }] = useModalInner(async (data) => { | |
32 | + setModalProps({ confirmLoading: false, loading: true }); | |
33 | + isUpdate.value = data?.isUpdate; | |
34 | + // recordInfo.value = data?.record; | |
35 | + // if (!selectedItem.value) { | |
36 | + // selectedItem.value = { id: '', username: '' }; | |
37 | + // } | |
38 | + // selectedItem.value.username = data?.record?.reportByName || ''; | |
39 | + // selectedItem.value.id = data?.record?.reportBy || ''; | |
40 | + // updateSchema({ | |
41 | + // field: 'situationImg', | |
42 | + // componentProps: { | |
43 | + // onChange: handleOrgChange, | |
44 | + // }, | |
45 | + // }); | |
46 | + // if (data?.record) { | |
47 | + // setFieldsValue(data?.record); | |
48 | + // } | |
49 | + setModalProps({ loading: false }); | |
50 | +}); | |
51 | + | |
52 | +const [registerForm, { getFieldsValue, setFieldsValue, validate, updateSchema }] = useForm({ | |
53 | + labelWidth: 140, | |
54 | + schemas, | |
55 | + actionColOptions: { | |
56 | + span: 14, | |
57 | + }, | |
58 | + showActionButtonGroup: false, | |
59 | +}); | |
60 | + | |
61 | +</script> | ... | ... |
src/views/faultReport/types/index.ts
0 → 100644
1 | +import {FormSchema} from "/@/components/Form"; | |
2 | +import {useI18n} from "/@/hooks/web/useI18n"; | |
3 | +import {BasicColumn} from "/@/components/Table"; | |
4 | +import {uploadThumbnail} from "/@/api/configuration/center/configurationCenter"; | |
5 | +import {createImgPreview} from "/@/components/Preview"; | |
6 | +import {getLedgerList} from "/@/api/equipment/ledger"; | |
7 | +const { t } = useI18n(); | |
8 | + | |
9 | +export enum DeviceListAuthEnum { | |
10 | + /** | |
11 | + * @description 新增 | |
12 | + */ | |
13 | + CREATE = 'api:yt:faultReport:types:post', | |
14 | + | |
15 | + /** | |
16 | + * @description 删除 | |
17 | + */ | |
18 | + DELETE = 'api:yt:faultReport:types:delete', | |
19 | + | |
20 | + /** | |
21 | + * @description 编辑 | |
22 | + */ | |
23 | + UPDATE = 'api:yt:faultReport:types:update', | |
24 | + | |
25 | + /** | |
26 | + * @description 详情 | |
27 | + */ | |
28 | + DETAIL = 'api:yt:faultReport:types:get', | |
29 | + | |
30 | + /** | |
31 | + * @description 启用 | |
32 | + */ | |
33 | + ENABLE = 'api:yt:faultReport:types:enable', | |
34 | + | |
35 | + /** | |
36 | + * @description 停用 | |
37 | + */ | |
38 | + DISABLE = 'api:yt:faultReport:types:disable', | |
39 | +} | |
40 | + | |
41 | +export const columns: BasicColumn[] = [ | |
42 | + { | |
43 | + title: t('faultReport.types.nameCode'), | |
44 | + dataIndex: 'code', | |
45 | + }, | |
46 | + { | |
47 | + title: t('faultReport.types.nameText'), | |
48 | + dataIndex: 'name', | |
49 | + }, | |
50 | + { | |
51 | + title: t('faultReport.types.status'), | |
52 | + dataIndex: 'status', | |
53 | + slots: { customRender: 'status' }, | |
54 | + }, | |
55 | + { | |
56 | + title: t('faultReport.types.remarks'), | |
57 | + dataIndex: 'remarks', | |
58 | + slots: { customRender: 'remarks' }, | |
59 | + }, | |
60 | + { | |
61 | + title: t('faultReport.types.creatorText'), | |
62 | + dataIndex: 'creator', | |
63 | + slots: { customRender: 'creator' }, | |
64 | + }, | |
65 | + { | |
66 | + title: t('faultReport.types.creatorDate'), | |
67 | + dataIndex: 'creatorDate', | |
68 | + } | |
69 | +]; | |
70 | + | |
71 | +export const searchFormSchema: FormSchema[] = [ | |
72 | + { | |
73 | + field: 'name', | |
74 | + label: t('faultReport.types.nameText'), | |
75 | + component: 'Input', | |
76 | + colProps: { span: 6 }, | |
77 | + } | |
78 | +]; | |
79 | + | |
80 | +export const schemas: FormSchema[] = [ | |
81 | + { | |
82 | + field: 'image', | |
83 | + label: t('deviceManagement.product.imageText'), | |
84 | + component: 'ApiUpload', | |
85 | + changeEvent: 'update:fileList', | |
86 | + valueField: 'fileList', | |
87 | + componentProps: ({ formModel }) => { | |
88 | + return { | |
89 | + listType: 'picture-card', | |
90 | + maxFileLimit: 1, | |
91 | + accept: '.png,.jpg,.jpeg,.gif', | |
92 | + api: async (file: File) => { | |
93 | + try { | |
94 | + const formData = new FormData(); | |
95 | + formData.set('file', file); | |
96 | + const { fileStaticUri, fileName } = await uploadThumbnail(formData); | |
97 | + return { | |
98 | + uid: fileStaticUri, | |
99 | + name: fileName, | |
100 | + url: fileStaticUri, | |
101 | + }; | |
102 | + } catch (error) { | |
103 | + return {}; | |
104 | + } | |
105 | + }, | |
106 | + onPreview: (fileList) => { | |
107 | + createImgPreview({ imageList: [fileList.url!] }); | |
108 | + }, | |
109 | + onDelete(url: string) { | |
110 | + formModel.deleteUrl = url!; | |
111 | + }, | |
112 | + }; | |
113 | + }, | |
114 | + }, | |
115 | + { | |
116 | + field: 'orderCode', | |
117 | + label: t('repair.order.nameCode'), | |
118 | + component: 'Input', | |
119 | + colProps: { span: 21 }, | |
120 | + required: true, | |
121 | + componentProps: { | |
122 | + maxLength: 20, | |
123 | + }, | |
124 | + }, | |
125 | + { | |
126 | + field: 'deviceId', | |
127 | + label: t('repair.order.deviceNameText'), | |
128 | + component: 'ApiSelect', | |
129 | + colProps: { span: 21 }, | |
130 | + required: true, | |
131 | + componentProps: { | |
132 | + api: getLedgerList, | |
133 | + params: { | |
134 | + page: 1, | |
135 | + pageSize: 999, | |
136 | + }, | |
137 | + resultField: 'items', | |
138 | + labelField: 'name', | |
139 | + valueField: 'id', | |
140 | + }, | |
141 | + }, | |
142 | + { | |
143 | + field: 'reportDate', | |
144 | + label: t('repair.order.time'), | |
145 | + component: 'DatePicker', | |
146 | + componentProps: { | |
147 | + showTime: true, | |
148 | + format: 'YYYY-MM-DD HH:mm:ss', | |
149 | + }, | |
150 | + }, | |
151 | + { | |
152 | + field: 'emergency', | |
153 | + label: t('repair.order.emergencyText'), | |
154 | + component: 'Select', | |
155 | + colProps: { span: 21 }, | |
156 | + required: true, | |
157 | + // componentProps: { | |
158 | + // options: emergencyOptions, | |
159 | + // }, | |
160 | + }, | |
161 | + { | |
162 | + field: 'description', | |
163 | + label: '故障描述', | |
164 | + colProps: { span: 21 }, | |
165 | + component: 'InputTextArea', | |
166 | + componentProps: { | |
167 | + maxLength: 255, | |
168 | + placeholder: '请输入描述', | |
169 | + }, | |
170 | + }, | |
171 | +]; | ... | ... |
src/views/faultReport/types/index.vue
0 → 100644
1 | +<template> | |
2 | + <div> | |
3 | + <BasicTable @register="registerTable" style="flex: auto"> | |
4 | + <template #toolbar> | |
5 | + <Authority value="api:yt:faultReport:types:post"> | |
6 | + <Button type="primary" @click="handleCreate"> | |
7 | + {{ t('faultReport.types.createCategoryText') }} | |
8 | + </Button> | |
9 | + </Authority> | |
10 | + | |
11 | + <Authority | |
12 | + :value="[ | |
13 | + DeviceListAuthEnum.DELETE, | |
14 | + DeviceListAuthEnum.ENABLE, | |
15 | + DeviceListAuthEnum.DISABLE, | |
16 | + ]" | |
17 | + > | |
18 | + <AuthDropDown | |
19 | + v-if="authBtn(role)" | |
20 | + :disabled="!isExistOption" | |
21 | + :dropMenuList="[ | |
22 | + { | |
23 | + text: t('common.delText'), | |
24 | + auth: DeviceListAuthEnum.DELETE, | |
25 | + icon: 'ant-design:delete-outlined', | |
26 | + event: '', | |
27 | + // popconfirm: { | |
28 | + // title: t('common.deleteConfirmText'), | |
29 | + // onConfirm: () => handleDelete(), | |
30 | + // }, | |
31 | + }, | |
32 | + { | |
33 | + text: t('faultReport.types.enableText'), | |
34 | + auth: DeviceListAuthEnum.ENABLE, | |
35 | + icon: 'ant-design:check-circle-outlined', | |
36 | + event: '', | |
37 | + // onClick: handelOpenBatchUpdateProductModal, | |
38 | + }, | |
39 | + { | |
40 | + text: t('faultReport.types.disableText'), | |
41 | + auth: DeviceListAuthEnum.DISABLE, | |
42 | + icon: 'ant-design:close-circle-outlined', | |
43 | + event: '', | |
44 | + // disabled: !batchPrivateFlag || batchUpdateProductFlag, | |
45 | + // onClick: handelOpenBatchUpdateProductModal, | |
46 | + }, | |
47 | + // { | |
48 | + // text: t('business.privateText'), | |
49 | + // icon: 'ant-design:wallet-outlined', | |
50 | + // event: '', | |
51 | + // // disabled: batchPrivateFlag, | |
52 | + // // onClick: handleBatchPrivate.bind(null), | |
53 | + // } | |
54 | + ]" | |
55 | + > | |
56 | + <Button type="primary" :disabled="!isExistOption"> | |
57 | + {{ t('faultReport.types.batchActionText') }} | |
58 | + </Button> | |
59 | + </AuthDropDown> | |
60 | + </Authority> | |
61 | + </template> | |
62 | + </BasicTable> | |
63 | + <ReportModal /> | |
64 | + </div> | |
65 | +</template> | |
66 | +<script setup lang="ts"> | |
67 | +import { ReportModal } from "./components/index" | |
68 | +import {BasicTable, useTable} from "/@/components/Table"; | |
69 | +import {columns, searchFormSchema} from "./index"; | |
70 | +import {getPlanList} from "/@/api/equipment/chenkPlan"; | |
71 | +import {useI18n} from "/@/hooks/web/useI18n"; | |
72 | +import {Authority} from "/@/components/Authority"; | |
73 | +import {Button} from "ant-design-vue"; | |
74 | +import {DeviceListAuthEnum} from "./index"; | |
75 | +import {authBtn} from "/@/enums/roleEnum"; | |
76 | +import {AuthDropDown} from "/@/components/Widget"; | |
77 | +import {useBatchOperation} from "/@/utils/useBatchOperation"; | |
78 | +import {DeviceModel} from "/@/api/device/model/deviceModel"; | |
79 | +const { t } = useI18n(); | |
80 | + | |
81 | +const [ | |
82 | + registerTable, | |
83 | + { reload, setLoading, setSelectedRowKeys, getForm, getSelectRowKeys, getRowSelection }, | |
84 | +] = useTable({ | |
85 | + title: t('faultReport.types.listText'), | |
86 | + api: getPlanList, | |
87 | + columns, | |
88 | + formConfig: { | |
89 | + labelWidth: 100, | |
90 | + schemas: searchFormSchema, | |
91 | + }, | |
92 | + immediate: true, | |
93 | + useSearchForm: true, | |
94 | + showTableSetting: true, | |
95 | + bordered: true, | |
96 | + showIndexColumn: false, | |
97 | + clickToRowSelect: false, | |
98 | + rowKey: 'id', | |
99 | + actionColumn: { | |
100 | + width: 230, | |
101 | + title: t('common.actionText'), | |
102 | + slots: { customRender: 'action' }, | |
103 | + fixed: 'right', | |
104 | + }, | |
105 | + rowSelection: { | |
106 | + type: 'checkbox', | |
107 | + getCheckboxProps: (record: DeviceModel) => { | |
108 | + return {disabled: !!record.customerId && record.customerName !== 'Public'}; | |
109 | + }, | |
110 | + } | |
111 | +}); | |
112 | + | |
113 | +const { isExistOption } = useBatchOperation(getRowSelection, setSelectedRowKeys); | |
114 | + | |
115 | +// 新增 | |
116 | +const handleCreate = () => { | |
117 | + openModal(true, { | |
118 | + isUpdate: false, | |
119 | + }); | |
120 | +}; | |
121 | + | |
122 | +</script> | ... | ... |