瀏覽代碼

事故举报台账

黄鲁亚 2 週之前
父節點
當前提交
47ecb30889

+ 5
- 0
src/router/index.ts 查看文件

@@ -554,6 +554,11 @@ const router = createRouter({
554 554
 			name: 'accidentJuBao_edit',
555 555
 			component: () => import('@/view/accidentManager/accidentJuBao/accidentJuBao_edit/index.vue')
556 556
 		},
557
+		{
558
+			path: '/accidentManager/accidentJuBaoLedger/index',
559
+			name: 'accidentJuBaoLedger',
560
+			component: () => import('@/view/accidentManager/accidentJuBaoLedger/index.vue')
561
+		},
557 562
 	]
558 563
 })
559 564
 

+ 1
- 1
src/view/accidentManager/accidentJuBao/index.vue 查看文件

@@ -5,7 +5,7 @@
5 5
         <van-icon name="add" size="25" color="#000" />
6 6
       </template>
7 7
     </van-nav-bar>
8
-    <van-search v-model="query.discovererDesc" show-action placeholder="请输入发现人" @search="onRefresh"
8
+    <van-search v-if="false" v-model="query.discovererDesc" show-action placeholder="请输入发现人" @search="onRefresh"
9 9
       @cancel="handdelect" />
10 10
 
11 11
     <!-- 项目列表 -->

+ 735
- 0
src/view/accidentManager/accidentJuBaoLedger/accidentJuBao_edit/index.vue 查看文件

@@ -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>

+ 867
- 0
src/view/accidentManager/accidentJuBaoLedger/index.vue 查看文件

