Commit bb8bc03793ba528257ac91e9633d19ee0c401f50

Authored by gesilong
1 parent 57bf5a64

commit: bug修复1

... ... @@ -177,7 +177,7 @@ const handleSwitch = async (e: any, record: any) => {
177 177 switchLoading.value = false;
178 178 }, 1500);
179 179 createMessage.success(
180   - `${!e ? t('common.disableText') : t('common.enableText')}${t('common.successText')}`
  180 + `${e !== 'ENABLE' ? t('common.disableText') : t('common.enableText')}${t('common.successText')}`
181 181 );
182 182 handleReload();
183 183 };
... ...
... ... @@ -5,7 +5,7 @@
5 5 showFooter
6 6 width="35%"
7 7 :maskClosable="true"
8   - :title="businessText"
  8 + :title="titleText"
9 9 @register="registerDrawer"
10 10 wrapClassName="report-drawer"
11 11 @ok="handleSubmit"
... ... @@ -14,8 +14,8 @@
14 14 <BasicForm @register="registerForm">
15 15 </BasicForm>
16 16 <div style="display: flex;width: 70%;margin-left: 70px">
17   - <div style="width: 122px;text-align: center">
18   - 报修人
  17 + <div style="width: 115px;align-content: center;display: flex;justify-content: center;" class="inputTitle">
  18 + 负责人
19 19 </div>
20 20 <a-input
21 21 placeholder="请选择"
... ... @@ -62,7 +62,6 @@ import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/or
62 62 const {
63 63 setDefaultTime,
64 64 disableCustomWeekly,
65   - setPropsForModal,
66 65 removeFields,
67 66 } = useHooks();
68 67 const userInfo = useUserStore();
... ... @@ -104,12 +103,14 @@ const [registerForm, { validate, resetFields, setFieldsValue, updateSchema }] =
104 103 }
105 104 );
106 105
  106 +const titleText = ref('');
