Преглед на файлове

Merge branch 'master' of http://git.shengws.com/csx/Vue_New

csx преди 5 години
родител
ревизия
b62ff6ffca

+ 9 - 0
src/api/role/role.js Целия файл

@@ -95,3 +95,12 @@ export function AddUserRole(params){
95 95
   })
96 96
 }
97 97
 
98
+
99
+
100
+export function getRoleStaff() {
101
+  return request({
102
+    url: '/api/role/staff',
103
+    method: 'get',
104
+  })
105
+}
106
+

BIN
src/assets/logo/logo1.png Целия файл


+ 132 - 60
src/router/modules/stock.js Целия файл

@@ -13,77 +13,149 @@ export default {
13 13
   },
14 14
   children: [
15 15
     {
16
-      path: "/stock/",
16
+      path: "/warehouseReceipt/",
17 17
       component: Layout,
18
-      redirect: "noredirect",
18
+      redirect: "/stock/in",
19 19
       name: "warehouseReceipt",
20
+      parentNum: 1,
20 21
       meta: {
21 22
         isChild: true,
22 23
         title: "warehouseReceipt"
23
-      },
24
-      children: [
25
-        {
26
-          path: "/stock/in",
27
-          component: () => import("@/xt_pages/stock/stockInOrder"),
28
-          name: "stockInOrder",
29
-          meta: { title: "stockInOrder", noCache: true }
30
-        },
31
-        {
32
-          path: "/stock/return",
33
-          component: () => import("@/xt_pages/stock/salesReturnOrder"),
34
-          name: "salesReturnOrder",
35
-          meta: { title: "salesReturnOrder", noCache: true }
36
-        },
37
-        {
38
-          path: "/stock/out",
39
-          component: () => import("@/xt_pages/stock/stockOutOrder"),
40
-          name: "stockOutOrder",
41
-          meta: { title: "stockOutOrder", noCache: true }
42
-        },
43
-        {
44
-          path: "/stock/cancel",
45
-          component: () => import("@/xt_pages/stock/cancelStockOrder"),
46
-          name: "cancelStockOrder",
47
-          meta: { title: "cancelStockOrder", noCache: true }
48
-        }
49
-      ]
50
-    },
51
-    {
52
-      path: "stock/",
24
+      }
25
+    },
26
+    {
27
+      path: "/warehouseReceiptOther/",
53 28
       component: Layout,
54
-      redirect: "noredirect",
29
+      redirect: "/stock/in/other",
55 30
       name: "warehouseReceiptOther",
31
+      parentNum: 2,
56 32
       meta: {
57 33
         isChild: true,
58 34
         title: "warehouseReceiptOther"
59
-      },
60
-      children: [
61
-        {
62
-          path: "/stock/in/other",
63
-          component: () => import("@/xt_pages/stock/otherStockInOrder"),
64
-          name: "otherStockInOrder",
65
-          meta: { title: "otherStockInOrder", noCache: true }
66
-        },
67
-        {
68
-          path: "/stock/return/other",
69
-          component: () => import("@/xt_pages/stock/otherSalesReturnOrder"),
70
-          name: "otherSalesReturnOrder",
71
-          meta: { title: "otherSalesReturnOrder", noCache: true }
72
-        },
73
-        {
74
-          path: "/stock/out/other",
75
-          component: () => import("@/xt_pages/stock/otherStockOutOrder"),
76
-          name: "otherStockOutOrder",
77
-          meta: { title: "otherStockOutOrder", noCache: true }
78
-        },
79
-        {
80
-          path: "/stock/cancel/other",
81
-          component: () => import("@/xt_pages/stock/otherCancelStockOrder"),
82
-          name: "otherCancelStockOrder",
83
-          meta: { title: "otherCancelStockOrder", noCache: true }
84
-        }
85
-      ]
35
+      }
36
+    },
37
+    {
38
+      path: "/stock/in",
39
+      component: () => import("@/xt_pages/stock/stockInOrder"),
40
+      name: "stockInOrder",
41
+      hidden: true,
42
+      is_menu: false,
43
+      num: 1,
44
+      meta: { title: "stockInOrder", noCache: true }
45
+    },
46
+    {
47
+      path: "/stock/return",
48
+      component: () => import("@/xt_pages/stock/salesReturnOrder"),
49
+      name: "salesReturnOrder",
50
+      hidden: true,
51
+      is_menu: false,
52
+      num: 1,
53
+      meta: { title: "salesReturnOrder", noCache: true }
54
+    },
55
+    {
56
+      path: "/stock/out",
57
+      component: () => import("@/xt_pages/stock/stockOutOrder"),
58
+      name: "stockOutOrder",
59
+      hidden: true,
60
+      is_menu: false,
61
+      num: 1,
62
+      meta: { title: "stockOutOrder", noCache: true }
63
+    },
64
+    {
65
+      path: "/stock/cancel",
66
+      component: () => import("@/xt_pages/stock/cancelStockOrder"),
67
+      name: "cancelStockOrder",
68
+      hidden: true,
69
+      is_menu: false,
70
+      num: 1,
71
+      meta: { title: "cancelStockOrder", noCache: true }
72
+    },
73
+    {
74
+      path: "/stock/in/other",
75
+      component: () => import("@/xt_pages/stock/otherStockInOrder"),
76
+      name: "otherStockInOrder",
77
+      hidden: true,
78
+      is_menu: false,
79
+      num: 2,
80
+      meta: { title: "otherStockInOrder", noCache: true }
86 81
     },
