projectSubmissionDialog.vue
3.03 KB
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
<template>
<div>
<el-dialog
:title="dialogForm.title"
:visible.sync="dialogForm.dialogVisible"
width="30%"
@close="handleClose">
<el-row>
<el-form :model="dialogForm" ref="dialogForm" :rules="rules">
<el-form-item :label="dialogForm.label" prop="textarea">
<el-input
type="textarea"
:autosize="{ minRows: 4, maxRows:5}"
placeholder="请输入内容"
v-model="dialogForm.textarea">
</el-input>
</el-form-item>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="handleSubmit('dialogForm')">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { submitData } from '@/api/projectSubmission'
export default {
name: "projectSubmissionDialog",
data(){
return {
dialogForm:{
dialogVisible:false,
title:'入库',
textarea:'',
label:'入库说明:',
fProjectId:'',
fEventType:''
},
rules:{
textarea:[
{ required: true, message: '请填写入库说明', trigger: 'blur' }
]
}
}
},
methods:{
open(type,row){
console.log('打印type',type);
console.log('打印row',row);
this.dialogType = type;
this.dialogForm.fProjectId = row.id_;
this.dialogForm.dialogVisible = true;
switch (type){
case 'rk':
this.dialogForm.title = '入库';
this.dialogForm.label ='入库说明:';
this.dialogForm.fEventType = 'ruku';
break;
case 'zf':
this.dialogForm.label = '作废说明:';
this.dialogForm.title = '作废';
this.dialogForm.fEventType = 'zuofei';
break;
case 'xmjz':
this.dialogForm.title = '项目进展';
this.dialogForm.label ='本次项目进展说明:';
this.dialogForm.fEventType = 'xiangmujinzhan';
break;
case 'zf':
this.dialogForm.label = '出库说明:';
this.dialogForm.title = '出库';
this.dialogForm.fEventType = 'chuku';
break;
}
},
handleSubmit(formName){
this.$refs[formName].validate(async (valid) => {
if (valid) {
let params ={
fProjectId:this.dialogForm.fProjectId,
fEventType:this.dialogForm.fEventType,
fProgressStatus:this.dialogForm.textarea
}
await submitData(params).then((res)=>{
console.log('打印res',res);
if(res.code == 200){
this.$emit('handleRefresh');
}
this.dialogForm.dialogVisible = false;
})
} else {
console.log('error submit!!');
return false;
}
});
},
handleClose(){
this.$refs.dialogForm.resetFields();
this.dialogForm.dialogVisible = false;
},
}
}
</script>
<style scoped>
</style>