107 107 const businessText = ref('');
108 108 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
109 109 try {
110 110 await nextTick();
111 111 handleClose();
112 112 businessText.value = data.text;
  113 + titleText.value = data.text === 'add' ? '创建台账' : data.text === 'edit' ? '编辑台账' : '查看台账';
113 114 if (!selectedItem.value) {
114 115 selectedItem.value = { id: '', username: '' };
115 116 }
... ... @@ -117,7 +118,6 @@ const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (
117 118 selectedItem.value.id = data?.record?.directorId || '';
118 119 setFieldsValue(setDefaultTime());
119 120 updateSchema(disableCustomWeekly(0));
120   - setDrawerProps(setPropsForModal(businessText.value));
121 121 if (businessText.value === 'add') return;
122 122 const rest = await ledgerEditDetailPage({id: data.record?.id});
123 123 restData.data = rest ?? {};
... ... @@ -139,6 +139,11 @@ const resetValue = () => {
139 139 };
140 140
141 141 const handleSubmit = () => {
  142 + if (businessText.value === 'view') {
  143 + closeDrawer();
  144 + handleClose();
  145 + return;
  146 + }
142 147 useThrottle();
143 148 };
144 149
... ... @@ -151,6 +156,10 @@ const getValue = async () => {
151 156 setDrawerProps({ confirmLoading: true });
152 157 const values = await validate();
153 158 if (!values) return;
  159 + if (!selectedItem?.value?.id) {
  160 + createMessage.warning('请选择负责人');
  161 + return;
  162 + }
154 163 const data = {
155 164 ...values,
156 165 buyDate: values.buyDate?.format('YYYY-MM-DD hh:mm:ss'),
... ... @@ -211,3 +220,14 @@ const handleSelect = async (organizationId: string) => {
211 220 };
212 221
213 222 </script>
  223 +<style scoped>
  224 +.inputTitle::before {
  225 + display: inline-block;
  226 + margin-right: 4px;
  227 + color: #ff4d4f;
  228 + font-size: 14px;
  229 + font-family: SimSun, sans-serif;
  230 + line-height: 1;
  231 + content: '*';
  232 +}
  233 +</style>
... ...
... ... @@ -27,13 +27,13 @@ export const searchFormSchema: FormSchema[] = [
27 27 },
28 28 },
29 29 {
30   - field: 'startTime',
  30 + field: 'startTimeStart',
31 31 label: t('inspection.inspectionPlan.startTimeText'),
32 32 component: 'DatePicker',
33 33 colProps: { span: 6 },
34 34 },
35 35 {
36   - field: 'endTime',
  36 + field: 'endTimeEnd',
37 37 label: t('inspection.inspectionPlan.endTimeText'),
38 38 component: 'DatePicker',
39 39 colProps: { span: 6 },
... ...
... ... @@ -72,12 +72,12 @@
72 72 </a-row>
73 73 <a-form-item label="巡检明细" name="tkInspectionDetailsDTOList">
74 74 <a-table bordered :data-source="tableData" :columns="columns">
75   - <template #tkDeviceAccountDTO="{ text, record, index }">
  75 + <template #tkDeviceAccountDTO="{record}">
76 76 <div>
77 77 {{record?.tkDeviceAccountDTO?.name}}
78 78 </div>
79 79 </template>
80   - <template #recordResult="{ text, record, index }">
  80 + <template #recordResult="{ record }">
81 81 <div>
82 82 <a-select
83 83 v-model:value="record.recordResult"
... ... @@ -87,7 +87,7 @@
87 87 />
88 88 </div>
89 89 </template>
90   - <template #operation="{ text, record, index }">
  90 + <template #operation="{ index }">
91 91 <div>
92 92 <a-button type="link" @click="handleDelete(index)" :disabled="isViewMode">删除</a-button>
93 93 </div>
... ... @@ -119,7 +119,6 @@
119 119 <script setup lang="ts">
120 120 import {computed, onMounted, reactive, ref, unref, watch} from "vue";
121 121 import {getInspectionPlanList, getInsPlanDetail} from "/@/api/inspection/inspectionPlan";
122   -import { ApiTreeSelect } from '/@/components/Form';
123 122 import {OrganizationListItem} from "/@/api/system/model/systemModel";
124 123 import {getOrganizationList} from "/@/api/system/system";
125 124 import {getUserListByOrg} from "/@/api/equipment/ledger";
... ... @@ -211,7 +210,7 @@ const needReload = ref(true);
211 210 const { createMessage } = useMessage();
212 211
213 212 const searchInfo = reactive<Recordable>({});
214   -const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo);
  213 +const { organizationIdTreeRef } = useResetOrganizationTree(searchInfo);
215 214 const userVisible = ref(false);
216 215 const userModalTitle = ref('选人');
217 216 const selectedItem = ref<{ id: number; username: string } | null>(null);
... ... @@ -300,8 +299,9 @@ onMounted(() => {
300 299
301 300 const fetchAgeOptions = async () => {
302 301 try {
303   - const response = await getInspectionPlanList({ page: 1, pageSize: 999 }); // 调用接口
304   - planOptions.value = response.items?.map((item: any) => {
  302 + const _response = await getInspectionPlanList({ page: 1, pageSize: 999}); // 调用接口
  303 + const response = _response.items?.filter(item => item.status !== 'STOP');
  304 + planOptions.value = response?.map((item: any) => {
305 305 return {
306 306 value: item?.id,
307 307 label: item?.name
... ... @@ -312,49 +312,6 @@ const fetchAgeOptions = async () => {
312 312 }
313 313 };
314 314
315   -const getBindProps = computed<Recordable>(() => {
316   - const params = {}
317   - return {
318   - replaceFields: { children: 'children', key: 'id', title: 'name', value: 'id' },
319   - getPopupContainer: () => document.body,
320   - placeholder: t('deviceManagement.device.organizationPlaceholderText'),
321   - maxLength: 250,
322   - value: form.orgId,
323   - dropdownStyle: { maxHeight: '300px' },
324   - api: async (params: OrganizationListItem) => {
325   - try {
326   - const result = ((await getOrganizationList(params)) as unknown as Recordable[]) || [];
327   - orgList.value = result;
328   - needReload.value = false;
329   - return result;
330   - } catch (error) {
331   - return unref(orgList);
332   - }
333   - },
334   - params: {
335   - ...params,
336   - _t: unref(timespan),
337   - },
338   - onChange: async (...args: any[]) => {
339   - const _data = {
340   - page: '1',
341   - pageSize: '999',
342   - tenantId: userInfo.getUserInfo.tenantId!,
343   - organizationId: args?.[0]
344   - }
345   - const response = await getUserListByOrg(_data); // 调用接口
346   - Options.value = response.items?.map((item: any) => {
347   - return {
348   - label: item.username,
349   - value: item.id,
350   - }
351   - });
352   - form.orgId.value = args?.[0]
353   -
354   - },
355   - };
356   -});
357   -
358 315 const handleChange = async (value: Value) => {
359 316 const res = await getInsPlanDetail({id:value})
360 317 form.value.code = res.code
... ... @@ -362,7 +319,7 @@ const handleChange = async (value: Value) => {
362 319 return {
363 320 checkDeviceId: item?.checkDeviceId || '',
364 321 recordResult: true,
365   - planDetails: item?.checkDeviceId || '',
  322 + planDetails: item?.planDetails || '',
366 323 tkDeviceAccountDTO: item?.tkDeviceAccountDTO
367 324 }
368 325 }) || []
... ...
... ... @@ -164,14 +164,14 @@
164 164 const handleViewDetail = async (record?: any) => {
165 165 let id = record.id;
166 166 modalTitle.value = '查看';
  167 + modalVisible.value = true; // 打开弹框
  168 + isViewMode.value = true;
167 169 try {
168 170 const response = await getInsRecordDetail({id})
169 171 initialData.value = {
170 172 form: response, // 表单数据
171 173 tableData: response.tkInspectionDetailsDTOList, // 表格数据
172 174 };
173   - modalVisible.value = true; // 打开弹框
174   - isViewMode.value = true;
175 175 }catch (error) {
176 176 throw error;
177 177 }finally {
... ...
... ... @@ -57,7 +57,7 @@ export const columns: BasicColumn[] = [
57 57 },
58 58 {
59 59 title: t('inspection.serviceRecord.createTimeText'),
60   - dataIndex: 'createTime',
  60 + dataIndex: 'preserveDate',
61 61 },
62 62 {
63 63 title: t('inspection.serviceRecord.preserveByName'),
... ...
... ... @@ -16,7 +16,7 @@ export const columns: BasicColumn[] = [
16 16 },
17 17 {
18 18 title: t('repair.history.orderText'),
19   - dataIndex: 'tkRepairOrderDTO',
  19 + dataIndex: 'orderCode',
20 20 format: (text, record) => {
21 21 return record.tkRepairOrderDTO?.orderCode || '-' || text;
22 22 },
... ... @@ -27,7 +27,7 @@ export const columns: BasicColumn[] = [
27 27 },
28 28 {
29 29 title: t('repair.history.time'),
30   - dataIndex: 'tkRepairOrderDTO',
  30 + dataIndex: 'reportDate',
31 31 format: (text, record) => {
32 32 return record.tkRepairOrderDTO?.reportDate || '-' || text;
33 33 },
... ...
... ... @@ -12,7 +12,9 @@
12 12 <div>
13 13 <BasicForm @register="registerForm" />
14 14 <div style="display: flex; width: 70%; margin-left: 70px">
15   - <div style="width: 122px; text-align: center"> 报修人 </div>
  15 + <div style="display: flex;width: 115px;align-content: center;justify-content: center;" class="inputTitle">
  16 + 报修人
  17 + </div>
16 18 <a-input placeholder="请选择" :disabled="true" v-model:value="selectedUsername" />
17 19 <a-button type="primary" @click="goChoose">选人</a-button>
18 20 </div>
... ... @@ -152,6 +154,10 @@
152 154 const handleOk = async () => {
153 155 await validate();
154 156 let values = getFieldsValue();
  157 + if (!selectedItem?.value?.id) {
  158 + createMessage.warning('请选择报修人');
  159 + return;
  160 + }
155 161 if (unref(isUpdate)) {
156 162 values = {
157 163 ...values,
... ... @@ -204,3 +210,14 @@
204 210 Options.value = response.items;
205 211 };
206 212 </script>
  213 +<style scoped>
  214 +.inputTitle::before {
  215 + display: inline-block;
  216 + margin-right: 4px;
  217 + color: #ff4d4f;
  218 + font-size: 14px;
  219 + font-family: SimSun, sans-serif;
  220 + line-height: 1;
  221 + content: '*';
  222 +}
  223 +</style>
... ...