distribution-courier.vue
2.82 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
119
120
121
122
123
124
125
126
<template>
<div class="add-form">
<el-dialog
:title="titleInfo.text"
:visible.sync="dialogFormVisible"
top="300px"
>
<el-form
ref="dataForm"
:rules="ruleInline"
:model="institutionsAddForm"
label-position="left"
label-width="150px"
style="width: 50%;"
>
<el-form-item
label="选择快递员"
prop="company"
>
<el-select
v-model="value"
style="width:300px"
clearable
placeholder="请选择"
/>
</el-form-item>
<div
slot="footer"
class="dialog-footer"
>
<el-button
style="background-color:#E15536;color:#ffffff;"
@click="createData"
>确认</el-button>
<el-button @click="dialogFormH">取消</el-button>
</div>
</el-form>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'InstitutionsAdd',
props: {
titleInfo: {
type: Object,
required: true
}
},
data() {
return {
// 是否可以编辑
disabled: true,
activeClass: 'active',
disactiveClass: 'disactive',
institutionsAddForm: {
shortName: '',
jgbh: 'WD001',
company: ''
},
dialogFormVisible: false,
// 表单验证
ruleInline: {
shortName: [
{ required: true, message: '机构简称不能为空', trigger: 'blur' }
],
company: [{ required: true, message: '请选择省份', trigger: 'change' }]
}
}
},
computed: {},
// 挂载结束
mounted: function() {},
// 创建完毕状态
created() {
this.showcity()
},
// 组件更新
updated: function() {},
methods: {
// 弹层显示
dialogFormV() {
this.dialogFormVisible = true
},
// 弹层隐藏
dialogFormH() {
this.dialogFormVisible = false
},
// 表单提交
createData() {
this.$refs['dataForm'].validate(async valid => {
if (valid) {
this.dialogFormH()
const data = {
...this.formBase
}
if (this.formBase.id) {
// eslint-disable-next-line no-undef
await update(data).then(() => {
this.$emit('newDataes', this.formBase)
})
} else {
// eslint-disable-next-line no-undef
await add(this.formBase).then(() => {
this.$emit('newDataes', this.formBase)
})
}
} else {
this.$message.error('*号为必填项!')
}
})
}
}
}
</script>
<style>
.el-form--label-left .el-form-item__label {
/* text-align: right; */
}
.el-form-item--medium {
/* margin-bottom: 22px; */
}
.el-dialog__footer {
/* text-align: center; */
}
</style>