Selaa lähdekoodia

Merge branch 'dev' of http://git.ycjcjy.com/SpaceOfCheng/admin into dev

yuantianjiao 6 vuotta sitten
vanhempi
commit
6dec0b0c1a

+ 1
- 1
src/pages/login/index.vue Näytä tiedosto

@@ -71,7 +71,7 @@ export default {
71 71
           duration: 1000
72 72
         })
73 73
         setTimeout(() => {
74
-          this.$router.push({ name: 'system' })
74
+          this.$router.push({ name: 'userManager' })
75 75
         }, 1000)
76 76
       }).catch(msg => {
77 77
 

+ 54
- 15
src/pages/system/channelManager/channelList/add.vue Näytä tiedosto

@@ -3,24 +3,27 @@
3 3
     <form class="mainForm">
4 4
       <ul>
5 5
         <li class="flex-h">
6
-          <span>渠道名:</span>
6
+          <span>选择案场:</span>
7 7
           <div class="flex-item">
8 8
             <div style="width:50%">
9
-              <el-input
10
-                placeholder="请输入渠道名"
11
-                v-model="postData.channelName"
12
-                clearable>
13
-              </el-input>
9
+              <el-select v-model="CaseId" placeholder="请选择">
10
+                <el-option
11
+                  v-for="item in cases"
12
+                  :key="item.CaseId"
13
+                  :label="item.CaseName"
14
+                  :value="item.CaseId">
15
+                </el-option>
16
+              </el-select>
14 17
             </div>
15 18
           </div>
16 19
         </li>
17 20
         <li class="flex-h">
18
-          <span>渠道code:</span>
21
+          <span>渠道:</span>
19 22
           <div class="flex-item">
20 23
             <div style="width:50%">
21 24
               <el-input
22
-                placeholder="请输入渠道code"
23
-                v-model="postData.channelCode"
25
+                placeholder="请输入渠道"
26
+                v-model="postData.ChannelName"
24 27
                 clearable>
25 28
               </el-input>
26 29
             </div>
@@ -36,26 +39,62 @@
36 39
 </template>
37 40
 
38 41
 <script>
42
+import { mapState } from 'vuex'
39 43
 export default {
40 44
   name: '',
41 45
   data () {
42 46
     return {
43 47
       postData: {
44
-        channelName: '',
45
-        channelCode: ''
48
+        ChannelId: '', // 渠道id
49
+        ChannelName: '', // 渠道名称
50
+        CaseId: '', // 案场id
51
+        OrgId: '', // 机构id
52
+      }
53
+    }
54
+  },
55
+  computed: {
56
+    ...mapState({
57
+      cases: x => x.app.cases.list,
58
+      defaultCaseId: x => x.app.cases.default,
59
+      OrgId: x => x.app.user.OrgId,
60
+    }),
61
+    CaseId: {
62
+      get () {
63
+        return this.postData.CaseId === '' ? this.defaultCaseId || '' : this.postData.CaseId
64
+      },
65
+      set (val) {
66
+        this.postData.CaseId = val
46 67
       }
47 68
     }
48 69
   },
49 70
   components: {},
50 71
   methods: {
51
-    submit () {
52
-      console.log(this.postData)
72
+    submit () { // 提交数据
73
+      if (this.postData.ChannelName === '') {
74
+        this.$message({
75
+          type: 'error',
76
+          message: '渠道名称不能为空'
77
+        })
78
+        return false
79
+      }
80
+      this.postData.OrgId = this.OrgId
81
+      if (this.postData.CaseId === '') this.postData.CaseId = this.CaseId
82
+      this.$ajax(this.$api.channelManager.addChannel.url, {
83
+        method: this.$api.channelManager.addChannel.method,
84
+        data: this.postData
85
+      }).then(res => {
86
+        this.$message({
87
+          type: 'success',
88
+          message: '操作成功'
89
+        })
90
+        this.$router.push({ name: 'channelList' })
91
+      })
53 92
     },
54 93
     cancel () {
55
-      this.$router.go(-1)
94
+      this.$router.push({ name: 'channelList' })
56 95
     }
57 96
   },
58
-  mounted () {}
97
+  mounted () { }
59 98
 }
60 99
 </script>
61 100
 

+ 65
- 15
src/pages/system/channelManager/channelList/edit.vue Näytä tiedosto

@@ -3,24 +3,27 @@
3 3
     <form class="mainForm">
4 4
       <ul>
5 5
         <li class="flex-h">
6
-          <span>渠道名:</span>
6
+          <span>选择案场:</span>
7 7
           <div class="flex-item">
8 8
             <div style="width:50%">
9
-              <el-input
10
-                placeholder="请输入渠道名"
11
-                v-model="postData.channelName"
12
-                clearable>
13
-              </el-input>
9
+              <el-select v-model="CaseId" placeholder="请选择">
10
+                <el-option
11
+                  v-for="item in cases"
12
+                  :key="item.CaseId"
13
+                  :label="item.CaseName"
14
+                  :value="item.CaseId">
15
+                </el-option>
16
+              </el-select>
14 17
             </div>
15 18
           </div>
16 19
         </li>
17 20
         <li class="flex-h">
18
-          <span>渠道code:</span>
21
+          <span>渠道:</span>
19 22
           <div class="flex-item">
20 23
             <div style="width:50%">
21 24
               <el-input
22
-                placeholder="请输入渠道code"
23
-                v-model="postData.channelCode"
25
+                placeholder="请输入渠道"
26
+                v-model="postData.ChannelName"
24 27
                 clearable>
25 28
               </el-input>
26 29
             </div>
@@ -36,26 +39,73 @@
36 39
 </template>
37 40
 
38 41
 <script>
42
+import { mapState } from 'vuex'
39 43
 export default {
40 44
   name: '',
41 45
   data () {
42 46
     return {
43 47
       postData: {
44
-        channelName: '',
45
-        channelCode: ''
48
+        ChannelId: '', // 渠道id
49
+        ChannelName: '', // 渠道名称
50
+        CaseId: '', // 案场id
51
+        OrgId: '', // 机构id
46 52
       }
47 53
     }
48 54
   },
55
+  computed: {
56
+    ...mapState({
57
+      cases: x => x.app.cases.list,
58
+      defaultCaseId: x => x.app.cases.default,
59
+      OrgId: x => x.app.user.OrgId,
60
+    }),
61
+    CaseId: {
62
+      get () {
63
+        return this.postData.CaseId === '' ? this.defaultCaseId || '' : this.postData.CaseId
64
+      },
65
+      set (val) {
66
+        this.postData.CaseId = val
67
+      }
68
+    }
69
+  },
70
+  created () {
71
+    this.getChannelInfo()
72
+  },
49 73
   components: {},
50 74
   methods: {
51
-    submit () {
52
-      console.log(this.postData)
75
+    getChannelInfo () {
76
+      this.$ajax(this.$api.channelManager.getChannelInfo.url, {
77
+        method: this.$api.channelManager.getChannelInfo.method,
78
+        urlData: { channelId: this.$route.query.id }
79
+      }).then(res => {
80
+        this.postData = res
81
+      })
82
+    },
83
+    submit () { // 提交数据
84
+      if (this.postData.ChannelName === '') {
85
+        this.$message({
86
+          type: 'error',
87
+          message: '渠道名称不能为空'
88
+        })
89
+        return false
90
+      }
91
+      this.postData.OrgId = this.OrgId
92
+      if (this.postData.CaseId === '') this.postData.CaseId = this.CaseId
93
+      this.$ajax(this.$api.channelManager.editChannel.url, {
94
+        method: this.$api.channelManager.editChannel.method,
95
+        data: this.postData
96
+      }).then(res => {
97
+        this.$message({
98
+          type: 'success',
99
+          message: '操作成功'
100
+        })
101
+        this.$router.push({ name: 'channelList' })
102
+      })
53 103
     },
54 104
     cancel () {
55
-      this.$router.go(-1)
105
+      this.$router.push({ name: 'channelList' })
56 106
     }
57 107
   },
58
-  mounted () {}
108
+  mounted () { }
59 109
 }
60 110
 </script>
61 111
 

+ 12
- 15
src/pages/system/channelManager/channelList/index.vue Näytä tiedosto

@@ -26,16 +26,16 @@
26 26
     </div>
27 27
     <div class="system-table-box">
28 28
       <el-table
29
-        :data="tableData"
29
+        :data="currentList"
30 30
         stripe
31 31
         style="width: 100%">
32 32
         <el-table-column
33
-          prop="channelName"
34
-          label="渠道名">
33
+          prop="CaseName"
34
+          label="案场">
35 35
         </el-table-column>
36 36
         <el-table-column
37
-          prop="channelCode"
38
-          label="渠道code">
37
+          prop="ChannelName"
38
+          label="渠道名称">
39 39
         </el-table-column>
40 40
         <el-table-column label="操作">
41 41
           <template slot-scope="scope">
@@ -70,7 +70,7 @@ export default {
70 70
     return {
71 71
       total: 0,
72 72
       postData: { // 表格搜索条件
73
-        CaseId: '', // 案场id
73
+        caseid: '', // 案场id
74 74
         page: 1, // 当前页码
75 75
         pagesize: 10, // 请求数据量
76 76
       },
@@ -87,10 +87,10 @@ export default {
87 87
     }),
88 88
     CaseId: {
89 89
       get () {
90
-        return this.postData.CaseId || this.defaultCaseId
90
+        return this.postData.caseid || this.defaultCaseId
91 91
       },
92 92
       set (val) {
93
-        this.postData.CaseId = val
93
+        this.postData.caseid = val
94 94
       }
95 95
     }
96 96
   },
@@ -101,13 +101,10 @@ export default {
101 101
       this.getList()
102 102
     },
103 103
     getList () { // 获取列表
104
-      this.$ajax(this.$api.goodsManager.getGoodsTypeList.url, {
105
-        method: this.$api.goodsManager.getGoodsTypeList.method,
106
-        data: { ...this.postData, CaseId: this.CaseId }
104
+      this.$ajax(this.$api.channelManager.getChannelList.url, {
105
+        method: this.$api.channelManager.getChannelList.method,
106
+        queryData: { ...this.postData, caseid: this.CaseId }
107 107
       }).then(res => {
108
-        for (var n = 0; n < res.list.length; n++) {
109
-          res.list[n].CaseName = this.cases.filter(x => x.CaseId === res.list[n].CaseId)[0].CaseName
110
-        }
111 108
         this.currentList = res.list
112 109
         this.postData.page = res.page
113 110
         this.total = res.pagenum
@@ -117,7 +114,7 @@ export default {
117 114
       this.getList()
118 115
     },
119 116
     handleEdit (index, row) { // 编辑
120
-      this.$router.push({ name: 'editGoodsType', query: { id: row.TypeId } })
117
+      this.$router.push({ name: 'editChannel', query: { id: row.ChannelId } })
121 118
     },
122 119
     handleDelete (index, row) { // 删除
123 120
       let name = '确认删除规格“' + row.TypeName + '”?'

+ 33
- 89
src/pages/system/dataStatistics/frontEndUserList/index.vue Näytä tiedosto

@@ -3,147 +3,91 @@
3 3
     <div class="system-table-search">
4 4
       <div class="flex-h">
5 5
         <div class="flex-item flex-h"></div>
6
-        <tableSearch value="请输入用户名称" @exportSearchKey="searchList"></tableSearch>
6
+        <tableSearch value="请输入用户手机号" @exportSearchKey="searchList"></tableSearch>
7 7
       </div>
8 8
       <div class="moreFilter"></div>
9 9
     </div>
10 10
     <div class="system-table-box">
11 11
       <el-table
12
-        :data="tableData"
12
+        :data="currentList"
13 13
         stripe
14 14
         style="width: 100%">
15 15
         <el-table-column
16
-          prop="name"
16
+          prop="Name"
17 17
           label="姓名">
18 18
         </el-table-column>
19 19
         <el-table-column
20
-          prop="phone"
20
+          prop="Phone"
21 21
           label="手机号">
22 22
         </el-table-column>
23 23
         <el-table-column
24
-          prop="nickName"
24
+          prop="CustomerName"
25 25
           label="微信昵称">
26 26
         </el-table-column>
27 27
         <el-table-column
28
-          prop="recommendName"
28
+          prop="RecommendName"
29 29
           label="推荐人">
30 30
         </el-table-column>
31 31
         <el-table-column
32
-          prop="integral"
32
+          prop="Points"
33 33
           label="积分">
34
-          <template slot-scope="scope">
35
-            -
36
-          </template>
37 34
         </el-table-column>
38 35
         <el-table-column
39
-          prop="openId"
36
+          prop="OpenId"
40 37
           label="openId">
41 38
         </el-table-column>
42
-        <el-table-column
43
-          prop="creatTime"
44
-          label="创建时间">
45
-        </el-table-column>
46 39
       </el-table>
47 40
     </div>
48 41
     <el-pagination
49
-      @size-change="handleSizeChange"
50 42
       @current-change="handleCurrentChange"
51
-      :current-page.sync="currentPage"
52
-      :page-size="10"
43
+      :current-page.sync="postData.page"
44
+      :page-size="postData.pagesize"
53 45
       layout="prev, pager, next, jumper"
54
-      :total="100">
46
+      :total="total">
55 47
     </el-pagination>
56 48
   </div>
57 49
 </template>
58 50
 
59 51
 <script>
60 52
 import tableSearch from '@/components/tableSearch/index'
61
-import { createNamespacedHelpers } from 'vuex'
62
-
63
-const { mapState: mapCaseState } = createNamespacedHelpers('case')
64 53
 
65 54
 export default {
66 55
   name: '',
67 56
   data () {
68 57
     return {
69
-      currentPage: 0, // 当前页码
70
-      tableSearch: { // 表格搜索条件
71
-        key: '', // 搜索关键字
72
-        caseId: '', // 案场id
58
+      total: 0,
59
+      postData: { // 表格搜索条件
60
+        phone: '', // 手机号
61
+        page: 1, // 当前页码
62
+        pagesize: 10, // 请求数据量
73 63
       },
74
-      tableData: [{
75
-        name: 'xxx',
76
-        phone: 'xxx',
77
-        nickName: 'xxx',
78
-        recommendName: 'xxx',
79
-        integral: 'xxx',
80
-        openId: 'xxx',
81
-        creatTime: 'xxx'
82
-      }, {
83
-        name: 'xxx',
84
-        phone: 'xxx',
85
-        nickName: 'xxx',
86
-        recommendName: 'xxx',
87
-        integral: 'xxx',
88
-        openId: 'xxx',
89
-        creatTime: 'xxx'
90
-      }, {
91
-        name: 'xxx',
92
-        phone: 'xxx',
93
-        nickName: 'xxx',
94
-        recommendName: 'xxx',
95
-        integral: 'xxx',
96
-        openId: 'xxx',
97
-        creatTime: 'xxx'
98
-      }, {
99
-        name: 'xxx',
100
-        phone: 'xxx',
101
-        nickName: 'xxx',
102
-        recommendName: 'xxx',
103
-        integral: 'xxx',
104
-        openId: 'xxx',
105
-        creatTime: 'xxx'
106
-      }]
64
+      currentList: [],
107 65
     }
108 66
   },
109
-  computed: {
110
-    ...mapCaseState({
111
-      caseList: x => x.caseList,
112
-    })
113
-  },
114 67
   components: {
115 68
     tableSearch,
116 69
   },
70
+  created () {
71
+    this.getList()
72
+  },
117 73
   methods: {
118
-    handleSizeChange (val) {
119
-      console.log(`每页 ${val} 条`)
120
-    },
121 74
     handleCurrentChange (val) {
122
-      console.log(`当前页: ${val}`)
75
+      this.getList()
123 76
     },
124
-    handleEdit (index, row) { // 编辑
125
-      console.log(index, row)
77
+    searchList (key) { // 搜索列表
78
+      this.postData.phone = key
79
+      this.postData.page = 1
80
+      this.getList()
126 81
     },
127
-    handleDelete (index, row) { // 删除
128
-      console.log(index, row)
129
-      this.$confirm('确认删除此渠道?', '提示', {
130
-        confirmButtonText: '确定',
131
-        cancelButtonText: '取消',
132
-        type: 'warning'
133
-      }).then(() => {
134
-        this.$message({
135
-          type: 'success',
136
-          message: '删除成功!'
137
-        })
138
-      }).catch(() => {
139
-        this.$message({
140
-          type: 'info',
141
-          message: '已取消删除'
142
-        })
82
+    getList () {
83
+      this.$ajax(this.$api.dataStatistics.getCustomerList.url, {
84
+        method: this.$api.dataStatistics.getCustomerList.method,
85
+        queryData: this.postData
86
+      }).then(res => {
87
+        this.currentList = res.list
88
+        this.postData.page = res.page
89
+        this.total = res.pagenum
143 90
       })
144
-    },
145
-    searchList (key) { // 搜索列表
146
-      console.log(key)
147 91
     }
148 92
   }
149 93
 }

+ 65
- 3
src/pages/system/index.vue Näytä tiedosto

@@ -3,10 +3,18 @@
3 3
     <div class="system-header flex-h">
4 4
       <i class="iconfont icon-yinchenglogo"></i>
5 5
       <span>银城-城的空间</span>
6
-      <div class="flex-item flex-h">
6
+      <div class="flex-item flex-h" style="overflow: visible;">
7 7
         <div class="flex-item"></div>
8
-        <span class="characterMark">用户角色</span>
9
-        <a class="userIcon"></a>
8
+        <span class="characterMark">{{user.UserName}}</span>
9
+        <div class="userIconBox">
10
+          <a class="userIcon">
11
+            <img :src="user.Headimgurl" class="centerLabel cover" alt="">
12
+          </a>
13
+          <ul class="userSet">
14
+            <li @click="signout">登出</li>
15
+            <li @click="editPassword">修改密码</li>
16
+          </ul>
17
+        </div>
10 18
       </div>
11 19
     </div>
12 20
     <div class="flex-item flex-h">
@@ -24,6 +32,22 @@
24 32
         </div>
25 33
       </div>
26 34
     </div>
35
+    <el-dialog title="修改密码" :visible.sync="dialogFormVisible">
36
+      <el-input
37
+        placeholder="请输入旧密码"
38
+        v-model="postData.oriPasswd"
39
+        clearable>
40
+      </el-input>
41
+      <el-input style="margin-top:20px;"
42
+        placeholder="请输入新密码"
43
+        v-model="postData.newPasswd"
44
+        clearable>
45
+      </el-input>
46
+      <div slot="footer" class="dialog-footer">
47
+        <el-button @click="dialogFormVisible = false">取 消</el-button>
48
+        <el-button type="primary" @click="submitPasswd">确 定</el-button>
49
+      </div>
50
+    </el-dialog>
27 51
   </div>
28 52
 </template>
29 53
 
@@ -36,12 +60,18 @@ export default {
36 60
   name: '',
37 61
   data () {
38 62
     return {
63
+      dialogFormVisible: false,
64
+      postData: {
65
+        oriPasswd: '', // 旧密码
66
+        newPasswd: '', // 新密码
67
+      },
39 68
     }
40 69
   },
41 70
   computed: {
42 71
     ...mapState({
43 72
       breadCrumb: x => x.app.breadcrumb,
44 73
       pageMenu: x => x.app.menus,
74
+      user: x => x.app.user,
45 75
     })
46 76
   },
47 77
   components: {
@@ -53,6 +83,38 @@ export default {
53 83
     this.updateBread({ routerData, Url: this.$route.name })
54 84
   },
55 85
   methods: {
86
+    submitPasswd () { // 修改密码
87
+      var aData = {
88
+        oriPasswd: this.md5(this.postData.oriPasswd),
89
+        newPasswd: this.md5(this.postData.newPasswd)
90
+      }
91
+      this.$ajax(this.$api.system.editPassword.url, {
92
+        method: this.$api.system.editPassword.method,
93
+        urlData: { id: this.user.UserId },
94
+        data: aData
95
+      }).then(res => {
96
+        this.$message({
97
+          type: 'success',
98
+          message: '操作成功!'
99
+        })
100
+        this.$cookie.set('accountInfo', null)
101
+        this.$router.push({ name: 'login' })
102
+      })
103
+    },
104
+    editPassword () { // 修改密码
105
+      this.dialogFormVisible = true
106
+    },
107
+    signout () { // 登出
108
+      this.$ajax(this.$api.system.signout.url, {
109
+        method: this.$api.system.signout.method,
110
+      }).then(res => {
111
+        this.$message({
112
+          type: 'success',
113
+          message: '操作成功!'
114
+        })
115
+        this.$router.push({ name: 'login' })
116
+      })
117
+    },
56 118
     ...mapMutations([
57 119
       'updateBread'
58 120
     ]),

+ 43
- 0
src/pages/system/page.scss Näytä tiedosto

@@ -58,6 +58,49 @@
58 58
     border-radius: 100%;
59 59
     background: #eee;
60 60
     margin: 0 20px 0 10px;
61
+    display: block;
62
+  }
63
+
64
+  .userIconBox{
65
+    position: relative;
66
+    overflow: visible;
67
+    .userSet{
68
+      display: none;
69
+      position: absolute;
70
+      right: 30px;
71
+      top: 40px;
72
+      background: #fff;
73
+      padding: 5px 0;
74
+      box-shadow: 0 0 20px 2px rgba(0, 0, 0, .1);
75
+      li{
76
+        display: block;
77
+        line-height: 30px;
78
+        white-space: nowrap;
79
+        color: #666;
80
+        font-size: 13px;
81
+        padding: 0 15px;
82
+        &:hover{
83
+          cursor: pointer;
84
+          background: #eee;
85
+        }
86
+      }
87
+      &::after{
88
+        content: '';
89
+        position: absolute;
90
+        width: 0;
91
+        height: 0;
92
+        border-style: dashed dashed solid dashed;
93
+        border-width: 8px;
94
+        border-color: transparent transparent #fff transparent;
95
+        right: 0;
96
+        top: -14px;
97
+      }
98
+    }
99
+    &:hover{
100
+      &>.userSet{
101
+        display: inline-block;
102
+      }
103
+    }
61 104
   }
62 105
 
63 106
 }

+ 53
- 20
src/pages/system/systemSet/roleManager/index.vue Näytä tiedosto

@@ -3,7 +3,7 @@
3 3
     <div class="system-table-search">
4 4
       <div class="flex-h">
5 5
         <div class="flex-item flex-h">
6
-          <el-button size="mini" type="success" @click='editRole'>新增角色</el-button>
6
+          <el-button size="mini" type="success" @click='addRole'>新增角色</el-button>
7 7
         </div>
8 8
         <tableSearch value='角色名称' @exportSearchKey="searchList"></tableSearch>
9 9
       </div>
@@ -35,24 +35,26 @@
35 35
     layout="prev, pager, next, jumper"
36 36
     :total="roles.pagenum">
37 37
     </el-pagination>
38
-    <!-- <el-dialog title="请选择机构" :visible.sync="dialogTableVisible">
38
+    <el-dialog title="请选择菜单" :visible.sync="dialogTableVisible">
39 39
       <el-tree
40
+        v-if="dialogTableVisible"
40 41
         class="flxe-h"
41
-        :data="treeData"
42
+        :data="menus"
43
+        node-key="id"
42 44
         :default-expand-all="true"
43
-        :expand-on-click-node="false"
45
+        :default-checked-keys="defaultChecked"
44 46
         ref="tree"
45 47
         show-checkbox
46 48
         @node-click="handleNodeClick"></el-tree>
47 49
         <div class="flex-h" style="justify-content: flex-end;margin-top: 1rem">
48 50
           <el-button type='success' @click="getCheckedNodes">确定</el-button>
49 51
         </div>
50
-    </el-dialog> -->
52
+    </el-dialog>
51 53
   </div>
52 54
 </template>
53 55
 
54 56
 <script>
55
-import { createNamespacedHelpers } from 'vuex'
57
+import { createNamespacedHelpers, mapState } from 'vuex'
56 58
 import tableSearch from '@/components/tableSearch/index'
57 59
 
58 60
 const { mapState: mapRoleState, mapActions: mapRoleActions } = createNamespacedHelpers('role')
@@ -62,17 +64,26 @@ export default {
62 64
   data () {
63 65
     return {
64 66
       currentPage: 0, // 当前页码
65
-      tableSearch: {
66
-        // 表格搜索条件
67
-        key: '111' // 搜索关键字
68
-      },
67
+      key: '',
68
+      selid: '',
69 69
       dialogTableVisible: false,
70 70
     }
71 71
   },
72 72
   computed: {
73 73
     ...mapRoleState({
74 74
       roles: x => x.roleList,
75
+      roleMenus: x => x.roleMenus,
76
+    }),
77
+    ...mapState({
78
+      menus: x => x.app.menus
75 79
     }),
80
+    defaultChecked: {
81
+      get () {
82
+        const sels = (this.roleMenus || []).map(x => x.MenuId)
83
+        console.log(sels)
84
+        return sels
85
+      },
86
+    },
76 87
   },
77 88
   components: {
78 89
     tableSearch
@@ -80,6 +91,9 @@ export default {
80 91
   methods: {
81 92
     ...mapRoleActions([
82 93
       'GetRolesList',
94
+      'DelRole',
95
+      'SaveRoleMenus',
96
+      'GetRoleMenu',
83 97
     ]),
84 98
     FormatDate (date) {
85 99
       console.log()
@@ -98,16 +112,13 @@ export default {
98 112
     handleDelete (index, row) {
99 113
       // 删除
100 114
       console.log(index, row)
101
-      this.$confirm('确认删除此用户?', '提示', {
115
+      this.$confirm('确认删除此角色?', '提示', {
102 116
         confirmButtonText: '确定',
103 117
         cancelButtonText: '取消',
104 118
         type: 'warning'
105 119
       })
106 120
         .then(() => {
107
-          this.$message({
108
-            type: 'success',
109
-            message: '删除成功!'
110
-          })
121
+          this.DelRole({id: row.RoleId, callback: this.delCallBack})
111 122
         })
112 123
         .catch(() => {
113 124
           this.$message({
@@ -116,22 +127,44 @@ export default {
116 127
           })
117 128
         })
118 129
     },
130
+    delCallBack () {
131
+      this.$message({
132
+        type: 'success',
133
+        message: '删除成功!'
134
+      })
135
+      this.GetRolesList({name: this.key})
136
+    },
119 137
     handlePermission (index, row) {
138
+      this.selid = row.RoleId
139
+      this.GetRoleMenu({id: this.selid})
120 140
       this.dialogTableVisible = true
121
-      console.log(index)
122 141
     },
123 142
     handleNodeClick (node) {
124 143
       console.log(node)
125 144
     },
126 145
     searchList (key) {
127
-      this.GetRolesList({name: key})
146
+      this.key = key
147
+      this.GetRolesList({name: this.key})
128 148
     },
129 149
     addRole () {
130
-      this.$router.push({ name: 'addRole' })
150
+      this.$router.push({ name: 'editRole' })
131 151
     },
132 152
     getCheckedNodes () { // 获取选中的节点
133
-      console.log(this.$refs.tree.getCheckedNodes())
134
-    }
153
+      const menuids = this.$refs.tree.getCheckedNodes().map(x => x.id).join(',')
154
+      console.log(menuids)
155
+      this.SaveRoleMenus({
156
+        id: this.selid,
157
+        menuids: menuids,
158
+        callback: this.hideDialog,
159
+      })
160
+    },
161
+    hideDialog () {
162
+      this.$message({
163
+        type: 'success',
164
+        message: '操作成功!'
165
+      })
166
+      this.dialogTableVisible = false
167
+    },
135 168
   },
136 169
   beforeMount () {
137 170
     this.GetRolesList()

+ 33
- 6
src/pages/system/systemSet/userManager/index.vue Näytä tiedosto

@@ -65,7 +65,7 @@
65 65
           label="创建时间"
66 66
           width="200">
67 67
         </el-table-column>
68
-        <el-table-column label="操作" fixed='right' width="300">
68
+        <el-table-column label="操作" fixed='right' width="350">
69 69
           <template slot-scope="scope">
70 70
             <el-button
71 71
               size="mini"
@@ -75,10 +75,14 @@
75 75
               size="mini"
76 76
               type="danger"
77 77
               @click="handleDelete(scope.$index, scope.row)">删除</el-button>
78
-              <el-button
79
-              size="mini"
80
-              type="success"
81
-              @click="handleBind(scope.$index, scope.row)">绑定角色</el-button>
78
+            <el-button
79
+            size="mini"
80
+            type="success"
81
+            @click="handleBind(scope.$index, scope.row)">绑定角色</el-button>
82
+            <el-button
83
+            size="mini"
84
+            type="primary"
85
+            @click="resetPasswd(scope.$index, scope.row)">重置密码</el-button>
82 86
           </template>
83 87
         </el-table-column>
84 88
       </el-table>
@@ -185,6 +189,28 @@ export default {
185 189
     this.getList()
186 190
   },
187 191
   methods: {
192
+    resetPasswd (index, row) { // 重置密码
193
+      this.$confirm('确认重置此用户密码?', '提示', {
194
+        confirmButtonText: '确定',
195
+        cancelButtonText: '取消',
196
+        type: 'warning'
197
+      }).then(() => {
198
+        this.$ajax(this.$api.systemSet.resetPassword.url, {
199
+          method: this.$api.systemSet.resetPassword.method,
200
+          data: {userid: row.UserId}
201
+        }).then(res => {
202
+          this.$message({
203
+            type: 'success',
204
+            message: '操作成功'
205
+          })
206
+        })
207
+      }).catch(() => {
208
+        this.$message({
209
+          type: 'info',
210
+          message: '已取消重置'
211
+        })
212
+      })
213
+    },
188 214
     bindRoles () { // 绑定角色
189 215
       this.$ajax(this.$api.systemSet.bindRoles.url, {
190 216
         method: this.$api.systemSet.bindRoles.method,
@@ -271,6 +297,7 @@ export default {
271 297
       }).then(res => {
272 298
         if (res !== null) this.tags = res
273 299
         this.currentEditItem = row
300
+        this.getRole()
274 301
         this.dialogTableVisible = true
275 302
       })
276 303
     },
@@ -291,7 +318,7 @@ export default {
291 318
     getRole () { // 绑定角色搜索事件,发送请求搜索角色列表
292 319
       this.$ajax(this.$api.caseManager.getRolesList.url, {
293 320
         method: this.$api.caseManager.getRolesList.method,
294
-        data: this.postData
321
+        queryData: this.postData
295 322
       }).then(res => {
296 323
         this.searchTagList = res.list
297 324
       })

+ 7
- 1
src/store/app.js Näytä tiedosto

@@ -20,6 +20,12 @@ function packChildren (data) {
20 20
   let cp = data.slice()
21 21
   const res = []
22 22
 
23
+  cp.map(x => {
24
+    x.id = x.MenuId
25
+    x.label = x.MenuName
26
+    return x
27
+  })
28
+
23 29
   data.forEach((it, inx) => {
24 30
     let found = false
25 31
     for (let i = 0; i < cp.length; i += 1) {
@@ -32,7 +38,7 @@ function packChildren (data) {
32 38
       }
33 39
     }
34 40
 
35
-    if (!found) {
41
+    if (!found && cp[inx].IsShow === 1) {
36 42
       res.push(cp[inx])
37 43
     }
38 44
   })

+ 32
- 4
src/store/system/role.js Näytä tiedosto

@@ -6,6 +6,7 @@ export default {
6 6
   state: {
7 7
     roleList: [],
8 8
     roleInfo: {},
9
+    roleMenus: [],
9 10
   },
10 11
   mutations: {
11 12
     updateList (state, payload) {
@@ -14,6 +15,9 @@ export default {
14 15
     updateInfo (state, payload) {
15 16
       state.roleInfo = payload || {}
16 17
     },
18
+    updateRoleMenus (state, payload) {
19
+      state.roleMenus = payload || {}
20
+    },
17 21
   },
18 22
   actions: {
19 23
     GetRolesList ({ commit }, payload) {
@@ -55,17 +59,41 @@ export default {
55 59
       }).then(res => {
56 60
       })
57 61
     },
58
-    DelRole ({ commit }, payload) {
62
+    DelRole ({ commit }, { id, callback }) {
59 63
       ajax(api.role.delete.url, {
60 64
         method: api.role.delete.method,
61
-        data: {
62
-          ...payload
65
+        urlData: {
66
+          id: id,
63 67
         }
64 68
       }).then(res => {
69
+        callback()
65 70
       })
66 71
     },
67 72
     SetRoleNull ({ commit }) {
68 73
       commit('updateInfo', {})
69
-    }
74
+    },
75
+    GetRoleMenu ({ commit }, payload) {
76
+      ajax(api.role.getmenus.url, {
77
+        method: api.role.getmenus.method,
78
+        urlData: {
79
+          id: payload.id,
80
+        },
81
+      }).then(res => {
82
+        commit('updateRoleMenus', res)
83
+      })
84
+    },
85
+    SaveRoleMenus ({ commit }, payload) {
86
+      ajax(api.role.savemenu.url, {
87
+        method: api.role.savemenu.method,
88
+        urlData: {
89
+          id: payload.id,
90
+        },
91
+        data: {
92
+          menuids: payload.menuids
93
+        }
94
+      }).then(res => {
95
+        payload.callback()
96
+      })
97
+    },
70 98
   }
71 99
 }

+ 40
- 2
src/util/api.js Näytä tiedosto

@@ -13,7 +13,15 @@ const $api = {
13 13
     init: { // 初始化菜单
14 14
       method: 'get',
15 15
       url: `${baseUrl}${common}/system/init`
16
-    }
16
+    },
17
+    signout: { // 登出
18
+      method: 'post',
19
+      url: `${baseUrl}${common}/signout`
20
+    },
21
+    editPassword: { // 修改密码
22
+      method: 'put',
23
+      url: `${baseUrl}${common}/user/:id/password`
24
+    },
17 25
   },
18 26
   systemSet: {
19 27
     getUserList: { // 获取用户列表
@@ -36,6 +44,10 @@ const $api = {
36 44
       method: 'delete',
37 45
       url: `${baseUrl}/common/user/:id`
38 46
     },
47
+    resetPassword: { // 重置用户密码
48
+      method: 'put',
49
+      url: `${baseUrl}/common/user/password/reset`
50
+    },
39 51
     bindRoles: { // 绑定角色
40 52
       method: 'put',
41 53
       url: `${baseUrl}/common/userrole`
@@ -48,7 +60,19 @@ const $api = {
48 60
   channelManager: {
49 61
     getChannelList: { // 渠道列表
50 62
       method: 'get',
51
-      url: `${baseUrl}${common}/`
63
+      url: `${baseUrl}${common}/channel`
64
+    },
65
+    getChannelInfo: { // 获取渠道信息
66
+      method: 'get',
67
+      url: `${baseUrl}${common}/channel/:channelId`
68
+    },
69
+    addChannel: { // 新增渠道
70
+      method: 'post',
71
+      url: `${baseUrl}${common}/channel`
72
+    },
73
+    editChannel: { // 更新渠道
74
+      method: 'put',
75
+      url: `${baseUrl}${common}/channel`
52 76
     },
53 77
   },
54 78
   caseManager: {
@@ -344,6 +368,20 @@ const $api = {
344 368
       method: 'delete',
345 369
       url: `${baseUrl}${common}/role/:id`
346 370
     },
371
+    getmenus: {
372
+      method: 'get',
373
+      url: `${baseUrl}${common}/rolemenu/:id`
374
+    },
375
+    savemenu: {
376
+      method: 'put',
377
+      url: `${baseUrl}${common}/rolemenu/:id`
378
+    },
379
+  },
380
+  dataStatistics: {
381
+    getCustomerList: { // 获取会员列表
382
+      method: 'get',
383
+      url: `${baseUrl}${common}/customer`
384
+    }
347 385
   },
348 386
 }
349 387
 export default $api