clxxAddDialog.vue
2.94 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
112
113
114
115
116
117
118
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-07-18 08:55:31
-->
<template>
<dialogBox title="新建材料信息" width="20%" isMain v-model="myValue" @closeDialog="closeDialog" @submitForm="handleSubmit"
:isFullscreen="false">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item label="材料类型" prop="cllx">
<el-select v-model="ruleForm.cllx" class="width100" placeholder="请选择">
<el-option v-for="item in dictData['A40']" :key="item.dcode" :label="item.dname" :value="item.dcode">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="材料名称" prop="clmc">
<el-input v-model="ruleForm.clmc"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item
label="是否公共材料"
>
<el-radio-group
v-model="ruleForm.sfggcl"
>
<el-radio label="1">是</el-radio>
<el-radio label="0">否</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
</dialogBox>
</template>
<script>
import { mapGetters } from "vuex";
export default {
props: {
value: { type: Boolean, default: false },
},
data () {
return {
myValue: this.value,
ruleForm: {
cllx: "",
clmc: "",
sfggcl:"0"
},
rules: {
cllx: [
{ required: true, message: '请选择材料类型', trigger: 'change' }
],
clmc: [
{ required: true, message: '请输入材料名称', trigger: 'blur' }
]
}
}
},
computed: {
...mapGetters(["dictData"]),
},
watch: {
value (val) {
this.myValue = val;
},
},
methods: {
/**
* @description: closeDialog
* @author: renchao
*/
closeDialog () {
this.$emit("input", false);
this.ruleForm = {
cllx: "",
clmc: "",
}
},
/**
* @description: handleSubmit
* @author: renchao
*/
handleSubmit () {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.$parent.addSave(this.ruleForm);
this.ruleForm = {
cllx: "",
clmc: "",
sfggcl:"0"
}
this.$emit("input", false);
} else {
return false;
}
})
}
}
};
</script>
<style scoped lang="scss">
.submit-button {
text-align: center;
height: 52px;
padding-top: 10px;
background-color: #fff;
}
</style>