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