|
|
@@ -0,0 +1,680 @@
|
|
|
1
|
+<script setup>
|
|
|
2
|
+import { getCurrentInstance, onMounted, ref , computed, nextTick } from 'vue';
|
|
|
3
|
+import { useRoute, useRouter } from 'vue-router';
|
|
|
4
|
+import tools from '@/tools'
|
|
|
5
|
+import OrganizationalWithLeafUserOne from '@/components/OrganizationalWithLeafUserOne.vue';
|
|
|
6
|
+const {
|
|
|
7
|
+ proxy
|
|
|
8
|
+} = getCurrentInstance()
|
|
|
9
|
+const accidentDictList = ref([])
|
|
|
10
|
+const columns = ref([])
|
|
|
11
|
+const columnsLevel = ref([])
|
|
|
12
|
+
|
|
|
13
|
+
|
|
|
14
|
+const columnsIn = ref([{text: '公司专项', value: '公司专项'},
|
|
|
15
|
+ {text: '自筹', value: '自筹'},
|
|
|
16
|
+ {text: '其他', value: '其他'},])
|
|
|
17
|
+
|
|
|
18
|
+// 定义生成编号的函数(你已写好的逻辑)
|
|
|
19
|
+
|
|
|
20
|
+const generateCode = () => {
|
|
|
21
|
+ const now = new Date();
|
|
|
22
|
+ const year = now.getFullYear();
|
|
|
23
|
+ const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
|
24
|
+ const day = String(now.getDate()).padStart(2, '0');
|
|
|
25
|
+ const formattedDate = `${year}${month}${day}`;
|
|
|
26
|
+ const hours = String(now.getHours()).padStart(2, '0');
|
|
|
27
|
+ const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
|
28
|
+ const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
|
29
|
+ const formattedTime = `${hours}${minutes}${seconds}`;
|
|
|
30
|
+ const sequenceNumber = Math.floor(Math.random() * 1000);
|
|
|
31
|
+ const paddedSequence = String(sequenceNumber).padStart(3, '0');
|
|
|
32
|
+ return `SGAL${formattedDate}${formattedTime}${paddedSequence}`;
|
|
|
33
|
+};
|
|
|
34
|
+
|
|
|
35
|
+// 存储生成的编号(响应式变量)
|
|
|
36
|
+const generatedCode = ref(generateCode());
|
|
|
37
|
+
|
|
|
38
|
+// 重新生成编号的方法
|
|
|
39
|
+const regenerateCode = () => {
|
|
|
40
|
+ generatedCode.value = generateCode();
|
|
|
41
|
+};
|
|
|
42
|
+
|
|
|
43
|
+const caseSourceFlag = ref(false)
|
|
|
44
|
+const moneyTypeFlag = ref(false)
|
|
|
45
|
+const moneyInFlag = ref(false)
|
|
|
46
|
+
|
|
|
47
|
+let title = '新增安全生产费用登记'
|
|
|
48
|
+
|
|
|
49
|
+/* 返回上一级页面 */
|
|
|
50
|
+const router = useRouter()
|
|
|
51
|
+
|
|
|
52
|
+
|
|
|
53
|
+
|
|
|
54
|
+
|
|
|
55
|
+const onClickLeft = () => {
|
|
|
56
|
+ router.go(-1)
|
|
|
57
|
+}
|
|
|
58
|
+
|
|
|
59
|
+const currentYear = ref()
|
|
|
60
|
+currentYear.value = new Date().getFullYear()
|
|
|
61
|
+
|
|
|
62
|
+/* 获取用户部门信息 */
|
|
|
63
|
+const jsonArray = localStorage.getItem('dept')
|
|
|
64
|
+const deptInformation = ref([])
|
|
|
65
|
+try {
|
|
|
66
|
+ deptInformation.value = jsonArray ? JSON.parse(jsonArray) : [];
|
|
|
67
|
+} catch (error) {
|
|
|
68
|
+ deptInformation.value = [];
|
|
|
69
|
+}
|
|
|
70
|
+const deptName = deptInformation.value[0].deptName
|
|
|
71
|
+const deptCode = deptInformation.value[0].deptCode
|
|
|
72
|
+
|
|
|
73
|
+const guid = () => {
|
|
|
74
|
+ function S4() {
|
|
|
75
|
+ return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
|
|
|
76
|
+ }
|
|
|
77
|
+ return (S4()+S4()+S4()+S4()+S4()+S4()+S4()+S4())
|
|
|
78
|
+}
|
|
|
79
|
+const formJieguo = ref({
|
|
|
80
|
+ resultWhether:'',
|
|
|
81
|
+ resultDetail:'',
|
|
|
82
|
+ resultWhy:'',
|
|
|
83
|
+ resultFile:'',
|
|
|
84
|
+ itemsId:'',
|
|
|
85
|
+ resultFileId:'',
|
|
|
86
|
+ resType:''
|
|
|
87
|
+})
|
|
|
88
|
+const route = useRoute()
|
|
|
89
|
+
|
|
|
90
|
+const currentDeptName = ref('')
|
|
|
91
|
+console.log('获取路由传值信息',route)
|
|
|
92
|
+currentDeptName.value = route.query.deptName
|
|
|
93
|
+let planInfo = {}
|
|
|
94
|
+const userName1=localStorage.getItem('userName');
|
|
|
95
|
+const isEdit = ref(route.query.mark === '1');
|
|
|
96
|
+const isReadOnly = ref(route.query.readOnly === 'true');
|
|
|
97
|
+const isCaseSubmitted = computed(() => isReadOnly.value && isEdit.value);
|
|
|
98
|
+const result=ref('')
|
|
|
99
|
+
|
|
|
100
|
+const moneySafeForm = ref({
|
|
|
101
|
+ id: '',
|
|
|
102
|
+ moneyDept: '', // 所属部门
|
|
|
103
|
+ moneyNumber: '', // 投入费用
|
|
|
104
|
+ useTime: '', // 使用日期
|
|
|
105
|
+ moneyType: '', // 费用类型
|
|
|
106
|
+ moneyIn: '', // 资金来源
|
|
|
107
|
+ moneyOut: '', // 资金使用情况说明
|
|
|
108
|
+ otherDec: '', // 备注
|
|
|
109
|
+ fileId: guid(), // 附件ID
|
|
|
110
|
+ moneyTypeId:'' // 费用类型ID
|
|
|
111
|
+})
|
|
|
112
|
+if (route.query.mark) {
|
|
|
113
|
+ planInfo = JSON.parse(route.query.mark)
|
|
|
114
|
+}
|
|
|
115
|
+
|
|
|
116
|
+console.log(planInfo);
|
|
|
117
|
+// 新增模式
|
|
|
118
|
+if (planInfo==-1){
|
|
|
119
|
+ const caseNumber = generateCode();
|
|
|
120
|
+ const fileId = ref()
|
|
|
121
|
+ result.value= caseNumber
|
|
|
122
|
+ //初始化 moneySafeForm
|
|
|
123
|
+ moneySafeForm.value = {
|
|
|
124
|
+ id: '',
|
|
|
125
|
+ moneyDept: '', // 所属部门
|
|
|
126
|
+ moneyNumber: '', // 投入费用
|
|
|
127
|
+ useTime: '', // 使用日期
|
|
|
128
|
+ moneyType: '', // 费用类型
|
|
|
129
|
+ moneyIn: '', // 资金来源
|
|
|
130
|
+ moneyOut: '', // 资金使用情况说明
|
|
|
131
|
+ otherDec: '', // 备注
|
|
|
132
|
+ fileId: guid(), // 附件ID
|
|
|
133
|
+ moneyTypeId:'' // 费用类型ID
|
|
|
134
|
+ };
|
|
|
135
|
+ console.log( result.value);
|
|
|
136
|
+}
|
|
|
137
|
+if (planInfo==1) {
|
|
|
138
|
+ console.log(planInfo);
|
|
|
139
|
+ title = '查看安环费用管理'
|
|
|
140
|
+ moneySafeForm.value= JSON.parse(route.query.data)
|
|
|
141
|
+ if (!moneySafeForm.value.fileId) {
|
|
|
142
|
+ const newFileId = guid();
|
|
|
143
|
+ moneySafeForm.value.fileId = newFileId;
|
|
|
144
|
+ result.value = newFileId;
|
|
|
145
|
+ } else {
|
|
|
146
|
+ result.value = moneySafeForm.value.fileId;
|
|
|
147
|
+ }
|
|
|
148
|
+
|
|
|
149
|
+ console.log('编辑模式 - fileId:', result.value);
|
|
|
150
|
+}
|
|
|
151
|
+
|
|
|
152
|
+const moneySafeFormRef = ref()
|
|
|
153
|
+const moneySafeFormRules = ref({
|
|
|
154
|
+ moneyDept: [{ required: true, message: '请输入所属部门' }],
|
|
|
155
|
+ moneyNumber: [{ required: true, message: '请输入投入费用' }],
|
|
|
156
|
+ useTime: [{ required: true, message: '请选择使用日期' }],
|
|
|
157
|
+ moneyType: [{ required: true, message: '请选择费用类型' }],
|
|
|
158
|
+ moneyIn: [{ required: true, message: '请选择资金来源' }],
|
|
|
159
|
+ moneyOut: [{ required: true, message: '请输入资金使用情况说明' }]
|
|
|
160
|
+})
|
|
|
161
|
+
|
|
|
162
|
+
|
|
|
163
|
+const resDetail=ref('')
|
|
|
164
|
+const ruleIds = ref([]);
|
|
|
165
|
+/*const getRuleId = () => {
|
|
|
166
|
+ var url = '/sgsafe/ExamHead/getCheckRuleId'
|
|
|
167
|
+ var param = {}
|
|
|
168
|
+ proxy.$axios.get(url, param).then(response => {
|
|
|
169
|
+ if (response.data.code == '0') {
|
|
|
170
|
+ ruleIds.value = response.data.data
|
|
|
171
|
+ } else {
|
|
|
172
|
+ console.log("1111111");
|
|
|
173
|
+ }
|
|
|
174
|
+ })
|
|
|
175
|
+ console.log('ruleIds', ruleIds)
|
|
|
176
|
+}
|
|
|
177
|
+getRuleId()*/
|
|
|
178
|
+
|
|
|
179
|
+const onConfirmDatetime = () => {
|
|
|
180
|
+ const year = currentDate.value[0];
|
|
|
181
|
+ const month = currentDate.value[1].toString().padStart(2, '0');
|
|
|
182
|
+ const day = currentDate.value[2].toString().padStart(2, '0');
|
|
|
183
|
+
|
|
|
184
|
+ moneySafeForm.value.useTime = `${year}-${month}-${day}`;
|
|
|
185
|
+ showDatetimePicker.value = false;
|
|
|
186
|
+ dateOrTime.value = false;
|
|
|
187
|
+};
|
|
|
188
|
+
|
|
|
189
|
+
|
|
|
190
|
+const showDatetimePicker = ref(false);
|
|
|
191
|
+const currentTime = ref();
|
|
|
192
|
+const minDate = ref(new Date(1900, 0, 1)); // 初始化最小日期
|
|
|
193
|
+const maxDate = ref(new Date(2100, 11, 31)); // 初始化最大日期
|
|
|
194
|
+
|
|
|
195
|
+const dateOrTime = ref(false);
|
|
|
196
|
+const onDateConfirm = () => {
|
|
|
197
|
+ // 日期选择确认后的处理
|
|
|
198
|
+ moneySafeForm.value.useTime = currentDate.value[0] + '-' + currentDate.value[1] + '-' + currentDate.value[2];
|
|
|
199
|
+ showDatetimePicker.value = false
|
|
|
200
|
+};
|
|
|
201
|
+const resetDatetime = () => {
|
|
|
202
|
+ dateOrTime.value = false;
|
|
|
203
|
+
|
|
|
204
|
+ // 初始化日期和时间
|
|
|
205
|
+ if (moneySafeForm.value.useTime) {
|
|
|
206
|
+ // 修复:使用 useTime 而不是 accidentTime
|
|
|
207
|
+ const dt = new Date(moneySafeForm.value.useTime);
|
|
|
208
|
+ currentDate.value = [dt.getFullYear(), dt.getMonth() + 1, dt.getDate()];
|
|
|
209
|
+ } else {
|
|
|
210
|
+ const now = new Date();
|
|
|
211
|
+ currentDate.value = [now.getFullYear(), now.getMonth() + 1, now.getDate()];
|
|
|
212
|
+ }
|
|
|
213
|
+};
|
|
|
214
|
+const cancelDatePicker = () => {
|
|
|
215
|
+ // 先关闭弹窗,避免在关闭过程中触发重置导致错误
|
|
|
216
|
+ showDatetimePicker.value = false;
|
|
|
217
|
+ // 使用 nextTick 确保弹窗关闭后再重置,避免状态冲突
|
|
|
218
|
+ nextTick(() => {
|
|
|
219
|
+ resetDatetime();
|
|
|
220
|
+ });
|
|
|
221
|
+};
|
|
|
222
|
+
|
|
|
223
|
+// 时间选择器取消
|
|
|
224
|
+const cancelTimePicker = () => {
|
|
|
225
|
+ resetDatetime();
|
|
|
226
|
+ // 重置为当前时间或从表单获取时间
|
|
|
227
|
+ if (moneySafeForm.value.useTime) {
|
|
|
228
|
+ const dt = new Date(moneySafeForm.value.useTime);
|
|
|
229
|
+ } else {
|
|
|
230
|
+ const now = new Date();
|
|
|
231
|
+ currentTime.value = [
|
|
|
232
|
+ String(now.getHours()).padStart(2, '0'),
|
|
|
233
|
+ String(now.getMinutes()).padStart(2, '0'),
|
|
|
234
|
+ String(now.getSeconds()).padStart(2, '0')
|
|
|
235
|
+ ];
|
|
|
236
|
+ }
|
|
|
237
|
+};
|
|
|
238
|
+
|
|
|
239
|
+
|
|
|
240
|
+/* 下拉框 */
|
|
|
241
|
+const showActionSheet = ref(false)
|
|
|
242
|
+const showActionSheet1 = ref(false)
|
|
|
243
|
+const planLevelList = [
|
|
|
244
|
+ { name: '转发', value: '转发' },
|
|
|
245
|
+ { name: '内部', value: '内部' },
|
|
|
246
|
+ { name: '文章', value: '文章' }
|
|
|
247
|
+];
|
|
|
248
|
+const isdisabled=ref(true)
|
|
|
249
|
+const isdisabled2=ref(true)
|
|
|
250
|
+const onSelect = (item) => {
|
|
|
251
|
+ moneySafeForm.value.fileContent = item.name
|
|
|
252
|
+
|
|
|
253
|
+ showActionSheet.value=false
|
|
|
254
|
+}
|
|
|
255
|
+
|
|
|
256
|
+const onSelect2 = (item) => {
|
|
|
257
|
+ moneySafeForm.value.fileType=item.name
|
|
|
258
|
+ showActionSheet2.value=false
|
|
|
259
|
+ }
|
|
|
260
|
+
|
|
|
261
|
+const onCaseSourseSelect = (item) => {
|
|
|
262
|
+ moneySafeForm.value.caseSource=item.dicCode
|
|
|
263
|
+ caseSourceFlag.value = false
|
|
|
264
|
+}
|
|
|
265
|
+
|
|
|
266
|
+const onAccidentLevelSelect = (item) => {
|
|
|
267
|
+ moneySafeForm.value.accidentLevel = item.dicCode
|
|
|
268
|
+ moneyTypeFlag.value = false
|
|
|
269
|
+
|
|
|
270
|
+}
|
|
|
271
|
+
|
|
|
272
|
+const displayFileName = ref('')
|
|
|
273
|
+const onSelect1 = (item) => {
|
|
|
274
|
+ console.log(item);
|
|
|
275
|
+ formJieguo.value.resultFile = item.value
|
|
|
276
|
+ result.value=formJieguo.value.resultFile
|
|
|
277
|
+ displayFileName.value = item.name
|
|
|
278
|
+ console.log(result.value);
|
|
|
279
|
+ showActionSheet1.value = false
|
|
|
280
|
+}
|
|
|
281
|
+const questionIds = ref([])
|
|
|
282
|
+const actions=ref([])
|
|
|
283
|
+/*const getQuestionId = () => {
|
|
|
284
|
+ var url = '/sgsafe/AssessmentRecord/queryRuleNoPage';
|
|
|
285
|
+ var param = {};
|
|
|
286
|
+ proxy.$axios.get(url, param).then(response => {
|
|
|
287
|
+ if (response.data.code == '0') {
|
|
|
288
|
+ questionIds.value = response.data.data; // 先赋值给 questionIds.value
|
|
|
289
|
+
|
|
|
290
|
+
|
|
|
291
|
+ // ✅ 关键:使用 questionIds.value.map
|
|
|
292
|
+ actions.value = questionIds.value.map(item => ({
|
|
|
293
|
+ name: item.ruleName,
|
|
|
294
|
+ value: item.id
|
|
|
295
|
+ }));
|
|
|
296
|
+ console.log('actions:', actions.value); // 看看有没有输出
|
|
|
297
|
+ } else {
|
|
|
298
|
+ ElMessage.error('操作失败!' + response.data.msg);
|
|
|
299
|
+ }
|
|
|
300
|
+ });
|
|
|
301
|
+};
|
|
|
302
|
+getQuestionId()*/
|
|
|
303
|
+
|
|
|
304
|
+const baocun3 = (ruleFormRef) => {
|
|
|
305
|
+ console.log(formJieguo.value)
|
|
|
306
|
+ ruleFormRef.validate((valid, fields) => {
|
|
|
307
|
+ if (valid) {
|
|
|
308
|
+
|
|
|
309
|
+ var url = '/sgsafe/ItemsResult/save';
|
|
|
310
|
+ var param = {
|
|
|
311
|
+ json: JSON.stringify(formJieguo.value)
|
|
|
312
|
+ };
|
|
|
313
|
+ proxy.$axios.post(url, param).then(response => {
|
|
|
314
|
+ if (response.data.code == '0') {
|
|
|
315
|
+ getTableData1()
|
|
|
316
|
+ ElMessage({
|
|
|
317
|
+ message: '保存成功',
|
|
|
318
|
+ type: 'success',
|
|
|
319
|
+ })
|
|
|
320
|
+ if (ruleFormRef.value) {
|
|
|
321
|
+ ruleFormRef.value.resetFields();
|
|
|
322
|
+ }
|
|
|
323
|
+ dialogVisibletemplate.value=false
|
|
|
324
|
+ } else {
|
|
|
325
|
+ ElMessage.error('操作失败!' + response.data.msg)
|
|
|
326
|
+ }
|
|
|
327
|
+
|
|
|
328
|
+ })
|
|
|
329
|
+ }
|
|
|
330
|
+ })
|
|
|
331
|
+}
|
|
|
332
|
+
|
|
|
333
|
+/* 组织树选择 */
|
|
|
334
|
+const showBottom = ref(false)
|
|
|
335
|
+import OrganizationalWithLeaf from '@/components/OrganizationalWithLeaf.vue';
|
|
|
336
|
+import { showFailToast, showLoadingToast, showSuccessToast } from 'vant';
|
|
|
337
|
+const handleTableDataUserDeptUpdate = async (nodeData) => {
|
|
|
338
|
+ moneySafeForm.value.moneyDept = nodeData
|
|
|
339
|
+ showBottom.value = false
|
|
|
340
|
+}
|
|
|
341
|
+
|
|
|
342
|
+const addEmergencyDrillPlan = async () => {
|
|
|
343
|
+ const loadingToast = showLoadingToast({
|
|
|
344
|
+ duration: 0,
|
|
|
345
|
+ message: '加载中',
|
|
|
346
|
+ forbidClick: true
|
|
|
347
|
+ })
|
|
|
348
|
+
|
|
|
349
|
+ moneySafeForm.value.fileId = result.value
|
|
|
350
|
+
|
|
|
351
|
+ var url = '/sgsafe/MoneySafe/save';
|
|
|
352
|
+ const params = {
|
|
|
353
|
+ json: JSON.stringify(moneySafeForm.value)
|
|
|
354
|
+ }
|
|
|
355
|
+ proxy.$axios.post(url,params).then(res=>{
|
|
|
356
|
+ if (res.data.code === 0) {
|
|
|
357
|
+ loadingToast.close()
|
|
|
358
|
+ showSuccessToast('保存成功')
|
|
|
359
|
+ onClickLeft()
|
|
|
360
|
+
|
|
|
361
|
+ } else {
|
|
|
362
|
+ loadingToast.close()
|
|
|
363
|
+ showFailToast('操作失败!' + res.data.msg)
|
|
|
364
|
+ }
|
|
|
365
|
+ })
|
|
|
366
|
+}
|
|
|
367
|
+const showDatePicker = ref(false)
|
|
|
368
|
+const onDatePicker = (value) => {
|
|
|
369
|
+ const dateArr = value.selectedValues
|
|
|
370
|
+ moneySafeForm.value.checkTime = dateArr[0] + '-' + dateArr[1] + '-' + dateArr[2]
|
|
|
371
|
+ showDatePicker.value = false
|
|
|
372
|
+}
|
|
|
373
|
+const currentDate = ref([2025, 7, 25])
|
|
|
374
|
+//定义字典集合
|
|
|
375
|
+const dicList = ref([])
|
|
|
376
|
+const dictList = ref([])
|
|
|
377
|
+
|
|
|
378
|
+const getDicList = () => {
|
|
|
379
|
+ tools.dic.getDicList(['MONEY_TYPE']).then((response => {
|
|
|
380
|
+
|
|
|
381
|
+ dictList.value = response.data.data
|
|
|
382
|
+ columnsLevel.value = dictList.value.MONEY_TYPE.map(item => ({
|
|
|
383
|
+ text: item.dicName,
|
|
|
384
|
+ value: item.dicName // Web端保存的是 dicCode
|
|
|
385
|
+ }))
|
|
|
386
|
+ })).catch(error => {
|
|
|
387
|
+ console.error('获取字典数据出错:', error)
|
|
|
388
|
+ columns.value = []
|
|
|
389
|
+ })
|
|
|
390
|
+}
|
|
|
391
|
+onMounted(() => {
|
|
|
392
|
+ //getAccidentDicList()
|
|
|
393
|
+ console.log('这是编辑页面')
|
|
|
394
|
+ const today = new Date()
|
|
|
395
|
+ const year = today.getFullYear()
|
|
|
396
|
+ const month = today.getMonth() + 1 // 月份从 0 开始
|
|
|
397
|
+ const day = today.getDate()
|
|
|
398
|
+ currentDate.value = [year, month, day]
|
|
|
399
|
+
|
|
|
400
|
+ // 确保 minDate 和 maxDate 已初始化
|
|
|
401
|
+ if (!minDate.value) {
|
|
|
402
|
+ minDate.value = new Date(1900, 0, 1);
|
|
|
403
|
+ }
|
|
|
404
|
+ if (!maxDate.value) {
|
|
|
405
|
+ maxDate.value = new Date(2100, 11, 31);
|
|
|
406
|
+ }
|
|
|
407
|
+
|
|
|
408
|
+ // 初始化时间
|
|
|
409
|
+ currentTime.value = [today.getHours(), today.getMinutes(), today.getSeconds()];
|
|
|
410
|
+ // 如果是编辑模式且有已有的使用日期,解析并初始化
|
|
|
411
|
+ if (isEdit.value && moneySafeForm.value.useTime) {
|
|
|
412
|
+ try {
|
|
|
413
|
+ // 解析格式如 "2025-01-15" 的日期字符串
|
|
|
414
|
+ const dateStr = moneySafeForm.value.useTime;
|
|
|
415
|
+ const [year, month, day] = dateStr.split('-').map(Number);
|
|
|
416
|
+ if (year && month && day) {
|
|
|
417
|
+ currentDate.value = [year, month, day];
|
|
|
418
|
+ }
|
|
|
419
|
+ } catch (error) {
|
|
|
420
|
+ console.error('解析使用日期失败:', error);
|
|
|
421
|
+ }
|
|
|
422
|
+ }
|
|
|
423
|
+ getDicList()
|
|
|
424
|
+})
|
|
|
425
|
+const showActionSheet2=ref(false)
|
|
|
426
|
+/* 文件上传 */
|
|
|
427
|
+import AttachmentS3 from '@/components/AttachmentS3.vue';
|
|
|
428
|
+
|
|
|
429
|
+const onSubmit = (values) => {
|
|
|
430
|
+ addEmergencyDrillPlan()
|
|
|
431
|
+}
|
|
|
432
|
+const leaderKeyysr = guid();
|
|
|
433
|
+const PopupDepartmentLeaderNameRefysr = ref();
|
|
|
434
|
+const handleDepartmentLeaderNameysr = () => {
|
|
|
435
|
+ PopupDepartmentLeaderNameRefysr.value.open();
|
|
|
436
|
+};
|
|
|
437
|
+const getDepartmentLeaderNameysr = (item) => {
|
|
|
438
|
+ moneySafeForm.value.punCode = item.user.userCode;
|
|
|
439
|
+ moneySafeForm.value.punName = item.user.userDesc;
|
|
|
440
|
+ moneySafeForm.value.punId = item.user.id
|
|
|
441
|
+};
|
|
|
442
|
+
|
|
|
443
|
+const onCaseSourceConfirm = ({ selectedOptions }) => {
|
|
|
444
|
+ caseSourceFlag.value = false;
|
|
|
445
|
+ moneySafeForm.value.caseSource = selectedOptions[0].text;
|
|
|
446
|
+};
|
|
|
447
|
+
|
|
|
448
|
+const moneyTypeLevelConfirm = ({ selectedOptions }) => {
|
|
|
449
|
+ moneyTypeFlag.value = false;
|
|
|
450
|
+ moneySafeForm.value.moneyTypeId = selectedOptions[0].value;
|
|
|
451
|
+ moneySafeForm.value.moneyType = selectedOptions[0].text;
|
|
|
452
|
+};
|
|
|
453
|
+
|
|
|
454
|
+const moneyInConfirm = ({ selectedOptions }) => {
|
|
|
455
|
+ moneyInFlag.value = false;
|
|
|
456
|
+ moneySafeForm.value.moneyIn = selectedOptions[0].text;
|
|
|
457
|
+};
|
|
|
458
|
+
|
|
|
459
|
+const getDeptInfo = (currentDeptInfo) => {
|
|
|
460
|
+ // 如果需要初始化部门信息,可以在这里处理
|
|
|
461
|
+ // 例如:moneySafeForm.value.moneyDept = currentDeptInfo
|
|
|
462
|
+}
|
|
|
463
|
+</script>
|
|
|
464
|
+
|
|
|
465
|
+<template>
|
|
|
466
|
+
|
|
|
467
|
+ <div class="page-container">
|
|
|
468
|
+ <van-sticky class="header">
|
|
|
469
|
+ <van-nav-bar
|
|
|
470
|
+ :title="title"
|
|
|
471
|
+ left-text="返回"
|
|
|
472
|
+ left-arrow
|
|
|
473
|
+ @click-left="onClickLeft" >
|
|
|
474
|
+ </van-nav-bar>
|
|
|
475
|
+ </van-sticky>
|
|
|
476
|
+ <div class="scroll-container">
|
|
|
477
|
+ <van-form @submit="onSubmit">
|
|
|
478
|
+ <van-field
|
|
|
479
|
+ v-model="moneySafeForm.moneyDept"
|
|
|
480
|
+ label="所属部门"
|
|
|
481
|
+ name="moneyDept"
|
|
|
482
|
+ readonly
|
|
|
483
|
+ placeholder="请选择所属部门"
|
|
|
484
|
+ @click="!isCaseSubmitted && (showBottom = true)"
|
|
|
485
|
+ :rules="[{required: true, message: '请选择所属部门'}]"
|
|
|
486
|
+ required
|
|
|
487
|
+ />
|
|
|
488
|
+
|
|
|
489
|
+ <van-field
|
|
|
490
|
+ v-model="moneySafeForm.moneyNumber"
|
|
|
491
|
+ label="投入费用"
|
|
|
492
|
+ name="moneyNumber"
|
|
|
493
|
+ :readonly="isCaseSubmitted"
|
|
|
494
|
+ required
|
|
|
495
|
+ placeholder="请输入投入费用"
|
|
|
496
|
+ :rules="[{required: true, message: '请输入投入费用'}]"
|
|
|
497
|
+ />
|
|
|
498
|
+
|
|
|
499
|
+ <!-- //时间-->
|
|
|
500
|
+ <van-field
|
|
|
501
|
+ v-model="moneySafeForm.useTime"
|
|
|
502
|
+ is-link
|
|
|
503
|
+ readonly
|
|
|
504
|
+ name="useTime"
|
|
|
505
|
+ label="使用日期"
|
|
|
506
|
+ :colon="true"
|
|
|
507
|
+ placeholder="点击选择日期"
|
|
|
508
|
+ @click="showDatetimePicker = !isCaseSubmitted"
|
|
|
509
|
+ :rules="[{ required:true, message: '请点击选择日期' }]"
|
|
|
510
|
+ required
|
|
|
511
|
+ />
|
|
|
512
|
+ <van-popup
|
|
|
513
|
+ v-model:show="showDatetimePicker"
|
|
|
514
|
+ position="bottom"
|
|
|
515
|
+ round
|
|
|
516
|
+ style="max-height: 50vh;"
|
|
|
517
|
+ >
|
|
|
518
|
+ <van-date-picker
|
|
|
519
|
+ v-model="currentDate"
|
|
|
520
|
+ title="选择日期"
|
|
|
521
|
+ :min-date="minDate"
|
|
|
522
|
+ :max-date="maxDate"
|
|
|
523
|
+ @confirm="onDateConfirm"
|
|
|
524
|
+ @cancel="cancelDatePicker"
|
|
|
525
|
+ >
|
|
|
526
|
+ <template #confirm>
|
|
|
527
|
+ <van-button type="primary" @click="onDateConfirm">确认</van-button>
|
|
|
528
|
+ </template>
|
|
|
529
|
+ <template #cancel>
|
|
|
530
|
+ <van-button type="danger" @click="cancelDatePicker">取消</van-button>
|
|
|
531
|
+ </template>
|
|
|
532
|
+ </van-date-picker>
|
|
|
533
|
+
|
|
|
534
|
+ </van-popup>
|
|
|
535
|
+
|
|
|
536
|
+
|
|
|
537
|
+ <van-field
|
|
|
538
|
+ v-model="moneySafeForm.moneyType"
|
|
|
539
|
+ is-link
|
|
|
540
|
+ readonly
|
|
|
541
|
+ label="费用类型"
|
|
|
542
|
+ name="moneyType"
|
|
|
543
|
+ placeholder="请选择"
|
|
|
544
|
+ @click="!isCaseSubmitted && (moneyTypeFlag = true)"
|
|
|
545
|
+ :rules="[{required: true, message: '请选择费用类型'}]"
|
|
|
546
|
+ required
|
|
|
547
|
+ />
|
|
|
548
|
+
|
|
|
549
|
+ <van-field
|
|
|
550
|
+ v-model="moneySafeForm.moneyIn"
|
|
|
551
|
+ is-link
|
|
|
552
|
+ readonly
|
|
|
553
|
+ label="资金来源"
|
|
|
554
|
+ name="moneyIn"
|
|
|
555
|
+ placeholder="请选择"
|
|
|
556
|
+ :rules="[{required: true, message: '请选择资金来源'}]"
|
|
|
557
|
+ @click="!isCaseSubmitted && (moneyInFlag = true)"
|
|
|
558
|
+ required
|
|
|
559
|
+ />
|
|
|
560
|
+
|
|
|
561
|
+ <van-field
|
|
|
562
|
+ v-model="moneySafeForm.moneyOut"
|
|
|
563
|
+ label="资金使用情况说明"
|
|
|
564
|
+ name="casualtyCount"
|
|
|
565
|
+ rows="1"
|
|
|
566
|
+ autosize
|
|
|
567
|
+ type="textarea"
|
|
|
568
|
+ placeholder="请输入事故造成后果"
|
|
|
569
|
+ :readonly="isCaseSubmitted"
|
|
|
570
|
+ :rules="[{required: true, message: '请输入事故造成后果'}]"
|
|
|
571
|
+ required
|
|
|
572
|
+ />
|
|
|
573
|
+ <van-field
|
|
|
574
|
+ v-model="moneySafeForm.otherDec"
|
|
|
575
|
+ label="备注"
|
|
|
576
|
+ name="accidentSummary"
|
|
|
577
|
+ rows="3"
|
|
|
578
|
+ autosize
|
|
|
579
|
+ type="textarea"
|
|
|
580
|
+ placeholder="请输入事故简要经过"
|
|
|
581
|
+ :readonly="isCaseSubmitted"
|
|
|
582
|
+ />
|
|
|
583
|
+ <div style="margin: 16px;">
|
|
|
584
|
+ <van-button v-if="!isReadOnly" round block type="primary" native-type="submit">
|
|
|
585
|
+ {{ isEdit ? '保存' : '提交' }}
|
|
|
586
|
+ </van-button>
|
|
|
587
|
+ </div>
|
|
|
588
|
+ </van-form>
|
|
|
589
|
+
|
|
|
590
|
+ <van-action-sheet
|
|
|
591
|
+ v-model:show="showActionSheet"
|
|
|
592
|
+ :actions="planLevelList"
|
|
|
593
|
+ @select="onSelect"
|
|
|
594
|
+ />
|
|
|
595
|
+ <van-action-sheet
|
|
|
596
|
+ v-model:show="showActionSheet2"
|
|
|
597
|
+ :actions="dicList"
|
|
|
598
|
+ @select="onSelect2"
|
|
|
599
|
+ />
|
|
|
600
|
+
|
|
|
601
|
+ <van-action-sheet
|
|
|
602
|
+ v-model:show="caseSourceFlag"
|
|
|
603
|
+ :actions="accidentDictList.case_source"
|
|
|
604
|
+ @select="onCaseSourseSelect"
|
|
|
605
|
+ />
|
|
|
606
|
+
|
|
|
607
|
+ <van-popup v-model:show="caseSourceFlag" round position="bottom">
|
|
|
608
|
+ <van-picker
|
|
|
609
|
+ :columns="columns"
|
|
|
610
|
+ @cancel="caseSourceFlag = false"
|
|
|
611
|
+ @confirm="onCaseSourceConfirm"
|
|
|
612
|
+ />
|
|
|
613
|
+ </van-popup>
|
|
|
614
|
+
|
|
|
615
|
+ <van-popup v-model:show="moneyTypeFlag" round position="bottom">
|
|
|
616
|
+ <van-picker
|
|
|
617
|
+ :columns="columnsLevel"
|
|
|
618
|
+ @cancel="moneyTypeFlag = false"
|
|
|
619
|
+ @confirm="moneyTypeLevelConfirm"
|
|
|
620
|
+ />
|
|
|
621
|
+ </van-popup>
|
|
|
622
|
+
|
|
|
623
|
+ <van-popup v-model:show="moneyInFlag" round position="bottom">
|
|
|
624
|
+ <van-picker
|
|
|
625
|
+ :columns="columnsIn"
|
|
|
626
|
+ @cancel="moneyInFlag = false"
|
|
|
627
|
+ @confirm="moneyInConfirm"
|
|
|
628
|
+ />
|
|
|
629
|
+ </van-popup>
|
|
|
630
|
+
|
|
|
631
|
+ <van-popup
|
|
|
632
|
+ :close-on-click-overlay="false"
|
|
|
633
|
+ :lazy-render="false"
|
|
|
634
|
+ v-model:show="showBottom"
|
|
|
635
|
+ position="bottom"
|
|
|
636
|
+ >
|
|
|
637
|
+ <OrganizationalWithLeaf
|
|
|
638
|
+ @init="getDeptInfo"
|
|
|
639
|
+ @close="showBottom = false"
|
|
|
640
|
+ @update:selected-node="handleTableDataUserDeptUpdate"
|
|
|
641
|
+ />
|
|
|
642
|
+ </van-popup>
|
|
|
643
|
+ <van-popup v-model:show="showDatePicker" position="bottom">
|
|
|
644
|
+ <van-date-picker
|
|
|
645
|
+ v-model="currentDate"
|
|
|
646
|
+ @confirm="onDatePicker"
|
|
|
647
|
+ @cancel="showDatePicker = false" />
|
|
|
648
|
+ </van-popup>
|
|
|
649
|
+ </div>
|
|
|
650
|
+ </div>
|
|
|
651
|
+</template>
|
|
|
652
|
+
|
|
|
653
|
+<style scoped>
|
|
|
654
|
+.page-container {
|
|
|
655
|
+ height: 100vh; /* 关键:外层容器高度设为视口高度 */
|
|
|
656
|
+ display: flex;
|
|
|
657
|
+ flex-direction: column;
|
|
|
658
|
+
|
|
|
659
|
+}
|
|
|
660
|
+/* overflow-y: auto; !* 启用垂直滚动 *!*/
|
|
|
661
|
+
|
|
|
662
|
+
|
|
|
663
|
+.scroll-container {
|
|
|
664
|
+ flex: 1;
|
|
|
665
|
+ overflow: auto;
|
|
|
666
|
+ -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
|
|
|
667
|
+}
|
|
|
668
|
+
|
|
|
669
|
+/* 可选:隐藏滚动条(视觉优化) */
|
|
|
670
|
+.scroll-container::-webkit-scrollbar {
|
|
|
671
|
+ display: none;
|
|
|
672
|
+}
|
|
|
673
|
+
|
|
|
674
|
+.header, .footer {
|
|
|
675
|
+ /* 固定高度区域 */
|
|
|
676
|
+ flex-shrink: 0; /* 防止被压缩 */
|
|
|
677
|
+ background: #f5f5f5;
|
|
|
678
|
+ padding: 12px;
|
|
|
679
|
+}
|
|
|
680
|
+</style>
|