82
+    {
83
+      path: "/stock/return/other",
84
+      component: () => import("@/xt_pages/stock/otherSalesReturnOrder"),
85
+      name: "otherSalesReturnOrder",
86
+      hidden: true,
87
+      is_menu: false,
88
+      num: 2,
89
+      meta: { title: "otherSalesReturnOrder", noCache: true }
90
+    },
91
+    {
92
+      path: "/stock/out/other",
93
+      component: () => import("@/xt_pages/stock/otherStockOutOrder"),
94
+      name: "otherStockOutOrder",
95
+      hidden: true,
96
+      is_menu: false,
97
+      num: 2,
98
+      meta: { title: "otherStockOutOrder", noCache: true }
99
+    },
100
+    {
101
+      path: "/stock/cancel/other",
102
+      component: () => import("@/xt_pages/stock/otherCancelStockOrder"),
103
+      name: "otherCancelStockOrder",
104
+      hidden: true,
105
+      is_menu: false,
106
+      num: 2,
107
+      meta: { title: "otherCancelStockOrder", noCache: true }
108
+    },
109
+    // {
110
+    //   path: "/stock/",
111
+    //   component: Layout,
112
+    //   redirect: "noredirect",
113
+    //   name: "warehouseReceipt",
114
+    //   meta: {
115
+    //     isChild: true,
116
+    //     title: "warehouseReceipt"
117
+    //   },
118
+    //   children: [
119
+
120
+    //   ]
121
+    // },
122
+
123
+    // {
124
+    //   path: "stock/",
125
+    //   component: Layout,
126
+    //   redirect: "noredirect",
127
+    //   name: "warehouseReceiptOther",
128
+    //   meta: {
129
+    //     isChild: true,
130
+    //     title: "warehouseReceiptOther"
131
+    //   },
132
+    //   children: [
133
+    //     {
134
+    //       path: "/stock/in/other",
135
+    //       component: () => import("@/xt_pages/stock/otherStockInOrder"),
136
+    //       name: "otherStockInOrder",
137
+    //       meta: { title: "otherStockInOrder", noCache: true }
138
+    //     },
139
+    //     {
140
+    //       path: "/stock/return/other",
141
+    //       component: () => import("@/xt_pages/stock/otherSalesReturnOrder"),
142
+    //       name: "otherSalesReturnOrder",
143
+    //       meta: { title: "otherSalesReturnOrder", noCache: true }
144
+    //     },
145
+    //     {
146
+    //       path: "/stock/out/other",
147
+    //       component: () => import("@/xt_pages/stock/otherStockOutOrder"),
148
+    //       name: "otherStockOutOrder",
149
+    //       meta: { title: "otherStockOutOrder", noCache: true }
150
+    //     },
151
+    //     {
152
+    //       path: "/stock/cancel/other",
153
+    //       component: () => import("@/xt_pages/stock/otherCancelStockOrder"),
154
+    //       name: "otherCancelStockOrder",
155
+    //       meta: { title: "otherCancelStockOrder", noCache: true }
156
+    //     }
157
+    //   ]
158
+    // },
87 159
     {
88 160
       path: "/stock/query",
89 161
       component: () => import("@/xt_pages/stock/stockQuery"),

+ 6 - 8
src/views/layout/Layout.vue Целия файл

@@ -1,17 +1,13 @@
1 1
 <template>
2 2
   <div class="app-wrapper" :class="classObj">
3
-    <div
4
-      v-if="device === 'mobile' && sidebar.opened"
5
-      class="drawer-bg"
6
-      @click="handleClickOutside"
7
-    ></div>
3
+    <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside"></div>
8 4
     <navbar></navbar>
9 5
 
10 6
     <div class="Header-container">
11 7
       <sidebar class="sidebar-container" @callBackIndex="handleIndex"></sidebar>
12 8
       <!-- <sidebar class="newSide" @callBackIndex="handleIndex"></sidebar> -->
13 9
       <div class="main-container">
14
-        <tags-view :index="index"></tags-view>
10
+        <tags-view :index="index" :num="num"></tags-view>
15 11
         <app-main></app-main>
16 12
       </div>
17 13
     </div>
@@ -49,16 +45,18 @@ export default {
49 45
   },
50 46
   data() {
51 47
     return {
52
-      index: 0
48
+      index: 0,
49
+      num: 1
53 50
     };
54 51
   },
55 52
   methods: {
56 53
     handleClickOutside() {
57 54
       this.$store.dispatch("closeSideBar", { withoutAnimation: false });
58 55
     },
59
-    handleIndex(data) {
56
+    handleIndex(data, num) {
60 57
       // console.log({ prop: data });
61 58
       this.index = data;
59
+      this.num = num;
62 60
     }
63 61
   }
64 62
 };

+ 9 - 5
src/views/layout/components/Sidebar/SidebarItem.vue Целия файл

@@ -41,7 +41,7 @@
41 41
             v-if="child.meta.isChild != true"
42 42
             :key="child.name"
43 43
           >
44
-            <el-menu-item :index="resolvePath(child.path)">
44
+            <el-menu-item @click="onClick(item)" :index="resolvePath(child.path)">
45 45
               <svg-icon v-if="child.meta && child.meta.icon" :icon-class="child.meta.icon"></svg-icon>
46 46
               <span v-if="child.meta && child.meta.title" slot="title">
47 47
                 {{
@@ -51,8 +51,8 @@
51 51
             </el-menu-item>
52 52
           </router-link>
53 53
 
54
-          <router-link v-else :to="child.children[0].path" :key="child.name">
55
-            <el-menu-item :index="resolvePath(child.path)">
54
+          <router-link v-else :to="child.path" :key="child.name">
55
+            <el-menu-item @click="onClick(item,child.parentNum)" :index="resolvePath(child.path)">
56 56
               <svg-icon v-if="child.meta && child.meta.icon" :icon-class="child.meta.icon"></svg-icon>
57 57
               <span v-if="child.meta && child.meta.title" slot="title">
58 58
                 {{
@@ -157,10 +157,14 @@ export default {
157 157
       return path.resolve(this.basePath, ...paths);
158 158
     },
159 159
     generateTitle,
160
-    onClick(index) {
160
+    onClick(index, num) {
161 161
       this.permission_routers.map((item, i) => {
162 162
         if (this.isObjectValueEqual(item, index)) {
163
-          this.$emit("a", i);
163
+          if (num) {
164
+            this.$emit("a", i, num);
165
+          } else {
166
+            this.$emit("a", i, 999);
167
+          }
164 168
         }
165 169
       });
166 170
     },

+ 4 - 5
src/views/layout/components/Sidebar/index.vue Целия файл

@@ -18,7 +18,7 @@
18 18
       active-text-color="#409EFF"
19 19
     >-->
20 20
     <div class="logo">
21
-      <img src="/static/img/logo.8dbb9fd.png" alt />
21
+      <img src="../../../../assets/logo/logo1.png" alt />
22 22
     </div>
23 23
     <el-menu
24 24
       mode="vertical"
@@ -105,11 +105,10 @@ export default {
105 105
     resolvePath(...paths) {
106 106
       return path.resolve(this.basePath, ...paths);
107 107
     },
108
-    b(index) {
109
-      // console.log(index);
108
+    b(index, num) {
110 109
       // this.index = index;
111 110
       // this.activeClass = index;
112
-      this.$emit("callBackIndex", index);
111
+      this.$emit("callBackIndex", index, num);
113 112
     }
114 113
   },
115 114
   created() {
@@ -157,7 +156,7 @@ export default {
157 156
 .logo {
158 157
   width: 100px;
159 158
   height: 32px;
160
-  margin: 20px auto 0;
159
+  margin: 20px auto;
161 160
   img {
162 161
     width: 100%;
163 162
     height: 100%;

+ 82 - 24
src/views/layout/components/TagsView.vue Целия файл

@@ -27,27 +27,63 @@
27 27
       <li @click="closeAllTags">{{ $t("tagsView.closeAll") }}</li>
28 28
     </ul>-->
29 29
     <div class="tags-view-wrapper">
30
-      <div class="tagsBox">
31
-        <div
32
-          class="tagsOne"
33
-          v-if="permission_routers[newIndex].meta"
34
-          v-for="(item, i) in permission_routers[newIndex].children"
35
-          :key="i"
36
-        >
37
-          <router-link :to="item.path" v-if="!item.hidden && !item.is_menu">
38
-            <p
39
-              class="newTags"
40
-              :class="activeClass == i ? 'active' : ''"
41
-              @click="onClick(i)"
42
-            >{{ generateTitle(item.meta.title) }}</p>
43
-          </router-link>
30
+      <div style="height:100%">
31
+        <div style="height:100%" v-if="newIndex == 9">
32
+          <div class="tagsBox" v-if="routerList.length > 0 && newNum != 999">
33
+            <div
34
+              class="tagsOne"
35
+              v-if="routerList[newIndex].meta"
36
+              v-for="(item, i) in routerList[newIndex].children"
37
+              :key="i"
38
+            >
39
+              <router-link :to="item.path" v-if="item.num ? item.num == newNum : false">
40
+                <p
41
+                  class="newTags"
42
+                  :class="activeClass == i ? 'active' : ''"
43
+                  @click="onClick(i)"
44
+                >{{ generateTitle(item.meta.title) }}</p>
45
+              </router-link>
46
+            </div>
47
+          </div>
48
+          <div class="tagsBox" v-if="newNum == 999">
49
+            <div
50
+              class="tagsOne"
51
+              v-if="permission_routers[newIndex].meta"
52
+              v-for="(item, i) in permission_routers[newIndex].children"
53
+              :key="i"
54
+            >
55
+              <router-link :to="item.path" v-if="item.num ? item.num == newNum : false">
56
+                <p
57
+                  class="newTags"
58
+                  :class="activeClass == i ? 'active' : ''"
59
+                  @click="onClick(i)"
60
+                >{{ generateTitle(item.meta.title) }}</p>
61
+              </router-link>
62
+            </div>
63
+          </div>
44 64
         </div>
45
-        <div v-else class="tagsOne">
46
-          <p class="newTags" :class="activeClass == i ? 'active' : ''" @click="onClick(i)">
47
-            {{
48
-            generateTitle(permission_routers[newIndex].children[0].meta.title)
49
-            }}
50
-          </p>
65
+        <div class="tagsBox" v-if="newIndex != 9">
66
+          <div
67
+            class="tagsOne"
68
+            v-if="permission_routers[newIndex].meta"
69
+            v-for="(item, i) in permission_routers[newIndex].children"
70
+            :key="i"
71
+          >
72
+            <router-link :to="item.path" v-if="!item.hidden && !item.is_menu">
73
+              <p
74
+                class="newTags"
75
+                :class="activeClass == i ? 'active' : ''"
76
+                @click="onClick(i)"
77
+              >{{ generateTitle(item.meta.title) }}</p>
78
+            </router-link>
79
+          </div>
80
+          <div v-else class="tagsOne">
81
+            <p class="newTags" :class="activeClass == i ? 'active' : ''" @click="onClick(i)">
82
+              {{
83
+              generateTitle(permission_routers[newIndex].children[0].meta.title)
84
+              }}
85
+            </p>
86
+          </div>
51 87
         </div>
52 88
       </div>
53 89
     </div>
@@ -61,7 +97,10 @@ import { generateTitle } from "@/utils/i18n";
61 97
 import { mapGetters } from "vuex";
62 98
 
63 99
 export default {
64
-  props: ["index"],
100
+  props: {
101
+    index: Number,
102
+    num: Number
103
+  },
65 104
   components: { ScrollPane },
66 105
   data() {
67 106
     return {
@@ -70,7 +109,8 @@ export default {
70 109
       left: 0,
71 110
       selectedTag: {},
72 111
       newIndex: 0,
73
-      activeClass: ""
112
+      activeClass: 0,
113
+      newNum: 1
74 114
     };
75 115
   },
76 116
   computed: {
@@ -92,12 +132,30 @@ export default {
92 132
     //   }
93 133
     // },
94 134
     index(newVal) {
135
+      if (this.newIndex != newVal) {
136
+        this.activeClass = 0;
137
+      }
95 138
       this.newIndex = this.index;
139
+    },
140
+    num(newVal) {
141
+      this.newNum = newVal;
142
+      if (newVal == 999) {
143
+        this.routerList = [];
144
+      } else {
145
+        this.routerList = this.permission_routers;
146
+      }
147
+      if (newVal == 1) {
148
+        this.activeClass = 2;
149
+      }
150
+      if (newVal == 2) {
151
+        this.activeClass = 6;
152
+      }
96 153
     }
97 154
   },
155
+  created() {
156
+    this.routerList = this.permission_routers;
157
+  },
98 158
   mounted() {
99
-    console.log(111111122111118379487239847, this.permission_routers);
100
-    console.log(this.permission_routers);
101 159
     // this.addViewTags();
102 160
   },
103 161
   methods: {

+ 2 - 3
src/xt_pages/home/index.vue Целия файл

@@ -112,7 +112,6 @@
112 112
             :total="total"
113 113
           ></el-pagination>
114 114
         </div>
115
-
116 115
       </div>
117 116
     </section>
118 117
   </div>
@@ -193,8 +192,8 @@ export default {
193 192
   methods: {
194 193
     dateCompare(date) {
195 194
       var date1 = Date.parse(new Date()) / 1000;
196
-      console.log(date);
197
-      console.log(date1);
195
+      // console.log(date);
196
+      // console.log(date1);
198 197
       if (date > date1) {
199 198
         return 1;
200 199
       } else {

+ 252 - 0
src/xt_pages/role/components/AddRole.vue Целия файл

@@ -0,0 +1,252 @@
1
+<template>
2
+  <el-dialog
3
+    title="新增用户"
4
+    width="660px"
5
+    :visible.sync="visible"
6
+    :before-close="_close"
7
+  >
8
+    <el-form :model="form" :rules="rules" ref="form" label-width="90px">
9
+      <el-form-item label="角色名称 : " prop="name">
10
+        <el-input v-model="form.name" placeholder="" maxlength="30"></el-input>
11
+      </el-form-item>
12
+      <el-form-item label="角色描述 : " >
13
+        <el-input type="textarea" v-model="form.intro" placeholder="" resize="none" rows="4"></el-input>
14
+      </el-form-item>
15
+    </el-form>
16
+    <div slot="footer" class="dialog-footer">
17
+      <el-button @click="hide">取 消</el-button>
18
+      <el-button type="primary" @click="submitAction()">保 存</el-button>
19
+    </div>
20
+  </el-dialog>
21
+</template>
22
+
23
+<script>
24
+  import { addRole, modifyRole } from '@/api/role/role'
25
+
26
+  export default {
27
+    name: 'AddRole',
28
+    data() {
29
+      return {
30
+        form: {
31
+          id: 0,
32
+          name: '',
33
+          intro: ''
34
+        },
35
+        visible: false,
36
+        rules: {
37
+          name: [
38
+            { required: true, message: '请输入角色名称', trigger: 'blur' },
39
+            { max: 10, message: '10个字以内', trigger: 'blur' }
40
+          ],
41
+          // intro: [{ required: true, message: '请输入角色说明', trigger: 'blur' }]
42
+        },
43
+
44
+        //
45
+        checked: '1',
46
+        checkAll: false,
47
+        checkedCities: [],
48
+        cities: ['上海', '北京', '广州', '深圳'],
49
+        isIndeterminate: true,
50
+        ruleForm: {
51
+          name: '',
52
+          phone: '',
53
+          position: ''
54
+        },
55
+        newrules: {
56
+          name: [
57
+            { required: true, message: '请输入角色名称', trigger: 'blur' },
58
+            { max: 10, message: '10个字以内', trigger: 'blur' }
59
+          ],
60
+          phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }]
61
+        }
62
+      }
63
+    },
64
+    methods: {
65
+      _close: function(done) {
66
+        this.clear()
67
+        done()
68
+      },
69
+      clear: function() {
70
+        this.form.id = 0
71
+        this.form.name = ''
72
+        this.form.intro = ''
73
+      },
74
+      show() {
75
+        this.clear()
76
+        this.visible = true
77
+      },
78
+      hide() {
79
+        this.clear()
80
+        this.visible = false
81
+      },
82
+      modify(id, name, intro) {
83
+        this.form.id = id
84
+        this.form.name = name
85
+        this.form.intro = intro
86
+        this.visible = true
87
+      },
88
+      submitAction() {
89
+        this.$refs.form.validate(valid => {
90
+          if (valid) {
91
+            // 验证通过
92
+            if (this.form.id === 0) {
93
+              // 新增 role
94
+              addRole(this.form.name, this.form.intro)
95
+                .then(rs => {
96
+                  var resp = rs.data
97
+                  if (resp.state === 1) {
98
+                    var new_id = resp.data.id
99
+                    var new_name = resp.data.name
100
+                    var new_intro = resp.data.intro
101
+                    var new_status = resp.data.status
102
+                    var staff_number = 0
103
+                    this.$emit(
104
+                      'did-add-role',
105
+                      new_id,
106
+                      new_name,
107
+                      new_intro,
108
+                      new_status,
109
+                      staff_number
110
+                    )
111
+
112
+                    this.hide()
113
+                  } else {
114
+                    this.$message.error(resp.msg)
115
+                  }
116
+                })
117
+                .catch(err => {
118
+                  this.$message.error(err)
119
+                })
120
+            } else {
121
+              // 修改 role
122
+              modifyRole(this.form.id, this.form.name, this.form.intro)
123
+                .then(rs => {
124
+                  var resp = rs.data
125
+                  if (resp.state === 1) {
126
+                    this.$emit(
127
+                      'did-edit-role',
128
+                      this.form.id,
129
+                      this.form.name,
130
+                      this.form.intro
131
+                    )
132
+                    this.hide()
133
+                  } else {
134
+                    this.$message.error(resp.msg)
135
+                  }
136
+                })
137
+                .catch(err => {
138
+                  this.$message.error(err)
139
+                })
140
+            }
141
+          } else {
142
+            // 验证失败
143
+            return false
144
+          }
145
+        })
146
+      },
147
+      handleCheckAllChange(val) {
148
+        this.checkedCities = val ? this.cities : []
149
+        this.isIndeterminate = false
150
+      },
151
+      handleCheckedCitiesChange(value) {
152
+        let checkedCount = value.length
153
+        this.checkAll = checkedCount === this.cities.length
154
+        this.isIndeterminate =
155
+          checkedCount > 0 && checkedCount < this.cities.length
156
+      }
157
+    }
158
+  }
159
+</script>
160
+
161
+<style lang="scss" scoped>
162
+  .roleContent {
163
+    margin-top: 20px;
164
+    display: flex;
165
+    justify-content: space-between;
166
+
167
+  .roleContentLeft {
168
+
169
+  .chooseBox {
170
+    width: 280px;
171
+    height: 320px;
172
+    overflow-y: auto;
173
+    border: 1px solid rgba(235, 238, 240, 1);
174
+    margin-top: 26px;
175
+    padding: 20px;
176
+
177
+  .checkone {
178
+    display: flex;
179
+    align-items: center;
180
+    height: 50px;
181
+  }
182
+
183
+  .el-checkbox__label {
184
+    display: flex;
185
+    align-items: center;
186
+
187
+  img {
188
+    width: 30px;
189
+    height: 30px;
190
+    margin-right: 10px;
191
+  }
192
+
193
+  }
194
+  }
195
+  }
196
+  .roleContentRight {
197
+
198
+  .chooseBox {
199
+    width: 280px;
200
+    height: 320px;
201
+    overflow-y: auto;
202
+    border: 1px solid rgba(235, 238, 240, 1);
203
+    margin-top: 26px;
204
+    padding: 20px;
205
+
206
+  .hasChoosedOne {
207
+    display: flex;
208
+    align-items: center;
209
+    height: 50px;
210
+
211
+  img {
212
+    width: 30px;
213
+    height: 30px;
214
+    margin-right: 10px;
215
+  }
216
+
217
+  }
218
+  }
219
+  }
220
+  }
221
+  .newStaff {
222
+    margin-top: 26px;
223
+
224
+  .newItem {
225
+    display: flex;
226
+    align-items: center;
227
+  }
228
+
229
+  }
230
+</style>
231
+
232
+<style lang="scss">
233
+  .roleContent {
234
+
235
+  .roleContentLeft {
236
+
237
+  .chooseBox {
238
+
239
+  .el-checkbox {
240
+    display: flex;
241
+    align-items: center;
242
+  }
243
+
244
+  .el-checkbox__label {
245
+    display: flex;
246
+    align-items: center;
247
+  }
248
+
249
+  }
250
+  }
251
+  }
252
+</style>

+ 257 - 0
src/xt_pages/role/components/AdminRoleInfoForm.vue Целия файл

@@ -0,0 +1,257 @@
1
+<template>
2
+  <el-dialog :title="formTitle" :visible.sync="dialogFormVisible">
3
+    <el-form :model="form" ref="form" :rules="rules" label-width="60px">
4
+      <el-form-item label="账号 : " prop="mobile">
5
+        <el-input v-model="form.mobile" placeholder="用户手机号" maxlength="11"
6
+                  :disabled="form.id !==  0"></el-input>
7
+      </el-form-item>
8
+
9
+      <el-form-item label="姓名 : " prop="name">
10
+        <el-input v-model="form.name" placeholder="用户姓名"></el-input>
11
+      </el-form-item>
12
+
13
+      <el-form-item label="职称 : ">
14
+        <el-select v-model="form.user_type" placeholder="用户类型">
15
+          <el-option
16
+            v-for="item in user_types"
17
+            :label="item.name"
18
+            :value="item.index"
19
+            :key="item.index"
20
+          ></el-option>
21
+        </el-select>
22
+
23
+        <el-select v-model="form.user_title" placeholder="用户职称">
24
+          <el-option
25
+            v-for="item in user_titles"
26
+            :label="item.name"
27
+            :value="item.index"
28
+            :key="item.index"
29
+          ></el-option>
30
+        </el-select>
31
+      </el-form-item>
32
+
33
+      <el-form-item label="职位 : ">
34
+        <el-input v-model="form.user_title_name" placeholder="输入职位"></el-input>
35
+      </el-form-item>
36
+
37
+      <el-form-item label="介绍 : ">
38
+        <Tinymce :height="400" menubar ref="editor" v-model="form.intro" :show_upload_img="false"/>
39
+      </el-form-item>
40
+    </el-form>
41
+    <div slot="footer" class="dialog-footer">
42
+      <el-button @click="dialogFormVisible = false">取 消</el-button>
43
+      <el-button type="primary" @click="submitAction">保 存</el-button>
44
+    </div>
45
+  </el-dialog>
46
+</template>
47
+
48
+<script>
49
+  import Tinymce from '@/components/Tinymce'
50
+  import { addAdmin, getAddAdminInitData, getModifyAdminInitData, modifyAdmin } from '@/api/role/admin'
51
+
52
+  export default {
53
+    name: 'AdminRoleInfoForm',
54
+    components: {
55
+      Tinymce
56
+    },
57
+    data() {
58
+      var checkMobile = (rule, value, callback) => {
59
+        if (!value || value.length == 0) {
60
+          return callback(new Error('手机号不能为空'))
61
+        }
62
+        if (/^1\d{10}$/.test(value) == false) {
63
+          return callback(new Error('手机号格式错误'))
64
+        } else {
65
+          callback()
66
+        }
67
+      }
68
+      var checkName = (rule, value, callback) => {
69
+        if (!value || value.length == 0) {
70
+          return callback(new Error('姓名不能为空'))
71
+        } else {
72
+          callback()
73
+        }
74
+      }
75
+      return {
76
+        admin_id: 0,
77
+        dialogFormVisible: false,
78
+
79
+        user_types: [
80
+          { index: 2, name: '医生' },
81
+          { index: 3, name: '护士' }
82
+        ],
83
+        user_titles: [
84
+          { index: 1, name: '医士' },
85
+          { index: 2, name: '医师' },
86
+          { index: 3, name: '住院医师' },
87
+          { index: 4, name: '主治医师' },
88
+          { index: 5, name: '副主任医师' },
89
+          { index: 6, name: '主任医师' },
90
+          { index: 7, name: '护士' },
91
+          { index: 8, name: '护师' },
92
+          { index: 9, name: '主管护师' },
93
+          { index: 10, name: '副主任护师' },
94
+          { index: 11, name: '主任护师' },
95
+          { index: 12, name: '运营专员' },
96
+          { index: 13, name: '运营主管' }
97
+        ],
98
+        roles: [], // [{id, name, intro, status}]
99
+        loading: true,
100
+        qntoken: '',
101
+        formTitle: '',
102
+        isSubSuperAdmin: false,
103
+        org: null,
104
+        form: {
105
+          role_ids: [],
106
+          user_title_name: '',
107
+          id: 0,
108
+          mobile: '',
109
+          name: '',
110
+          user_type: '',
111
+          user_title: '',
112
+          role: '', // 其实应该是 int 类型
113
+          intro: ''
114
+        },
115
+        rules: {
116
+          mobile: [{ required: true, validator: checkMobile, trigger: 'blur' }],
117
+          name: [{ required: true, validator: checkName, trigger: 'blur' }]
118
+
119
+        }
120
+      }
121
+    },
122
+    methods: {
123
+      open: function(adminId,role_id) {
124
+        this.admin_id = adminId
125
+        this.roles.push(role_id)
126
+        if (this.admin_id < 0) {
127
+          this.$message.error('参数错误')
128
+          this.loading = false
129
+          return
130
+        }
131
+        let local_user_id = this.$store.getters.xt_user.user.id
132
+        local_user_id = 597
133
+        this.form.id = this.admin_id
134
+        this.formTitle = '编辑用户'
135
+        getModifyAdminInitData(this.form.id)
136
+          .then(rs => {
137
+            this.loading = false
138
+            var resp = rs.data
139
+            if (resp.state === 1) {
140
+              this.roles = []
141
+              this.roles.push(...resp.data.roles)
142
+              this.qntoken = resp.data.qntoken
143
+              var admin = resp.data.admin
144
+              this.form.name = admin.user_name
145
+              this.form.mobile = admin.admin.mobile
146
+              this.form.user_type = admin.user_type
147
+              this.form.user_title = admin.user_title
148
+              this.form.role = admin.role_ids
149
+              this.form.role_ids = []
150
+              for (let i = 0; i < this.form.role.split(",").length; i++) {
151
+                if (this.form.role.split(',')[i].length > 0) {
152
+                  this.form.role_ids.push(parseInt(this.form.role.split(',')[i]))
153
+                }
154
+              }
155
+
156
+              this.form.intro = admin.intro
157
+              this.form.user_title_name = admin.user_title_name
158
+
159
+              //如果当前用户是超级管理员而且编辑自己的信息
160
+              if (!this.isSubSuperAdmin && local_user_id == this.form.id) {
161
+                for (let i = 0; i < this.roles.length; i++) {
162
+                  if (this.roles[i].is_system == 1 && this.roles[i].role_name != '子管理员') {
163
+                    this.roles.splice(i, 1)
164
+                    i--
165
+                  }
166
+                }
167
+              }
168
+
169
+            } else {
170
+              this.$message.error('该用户不存在')
171
+            }
172
+          })
173
+          .catch(err => {
174
+            this.loading = false
175
+            this.$message.error('该用户不存在')
176
+          })
177
+
178
+        this.dialogFormVisible = true
179
+      },
180
+      submitAction: function() {
181
+        if (this.admin_id < 0) {
182
+          return
183
+        }
184
+        this.$refs.form.validate(valid => {
185
+          if (valid) {
186
+            this.loading = true
187
+            if (this.form.id === 0) {
188
+              this.form.role = this.form.role_ids.join(',')
189
+              addAdmin(
190
+                this.form.mobile,
191
+                this.form.name,
192
+                this.form.user_type,
193
+                this.form.user_title,
194
+                this.form.role,
195
+                this.form.intro,
196
+                this.form.user_title_name
197
+              )
198
+                .then(rs => {
199
+                  this.loading = false
200
+                  var resp = rs.data
201
+                  if (resp.state === 1) {
202
+                    this.$store.dispatch('DidChangeAdmins')
203
+                    var _this = this
204
+                    setTimeout(() => {
205
+                      _this.$store.dispatch('RecoverAdminsChangeState')
206
+                    }, 500)
207
+
208
+                    this.$emit('did-edit-admin')
209
+
210
+                  } else {
211
+                    this.$message.error(resp.msg)
212
+                  }
213
+                })
214
+                .catch(err => {
215
+                  this.loading = false
216
+                  this.$message.error(err)
217
+                })
218
+            } else {
219
+              this.form.role = this.form.role_ids.join(',')
220
+
221
+              modifyAdmin(
222
+                this.form.id,
223
+                this.form.name,
224
+                this.form.user_type,
225
+                this.form.user_title,
226
+                this.form.role,
227
+                this.form.intro,
228
+                this.form.user_title_name
229
+              )
230
+                .then(rs => {
231
+                  this.loading = false
232
+                  var resp = rs.data
233
+                  if (resp.state === 1) {
234
+                   console.log("11111111")
235
+                    this.$emit('did-edit-admin')
236
+
237
+                  } else {
238
+                    this.$message.error(resp.msg)
239
+                  }
240
+                })
241
+                .catch(err => {
242
+                  this.loading = false
243
+                  this.$message.error(err)
244
+                })
245
+            }
246
+          } else {
247
+            return false
248
+          }
249
+        })
250
+      },
251
+      close:function() {
252
+        this.dialogFormVisible= false
253
+
254
+      }
255
+    }
256
+  }
257
+</script>

+ 69 - 14
src/xt_pages/role/components/PermissionSettings.vue Целия файл

@@ -12,18 +12,23 @@
12 12
         <div class="roleMainLeft">
13 13
           <p class="roletitle">选择权限</p>
14 14
           <div class="roleMainLeftBox">
15
-            <el-tree
16
-              :props="defaultProps"
17
-              :data="data"
18
-              :default-checked-keys="data"
19
-              node-key="id"
20
-              ref="tree"
21
-              default-expand-all
22
-              show-checkbox
23
-            >
24
-              <!-- <span class="custom-tree-node" slot-scope="{ node, data }">
15
+            <!--<el-tree-->
16
+              <!--:props="defaultProps"-->
17
+              <!--:data="data"-->
18
+              <!--:default-checked-keys="data"-->
19
+              <!--node-key="id"-->
20
+              <!--ref="tree"-->
21
+              <!--default-expand-all-->
22
+              <!--show-checkbox-->
23
+            <!--&gt;-->
24
+              <!--&lt;!&ndash; <span class="custom-tree-node" slot-scope="{ node, data }">-->
25
+                                <!--<span>{{ data.name }}</span>-->
26
+              <!--</span>&ndash;&gt;-->
27
+            <!--</el-tree>-->
28
+            <el-tree :props="treeProps" :data="purviews" :default-checked-keys="default_checkeds" node-key="id" ref="tree" default-expand-all show-checkbox>
29
+                            <span class="custom-tree-node" slot-scope="{ node, data }">
25 30
                                 <span>{{ data.name }}</span>
26
-              </span>-->
31
+                            </span>
27 32
             </el-tree>
28 33
           </div>
29 34
         </div>
@@ -38,10 +43,20 @@
38 43
 
39 44
 
40 45
 <script>
41
-export default {
46
+  import {getEditPurviewInitData, editPurview} from '@/api/role/role'
47
+
48
+  export default {
42 49
   data() {
43 50
     return {
44 51
       visible: false,
52
+      role_id: 0,
53
+      purviews: [], // [{id, pid, name, childs}]
54
+      treeProps: {
55
+        label: "name",
56
+        children: "childs"
57
+      },
58
+      // role_purview_ids: '',
59
+      default_checkeds: [],
45 60
       data: [
46 61
         {
47 62
           id: 1,
@@ -85,10 +100,50 @@ export default {
85 100
     };
86 101
   },
87 102
   methods: {
88
-    show() {
103
+    show(role_id) {
89 104
       this.visible = true;
105
+
106
+      var id = parseInt(role_id)
107
+      if (id <= 0) {
108
+        this.$message.error("参数错误")
109
+        return
110
+      }
111
+      this.role_id = role_id
112
+      getEditPurviewInitData(this.role_id).then(rs => {
113
+        var resp = rs.data
114
+        if (resp.state === 1) {
115
+          this.purviews.push(...resp.data.purviews)
116
+          // 初始化默认选中项
117
+          var role_purview_ids = resp.data.role_purview_ids
118
+          var checkeds = []
119
+          if (role_purview_ids.length > 0) {
120
+            var ids = role_purview_ids.split(",")
121
+            this.purviews.forEach(purview => {
122
+              if (purview.childs != null && purview.childs.length > 0) {
123
+                purview.childs.forEach(child => {
124
+                  if (ids.indexOf(child.id+"") != -1) {
125
+                    checkeds.push(child.id)
126
+                  }
127
+                });
128
+              } else {
129
+                if (ids.indexOf(purview.id+"") != -1) {
130
+                  checkeds.push(purview.id)
131
+                }
132
+              }
133
+            });
134
+          }
135
+          this.default_checkeds = checkeds
136
+        } else {
137
+          this.$message.error(resp.msg)
138
+        }
139
+      }).catch(err => {
140
+        this.$message.error(err)
141
+      })
90 142
     }
91
-  }
143
+  },created(){
144
+
145
+
146
+  },
92 147
 };
93 148
 </script>
94 149
 

+ 233 - 0
src/xt_pages/role/components/UserManagement.vue Целия файл

@@ -0,0 +1,233 @@
1
+<template>
2
+  <div>
3
+  <el-dialog class="userDialog" title="用户管理" width="660px" :visible.sync="visible">
4
+    <div class="userManagement">
5
+      <el-table
6
+        :row-style="{ color: '#303133' }"
7
+        :header-cell-style="{
8
+          backgroundColor: 'rgb(245, 247, 250)',
9
+          color: '#606266'
10
+        }"
11
+        style="width:100%;"
12
+        ref="table"
13
+        border
14
+        :data="admin_user"
15
+      >
16
+        <el-table-column prop="name" label="员工姓名" width="120">
17
+          <template slot-scope="scope">
18
+            {{scope.row.user_name}}
19
+          </template>
20
+        </el-table-column>
21
+        <!--<el-table-column prop="date" label="登录账号" width="120">-->
22
+          <!--<template slot-scope="scope">-->
23
+            <!--{{}}-->
24
+          <!--</template>-->
25
+        <!--</el-table-column>-->
26
+        <el-table-column prop="date" label="最后登录时间" width="180">
27
+          <template slot-scope="scope">
28
+             <span>{{
29
+              scope.row.last_login_time == 0
30
+                ? ""
31
+                : _parseTime(scope.row.last_login_time, "{y}-{m}-{d} {h}:{i}")
32
+            }}</span>
33
+          </template>
34
+
35
+        </el-table-column>
36
+        <el-table-column label="操作" >
37
+          <template slot-scope="scope" style="text-align: center">
38
+            <el-tooltip class="item" effect="dark" content="编辑" placement="top">
39
+              <el-button  type="primary" icon="el-icon-edit-outline" size="small"
40
+                         v-if="org.creator != scope.row.user_id && (scope.row.user_id != local_user_id) && !scope.row.is_sub_super_admin"
41
+                         @click="openForm(scope.row.user_id, role_id)" ></el-button>
42
+            </el-tooltip>
43
+
44
+            <el-tooltip
45
+              class="item"
46
+              effect="dark"
47
+              content="移除"
48
+              placement="top"
49
+            >
50
+              <el-button
51
+                type="danger"
52
+                size="small"
53
+                icon="el-icon-delete"
54
+                v-if="scope.row.status == 1 && org.creator != scope.row.user_id && (scope.row.user_id != local_user_id) && !scope.row.is_sub_super_admin"
55
+                @click="disableAdminAction(scope.row)"
56
+              ></el-button>
57
+            </el-tooltip>
58
+
59
+            <el-tooltip
60
+              class="item"
61
+              effect="dark"
62
+              content="恢复"
63
+              placement="top"
64
+            >
65
+              <el-button
66
+                size="small"
67
+                type="info"
68
+                icon="el-icon-refresh"
69
+                v-if="scope.row.status == 0 && org.creator != scope.row.user_id  && (scope.row.user_id != local_user_id ) && !scope.row.is_sub_super_admin"
70
+                @click="recoverAdminAction(scope.row)"
71
+              ></el-button>
72
+            </el-tooltip>
73
+
74
+          </template>
75
+        </el-table-column>
76
+      </el-table>
77
+    </div>
78
+  </el-dialog>
79
+  <!--<admin-info-form ref="admininfoform"></admin-info-form>-->
80
+    <admin-role-info-form ref="admininfoform"  @did-edit-admin="didModifyAdmin"></admin-role-info-form>
81
+  </div>
82
+</template>
83
+
84
+
85
+<script>
86
+  import { getRoleStaff } from '@/api/role/role'
87
+  import { parseTime } from "@/utils";
88
+  import { setAdminStatus } from "@/api/role/admin";
89
+  // import AdminInfoForm from './AdminInfoForm'
90
+  import AdminRoleInfoForm from './AdminRoleInfoForm'
91
+
92
+  export default {
93
+    components: { AdminRoleInfoForm },
94
+    data() {
95
+      return {
96
+        visible: false,
97
+        role_id: 0,
98
+        admin_user: [],
99
+        local_user_id: 0,
100
+        org:null,
101
+
102
+
103
+      }
104
+    },
105
+    methods: {
106
+      didModifyAdmin(){
107
+        this.GetAllStaff()
108
+        this.$refs["admininfoform"].close();
109
+
110
+      },
111
+      openForm(adminId,role_id) {
112
+        this.$refs["admininfoform"].open(adminId,role_id);
113
+      },
114
+      disableAdminAction: function(row) {
115
+        this.$msgbox({
116
+          title: "提示",
117
+          message: "是否确定要移除该用户",
118
+          showCancelButton: true,
119
+          confirmButtonText: "确定",
120
+          cancelButtonText: "取消",
121
+          type: "warning",
122
+          beforeClose: (action, instance, done) => {
123
+            if (action === "confirm") {
124
+              instance.confirmButtonLoading = true;
125
+              instance.confirmButtonText = "删除中...";
126
+
127
+              setAdminStatus(row.user_id, false)
128
+                .then(rs => {
129
+                  done();
130
+                  instance.confirmButtonLoading = false;
131
+
132
+                  const resp = rs.data;
133
+                  if (resp.state === 1) {
134
+                    row.status = 0;
135
+                  } else {
136
+                    this.$message.error(resp.msg);
137
+                  }
138
+                })
139
+                .catch(err => {
140
+                  done();
141
+                  instance.confirmButtonLoading = false;
142
+                  this.$message.error(err);
143
+                });
144
+            } else {
145
+              done();
146
+            }
147
+          }
148
+        });
149
+      },
150
+      recoverAdminAction: function(row) {
151
+        const loading = this.$loading({
152
+          lock: true,
153
+          text: "正在恢复管理员...",
154
+          spinner: "el-icon-loading",
155
+          background: "rgba(0, 0, 0, 0.7)"
156
+        });
157
+
158
+        setAdminStatus(row.user_id, true)
159
+          .then(rs => {
160
+            loading.close();
161
+
162
+            const resp = rs.data;
163
+            if (resp.state === 1) {
164
+              row.status = 1;
165
+            } else {
166
+              this.$message.error(resp.msg);
167
+            }
168
+          })
169
+          .catch(err => {
170
+            loading.close();
171
+            this.$message.error(err);
172
+          });
173
+      },
174
+      _parseTime(time, format) {
175
+        return parseTime(time, format);
176
+      },
177
+      GetAllStaff: function() {
178
+        getRoleStaff().then(response => {
179
+          if (response.data.state === 1) {
180
+            this.admin_user = response.data.data.admins
181
+            this.org = response.data.data.org
182
+
183
+            for (let i = 0; i < this.admin_user.length; i++) {
184
+              if (this.admin_user[i].role_ids.length > 0) {
185
+                let isExist = -1
186
+                let ids = this.admin_user[i].role_ids.split(',')
187
+                isExist = ids.indexOf(this.role_id.toString())
188
+                if (isExist < 0) {
189
+                  this.admin_user.splice(i, 1)
190
+                  i = i - 1
191
+                }
192
+              }
193
+            }
194
+          } else {
195
+            this.$toast({
196
+              message: response.data.msg
197
+            })
198
+          }
199
+        })
200
+      },
201
+
202
+      show(role_id) {
203
+        this.visible = true
204
+        this.role_id = role_id
205
+        this.admin_user = []
206
+        this.local_user_id = this.$store.getters.xt_user.user.id
207
+        this.local_user_id = 597
208
+        this.GetAllStaff()
209
+      }
210
+    }
211
+  }
212
+</script>
213
+
214
+<style lang="scss" scoped>
215
+  .userManagement {
216
+
217
+  .cell {
218
+    text-align: center;
219
+  }
220
+
221
+  }
222
+</style>
223
+
224
+
225
+<style lang="scss">
226
+  .userManagement {
227
+
228
+  .cell {
229
+    text-align: center;
230
+  }
231
+
232
+  }
233
+</style>

+ 11 - 5
src/xt_pages/role/role.vue Целия файл

@@ -96,6 +96,7 @@
96 96
       ></add-role>
97 97
 
98 98
       <permission-settings ref="permission_settings"></permission-settings>
99
+      <user-management ref="user_management"></user-management>
99 100
 
100 101
       <div class="roleTitle">
101 102
         <i class="el-icon-warning warn"></i>
@@ -107,7 +108,7 @@
107 108
         <div class="roleOne" v-for="item in this.roles">
108 109
           <div class="setting">
109 110
             <i class="el-icon-setting"></i>
110
-            <span style="margin-right:20px" @click="onClick">权限配置</span>
111
+            <span style="margin-right:20px" @click="onClick(item.id)">权限配置</span>
111 112
           </div>
112 113
           <div class="avatar">
113 114
             <img v-if="item.name == '子管理员'" src="../../assets/img/pc1.png" alt=""/>
@@ -132,7 +133,7 @@
132 133
           </div>
133 134
           <div class="btnBox">
134 135
             <el-button @click="addStaff(item.id)">新增用户</el-button>
135
-            <el-button>用户管理</el-button>
136
+            <el-button @click="onClickManagement(item.id)">用户管理</el-button>
136 137
           </div>
137 138
         </div>
138 139
 
@@ -145,6 +146,7 @@
145 146
 import EditRole from "./components/EditRole.vue";
146 147
 import PermissionSettings from "./components/PermissionSettings.vue";
147 148
 import { getRoles, setRoleStatus,getRolesList } from "@/api/role/role";
149
+import UserManagement from "./components/UserManagement.vue";
148 150
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
149 151
 import AddRole from './components/AddRole'
150 152
 
@@ -153,7 +155,8 @@ export default {
153 155
     AddRole,
154 156
     EditRole,
155 157
     BreadCrumb,
156
-    PermissionSettings
158
+    PermissionSettings,
159
+    UserManagement
157 160
   },
158 161
   data: function() {
159 162
     return {
@@ -278,8 +281,11 @@ export default {
278 281
     },
279 282
     ///
280 283
 
281
-    onClick() {
282
-      this.$refs.permission_settings.show();
284
+    onClick(role_id) {
285
+      this.$refs.permission_settings.show(role_id);
286
+    },
287
+    onClickManagement(role_id) {
288
+      this.$refs.user_management.show(role_id);
283 289
     }
284 290
   }
285 291
 };