Showing
8 changed files
with
373 additions
and
0 deletions
src/locales/lang/zh-CN/spare/equip.ts
0 → 100644
1 | +export default { | |
2 | + listText: '备件台账列表', | |
3 | + nameText: '备件名称', | |
4 | + nameCode: '备件编号', | |
5 | + specifications: '规格型号', | |
6 | + typeText: '备件类型', | |
7 | + unitText: '单位', | |
8 | + factoryText: '生产厂商', | |
9 | + operatorText: '操作人', | |
10 | + operaDate: '操作时间', | |
11 | + createCategoryText: '创建备件台账', | |
12 | + editOrderText: '编辑备件台账', | |
13 | +} | ... | ... |
src/locales/lang/zh-CN/spare/types.ts
0 → 100644
1 | +export default { | |
2 | + listText: '备件类型列表', | |
3 | + nameText: '备件名称', | |
4 | + nameCode: '备件编号', | |
5 | + specifications: '规格型号', | |
6 | + typeText: '备件类型', | |
7 | + unitText: '单位', | |
8 | + factoryText: '生产厂商', | |
9 | + operatorText: '操作人', | |
10 | + operaDate: '操作时间', | |
11 | + createCategoryText: '创建备件台账', | |
12 | + editOrderText: '编辑备件台账', | |
13 | +} | ... | ... |
1 | +<template> | |
2 | + <div> | |
3 | + <BasicModal | |
4 | + v-bind="$attrs" | |
5 | + width="30rem" | |
6 | + :title="getTitle" | |
7 | + @register="register" | |
8 | + @cancel="handleCancel" | |
9 | + @ok="handleOk" | |
10 | + destroyOnClose | |
11 | + > | |
12 | + | |
13 | + </BasicModal> | |
14 | + </div> | |
15 | +</template> | |
16 | +<script setup lang="ts"> | |
17 | +import {BasicModal} from "/@/components/Modal"; | |
18 | +import {computed, ref, unref} from "vue"; | |
19 | +import {useI18n} from "/@/hooks/web/useI18n"; | |
20 | +const { t } = useI18n(); | |
21 | +const isUpdate = ref<Boolean>(false); | |
22 | + | |
23 | + | |
24 | +const getTitle = computed(() => | |
25 | + !unref(isUpdate) ? t('spare.equip.createCategoryText') : t('spare.equip.editOrderText') | |
26 | +); | |
27 | + | |
28 | +const emit = defineEmits(['handleReload', 'register']); | |
29 | + | |
30 | + | |
31 | + | |
32 | +</script> | ... | ... |
src/views/spare/equip/components/index.ts
0 → 100644
src/views/spare/equip/index.ts
0 → 100644
1 | +import {FormSchema} from "/@/components/Form"; | |
2 | +import {useI18n} from "/@/hooks/web/useI18n"; | |
3 | +import {BasicColumn} from "/@/components/Table"; | |
4 | +const { t } = useI18n(); | |
5 | + | |
6 | +export const columns: BasicColumn[] = [ | |
7 | + { | |
8 | + title: t('spare.equip.nameCode'), | |
9 | + dataIndex: 'code', | |
10 | + }, | |
11 | + { | |
12 | + title: t('spare.equip.nameText'), | |
13 | + dataIndex: 'name', | |
14 | + }, | |
15 | + { | |
16 | + title: t('spare.equip.specifications'), | |
17 | + dataIndex: 'name', | |
18 | + }, | |
19 | + { | |
20 | + title: t('spare.equip.typeText'), | |
21 | + dataIndex: 'type', | |
22 | + slots: { customRender: 'type' }, | |
23 | + }, | |
24 | + { | |
25 | + title: t('spare.equip.unitText'), | |
26 | + dataIndex: 'unit', | |
27 | + slots: { customRender: 'unit' }, | |
28 | + }, | |
29 | + { | |
30 | + title: t('spare.equip.factoryText'), | |
31 | + dataIndex: 'factory', | |
32 | + }, | |
33 | + { | |
34 | + title: t('spare.equip.operatorText'), | |
35 | + dataIndex: 'operator', | |
36 | + }, | |
37 | + { | |
38 | + title: t('spare.equip.operaDate'), | |
39 | + dataIndex: 'operaDate', | |
40 | + }, | |
41 | +]; | |
42 | + | |
43 | +export const searchFormSchema: FormSchema[] = [ | |
44 | + { | |
45 | + field: 'name', | |
46 | + label: t('spare.equip.nameText'), | |
47 | + component: 'Input', | |
48 | + colProps: { span: 6 }, | |
49 | + }, | |
50 | + { | |
51 | + field: 'code', | |
52 | + label: t('spare.equip.nameCode'), | |
53 | + component: 'Input', | |
54 | + colProps: { span: 6 }, | |
55 | + }, | |
56 | + { | |
57 | + field: 'type', | |
58 | + label: t('spare.equip.typeText'), | |
59 | + component: 'Select', | |
60 | + colProps: { span: 6 }, | |
61 | + }, | |
62 | + { | |
63 | + field: 'specifications', | |
64 | + label: t('spare.equip.specifications'), | |
65 | + component: 'Input', | |
66 | + colProps: { span: 6 }, | |
67 | + }, | |
68 | + { | |
69 | + field: 'factory', | |
70 | + label: t('spare.equip.factoryText'), | |
71 | + component: 'Input', | |
72 | + colProps: { span: 6 }, | |
73 | + } | |
74 | +]; | ... | ... |
src/views/spare/equip/index.vue
0 → 100644
1 | +<template> | |
2 | + <div > | |
3 | + <BasicTable style="flex: auto" @register="registerTable"> | |
4 | + <template #toolbar> | |
5 | + <Authority value="api:yt:equip:post"> | |
6 | + <Button type="primary" @click="handleCreate"> | |
7 | + {{ t('spare.equip.createCategoryText') }} | |
8 | + </Button> | |
9 | + </Authority> | |
10 | + </template> | |
11 | + <template #action="{ record }"> | |
12 | + <TableAction | |
13 | + :actions="[ | |
14 | + { | |
15 | + label: t('common.detailText'), | |
16 | + icon: 'ant-design:eye-outlined', | |
17 | + auth: 'api:yt:equip:get', | |
18 | + onClick: handleDetail.bind(null, record), | |
19 | + }, | |
20 | + { | |
21 | + label: t('common.editText'), | |
22 | + auth: 'api:yt:equip:update', | |
23 | + icon: 'clarity:note-edit-line', | |
24 | + onClick: handleEdit.bind(null, record), | |
25 | + }, | |
26 | + { | |
27 | + label: t('common.delText'), | |
28 | + auth: 'api:yt:equip:delete', | |
29 | + icon: 'ant-design:delete-outlined', | |
30 | + color: 'error', | |
31 | + popConfirm: { | |
32 | + title: t('common.deleteConfirmText'), | |
33 | + confirm: handleDelete.bind(null, record), | |
34 | + }, | |
35 | + }, | |
36 | + ]" | |
37 | + /> | |
38 | + </template> | |
39 | + </BasicTable> | |
40 | + <EquipModal @register="registerModal" /> | |
41 | + </div> | |
42 | +</template> | |
43 | +<script setup lang="ts"> | |
44 | +import {BasicTable, TableAction, useTable} from "/@/components/Table"; | |
45 | +import {getPlanList} from "/@/api/equipment/chenkPlan"; | |
46 | +import {columns, searchFormSchema} from "/@/views/spare/equip/index"; | |
47 | +import {useI18n} from "/@/hooks/web/useI18n"; | |
48 | +import {Button} from "ant-design-vue"; | |
49 | +import {Authority} from "/@/components/Authority"; | |
50 | +import {useModal} from "/@/components/Modal"; | |
51 | +import { EquipModal } from './components/index' | |
52 | +const [registerModal, { openModal }] = useModal(); | |
53 | + | |
54 | +const { t } = useI18n(); | |
55 | +const [ | |
56 | + registerTable, | |
57 | + { reload, setLoading, setSelectedRowKeys }, | |
58 | +] = useTable({ | |
59 | + title: t('spare.equip.listText'), | |
60 | + api: getPlanList, | |
61 | + columns, | |
62 | + formConfig: { | |
63 | + labelWidth: 100, | |
64 | + schemas: searchFormSchema, | |
65 | + }, | |
66 | + immediate: true, | |
67 | + useSearchForm: true, | |
68 | + showTableSetting: true, | |
69 | + bordered: true, | |
70 | + showIndexColumn: false, | |
71 | + clickToRowSelect: false, | |
72 | + rowKey: 'id', | |
73 | + actionColumn: { | |
74 | + width: 230, | |
75 | + title: t('common.actionText'), | |
76 | + slots: { customRender: 'action' }, | |
77 | + fixed: 'right', | |
78 | + }, | |
79 | +}); | |
80 | + | |
81 | +// 新增 | |
82 | +const handleCreate = () => { | |
83 | + openModal(true, { | |
84 | + isUpdate: false, | |
85 | + }); | |
86 | +}; | |
87 | + | |
88 | +</script> | ... | ... |
src/views/spare/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 | +const { t } = useI18n(); | |
5 | + | |
6 | +export const columns: BasicColumn[] = [ | |
7 | + { | |
8 | + title: t('spare.types.nameCode'), | |
9 | + dataIndex: 'code', | |
10 | + }, | |
11 | + { | |
12 | + title: t('spare.types.nameText'), | |
13 | + dataIndex: 'name', | |
14 | + }, | |
15 | + { | |
16 | + title: t('spare.types.specifications'), | |
17 | + dataIndex: 'name', | |
18 | + }, | |
19 | + { | |
20 | + title: t('spare.types.typeText'), | |
21 | + dataIndex: 'type', | |
22 | + slots: { customRender: 'type' }, | |
23 | + }, | |
24 | + { | |
25 | + title: t('spare.types.unitText'), | |
26 | + dataIndex: 'unit', | |
27 | + slots: { customRender: 'unit' }, | |
28 | + }, | |
29 | + { | |
30 | + title: t('spare.types.factoryText'), | |
31 | + dataIndex: 'factory', | |
32 | + }, | |
33 | + { | |
34 | + title: t('spare.types.operatorText'), | |
35 | + dataIndex: 'operator', | |
36 | + }, | |
37 | + { | |
38 | + title: t('spare.types.operaDate'), | |
39 | + dataIndex: 'operaDate', | |
40 | + }, | |
41 | +]; | |
42 | + | |
43 | +export const searchFormSchema: FormSchema[] = [ | |
44 | + { | |
45 | + field: 'name', | |
46 | + label: t('spare.types.nameText'), | |
47 | + component: 'Input', | |
48 | + colProps: { span: 6 }, | |
49 | + }, | |
50 | + { | |
51 | + field: 'code', | |
52 | + label: t('spare.types.nameCode'), | |
53 | + component: 'Input', | |
54 | + colProps: { span: 6 }, | |
55 | + }, | |
56 | + { | |
57 | + field: 'type', | |
58 | + label: t('spare.types.typeText'), | |
59 | + component: 'Select', | |
60 | + colProps: { span: 6 }, | |
61 | + }, | |
62 | + { | |
63 | + field: 'specifications', | |
64 | + label: t('spare.types.specifications'), | |
65 | + component: 'Input', | |
66 | + colProps: { span: 6 }, | |
67 | + }, | |
68 | + { | |
69 | + field: 'factory', | |
70 | + label: t('spare.types.factoryText'), | |
71 | + component: 'Input', | |
72 | + colProps: { span: 6 }, | |
73 | + } | |
74 | +]; | ... | ... |
src/views/spare/types/index.vue
0 → 100644
1 | +<template> | |
2 | + <div> | |
3 | + <BasicTable style="flex: auto" @register="registerTable"> | |
4 | + <template #toolbar> | |
5 | + <Authority value="api:yt:types:post"> | |
6 | + <Button type="primary" @click="handleCreate"> | |
7 | + {{ t('spare.types.createCategoryText') }} | |
8 | + </Button> | |
9 | + </Authority> | |
10 | + </template> | |
11 | + <template #action="{ record }"> | |
12 | + <TableAction | |
13 | + :actions="[ | |
14 | + { | |
15 | + label: t('common.detailText'), | |
16 | + icon: 'ant-design:eye-outlined', | |
17 | + auth: 'api:yt:types:get', | |
18 | + onClick: handleDetail.bind(null, record), | |
19 | + }, | |
20 | + { | |
21 | + label: t('common.editText'), | |
22 | + auth: 'api:yt:types:update', | |
23 | + icon: 'clarity:note-edit-line', | |
24 | + onClick: handleEdit.bind(null, record), | |
25 | + }, | |
26 | + { | |
27 | + label: t('common.delText'), | |
28 | + auth: 'api:yt:types:delete', | |
29 | + icon: 'ant-design:delete-outlined', | |
30 | + color: 'error', | |
31 | + popConfirm: { | |
32 | + title: t('common.deleteConfirmText'), | |
33 | + confirm: handleDelete.bind(null, record), | |
34 | + }, | |
35 | + }, | |
36 | + ]" | |
37 | + /> | |
38 | + </template> | |
39 | + </BasicTable> | |
40 | + </div> | |
41 | +</template> | |
42 | +<script setup lang="ts"> | |
43 | +import {BasicTable, TableAction, useTable} from "/@/components/Table"; | |
44 | +import {getPlanList} from "/@/api/equipment/chenkPlan"; | |
45 | +import {columns, searchFormSchema} from "./index"; | |
46 | +import {useI18n} from "/@/hooks/web/useI18n"; | |
47 | +import {Button} from "ant-design-vue"; | |
48 | +import {Authority} from "/@/components/Authority"; | |
49 | +const { t } = useI18n(); | |
50 | + | |
51 | +const [ | |
52 | + registerTable, | |
53 | + { reload, setLoading, setSelectedRowKeys }, | |
54 | +] = useTable({ | |
55 | + title: t('spare.types.listText'), | |
56 | + api: getPlanList, | |
57 | + columns, | |
58 | + formConfig: { | |
59 | + labelWidth: 100, | |
60 | + schemas: searchFormSchema, | |
61 | + }, | |
62 | + immediate: true, | |
63 | + useSearchForm: true, | |
64 | + showTableSetting: true, | |
65 | + bordered: true, | |
66 | + showIndexColumn: false, | |
67 | + clickToRowSelect: false, | |
68 | + rowKey: 'id', | |
69 | + actionColumn: { | |
70 | + width: 230, | |
71 | + title: t('common.actionText'), | |
72 | + slots: { customRender: 'action' }, | |
73 | + fixed: 'right', | |
74 | + }, | |
75 | +}); | |
76 | +</script> | ... | ... |