Showing
9 changed files
with
236 additions
and
124 deletions
@@ -61,7 +61,7 @@ | @@ -61,7 +61,7 @@ | ||
61 | selectedKeys.value = []; | 61 | selectedKeys.value = []; |
62 | } | 62 | } |
63 | 63 | ||
64 | - const foldFlag = ref(false); | 64 | + const foldFlag = ref(true); |
65 | const handleFold = () => { | 65 | const handleFold = () => { |
66 | foldFlag.value = !unref(foldFlag); | 66 | foldFlag.value = !unref(foldFlag); |
67 | }; | 67 | }; |
@@ -78,11 +78,12 @@ | @@ -78,11 +78,12 @@ | ||
78 | }; | 78 | }; |
79 | 79 | ||
80 | onMounted(async () => { | 80 | onMounted(async () => { |
81 | + console.log(attrs,'attrs') | ||
81 | if (attrs?.isOpen) { | 82 | if (attrs?.isOpen) { |
82 | foldFlag.value = false; | 83 | foldFlag.value = false; |
83 | - treeStyle.value.height = '50vh' | 84 | + treeStyle.value.maxHeight = '50vh' |
84 | }else { | 85 | }else { |
85 | - treeStyle.value.height = '100vh' | 86 | + treeStyle.value.maxHeight = '100vh' |
86 | } | 87 | } |
87 | let api:any; | 88 | let api:any; |
88 | if (attrs?.listType === 'equipment') { | 89 | if (attrs?.listType === 'equipment') { |
@@ -12,12 +12,42 @@ | @@ -12,12 +12,42 @@ | ||
12 | @close="handleClose" | 12 | @close="handleClose" |
13 | > | 13 | > |
14 | <BasicForm @register="registerForm"> | 14 | <BasicForm @register="registerForm"> |
15 | - | ||
16 | </BasicForm> | 15 | </BasicForm> |
16 | + <div style="display: flex;width: 70%;margin-left: 70px"> | ||
17 | + <div style="width: 122px;text-align: center"> | ||
18 | + 报修人 | ||
19 | + </div> | ||
20 | + <a-input | ||
21 | + placeholder="请选择" | ||
22 | + :disabled="true" | ||
23 | + v-model:value="selectedUsername" | ||
24 | + > | ||
25 | + </a-input> | ||
26 | + <a-button type="primary" @click="goChoose">选人</a-button> | ||
27 | + </div> | ||
28 | + <a-modal | ||
29 | + v-model:visible="userVisible" | ||
30 | + :title="userModalTitle" | ||
31 | + width="60vw" | ||
32 | + height="50vh" | ||
33 | + @ok="handleUserOk" | ||
34 | + @cancel="handleUserCancel" | ||
35 | + > | ||
36 | + <div style="padding: 20px;display: flex"> | ||
37 | + <OrganizationIdTree @select="handleSelect" ref="organizationIdTreeRef" isOpen="true"/> | ||
38 | + <div style="margin-top: 20px;margin-left: 30px"> | ||
39 | + <a-radio-group v-model:value="selectedItem"> | ||
40 | + <template v-for="item in Options" :key="`${item.id}`"> | ||
41 | + <a-radio :style="radioStyle" :value="item">{{ item.username }}</a-radio> | ||
42 | + </template> | ||
43 | + </a-radio-group> | ||
44 | + </div> | ||
45 | + </div> | ||
46 | + </a-modal> | ||
17 | </BasicDrawer> | 47 | </BasicDrawer> |
18 | </template> | 48 | </template> |
19 | <script setup lang="ts"> | 49 | <script setup lang="ts"> |
20 | -import {nextTick, reactive, ref} from "vue"; | 50 | +import {computed, nextTick, reactive, ref} from "vue"; |
21 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 51 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
22 | import { SchemaFiled} from "../../config/enum"; | 52 | import { SchemaFiled} from "../../config/enum"; |
23 | import {BasicForm,useForm} from "/@/components/Form"; | 53 | import {BasicForm,useForm} from "/@/components/Form"; |
@@ -28,6 +58,7 @@ import {useUserStore} from "/@/store/modules/user"; | @@ -28,6 +58,7 @@ import {useUserStore} from "/@/store/modules/user"; | ||
28 | import {useThrottleFn} from "@vueuse/shared/index"; | 58 | import {useThrottleFn} from "@vueuse/shared/index"; |
29 | import {useMessage} from "/@/hooks/web/useMessage"; | 59 | import {useMessage} from "/@/hooks/web/useMessage"; |
30 | import {useI18n} from "/@/hooks/web/useI18n"; | 60 | import {useI18n} from "/@/hooks/web/useI18n"; |
61 | +import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; | ||
31 | const { | 62 | const { |
32 | setDefaultTime, | 63 | setDefaultTime, |
33 | disableCustomWeekly, | 64 | disableCustomWeekly, |
@@ -40,6 +71,29 @@ const restData = reactive({ | @@ -40,6 +71,29 @@ const restData = reactive({ | ||
40 | }); | 71 | }); |
41 | const { createMessage } = useMessage(); | 72 | const { createMessage } = useMessage(); |
42 | const { t } = useI18n(); | 73 | const { t } = useI18n(); |
74 | + | ||
75 | +// 定义人员选项 | ||
76 | +const Options = ref([]); | ||
77 | +const searchInfo = reactive<Recordable>({}); | ||
78 | +const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); | ||
79 | +const userVisible = ref(false); | ||
80 | +const userModalTitle = ref('选人'); | ||
81 | +const selectedItem = ref<{ id: string; username: string } | null>(null); | ||
82 | +const radioStyle = reactive({ | ||
83 | + display: 'block', | ||
84 | + height: '30px', | ||
85 | + lineHeight: '30px', | ||
86 | +}); | ||
87 | +// 计算属性实现双向绑定 | ||
88 | +const selectedUsername = computed({ | ||
89 | + get: () => selectedItem.value?.username || '', | ||
90 | + set: (value) => { | ||
91 | + if (selectedItem.value) { | ||
92 | + selectedItem.value.username = value; | ||
93 | + } | ||
94 | + }, | ||
95 | +}); | ||
96 | + | ||
43 | const emits = defineEmits(['success', 'register']); | 97 | const emits = defineEmits(['success', 'register']); |
44 | const [registerForm, { validate, resetFields, setFieldsValue, updateSchema, setProps }] = useForm( | 98 | const [registerForm, { validate, resetFields, setFieldsValue, updateSchema, setProps }] = useForm( |
45 | { | 99 | { |
@@ -49,42 +103,6 @@ const [registerForm, { validate, resetFields, setFieldsValue, updateSchema, setP | @@ -49,42 +103,6 @@ const [registerForm, { validate, resetFields, setFieldsValue, updateSchema, setP | ||
49 | fieldMapToTime: [[SchemaFiled.DATE_RANGE, [SchemaFiled.START_TS, SchemaFiled.END_TS]]], | 103 | fieldMapToTime: [[SchemaFiled.DATE_RANGE, [SchemaFiled.START_TS, SchemaFiled.END_TS]]], |
50 | } | 104 | } |
51 | ); | 105 | ); |
52 | -// 定义人员选项 | ||
53 | -const userOptions = ref<any[]>([]); | ||
54 | - | ||
55 | -// 监听 org 字段的变化 | ||
56 | -const handleOrgChange = async (orgId: string) => { | ||
57 | - if (!orgId) { | ||
58 | - userOptions.value = []; // 清空人员选项 | ||
59 | - updateSchema({ | ||
60 | - field: 'directorId', | ||
61 | - componentProps: { options: [] }, | ||
62 | - }); | ||
63 | - return; | ||
64 | - } | ||
65 | - const _data = { | ||
66 | - page: '1', | ||
67 | - pageSize: '999', | ||
68 | - tenantId: userInfo.getUserInfo.tenantId!, | ||
69 | - organizationId: orgId | ||
70 | - } | ||
71 | - // 调用接口 B 获取人员数据 | ||
72 | - const userList = await getUserListByOrg(_data); | ||
73 | - console.log(userList,'userList') | ||
74 | - userOptions.value = userList?.items.map(user => ({ | ||
75 | - label: user.username, | ||
76 | - value: user.id, | ||
77 | - })); | ||
78 | - | ||
79 | - // 更新 user 字段的选项 | ||
80 | - updateSchema({ | ||
81 | - field: 'directorId', | ||
82 | - componentProps: { options: userOptions.value }, | ||
83 | - }); | ||
84 | -}; | ||
85 | - | ||
86 | - | ||
87 | - | ||
88 | 106 | ||
89 | const businessText = ref(''); | 107 | const businessText = ref(''); |
90 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | 108 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
@@ -92,13 +110,11 @@ const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async ( | @@ -92,13 +110,11 @@ const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async ( | ||
92 | await nextTick(); | 110 | await nextTick(); |
93 | handleClose(); | 111 | handleClose(); |
94 | businessText.value = data.text; | 112 | businessText.value = data.text; |
95 | - // 更新 formSchema 中的 org 字段,绑定 change 事件 | ||
96 | - updateSchema({ | ||
97 | - field: 'org', | ||
98 | - componentProps: { | ||
99 | - onChange: handleOrgChange, | ||
100 | - }, | ||
101 | - }); | 113 | + if (!selectedItem.value) { |
114 | + selectedItem.value = { id: '', username: '' }; | ||
115 | + } | ||
116 | + selectedItem.value.username = data?.record?.reportByName || ''; | ||
117 | + selectedItem.value.id = data?.record?.reportBy || ''; | ||
102 | setFieldsValue(setDefaultTime()); | 118 | setFieldsValue(setDefaultTime()); |
103 | updateSchema(disableCustomWeekly(0)); | 119 | updateSchema(disableCustomWeekly(0)); |
104 | setDrawerProps(setPropsForModal(businessText.value)); | 120 | setDrawerProps(setPropsForModal(businessText.value)); |
@@ -141,6 +157,7 @@ const getValue = async () => { | @@ -141,6 +157,7 @@ const getValue = async () => { | ||
141 | productDate: values.productDate?.format('YYYY-MM-DD hh:mm:ss'), | 157 | productDate: values.productDate?.format('YYYY-MM-DD hh:mm:ss'), |
142 | receiveDate: values.receiveDate?.format('YYYY-MM-DD hh:mm:ss'), | 158 | receiveDate: values.receiveDate?.format('YYYY-MM-DD hh:mm:ss'), |
143 | registeDate: values.registeDate?.format('YYYY-MM-DD hh:mm:ss'), | 159 | registeDate: values.registeDate?.format('YYYY-MM-DD hh:mm:ss'), |
160 | + directorId: selectedItem.value?.id || '', | ||
144 | }; | 161 | }; |
145 | removeFields.forEach((item) => { | 162 | removeFields.forEach((item) => { |
146 | Reflect.deleteProperty(data, item); | 163 | Reflect.deleteProperty(data, item); |
@@ -160,5 +177,37 @@ const getValue = async () => { | @@ -160,5 +177,37 @@ const getValue = async () => { | ||
160 | setDrawerProps({ confirmLoading: false }); | 177 | setDrawerProps({ confirmLoading: false }); |
161 | } | 178 | } |
162 | }; | 179 | }; |
180 | +const goChoose = () => { | ||
181 | + userVisible.value = true; | ||
182 | + selectedItem.value = null; | ||
183 | +} | ||
184 | + | ||
185 | +// 确认按钮的回调 | ||
186 | +const handleUserOk = () => { | ||
187 | + if (!selectedItem.value) { | ||
188 | + createMessage.warning('请选择一个用户'); | ||
189 | + return; | ||
190 | + } | ||
191 | + | ||
192 | + userVisible.value = false; // 关闭弹框 | ||
193 | +}; | ||
194 | + | ||
195 | +const handleUserCancel = () => { | ||
196 | + selectedItem.value = null; | ||
197 | + userVisible.value = false; | ||
198 | +}; | ||
199 | + | ||
200 | +const handleSelect = async (organizationId: string) => { | ||
201 | + searchInfo.organizationId = organizationId; | ||
202 | + const _data = { | ||
203 | + page: '1', | ||
204 | + pageSize: '999', | ||
205 | + tenantId: userInfo.getUserInfo.tenantId!, | ||
206 | + organizationId: organizationId | ||
207 | + } | ||
208 | + const response = await getUserListByOrg(_data); // 调用接口 | ||
209 | + Options.value = response.items; | ||
210 | + | ||
211 | +}; | ||
163 | 212 | ||
164 | </script> | 213 | </script> |
@@ -50,31 +50,6 @@ export const formSchema: BFormSchema[] = [ | @@ -50,31 +50,6 @@ export const formSchema: BFormSchema[] = [ | ||
50 | }, | 50 | }, |
51 | }, | 51 | }, |
52 | { | 52 | { |
53 | - field: 'org', | ||
54 | - component: 'OrgTreeSelect', | ||
55 | - label: '负责人组织', | ||
56 | - required: true, | ||
57 | - colProps: { span: 24 }, | ||
58 | - componentProps: { | ||
59 | - // 添加 change 事件 | ||
60 | - onChange: (value: string) => { | ||
61 | - // 这里需要触发加载人员数据的逻辑 | ||
62 | - console.log(value,'value') | ||
63 | - }, | ||
64 | - }, | ||
65 | - }, | ||
66 | - { | ||
67 | - field: 'directorId', | ||
68 | - component: 'Select', | ||
69 | - label: '负责人', | ||
70 | - required: true, | ||
71 | - colProps: { span: 24 }, | ||
72 | - componentProps: { | ||
73 | - // 动态加载的选项 | ||
74 | - options: [], // 初始为空,后续动态加载 | ||
75 | - }, | ||
76 | - }, | ||
77 | - { | ||
78 | field: 'isOnline', | 53 | field: 'isOnline', |
79 | component: 'Select', | 54 | component: 'Select', |
80 | label: '是否联网', | 55 | label: '是否联网', |
@@ -6,6 +6,11 @@ const { t } = useI18n(); | @@ -6,6 +6,11 @@ const { t } = useI18n(); | ||
6 | 6 | ||
7 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
8 | { | 8 | { |
9 | + title: t('repair.history.photo'), | ||
10 | + dataIndex: 'situationImg', | ||
11 | + slots: { customRender: 'situationImg' }, | ||
12 | + }, | ||
13 | + { | ||
9 | title: t('repair.history.orderCode'), | 14 | title: t('repair.history.orderCode'), |
10 | dataIndex: 'code', | 15 | dataIndex: 'code', |
11 | }, | 16 | }, |
@@ -34,13 +39,7 @@ export const columns: BasicColumn[] = [ | @@ -34,13 +39,7 @@ export const columns: BasicColumn[] = [ | ||
34 | return record.tkRepairOrderDTO?.reportByName || '-' || text; | 39 | return record.tkRepairOrderDTO?.reportByName || '-' || text; |
35 | }, | 40 | }, |
36 | }, | 41 | }, |
37 | - { | ||
38 | - title: t('repair.history.photo'), | ||
39 | - dataIndex: 'tkRepairOrderDTO', | ||
40 | - format: (text, record) => { | ||
41 | - return record.tkRepairOrderDTO?.situationImg || '-' || text; | ||
42 | - }, | ||
43 | - }, | 42 | + |
44 | { | 43 | { |
45 | title: t('repair.history.description'), | 44 | title: t('repair.history.description'), |
46 | dataIndex: 'description', | 45 | dataIndex: 'description', |
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | <BasicTable style="flex: auto" @register="registerTable"> | 3 | <BasicTable style="flex: auto" @register="registerTable"> |
4 | - <template #toolbar> </template> | 4 | + <template #situationImg="{ record }"> |
5 | + <TableImg | ||
6 | + :size="30" | ||
7 | + :showBadge="false" | ||
8 | + :simpleShow="true" | ||
9 | + :imgList=" | ||
10 | + typeof record?.tkRepairOrderDTO?.situationImg !== 'undefined' && record?.tkRepairOrderDTO?.situationImg !== '' && record?.tkRepairOrderDTO?.situationImg != null | ||
11 | + ? [record?.tkRepairOrderDTO?.situationImg] | ||
12 | + : null | ||
13 | + " | ||
14 | + /> | ||
15 | + </template> | ||
5 | </BasicTable> | 16 | </BasicTable> |
6 | </div> | 17 | </div> |
7 | </template> | 18 | </template> |
8 | <script setup lang="ts"> | 19 | <script setup lang="ts"> |
9 | - import { BasicTable, useTable } from '/@/components/Table'; | 20 | + import { BasicTable, useTable, TableImg } from '/@/components/Table'; |
10 | import { getRepairHistoryList } from '/@/api/repair/history'; | 21 | import { getRepairHistoryList } from '/@/api/repair/history'; |
11 | - import { columns, searchFormSchema } from './index'; | 22 | + import { columns, searchFormSchema } from "./index" |
12 | import { useI18n } from '/@/hooks/web/useI18n'; | 23 | import { useI18n } from '/@/hooks/web/useI18n'; |
13 | const { t } = useI18n(); | 24 | const { t } = useI18n(); |
14 | const [ | 25 | const [ |
@@ -11,28 +11,81 @@ | @@ -11,28 +11,81 @@ | ||
11 | > | 11 | > |
12 | <div> | 12 | <div> |
13 | <BasicForm @register="registerForm" /> | 13 | <BasicForm @register="registerForm" /> |
14 | + <div style="display: flex;width: 70%;margin-left: 70px"> | ||
15 | + <div style="width: 122px;text-align: center"> | ||
16 | + 报修人 | ||
17 | + </div> | ||
18 | + <a-input | ||
19 | + placeholder="请选择" | ||
20 | + :disabled="true" | ||
21 | + v-model:value="selectedUsername" | ||
22 | + > | ||
23 | + </a-input> | ||
24 | + <a-button type="primary" @click="goChoose">选人</a-button> | ||
25 | + </div> | ||
14 | </div> | 26 | </div> |
27 | + <a-modal | ||
28 | + v-model:visible="userVisible" | ||
29 | + :title="userModalTitle" | ||
30 | + width="60vw" | ||
31 | + height="50vh" | ||
32 | + @ok="handleUserOk" | ||
33 | + @cancel="handleUserCancel" | ||
34 | + > | ||
35 | + <div style="padding: 20px;display: flex"> | ||
36 | + <OrganizationIdTree @select="handleSelect" ref="organizationIdTreeRef" isOpen="true"/> | ||
37 | + <div style="margin-top: 20px;margin-left: 30px"> | ||
38 | + <a-radio-group v-model:value="selectedItem"> | ||
39 | + <template v-for="item in Options" :key="`${item.id}`"> | ||
40 | + <a-radio :style="radioStyle" :value="item">{{ item.username }}</a-radio> | ||
41 | + </template> | ||
42 | + </a-radio-group> | ||
43 | + </div> | ||
44 | + </div> | ||
45 | + </a-modal> | ||
15 | </BasicModal> | 46 | </BasicModal> |
16 | </div> | 47 | </div> |
17 | </template> | 48 | </template> |
18 | <script setup lang="ts"> | 49 | <script setup lang="ts"> |
19 | import {BasicModal, useModalInner} from "/@/components/Modal"; | 50 | import {BasicModal, useModalInner} from "/@/components/Modal"; |
20 | import {BasicForm, useForm} from "/@/components/Form"; | 51 | import {BasicForm, useForm} from "/@/components/Form"; |
21 | -import {computed, ref, unref} from "vue"; | 52 | +import {computed, reactive, ref, unref} from "vue"; |
22 | import {useI18n} from "/@/hooks/web/useI18n"; | 53 | import {useI18n} from "/@/hooks/web/useI18n"; |
23 | import {schemas} from "../index"; | 54 | import {schemas} from "../index"; |
24 | import {getUserListByOrg} from "/@/api/equipment/ledger"; | 55 | import {getUserListByOrg} from "/@/api/equipment/ledger"; |
25 | import {useUserStore} from "/@/store/modules/user"; | 56 | import {useUserStore} from "/@/store/modules/user"; |
26 | import {saveOrder} from "/@/api/repair/order"; | 57 | import {saveOrder} from "/@/api/repair/order"; |
27 | import {useMessage} from "/@/hooks/web/useMessage"; | 58 | import {useMessage} from "/@/hooks/web/useMessage"; |
59 | +import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; | ||
28 | const { t } = useI18n(); | 60 | const { t } = useI18n(); |
29 | const isUpdate = ref<Boolean>(false); | 61 | const isUpdate = ref<Boolean>(false); |
30 | const recordInfo = ref<any>({}); | 62 | const recordInfo = ref<any>({}); |
31 | // 定义人员选项 | 63 | // 定义人员选项 |
32 | -const userOptions = ref<any[]>([]); | ||
33 | const userInfo = useUserStore(); | 64 | const userInfo = useUserStore(); |
34 | const { createMessage } = useMessage(); | 65 | const { createMessage } = useMessage(); |
35 | 66 | ||
67 | +const userOptions = ref([]); | ||
68 | +const Options = ref([]); | ||
69 | +const searchInfo = reactive<Recordable>({}); | ||
70 | +const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo); | ||
71 | +const userVisible = ref(false); | ||
72 | +const userModalTitle = ref('选人'); | ||
73 | +const selectedItem = ref<{ id: string; username: string } | null>(null); | ||
74 | +const radioStyle = reactive({ | ||
75 | + display: 'block', | ||
76 | + height: '30px', | ||
77 | + lineHeight: '30px', | ||
78 | +}); | ||
79 | +// 计算属性实现双向绑定 | ||
80 | +const selectedUsername = computed({ | ||
81 | + get: () => selectedItem.value?.username || '', | ||
82 | + set: (value) => { | ||
83 | + if (selectedItem.value) { | ||
84 | + selectedItem.value.username = value; | ||
85 | + } | ||
86 | + }, | ||
87 | +}); | ||
88 | + | ||
36 | const emit = defineEmits(['handleReload', 'register']); | 89 | const emit = defineEmits(['handleReload', 'register']); |
37 | 90 | ||
38 | const getTitle = computed(() => | 91 | const getTitle = computed(() => |
@@ -54,9 +107,13 @@ const [register, { closeModal, setModalProps }] = useModalInner(async (data) => | @@ -54,9 +107,13 @@ const [register, { closeModal, setModalProps }] = useModalInner(async (data) => | ||
54 | setModalProps({ confirmLoading: false, loading: true }); | 107 | setModalProps({ confirmLoading: false, loading: true }); |
55 | isUpdate.value = data?.isUpdate; | 108 | isUpdate.value = data?.isUpdate; |
56 | recordInfo.value = data?.record; | 109 | recordInfo.value = data?.record; |
57 | - // 更新 formSchema 中的 org 字段,绑定 change 事件 | 110 | + if (!selectedItem.value) { |
111 | + selectedItem.value = { id: '', username: '' }; | ||
112 | + } | ||
113 | + selectedItem.value.username = data?.record?.reportByName || ''; | ||
114 | + selectedItem.value.id = data?.record?.reportBy || ''; | ||
58 | updateSchema({ | 115 | updateSchema({ |
59 | - field: 'org', | 116 | + field: 'situationImg', |
60 | componentProps: { | 117 | componentProps: { |
61 | onChange: handleOrgChange, | 118 | onChange: handleOrgChange, |
62 | }, | 119 | }, |
@@ -67,12 +124,13 @@ const [register, { closeModal, setModalProps }] = useModalInner(async (data) => | @@ -67,12 +124,13 @@ const [register, { closeModal, setModalProps }] = useModalInner(async (data) => | ||
67 | setModalProps({ loading: false }); | 124 | setModalProps({ loading: false }); |
68 | }); | 125 | }); |
69 | 126 | ||
127 | + | ||
70 | // 监听 org 字段的变化 | 128 | // 监听 org 字段的变化 |
71 | const handleOrgChange = async (orgId: string) => { | 129 | const handleOrgChange = async (orgId: string) => { |
72 | if (!orgId) { | 130 | if (!orgId) { |
73 | userOptions.value = []; // 清空人员选项 | 131 | userOptions.value = []; // 清空人员选项 |
74 | updateSchema({ | 132 | updateSchema({ |
75 | - field: 'reportBy', | 133 | + field: 'report', |
76 | componentProps: { options: [] }, | 134 | componentProps: { options: [] }, |
77 | }); | 135 | }); |
78 | return; | 136 | return; |
@@ -92,12 +150,11 @@ const handleOrgChange = async (orgId: string) => { | @@ -92,12 +150,11 @@ const handleOrgChange = async (orgId: string) => { | ||
92 | 150 | ||
93 | // 更新 user 字段的选项 | 151 | // 更新 user 字段的选项 |
94 | updateSchema({ | 152 | updateSchema({ |
95 | - field: 'reportBy', | 153 | + field: 'report', |
96 | componentProps: { options: userOptions.value }, | 154 | componentProps: { options: userOptions.value }, |
97 | }); | 155 | }); |
98 | }; | 156 | }; |
99 | 157 | ||
100 | - | ||
101 | const handleCancel = () => { | 158 | const handleCancel = () => { |
102 | closeModal(); | 159 | closeModal(); |
103 | }; | 160 | }; |
@@ -106,9 +163,9 @@ const handleOk = async () => { | @@ -106,9 +163,9 @@ const handleOk = async () => { | ||
106 | await validate(); | 163 | await validate(); |
107 | let values = getFieldsValue(); | 164 | let values = getFieldsValue(); |
108 | if (unref(isUpdate)) { | 165 | if (unref(isUpdate)) { |
109 | - values = { ...values, id: unref(recordInfo).id, situationImg: values.situationImg?.[0]?.url}; | 166 | + values = { ...values, id: unref(recordInfo).id, situationImg: values.situationImg?.[0]?.url, reportBy: selectedItem.value?.id || ''}; |
110 | }else { | 167 | }else { |
111 | - values = { ...values, situationImg: values.situationImg?.[0]?.url}; | 168 | + values = { ...values, situationImg: values.situationImg?.[0]?.url, reportBy: selectedItem.value?.id || ''}; |
112 | } | 169 | } |
113 | await saveOrder(values); | 170 | await saveOrder(values); |
114 | createMessage.success(t('common.operationSuccessText')); | 171 | createMessage.success(t('common.operationSuccessText')); |
@@ -116,4 +173,37 @@ const handleOk = async () => { | @@ -116,4 +173,37 @@ const handleOk = async () => { | ||
116 | handleCancel(); | 173 | handleCancel(); |
117 | }; | 174 | }; |
118 | 175 | ||
176 | +const goChoose = () => { | ||
177 | + userVisible.value = true; | ||
178 | + selectedItem.value = null; | ||
179 | +} | ||
180 | + | ||
181 | +// 确认按钮的回调 | ||
182 | +const handleUserOk = () => { | ||
183 | + if (!selectedItem.value) { | ||
184 | + createMessage.warning('请选择一个用户'); | ||
185 | + return; | ||
186 | + } | ||
187 | + | ||
188 | + userVisible.value = false; // 关闭弹框 | ||
189 | +}; | ||
190 | + | ||
191 | +const handleUserCancel = () => { | ||
192 | + selectedItem.value = null; | ||
193 | + userVisible.value = false; | ||
194 | +}; | ||
195 | + | ||
196 | +const handleSelect = async (organizationId: string) => { | ||
197 | + searchInfo.organizationId = organizationId; | ||
198 | + const _data = { | ||
199 | + page: '1', | ||
200 | + pageSize: '999', | ||
201 | + tenantId: userInfo.getUserInfo.tenantId!, | ||
202 | + organizationId: organizationId | ||
203 | + } | ||
204 | + const response = await getUserListByOrg(_data); // 调用接口 | ||
205 | + Options.value = response.items; | ||
206 | + | ||
207 | +}; | ||
208 | + | ||
119 | </script> | 209 | </script> |
@@ -20,6 +20,11 @@ const emergencyOptions = [ | @@ -20,6 +20,11 @@ const emergencyOptions = [ | ||
20 | 20 | ||
21 | export const columns: BasicColumn[] = [ | 21 | export const columns: BasicColumn[] = [ |
22 | { | 22 | { |
23 | + title: t('repair.order.situationImg'), | ||
24 | + dataIndex: 'situationImg', | ||
25 | + slots: { customRender: 'situationImg' }, | ||
26 | + }, | ||
27 | + { | ||
23 | title: t('repair.order.nameCode'), | 28 | title: t('repair.order.nameCode'), |
24 | dataIndex: 'orderCode', | 29 | dataIndex: 'orderCode', |
25 | }, | 30 | }, |
@@ -143,31 +148,6 @@ export const schemas: FormSchema[] = [ | @@ -143,31 +148,6 @@ export const schemas: FormSchema[] = [ | ||
143 | }, | 148 | }, |
144 | }, | 149 | }, |
145 | { | 150 | { |
146 | - field: 'org', | ||
147 | - component: 'OrgTreeSelect', | ||
148 | - label: '报修人组织', | ||
149 | - required: true, | ||
150 | - colProps: { span: 24 }, | ||
151 | - componentProps: { | ||
152 | - // 添加 change 事件 | ||
153 | - onChange: (value: string) => { | ||
154 | - // 这里需要触发加载人员数据的逻辑 | ||
155 | - console.log(value,'value') | ||
156 | - }, | ||
157 | - }, | ||
158 | - }, | ||
159 | - { | ||
160 | - field: 'reportBy', | ||
161 | - component: 'Select', | ||
162 | - label: '报修人', | ||
163 | - required: true, | ||
164 | - colProps: { span: 21 }, | ||
165 | - componentProps: { | ||
166 | - // 动态加载的选项 | ||
167 | - options: [], // 初始为空,后续动态加载 | ||
168 | - }, | ||
169 | - }, | ||
170 | - { | ||
171 | field: 'reportDate', | 151 | field: 'reportDate', |
172 | label: t('repair.order.time'), | 152 | label: t('repair.order.time'), |
173 | component: 'DatePicker', | 153 | component: 'DatePicker', |
@@ -8,6 +8,18 @@ | @@ -8,6 +8,18 @@ | ||
8 | </Button> | 8 | </Button> |
9 | </Authority> | 9 | </Authority> |
10 | </template> | 10 | </template> |
11 | + <template #situationImg="{ record }"> | ||
12 | + <TableImg | ||
13 | + :size="30" | ||
14 | + :showBadge="false" | ||
15 | + :simpleShow="true" | ||
16 | + :imgList=" | ||
17 | + typeof record.situationImg !== 'undefined' && record.situationImg !== '' && record.situationImg != null | ||
18 | + ? [record.situationImg] | ||
19 | + : null | ||
20 | + " | ||
21 | + /> | ||
22 | + </template> | ||
11 | <template #deviceId="{ record }"> | 23 | <template #deviceId="{ record }"> |
12 | <span>{{ record?.deviceInfo?.name }}</span> | 24 | <span>{{ record?.deviceInfo?.name }}</span> |
13 | </template> | 25 | </template> |
@@ -33,12 +45,6 @@ | @@ -33,12 +45,6 @@ | ||
33 | <template #action="{ record }"> | 45 | <template #action="{ record }"> |
34 | <TableAction | 46 | <TableAction |
35 | :actions="[ | 47 | :actions="[ |
36 | - // { | ||
37 | - // label: t('common.detailText'), | ||
38 | - // icon: 'ant-design:eye-outlined', | ||
39 | - // auth: 'api:yt:product:category:get', | ||
40 | - // onClick: handleDetail.bind(null, record), | ||
41 | - // }, | ||
42 | { | 48 | { |
43 | label: t('common.editText'), | 49 | label: t('common.editText'), |
44 | auth: 'api:yt:product:category:update', | 50 | auth: 'api:yt:product:category:update', |
@@ -67,7 +73,7 @@ | @@ -67,7 +73,7 @@ | ||
67 | </template> | 73 | </template> |
68 | <script setup lang="ts"> | 74 | <script setup lang="ts"> |
69 | import { orderModal } from "./components/index" | 75 | import { orderModal } from "./components/index" |
70 | - import { BasicTable, TableAction } from '/@/components/Table'; | 76 | + import { BasicTable, TableAction, TableImg } from '/@/components/Table'; |
71 | import { useTable } from '/@/components/Table'; | 77 | import { useTable } from '/@/components/Table'; |
72 | import { getRepairOrderList } from '/@/api/repair/order'; | 78 | import { getRepairOrderList } from '/@/api/repair/order'; |
73 | import { columns, searchFormSchema } from './index'; | 79 | import { columns, searchFormSchema } from './index'; |