@@ -0,0 +1,867 @@
1
+<template>
2
+  <div class="h5-container">
3
+    <van-nav-bar title="事故举报台账" @click-left="onClickLeft" @click-right="handAdd('add','XY')">
4
+      <template v-if="false" #right>
5
+        <van-icon name="add" size="25" color="#000" />
6
+      </template>
7
+    </van-nav-bar>
8
+    <van-search v-if="false" v-model="query.discovererDesc" show-action placeholder="请输入发现人" @search="onRefresh"
9
+      @cancel="handdelect" />
10
+
11
+    <!-- 项目列表 -->
12
+    <van-pull-refresh v-model="isRefreshing" success-text="刷新成功" @refresh="onRefresh">
13
+      <van-list v-model:loading="isLoading" :finished="isFinished" finished-text="没有更多了" offset="200" @load="onLoad">
14
+        <div v-for="(item, idx) in resultData" :key="item.id">
15
+          <van-swipe-cell @open="handleSwipeOpen(item,idx)" @close="handleSwipeClose(item,idx)" title-style="color: #007aff" style="height: 80px;" :ref="el => getSwipeCellRef(el, idx)">
16
+            <template #default>
17
+              <div class="swipe-cell-default">
18
+                <van-cell style="min-height: 100px; padding: 0 0 0 0; display: flex; align-items: flex-start;" @click="handAdd('look',item)">
19
+                  <template #title>
20
+                    <div class="cell-title">
21
+                      {{ item.hdDescription }}
22
+                    </div>
23
+                  </template>
24
+                  <template #label>
25
+                    <div>事故地点:{{ item.accidentLocation }}</div>
26
+                    <div>发生时间:{{ item.accidentTime }}</div>
27
+                    <div>事故类型:{{ item.accidentType }}</div>
28
+                    <div>事故等级:{{ item.accidentLevel }}</div>
29
+                  </template>
30
+                </van-cell>
31
+                <div v-if="false" class="swipe-cell-default-icon">
32
+                  <van-icon v-if="openStatus[idx]" name="arrow-double-left" @click.stop="openSwipe(idx)" />
33
+                  <van-icon v-else name="arrow-double-right" @click.stop="closeSwipe(idx)" />
34
+                </div>
35
+              </div>
36
+            </template>
37
+
38
+            <template v-if="false" #right>
39
+              <van-button square class="edit-button" text="编辑" @click="handAdd('edit', item)" />
40
+              <van-button square class="delete-button" text="删除" @click="handleDelete(item, idx)" />
41
+            </template>
42
+          </van-swipe-cell>
43
+        </div>
44
+
45
+      </van-list>
46
+    </van-pull-refresh>
47
+
48
+
49
+    <!-- 删除确认弹窗 -->
50
+    <van-dialog v-model:show="deleteDialogVisible" show-cancel-button @confirm="confirmDelete">
51
+      <template #title>
52
+        <div>删除确认</div>
53
+      </template>
54
+      <div style="padding: 30px;">确定要删除该事故记录吗?</div>
55
+    </van-dialog>
56
+
57
+  </div>
58
+</template>
59
+
60
+<script setup>
61
+import { ref, reactive, onMounted, getCurrentInstance, nextTick, toRaw } from 'vue';
62
+import { Dialog, showDialog, showSuccessToast, showToast, Toast } from 'vant';
63
+
64
+const { proxy } = getCurrentInstance();
65
+
66
+const onClickLeft = () => {
67
+  history.back();
68
+};
69
+const headers = ref({
70
+  token: localStorage.getItem('token'),
71
+  userId: localStorage.getItem('userId'),
72
+  dept: JSON.parse(localStorage.getItem('dept'))[0].deptCode
73
+});
74
+const switchIconState = (idx) => {
75
+  openStatus.value[idx] = !openStatus.value[idx]
76
+  openStatus.value = new Array(resultData.value.length).fill(true);
77
+}
78
+
79
+// const onClickRight = () =>{
80
+//   searchShow.value = !searchShow.value;
81
+// }
82
+
83
+const searchShow = ref(false);
84
+const query = ref({
85
+  discovererDesc: '',
86
+  hdSelect:'隐患举报'
87
+});
88
+
89
+function formatDate(date, format) {
90
+  const year = date.getFullYear();
91
+  const month = date.getMonth() + 1;
92
+  const day = date.getDate();
93
+  const hours = date.getHours();
94
+  const minutes = date.getMinutes();
95
+  const seconds = date.getSeconds();
96
+
97
+  return format
98
+    .replace('yyyy', year)
99
+    .replace('MM', month.toString().padStart(2, '0'))
100
+    .replace('dd', day.toString().padStart(2, '0'))
101
+    .replace('HH', hours.toString().padStart(2, '0'))
102
+    .replace('mm', minutes.toString().padStart(2, '0'))
103
+    .replace('ss', seconds.toString().padStart(2, '0'));
104
+}
105
+
106
+const tableData = ref([]);
107
+const selectedRows = ref([]);
108
+const dialogVisibleLook = ref(false);
109
+const deleteDialogVisible = ref(false);
110
+const currentDeleteItem = ref([]);
111
+const dialogVisible = ref(false);
112
+const dialogVisibleFile = ref(false);
113
+const date = ref(null);
114
+
115
+const kz = ref(true);
116
+const handAdd = async (flag,item) => {
117
+  if('add'===flag) {
118
+    // 将表单数据置空
119
+    resetForma();
120
+    //todo 编辑页面
121
+    proxy.$router.push({
122
+      path: '/accidentManager/accidentJuBao/accidentJuBao_edit/index',
123
+      query: {
124
+        flag:'add'
125
+      }
126
+    });
127
+  }else if('edit'===flag) { 
128
+    proxy.$router.push({
129
+      path: '/accidentManager/accidentJuBao/accidentJuBao_edit/index',
130
+      query: {
131
+        id:item.id,
132
+        flag:'edit'
133
+      }
134
+    })
135
+  }else {
136
+    proxy.$router.push({
137
+      path: '/accidentManager/accidentJuBao/accidentJuBao_edit/index',
138
+      query: {
139
+        id:item.id,
140
+        flag:'look'
141
+      }
142
+    })
143
+  }
144
+};
145
+// 定义表单数据
146
+const form = ref({
147
+  hdPicId: '',
148
+  hdId: '',
149
+  hdType: '',
150
+  discoveryTime: '',
151
+  hdSubtype: '',
152
+  discoverer: '',
153
+  discovererOther: '',
154
+  hdDescription: '',
155
+  hdLevel: '',
156
+  bz: '',
157
+  hdLocation: '',
158
+  picBefore: '',
159
+
160
+  equipmentId: '',
161
+  hdmanageLevel: '',
162
+  handlingProcesses: '',
163
+  companyId: '',
164
+  repairLeader: '',
165
+  repairOther: '',
166
+  repairSuggest: '',
167
+  repairDdl: '',
168
+  repairDept: '',
169
+  acceptLeader: '',
170
+  acceptOther: '',
171
+  picAfter: '',
172
+  picTemp: '',
173
+  repairDescription: '',
174
+  discovererDept: '',
175
+  discovererDeptCode: '',
176
+  hdLocationCode: '',
177
+  hdLocationName: '',
178
+
179
+  status: '',
180
+
181
+
182
+  hdSelect: '隐患举报',
183
+  id: ''
184
+});
185
+const resetForma = () => {
186
+  form.value = {
187
+    hdPicId: '',
188
+    hdId: '',
189
+    hdType: '',
190
+    discoveryTime: '',
191
+    hdSubtype: '',
192
+    discoverer: '',
193
+    discovererOther: '',
194
+    hdDescription: '',
195
+    hdLevel: '',
196
+    bz: '',
197
+    hdLocation: '',
198
+    picBefore: '',
199
+
200
+    equipmentId: '',
201
+    hdmanageLevel: '',
202
+    handlingProcesses: '',
203
+    companyId: '',
204
+    repairLeader: '',
205
+    repairOther: '',
206
+    repairSuggest: '',
207
+    repairDdl: '',
208
+    repairDept: '',
209
+    acceptLeader: '',
210
+    acceptOther: '',
211
+    picAfter: '',
212
+    picTemp: '',
213
+    repairDescription: '',
214
+    status: '',
215
+    discovererDept: '',
216
+    discovererDeptCode: '',
217
+    hdLocationCode: '',
218
+    hdLocationName: '',
219
+
220
+    hdSelect: '隐患举报',
221
+    id: ''
222
+  };
223
+};
224
+
225
+const isRefreshing = ref(false);
226
+const isLoading = ref(false);
227
+const isFinished = ref(false);
228
+const currentPage = ref(1);
229
+const pageSize = ref(10);
230
+const totalRows = ref(0);
231
+const resultData = ref([]);
232
+
233
+const getTableData = async () => {
234
+  const url = 'sgsafe/AccidentDirect/query';
235
+  const param = {
236
+    page: currentPage.value,
237
+    rows: pageSize.value,
238
+    params: JSON.stringify(query.value)
239
+  };
240
+  const response = await proxy.$axios.get(url, param);
241
+  if (response.data.code === 0) {
242
+    tableData.value = response.data.data.records;
243
+    totalRows.value = response.data.data.total;
244
+    // tableData.value.forEach(item => {
245
+    //   switch (item.status) {
246
+    //     case '0':
247
+    //       item.status = '隐患登记';
248
+    //       break;
249
+    //     case '1':
250
+    //       item.status = '隐患分析确认';
251
+    //       break;
252
+    //     case '2':
253
+    //       item.status = '隐患整改';
254
+    //       break;
255
+    //     case '3':
256
+    //       item.status = '隐患验收';
257
+    //       break;
258
+    //     case '4':
259
+    //       item.status = '隐患销号';
260
+    //       break;
261
+    //     case '5':
262
+    //       item.status = '结束';
263
+    //       break;
264
+    //     case '-1':
265
+    //       item.status = '待提交';
266
+    //       break;
267
+    //   }
268
+    // });
269
+  } else {
270
+    showToast({
271
+      type: 'error',
272
+      message: '操作失败!' + response.data.msg
273
+    });
274
+  }
275
+};
276
+
277
+const onRefresh = () => {
278
+  basicReset();
279
+  onLoad();
280
+};
281
+
282
+const onLoad = async () => {
283
+  if (isRefreshing.value) {
284
+    resultData.value = [];
285
+    currentPage.value = 1;
286
+    isRefreshing.value = false;
287
+  }
288
+  try {
289
+    await getTableData();
290
+    if (pageSize.value * currentPage.value < totalRows.value) {
291
+      resultData.value = [...resultData.value, ...tableData.value];
292
+      openStatus.value = new Array(resultData.value.length).fill(true);
293
+      currentPage.value++;
294
+
295
+    } else {
296
+      resultData.value = [...resultData.value, ...tableData.value];
297
+      openStatus.value = new Array(resultData.value.length).fill(true);
298
+      isFinished.value = true;
299
+    }
300
+  } catch (error) {
301
+    console.log(error);
302
+    isFinished.value = true;
303
+  } finally {
304
+    isLoading.value = false;
305
+  }
306
+};
307
+/* 通用方法: 重置list数据 */
308
+const basicReset = () => {
309
+  isFinished.value = false;
310
+  isLoading.value = true;
311
+  currentPage.value = 1;
312
+  resultData.value = [];
313
+};
314
+
315
+/*onMounted(() => {
316
+  handleSearch();
317
+});
318
+
319
+const handleSearch = () => {
320
+/!*  currentPage.value = 1;
321
+  isFinished.value = false;
322
+  tableData.value = [];*!/
323
+  basicReset()
324
+  onLoad()
325
+};*/
326
+
327
+const handdelect = () => {
328
+  query.value.discoverer = '';
329
+  onRefresh()
330
+};
331
+
332
+const handleDetailLook = (row) => {
333
+  form.value = { ...row };
334
+  proxy.$router.push({
335
+    name: 'taiZhang_detail',
336
+    query: {
337
+      form: form.value.id
338
+    }
339
+  });
340
+  // dialogVisibleLook.value = true;
341
+};
342
+const deleteId = ref('')
343
+const handleDelete = (item, idx) => {
344
+  openStatus.value[idx] = !openStatus.value[idx]
345
+  openStatus.value = new Array(resultData.value.length).fill(true);
346
+  deleteId.value = item.id
347
+  deleteDialogVisible.value = true;
348
+};
349
+
350
+const confirmDelete = () => {
351
+  var url = 'sgsafe/AccidentDirect/remove';
352
+  var param = {
353
+    id: deleteId.value
354
+  };
355
+  proxy.$axios.get(url, param).then(response => {
356
+    if (response.data.code == 0) {
357
+      showToast({
358
+        type: 'success',
359
+        message: '删除成功'
360
+      });
361
+      onRefresh();
362
+    } else {
363
+      showToast({
364
+        type: 'fail',
365
+        message: '操作失败!' + response.data.msg
366
+      });
367
+    }
368
+  });
369
+};
370
+
371
+const edits = (row) => {
372
+  form.value = { ...row };
373
+  if (row.workId) {
374
+    sessionStorage.setItem('workflowQuery', JSON.stringify({
375
+      flowId: row.flowId,
376
+      workId: row.workId,
377
+      trackId: row.trackId,
378
+      // subjectionId: '0703E25C35BD11B2A553E9317BF53B18',
379
+      // subjectionId: '0703E25C35BD11B2A553E9317BF53B18',
380
+      type: '1',
381
+      date: new Date().getTime()
382
+    }));
383
+    proxy.$router.push({
384
+      path: '/yinhuan/JuBaohdLedger_detail'
385
+    });
386
+  } else {
387
+    proxy.$router.push({
388
+      path: '/yinhuan/JuBaoregistration_edit/index',
389
+      query: {
390
+        id: form.value.id
391
+      }
392
+    });
393
+  }
394
+
395
+};
396
+
397
+
398
+const resetForm = () => {
399
+  form.value = {
400
+    projectName: '',
401
+    projectLeader: '',
402
+    phone: '',
403
+    dept: ''
404
+  };
405
+};
406
+
407
+const baocun = () => {
408
+  nextTick(() => {
409
+    if (form.value.hdSelect === '隐患举报') {
410
+      form.value.status = '0';
411
+    } else if (form.value.hdSelect === '下发隐患') {
412
+      form.value.status = '2';
413
+    } else {
414
+      form.value.status = '-1';
415
+    }
416
+  });
417
+  // 原有保存逻辑保持不变
418
+  var url = 'sgsafe/JuBaoHiddendanger/save';
419
+  var param = {
420
+    json: JSON.stringify(form.value)
421
+  };
422
+  proxy.$axios.post(url, param).then(response => {
423
+    if (response.data.code == '0') {
424
+      showSuccessToast('保存成功!');
425
+      getTableData();
426
+      orJsons();
427
+      // clearDeptUsers()
428
+    } else {
429
+      showToast({
430
+        type: 'fail',
431
+        message: '操作失败!' + response.data.msg
432
+      });
433
+    }
434
+  });
435
+};
436
+
437
+//处理人员code
438
+const repairLL = ref('');
439
+const repairOO = ref('');
440
+const acceptLL = ref('');
441
+const orJsons = () => {
442
+  // console.log('forms',form.value)
443
+  if (form.value.hdSelect === '隐患举报') {
444
+    nextTick(() => {
445
+      nextTick(() => {
446
+        repairLL.value = qq('repairLL', form.value.discoverer);//隐患发现人
447
+        nextTick(() => {
448
+          repairOO.value = qq('repairOO', form.value.discovererOther);//其他隐患发现人
449
+          nextTick(() => {
450
+            acceptLL.value = qq('acceptLL', form.value.discoverer);//隐患销号人
451
+          });
452
+        });
453
+      });
454
+
455
+      // acceptOO.value = qq('acceptOO', form.value.acceptOther)
456
+    });
457
+  } else {
458
+    // console.log('noiajdoifjpoewjfopjp')
459
+    nextTick(() => {
460
+      nextTick(() => {
461
+        repairLL.value = qq('repairLL', form.value.acceptLeader);//隐患发现人
462
+        nextTick(() => {
463
+          repairOO.value = qq('repairOO', form.value.acceptOther);//其他隐患发现人
464
+          nextTick(() => {
465
+            acceptLL.value = qq('acceptLL', form.value.discoverer);//隐患销号人
466
+          });
467
+        });
468
+      });
469
+
470
+      // acceptOO.value = qq('acceptOO', form.value.acceptOther)
471
+    });
472
+  }
473
+};
474
+
475
+const jsons = ref({});
476
+const qq = (a, val) => {
477
+  let aa = '';
478
+  var url = 'sgsafe/JuBaoHiddendanger/qqId';
479
+  var param = {
480
+    params: val
481
+  };
482
+  proxy.$axios.post(url, param).then(response => {
483
+    if (response.data.code == 0) {
484
+
485
+      aa = response.data.data;
486
+      switch (a) {
487
+        case 'repairLL':
488
+          repairLL.value = response.data.data;
489
+          // console.log('repairLL',repairLL.value);
490
+          break;
491
+        case 'repairOO':
492
+          repairOO.value = response.data.data;
493
+          // console.log('repairOO',repairLL.value);
494
+          break;
495
+        case 'acceptLL':
496
+          acceptLL.value = response.data.data;
497
+          // console.log('acceptLL',repairLL.value);
498
+          break;
499
+        default:
500
+          break;
501
+      }
502
+      jsons.value = {
503
+        hdConfirm: repairLL.value,
504
+        hdConfirmO: repairOO.value,
505
+        hdCancel: acceptLL.value
506
+      };
507
+
508
+      // 处理函数
509
+      function processValue(value) {
510
+        // 将逗号替换为分号
511
+        const replacedValue = value.replace(/,/g, ';');
512
+        // 分割值
513
+        const parts = replacedValue.split(';');
514
+        // 每个部分前加上 U_
515
+        const processedParts = parts.map(part => `U_${part.trim()}`);
516
+        // 重新组合
517
+        return processedParts.join(';');
518
+      }
519
+
520
+      // 处理整个对象
521
+      const processedData = {};
522
+      for (const key in jsons.value) {
523
+        if (jsons.value.hasOwnProperty(key)) {
524
+          processedData[key] = processValue(jsons.value[key]);
525
+        }
526
+      }
527
+
528
+      console.log('对象', toRaw(processedData));
529
+
530
+      let b = {
531
+        acceptL: processedData.hdConfirm,
532
+        acceptO: processedData.hdConfirmO,
533
+        id: form.value.id
534
+      };
535
+
536
+      if (form.value.hdSelect === '即查即改') {
537
+        b = {
538
+          hdFxr: processedData.hdCancel,
539
+          id: form.value.id
540
+        };
541
+      }
542
+
543
+      if (form.value.hdSelect === '隐患举报') {
544
+        b = {
545
+          // hdConfirm: processedData.hdConfirm,
546
+          // hdConfirmO: processedData.hdConfirmO,
547
+          id: form.value.id
548
+        };
549
+      }
550
+
551
+      const aaa = JSON.stringify(toRaw(b));
552
+      sessionStorage.setItem('variables', aaa);
553
+      console.log('aaa', aaa);
554
+    } else {
555
+      showToast({
556
+        type: 'fail',
557
+        message: '操作失败!' + response.data.msg
558
+      });
559
+    }
560
+  });
561
+  return aa;
562
+};
563
+
564
+const reback = () => {
565
+  // 返回逻辑
566
+};
567
+
568
+const deleteRow = (row) => {
569
+  selectedRows.value = [row];
570
+  handleDelete(row);
571
+};
572
+
573
+const deleteRowa = (row) => {
574
+  deleteRow(row);
575
+};
576
+
577
+const bm = (val) => {
578
+  // 部门选择逻辑
579
+};
580
+
581
+//提交审批流程
582
+import { workflowSubmit, workflowCancel } from '@/tools/workflow.js';
583
+
584
+const flowId = ref('');
585
+flowId.value = 'hdRwardReportingId';
586
+const handleSubmit2 = (val, idx) => {
587
+  openStatus.value[idx] = !openStatus.value[idx]
588
+  openStatus.value = new Array(resultData.value.length).fill(true);
589
+  console.log('提交');
590
+  console.log('selectedRows', selectedRows.value);
591
+  let row = val;
592
+  form.value = { ...row }
593
+  form.value.workCreate = headers.value.dept;
594
+
595
+  let b = {
596
+    id: form.value.id,
597
+    hdConfirm:form.value.hdConfirm
598
+  }
599
+  const aaa = JSON.stringify(toRaw(b))
600
+  sessionStorage.setItem('variables', aaa)
601
+
602
+  if (form.value.hdSelect === '隐患举报') {
603
+    flowId.value = 'hdRwardReportingId'
604
+  } 
605
+
606
+  console.log('----');
607
+  console.log(flowId.value);
608
+  console.log(sessionStorage.getItem('variables'));
609
+  console.log(row.workId);
610
+  console.log(row.trackId);
611
+  let titles = '隐患举报'
612
+  showDialog({
613
+    title: '提示',
614
+    message: '确定提交审批?',
615
+    showCancelButton: true,
616
+    confirmButtonText: '确定',
617
+    type: 'warning',
618
+    cancelButtonText: '取消'
619
+  }
620
+  ).then(() => {
621
+    return workflowSubmit(
622
+      flowId.value,
623
+      '隐患举报',
624
+      '初始化提交',
625
+      // JSON.stringify({}),
626
+      sessionStorage.getItem('variables'),
627
+      row.workId,
628
+      row.trackId);
629
+  }).then((result) => {
630
+    if (result.status === 'success') {
631
+      // 将结果返回的workId和trackId保存
632
+      var url = 'sgsafe/JuBaoHiddendanger/saveProcessInfo';
633
+      console.log('id', result, row.id);
634
+      var process = {
635
+        'id': form.value.id,
636
+        'workId': result.workId,
637
+        'trackId': result.trackId
638
+      };
639
+      var param = {
640
+        json: JSON.stringify(process)
641
+      };
642
+      proxy.$axios.post(url, param).then(response => {
643
+        if (response.data.code === 0) {
644
+          form.value = response.data.data;
645
+          console.log('我要进来啦保存成功');
646
+          showToast({
647
+            type: 'success',
648
+            message: '提交审批成功'
649
+          });
650
+          onRefresh()
651
+        }
652
+      });
653
+    } else {
654
+      showToast({
655
+        type: 'error',
656
+        message: '提交审批失败,' + result.msg
657
+      });
658
+    }
659
+  }).catch(() => {
660
+    showToast({
661
+      type: 'info',
662
+      message: '已取消提交'
663
+    });
664
+  });
665
+};
666
+
667
+
668
+const getStatusClass = (status) => {
669
+  switch (status) {
670
+    case '-1':
671
+      return 'status-pending';
672
+    case '0':
673
+      return 'status-registered';
674
+    case '1':
675
+      return 'status-analyzing';
676
+    case '2':
677
+      return 'status-rectifying';
678
+    case '3':
679
+      return 'status-accepting';
680
+    case '4':
681
+      return 'status-closed';
682
+    case '5':
683
+      return 'status-finished';
684
+    default:
685
+      return 'status-unknown';
686
+  }
687
+};
688
+
689
+/**
690
+ * 按钮实现swipe-cell滑动
691
+ */
692
+const openStatus = ref([])
693
+const swipeCellRefs = ref([])
694
+const getSwipeCellRef = (el, index) => {
695
+  if (el) {
696
+    swipeCellRefs.value[index] = el;
697
+  }
698
+}
699
+const openSwipe = (idx) => {
700
+  openStatus.value = new Array(resultData.value.length).fill(true);
701
+  if (idx >= 0 && idx < swipeCellRefs.value.length) {
702
+    openStatus.value[idx] = false
703
+    swipeCellRefs.value[idx].open('right')
704
+  }
705
+  document.addEventListener('click', handleDocumentClick)
706
+}
707
+/**
708
+ * 当点击滑动单元格时,开始监听点击事件
709
+ */
710
+const handleDocumentClick = (event) => {
711
+  openStatus.value = new Array(resultData.value.length).fill(true);
712
+}
713
+
714
+const closeSwipe = (idx) => {
715
+  if (idx >= 0 && idx < swipeCellRefs.value.length) {
716
+    openStatus.value[idx] = true
717
+    swipeCellRefs.value[idx].close()
718
+  }
719
+}
720
+
721
+/**滑动监听**/
722
+const handleSwipeOpen = (item,idx) =>{
723
+  console.log('handleSwipeOpen', idx)
724
+  console.log('handleSwipeOpen数据', item)
725
+  openStatus.value[idx] = false
726
+}
727
+
728
+const handleSwipeClose = (item,idx) =>{
729
+  openStatus.value[idx] = true
730
+  console.log('handleSwipeClose', idx)
731
+  console.log('handleSwipeClose数据', item)
732
+}
733
+
734
+</script>
735
+
736
+<style scoped>
737
+.h5-container {
738
+  width: 100%;
739
+  padding: 5px;
740
+  box-sizing: border-box;
741
+}
742
+
743
+.status-pending {
744
+  background-color: #fff3cd;
745
+  color: #856404;
746
+  padding: 2px 4px;
747
+  border-radius: 4px;
748
+}
749
+
750
+.status-registered {
751
+  background-color: #d1ecf1;
752
+  color: #0c5460;
753
+  padding: 2px 4px;
754
+  border-radius: 4px;
755
+}
756
+
757
+.status-analyzing {
758
+  background-color: #fff8e1;
759
+  color: #ff8f00;
760
+  padding: 2px 4px;
761
+  border-radius: 4px;
762
+}
763
+
764
+.status-rectifying {
765
+  background-color: #e8f5e9;
766
+  color: #2e7d32;
767
+  padding: 2px 4px;
768
+  border-radius: 4px;
769
+}
770
+
771
+.status-accepting {
772
+  background-color: #e3f2fd;
773
+  color: #1565c0;
774
+  padding: 2px 4px;
775
+  border-radius: 4px;
776
+}
777
+
778
+.status-closed {
779
+  background-color: #f8bbd0;
780
+  color: #b71c1c;
781
+  padding: 2px 4px;
782
+  border-radius: 4px;
783
+}
784
+
785
+.status-finished {
786
+  background-color: #e8eaf6;
787
+  color: #311b92;
788
+  padding: 2px 4px;
789
+  border-radius: 4px;
790
+}
791
+
792
+.status-unknown {
793
+  background-color: #efebe9;
794
+  color: #424242;
795
+  padding: 2px 4px;
796
+  border-radius: 4px;
797
+}
798
+
799
+.cell-title {
800
+  display: -webkit-box;
801
+  /* 旧版弹性盒子模型 */
802
+  -webkit-box-orient: vertical;
803
+  /* 内容垂直排列 */
804
+  -webkit-line-clamp: 2;
805
+  /* 限制显示行数 */
806
+  overflow: hidden;
807
+  /* 超出隐藏 */
808
+  text-overflow: ellipsis;
809
+  /* 省略号 */
810
+  line-height: 1.5;
811
+  /* 可选:设置行高 */
812
+  max-height: calc(1.5em * 3);
813
+  /* 可选:根据行高限制最大高度 */
814
+  font-size: 16px;
815
+  font-weight: bold;
816
+  color: #333;
817
+  /* 字号 */
818
+}
819
+
820
+.swipe-cell-default {
821
+  display: flex;
822
+  background-color: #ffffff;
823
+  justify-content: center;
824
+  align-items: center;
825
+}
826
+
827
+.swipe-cell-default-icon {
828
+  width: 60px;
829
+  display: flex;
830
+  justify-content: center;
831
+}
832
+
833
+.delete-button {
834
+  height: 100%;
835
+  border: none;
836
+  color: #ff0000;
837
+  background-image: url('@/assets/img/del.png');
838
+  background-size: auto 100%;
839
+  background-repeat: no-repeat;
840
+}
841
+.edit-button {
842
+  height: 100%;
843
+  border: none;
844
+  color: #F9CC9D;
845
+  background-image: url('@/assets/img/edit.png');
846
+  background-size: auto 100%;
847
+  background-repeat: no-repeat;
848
+}
849
+
850
+.submit-button {
851
+  height: 100%;
852
+  border: none;
853
+  color: #07c160;
854
+  background-image: url('@/assets/img/sub.png');
855
+  background-size: auto 100%;
856
+  background-repeat: no-repeat;
857
+}
858
+
859
+.subsuccess {
860
+  height: 100%;
861
+  border: none;
862
+  color: #07c160;
863
+  background-image: url('@/assets/img/sub1.png');
864
+  background-size: auto 100%;
865
+  background-repeat: no-repeat;
866
+}
867
+</style>

Loading…
取消
儲存