Showing
7 changed files
with
344 additions
and
354 deletions
... | ... | @@ -14,8 +14,10 @@ |
14 | 14 | record.status == 'NOT_START' |
15 | 15 | ? 'yellow' |
16 | 16 | : record.status == 'UNDERWAY' |
17 | - ? 'blue': record.status == 'FINISH' | |
18 | - ? 'green': 'red' | |
17 | + ? 'blue' | |
18 | + : record.status == 'FINISH' | |
19 | + ? 'green' | |
20 | + : 'red' | |
19 | 21 | " |
20 | 22 | class="ml-2" |
21 | 23 | > |
... | ... | @@ -66,7 +68,7 @@ |
66 | 68 | ifShow: () => record.status === 'NOT_START' || record.status === 'UNDERWAY', |
67 | 69 | popConfirm: { |
68 | 70 | title: t('common.stopConfirmText'), |
69 | - confirm: handleUpdateStatus.bind(null, record,'STOP'), | |
71 | + confirm: handleUpdateStatus.bind(null, record, 'STOP'), | |
70 | 72 | }, |
71 | 73 | }, |
72 | 74 | { |
... | ... | @@ -93,147 +95,27 @@ |
93 | 95 | </div> |
94 | 96 | </template> |
95 | 97 | <script setup lang="ts"> |
96 | -import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
97 | -import { | |
98 | - deleteInspectionPlan, | |
99 | - getInspectionPlanList, | |
100 | - getInsPlanDetail, | |
101 | - updateInspectionStatus, updateInsStatus | |
102 | -} from '/@/api/inspection/inspectionPlan'; | |
103 | -import { columns, searchFormSchema } from './index'; | |
104 | -import { useI18n } from '/@/hooks/web/useI18n'; | |
105 | -import {Button, message, Tag} from 'ant-design-vue'; | |
106 | -import {useMessage} from "/@/hooks/web/useMessage"; | |
107 | -import { insPlanModal } from "./components/index" | |
108 | -import {ref} from "vue"; | |
109 | -import {dateFormat} from "/@/utils/common/compUtils"; | |
110 | -const { t } = useI18n(); | |
111 | -const { createMessage } = useMessage(); | |
112 | -const modalVisible = ref(false); | |
113 | -const isViewMode = ref(false); | |
114 | -const modalTitle = ref(''); | |
115 | -const initialData = ref({ | |
116 | - form: { | |
117 | - code: '', | |
118 | - name: '', | |
119 | - status: '', | |
120 | - enabled: '', | |
121 | - startTime: '', | |
122 | - endTime: '', | |
123 | - remark: '', | |
124 | - }, | |
125 | - tableData: [], | |
126 | -}); | |
127 | - | |
128 | -const [ | |
129 | - registerTable, | |
130 | - { reload, setLoading, setSelectedRowKeys }, | |
131 | -] = useTable({ | |
132 | - title: t('inspection.inspectionPlan.listText'), | |
133 | - api: getInspectionPlanList, | |
134 | - columns, | |
135 | - formConfig: { | |
136 | - labelWidth: 100, | |
137 | - schemas: searchFormSchema, | |
138 | - }, | |
139 | - immediate: true, | |
140 | - useSearchForm: true, | |
141 | - showTableSetting: true, | |
142 | - bordered: true, | |
143 | - showIndexColumn: false, | |
144 | - clickToRowSelect: false, | |
145 | - rowKey: 'id', | |
146 | - actionColumn: { | |
147 | - width: 360, | |
148 | - title: t('common.actionText'), | |
149 | - slots: { customRender: 'action' }, | |
150 | - fixed: 'right', | |
151 | - }, | |
152 | -}); | |
153 | - | |
154 | -const handleDelete = async (record?: any) => { | |
155 | - let id = record.id; | |
156 | - try { | |
157 | - setLoading(true); | |
158 | - await deleteInspectionPlan({ id }); | |
159 | - createMessage.success(t('common.deleteSuccessText')); | |
160 | - handleReload(); | |
161 | - } catch (error) { | |
162 | - throw error; | |
163 | - } finally { | |
164 | - setLoading(false); | |
165 | - } | |
166 | -}; | |
167 | - | |
168 | -const handleReload = () => { | |
169 | - setSelectedRowKeys([]); | |
170 | - reload(); | |
171 | -}; | |
172 | - | |
173 | -const handleUpdateStatus = async (record?: any,value?: string) => { | |
174 | - let id = record.id; | |
175 | - let status = ''; | |
176 | - if (record.status === 'NOT_START') { | |
177 | - status = 'UNDERWAY' | |
178 | - }else if(record.status === 'UNDERWAY'){ | |
179 | - status = 'FINISH' | |
180 | - }else if(record.status === 'FINISH'){ | |
181 | - status = 'STOP' | |
182 | - } | |
183 | - if (value === 'STOP') { | |
184 | - status = 'STOP' | |
185 | - } | |
186 | - try { | |
187 | - setLoading(true); | |
188 | - await updateInsStatus({ id,status }); | |
189 | - createMessage.success(t('common.editSuccessText')); | |
190 | - handleReload(); | |
191 | - } catch (error) { | |
192 | - throw error; | |
193 | - } finally { | |
194 | - setLoading(false); | |
195 | - } | |
196 | -} | |
197 | - | |
198 | -const handleViewDetail = async (record?: any) => { | |
199 | - let id = record.id; | |
200 | - modalTitle.value = '查看'; | |
201 | - try { | |
202 | - const response = await getInsPlanDetail({id}) | |
203 | - initialData.value = { | |
204 | - form: response, // 表单数据 | |
205 | - tableData: response.tkCheckDetailsDTOList, // 表格数据 | |
206 | - }; | |
207 | - modalVisible.value = true; // 打开弹框 | |
208 | - isViewMode.value = true; | |
209 | - }catch (error) { | |
210 | - throw error; | |
211 | - }finally { | |
212 | - | |
213 | - } | |
214 | -} | |
215 | - | |
216 | -const handleEdit = async (record?: any) => { | |
217 | - let id = record.id; | |
218 | - modalTitle.value = '修改'; | |
219 | - try { | |
220 | - const response = await getInsPlanDetail({id}) | |
221 | - initialData.value = { | |
222 | - form: response, // 表单数据 | |
223 | - tableData: response.tkCheckDetailsDTOList, // 表格数据 | |
224 | - }; | |
225 | - modalVisible.value = true; // 打开弹框 | |
226 | - }catch (error) { | |
227 | - throw error; | |
228 | - }finally { | |
229 | - | |
230 | - } | |
231 | -} | |
232 | - | |
233 | -// 新增 | |
234 | -const handleCreate = () => { | |
235 | - modalTitle.value = '新增'; | |
236 | - initialData.value = { | |
98 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
99 | + import { | |
100 | + deleteInspectionPlan, | |
101 | + getInspectionPlanList, | |
102 | + getInsPlanDetail, | |
103 | + updateInspectionStatus, | |
104 | + updateInsStatus, | |
105 | + } from '/@/api/inspection/inspectionPlan'; | |
106 | + import { columns, searchFormSchema } from './index'; | |
107 | + import { useI18n } from '/@/hooks/web/useI18n'; | |
108 | + import { Button, message, Tag } from 'ant-design-vue'; | |
109 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
110 | + import { insPlanModal } from './components/index'; | |
111 | + import { ref } from 'vue'; | |
112 | + import { dateFormat } from '/@/utils/common/compUtils'; | |
113 | + const { t } = useI18n(); | |
114 | + const { createMessage } = useMessage(); | |
115 | + const modalVisible = ref(false); | |
116 | + const isViewMode = ref(false); | |
117 | + const modalTitle = ref(''); | |
118 | + const initialData = ref({ | |
237 | 119 | form: { |
238 | 120 | code: '', |
239 | 121 | name: '', |
... | ... | @@ -244,22 +126,137 @@ const handleCreate = () => { |
244 | 126 | remark: '', |
245 | 127 | }, |
246 | 128 | tableData: [], |
247 | - } | |
248 | - modalVisible.value = true; | |
249 | -}; | |
129 | + }); | |
130 | + | |
131 | + const [registerTable, { reload, setLoading, setSelectedRowKeys }] = useTable({ | |
132 | + title: t('inspection.inspectionPlan.listText'), | |
133 | + api: getInspectionPlanList, | |
134 | + columns, | |
135 | + formConfig: { | |
136 | + labelWidth: 100, | |
137 | + schemas: searchFormSchema, | |
138 | + }, | |
139 | + immediate: true, | |
140 | + useSearchForm: true, | |
141 | + showTableSetting: true, | |
142 | + bordered: true, | |
143 | + showIndexColumn: false, | |
144 | + clickToRowSelect: false, | |
145 | + rowKey: 'id', | |
146 | + actionColumn: { | |
147 | + width: 360, | |
148 | + title: t('common.actionText'), | |
149 | + slots: { customRender: 'action' }, | |
150 | + fixed: 'right', | |
151 | + }, | |
152 | + }); | |
153 | + | |
154 | + const handleDelete = async (record?: any) => { | |
155 | + let id = record.id; | |
156 | + try { | |
157 | + setLoading(true); | |
158 | + await deleteInspectionPlan({ id }); | |
159 | + createMessage.success(t('common.deleteSuccessText')); | |
160 | + handleReload(); | |
161 | + } catch (error) { | |
162 | + throw error; | |
163 | + } finally { | |
164 | + setLoading(false); | |
165 | + } | |
166 | + }; | |
167 | + | |
168 | + const handleReload = () => { | |
169 | + setSelectedRowKeys([]); | |
170 | + reload(); | |
171 | + }; | |
250 | 172 | |
251 | -const handleSubmit = async (data) => { | |
252 | - const format = 'yyyy-MM-dd hh:mm:ss'; | |
253 | - const _data = { | |
254 | - ...data, | |
255 | - startTime: dateFormat(data?.startTime, format), | |
256 | - endTime: dateFormat(data?.endTime, format), | |
257 | - } | |
258 | - modalVisible.value = false; | |
259 | - await updateInspectionStatus(_data) | |
260 | - message.success('提交成功'); | |
261 | - handleReload() | |
262 | -}; | |
173 | + const handleUpdateStatus = async (record?: any, value?: string) => { | |
174 | + let id = record.id; | |
175 | + let status = ''; | |
176 | + if (record.status === 'NOT_START') { | |
177 | + status = 'UNDERWAY'; | |
178 | + } else if (record.status === 'UNDERWAY') { | |
179 | + status = 'FINISH'; | |
180 | + } else if (record.status === 'FINISH') { | |
181 | + status = 'STOP'; | |
182 | + } | |
183 | + if (value === 'STOP') { | |
184 | + status = 'STOP'; | |
185 | + } | |
186 | + try { | |
187 | + setLoading(true); | |
188 | + await updateInsStatus({ id, status }); | |
189 | + createMessage.success(t('common.editSuccessText')); | |
190 | + handleReload(); | |
191 | + } catch (error) { | |
192 | + throw error; | |
193 | + } finally { | |
194 | + setLoading(false); | |
195 | + } | |
196 | + }; | |
263 | 197 | |
198 | + const handleViewDetail = async (record?: any) => { | |
199 | + let id = record.id; | |
200 | + modalTitle.value = '查看'; | |
201 | + try { | |
202 | + const response = await getInsPlanDetail({ id }); | |
203 | + initialData.value = { | |
204 | + form: response, // 表单数据 | |
205 | + tableData: response.tkCheckDetailsDTOList, // 表格数据 | |
206 | + }; | |
207 | + modalVisible.value = true; // 打开弹框 | |
208 | + isViewMode.value = true; | |
209 | + } catch (error) { | |
210 | + throw error; | |
211 | + } finally { | |
212 | + } | |
213 | + }; | |
264 | 214 | |
215 | + const handleEdit = async (record?: any) => { | |
216 | + let id = record.id; | |
217 | + modalTitle.value = '修改'; | |
218 | + try { | |
219 | + const response = await getInsPlanDetail({ id }); | |
220 | + initialData.value = { | |
221 | + form: response, // 表单数据 | |
222 | + tableData: response.tkCheckDetailsDTOList, // 表格数据 | |
223 | + }; | |
224 | + modalVisible.value = true; // 打开弹框 | |
225 | + isViewMode.value = false; | |
226 | + } catch (error) { | |
227 | + throw error; | |
228 | + } finally { | |
229 | + } | |
230 | + }; | |
231 | + | |
232 | + // 新增 | |
233 | + const handleCreate = () => { | |
234 | + modalTitle.value = '新增'; | |
235 | + initialData.value = { | |
236 | + form: { | |
237 | + code: '', | |
238 | + name: '', | |
239 | + status: '', | |
240 | + enabled: '', | |
241 | + startTime: '', | |
242 | + endTime: '', | |
243 | + remark: '', | |
244 | + }, | |
245 | + tableData: [], | |
246 | + }; | |
247 | + modalVisible.value = true; | |
248 | + }; | |
249 | + | |
250 | + const handleSubmit = async (data) => { | |
251 | + const format = 'yyyy-MM-dd hh:mm:ss'; | |
252 | + const _data = { | |
253 | + ...data, | |
254 | + startTime: dateFormat(data?.startTime, format), | |
255 | + endTime: dateFormat(data?.endTime, format), | |
256 | + }; | |
257 | + modalVisible.value = false; | |
258 | + await updateInspectionStatus(_data); | |
259 | + message.success('提交成功'); | |
260 | + handleReload(); | |
261 | + }; | |
265 | 262 | </script> | ... | ... |
... | ... | @@ -9,11 +9,8 @@ |
9 | 9 | </Authority> |
10 | 10 | </template> |
11 | 11 | <template #recordResult="{ record }"> |
12 | - <Tag | |
13 | - :color="record.recordResult ? 'green' : 'red'" | |
14 | - class="ml-2" | |
15 | - > | |
16 | - {{record.recordResult ? '正常' : '异常'}} | |
12 | + <Tag :color="record.recordResult ? 'green' : 'red'" class="ml-2"> | |
13 | + {{ record.recordResult ? '正常' : '异常' }} | |
17 | 14 | </Tag> |
18 | 15 | </template> |
19 | 16 | <template #action="{ record }"> |
... | ... | @@ -55,18 +52,19 @@ |
55 | 52 | </div> |
56 | 53 | </template> |
57 | 54 | <script setup lang="ts"> |
58 | - import {ref} from "vue"; | |
55 | + import { ref } from 'vue'; | |
59 | 56 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
60 | 57 | import { |
61 | 58 | getInspectionRecordList, |
62 | 59 | deleteInsRecord, |
63 | - saveInsRecord, getInsRecordDetail | |
60 | + saveInsRecord, | |
61 | + getInsRecordDetail, | |
64 | 62 | } from '/@/api/inspection/inspectionRecord'; |
65 | 63 | import { columns, searchFormSchema } from './index'; |
66 | 64 | import { useI18n } from '/@/hooks/web/useI18n'; |
67 | - import {Button, message, Tag} from 'ant-design-vue'; | |
68 | - import {useMessage} from "/@/hooks/web/useMessage"; | |
69 | - import { insRecordModal } from "./components/index" | |
65 | + import { Button, message, Tag } from 'ant-design-vue'; | |
66 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
67 | + import { insRecordModal } from './components/index'; | |
70 | 68 | const { t } = useI18n(); |
71 | 69 | const { createMessage } = useMessage(); |
72 | 70 | const modalVisible = ref(false); |
... | ... | @@ -84,10 +82,7 @@ |
84 | 82 | }, |
85 | 83 | tableData: [], |
86 | 84 | }); |
87 | - const [ | |
88 | - registerTable, | |
89 | - { reload, setLoading, setSelectedRowKeys, }, | |
90 | - ] = useTable({ | |
85 | + const [registerTable, { reload, setLoading, setSelectedRowKeys }] = useTable({ | |
91 | 86 | title: t('inspection.inspectionRecord.listText'), |
92 | 87 | api: getInspectionRecordList, |
93 | 88 | columns, |
... | ... | @@ -136,9 +131,9 @@ |
136 | 131 | orgId: '', |
137 | 132 | }, |
138 | 133 | tableData: [], |
139 | - } | |
134 | + }; | |
140 | 135 | modalVisible.value = true; |
141 | - } | |
136 | + }; | |
142 | 137 | |
143 | 138 | const handleReload = () => { |
144 | 139 | setSelectedRowKeys([]); |
... | ... | @@ -150,11 +145,11 @@ |
150 | 145 | modalVisible.value = false; |
151 | 146 | const _data = { |
152 | 147 | ...data, |
153 | - checkDate: dateFormat(data?.checkDate, format) | |
154 | - } | |
155 | - await saveInsRecord(_data) | |
148 | + checkDate: dateFormat(data?.checkDate, format), | |
149 | + }; | |
150 | + await saveInsRecord(_data); | |
156 | 151 | message.success('提交成功'); |
157 | - handleReload() | |
152 | + handleReload(); | |
158 | 153 | }; |
159 | 154 | |
160 | 155 | const handleViewDetail = async (record?: any) => { |
... | ... | @@ -163,32 +158,31 @@ |
163 | 158 | modalVisible.value = true; // 打开弹框 |
164 | 159 | isViewMode.value = true; |
165 | 160 | try { |
166 | - const response = await getInsRecordDetail({id}) | |
161 | + const response = await getInsRecordDetail({ id }); | |
167 | 162 | initialData.value = { |
168 | 163 | form: response, // 表单数据 |
169 | 164 | tableData: response.tkInspectionDetailsDTOList, // 表格数据 |
170 | 165 | }; |
171 | - }catch (error) { | |
166 | + } catch (error) { | |
172 | 167 | throw error; |
173 | - }finally { | |
174 | - | |
168 | + } finally { | |
175 | 169 | } |
176 | - } | |
170 | + }; | |
177 | 171 | |
178 | 172 | const handleEdit = async (record?: any) => { |
179 | 173 | let id = record.id; |
180 | 174 | modalTitle.value = '修改'; |
181 | 175 | try { |
182 | - const response = await getInsRecordDetail({id}) | |
176 | + const response = await getInsRecordDetail({ id }); | |
183 | 177 | initialData.value = { |
184 | 178 | form: response, // 表单数据 |
185 | 179 | tableData: response.tkInspectionDetailsDTOList, // 表格数据 |
186 | 180 | }; |
187 | 181 | modalVisible.value = true; // 打开弹框 |
188 | - }catch (error) { | |
182 | + isViewMode.value = false; | |
183 | + } catch (error) { | |
189 | 184 | throw error; |
190 | - }finally { | |
185 | + } finally { | |
191 | 186 | } |
192 | - } | |
193 | - | |
187 | + }; | |
194 | 188 | </script> | ... | ... |
... | ... | @@ -14,8 +14,10 @@ |
14 | 14 | record.status == 'NOTSTART' |
15 | 15 | ? 'red' |
16 | 16 | : record.status == 'UNDERWAY' |
17 | - ? 'blue': record.status == 'COMPLETED' | |
18 | - ? 'green': 'yellow' | |
17 | + ? 'blue' | |
18 | + : record.status == 'COMPLETED' | |
19 | + ? 'green' | |
20 | + : 'yellow' | |
19 | 21 | " |
20 | 22 | class="ml-2" |
21 | 23 | > |
... | ... | @@ -66,7 +68,7 @@ |
66 | 68 | ifShow: () => record.status === 'NOTSTART' || record.status === 'UNDERWAY', |
67 | 69 | popConfirm: { |
68 | 70 | title: t('common.stopConfirmText'), |
69 | - confirm: handleUpdateStatus.bind(null, record,'STOP'), | |
71 | + confirm: handleUpdateStatus.bind(null, record, 'STOP'), | |
70 | 72 | }, |
71 | 73 | }, |
72 | 74 | { |
... | ... | @@ -90,19 +92,24 @@ |
90 | 92 | @submit="handleSubmit" |
91 | 93 | :title="modalTitle" |
92 | 94 | /> |
93 | - | |
94 | 95 | </div> |
95 | 96 | </template> |
96 | 97 | <script setup lang="ts"> |
97 | 98 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
98 | - import {deleteServePlan, getServicePlanList, updateServiceStatus, savePreservePlan, getPreserveDetail} from '/@/api/inspection/servicePlan'; | |
99 | - import { servicePlanModal } from "./components/index" | |
99 | + import { | |
100 | + deleteServePlan, | |
101 | + getServicePlanList, | |
102 | + updateServiceStatus, | |
103 | + savePreservePlan, | |
104 | + getPreserveDetail, | |
105 | + } from '/@/api/inspection/servicePlan'; | |
106 | + import { servicePlanModal } from './components/index'; | |
100 | 107 | import { columns, searchFormSchema } from './index'; |
101 | 108 | import { useI18n } from '/@/hooks/web/useI18n'; |
102 | - import {Button, Tag} from 'ant-design-vue'; | |
103 | - import {useMessage} from "/@/hooks/web/useMessage"; | |
109 | + import { Button, Tag } from 'ant-design-vue'; | |
110 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
104 | 111 | const { t } = useI18n(); |
105 | - import { ref } from "vue" | |
112 | + import { ref } from 'vue'; | |
106 | 113 | const { createMessage } = useMessage(); |
107 | 114 | const modalVisible = ref(false); |
108 | 115 | const isViewMode = ref(false); |
... | ... | @@ -117,10 +124,7 @@ |
117 | 124 | }, |
118 | 125 | tableData: [], |
119 | 126 | }); |
120 | - const [ | |
121 | - registerTable, | |
122 | - { reload, setLoading, setSelectedRowKeys, }, | |
123 | - ] = useTable({ | |
127 | + const [registerTable, { reload, setLoading, setSelectedRowKeys }] = useTable({ | |
124 | 128 | title: t('inspection.servicePlan.listText'), |
125 | 129 | api: getServicePlanList, |
126 | 130 | columns, |
... | ... | @@ -155,15 +159,15 @@ |
155 | 159 | frequency: '', |
156 | 160 | }, |
157 | 161 | tableData: [], |
158 | - } | |
162 | + }; | |
159 | 163 | modalVisible.value = true; |
160 | 164 | }; |
161 | 165 | |
162 | 166 | const handleSubmit = async (data) => { |
163 | 167 | modalVisible.value = false; |
164 | - await savePreservePlan(data) | |
168 | + await savePreservePlan(data); | |
165 | 169 | createMessage.success('提交成功'); |
166 | - handleReload() | |
170 | + handleReload(); | |
167 | 171 | }; |
168 | 172 | |
169 | 173 | const handleReload = () => { |
... | ... | @@ -175,36 +179,35 @@ |
175 | 179 | let id = record.id; |
176 | 180 | modalTitle.value = '查看'; |
177 | 181 | try { |
178 | - const response = await getPreserveDetail({id}) | |
182 | + const response = await getPreserveDetail({ id }); | |
179 | 183 | initialData.value = { |
180 | 184 | form: response, // 表单数据 |
181 | 185 | tableData: response.preserveDetailList, // 表格数据 |
182 | 186 | }; |
183 | 187 | modalVisible.value = true; // 打开弹框 |
184 | 188 | isViewMode.value = true; |
185 | - }catch (error) { | |
189 | + } catch (error) { | |
186 | 190 | throw error; |
187 | - }finally { | |
188 | - | |
191 | + } finally { | |
189 | 192 | } |
190 | - } | |
191 | - | |
193 | + }; | |
194 | + | |
192 | 195 | const handleEdit = async (record?: any) => { |
193 | 196 | let id = record.id; |
194 | 197 | modalTitle.value = '修改'; |
195 | 198 | try { |
196 | - const response = await getPreserveDetail({id}) | |
199 | + const response = await getPreserveDetail({ id }); | |
197 | 200 | initialData.value = { |
198 | 201 | form: response, // 表单数据 |
199 | 202 | tableData: response.preserveDetailList, // 表格数据 |
200 | 203 | }; |
201 | 204 | modalVisible.value = true; // 打开弹框 |
202 | - }catch (error) { | |
205 | + isViewMode.value = false; | |
206 | + } catch (error) { | |
203 | 207 | throw error; |
204 | - }finally { | |
205 | - | |
208 | + } finally { | |
206 | 209 | } |
207 | - } | |
210 | + }; | |
208 | 211 | |
209 | 212 | const handleDelete = async (record?: any) => { |
210 | 213 | let id = record.id; |
... | ... | @@ -220,22 +223,22 @@ |
220 | 223 | } |
221 | 224 | }; |
222 | 225 | |
223 | - const handleUpdateStatus = async (record?: any,value?: string) => { | |
226 | + const handleUpdateStatus = async (record?: any, value?: string) => { | |
224 | 227 | let id = record.id; |
225 | 228 | let status = ''; |
226 | 229 | if (record.status === 'NOTSTART') { |
227 | - status = 'UNDERWAY' | |
228 | - }else if(record.status === 'UNDERWAY'){ | |
229 | - status = 'COMPLETED' | |
230 | - }else if(record.status === 'COMPLETED'){ | |
231 | - status = 'STOP' | |
230 | + status = 'UNDERWAY'; | |
231 | + } else if (record.status === 'UNDERWAY') { | |
232 | + status = 'COMPLETED'; | |
233 | + } else if (record.status === 'COMPLETED') { | |
234 | + status = 'STOP'; | |
232 | 235 | } |
233 | 236 | if (value === 'STOP') { |
234 | - status = 'STOP' | |
237 | + status = 'STOP'; | |
235 | 238 | } |
236 | 239 | try { |
237 | 240 | setLoading(true); |
238 | - await updateServiceStatus({ id,status }); | |
241 | + await updateServiceStatus({ id, status }); | |
239 | 242 | createMessage.success(t('common.editSuccessText')); |
240 | 243 | handleReload(); |
241 | 244 | } catch (error) { |
... | ... | @@ -243,6 +246,5 @@ |
243 | 246 | } finally { |
244 | 247 | setLoading(false); |
245 | 248 | } |
246 | - } | |
247 | - | |
249 | + }; | |
248 | 250 | </script> | ... | ... |
1 | 1 | import { FormSchema } from '/@/components/Form'; |
2 | 2 | import { useI18n } from '/@/hooks/web/useI18n'; |
3 | 3 | import { BasicColumn } from '/@/components/Table'; |
4 | -import {getServicePlanList} from "/@/api/inspection/servicePlan"; | |
4 | +import { getServicePlanList } from '/@/api/inspection/servicePlan'; | |
5 | 5 | const { t } = useI18n(); |
6 | 6 | |
7 | - | |
8 | 7 | const statusOptions = [ |
9 | 8 | { label: t('inspection.serviceRecord.INCOMPLETE'), value: 'INCOMPLETE' }, |
10 | 9 | { label: t('inspection.serviceRecord.COMPLETE'), value: 'COMPLETE' }, |
... | ... | @@ -60,9 +59,7 @@ export const columns: BasicColumn[] = [ |
60 | 59 | dataIndex: 'preserveDate', |
61 | 60 | }, |
62 | 61 | { |
63 | - title: t('inspection.serviceRecord.preserveByName'), | |
64 | 62 | dataIndex: 'preserveByName', |
65 | - | |
66 | 63 | }, |
67 | 64 | { |
68 | 65 | title: t('inspection.serviceRecord.preserveNameText'), | ... | ... |
... | ... | @@ -12,8 +12,10 @@ |
12 | 12 | <Tag |
13 | 13 | :color=" |
14 | 14 | record.status == 'INCOMPLETE' |
15 | - ? 'red': record.status == 'COMPLETED' | |
16 | - ? 'green': 'yellow' | |
15 | + ? 'red' | |
16 | + : record.status == 'COMPLETED' | |
17 | + ? 'green' | |
18 | + : 'yellow' | |
17 | 19 | " |
18 | 20 | class="ml-2" |
19 | 21 | > |
... | ... | @@ -59,85 +61,26 @@ |
59 | 61 | </div> |
60 | 62 | </template> |
61 | 63 | <script setup lang="ts"> |
62 | -import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
63 | -import { | |
64 | - getServiceRecordList, | |
65 | - deleteServeRecord, | |
66 | - savePreserveRecord, getRecordDetail | |
67 | -} from '/@/api/inspection/serviceRecord'; | |
68 | -import { columns, searchFormSchema } from './index'; | |
69 | -import { useI18n } from '/@/hooks/web/useI18n'; | |
70 | -import {Button, message, Tag} from 'ant-design-vue'; | |
71 | -import {useMessage} from "/@/hooks/web/useMessage"; | |
72 | -import { serviceRecordModal } from "./components/index" | |
73 | -import {ref} from "vue"; | |
74 | -const { t } = useI18n(); | |
75 | -const { createMessage } = useMessage(); | |
76 | -const modalVisible = ref(false); | |
77 | -const isViewMode = ref(false); | |
78 | -const modalTitle = ref(''); | |
79 | -import { dateFormat } from '/@/utils/common/compUtils'; | |
80 | -const initialData = ref({ | |
81 | - form: { | |
82 | - recordCode: '', | |
83 | - preservePlanId: '', | |
84 | - preserveStatus: '', | |
85 | - preserveBy: '', | |
86 | - preserveByName: '', | |
87 | - preserveDate: '', | |
88 | - orgId: '', | |
89 | - }, | |
90 | - tableData: [], | |
91 | -}); | |
92 | - | |
93 | -const [ | |
94 | - registerTable, | |
95 | - { reload, setLoading, setSelectedRowKeys, }, | |
96 | -] = useTable({ | |
97 | - title: t('inspection.serviceRecord.listText'), | |
98 | - api: getServiceRecordList, | |
99 | - columns, | |
100 | - formConfig: { | |
101 | - labelWidth: 100, | |
102 | - schemas: searchFormSchema, | |
103 | - }, | |
104 | - immediate: true, | |
105 | - useSearchForm: true, | |
106 | - showTableSetting: true, | |
107 | - bordered: true, | |
108 | - showIndexColumn: false, | |
109 | - clickToRowSelect: false, | |
110 | - rowKey: 'id', | |
111 | - actionColumn: { | |
112 | - width: 230, | |
113 | - title: t('common.actionText'), | |
114 | - slots: { customRender: 'action' }, | |
115 | - fixed: 'right', | |
116 | - }, | |
117 | -}); | |
118 | - | |
119 | -const handleDelete = async (record?: any) => { | |
120 | - let id = record.id; | |
121 | - try { | |
122 | - setLoading(true); | |
123 | - await deleteServeRecord({ id }); | |
124 | - createMessage.success(t('common.deleteSuccessText')); | |
125 | - handleReload(); | |
126 | - } catch (error) { | |
127 | - throw error; | |
128 | - } finally { | |
129 | - setLoading(false); | |
130 | - } | |
131 | -}; | |
132 | - | |
133 | -const handleReload = () => { | |
134 | - setSelectedRowKeys([]); | |
135 | - reload(); | |
136 | -}; | |
137 | - | |
138 | -const handleCreate = () => { | |
139 | - modalTitle.value = '新增'; | |
140 | - initialData.value = { | |
64 | + import { BasicTable, useTable, TableAction } from '/@/components/Table'; | |
65 | + import { | |
66 | + getServiceRecordList, | |
67 | + deleteServeRecord, | |
68 | + savePreserveRecord, | |
69 | + getRecordDetail, | |
70 | + } from '/@/api/inspection/serviceRecord'; | |
71 | + import { columns, searchFormSchema } from './index'; | |
72 | + import { useI18n } from '/@/hooks/web/useI18n'; | |
73 | + import { Button, message, Tag } from 'ant-design-vue'; | |
74 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
75 | + import { serviceRecordModal } from './components/index'; | |
76 | + import { ref } from 'vue'; | |
77 | + const { t } = useI18n(); | |
78 | + const { createMessage } = useMessage(); | |
79 | + const modalVisible = ref(false); | |
80 | + const isViewMode = ref(false); | |
81 | + const modalTitle = ref(''); | |
82 | + import { dateFormat } from '/@/utils/common/compUtils'; | |
83 | + const initialData = ref({ | |
141 | 84 | form: { |
142 | 85 | recordCode: '', |
143 | 86 | preservePlanId: '', |
... | ... | @@ -148,55 +91,110 @@ const handleCreate = () => { |
148 | 91 | orgId: '', |
149 | 92 | }, |
150 | 93 | tableData: [], |
151 | - } | |
152 | - modalVisible.value = true; | |
153 | -} | |
94 | + }); | |
95 | + | |
96 | + const [registerTable, { reload, setLoading, setSelectedRowKeys }] = useTable({ | |
97 | + title: t('inspection.serviceRecord.listText'), | |
98 | + api: getServiceRecordList, | |
99 | + columns, | |
100 | + formConfig: { | |
101 | + labelWidth: 100, | |
102 | + schemas: searchFormSchema, | |
103 | + }, | |
104 | + immediate: true, | |
105 | + useSearchForm: true, | |
106 | + showTableSetting: true, | |
107 | + bordered: true, | |
108 | + showIndexColumn: false, | |
109 | + clickToRowSelect: false, | |
110 | + rowKey: 'id', | |
111 | + actionColumn: { | |
112 | + width: 230, | |
113 | + title: t('common.actionText'), | |
114 | + slots: { customRender: 'action' }, | |
115 | + fixed: 'right', | |
116 | + }, | |
117 | + }); | |
118 | + | |
119 | + const handleDelete = async (record?: any) => { | |
120 | + let id = record.id; | |
121 | + try { | |
122 | + setLoading(true); | |
123 | + await deleteServeRecord({ id }); | |
124 | + createMessage.success(t('common.deleteSuccessText')); | |
125 | + handleReload(); | |
126 | + } catch (error) { | |
127 | + throw error; | |
128 | + } finally { | |
129 | + setLoading(false); | |
130 | + } | |
131 | + }; | |
154 | 132 | |
155 | -const handleSubmit = async (data) => { | |
156 | - const format = 'yyyy-MM-dd hh:mm:ss'; | |
157 | - modalVisible.value = false; | |
158 | - const _data = { | |
159 | - ...data, | |
160 | - preserveDate: dateFormat(data?.preserveDate, format) | |
161 | - } | |
162 | - await savePreserveRecord(_data) | |
163 | - message.success('提交成功'); | |
164 | - handleReload() | |
165 | -}; | |
133 | + const handleReload = () => { | |
134 | + setSelectedRowKeys([]); | |
135 | + reload(); | |
136 | + }; | |
166 | 137 | |
167 | -const handleEdit = async (record?: any) => { | |
168 | - let id = record.id; | |
169 | - modalTitle.value = '修改'; | |
170 | - try { | |
171 | - const response = await getRecordDetail({id}) | |
138 | + const handleCreate = () => { | |
139 | + modalTitle.value = '新增'; | |
172 | 140 | initialData.value = { |
173 | - form: response, // 表单数据 | |
174 | - tableData: response.preserveDetailStatusList, // 表格数据 | |
141 | + form: { | |
142 | + recordCode: '', | |
143 | + preservePlanId: '', | |
144 | + preserveStatus: '', | |
145 | + preserveBy: '', | |
146 | + preserveByName: '', | |
147 | + preserveDate: '', | |
148 | + orgId: '', | |
149 | + }, | |
150 | + tableData: [], | |
175 | 151 | }; |
176 | - modalVisible.value = true; // 打开弹框 | |
177 | - }catch (error) { | |
178 | - throw error; | |
179 | - }finally { | |
152 | + modalVisible.value = true; | |
153 | + }; | |
180 | 154 | |
181 | - } | |
182 | -} | |
183 | - | |
184 | -const handleViewDetail = async (record?: any) => { | |
185 | - let id = record.id; | |
186 | - modalTitle.value = '查看'; | |
187 | - try { | |
188 | - const response = await getRecordDetail({id}) | |
189 | - initialData.value = { | |
190 | - form: response, // 表单数据 | |
191 | - tableData: response.preserveDetailStatusList, // 表格数据 | |
155 | + const handleSubmit = async (data) => { | |
156 | + const format = 'yyyy-MM-dd hh:mm:ss'; | |
157 | + modalVisible.value = false; | |
158 | + const _data = { | |
159 | + ...data, | |
160 | + preserveDate: dateFormat(data?.preserveDate, format), | |
192 | 161 | }; |
193 | - modalVisible.value = true; // 打开弹框 | |
194 | - isViewMode.value = true; | |
195 | - }catch (error) { | |
196 | - throw error; | |
197 | - }finally { | |
162 | + await savePreserveRecord(_data); | |
163 | + message.success('提交成功'); | |
164 | + handleReload(); | |
165 | + }; | |
198 | 166 | |
199 | - } | |
200 | -} | |
167 | + const handleEdit = async (record?: any) => { | |
168 | + let id = record.id; | |
169 | + modalTitle.value = '修改'; | |
170 | + try { | |
171 | + const response = await getRecordDetail({ id }); | |
172 | + initialData.value = { | |
173 | + form: response, // 表单数据 | |
174 | + tableData: response.preserveDetailStatusList, // 表格数据 | |
175 | + }; | |
176 | + modalVisible.value = true; // 打开弹框 | |
177 | + isViewMode.value = false; | |
178 | + } catch (error) { | |
179 | + throw error; | |
180 | + } finally { | |
181 | + } | |
182 | + }; | |
201 | 183 | |
184 | + const handleViewDetail = async (record?: any) => { | |
185 | + let id = record.id; | |
186 | + modalTitle.value = '查看'; | |
187 | + try { | |
188 | + const response = await getRecordDetail({ id }); | |
189 | + initialData.value = { | |
190 | + form: response, // 表单数据 | |
191 | + tableData: response.preserveDetailStatusList, // 表格数据 | |
192 | + }; | |
193 | + modalVisible.value = true; // 打开弹框 | |
194 | + isViewMode.value = true; | |
195 | + } catch (error) { | |
196 | + throw error; | |
197 | + } finally { | |
198 | + } | |
199 | + }; | |
202 | 200 | </script> | ... | ... |
... | ... | @@ -9,6 +9,7 @@ import { createImgPreview } from '/@/components/Preview'; |
9 | 9 | useComponentRegister('OrgTreeSelect', OrgTreeSelect); |
10 | 10 | |
11 | 11 | const statusOptions = [ |
12 | + { label: t('repair.order.DRAFT'), value: 'DRAFT' }, | |
12 | 13 | { label: t('repair.order.SCHEDULING'), value: 'SCHEDULING' }, |
13 | 14 | { label: t('repair.order.REPAIRFINISH'), value: 'REPAIRFINISH' }, |
14 | 15 | { label: t('repair.order.ACCEPTANCEPASSED'), value: 'ACCEPTANCEPASSED' }, | ... | ... |