|
@@ -0,0 +1,608 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="main-contain">
|
|
3
|
+ <div class="position">
|
|
4
|
+ <bread-crumb :crumbs='crumbs'></bread-crumb>
|
|
5
|
+ </div>
|
|
6
|
+ <div class="app-container " >
|
|
7
|
+ <el-form ref="form" :model="form" label-width="80px" id="edit-org-info-form" v-loading="formloading" :element-loading-text="loadingText" class="clearfix" :popper-append-to-body="false" >
|
|
8
|
+ <el-row >
|
|
9
|
+ <el-col :span="24" >
|
|
10
|
+ <el-form-item label="机构名称:" prop="org_name">
|
|
11
|
+ <el-input v-model="form.org_name" placeholder="机构名称" ></el-input>
|
|
12
|
+ </el-form-item>
|
|
13
|
+ <el-form-item label="商家简称:" prop="org_short_name">
|
|
14
|
+ <el-input v-model="form.org_short_name" placeholder="商家简称" ></el-input>
|
|
15
|
+ </el-form-item>
|
|
16
|
+ <el-form-item label="机构介绍:" prop="org_introduction">
|
|
17
|
+ <!-- <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="机构介绍" v-model="form.org_introduction"> </el-input> -->
|
|
18
|
+ <keep-alive>
|
|
19
|
+ <neditor ref="neditor"
|
|
20
|
+ id="editor"
|
|
21
|
+ v-bind:r_content="form.org_introduction">
|
|
22
|
+ </neditor>
|
|
23
|
+ </keep-alive>
|
|
24
|
+ </el-form-item>
|
|
25
|
+ <el-form-item label="机构头像:" prop="org_logo">
|
|
26
|
+ <el-upload
|
|
27
|
+ v-loading="uploading"
|
|
28
|
+ :element-loading-text="loadingText"
|
|
29
|
+ class="avatar-uploader"
|
|
30
|
+ :data="uploadData"
|
|
31
|
+ action="https://upload.qiniup.com"
|
|
32
|
+ :show-file-list="false"
|
|
33
|
+ :on-error="handleAvatarError"
|
|
34
|
+ :on-success="handleAvatarSuccess"
|
|
35
|
+ :before-upload="beforeAvatarUpload">
|
|
36
|
+ <img v-if="form.org_logo" :src="form.org_logo" class="avatar">
|
|
37
|
+ <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
38
|
+ </el-upload>
|
|
39
|
+ </el-form-item>
|
|
40
|
+ <el-form-item label="机构地区:" prop="org_area">
|
|
41
|
+ <el-select v-model="form.province" clearable filterable placeholder="请选择" @change="changeProvince">
|
|
42
|
+ <el-option
|
|
43
|
+ v-for="item in provinces"
|
|
44
|
+ :key="item.id"
|
|
45
|
+ :label="item.name"
|
|
46
|
+ :value="item.id">
|
|
47
|
+ </el-option>
|
|
48
|
+ </el-select>
|
|
49
|
+ <el-select v-model="form.city" v-show="form.province&&citys.length>0" clearable filterable placeholder="请选择" @change="changeCity">
|
|
50
|
+ <el-option
|
|
51
|
+ v-for="item in citys"
|
|
52
|
+ :key="item.id"
|
|
53
|
+ :label="item.name"
|
|
54
|
+ :value="item.id">
|
|
55
|
+ </el-option>
|
|
56
|
+ </el-select>
|
|
57
|
+ <el-select v-model="form.district" v-show="form.city&&districts.length>0" clearable filterable placeholder="请选择">
|
|
58
|
+ <el-option
|
|
59
|
+ v-for="item in districts"
|
|
60
|
+ :key="item.id"
|
|
61
|
+ :label="item.name"
|
|
62
|
+ :value="item.id">
|
|
63
|
+ </el-option>
|
|
64
|
+ </el-select>
|
|
65
|
+ </el-form-item>
|
|
66
|
+ <el-form-item label="机构地址:" prop="address">
|
|
67
|
+ <el-input v-model="form.address" placeholder="机构地址" ></el-input>
|
|
68
|
+ </el-form-item>
|
|
69
|
+ <el-form-item label="机构类型:" prop="org_type">
|
|
70
|
+ <el-select v-model="form.parent_type" clearable placeholder="请选择" @change="changeParentType" >
|
|
71
|
+ <el-option
|
|
72
|
+ v-for="item in orgtypes"
|
|
73
|
+ :key="item.id"
|
|
74
|
+ :label="item.name"
|
|
75
|
+ :value="item.id">
|
|
76
|
+ </el-option>
|
|
77
|
+ </el-select>
|
|
78
|
+ <el-select v-model="form.child_type" v-show="form.parent_type&&childtypes.length>0" clearable placeholder="请选择" @change="changeChildType">
|
|
79
|
+ <el-option
|
|
80
|
+ v-for="item in childtypes"
|
|
81
|
+ :key="item.id"
|
|
82
|
+ :label="item.name"
|
|
83
|
+ :value="item.id">
|
|
84
|
+ </el-option>
|
|
85
|
+ </el-select>
|
|
86
|
+ </el-form-item>
|
|
87
|
+ <el-form-item label="机构电话:" prop="telephone">
|
|
88
|
+ <el-input v-model="form.telephone" placeholder="机构电话" ></el-input>
|
|
89
|
+ </el-form-item>
|
|
90
|
+ <el-form-item label="营业状态:" prop="operating_state">
|
|
91
|
+ <el-radio-group v-model="form.operating_state" >
|
|
92
|
+ <el-radio v-for="item in operatingStateOptions" :key="item.value" :label="item.value" :value="item.value" >{{item.label}}</el-radio>
|
|
93
|
+ </el-radio-group>
|
|
94
|
+ </el-form-item>
|
|
95
|
+ <el-form-item label="营业时间:" prop="business_time">
|
|
96
|
+ <el-input v-model="form.business_week" placeholder="营业时间" style="width:48%"></el-input>
|
|
97
|
+ <el-input v-model="form.business_time" placeholder="营业时间" style="width:48%"></el-input>
|
|
98
|
+ </el-form-item>
|
|
99
|
+ <el-form-item label="" prop="business_time">
|
|
100
|
+ <el-checkbox-group v-model="form.business_week_select" @change="handleChangeWeek">
|
|
101
|
+ <el-checkbox v-for="(item, index) in weekOptions" :label="item" :key="index" :value="item" >{{item}}</el-checkbox>
|
|
102
|
+ </el-checkbox-group>
|
|
103
|
+ </el-form-item>
|
|
104
|
+
|
|
105
|
+ <el-form-item label="上午:" prop="business_time">
|
|
106
|
+ <el-radio-group v-model="form.business_time_shange" @change="handleChangeTime">
|
|
107
|
+ <el-radio v-for="(item, index) in shangOptions" :key="index" :label="item" :value="item" >{{item}}</el-radio>
|
|
108
|
+ </el-radio-group>
|
|
109
|
+ </el-form-item>
|
|
110
|
+
|
|
111
|
+ <el-form-item label="下午:" prop="business_time_xia">
|
|
112
|
+ <el-radio-group v-model="form.business_time_xia" @change="handleChangeTime">
|
|
113
|
+ <el-radio v-for="(item, index) in xiaOptions" :key="index" :label="item" :value="item" >{{item}}</el-radio>
|
|
114
|
+ </el-radio-group>
|
|
115
|
+ </el-form-item>
|
|
116
|
+
|
|
117
|
+ <el-form-item label="服务病种:" prop="illness">
|
|
118
|
+ <el-checkbox-group v-model="form.illness_list" @change="handleChangeIllness">
|
|
119
|
+ <el-checkbox v-for="item in illnessOptions" :label="item.id" :key="item.id" :value="item.id" >{{item.illness_name}}</el-checkbox>
|
|
120
|
+ </el-checkbox-group>
|
|
121
|
+ </el-form-item>
|
|
122
|
+ <el-form-item label="机构图册:" prop="gallery">
|
|
123
|
+ <el-upload
|
|
124
|
+ v-loading="guploading"
|
|
125
|
+ :data="uploadData"
|
|
126
|
+ action="https://upload.qiniup.com"
|
|
127
|
+ list-type="picture-card"
|
|
128
|
+ :file-list="fileList"
|
|
129
|
+ :on-remove="handleRemove"
|
|
130
|
+ :on-error="handleGalleryError"
|
|
131
|
+ :on-success="handleGallerySuccess"
|
|
132
|
+ :before-upload="beforeGalleryUpload">
|
|
133
|
+ <i class="el-icon-plus"></i>
|
|
134
|
+ </el-upload>
|
|
135
|
+ </el-form-item>
|
|
136
|
+ </el-col>
|
|
137
|
+ </el-row>
|
|
138
|
+
|
|
139
|
+ <el-row :span="24">
|
|
140
|
+ <el-col :span="24" align="right" >
|
|
141
|
+ <el-form-item>
|
|
142
|
+ <el-button @click="$router.back(-1)" icon="el-icon-refresh" size="small">取消</el-button>
|
|
143
|
+ <el-button @click="submitForm" size="small" type="primary" icon="el-icon-setting" >保存</el-button>
|
|
144
|
+ </el-form-item>
|
|
145
|
+ </el-col>
|
|
146
|
+ </el-row>
|
|
147
|
+
|
|
148
|
+ </el-form>
|
|
149
|
+
|
|
150
|
+ </div>
|
|
151
|
+ </div>
|
|
152
|
+
|
|
153
|
+</template>
|
|
154
|
+
|
|
155
|
+<script>
|
|
156
|
+import { getToken } from '@/api/qiniu'
|
|
157
|
+import {GetOrgInfo,SaveOrgGallery,DeleteOrgGallery,EditOrgInfo} from '@/api/org/orginfo';
|
|
158
|
+import {GetDistrictsByUpid} from '@/api/district';
|
|
159
|
+import { getFileExtension} from '@/utils/tools'
|
|
160
|
+import Neditor from '@/components/Neditor'
|
|
161
|
+ import BreadCrumb from '@/xt_pages/components/bread-crumb'
|
|
162
|
+ export default {
|
|
163
|
+ name: 'orginfo',
|
|
164
|
+ data() {
|
|
165
|
+ return {
|
|
166
|
+ crumbs: [
|
|
167
|
+ { path: false, name: '机构信息' },
|
|
168
|
+ ],
|
|
169
|
+ qiniuDomain: 'https://images.shengws.com/',
|
|
170
|
+ formloading:false,
|
|
171
|
+ uploading:false,
|
|
172
|
+ guploading:false,
|
|
173
|
+ formsubmit:false,
|
|
174
|
+ loadingText:'',
|
|
175
|
+ illnessList:[],
|
|
176
|
+ fileList:[],
|
|
177
|
+ provinces:[],
|
|
178
|
+ citys:[],
|
|
179
|
+ districts:[],
|
|
180
|
+ orgtypes:[],
|
|
181
|
+ orgtypesMap:{},
|
|
182
|
+ childtypes:[],
|
|
183
|
+ uploadData: { token: '', key: '' },
|
|
184
|
+ operatingStateOptions: [{ value: 1, label: '正常营业' }, { value: 2, label: '暂未营业' }],
|
|
185
|
+ weekOptions:["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期天"],
|
|
186
|
+ shangOptions:['1:00','2:00','3:00','4:00','5:00','6:00','7:00','8:00','9:00','10:00','11:00','12:00'],
|
|
187
|
+ xiaOptions:['13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00','24:00'],
|
|
188
|
+ illnessOptions:[],
|
|
189
|
+ form:{
|
|
190
|
+ org_name:'',
|
|
191
|
+ org_short_name:'',
|
|
192
|
+ org_introduction:'',
|
|
193
|
+ org_logo:'',
|
|
194
|
+ province:'',
|
|
195
|
+ city:'',
|
|
196
|
+ district:'',
|
|
197
|
+ address:'',
|
|
198
|
+ parent_type:'',
|
|
199
|
+ child_type:'',
|
|
200
|
+ org_type:'',
|
|
201
|
+ telephone:'',
|
|
202
|
+ operating_state:'',
|
|
203
|
+ business_week:'',
|
|
204
|
+ business_week_select:[],
|
|
205
|
+ business_time_shange:'',
|
|
206
|
+ business_time_xia:'',
|
|
207
|
+ business_time:'',
|
|
208
|
+ illness:'',
|
|
209
|
+ illness_list:[],
|
|
210
|
+ org_gallery:[],
|
|
211
|
+ },
|
|
212
|
+ myConfig: {
|
|
213
|
+ // 如果需要上传功能,找后端小伙伴要服务器接口地址
|
|
214
|
+ serverUrl: '/api/web/upload/ueditor',
|
|
215
|
+ // 你的UEditor资源存放的路径,相对于打包后的index.html
|
|
216
|
+ UEDITOR_HOME_URL: '/NEditor/',
|
|
217
|
+ // 编辑器不自动被内容撑高
|
|
218
|
+ autoHeightEnabled: false,
|
|
219
|
+ // 初始容器高度
|
|
220
|
+ initialFrameHeight: 240,
|
|
221
|
+ // 初始容器宽度
|
|
222
|
+ initialFrameWidth: '100%',
|
|
223
|
+ // 关闭自动保存
|
|
224
|
+ enableAutoSave: false
|
|
225
|
+ },
|
|
226
|
+
|
|
227
|
+ }
|
|
228
|
+ },
|
|
229
|
+ components: {
|
|
230
|
+ Neditor,
|
|
231
|
+ BreadCrumb
|
|
232
|
+ },
|
|
233
|
+ computed: {
|
|
234
|
+
|
|
235
|
+ },
|
|
236
|
+ created() {
|
|
237
|
+ this.formloading = true;
|
|
238
|
+ this.loadingText = '加载中...';
|
|
239
|
+ this.GetOrgInfo();
|
|
240
|
+ },
|
|
241
|
+ methods: {
|
|
242
|
+
|
|
243
|
+ handleChangeIllness(values){
|
|
244
|
+ this.form.illness = values.join(',');
|
|
245
|
+ },
|
|
246
|
+ handleChangeWeek(values) {
|
|
247
|
+ var selectweek = [];
|
|
248
|
+ for (const index in values) {
|
|
249
|
+ var item = {id:this.weekOptions.indexOf(values[index]), name:values[index]};
|
|
250
|
+ selectweek.push(item);
|
|
251
|
+ }
|
|
252
|
+
|
|
253
|
+ if(selectweek.length==0) {
|
|
254
|
+ this.form.business_week = '';
|
|
255
|
+ }else if(selectweek.length==1) {
|
|
256
|
+ this.form.business_week = selectweek[0];
|
|
257
|
+ }else {
|
|
258
|
+ selectweek = selectweek.sort(function (a,b) {
|
|
259
|
+ return a.id-b.id;
|
|
260
|
+ });
|
|
261
|
+ var blen = selectweek.length;
|
|
262
|
+ if (blen == (selectweek[blen-1].id - selectweek[0].id + 1)) {
|
|
263
|
+ this.form.business_week = selectweek[0]["name"] + ' — ' + selectweek[blen-1]["name"];
|
|
264
|
+ }else {
|
|
265
|
+ var tem = [];
|
|
266
|
+ for (const index in selectweek) {
|
|
267
|
+ tem.push(selectweek[index].name);
|
|
268
|
+ }
|
|
269
|
+ this.form.business_week = tem.join("、")
|
|
270
|
+ }
|
|
271
|
+
|
|
272
|
+ }
|
|
273
|
+ },
|
|
274
|
+ handleChangeTime(t){
|
|
275
|
+ if(this.form.business_time_shange.length>0 && this.form.business_time_xia.length>0) {
|
|
276
|
+ this.form.business_time = '上午'+this.form.business_time_shange+"—下午"+this.form.business_time_xia;
|
|
277
|
+ }else if (this.form.business_time_shange.length>0) {
|
|
278
|
+ this.form.business_time = '上午'+this.form.business_time_shange;
|
|
279
|
+ }else if (this.form.business_time_xia.length>0) {
|
|
280
|
+ this.form.business_time = "下午"+this.form.business_time_xia;
|
|
281
|
+ }else {
|
|
282
|
+ this.form.business_time = '';
|
|
283
|
+ }
|
|
284
|
+ },
|
|
285
|
+ handleAvatarError(err, file, fileList) {
|
|
286
|
+ this.$message.error(err);
|
|
287
|
+ this.uploading = false;
|
|
288
|
+ return false
|
|
289
|
+ },
|
|
290
|
+ handleAvatarSuccess(res, file) {
|
|
291
|
+ this.form.org_logo = this.qiniuDomain + res.url;
|
|
292
|
+ this.uploading = false;
|
|
293
|
+ },
|
|
294
|
+ beforeAvatarUpload(file) {
|
|
295
|
+ var fileType = file.type
|
|
296
|
+ const isJPG = fileType.indexOf('image') > -1
|
|
297
|
+ const isLt2M = file.size / 1024 / 1024 < 2
|
|
298
|
+
|
|
299
|
+ if (!isJPG) {
|
|
300
|
+ this.$message.error('只能上传图片')
|
|
301
|
+ return false
|
|
302
|
+ }
|
|
303
|
+ if (!isLt2M) {
|
|
304
|
+ this.$message.error('上传头像图片大小不能超过 2MB!')
|
|
305
|
+ return false
|
|
306
|
+ }
|
|
307
|
+
|
|
308
|
+ var date = new Date()
|
|
309
|
+ var ext = getFileExtension(file.name)
|
|
310
|
+ var key = "" + date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours() + date.getMinutes() + date.getSeconds() +'_o_' + file.uid + '.' + ext;
|
|
311
|
+ this.uploading = true;
|
|
312
|
+ this.loadingText = '机构头像上传中'
|
|
313
|
+
|
|
314
|
+ const _self = this
|
|
315
|
+ return new Promise((resolve, reject) => {
|
|
316
|
+ getToken().then(response => {
|
|
317
|
+ const token = response.data.data.uptoken
|
|
318
|
+ _self._data.uploadData.token = token
|
|
319
|
+ _self._data.uploadData.key = key
|
|
320
|
+ resolve(true)
|
|
321
|
+ }).catch(err => {
|
|
322
|
+ reject(false)
|
|
323
|
+ this.uploading = false;
|
|
324
|
+ })
|
|
325
|
+ })
|
|
326
|
+ },
|
|
327
|
+ handleGalleryError(err, file, fileList) {
|
|
328
|
+ this.$message.error(err);
|
|
329
|
+ this.guploading = false;
|
|
330
|
+ return false
|
|
331
|
+ },
|
|
332
|
+ handleGallerySuccess(res, file) {
|
|
333
|
+ var data = {type:1, url: this.qiniuDomain + res.url};
|
|
334
|
+ SaveOrgGallery(data).then(response=>{
|
|
335
|
+ var res = response.data;
|
|
336
|
+ if (res.state==1) {
|
|
337
|
+ this.$message.success('上传成功');
|
|
338
|
+ }else {
|
|
339
|
+ this.$message.error('上传失败');
|
|
340
|
+ }
|
|
341
|
+ }).catch(e=>{});
|
|
342
|
+ this.guploading = false;
|
|
343
|
+ },
|
|
344
|
+ beforeGalleryUpload(file) {
|
|
345
|
+ var fileType = file.type
|
|
346
|
+ const isJPG = fileType.indexOf('image') > -1
|
|
347
|
+ const isLt100M = file.size / 1024 / 1024 < 100
|
|
348
|
+
|
|
349
|
+ if (!isJPG) {
|
|
350
|
+ this.$message.error('只能上传图片')
|
|
351
|
+ return false
|
|
352
|
+ }
|
|
353
|
+ if (!isLt100M) {
|
|
354
|
+ this.$message.error('上传图片大小不能超过 100MB!')
|
|
355
|
+ return false
|
|
356
|
+ }
|
|
357
|
+
|
|
358
|
+ var date = new Date()
|
|
359
|
+ var ext = getFileExtension(file.name)
|
|
360
|
+ var key = ""+date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours() + date.getMinutes() + date.getSeconds() +'_g_' + file.uid + '.' + ext;
|
|
361
|
+ this.guploading = true;
|
|
362
|
+ this.loadingText = '机构图册上传中'
|
|
363
|
+
|
|
364
|
+ const _self = this
|
|
365
|
+ return new Promise((resolve, reject) => {
|
|
366
|
+ getToken().then(response => {
|
|
367
|
+ const token = response.data.data.uptoken
|
|
368
|
+ _self._data.uploadData.token = token
|
|
369
|
+ _self._data.uploadData.key = key
|
|
370
|
+ resolve(true)
|
|
371
|
+ }).catch(err => {
|
|
372
|
+ reject(false)
|
|
373
|
+ this.guploading = false;
|
|
374
|
+ })
|
|
375
|
+ })
|
|
376
|
+ },
|
|
377
|
+
|
|
378
|
+ handleRemove(file, fileList) {
|
|
379
|
+ DeleteOrgGallery(file.id).then(response=>{
|
|
380
|
+ var res = response.data;
|
|
381
|
+ if(res.state==1) {
|
|
382
|
+ this.$message.success('删除成功');
|
|
383
|
+ }else {
|
|
384
|
+ this.$message.error('删除失败');
|
|
385
|
+ }
|
|
386
|
+ }).catch(e=>{});
|
|
387
|
+ console.log("handleRemove",file, fileList);
|
|
388
|
+ },
|
|
389
|
+ GetOrgInfo(){
|
|
390
|
+ GetOrgInfo().then(response=>{
|
|
391
|
+ var res = response.data;
|
|
392
|
+ if (res.state === 1) {
|
|
393
|
+ this.form.org_name = res.data.orginfo.org_name;
|
|
394
|
+ this.form.org_short_name = res.data.orginfo.org_short_name;
|
|
395
|
+ this.form.org_introduction = res.data.orginfo.org_introduction;
|
|
396
|
+ this.form.org_logo = res.data.orginfo.org_logo;
|
|
397
|
+ this.form.province = res.data.orginfo.province;
|
|
398
|
+ this.form.city = res.data.orginfo.city;
|
|
399
|
+ this.form.district = res.data.orginfo.district;
|
|
400
|
+ this.form.address = res.data.orginfo.address;
|
|
401
|
+ this.form.org_type = res.data.orginfo.org_type;
|
|
402
|
+ this.form.telephone = res.data.orginfo.telephone;
|
|
403
|
+ this.form.operating_state = res.data.orginfo.operating_state;
|
|
404
|
+ this.form.business_week = res.data.orginfo.business_week;
|
|
405
|
+ this.form.business_week_select = [];
|
|
406
|
+ this.form.business_time = res.data.orginfo.business_time;
|
|
407
|
+ this.form.business_time_shange = '';
|
|
408
|
+ this.form.business_time_xia = '';
|
|
409
|
+ this.form.illness = res.data.orginfo.illness;
|
|
410
|
+ this.form.illness_list = [];
|
|
411
|
+ this.form.org_gallery = res.data.orginfo.org_gallery;
|
|
412
|
+ this.fileList = [];
|
|
413
|
+ for (const index in this.form.org_gallery) {
|
|
414
|
+ var image = {id:this.form.org_gallery[index].id, name:this.form.org_gallery[index].id, url: this.form.org_gallery[index].type==1?this.form.org_gallery[index].url:this.form.org_gallery[index].url+'?vframe/jpg/offset/0/w/100/h/100'};
|
|
415
|
+ this.fileList.push(image);
|
|
416
|
+ }
|
|
417
|
+
|
|
418
|
+ var illness = res.data.orginfo.illness.split(',');
|
|
419
|
+ for (const index in illness) {
|
|
420
|
+ var iid = parseInt(illness[index]);
|
|
421
|
+ if (isNaN(iid) || iid<=0) {
|
|
422
|
+ continue;
|
|
423
|
+ }
|
|
424
|
+ this.form.illness_list.push(iid);
|
|
425
|
+ }
|
|
426
|
+ var business_week = this.form.business_week;
|
|
427
|
+ var business_week_tem = business_week.split(" — ");
|
|
428
|
+ if(business_week_tem.length==2) {
|
|
429
|
+ var fromIndex = this.weekOptions.indexOf(business_week_tem[0]);
|
|
430
|
+ var toIndex = this.weekOptions.indexOf(business_week_tem[1]);
|
|
431
|
+ if(fromIndex>=0 && toIndex>=0) {
|
|
432
|
+ for (const index in this.weekOptions) {
|
|
433
|
+ if(index>=fromIndex && index <= toIndex) {
|
|
434
|
+ this.form.business_week_select.push(this.weekOptions[index]);
|
|
435
|
+ }
|
|
436
|
+ }
|
|
437
|
+ }
|
|
438
|
+ }else {
|
|
439
|
+ business_week_tem = business_week.split("、");
|
|
440
|
+ for (const index in business_week_tem) {
|
|
441
|
+ if(business_week_tem[index].length>0) {
|
|
442
|
+ this.form.business_week_select.push(business_week_tem[index]);
|
|
443
|
+ }
|
|
444
|
+ }
|
|
445
|
+ }
|
|
446
|
+ var business_time = this.form.business_time;
|
|
447
|
+ var business_time_tem = business_time.split("—");
|
|
448
|
+ if(business_time_tem.length==2) {
|
|
449
|
+ this.form.business_time_shange = business_time_tem[0].substring(2);
|
|
450
|
+ this.form.business_time_xia = business_time_tem[1].substring(2);
|
|
451
|
+ }else {
|
|
452
|
+ var selectTime = business_time_tem[0].substring(2);
|
|
453
|
+ if(this.shangOptions.indexOf(selectTime)>-1) {
|
|
454
|
+ this.form.business_time_shange = selectTime;
|
|
455
|
+ }else if(this.xiaOptions.indexOf(selectTime)>-1) {
|
|
456
|
+ this.form.business_time_xia = selectTime;
|
|
457
|
+ }
|
|
458
|
+ }
|
|
459
|
+
|
|
460
|
+ this.provinces = res.data.provinces;
|
|
461
|
+ this.citys = res.data.citys?res.data.citys:[];
|
|
462
|
+ this.districts = res.data.districts?res.data.districts:[];
|
|
463
|
+
|
|
464
|
+ this.orgtypes = [];
|
|
465
|
+ this.orgtypesMap ={},
|
|
466
|
+ this.childtypes = [];
|
|
467
|
+ var orgtypes = res.data.orgtypes;
|
|
468
|
+ for (const index in orgtypes) {
|
|
469
|
+ if(orgtypes[index].pid>0) {
|
|
470
|
+ if(!(orgtypes[index].pid in this.orgtypesMap)) {
|
|
471
|
+ this.orgtypesMap[orgtypes[index].pid] = [];
|
|
472
|
+ }
|
|
473
|
+ this.orgtypesMap[orgtypes[index].pid].push(orgtypes[index]);
|
|
474
|
+ if(orgtypes[index].id == this.form.org_type) {
|
|
475
|
+ this.form.child_type = orgtypes[index].id;
|
|
476
|
+ this.form.parent_type = orgtypes[index].pid;
|
|
477
|
+ }
|
|
478
|
+ }else {
|
|
479
|
+ this.orgtypes.push(orgtypes[index]);
|
|
480
|
+ if(orgtypes[index].id == this.form.org_type) {
|
|
481
|
+ this.form.parent_type = orgtypes[index].id;
|
|
482
|
+ }
|
|
483
|
+ }
|
|
484
|
+ }
|
|
485
|
+ if (this.form.parent_type in this.orgtypesMap) {
|
|
486
|
+ this.childtypes = this.orgtypesMap[this.form.parent_type];
|
|
487
|
+ }else {
|
|
488
|
+ this.childtypes = [];
|
|
489
|
+ }
|
|
490
|
+ this.illnessOptions = res.data.illness?res.data.illness:[];
|
|
491
|
+ this.formloading = false;
|
|
492
|
+ } else {
|
|
493
|
+ this.$message.error(resp.msg)
|
|
494
|
+ }
|
|
495
|
+ }).catch(e=>{
|
|
496
|
+
|
|
497
|
+ })
|
|
498
|
+ },
|
|
499
|
+ myTrim(x) {
|
|
500
|
+ return x.replace(/^\s+|\s+$/gm,'');
|
|
501
|
+ },
|
|
502
|
+ changeProvince(id) {
|
|
503
|
+ this.citys = [];
|
|
504
|
+ this.districts = [];
|
|
505
|
+ this.form.city = '';
|
|
506
|
+ this.form.district = '';
|
|
507
|
+ var upid = parseInt(id);
|
|
508
|
+ if (isNaN(upid) || upid<=0) {
|
|
509
|
+ return false;
|
|
510
|
+ }
|
|
511
|
+ GetDistrictsByUpid({id:upid}).then(response=>{
|
|
512
|
+ var res = response.data;
|
|
513
|
+ if(res.state===1) {
|
|
514
|
+ this.citys = res.data.citys?res.data.citys:[];
|
|
515
|
+ }
|
|
516
|
+ }).catch(e=>{
|
|
517
|
+
|
|
518
|
+ })
|
|
519
|
+ },
|
|
520
|
+ changeCity(id) {
|
|
521
|
+ this.districts = [];
|
|
522
|
+ this.form.district = '';
|
|
523
|
+ var upid = parseInt(id);
|
|
524
|
+ if (isNaN(upid) || upid<=0) {
|
|
525
|
+ return false;
|
|
526
|
+ }
|
|
527
|
+ GetDistrictsByUpid({id:upid}).then(response=>{
|
|
528
|
+ var res = response.data;
|
|
529
|
+ if(res.state===1) {
|
|
530
|
+ this.districts = res.data.citys?res.data.citys:[];
|
|
531
|
+ }
|
|
532
|
+ }).catch(e=>{
|
|
533
|
+
|
|
534
|
+ })
|
|
535
|
+ },
|
|
536
|
+ changeParentType(id) {
|
|
537
|
+ id = parseInt(id);
|
|
538
|
+ this.childtypes = [];
|
|
539
|
+ this.form.child_type = '';
|
|
540
|
+ this.form.org_type = 0;
|
|
541
|
+
|
|
542
|
+ if (isNaN(id) || id<=0) {
|
|
543
|
+ return false;
|
|
544
|
+ }
|
|
545
|
+ if(id in this.orgtypesMap) {
|
|
546
|
+ this.childtypes = this.orgtypesMap[id];
|
|
547
|
+ }else{
|
|
548
|
+ this.childtypes = [];
|
|
549
|
+ }
|
|
550
|
+
|
|
551
|
+ this.form.org_type = id;
|
|
552
|
+
|
|
553
|
+ },
|
|
554
|
+ changeChildType(id) {
|
|
555
|
+ this.form.org_type = id;
|
|
556
|
+ },
|
|
557
|
+ submitForm(){
|
|
558
|
+ this.form.org_introduction = this.$refs.neditor.content;
|
|
559
|
+ this.formloading = true;
|
|
560
|
+ this.formsubmit = true;
|
|
561
|
+ this.loadingText = '正在保存...';
|
|
562
|
+ EditOrgInfo(this.form).then(response=>{
|
|
563
|
+ var res = response.data;
|
|
564
|
+ if(res.state==1) {
|
|
565
|
+ this.$message.success("修改成功");
|
|
566
|
+ }else {
|
|
567
|
+ this.$message.error(res.msg);
|
|
568
|
+ }
|
|
569
|
+
|
|
570
|
+ this.formloading = false;
|
|
571
|
+ this.formsubmit = false;
|
|
572
|
+ }).catch(e=>{
|
|
573
|
+
|
|
574
|
+ this.formloading = false;
|
|
575
|
+ this.formsubmit = false;
|
|
576
|
+ })
|
|
577
|
+ },
|
|
578
|
+ }
|
|
579
|
+ }
|
|
580
|
+</script>
|
|
581
|
+
|
|
582
|
+<style rel="stylesheet/scss" >
|
|
583
|
+
|
|
584
|
+ #edit-org-info-form .avatar-uploader .el-upload {
|
|
585
|
+ border: 1px dashed #d9d9d9;
|
|
586
|
+ border-radius: 6px;
|
|
587
|
+ cursor: pointer;
|
|
588
|
+ position: relative;
|
|
589
|
+ overflow: hidden;
|
|
590
|
+ }
|
|
591
|
+ #edit-org-info-form .avatar-uploader .el-upload:hover {
|
|
592
|
+ border-color: #409EFF;
|
|
593
|
+ }
|
|
594
|
+ #edit-org-info-form .avatar-uploader-icon {
|
|
595
|
+ font-size: 28px;
|
|
596
|
+ color: #8c939d;
|
|
597
|
+ width: 178px;
|
|
598
|
+ height: 178px;
|
|
599
|
+ line-height: 178px;
|
|
600
|
+ text-align: center;
|
|
601
|
+ }
|
|
602
|
+ #edit-org-info-form .avatar {
|
|
603
|
+ width: 178px;
|
|
604
|
+ height: 178px;
|
|
605
|
+ display: block;
|
|
606
|
+ }
|
|
607
|
+</style>
|
|
608
|
+
|