1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
<template>
<div class="assignment-edit" style="height: 70vh;overflow: auto;">
<a-form-model ref="form" :model="formData" :rules="rules" class="from-table">
<a-row>
<a-col :span="24">
<div class="tb-title">
<span>研究项目</span>
</div>
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
项目名称
</a-col>
<a-col :span="22" v-if="formData.projName != null">
{{formData.projName}}
</a-col>
</a-row>
<a-row>
<a-col :span="24">
<div class="tb-title">
<span>第一承担单位</span>
</div>
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
名称
</a-col>
<a-col :span="10">
{{formData.appUnitName}}
</a-col>
<a-col :span="2" class="bg-gray">
联系电话
</a-col>
<a-col :span="10">
{{formData.linkTel}}
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
地址
</a-col>
<a-col :span="10">
{{formData.linkAddress}}
</a-col>
<a-col :span="2" class="bg-gray">
邮政编码
</a-col>
<a-col :span="10">
{{formData.postcode}}
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
主管部门
</a-col>
<a-col :span="22">
{{formData.authority}}
</a-col>
</a-row>
<a-row>
<a-col :span="24">
<div class="tb-title">
<span>项目负责人</span>
</div>
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
姓名
</a-col>
<a-col :span="10">
{{formData.appPersonName}}
</a-col>
<a-col :span="2" class="bg-gray">
性别
</a-col>
<a-col :span="10">
{{formData.sex}}
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
出生年
</a-col>
<a-col :span="10">
{{formData.birthYear}}
</a-col>
<a-col :span="2" class="bg-gray">
联系电话
</a-col>
<a-col :span="10">
{{formData.mobile}}
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
学位
</a-col>
<a-col :span="10">
{{formData.degreeName}}
</a-col>
<a-col :span="2" class="bg-gray">
职称
</a-col>
<a-col :span="10">
{{formData.titleName}}
</a-col>
</a-row>
<a-row>
<a-col :span="24">
<div class="tb-title">
<span>项目组</span>
</div>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="special-middle">
<div class="required">实施目标和主要内容</div>
</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="testContent">
<a-textarea placeholder="实施目标和主要内容" v-model="formData.testContent" :maxLength="400" style="width: 80%;height: 160px;margin-top: 12px;" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required special-middle">预期成果形式</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="target">
<div style="display: flex;flex-wrap: wrap;line-height: 2.5;">
<div v-for="(item, index) in formData.target" :key="index" style="margin-right: 20px;">
<a-checkbox :checked="item.checked" :name="item.targetId" @change="onTargetChange(item)">{{item.targetName}}</a-checkbox>
<a-input-number size="small" :min="0" :max="1000" v-model="item.resultCount" :disabled="!item.checked" />
</div>
</div>
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">总经费</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="budgetCount">
<a-input-number :min="0" :max="10000000" v-model="formData.budgetCount" style="width: 10%" /> (万元)
</a-form-model-item>
</a-col>
<!-- <a-col :span="4" class="bg-gray">
<div class="required">市卫计委资助</div>
</a-col>
<a-col :span="8">
<a-form-model-item prop="budgetGovCount">
<a-input-number :min="0" :max="10000000" v-model="formData.budgetGovCount" style="width: 30%" /> (万元)
</a-form-model-item>
</a-col> -->
</a-row>
<a-row>
<a-col :span="4" class="bg-gray">
<div class="required">起止日期</div>
</a-col>
<a-col :span="20">
<a-form-model-item prop="startDate" style="flex-basis: 30%;">
<a-date-picker format="YYYY-MM-DD" valueFormat="YYYY-MM-DD HH:mm:ss" v-model="formData.startDate" style="width: 100%" @change="dateChange(formData)" />
</a-form-model-item>
<span style="margin: -12px 10px 0 10px;">~</span>
<a-form-model-item prop="endDate" style="flex-basis: 30%;">
<a-date-picker format="YYYY-MM-DD" valueFormat="YYYY-MM-DD HH:mm:ss" v-model="formData.endDate" style="width: 100%" @change="dateChange(formData)" />
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
<div class="tb-title">
<span>一、项目要实现的目标和主要研发内容</span>
</div>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
(一)项目要实现的目标
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
序号
</a-col>
<a-col :span="20" class="bg-gray">
内容
</a-col>
<a-col :span="2" class="bg-gray">
操作
</a-col>
</a-row>
<a-row v-for="(item, index) in formData.cont1" :key="'cont1' + index">
<a-col :span="2">
({{index + 1}})
</a-col>
<a-col :span="20">
<a-form-model-item :prop="'cont1.' + index + '.contentInfo'" :rules="{ required: true, message: '内容不能为空' }">
<a-input v-model="item.contentInfo" :maxLength="200" style="width: 90%;" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="removeCont(item, 'cont1')">
<a-button type="link" size="small">删除</a-button>
</a-popconfirm>
</a-col>
</a-row>
<a-row>
<a-col :span="24" style="text-align: center;">
<a-button type="dashed" style="width: 50%" @click="addCont('cont1')">
<a-icon type="plus" /> 添加
</a-button>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
(二)主要研发内容
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
序号
</a-col>
<a-col :span="20" class="bg-gray">
内容
</a-col>
<a-col :span="2" class="bg-gray">
操作
</a-col>
</a-row>
<a-row v-for="(item, index) in formData.cont2" :key="'cont2' + index">
<a-col :span="2">
({{index + 1}})
</a-col>
<a-col :span="20">
<a-form-model-item :prop="'cont2.' + index + '.contentInfo'" :rules="{ required: true, message: '内容不能为空' }">
<a-input v-model="item.contentInfo" :maxLength="200" style="width: 90%;" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="removeCont(item, 'cont2')">
<a-button type="link" size="small">删除</a-button>
</a-popconfirm>
</a-col>
</a-row>
<a-row>
<a-col :span="24" style="text-align: center;">
<a-button type="dashed" style="width: 50%" @click="addCont('cont2')">
<a-icon type="plus" /> 添加
</a-button>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
<div class="tb-title">
<span>二、项目的考核指标</span>
</div>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
(一)主要技术及学术指标 (形成的专利、新技术、新产品、新装置、论文专著、软件等的数量、指标及其水平等)
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
序号
</a-col>
<a-col :span="20" class="bg-gray">
内容
</a-col>
<a-col :span="2" class="bg-gray">
操作
</a-col>
</a-row>
<a-row v-for="(item, index) in formData.cont3" :key="'cont3' + index">
<a-col :span="2">
({{index + 1}})
</a-col>
<a-col :span="20">
<a-form-model-item :prop="'cont3.' + index + '.contentInfo'" :rules="{ required: true, message: '内容不能为空' }">
<a-input v-model="item.contentInfo" :maxLength="200" style="width: 90%;" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="removeCont(item, 'cont3')">
<a-button type="link" size="small">删除</a-button>
</a-popconfirm>
</a-col>
</a-row>
<a-row>
<a-col :span="24" style="text-align: center;">
<a-button type="dashed" style="width: 50%" @click="addCont('cont3')">
<a-icon type="plus" /> 添加
</a-button>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
(二)人才培养
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
序号
</a-col>
<a-col :span="20" class="bg-gray">
内容
</a-col>
<a-col :span="2" class="bg-gray">
操作
</a-col>
</a-row>
<a-row v-for="(item, index) in formData.cont4" :key="'cont4' + index">
<a-col :span="2">
({{index + 1}})
</a-col>
<a-col :span="20">
<a-form-model-item :prop="'cont4.' + index + '.contentInfo'" :rules="{ required: true, message: '内容不能为空' }">
<a-input v-model="item.contentInfo" :maxLength="200" style="width: 90%;" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="removeCont(item, 'cont4')">
<a-button type="link" size="small">删除</a-button>
</a-popconfirm>
</a-col>
</a-row>
<a-row>
<a-col :span="24" style="text-align: center;">
<a-button type="dashed" style="width: 50%" @click="addCont('cont4')">
<a-icon type="plus" /> 添加
</a-button>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
(三)其他应考核的指标
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
序号
</a-col>
<a-col :span="20" class="bg-gray">
内容
</a-col>
<a-col :span="2" class="bg-gray">
操作
</a-col>
</a-row>
<a-row v-for="(item, index) in formData.cont5" :key="'cont5' + index">
<a-col :span="2">
({{index + 1}})
</a-col>
<a-col :span="20">
<a-form-model-item :prop="'cont5.' + index + '.contentInfo'" :rules="{ required: true, message: '内容不能为空' }">
<a-input v-model="item.contentInfo" :maxLength="200" style="width: 90%;" />
</a-form-model-item>
</a-col>
<a-col :span="2">
<a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="removeCont(item, 'cont5')">
<a-button type="link" size="small">删除</a-button>
</a-popconfirm>
</a-col>
</a-row>
<a-row>
<a-col :span="24" style="text-align: center;">
<a-button type="dashed" style="width: 50%" @click="addCont('cont5')">
<a-icon type="plus" /> 添加
</a-button>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
<div class="tb-title">
<span>三、项目阶段实施内容及目标</span>
</div>
</a-col>
</a-row>
<a-row>
<a-col :span="2" class="bg-gray">
阶段
</a-col>
<a-col :span="12" class="bg-gray">
阶段实施内容及阶段目标
</a-col>
<a-col :span="8" class="bg-gray">
起止日期
</a-col>
<a-col :span="2" class="bg-gray">
操作
</a-col>
</a-row>
<a-row v-for="(item, index) in formData.cont6" :key="'cont6' + index">
<a-col :span="2">
<div class="special-middle">({{index + 1}})</div>
</a-col>
<a-col :span="12">
<a-form-model-item :prop="'cont6.' + index + '.contentInfo'" :rules="{ required: true, message: '内容不能为空' }">
<a-textarea v-model="item.contentInfo" placeholder="项目阶段实施内容及目标" :maxLength="500" style="width: 90%;height: 140px;margin-top: 12px;" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<div class="flex-layout special-middle">
<a-form-model-item :prop="'cont6.' + index + '.startTime'" :rules="{ required: true, message: '内容不能为空' }" style="flex-basis: 45%;">
<a-date-picker format="YYYY-MM-DD" valueFormat="YYYY-MM-DD HH:mm:ss" v-model="item.startTime" style="width: 100%" @change="dateChange(item)" />
</a-form-model-item>
<span style="margin: -12px 10px 0 10px;">~</span>
<a-form-model-item :prop="'cont6.' + index + '.endTime'" :rules="{ required: true, message: '内容不能为空' }" style="flex-basis: 45%;">
<a-date-picker format="YYYY-MM-DD" valueFormat="YYYY-MM-DD HH:mm:ss" v-model="item.endTime" style="width: 100%" @change="dateChange(item)" />
</a-form-model-item>
</div>
</a-col>
<a-col :span="2">
<div class="special-middle">
<a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="removeCont(item, 'cont6')" class="special-middle">
<a-button type="link" size="small">删除</a-button>
</a-popconfirm>
</div>
</a-col>
</a-row>
<a-row>
<a-col :span="24" style="text-align: center;">
<a-button type="dashed" style="width: 50%" @click="addCont('cont6')">
<a-icon type="plus" /> 添加
</a-button>
</a-col>
</a-row>
<proj-group-member :members.sync="formData.members" />
<budget-edit :budget.sync="formData.budget" />
<a-row style="margin-top: 20px;text-align:center;">
<a-button style="margin-right: 50px;" @click="save">保存</a-button>
<a-button type="primary" @click="submit">完成填写</a-button>
</a-row>
</a-form-model>
</div>
</template>
<script>
import ProjGroupMember from "@/views/report/project/components/projectMemberEdit"
import BudgetEdit from '@/views/report/project/components/budgetEdit'
import { isEmptyParams } from "@/views/utils/common"
const cont1 = () => { return { id: null, testId: null, contentInfo: '', startTime: null, endTime: null, contentType: 'd37abeb6-14e0-4486-924d-e1e4baf67098', showIndex: 1 } }
const cont2 = () => { return { id: null, testId: null, contentInfo: '', startTime: null, endTime: null, contentType: 'b1fe4003-16ed-482f-8fd5-e34b1482c3d4', showIndex: 1 } }
const cont3 = () => { return { id: null, testId: null, contentInfo: '', startTime: null, endTime: null, contentType: 'b19cf66b-c1bb-4974-a524-114c1895dbd8', showIndex: 1 } }
const cont4 = () => { return { id: null, testId: null, contentInfo: '', startTime: null, endTime: null, contentType: 'cf3abeff-9f1a-420e-b375-6aad33f12080', showIndex: 1 } }
const cont5 = () => { return { id: null, testId: null, contentInfo: '', startTime: null, endTime: null, contentType: 'f1cea24c-d13d-48af-8abb-58eed9367c27', showIndex: 1 } }
const cont6 = () => { return { id: null, testId: null, contentInfo: '', startTime: null, endTime: null, contentType: 'ebcdf2b0-011c-4d40-a064-f22d6f7ec646', showIndex: 1 } }
export default {
name: "TestEdit",
data () {
return {
formData: {
id: '',
projId: '',
// 实施目标和主要内容
testContent: '',
// 总经费
budgetCount: 0,
// 市卫计委资助
budgetGovCount: 0,
// 起止日期
startDate: null,
endDate: null,
// 申报人
appPersonName: null,
sex: null,
birthYear: null,
mobile: null,
degreeName: null,
titleName: null,
// 依托单位
appUnitName: null,
linkEmail: null,
linkTel: null,
linkAddress: null,
postcode: null,
authority: null,
// 项目内容
cont1: [cont1()],
cont2: [cont2()],
cont3: [cont3()],
cont4: [cont4()],
cont5: [cont5()],
cont6: [cont6()],
// 成员
members: [],
// 预期成果形式
target: [],
// 经费
budget: [],
},
rules: {
testContent: { required: true, message: '请填写实施目标和主要内容', trigger: 'blur' },
target: { required: true, message: '请选择预期成果形式' },
budgetCount: { required: true, message: '请填写总经费', trigger: 'blur' },
budgetGovCount: { required: true, message: '请填写市卫计委资助', trigger: 'blur' },
startDate: { required: true, message: '请选择起始日期', trigger: 'change' },
endDate: { required: true, message: '请选择结束日期', trigger: 'change' },
}
}
},
props: {
value: {
type: String,
default: () => {
return null
}
},
},
components: {
ProjGroupMember,BudgetEdit
},
created () {
this.getTestInfoByProjId()
},
methods: {
getTestInfoByProjId () {
let pars = { projId: this.value }
this.$api.taskReport.getTestInfoByProjId(pars).then(({ data = {} }) => {
if (data) {
this.formData = data
if (this.formData.cont1 === null) {
this.formData.cont1 = [cont1()];
this.formData.cont2 = [cont2()];
this.formData.cont3 = [cont3()];
this.formData.cont4 = [cont4()];
this.formData.cont5 = [cont5()];
this.formData.cont6 = [cont6()];
}
}
}).catch(() => {
})
},
save () {
let state = this.formData.testState
if (state == null)
this.formData.testState = -20
let pars = isEmptyParams(this.formData)
let par = { ...pars }
this.$api.taskReport.save(par).then(({ data = {} }) => {
if (data) {
this.formData.id = data
this.$message.success('保存成功!')
}
}).catch(() => {
})
},
submit () {
this.$refs.form.validate(valid => {
if (valid && this.checkApplyMoney()) {
let state = this.formData.testState
if (state != 30)
this.formData.testState = -10
let pars = isEmptyParams(this.formData)
let par = { ...pars }
this.$api.taskReport.save(par).then(({ data = {} }) => {
if (data) {
this.formData.id = data
this.$message.success('填写完成!')
this.$emit('close', 'edit')
}
}).catch(() => {
})
} else {
this.$message.success('任务书信息未填写完全,请检查!')
return false
}
})
},
checkApplyMoney () {
if (this.formData.budgetCount != null && this.formData.budgetCount != this.formData.budget[0].totalBudget) {
alert('项目经费与总经费不一致!')
return false
} else {
return true
}
},
onTargetChange (item) {
item.checked = !item.checked
if (item.checked) {
item.result = 'True'
} else {
item.result = 'False'
}
},
// 添加项目内容
addCont (key) {
switch (key) {
case 'cont1':
this.formData[key].push(cont1())
break
case 'cont2':
this.formData[key].push(cont2())
break
case 'cont3':
this.formData[key].push(cont3())
break
case 'cont4':
this.formData[key].push(cont4())
break
case 'cont5':
this.formData[key].push(cont5())
break
case 'cont6':
this.formData[key].push(cont6())
break
}
},
// 删除项目内容
removeCont (item, key) {
let index = this.formData[key].indexOf(item)
if (index !== -1) {
this.formData[key].splice(index, 1)
}
},
// 起止日期选择处理
dateChange (t) {
let statr = t.start_date
let end = t.end_date
if (!statr || !end) {
return
}
if (statr > end) {
t.start_date = end
t.end_date = statr
}
}
}
}
</script>
<style lang="less" scoped>
</style>