Browse Source

添加机构信息模块

庄逸洲 4 years ago
parent
commit
0b8f486971

+ 6 - 0
config/dev.env.js View File

@@ -2,5 +2,11 @@ module.exports = {
2 2
   NODE_ENV: '"development"',
3 3
   ENV_CONFIG: '"dev"',
4 4
   BASE_API: '"http://api.test1.sgjyun.com"', // // http://localhost:8090
5
+
6
+  SSO_HOST: '"http://testsso.sgjyun.com"',
7
+  SRCM_HOST: '"http://test1.sgjyun.com"',
8
+  XT_HOST: '"http://xt.test.sgjyun.com"',
9
+  MIRCO_MALL_HOST: '"http://mall.test.sgjyun.com"',
10
+  CDM_HOST: '"http://cdm.test.sgjyun.com"',
5 11
 }
6 12
 

+ 7 - 1
config/prod.env.js View File

@@ -1,5 +1,11 @@
1 1
 module.exports = {
2 2
   NODE_ENV: '"production"',
3 3
   ENV_CONFIG: '"prod"',
4
-  BASE_API: '"http://api.scrm.kuyicloud.com"'
4
+  BASE_API: '"http://api.scrm.kuyicloud.com"',
5
+
6
+  SSO_HOST: '"http://sso.kuyicloud.com"',
7
+  SRCM_HOST: '"http://jk.kuyicloud.com"',
8
+  XT_HOST: '"http://xt.kuyicloud.com"',
9
+  MIRCO_MALL_HOST: '"http://mall.kuyicloud.com"',
10
+  CDM_HOST: '"http://cdm.kuyicloud.com"',
5 11
 }

+ 7 - 1
config/sit.env.js View File

@@ -1,5 +1,11 @@
1 1
 module.exports = {
2 2
   NODE_ENV: '"production"',
3 3
   ENV_CONFIG: '"sit"',
4
-  BASE_API: '"http://api.test1.sgjyun.com"'
4
+  BASE_API: '"http://api.test1.sgjyun.com"',
5
+
6
+  SSO_HOST: '"http://testsso.sgjyun.com"',
7
+  SRCM_HOST: '"http://test1.sgjyun.com"',
8
+  XT_HOST: '"http://xt.test.sgjyun.com"',
9
+  MIRCO_MALL_HOST: '"http://mall.test.sgjyun.com"',
10
+  CDM_HOST: '"http://cdm.test.sgjyun.com"',
5 11
 }

+ 9 - 0
src/api/district.js View File

@@ -0,0 +1,9 @@
1
+import request from '@/utils/request'
2
+
3
+export function GetDistrictsByUpid(params){
4
+    return request({
5
+        url:'/api/district/getdistrictsbyupid',
6
+        method:'get',
7
+        params: params
8
+    })
9
+}

+ 32 - 0
src/api/org/orginfo.js View File

@@ -0,0 +1,32 @@
1
+import request from '@/utils/request'
2
+
3
+export function GetOrgInfo(){
4
+    return request({
5
+        url:'/api/orginfo/getinfo',
6
+        method:'get',
7
+    })
8
+}
9
+
10
+export function SaveOrgGallery(data){
11
+    return request({
12
+        url:'/api/orginfo/savegallery',
13
+        method:'Post',
14
+        data:data,
15
+    })
16
+}
17
+
18
+export function EditOrgInfo(data){
19
+    return request({
20
+        url:'/api/orginfo/edit',
21
+        method:'Post',
22
+        data:data,
23
+    })
24
+}
25
+
26
+export function DeleteOrgGallery(id){
27
+    return request({
28
+        url:'/api/orginfo/deletegallery',
29
+        method:'delete',
30
+        params:{id:id},
31
+    })
32
+}

+ 2 - 0
src/router/index.js View File

@@ -8,6 +8,7 @@ import Layout from '@/views/layout/Layout'
8 8
 
9 9
 import role from './modules/role'
10 10
 import article from './modules/article'
11
+import org from './modules/org'
11 12
 
