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
| <template>
| <el-dialog
| :visible="value"
| width="50%"
| :modal="false"
| :show-close="false"
| :title="rankID.id ? '编辑志愿者组织' : '新增志愿者组织'"
| :before-close="onCancel"
| >
| <el-form
| ref="form"
| :model="form"
| :rules="rules"
| label-position="right"
| label-width="150px"
| class="orgForm"
| >
|
| <el-form-item label="组织名称:" prop="name">
| <el-input
| v-model.trim="form.name"
| maxlength="10"
| placeholder="请输入组织名称,不超过10字"
| size="small"
| ></el-input>
| </el-form-item>
| <el-form-item>
| <el-button @click="onCancel()">取消</el-button>
| <el-button type="primary" @click="send('form')">确认</el-button>
| </el-form-item>
| </el-form>
| </el-dialog>
| </template>
|
| <script>
| // import * as organizationServicer from '@/services/organizationServicer';
|
| export default {
| components: { },
| props: {
| value: { type: Boolean },
| rankID: {}
| },
|
| data() {
| return {
| form: {
| name: '',
| parentId: 0,
| id: ''
| },
| rules: {
| name: [
| { required: true, message: '请输入组织名称', trigger: 'blur' }
| ]
|
| }
|
| }
| },
| watch: {
| rankID(val) {
| console.log(val)
| this.form.name = val.label;
| this.form.id = val.id;
| }
| },
| mounted() {
|
| },
| methods: {
|
| /** 取消 */
| onCancel () {
| this.$emit('change', false);
| },
|
| /** 确认 */
| send(formName) {
| this.$refs[formName].validate((valid) => {
| if (valid) {
| // console.log(this.form)
| if (this.rankID.id) {
| this.editExamine()
| } else {
| this.saveExamine()
| }
| } else {
| return false;
| }
| });
| },
|
| async saveExamine() {
| // return
| // await organizationServicer.addVolunteerOrg(this.form)
| this.$api.post('volunteer/org/add',this.form,e=>{
| this.$message('新增成功');
| this.form = {
| serviceTypeId: '',
| name: '',
| parentId: ''
| }
| this.$refs['form'].resetFields();
| this.$emit('success');
| })
|
| },
| async editExamine() {
| // return
| // await organizationServicer.editVolunteerOrg(this.form)
| this.$api.post('volunteer/org/edit',this.form,e=>{
| this.$message('编辑成功');
| this.form = {
| serviceTypeId: '',
| name: '',
| parentId: ''
| }
| this.$refs['form'].resetFields();
| this.$emit('success');
| })
|
| }
|
| }
|
| }
| </script>
|
| <style lang="less" scoped>
| .flex {
| display: flex;
| flex-wrap: wrap;
| .avatar {
| margin: 0 10px 10px 0;
| position: relative;
| width: 104px;
| height: 104px;
| border: 1px dashed #eee;
| text-align: center;
| color: #ccc;
| cursor: pointer;
| img {
| display: block;
| width: 100%;
| height: 100%;
| }
| .close {
| position: absolute;
| right: -8px;
| top: -8px;
| width: 16px;
| height: 16px;
| border-radius: 50%;
| background-color: tomato;
| color: #fff;
| cursor: pointer;
| }
| i {
| font-size: 25px;
| margin: 30px auto 10px;
| display: block;
| }
| b {
| font-size: 12px;
| }
| }
| }
| </style>
|
|