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