|
@@ -0,0 +1,353 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="app-container">
|
|
3
|
+ <el-row :gutter="20">
|
|
4
|
+ <el-col :span="18" :xs="24">
|
|
5
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
6
|
+ <el-form-item label="项目信息" prop="projectId">
|
|
7
|
+ <el-button type="primary" size="mini" @click="openProject = true" v-if="taskName == '变更登记'">选择项目</el-button>
|
|
8
|
+ <el-descriptions border v-if="isSelect" style="margin-top: 10px;" :column="2" direction="vertical">
|
|
9
|
+ <el-descriptions-item label="项目名称" label-class-name="my-label">{{ chooseProject.projectName
|
|
10
|
+ }}</el-descriptions-item>
|
|
11
|
+ <el-descriptions-item label="项目编号" label-class-name="my-label">{{ chooseProject.projectNumber
|
|
12
|
+ }}</el-descriptions-item>
|
|
13
|
+ <el-descriptions-item label="甲方单位" label-class-name="my-label">{{ chooseProject.partyA
|
|
14
|
+ }}</el-descriptions-item>
|
|
15
|
+ <el-descriptions-item label="项目类型" label-class-name="my-label">{{ chooseProject.projectType
|
|
16
|
+ }}</el-descriptions-item>
|
|
17
|
+ <el-descriptions-item label="承担部门" label-class-name="my-label">{{
|
|
18
|
+ chooseProject.undertakingDeptName
|
|
19
|
+ }}</el-descriptions-item>
|
|
20
|
+ <el-descriptions-item label="项目负责人" label-class-name="my-label">{{ chooseProject.projectLeaderUser
|
|
21
|
+ ? chooseProject.projectLeaderUser.nickName : ''
|
|
22
|
+ }}</el-descriptions-item>=
|
|
23
|
+ </el-descriptions>
|
|
24
|
+ </el-form-item>
|
|
25
|
+ <el-form-item label="变更内容">
|
|
26
|
+ <el-input type="textarea" :rows="10" v-model="form.content" :disabled="taskName != '项目登记'" />
|
|
27
|
+ </el-form-item>
|
|
28
|
+ <el-row>
|
|
29
|
+ <el-col :span="6" :xs="24" :offset="12">
|
|
30
|
+ <el-form-item label="签名:" label-width="120px">
|
|
31
|
+ <span class="auditor"> {{ registrantName }}
|
|
32
|
+ </span>
|
|
33
|
+ </el-form-item>
|
|
34
|
+ </el-col>
|
|
35
|
+ <el-col :span="6">
|
|
36
|
+ <el-form-item label="登记时间" label-width="120px">
|
|
37
|
+ <span> {{ parseTime(form.registerTime, '{y}-{m}-{d}') }} </span>
|
|
38
|
+ </el-form-item>
|
|
39
|
+ </el-col>
|
|
40
|
+ </el-row>
|
|
41
|
+ </el-form>
|
|
42
|
+ <div style="text-align: center;">
|
|
43
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
44
|
+ <el-button @click="cancel">取 消</el-button>
|
|
45
|
+ </div>
|
|
46
|
+ </el-col>
|
|
47
|
+ <el-col :span="6" :xs="24" v-if="isFlow">
|
|
48
|
+ <el-card>
|
|
49
|
+ <h2 style="text-align: center;">流程进度</h2>
|
|
50
|
+ <div>
|
|
51
|
+ <flow :flowData="flowData" />
|
|
52
|
+ </div>
|
|
53
|
+ </el-card>
|
|
54
|
+ </el-col>
|
|
55
|
+ </el-row>
|
|
56
|
+ <el-dialog title="选择项目" :visible.sync="openProject" width="70%" append-to-body>
|
|
57
|
+ <project-choose @chooseProject="confirmProject"></project-choose>
|
|
58
|
+ </el-dialog>
|
|
59
|
+ </div>
|
|
60
|
+</template>
|
|
61
|
+
|
|
62
|
+<script>
|
|
63
|
+import { listProjectChange, getProjectChange, delProjectChange, addProjectChange, updateProjectChange } from "@/api/oa/project/projectChange";
|
|
64
|
+import { getProject } from "@/api/oa/project/project";
|
|
65
|
+import { getUsersManageLeaderByDept, getUsersDeptLeaderByDept } from '@/api/system/post'
|
|
66
|
+import flow from '@/views/flowable/task/todo/detail/flow';
|
|
67
|
+import { complete, getNextFlowNode } from "@/api/flowable/todo";
|
|
68
|
+import { flowXmlAndNode } from "@/api/flowable/definition";
|
|
69
|
+import projectChoose from '@/views/flowable/form/components/chooseProject.vue';
|
|
70
|
+import { getDept } from "@/api/system/dept";
|
|
71
|
+
|
|
72
|
+export default {
|
|
73
|
+ components: {
|
|
74
|
+ projectChoose,
|
|
75
|
+ flow
|
|
76
|
+ },
|
|
77
|
+ props: {
|
|
78
|
+ taskName: {
|
|
79
|
+ type: String,
|
|
80
|
+ required: true
|
|
81
|
+ },
|
|
82
|
+ taskForm: {
|
|
83
|
+ type: Object,
|
|
84
|
+ required: true
|
|
85
|
+ },
|
|
86
|
+ isFlow: {
|
|
87
|
+ type: Boolean,
|
|
88
|
+ default: true
|
|
89
|
+ },
|
|
90
|
+ },
|
|
91
|
+ data() {
|
|
92
|
+ return {
|
|
93
|
+ // 遮罩层
|
|
94
|
+ loading: true,
|
|
95
|
+ // 选中数组
|
|
96
|
+ ids: [],
|
|
97
|
+ // 非单个禁用
|
|
98
|
+ single: true,
|
|
99
|
+ // 非多个禁用
|
|
100
|
+ multiple: true,
|
|
101
|
+ // 显示搜索条件
|
|
102
|
+ showSearch: true,
|
|
103
|
+ // 总条数
|
|
104
|
+ total: 0,
|
|
105
|
+ // cmc项目变更表格数据
|
|
106
|
+ projectChangeList: [],
|
|
107
|
+ leaderList: [],
|
|
108
|
+ undertakingDeptNameList: [],
|
|
109
|
+ // 弹出层标题
|
|
110
|
+ title: "",
|
|
111
|
+ // 是否显示弹出层
|
|
112
|
+ open: false,
|
|
113
|
+ openProject: false,
|
|
114
|
+ chooseProject: {},
|
|
115
|
+ isSelect: false,
|
|
116
|
+ // 查询参数
|
|
117
|
+ queryParams: {
|
|
118
|
+ pageNum: 1,
|
|
119
|
+ pageSize: 10,
|
|
120
|
+ projectId: null,
|
|
121
|
+ content: null,
|
|
122
|
+ registrant: null,
|
|
123
|
+ registerTime: null
|
|
124
|
+ },
|
|
125
|
+ // 表单参数
|
|
126
|
+ form: {
|
|
127
|
+ registerTime: undefined,
|
|
128
|
+ },
|
|
129
|
+ flowData: {},
|
|
130
|
+ formTotal: 0,
|
|
131
|
+ registrantName: '',
|
|
132
|
+ // 表单校验
|
|
133
|
+ rules: {
|
|
134
|
+ }
|
|
135
|
+ };
|
|
136
|
+ },
|
|
137
|
+ created() {
|
|
138
|
+ this.initForm();
|
|
139
|
+ this.getList();
|
|
140
|
+ if (this.$route.query.projectId) {
|
|
141
|
+ getProject(this.$route.query.projectId).then(res => {
|
|
142
|
+ if (res.data) {
|
|
143
|
+ this.$set(this.form, 'projectId', res.data.projectId)
|
|
144
|
+ this.handleSelectProject(res.data.projectId)
|
|
145
|
+ }
|
|
146
|
+ })
|
|
147
|
+ }
|
|
148
|
+ if (this.isFlow) {
|
|
149
|
+ flowXmlAndNode({ procInsId: this.taskForm.procInsId, deployId: this.taskForm.deployId }).then(res => {
|
|
150
|
+ this.flowData = res.data;
|
|
151
|
+ })
|
|
152
|
+ }
|
|
153
|
+ },
|
|
154
|
+ methods: {
|
|
155
|
+ // 初始化表单
|
|
156
|
+ initForm() {
|
|
157
|
+ getProjectChange(this.taskForm.formId).then(res => {
|
|
158
|
+ if (this.isEmptyObject(res.data)) {
|
|
159
|
+ this.formTotal = 0;
|
|
160
|
+ this.form.registrant = this.$store.getters.userId;
|
|
161
|
+ this.registrantName = this.$store.getters.name;
|
|
162
|
+ this.form.registerTime = new Date();
|
|
163
|
+ }
|
|
164
|
+ else {
|
|
165
|
+ this.formTotal = 1;
|
|
166
|
+ this.form = res.data;
|
|
167
|
+ if (res.data.projectId) {
|
|
168
|
+ getProject(res.data.projectId).then(response => {
|
|
169
|
+ this.chooseProject = response.data;
|
|
170
|
+ this.isSelect = true;
|
|
171
|
+ if (this.form.undertakingDept) {
|
|
172
|
+ let arr = this.chooseProject.undertakingDept.split(',')
|
|
173
|
+ this.getDeptName(arr);
|
|
174
|
+ }
|
|
175
|
+ })
|
|
176
|
+ }
|
|
177
|
+ this.loading = false
|
|
178
|
+ }
|
|
179
|
+ })
|
|
180
|
+ },
|
|
181
|
+ /** 查询cmc项目变更列表 */
|
|
182
|
+ getList() {
|
|
183
|
+ this.loading = true;
|
|
184
|
+ listProjectChange(this.queryParams).then(response => {
|
|
185
|
+ this.projectChangeList = response.rows;
|
|
186
|
+ this.total = response.total;
|
|
187
|
+ this.loading = false;
|
|
188
|
+ });
|
|
189
|
+ },
|
|
190
|
+ isEmptyObject(obj) {
|
|
191
|
+ for (var key in obj) {
|
|
192
|
+ if (obj.hasOwnProperty(key)) {
|
|
193
|
+ return false;
|
|
194
|
+ }
|
|
195
|
+ }
|
|
196
|
+ return true;
|
|
197
|
+ },
|
|
198
|
+ // 选择项目
|
|
199
|
+ handleSelectProject(val) {
|
|
200
|
+ if (val != "" && val != undefined && val != null) {
|
|
201
|
+ getProject(val).then(response => {
|
|
202
|
+ this.chooseProject = response.data;
|
|
203
|
+ this.isSelect = true;
|
|
204
|
+ if (this.chooseProject.undertakingDept) {
|
|
205
|
+ let arr = this.chooseProject.undertakingDept.split(',')
|
|
206
|
+ this.getLeader(arr);
|
|
207
|
+ this.getDeptName(arr);
|
|
208
|
+ }
|
|
209
|
+ })
|
|
210
|
+ } else {
|
|
211
|
+ this.isSelect = false
|
|
212
|
+ }
|
|
213
|
+ },
|
|
214
|
+ confirmProject(val) {
|
|
215
|
+ if (val.length > 1) {
|
|
216
|
+ this.$message.error('请选择一个项目');
|
|
217
|
+ return
|
|
218
|
+ } else if (val.length == 1) {
|
|
219
|
+ this.chooseProject = val[0]
|
|
220
|
+ this.isSelect = true
|
|
221
|
+ this.form.projectId = val[0].projectId
|
|
222
|
+ if (this.chooseProject.undertakingDept) {
|
|
223
|
+ let arr = this.chooseProject.undertakingDept.split(',')
|
|
224
|
+ this.getLeader(arr);
|
|
225
|
+ this.getDeptName(arr);
|
|
226
|
+ }
|
|
227
|
+ }
|
|
228
|
+ this.openProject = false;
|
|
229
|
+ },
|
|
230
|
+ getLeader(val) {
|
|
231
|
+ for (let v of val) {
|
|
232
|
+ getUsersDeptLeaderByDept({ deptId: Number(v) }).then(res => {
|
|
233
|
+ this.leaderList.push(res.data.userId);
|
|
234
|
+ })
|
|
235
|
+ getUsersManageLeaderByDept({ deptId: Number(v) }).then(res => {
|
|
236
|
+ this.leaderList.push(res.data.userId);
|
|
237
|
+ })
|
|
238
|
+ }
|
|
239
|
+ },
|
|
240
|
+ getDeptName(val) {
|
|
241
|
+ for (let v of val) {
|
|
242
|
+ getDept(Number(v)).then(res => {
|
|
243
|
+ this.undertakingDeptNameList.push(res.data.deptName);
|
|
244
|
+ this.chooseProject.undertakingDeptName = this.undertakingDeptNameList.join(',')
|
|
245
|
+ })
|
|
246
|
+ }
|
|
247
|
+ },
|
|
248
|
+ // 取消按钮
|
|
249
|
+ cancel() {
|
|
250
|
+ this.open = false;
|
|
251
|
+ this.reset();
|
|
252
|
+ },
|
|
253
|
+ // 表单重置
|
|
254
|
+ reset() {
|
|
255
|
+ this.form = {
|
|
256
|
+ changeId: null,
|
|
257
|
+ projectId: null,
|
|
258
|
+ content: null,
|
|
259
|
+ registrant: null,
|
|
260
|
+ registerTime: null
|
|
261
|
+ };
|
|
262
|
+ this.resetForm("form");
|
|
263
|
+ },
|
|
264
|
+ /** 搜索按钮操作 */
|
|
265
|
+ handleQuery() {
|
|
266
|
+ this.queryParams.pageNum = 1;
|
|
267
|
+ this.getList();
|
|
268
|
+ },
|
|
269
|
+ /** 重置按钮操作 */
|
|
270
|
+ resetQuery() {
|
|
271
|
+ this.resetForm("queryForm");
|
|
272
|
+ this.handleQuery();
|
|
273
|
+ },
|
|
274
|
+ // 多选框选中数据
|
|
275
|
+ handleSelectionChange(selection) {
|
|
276
|
+ this.ids = selection.map(item => item.changeId)
|
|
277
|
+ this.single = selection.length !== 1
|
|
278
|
+ this.multiple = !selection.length
|
|
279
|
+ },
|
|
280
|
+ /** 新增按钮操作 */
|
|
281
|
+ handleAdd() {
|
|
282
|
+ this.reset();
|
|
283
|
+ this.open = true;
|
|
284
|
+ this.title = "添加cmc项目变更";
|
|
285
|
+ },
|
|
286
|
+ /** 修改按钮操作 */
|
|
287
|
+ handleUpdate(row) {
|
|
288
|
+ this.reset();
|
|
289
|
+ const changeId = row.changeId || this.ids
|
|
290
|
+ getProjectChange(changeId).then(response => {
|
|
291
|
+ this.form = response.data;
|
|
292
|
+ this.open = true;
|
|
293
|
+ this.title = "修改cmc项目变更";
|
|
294
|
+ });
|
|
295
|
+ },
|
|
296
|
+ /** 提交按钮 */
|
|
297
|
+ submitForm() {
|
|
298
|
+ this.$refs["form"].validate(valid => {
|
|
299
|
+ if (valid) {
|
|
300
|
+ if (this.formTotal != 0) {
|
|
301
|
+ updateProjectChange(this.form).then(response => {
|
|
302
|
+ this.$modal.msgSuccess("修改成功");
|
|
303
|
+ this.open = false;
|
|
304
|
+ this.getList();
|
|
305
|
+ });
|
|
306
|
+ const params = { taskId: this.taskForm.taskId };
|
|
307
|
+ getNextFlowNode(params).then(res => {
|
|
308
|
+ if (this.taskName == '变更登记') {
|
|
309
|
+ this.$set(this.taskForm.variables, "approvalList", this.leaderList);
|
|
310
|
+ }
|
|
311
|
+ complete(this.taskForm).then(response => {
|
|
312
|
+ this.$modal.msgSuccess(response.msg);
|
|
313
|
+ this.$emit('goBack')
|
|
314
|
+ });
|
|
315
|
+ })
|
|
316
|
+ } else {
|
|
317
|
+ this.form.changeId = this.taskForm.formId;
|
|
318
|
+ addProjectChange(this.form).then(response => {
|
|
319
|
+ this.$modal.msgSuccess("新增成功");
|
|
320
|
+ this.open = false;
|
|
321
|
+ this.getList();
|
|
322
|
+ });
|
|
323
|
+ const params = { taskId: this.taskForm.taskId };
|
|
324
|
+ getNextFlowNode(params).then(res => {
|
|
325
|
+ this.$set(this.taskForm.variables, "approvalList", this.leaderList);
|
|
326
|
+ complete(this.taskForm).then(response => {
|
|
327
|
+ this.$modal.msgSuccess(response.msg);
|
|
328
|
+ this.$emit('goBack')
|
|
329
|
+ });
|
|
330
|
+ })
|
|
331
|
+ }
|
|
332
|
+ }
|
|
333
|
+ });
|
|
334
|
+ },
|
|
335
|
+ /** 删除按钮操作 */
|
|
336
|
+ handleDelete(row) {
|
|
337
|
+ const changeIds = row.changeId || this.ids;
|
|
338
|
+ this.$modal.confirm('是否确认删除cmc项目变更编号为"' + changeIds + '"的数据项?').then(function () {
|
|
339
|
+ return delProjectChange(changeIds);
|
|
340
|
+ }).then(() => {
|
|
341
|
+ this.getList();
|
|
342
|
+ this.$modal.msgSuccess("删除成功");
|
|
343
|
+ }).catch(() => { });
|
|
344
|
+ },
|
|
345
|
+ /** 导出按钮操作 */
|
|
346
|
+ handleExport() {
|
|
347
|
+ this.download('oa/projectChange/export', {
|
|
348
|
+ ...this.queryParams
|
|
349
|
+ }, `projectChange_${new Date().getTime()}.xlsx`)
|
|
350
|
+ }
|
|
351
|
+ }
|
|
352
|
+};
|
|
353
|
+</script>
|