|
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+<template>
|
|
|
2
|
+ <div class="h5-container">
|
|
|
3
|
+ <van-nav-bar :title @click-left="onClickLeft">
|
|
|
4
|
+ </van-nav-bar>
|
|
|
5
|
+ <van-form @submit="baocun" ref="formRef">
|
|
|
6
|
+ <van-field :readonly="ifElseReadonly" border v-model="form.accidentLocation" name="事故地点" label="事故地点"
|
|
|
7
|
+ :colon="true" placeholder="事故地点"
|
|
|
8
|
+ required
|
|
|
9
|
+ :rules="[{ required:true, message: '请填充内容' }]"
|
|
|
10
|
+ />
|
|
|
11
|
+ <van-field
|
|
|
12
|
+ v-model="form.accidentTime"
|
|
|
13
|
+ is-link
|
|
|
14
|
+ readonly
|
|
|
15
|
+ name="datetime"
|
|
|
16
|
+ label="发生时间"
|
|
|
17
|
+ :colon="true"
|
|
|
18
|
+ placeholder="点击选择日期和时间"
|
|
|
19
|
+ @click="showDatetimePicker = !ifElseReadonly"
|
|
|
20
|
+ required
|
|
|
21
|
+ :rules="[{ required:true, message: '请选择内容' }]"
|
|
|
22
|
+ />
|
|
|
23
|
+ <!-- 日期时间选择器部分 -->
|
|
|
24
|
+ <van-popup
|
|
|
25
|
+ v-model:show="showDatetimePicker"
|
|
|
26
|
+ position="bottom"
|
|
|
27
|
+ round
|
|
|
28
|
+ style="max-height: 50vh;"
|
|
|
29
|
+ >
|
|
|
30
|
+ <van-date-picker
|
|
|
31
|
+ v-if="!dateOrTime"
|
|
|
32
|
+ v-model="currentDate"
|
|
|
33
|
+ title="选择日期"
|
|
|
34
|
+ :min-date="minDate"
|
|
|
35
|
+ :max-date="maxDate"
|
|
|
36
|
+ @confirm="onDateConfirm"
|
|
|
37
|
+ @cancel="cancelDatePicker"
|
|
|
38
|
+ >
|
|
|
39
|
+ <template #confirm>
|
|
|
40
|
+ <van-button type="primary" @click="onDateConfirm">下一步</van-button>
|
|
|
41
|
+ </template>
|
|
|
42
|
+ <template #cancel>
|
|
|
43
|
+ <van-button type="danger" @click="cancelDatePicker">取消</van-button>
|
|
|
44
|
+ </template>
|
|
|
45
|
+ </van-date-picker>
|
|
|
46
|
+
|
|
|
47
|
+ <van-time-picker
|
|
|
48
|
+ v-if="dateOrTime"
|
|
|
49
|
+ v-model="currentTime"
|
|
|
50
|
+ title="选择时间"
|
|
|
51
|
+ :columns-type="['hour', 'minute', 'second']"
|
|
|
52
|
+ @confirm="onConfirmDatetime"
|
|
|
53
|
+ @cancel="cancelTimePicker"
|
|
|
54
|
+ >
|
|
|
55
|
+ <template #confirm>
|
|
|
56
|
+ <van-button type="primary" @click="onConfirmDatetime">确定</van-button>
|
|
|
57
|
+ </template>
|
|
|
58
|
+ <template #cancel>
|
|
|
59
|
+ <van-button type="danger" @click="cancelTimePicker">取消</van-button>
|
|
|
60
|
+ </template>
|
|
|
61
|
+ </van-time-picker>
|
|
|
62
|
+ </van-popup>
|
|
|
63
|
+
|
|
|
64
|
+ <van-field :readonly="ifElseReadonly" border v-model="form.sceneConditions" name="事故现场情况" label="事故现场情况"
|
|
|
65
|
+ type="textarea"
|
|
|
66
|
+ autosize
|
|
|
67
|
+ :colon="true" placeholder="事故现场情况"
|
|
|
68
|
+ required
|
|
|
69
|
+ :rules="[{ required:true, message: '请填充内容' }]"
|
|
|
70
|
+ />
|
|
|
71
|
+ <van-field :readonly="ifElseReadonly" border v-model="form.accidentSummary" name="事故简要经过" label="事故简要经过"
|
|
|
72
|
+ type="textarea"
|
|
|
73
|
+ autosize
|
|
|
74
|
+ :colon="true" placeholder="事故简要经过"
|
|
|
75
|
+ required
|
|
|
76
|
+ :rules="[{ required:true, message: '请填充内容' }]"
|
|
|
77
|
+ />
|
|
|
78
|
+
|
|
|
79
|
+ <van-field is-link :colon="true" readonly v-model="form.accidentType" required label="事故类型"
|
|
|
80
|
+ placeholder="选择事故类型"
|
|
|
81
|
+ @click="showPicker = !ifElseReadonly" :rules="[{ required: true, message: '请选择内容' }]" />
|
|
|
82
|
+ <van-popup :readonly="ifElseReadonly" v-model:show="showPicker" round position="bottom">
|
|
|
83
|
+ <van-picker :columns="yhlxs" @cancel="showPicker = false" @confirm="onConfirmYhlx" />
|
|
|
84
|
+ </van-popup>
|
|
|
85
|
+ <van-field v-model="form.seriousInjuryCount" name="重伤人数" label="重伤人数" :colon="true" readonly clickable @touchstart.stop="showSeriousInjuryCount = !ifElseReadonly"
|
|
|
86
|
+ required :rules="[{ required: true, message: '请输入重伤人数' }]"/>
|
|
|
87
|
+ <van-number-keyboard
|
|
|
88
|
+ :readonly="ifElseReadonly"
|
|
|
89
|
+ v-model="form.seriousInjuryCount"
|
|
|
90
|
+ :show="showSeriousInjuryCount"
|
|
|
91
|
+ @blur="showSeriousInjuryCount = false"
|
|
|
92
|
+ />
|
|
|
93
|
+ <van-field v-model="form.deathCount" name="死亡人数" label="死亡人数" :colon="true" readonly clickable @touchstart.stop="showDeathCount = !ifElseReadonly"
|
|
|
94
|
+ required :rules="[{ required: true, message: '请输入死亡人数' }]"/>
|
|
|
95
|
+ <van-number-keyboard
|
|
|
96
|
+ :readonly="ifElseReadonly"
|
|
|
97
|
+ v-model="form.deathCount"
|
|
|
98
|
+ :show="showDeathCount"
|
|
|
99
|
+ @blur="showDeathCount = false"
|
|
|
100
|
+ />
|
|
|
101
|
+ <van-field v-model="form.economicLoss" name="事故经济损失" label="事故经济损失(万元)" :colon="true" readonly clickable @touchstart.stop="showEconomicLoss = !ifElseReadonly"
|
|
|
102
|
+ required :rules="[{ required: true, message: '请输入事故经济损失并确认是否最多只有小数',pattern: /^\d+(\.\d{1,3})?$/ }]"/>
|
|
|
103
|
+ <van-number-keyboard
|
|
|
104
|
+ :readonly="ifElseReadonly"
|
|
|
105
|
+ v-model="form.economicLoss"
|
|
|
106
|
+ :show="showEconomicLoss"
|
|
|
107
|
+ theme="custom"
|
|
|
108
|
+ extra-key="."
|
|
|
109
|
+ close-button-text="完成"
|
|
|
110
|
+ @blur="showEconomicLoss = false"
|
|
|
111
|
+ @input="onInput"
|
|
|
112
|
+ @delete="cKeyDelete"
|
|
|
113
|
+ />
|
|
|
114
|
+ <van-field readonly border v-model="accidentLevel" name="事故等级" label="事故等级"
|
|
|
115
|
+ :colon="true" placeholder="事故等级"
|
|
|
116
|
+ />
|
|
|
117
|
+
|
|
|
118
|
+ <van-field v-if="false" border v-model="form.unlawfulAct" name="可能存在的违法行为" label="可能存在的违法行为"
|
|
|
119
|
+ type="textarea"
|
|
|
120
|
+ autosize
|
|
|
121
|
+ :colon="true" placeholder="可能存在的违法行为"
|
|
|
122
|
+ required
|
|
|
123
|
+ :rules="[{ required:true, message: '请填充内容' }]"
|
|
|
124
|
+ />
|
|
|
125
|
+ <van-field v-if="true" border v-model="form.unlawfulAct" name="可能存在的违法行为" label="可能存在的违法行为"
|
|
|
126
|
+ type="textarea"
|
|
|
127
|
+ :readonly="ifElseReadonly"
|
|
|
128
|
+ autosize
|
|
|
129
|
+ :colon="true" placeholder="可能存在的违法行为"
|
|
|
130
|
+ />
|
|
|
131
|
+
|
|
|
132
|
+ <van-field border v-model="form.measuresTaken" name="已采取的措施" label="已采取的措施"
|
|
|
133
|
+ type="textarea"
|
|
|
134
|
+ autosize
|
|
|
135
|
+ :readonly="ifElseReadonly"
|
|
|
136
|
+ :colon="true" placeholder="已采取的措施"
|
|
|
137
|
+ required
|
|
|
138
|
+ :rules="[{ required:true, message: '请填充内容' }]"
|
|
|
139
|
+ />
|
|
|
140
|
+
|
|
|
141
|
+ <van-field border v-model="form.otherConditions" name="其他应当报告的情况" label="其他应当报告的情况"
|
|
|
142
|
+ type="textarea"
|
|
|
143
|
+ autosize
|
|
|
144
|
+ :readonly="ifElseReadonly"
|
|
|
145
|
+ :colon="true" placeholder="其他应当报告的情况"
|
|
|
146
|
+ />
|
|
|
147
|
+
|
|
|
148
|
+ <van-button v-if="!ifElseReadonly" block round type="primary" native-type="submit" style="margin-bottom: 5px;">
|
|
|
149
|
+ 保存
|
|
|
150
|
+ </van-button>
|
|
|
151
|
+ <van-button v-if="!ifElseReadonly" block round plain type="default" @click="qvxiao">
|
|
|
152
|
+ 取消
|
|
|
153
|
+ </van-button>
|
|
|
154
|
+ <div style="height: 10px;"></div>
|
|
|
155
|
+ </van-form>
|
|
|
156
|
+ </div>
|
|
|
157
|
+
|
|
|
158
|
+
|
|
|
159
|
+ <van-dialog v-model:show="showDialogVisible" title="删除文件" show-cancel-button
|
|
|
160
|
+ confirm-button-color="#ee0124" message="确定删除该文件吗?" @confirm="onDelete" />
|
|
|
161
|
+</template>
|
|
|
162
|
+
|
|
|
163
|
+<script setup>
|
|
|
164
|
+import { ref, reactive, onMounted, getCurrentInstance, nextTick, computed } from 'vue';
|
|
|
165
|
+import { closeToast, Dialog, showFailToast, showLoadingToast, showSuccessToast, showToast } from 'vant';
|
|
|
166
|
+import AttachmentS3Image from '@/components/AttachmentS3Image.vue';
|
|
|
167
|
+import AttachmentS3 from '@/components/AttachmentS3.vue';
|
|
|
168
|
+import OrganizationalWithLeafUserOne from '@/components/OrganizationalWithLeafUserOne.vue';
|
|
|
169
|
+import OrganizationalWithLeafUser from '@/components/OrganizationalWithLeafUser.vue';
|
|
|
170
|
+import OrganizationalWithLeaf from '@/components/JuBaoOrganizationalWithLeaf.vue';
|
|
|
171
|
+
|
|
|
172
|
+const { proxy } = getCurrentInstance();
|
|
|
173
|
+
|
|
|
174
|
+const onClickLeft = () => {
|
|
|
175
|
+ history.back();
|
|
|
176
|
+};
|
|
|
177
|
+
|
|
|
178
|
+/* 风险隐患排查发现隐患,进行登记代码 */
|
|
|
179
|
+const checklistForm = ref({
|
|
|
180
|
+ evaluationId: '',
|
|
|
181
|
+ checklistType: '',
|
|
|
182
|
+ hiddenDangerId: ''
|
|
|
183
|
+});
|
|
|
184
|
+const saveCheckInfo = async () => {
|
|
|
185
|
+ let url = '/safe/ActivityRecords/save';
|
|
|
186
|
+ if (checklistForm.value.checklistType === 'equipment') {
|
|
|
187
|
+ url = '/safe/EquipmentRecords/save';
|
|
|
188
|
+ }
|
|
|
189
|
+ const param = {
|
|
|
190
|
+ json: JSON.stringify(checklistForm.value)
|
|
|
191
|
+ };
|
|
|
192
|
+ const res = await proxy.$axios.post(url, param);
|
|
|
193
|
+ if (res.data.code === 0) {
|
|
|
194
|
+ showSuccessToast('新增排查记录成功!');
|
|
|
195
|
+ sessionStorage.setItem('inspectionResult', '已排查');
|
|
|
196
|
+ } else {
|
|
|
197
|
+ showFailToast('操作失败!' + res.data.msg);
|
|
|
198
|
+ }
|
|
|
199
|
+};
|
|
|
200
|
+
|
|
|
201
|
+const ifElseReadonly = ref(false)
|
|
|
202
|
+const title = ref('')
|
|
|
203
|
+onMounted(async () => {
|
|
|
204
|
+ const id = proxy.$route.query.id
|
|
|
205
|
+ const flag = proxy.$route.query.flag
|
|
|
206
|
+ if('add'===flag){
|
|
|
207
|
+ title.value='新增事故信息'
|
|
|
208
|
+ }else if ('edit'===flag){
|
|
|
209
|
+ title.value='修改事故信息'
|
|
|
210
|
+ }else {
|
|
|
211
|
+ title.value='查看事故信息'
|
|
|
212
|
+ }
|
|
|
213
|
+ if(id){
|
|
|
214
|
+ const res = await proxy.$axios.get('/sgsafe/AccidentDirect/queryFormById', {
|
|
|
215
|
+ id
|
|
|
216
|
+ });
|
|
|
217
|
+ if(res.data.code === 0){
|
|
|
218
|
+ form.value = res.data.data
|
|
|
219
|
+ }else {
|
|
|
220
|
+ showToast({
|
|
|
221
|
+ type: 'fail',
|
|
|
222
|
+ message: '操作失败'+res.data.msg
|
|
|
223
|
+ })
|
|
|
224
|
+ }
|
|
|
225
|
+ if(flag === 'look'){
|
|
|
226
|
+ ifElseReadonly.value = true
|
|
|
227
|
+ }
|
|
|
228
|
+ }
|
|
|
229
|
+});
|
|
|
230
|
+
|
|
|
231
|
+const getTimeFormatter = (date) => {
|
|
|
232
|
+ const year = date.getFullYear();
|
|
|
233
|
+ const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需加 1
|
|
|
234
|
+ const day = String(date.getDate()).padStart(2, '0');
|
|
|
235
|
+ const hours = String(date.getHours()).padStart(2, '0');
|
|
|
236
|
+ const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
|
237
|
+ const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
|
238
|
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
239
|
+};
|
|
|
240
|
+
|
|
|
241
|
+/**表单*/
|
|
|
242
|
+const form = ref({
|
|
|
243
|
+ seriousInjuryCount:'',//重伤人数
|
|
|
244
|
+ deathCount:'',//死亡人数
|
|
|
245
|
+ economicLoss:'',//经济损失
|
|
|
246
|
+ accidentLevel:'',//事故等级
|
|
|
247
|
+});
|
|
|
248
|
+
|
|
|
249
|
+const showPicker = ref(false);
|
|
|
250
|
+
|
|
|
251
|
+const onConfirmYhlx = ({ selectedOptions }) => {
|
|
|
252
|
+ showPicker.value = false;
|
|
|
253
|
+ form.value.accidentType = selectedOptions[0].value;
|
|
|
254
|
+ console.log('选择的内容', form.value);
|
|
|
255
|
+};
|
|
|
256
|
+
|
|
|
257
|
+const yhlxs = ref([{text: '泄露', value: '泄露'},
|
|
|
258
|
+ {text: '坍塌', value: '坍塌'},
|
|
|
259
|
+ {text: '灼烫', value: '灼烫'},
|
|
|
260
|
+ {text: '触电', value: '触电'},
|
|
|
261
|
+ {text: '机械伤害', value: '机械伤害'},
|
|
|
262
|
+ {text: '高处坠落', value: '高处坠落'},
|
|
|
263
|
+ {text: '中毒窒息', value: '中毒窒息'},
|
|
|
264
|
+ {text: '容器爆炸', value: '容器爆炸'},
|
|
|
265
|
+ {text: '爆炸', value: '爆炸'},
|
|
|
266
|
+ {text: '火灾', value: '火灾'}]
|
|
|
267
|
+);
|
|
|
268
|
+
|
|
|
269
|
+const showDatetimePicker = ref(false);
|
|
|
270
|
+const currentDate = ref();
|
|
|
271
|
+const currentTime = ref();
|
|
|
272
|
+const minDate = ref();
|
|
|
273
|
+const maxDate = ref();
|
|
|
274
|
+
|
|
|
275
|
+const dateOrTime = ref(false);
|
|
|
276
|
+const onDateConfirm = () => {
|
|
|
277
|
+ // 日期选择确认后的处理
|
|
|
278
|
+ dateOrTime.value = true;
|
|
|
279
|
+};
|
|
|
280
|
+
|
|
|
281
|
+const onTimeConfirm = () => {
|
|
|
282
|
+ // 时间选择确认后的处理
|
|
|
283
|
+};
|
|
|
284
|
+
|
|
|
285
|
+const resetDatetime = () => {
|
|
|
286
|
+ dateOrTime.value = false;
|
|
|
287
|
+
|
|
|
288
|
+ // 初始化日期和时间
|
|
|
289
|
+ if (form.value.accidentTime) {
|
|
|
290
|
+ const dt = new Date(form.value.accidentTime);
|
|
|
291
|
+ currentDate.value = [dt.getFullYear(), dt.getMonth() + 1, dt.getDate()];
|
|
|
292
|
+ currentTime.value = [
|
|
|
293
|
+ String(dt.getHours()).padStart(2, '0'),
|
|
|
294
|
+ String(dt.getMinutes()).padStart(2, '0'),
|
|
|
295
|
+ String(dt.getSeconds()).padStart(2, '0')
|
|
|
296
|
+ ];
|
|
|
297
|
+ } else {
|
|
|
298
|
+ const now = new Date();
|
|
|
299
|
+ currentDate.value = [now.getFullYear(), now.getMonth() + 1, now.getDate()];
|
|
|
300
|
+ currentTime.value = [
|
|
|
301
|
+ String(now.getHours()).padStart(2, '0'),
|
|
|
302
|
+ String(now.getMinutes()).padStart(2, '0'),
|
|
|
303
|
+ String(now.getSeconds()).padStart(2, '0')
|
|
|
304
|
+ ];
|
|
|
305
|
+ }
|
|
|
306
|
+};
|
|
|
307
|
+
|
|
|
308
|
+const onConfirmDatetime = () => {
|
|
|
309
|
+ const year = currentDate.value[0];
|
|
|
310
|
+ const month = currentDate.value[1].toString().padStart(2, '0');
|
|
|
311
|
+ const day = currentDate.value[2].toString().padStart(2, '0');
|
|
|
312
|
+ const hours = currentTime.value[0].toString().padStart(2, '0');
|
|
|
313
|
+ const minutes = currentTime.value[1].toString().padStart(2, '0');
|
|
|
314
|
+ const seconds = currentTime.value[2].toString().padStart(2, '0');
|
|
|
315
|
+
|
|
|
316
|
+ form.value.accidentTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
317
|
+ showDatetimePicker.value = false;
|
|
|
318
|
+ dateOrTime.value = false;
|
|
|
319
|
+};
|
|
|
320
|
+
|
|
|
321
|
+const showPicker2 = ref(false);
|
|
|
322
|
+
|
|
|
323
|
+const onConfirmYhdj = ({ selectedOptions }) => {
|
|
|
324
|
+ showPicker2.value = false;
|
|
|
325
|
+ form.value.hdLevel = selectedOptions[0].value;
|
|
|
326
|
+ console.log('选择的内容', form.value);
|
|
|
327
|
+};
|
|
|
328
|
+
|
|
|
329
|
+const yhdjs = ref([{ text: '一般隐患', value: '一般隐患' },
|
|
|
330
|
+ { text: '重大隐患', value: '重大隐患' }]
|
|
|
331
|
+);
|
|
|
332
|
+
|
|
|
333
|
+const formRef = ref(null);
|
|
|
334
|
+const qvxiao = () => {
|
|
|
335
|
+ showToast({
|
|
|
336
|
+ type: 'fail',
|
|
|
337
|
+ message: '操作取消!'
|
|
|
338
|
+ });
|
|
|
339
|
+ onClickLeft();
|
|
|
340
|
+};
|
|
|
341
|
+const baocun = async () => {
|
|
|
342
|
+ form.value.accidentLevel = accidentLevel
|
|
|
343
|
+ // 原有保存逻辑保持不变
|
|
|
344
|
+ var url = 'sgsafe/AccidentDirect/save';
|
|
|
345
|
+ var param = {
|
|
|
346
|
+ json: JSON.stringify(form.value)
|
|
|
347
|
+ };
|
|
|
348
|
+ const response = await proxy.$axios.post(url, param);
|
|
|
349
|
+ if (response.data.code === 0) {
|
|
|
350
|
+ showToast({
|
|
|
351
|
+ type: 'success',
|
|
|
352
|
+ message: '保存成功!'
|
|
|
353
|
+ });
|
|
|
354
|
+ onClickLeft();
|
|
|
355
|
+ } else {
|
|
|
356
|
+ showToast({
|
|
|
357
|
+ type: 'fail',
|
|
|
358
|
+ message: '操作失败!'
|
|
|
359
|
+ });
|
|
|
360
|
+ }
|
|
|
361
|
+};
|
|
|
362
|
+
|
|
|
363
|
+const handleChangeHdSelect = (value) => {
|
|
|
364
|
+ form.value.hdSelect = value;
|
|
|
365
|
+ if (value === '隐患举报') {
|
|
|
366
|
+ isStandardFlow.value = true;
|
|
|
367
|
+ } else if (value === '即查即改') {
|
|
|
368
|
+ isStandardFlow.value = false;
|
|
|
369
|
+ }
|
|
|
370
|
+ getYHID();
|
|
|
371
|
+};
|
|
|
372
|
+
|
|
|
373
|
+const guid = () => {
|
|
|
374
|
+ function S4() {
|
|
|
375
|
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
|
376
|
+ }
|
|
|
377
|
+
|
|
|
378
|
+ return (S4() + S4() + S4() + S4() + S4() + S4() + S4() + S4());
|
|
|
379
|
+};
|
|
|
380
|
+/* 发现人 */
|
|
|
381
|
+const leaderKey = guid();
|
|
|
382
|
+const PopupDepartmentLeaderNameRef = ref();
|
|
|
383
|
+const handleDepartmentLeaderName = () => {
|
|
|
384
|
+ PopupDepartmentLeaderNameRef.value.open();
|
|
|
385
|
+};
|
|
|
386
|
+
|
|
|
387
|
+const codeAndDesc = ref([]);
|
|
|
388
|
+const getDepartmentLeaderName = (item) => {
|
|
|
389
|
+ form.value.discoverer = item.user.userCode;
|
|
|
390
|
+ form.value.discovererDesc = item.user.userDesc;
|
|
|
391
|
+ form.value.discovererDeptCode = item.dept.deptCode;
|
|
|
392
|
+ form.value.discovererDept = item.dept.deptName;
|
|
|
393
|
+};
|
|
|
394
|
+
|
|
|
395
|
+/* 其他发现人 */
|
|
|
396
|
+const leaderKey2 = guid();
|
|
|
397
|
+const PopupDepartmentLeaderNameRef2 = ref();
|
|
|
398
|
+const handleDepartmentLeaderName2 = () => {
|
|
|
399
|
+ PopupDepartmentLeaderNameRef2.value.open();
|
|
|
400
|
+};
|
|
|
401
|
+
|
|
|
402
|
+const codeAndDesc2 = ref([]);
|
|
|
403
|
+const getDepartmentLeaderName2 = (items) => {
|
|
|
404
|
+ console.log('人员数据', items);
|
|
|
405
|
+ let codeList = [];
|
|
|
406
|
+ let descList = [];
|
|
|
407
|
+ for (let item of items) {
|
|
|
408
|
+ codeAndDesc2.value.push(item.userCode + '-' + item.userDesc);
|
|
|
409
|
+ codeList.push(item.userCode);
|
|
|
410
|
+ descList.push(item.userDesc);
|
|
|
411
|
+ }
|
|
|
412
|
+ form.value.discovererOther = codeList.join(',');
|
|
|
413
|
+ form.value.discovererOtherDesc = descList.join(',');
|
|
|
414
|
+};
|
|
|
415
|
+
|
|
|
416
|
+//定义一个变量切换即查即改还是标准流程
|
|
|
417
|
+const isStandardFlow = ref(true);
|
|
|
418
|
+
|
|
|
419
|
+//当是即查即改时得到隐患编号并赋值
|
|
|
420
|
+const getYHID = () => {
|
|
|
421
|
+ //直接请求后端返回一个隐患编号
|
|
|
422
|
+ console.log('getYHID');
|
|
|
423
|
+ if (form.value.hdSelect === '即查即改') {
|
|
|
424
|
+ var url = 'safe/JuBaoHiddendanger/getYhbhTemp';
|
|
|
425
|
+ var param = {};
|
|
|
426
|
+ proxy.$axios.get(url, param).then(response => {
|
|
|
427
|
+ if (response.data.code == '0') {
|
|
|
428
|
+ form.value.hdId = response.data.data;
|
|
|
429
|
+ } else {
|
|
|
430
|
+ ElMessage.error('操作失败!' + response.data.msg);
|
|
|
431
|
+ }
|
|
|
432
|
+ });
|
|
|
433
|
+ } else {
|
|
|
434
|
+ form.value.hdId = '';
|
|
|
435
|
+ }
|
|
|
436
|
+};
|
|
|
437
|
+
|
|
|
438
|
+/* 整改人 */
|
|
|
439
|
+const leaderKeyzgr = guid();
|
|
|
440
|
+const PopupDepartmentLeaderNameRefzgr = ref();
|
|
|
441
|
+const handleDepartmentLeaderNamezgr = () => {
|
|
|
442
|
+ PopupDepartmentLeaderNameRefzgr.value.open();
|
|
|
443
|
+};
|
|
|
444
|
+
|
|
|
445
|
+const codeAndDesczgr = ref([]);
|
|
|
446
|
+const getDepartmentLeaderNamezgr = (item) => {
|
|
|
447
|
+ form.value.repairLeader = item.user.userCode;
|
|
|
448
|
+ form.value.repairLeaderDesc = item.user.userDesc;
|
|
|
449
|
+ form.value.repairDept = item.dept.deptName;
|
|
|
450
|
+};
|
|
|
451
|
+
|
|
|
452
|
+/* 其他整改人 */
|
|
|
453
|
+const leaderKey2qtzgr = guid();
|
|
|
454
|
+const PopupDepartmentLeaderNameRef2qtzgr = ref();
|
|
|
455
|
+const handleDepartmentLeaderName2qtzgr = () => {
|
|
|
456
|
+ PopupDepartmentLeaderNameRef2qtzgr.value.open();
|
|
|
457
|
+};
|
|
|
458
|
+
|
|
|
459
|
+const codeAndDesc2qtzgr = ref([]);
|
|
|
460
|
+const getDepartmentLeaderName2qtzgr = (items) => {
|
|
|
461
|
+ console.log('人员数据', items);
|
|
|
462
|
+ let codeList = [];
|
|
|
463
|
+ let descList = [];
|
|
|
464
|
+ for (let item of items) {
|
|
|
465
|
+ codeAndDesc2qtzgr.value.push(item.userCode + '-' + item.userDesc);
|
|
|
466
|
+ codeList.push(item.userCode);
|
|
|
467
|
+ descList.push(item.userDesc);
|
|
|
468
|
+ }
|
|
|
469
|
+ form.value.repairOther = codeList.join(',');
|
|
|
470
|
+ form.value.repairOtherDesc = descList.join(',');
|
|
|
471
|
+};
|
|
|
472
|
+
|
|
|
473
|
+/* 组织树选择 */
|
|
|
474
|
+const showBottom = ref(false);
|
|
|
475
|
+const handleTableDataUserDeptUpdate = async (nodeData) => {
|
|
|
476
|
+ let temp = nodeData.split('-');
|
|
|
477
|
+ if(temp[0].length<9){
|
|
|
478
|
+ showFailToast('请选择四级及以下部门')
|
|
|
479
|
+ return
|
|
|
480
|
+ }
|
|
|
481
|
+ form.value.hdLocation = temp[1];
|
|
|
482
|
+ form.value.hdLocationCode = temp[0];
|
|
|
483
|
+ form.value.hdConfirm = temp[2]
|
|
|
484
|
+ // form.value.repairDept = nodeData.deptCode + '-' + nodeData.deptName
|
|
|
485
|
+ showBottom.value = false;
|
|
|
486
|
+};
|
|
|
487
|
+const showPickerHandle = () => {
|
|
|
488
|
+ showBottom.value = true;
|
|
|
489
|
+};
|
|
|
490
|
+
|
|
|
491
|
+/**表单*/
|
|
|
492
|
+
|
|
|
493
|
+/***********************新图******************************/
|
|
|
494
|
+//公共区
|
|
|
495
|
+import { atob } from 'js-base64';
|
|
|
496
|
+
|
|
|
497
|
+const bucket = ref(import.meta.env.VITE_BUCKET);
|
|
|
498
|
+
|
|
|
499
|
+function base64ToBlob(base64) {
|
|
|
500
|
+ const contentType = base64.substring(base64.indexOf(':') + 1, base64.indexOf(';'));
|
|
|
501
|
+ const byteCharacters = atob(base64);
|
|
|
502
|
+ const byteArrays = [];
|
|
|
503
|
+
|
|
|
504
|
+ for (let i = 0; i < byteCharacters.length; i++) {
|
|
|
505
|
+ byteArrays.push(byteCharacters.charCodeAt(i));
|
|
|
506
|
+ }
|
|
|
507
|
+
|
|
|
508
|
+ const byteArray = new Uint8Array(byteArrays);
|
|
|
509
|
+ return new Blob([byteArray], { type: contentType });
|
|
|
510
|
+}
|
|
|
511
|
+
|
|
|
512
|
+const headers = ref({
|
|
|
513
|
+ token: localStorage.getItem('token'),
|
|
|
514
|
+ userId: localStorage.getItem('userId')
|
|
|
515
|
+});
|
|
|
516
|
+
|
|
|
517
|
+//整改前
|
|
|
518
|
+const fileList = ref([]);
|
|
|
519
|
+const afterRead = (file) => {
|
|
|
520
|
+ const content = base64ToBlob(file.content);
|
|
|
521
|
+ const formData = new FormData();
|
|
|
522
|
+ formData.append('fId', form.value.hdPicId);
|
|
|
523
|
+ formData.append('bucket', bucket.value);
|
|
|
524
|
+ formData.append('value1', null);
|
|
|
525
|
+ formData.append('value2', null);
|
|
|
526
|
+ formData.append('value3', null);
|
|
|
527
|
+ formData.append('value4', null);
|
|
|
528
|
+ formData.append('value5', null);
|
|
|
529
|
+ formData.append('file', content, file.file.name);
|
|
|
530
|
+ let url = import.meta.env.VITE_BASE_API + '/framework/Common/uploadFileS3';
|
|
|
531
|
+ proxy.$axios.post(url, formData, { headers: headers.value }).then(res => {
|
|
|
532
|
+ if (res.data.code === 0) {
|
|
|
533
|
+ showSuccessToast('上传成功');
|
|
|
534
|
+ getTableData();
|
|
|
535
|
+ } else {
|
|
|
536
|
+ showFailToast('上传失败' + res.data.msg);
|
|
|
537
|
+ }
|
|
|
538
|
+ }).catch(error => {
|
|
|
539
|
+ console.log(error);
|
|
|
540
|
+ });
|
|
|
541
|
+};
|
|
|
542
|
+const getTableData = () => {
|
|
|
543
|
+ //携带自定义参数
|
|
|
544
|
+ var url = 'framework/Common/queryFileWithValues';
|
|
|
545
|
+ var param = {
|
|
|
546
|
+ fId: form.value.hdPicId, //必填
|
|
|
547
|
+ value1: null, //非必填
|
|
|
548
|
+ value2: null, //非必填
|
|
|
549
|
+ value3: null, //非必填
|
|
|
550
|
+ value4: null, //非必填
|
|
|
551
|
+ value5: null //非必填
|
|
|
552
|
+ };
|
|
|
553
|
+ proxy.$axios.get(url, param).then(response => {
|
|
|
554
|
+ if (response.data.code === 0) {
|
|
|
555
|
+ for (var item of response.data.data) {
|
|
|
556
|
+ fileList.value.push({
|
|
|
557
|
+ id: item.id,
|
|
|
558
|
+ uploadFile: item.fileName,
|
|
|
559
|
+ url: import.meta.env.VITE_BASE_API +
|
|
|
560
|
+ '/framework/Common/downloadFileS3?bucket=' + bucket.value +
|
|
|
561
|
+ '&id=' + item.id
|
|
|
562
|
+ });
|
|
|
563
|
+ form.value.picBefore = fileList.value[0].url;
|
|
|
564
|
+ }
|
|
|
565
|
+ } else {
|
|
|
566
|
+ showFailToast('失败!' + response.data.msg);
|
|
|
567
|
+ }
|
|
|
568
|
+ });
|
|
|
569
|
+};
|
|
|
570
|
+/* 在线删除 */
|
|
|
571
|
+const showDialogVisible = ref(false);
|
|
|
572
|
+const deleteInfo = ref();
|
|
|
573
|
+const handleDelete = (row) => {
|
|
|
574
|
+ showDialogVisible.value = true;
|
|
|
575
|
+ deleteInfo.value = row;
|
|
|
576
|
+};
|
|
|
577
|
+const onDelete = () => {
|
|
|
578
|
+ let url = 'framework/Common/removeFile';
|
|
|
579
|
+ let param = {
|
|
|
580
|
+ id: deleteInfo.value.id
|
|
|
581
|
+ };
|
|
|
582
|
+ proxy.$axios.post(url, param).then(response => {
|
|
|
583
|
+ if (response.data.code === 0) {
|
|
|
584
|
+ showSuccessToast('删除成功!');
|
|
|
585
|
+ getTableData();
|
|
|
586
|
+ } else {
|
|
|
587
|
+ showFailToast('删除失败;' + response.data.msg);
|
|
|
588
|
+ }
|
|
|
589
|
+ });
|
|
|
590
|
+};
|
|
|
591
|
+
|
|
|
592
|
+//隐患选择
|
|
|
593
|
+const selectOption = (option) => {
|
|
|
594
|
+ if (form.value.workId.length > 0) {
|
|
|
595
|
+ return;
|
|
|
596
|
+ }
|
|
|
597
|
+ form.value.hdSelect = option;
|
|
|
598
|
+ if (option === '隐患举报') {
|
|
|
599
|
+ isStandardFlow.value = true;
|
|
|
600
|
+ } else if (option === '即查即改') {
|
|
|
601
|
+ isStandardFlow.value = false;
|
|
|
602
|
+ }
|
|
|
603
|
+ getYHID();
|
|
|
604
|
+};
|
|
|
605
|
+
|
|
|
606
|
+/**修改发现时间**/
|
|
|
607
|
+// 日期选择器取消
|
|
|
608
|
+const cancelDatePicker = () => {
|
|
|
609
|
+ showDatetimePicker.value = false;
|
|
|
610
|
+ resetDatetime();
|
|
|
611
|
+};
|
|
|
612
|
+
|
|
|
613
|
+// 时间选择器取消
|
|
|
614
|
+const cancelTimePicker = () => {
|
|
|
615
|
+ resetDatetime();
|
|
|
616
|
+ // 重置为当前时间或从表单获取时间
|
|
|
617
|
+ if (form.value.accidentTime) {
|
|
|
618
|
+ const dt = new Date(form.value.accidentTime);
|
|
|
619
|
+ currentTime.value = [
|
|
|
620
|
+ String(dt.getHours()).padStart(2, '0'),
|
|
|
621
|
+ String(dt.getMinutes()).padStart(2, '0'),
|
|
|
622
|
+ String(dt.getSeconds()).padStart(2, '0')
|
|
|
623
|
+ ];
|
|
|
624
|
+ } else {
|
|
|
625
|
+ const now = new Date();
|
|
|
626
|
+ currentTime.value = [
|
|
|
627
|
+ String(now.getHours()).padStart(2, '0'),
|
|
|
628
|
+ String(now.getMinutes()).padStart(2, '0'),
|
|
|
629
|
+ String(now.getSeconds()).padStart(2, '0')
|
|
|
630
|
+ ];
|
|
|
631
|
+ }
|
|
|
632
|
+};
|
|
|
633
|
+/**修改发现时间**/
|
|
|
634
|
+
|
|
|
635
|
+/**控制显示**/
|
|
|
636
|
+const showSeriousInjuryCount = ref(false)
|
|
|
637
|
+const showDeathCount = ref(false)
|
|
|
638
|
+const showEconomicLoss = ref(false)
|
|
|
639
|
+
|
|
|
640
|
+/**控制输入**//*
|
|
|
641
|
+const onInput = (value) =>{
|
|
|
642
|
+ console.log('输入的值', value)
|
|
|
643
|
+ // 1. 过滤所有非数字和非小数点的字符(只保留数字和一个小数点)
|
|
|
644
|
+ // let value = val.replace(/[^\d.]/g, '');
|
|
|
645
|
+
|
|
|
646
|
+ // 2. 处理多个小数点:只保留第一个小数点,后续的小数点删除
|
|
|
647
|
+ // const dotIndex = value.indexOf('.');
|
|
|
648
|
+ if (value !== -1) {
|
|
|
649
|
+ // 从第一个小数点后开始,删除所有其他小数点
|
|
|
650
|
+ value = value.slice(0, dotIndex + 1) + value.slice(dotIndex + 1).replace(/\./g, '');
|
|
|
651
|
+ }
|
|
|
652
|
+
|
|
|
653
|
+ // 3. 处理开头为小数点的情况:自动补0(如 .123 → 0.123)
|
|
|
654
|
+ if (value.startsWith('.')) {
|
|
|
655
|
+ value = '0' + value;
|
|
|
656
|
+ }
|
|
|
657
|
+
|
|
|
658
|
+ // 4. 限制小数位最多3位:如果有小数点,截取小数点后前3位
|
|
|
659
|
+ if (value.includes('.')) {
|
|
|
660
|
+ const parts = value.split('.');
|
|
|
661
|
+ // 整数部分 + 小数点 + 小数部分前3位
|
|
|
662
|
+ value = parts[0] + '.' + (parts[1] || '').slice(0, 3);
|
|
|
663
|
+ }
|
|
|
664
|
+
|
|
|
665
|
+ // 5. 赋值给表单(避免空值时显示undefined)
|
|
|
666
|
+ form.value.economicLoss = value || '';
|
|
|
667
|
+}*/
|
|
|
668
|
+
|
|
|
669
|
+/**控制键盘删除**/
|
|
|
670
|
+const cKeyDelete = () => {
|
|
|
671
|
+ if (!form.value.economicLoss) return; // 为空时不操作
|
|
|
672
|
+
|
|
|
673
|
+ // 截取掉最后一个字符
|
|
|
674
|
+ let value = form.value.economicLoss.slice(0, -1);
|
|
|
675
|
+
|
|
|
676
|
+ // 处理删除后可能出现的不合理格式(比如只剩小数点)
|
|
|
677
|
+ if (value === '.') {
|
|
|
678
|
+ value = ''; // 如果删除后只剩小数点,清空
|
|
|
679
|
+ }
|
|
|
680
|
+
|
|
|
681
|
+ form.value.economicLoss = value;
|
|
|
682
|
+}
|
|
|
683
|
+
|
|
|
684
|
+/**计算属性**/
|
|
|
685
|
+//计算属性
|
|
|
686
|
+const accidentLevel = computed(()=>{
|
|
|
687
|
+ if(form.value.deathCount>=30 || form.value.economicLoss>=100000 || form.value.seriousInjuryCount>=100){
|
|
|
688
|
+ return '特别重大事故'
|
|
|
689
|
+ }else if(form.value.deathCount>=10 || form.value.economicLoss>=5000 || form.value.seriousInjuryCount>=50){
|
|
|
690
|
+ return '重大事故'
|
|
|
691
|
+ }else if(form.value.deathCount>=3 || form.value.economicLoss>=1000 || form.value.seriousInjuryCount>=10){
|
|
|
692
|
+ return '较大事故'
|
|
|
693
|
+ }else{
|
|
|
694
|
+ return '一般事故'
|
|
|
695
|
+ }
|
|
|
696
|
+})
|
|
|
697
|
+
|
|
|
698
|
+</script>
|
|
|
699
|
+
|
|
|
700
|
+<style scoped>
|
|
|
701
|
+.h5-container {
|
|
|
702
|
+ width: 100%;
|
|
|
703
|
+ box-sizing: border-box;
|
|
|
704
|
+ height: 100vh;
|
|
|
705
|
+ background-color: white;
|
|
|
706
|
+ padding: 10px;
|
|
|
707
|
+ padding-bottom: 20px;
|
|
|
708
|
+}
|
|
|
709
|
+
|
|
|
710
|
+.radio-group {
|
|
|
711
|
+ display: flex;
|
|
|
712
|
+ background-color: white;
|
|
|
713
|
+ padding: 10px;
|
|
|
714
|
+ border-radius: 5px;
|
|
|
715
|
+ margin: 10px 0;
|
|
|
716
|
+ gap: 10px;
|
|
|
717
|
+}
|
|
|
718
|
+
|
|
|
719
|
+.radio-item {
|
|
|
720
|
+ padding: 8px 12px;
|
|
|
721
|
+ border: 1px solid #222;
|
|
|
722
|
+ border-radius: 4px;
|
|
|
723
|
+ background-color: white;
|
|
|
724
|
+ cursor: pointer;
|
|
|
725
|
+ transition: background-color 0.3s ease;
|
|
|
726
|
+ /* 添加过渡效果 */
|
|
|
727
|
+}
|
|
|
728
|
+
|
|
|
729
|
+.radio-item.active {
|
|
|
730
|
+ background-color: #4285f4;
|
|
|
731
|
+ /* 选中时的蓝色 */
|
|
|
732
|
+ color: white;
|
|
|
733
|
+ border-color: #4285f4;
|
|
|
734
|
+}
|
|
|
735
|
+</style>
|