|
@@ -1,8 +1,8 @@
|
1
|
1
|
<!--
|
2
|
2
|
* @Author: ysh
|
3
|
3
|
* @Date: 2024-03-07 13:44:39
|
4
|
|
- * @LastEditors: wrh
|
5
|
|
- * @LastEditTime: 2024-07-26 13:54:55
|
|
4
|
+ * @LastEditors: Please set LastEditors
|
|
5
|
+ * @LastEditTime: 2024-07-29 15:41:35
|
6
|
6
|
-->
|
7
|
7
|
|
8
|
8
|
<template>
|
|
@@ -18,13 +18,11 @@
|
18
|
18
|
<el-row :gutter="20">
|
19
|
19
|
<el-col :span="6" :xs="24">
|
20
|
20
|
<el-form-item label="申请人:" prop="user.nickName">
|
21
|
|
- <!-- <el-input v-model="form.user"></el-input> -->
|
22
|
21
|
{{ form.applierUser ? form.applierUser.nickName : form.user.nickName }}
|
23
|
22
|
</el-form-item>
|
24
|
23
|
</el-col>
|
25
|
24
|
<el-col :span="6" :xs="24">
|
26
|
25
|
<el-form-item label="所在部门:" prop="dept.deptName">
|
27
|
|
- <!-- <el-input v-model="form.deptName"></el-input> -->
|
28
|
26
|
{{ form.dept.deptName }}
|
29
|
27
|
</el-form-item>
|
30
|
28
|
</el-col>
|
|
@@ -39,12 +37,6 @@
|
39
|
37
|
<el-form-item label="项目编号:" prop="projectId">
|
40
|
38
|
<el-button type="primary" size="mini" @click="openProject = true"
|
41
|
39
|
v-if="taskName == '设备申请'">选择项目</el-button>
|
42
|
|
- <!-- <el-select v-model="form.projectId" filterable allow-create placeholder="请选择"
|
43
|
|
- @change="handleSelectProject" clearable :disabled="taskName != '设备申请'">
|
44
|
|
- <el-option v-for="item in projectList" :key="item.value" :label="item.projectNumber"
|
45
|
|
- :value="item.projectId">
|
46
|
|
- </el-option>
|
47
|
|
- </el-select> -->
|
48
|
40
|
<el-descriptions border v-if="isSelect" style="margin-top: 10px;" :column="1">
|
49
|
41
|
<el-descriptions-item label="项目编号" label-class-name="my-label">{{ chooseProject.projectNumber
|
50
|
42
|
}}</el-descriptions-item>
|
|
@@ -60,21 +52,15 @@
|
60
|
52
|
}}</el-descriptions-item>
|
61
|
53
|
</el-descriptions>
|
62
|
54
|
</el-form-item>
|
63
|
|
- <el-form-item label="设备选择:">
|
64
|
|
- <!-- <el-select style="width: 90%;" v-model="form.devices" filterable multiple placeholder="请选择" clearable
|
65
|
|
- disabled>
|
66
|
|
- <el-option v-for="item in deviceList" :key="item.deviceId" :disabled="item.status != 1" :label="item.name + '【' + (item.brand != null ? item.brand : '') + (item.series != null ? '-' + item.series + '】' : '')
|
67
|
|
- + (item.code != null ? '(设备编号:' + item.code + ')' : '')" :value="item.deviceId">
|
68
|
|
- </el-option>
|
69
|
|
- </el-select> -->
|
|
55
|
+ <el-form-item label="设备选择:" prop="devices">
|
70
|
56
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="openDevice = true"
|
71
|
57
|
:disabled="taskName != '设备申请'">选择设备</el-button>
|
72
|
58
|
<el-table :data="deviceList">
|
73
|
59
|
<el-table-column label="序号" type="index" />
|
|
60
|
+ <el-table-column label="出厂编号" align="center" prop="code" />
|
74
|
61
|
<el-table-column label="设备品牌" align="center" prop="brand" />
|
75
|
62
|
<el-table-column label="设备名称" align="center" prop="name" />
|
76
|
63
|
<el-table-column label="规格型号" align="center" prop="series" />
|
77
|
|
- <el-table-column label="出厂编号" align="center" prop="code" />
|
78
|
64
|
<el-table-column label="存放地址" align="center" prop="place" />
|
79
|
65
|
</el-table>
|
80
|
66
|
</el-form-item>
|
|
@@ -106,23 +92,24 @@
|
106
|
92
|
</el-row>
|
107
|
93
|
<!-- 安排设备意见 -->
|
108
|
94
|
<el-divider></el-divider>
|
109
|
|
- <el-form-item label-width="120px" label="拟发放设备:">
|
110
|
|
- <!-- <el-select style="width: 90%;" v-model="form.modifyDevices" filterable multiple placeholder="请选择"
|
111
|
|
- clearable disabled>
|
112
|
|
- <el-option v-for="item in deviceList" :key="item.deviceId" :disabled="item.status != 1" :label="item.name + '【' + (item.brand != null ? item.brand : '') + (item.series != null ? '-' + item.series + '】' : '')
|
113
|
|
- + (item.code != null ? '(设备编号:' + item.code + ')' : '') + '📍' + item.place" :value="item.deviceId">
|
114
|
|
- </el-option>
|
115
|
|
- </el-select> -->
|
116
|
|
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="openDevice = true"
|
117
|
|
- :disabled="taskName != '安排设备'">选择设备</el-button>
|
|
95
|
+ <el-form-item label-width="120px" label="拟发放设备:" prop="modifyDevices">
|
118
|
96
|
<el-table :data="modifyDeviceList">
|
119
|
97
|
<el-table-column label="序号" type="index" />
|
|
98
|
+ <el-table-column label="出厂编号" align="center" prop="code" />
|
120
|
99
|
<el-table-column label="设备品牌" align="center" prop="brand" />
|
121
|
100
|
<el-table-column label="设备名称" align="center" prop="name" />
|
122
|
101
|
<el-table-column label="规格型号" align="center" prop="series" />
|
123
|
|
- <el-table-column label="出厂编号" align="center" prop="code" />
|
124
|
102
|
<el-table-column label="存放地址" align="center" prop="place" />
|
|
103
|
+ <el-table-column label="操作" align="center" v-if="taskName == '安排设备'">
|
|
104
|
+ <template slot-scope="scope">
|
|
105
|
+ <el-button type="text" primary @click="replaceRowData(scope.row, scope.$index)">重新选择</el-button>
|
|
106
|
+ <el-button type="text" style="color:#F56C6C"
|
|
107
|
+ @click="deleteRowData(scope.row, scope.$index)">删除</el-button>
|
|
108
|
+ </template>
|
|
109
|
+ </el-table-column>
|
125
|
110
|
</el-table>
|
|
111
|
+ <el-button class="mt10" type="primary" size="mini" @click="addRowdata()" icon="el-icon-plus"
|
|
112
|
+ :disabled="taskName != '安排设备'">新增设备</el-button>
|
126
|
113
|
</el-form-item>
|
127
|
114
|
<el-form-item label="安排设备意见:" prop="dispatchComment" label-width="125px">
|
128
|
115
|
<el-input type="textarea" :rows="3" placeholder="请输入安排设备意见" v-model="form.dispatchComment"
|
|
@@ -185,7 +172,8 @@
|
185
|
172
|
<el-button type="primary" @click="submit">提交申请</el-button>
|
186
|
173
|
</el-row>
|
187
|
174
|
<el-row style="text-align: center;" v-else>
|
188
|
|
- <el-button type="primary" @click="completeApply" v-if="taskName">完成审批</el-button>
|
|
175
|
+ <el-button type="warning" @click="saves()">保存</el-button>
|
|
176
|
+ <el-button type="primary" @click="completeApply()" v-if="taskName">完成审批</el-button>
|
189
|
177
|
</el-row>
|
190
|
178
|
</div>
|
191
|
179
|
</el-card>
|
|
@@ -198,14 +186,13 @@
|
198
|
186
|
<flow :flowData="flowData" />
|
199
|
187
|
</div>
|
200
|
188
|
</el-card>
|
201
|
|
-
|
202
|
189
|
</el-col>
|
203
|
190
|
</el-row>
|
204
|
191
|
<el-dialog title="选择项目" :visible.sync="openProject" width="70%" append-to-body>
|
205
|
192
|
<project-choose @chooseProject="confirmProject"></project-choose>
|
206
|
193
|
</el-dialog>
|
207
|
194
|
<el-dialog title="选择仪器" :visible.sync="openDevice" width="70%" append-to-body>
|
208
|
|
- <choose-device @chooseList="confirmDevice"></choose-device>
|
|
195
|
+ <choose-device :multiple="multiple" @chooseList="confirmDevice"></choose-device>
|
209
|
196
|
</el-dialog>
|
210
|
197
|
</div>
|
211
|
198
|
</template>
|
|
@@ -297,7 +284,10 @@ export default {
|
297
|
284
|
deviceList: [],
|
298
|
285
|
grantDeviceList: [],
|
299
|
286
|
modifyDeviceList: [],
|
300
|
|
- formTotal: 0
|
|
287
|
+ formTotal: 0,
|
|
288
|
+ clicDevice: {},
|
|
289
|
+ clickRowIndex: 0,
|
|
290
|
+ multiple: true,
|
301
|
291
|
}
|
302
|
292
|
},
|
303
|
293
|
mounted() {
|
|
@@ -308,6 +298,9 @@ export default {
|
308
|
298
|
initRules() {
|
309
|
299
|
if (this.taskName == '设备申请') {
|
310
|
300
|
this.rules = {
|
|
301
|
+ projectId: [
|
|
302
|
+ { required: true, message: '请选择项目', trigger: 'blur' },
|
|
303
|
+ ],
|
311
|
304
|
devices: [
|
312
|
305
|
{ required: true, message: '请选择申请设备', trigger: 'change' },
|
313
|
306
|
],
|
|
@@ -320,6 +313,9 @@ export default {
|
320
|
313
|
applyReason: [
|
321
|
314
|
{ required: true, message: '请输入申领理由', trigger: 'blur' },
|
322
|
315
|
],
|
|
316
|
+ devices: [
|
|
317
|
+ { required: true, message: '请选择设备', trigger: 'blur' },
|
|
318
|
+ ]
|
323
|
319
|
}
|
324
|
320
|
} else if (this.taskName == '分管审核') {
|
325
|
321
|
this.rules = {
|
|
@@ -369,7 +365,7 @@ export default {
|
369
|
365
|
}
|
370
|
366
|
if (res.data.modifyDevices == null || res.data.modifyDevices == undefined || res.data.modifyDevices == "") {
|
371
|
367
|
data.modifyDevices = []
|
372
|
|
- this.modifyDeviceList = []
|
|
368
|
+ this.modifyDeviceList = this.deviceList
|
373
|
369
|
} else {
|
374
|
370
|
data.modifyDevices = data.modifyDevices.split(',');
|
375
|
371
|
let arr = []
|
|
@@ -411,22 +407,48 @@ export default {
|
411
|
407
|
this.taskForm.formData = formData;
|
412
|
408
|
this.getNextFlowNodeApproval();
|
413
|
409
|
})
|
|
410
|
+ } else {
|
|
411
|
+ this.$message.error('必填项未填写完毕')
|
|
412
|
+ }
|
|
413
|
+ })
|
|
414
|
+ },
|
|
415
|
+ saves() {
|
|
416
|
+ this.$refs['deviceForm'].validate((valid) => {
|
|
417
|
+ if (valid) {
|
|
418
|
+ this.form.formId = this.taskForm.formId;
|
|
419
|
+ this.form.deviceApplyId = this.taskForm.formId;
|
|
420
|
+ let formData = new FormData();
|
|
421
|
+ let jsonForm = JSON.stringify(this.form);
|
|
422
|
+ formData.append("form", jsonForm);
|
|
423
|
+ if (this.formTotal != 0) {
|
|
424
|
+ modifyDeviceApproval(formData).then(res => {
|
|
425
|
+ this.$message.success('保存成功')
|
|
426
|
+ });
|
|
427
|
+ }
|
|
428
|
+ } else {
|
|
429
|
+ this.$message.error('必填项未填写完毕')
|
414
|
430
|
}
|
415
|
431
|
})
|
416
|
432
|
},
|
417
|
433
|
completeApply() {
|
418
|
|
- this.form.formId = this.taskForm.formId;
|
419
|
|
- this.form.deviceApplyId = this.taskForm.formId;
|
420
|
|
- let formData = new FormData();
|
421
|
|
- let jsonForm = JSON.stringify(this.form);
|
422
|
|
- formData.append("form", jsonForm);
|
423
|
|
- modifyDeviceApproval(formData);
|
424
|
|
- const params = { taskId: this.taskForm.taskId };
|
425
|
|
- // 获取下一个流程节点
|
426
|
|
- getNextFlowNode(params).then(res => {
|
427
|
|
- const data = res.data;
|
428
|
|
- this.taskForm.formData = formData;
|
429
|
|
- this.getNextFlowNodeApproval();
|
|
434
|
+ this.$refs['deviceForm'].validate((valid) => {
|
|
435
|
+ if (valid) {
|
|
436
|
+ this.form.formId = this.taskForm.formId;
|
|
437
|
+ this.form.deviceApplyId = this.taskForm.formId;
|
|
438
|
+ let formData = new FormData();
|
|
439
|
+ let jsonForm = JSON.stringify(this.form);
|
|
440
|
+ formData.append("form", jsonForm);
|
|
441
|
+ modifyDeviceApproval(formData);
|
|
442
|
+ const params = { taskId: this.taskForm.taskId };
|
|
443
|
+ // 获取下一个流程节点
|
|
444
|
+ getNextFlowNode(params).then(res => {
|
|
445
|
+ const data = res.data;
|
|
446
|
+ this.taskForm.formData = formData;
|
|
447
|
+ this.getNextFlowNodeApproval();
|
|
448
|
+ })
|
|
449
|
+ } else {
|
|
450
|
+ this.$message.error('必填项未填写完毕')
|
|
451
|
+ }
|
430
|
452
|
})
|
431
|
453
|
},
|
432
|
454
|
// 获取下一个审批人
|
|
@@ -537,25 +559,54 @@ export default {
|
537
|
559
|
} else if (val.length == 1) {
|
538
|
560
|
this.chooseProject = val[0]
|
539
|
561
|
this.isSelect = true
|
540
|
|
- this.form.projectId = val[0].projectId
|
|
562
|
+ this.$set(this.form, 'projectId', val[0].projectId);
|
|
563
|
+ this.$refs.deviceForm.validateField('projectId');
|
541
|
564
|
}
|
542
|
565
|
this.openProject = false
|
543
|
566
|
},
|
544
|
567
|
confirmDevice(val) {
|
545
|
568
|
if (val) {
|
546
|
569
|
let list = []
|
547
|
|
- for (let v of val) {
|
548
|
|
- list.push(v.deviceId)
|
549
|
|
- }
|
550
|
570
|
if (this.taskName == '设备申请') {
|
551
|
|
- this.form.devices = list
|
|
571
|
+ for (let v of val) {
|
|
572
|
+ list.push(v.deviceId)
|
|
573
|
+ }
|
|
574
|
+ this.$set(this.form, 'devices', list);
|
|
575
|
+ this.$refs.deviceForm.validateField('devices');
|
552
|
576
|
this.deviceList = val;
|
553
|
577
|
} else if (this.taskName == '安排设备') {
|
554
|
|
- this.form.modifyDevices = list
|
555
|
|
- this.modifyDeviceList = val;
|
|
578
|
+ if (!this.multiple) {
|
|
579
|
+ this.$set(this.modifyDeviceList, this.clickRowIndex, val);
|
|
580
|
+ } else {
|
|
581
|
+ for (let i of val) {
|
|
582
|
+ this.modifyDeviceList.push(i);
|
|
583
|
+ }
|
|
584
|
+ }
|
|
585
|
+ for (let j of this.modifyDeviceList) {
|
|
586
|
+ list.push(j.deviceId)
|
|
587
|
+ }
|
|
588
|
+ this.form.modifyDevices = list;
|
556
|
589
|
}
|
557
|
590
|
}
|
558
|
591
|
this.openDevice = false;
|
|
592
|
+ },
|
|
593
|
+ replaceRowData(row, rowIndex) {
|
|
594
|
+ this.openDevice = true;
|
|
595
|
+ this.clicDevice = row;
|
|
596
|
+ this.clickRowIndex = rowIndex;
|
|
597
|
+ this.multiple = false;
|
|
598
|
+ },
|
|
599
|
+ deleteRowData(row, rowIndex) {
|
|
600
|
+ let list = [];
|
|
601
|
+ this.modifyDeviceList = this.modifyDeviceList.slice(0, rowIndex).concat(this.modifyDeviceList.slice(rowIndex + 1));
|
|
602
|
+ for (let j of this.modifyDeviceList) {
|
|
603
|
+ list.push(j.deviceId)
|
|
604
|
+ }
|
|
605
|
+ this.form.modifyDevices = list;
|
|
606
|
+ },
|
|
607
|
+ addRowdata() {
|
|
608
|
+ this.openDevice = true;
|
|
609
|
+ this.multiple = true;
|
559
|
610
|
}
|
560
|
611
|
},
|
561
|
612
|
}
|