12 13
 /** note: submenu only apppear when children.length>=1
13 14
  *   detail see  https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
@@ -69,6 +70,7 @@ var _constant_router_map = [{
69 70
 
70 71
 var _asy_router_map = [
71 72
   article,
73
+  org,
72 74
   role
73 75
 ]
74 76
 

+ 26 - 0
src/router/modules/org.js View File

@@ -0,0 +1,26 @@
1
+import Layout from '@/views/layout/Layout'
2
+
3
+export default {
4
+    path: '/orginfo',
5
+    component: Layout,
6
+    hidden: true,
7
+    is_menu: false,
8
+    meta: {
9
+        title: 'orginfo',
10
+        icon: 'shebei'
11
+    },
12
+    children: [
13
+        {
14
+            path: '/orginfo',
15
+            component: () => import('@/scrm_pages/org/orginfo'),
16
+            hidden: true,
17
+            is_menu: false,
18
+            name: 'orginfo',
19
+            meta: {
20
+                title: '机构信息',
21
+                icon: 'shebei',
22
+                noCache: true
23
+            }
24
+        }
25
+    ]
26
+}

+ 47 - 0
src/scrm_pages/org/README.md View File

@@ -0,0 +1,47 @@
1
+### neditor使用:
2
+
3
+1、引入资源
4
+
5
+1.1 在static\neditor
6
+
7
+1.2 在根目录下index.html下
8
+
9
+```
10
+<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
11
+<script src="<%= htmlWebpackPlugin.options.path %>/neditor/neditor.config.js"></script>
12
+<script src="<%= htmlWebpackPlugin.options.path %>/neditor/neditor.all.min.js"></script>
13
+<script src="<%= htmlWebpackPlugin.options.path %>/neditor/neditor.service.js"></script>
14
+<script src="<%= htmlWebpackPlugin.options.path %>/neditor/i18n/zh-cn/zh-cn.js"></script>
15
+<script src="<%= htmlWebpackPlugin.options.path %>/neditor/neditor.parse.min.js"></script>
16
+```
17
+
18
+2、自定义components,在src下新建Neditor/index.vue,具体见src\components\Neditor\index.vue
19
+
20
+3、使用
21
+
22
+3.1、引入自定义components:
23
+
24
+`import Neditor from '@/components/Neditor'`
25
+
26
+3.2、注册:
27
+
28
+```
29
+components: {
30
+    Neditor,
31
+    ......
32
+},
33
+```
34
+3.3
35
+
36
+```
37
+<el-form-item label="机构介绍:" prop="org_introduction">
38
+    <keep-alive><!--网上说用百度ueditor时,要用keep-alive-->
39
+         <neditor ref="neditor"   id="editor"  v-bind:r_content="form.org_introduction"> </neditor> <!--这里是Neditor-->
40
+    </keep-alive>
41
+</el-form-item>
42
+```
43
+3.4
44
+4.
45
+提交时,需要获取富文本里的内容:
46
+
47
+`this.form.org_introduction = this.$refs.neditor.content;`

+ 754 - 0
src/scrm_pages/org/orginfo.vue View File

@@ -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
+

+ 3 - 1
src/store/getters.js View File

@@ -9,6 +9,8 @@ const getters = {
9 9
   errorLogs: state => state.errorLog.logs,
10 10
 
11 11
   xt_permission: state => state.xt_permission,
12
-  xt_user: state => state.xt_user
12
+  xt_user: state => state.xt_user,
13
+
14
+  xt_role_temps: state => state.xt_role_temps,
13 15
 }
14 16
 export default getters

+ 3 - 1
src/store/index.js View File

@@ -5,6 +5,7 @@ import errorLog from './modules/errorLog'
5 5
 import tagsView from './modules/tagsView'
6 6
 import xt_user from './modules/xt_user'
7 7
 import xt_permission from './modules/xt_permission'
8
+import xt_role_temps from './modules/role_temps'
8 9
 
9 10
 import getters from './getters'
10 11
 
@@ -16,7 +17,8 @@ const store = new Vuex.Store({
16 17
     errorLog,
17 18
     tagsView,
18 19
     xt_user,
19
-    xt_permission
20
+    xt_permission,
21
+    xt_role_temps,
20 22
   },
21 23
   getters
22 24
 })

+ 20 - 0
src/store/modules/role_temps.js View File

@@ -0,0 +1,20 @@
1
+const xt_role_temps = {
2
+    state: {
3
+        did_admins_changed: false
4
+    },
5
+    mutations: {
6
+        UPDATE_ADMINS_STATE: (state, did_change) => {
7
+            state.did_admins_changed = did_change
8
+        }
9
+    },
10
+    actions: {
11
+        DidChangeAdmins: ({commit}) => {
12
+            commit('UPDATE_ADMINS_STATE', true)
13
+        },
14
+        RecoverAdminsChangeState: ({commit}) => {
15
+            commit('UPDATE_ADMINS_STATE', false)
16
+        }
17
+    }
18
+}
19
+
20
+export default xt_role_temps

+ 22 - 1
src/store/modules/xt_user.js View File

@@ -36,6 +36,10 @@ const xt_user = {
36 36
       patients:20, //患者数
37 37
     },
38 38
 
39
+    xt_role_exist: false,
40
+    cdm_role_exist: false,
41
+    mall_role_exist: false,
42
+
39 43
     // 示例: ['', '',]
40 44
     urlfors: []
41 45
   },
@@ -68,6 +72,10 @@ const xt_user = {
68 72
       state.subscibe.period_start = cur_info.subscibe.period_start
69 73
       state.subscibe.period_end = cur_info.subscibe.period_end
70 74
       state.subscibe.state = cur_info.subscibe.state
75
+
76
+      state.xt_role_exist = cur_info.xt_role_exist
77
+      state.cdm_role_exist = cur_info.cdm_role_exist
78
+      state.mall_role_exist = cur_info.mall_role_exist
71 79
     },
72 80
 
73 81
     SET_URLFORS: (state, payload) => {
@@ -110,6 +118,10 @@ const xt_user = {
110 118
       state.subscibe.state = 3
111 119
       state.subscibe.patients = 0
112 120
 
121
+      state.xt_role_exist = false
122
+      state.cdm_role_exist = false
123
+      state.mall_role_exist = false
124
+
113 125
       state.urlfors = []
114 126
     }
115 127
   },
@@ -139,6 +151,9 @@ const xt_user = {
139 151
             cur_app_id: infoJSON.current_app_id,
140 152
             org: infoJSON.org,
141 153
             subscibe: infoJSON.subscibe,
154
+            xt_role_exist: infoJSON.xt_role_exist,
155
+            cdm_role_exist: infoJSON.cdm_role_exist,
156
+            mall_role_exist: infoJSON.mall_role_exist
142 157
           })
143 158
 
144 159
           commit('SET_URLFORS', {
@@ -156,7 +171,10 @@ const xt_user = {
156 171
                 cur_org_id: data.current_org_id,
157 172
                 cur_app_id: data.current_app_id,
158 173
                 org: data.org,
159
-                subscibe: data.subscibe
174
+                subscibe: data.subscibe,
175
+                xt_role_exist: data.xt_role_exist,
176
+                cdm_role_exist: data.cdm_role_exist,
177
+                mall_role_exist: data.mall_role_exist
160 178
               })
161 179
 
162 180
               this.commit('SET_URLFORS', {
@@ -184,6 +202,9 @@ const xt_user = {
184 202
           current_app_id: state.app_id, 
185 203
           urlfors: state.urlfors,
186 204
           subscibe: state.subscibe,
205
+          xt_role_exist: state.xt_role_exist,
206
+          cdm_role_exist: state.cdm_role_exist,
207
+          mall_role_exist: state.mall_role_exist
187 208
         })
188 209
       )
189 210
     },

+ 55 - 30
src/views/layout/components/Navbar.vue View File

@@ -5,61 +5,59 @@
5 5
     </div>
6 6
     <el-menu class="navbar" mode="horizontal">
7 7
       <div>
8
-        <!-- <el-dropdown trigger="click" style="color:#fff;"> -->
9
-        <span class="el-dropdown-link">{{ this.$store.getters.xt_user.org.org_name }}
10
-          <!--<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
8
+        <span> {{this.$store.getters.xt_user.org.org_name}}
11 9
         </span>
12
-        <!-- </el-dropdown> -->
13 10
       </div>
14 11
       <div class="system-nav">
15
-        <div class="system-nav-menu">
16
-          <a  href="http://jk.kuyicloud.com/">
17
-          <!-- <a href="http://test1.sgjyun.com/"> -->
18
-            <span><i class="iconfont icon-pengyou"></i> SCRM</span>
12
+        <div class="system-nav-menu" v-if="this.$store.getters.xt_user.xt_role_exist">
13
+          <a :href="XTWebsit()">
14
+            <span><i class="icon iconfont icon-jiankangshuidi"></i> 血透管理</span>
19 15
           </a>
20 16
         </div>
21
-        <div class="system-nav-menu">
22
-          <a href="http://mall.kuyicloud.com/">
23
-          <!-- <a href="http://mall.test.sgjyun.com/"> -->
24
-            <span><i class="icon iconfont icon-service_fill"></i> 微商城</span>
17
+        <div class="system-nav-menu" v-if="this.$store.getters.xt_user.cdm_role_exist">
18
+          <a :href="CDMWebsit()">
19
+            <span><i class="icon iconfont icon-manbing-xuanzhong"></i> 慢病管理</span>
25 20
           </a>
26 21
         </div>
27 22
         <div class="system-nav-menu active">
28 23
           <a>
29
-            <span><i class="icon iconfont icon-jiankangshuidi"></i> 血透管理</span>
24
+            <span><i class="iconfont icon-pengyou"></i> SCRM</span>
30 25
           </a>
31 26
         </div>
32
-        <div class="system-nav-menu">
33
-          <a href="http://cdm.kuyicloud.com/">
34
-          <!-- <a href=" http://cdm.test.sgjyun.com/"> -->
35
-            <span><i class="icon iconfont icon-manbing-xuanzhong"></i> 慢病管理</span>
27
+        <div class="system-nav-menu" v-if="this.$store.getters.xt_user.mall_role_exist">
28
+          <a :href="MircoMallWebsit()">
29
+            <span><i class="icon iconfont icon-service_fill"></i> 微商城</span>
36 30
           </a>
37 31
         </div>
38 32
 
39 33
         <div class="system-nav-menu">
40
-          <a href="http://sso.kuyicloud.com/org/app/create">
41
-          <!-- <a href="http://testsso.sgjyun.com/org/app/create"> -->
34
+          <a :href="APPManageWebsit()">
42 35
             <span><i class="icon iconfont icon-suoyou"></i> 应用</span>
43 36
           </a>
44 37
         </div>
45 38
       </div>
46 39
 
47 40
       <div class="right-menu">
48
-        <el-dropdown class="avatar-container right-menu-item" trigger="click">
41
+        <el-dropdown class="avatar-container right-menu-item" trigger="click"  @command="handleCommand">
49 42
           <div class="avatar-wrapper">
50 43
             <img class="user-avatar" :src="avater">
51 44
             <span class="user-title">{{ this.$store.getters.xt_user.user.user_name }}</span>
52 45
             <i class="el-icon-caret-bottom"></i>
53 46
           </div>
54 47
           <el-dropdown-menu slot="dropdown">
55
-            <el-dropdown-item>
56
-              <span @click="modifyUserInfoAction">修改个人信息</span>
48
+            <el-dropdown-item command="modifyUserInfoAction">
49
+              修改个人信息
50
+              <!-- <span @click="modifyUserInfoAction">修改个人信息</span> -->
51
+            </el-dropdown-item>
52
+            <el-dropdown-item command="modifyOrgInfoAction">
53
+              机构信息
57 54
             </el-dropdown-item>
58 55
             <!-- <el-dropdown-item divided>
59 56
               <span @click="myServe">我的服务</span>
60 57
             </el-dropdown-item> -->
61
-            <el-dropdown-item divided>
62
-              <span @click="logout" style="display:block;">{{$t('navbar.logOut')}}</span>
58
+            <el-dropdown-item divided command="logout">
59
+              {{$t('navbar.logOut')}}
60
+              <!-- <span @click="logout" style="display:block;">{{$t('navbar.logOut')}}</span> -->
63 61
             </el-dropdown-item>
64 62
           </el-dropdown-menu>
65 63
         </el-dropdown>
@@ -82,14 +80,14 @@
82 80
   export default {
83 81
     data() {
84 82
       return {
85
-        orgname: ''
83
+        
86 84
       }
87 85
     },
88 86
     components: {
89 87
       // Breadcrumb,
90 88
       // Hamburger,
91 89
       Screenfull,
92
-      ModifyUserInfoDialog
90
+      ModifyUserInfoDialog,
93 91
     },
94 92
     computed: {
95 93
       ...mapGetters(['sidebar']),
@@ -104,22 +102,49 @@
104 102
       // toggleSideBar() {
105 103
       //   this.$store.dispatch("toggleSideBar");
106 104
       // },
105
+      handleCommand(command){
106
+        switch (command) {
107
+          case 'modifyUserInfoAction':
108
+            this.modifyUserInfoAction();
109
+            break;
110
+          case 'modifyOrgInfoAction':
111
+            this.modifyOrgInfoAction();
112
+            break;
113
+          case 'logout':
114
+            this.logout();
115
+            break;
116
+        }
117
+      },
107 118
       logout() {
108 119
         this.$store.dispatch('FrontendLogout')
109 120
         window.location.href = process.env.BASE_API + '/logout'
110 121
       },
122
+      modifyOrgInfoAction() {
123
+        // this.$refs.modify_org_info_dialog.show()
124
+        this.$router.push('/orginfo')
125
+        return false
126
+      },
111 127
       modifyUserInfoAction() {
112 128
         this.$refs.modify_user_info_dialog.show()
113 129
       },
114 130
       myServe() {
115 131
         this.$router.push('/service')
116 132
         return false
133
+      },
134
+      XTWebsit() {
135
+        return process.env.XT_HOST
136
+      },
137
+      MircoMallWebsit() {
138
+        return process.env.MIRCO_MALL_HOST
139
+      },
140
+      CDMWebsit() {
141
+        return process.env.CDM_HOST
142
+      },
143
+      APPManageWebsit() {
144
+        return process.env.SSO_HOST + '/org/admin/apps?org=' + this.$store.getters.xt_user.org_id
117 145
       }
118 146
     },
119
-    create() {
120
-      var xtuser = this.$store.getters.xt_user
121
-      this.orgname = xtuser.org.org_name
122
-      console.log(this.orgname)
147
+    created() {
123 148
     }
124 149
   }
125 150
 </script>