Browse Source

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

yuantianjiao 6 years ago
parent
commit
6dec0b0c1a

+ 1
- 1
src/pages/login/index.vue View File

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

+ 54
- 15
src/pages/system/channelManager/channelList/add.vue View File

3
     <form class="mainForm">
3
     <form class="mainForm">
4
       <ul>
4
       <ul>
5
         <li class="flex-h">
5
         <li class="flex-h">
6
-          <span>渠道名:</span>
6
+          <span>选择案场:</span>
7
           <div class="flex-item">
7
           <div class="flex-item">
8
             <div style="width:50%">
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
             </div>
17
             </div>
15
           </div>
18
           </div>
16
         </li>
19
         </li>
17
         <li class="flex-h">
20
         <li class="flex-h">
18
-          <span>渠道code:</span>
21
+          <span>渠道:</span>
19
           <div class="flex-item">
22
           <div class="flex-item">
20
             <div style="width:50%">
23
             <div style="width:50%">
21
               <el-input
24
               <el-input
22
-                placeholder="请输入渠道code"
23
-                v-model="postData.channelCode"
25
+                placeholder="请输入渠道"
26
+                v-model="postData.ChannelName"
24
                 clearable>
27
                 clearable>
25
               </el-input>
28
               </el-input>
26
             </div>
29
             </div>
36
 </template>
39
 </template>
37
 
40
 
38
 <script>
41
 <script>
42
+import { mapState } from 'vuex'
39
 export default {
43
 export default {
40
   name: '',
44
   name: '',
41
   data () {
45
   data () {
42
     return {
46
     return {
43
       postData: {
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
   components: {},
70
   components: {},
50
   methods: {
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
     cancel () {
93
     cancel () {
55
-      this.$router.go(-1)
94
+      this.$router.push({ name: 'channelList' })
56
     }
95
     }
57
   },
96
   },
58
-  mounted () {}
97
+  mounted () { }
59
 }
98
 }
60
 </script>
99
 </script>
61
 
100
 

+ 65
- 15
src/pages/system/channelManager/channelList/edit.vue View File

3
     <form class="mainForm">
3
     <form class="mainForm">
4
       <ul>
4
       <ul>
5
         <li class="flex-h">
5
         <li class="flex-h">
6
-          <span>渠道名:</span>
6
+          <span>选择案场:</span>
7
           <div class="flex-item">
7
           <div class="flex-item">
8
             <div style="width:50%">
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
             </div>
17
             </div>
15
           </div>
18
           </div>
16
         </li>
19
         </li>
17
         <li class="flex-h">
20
         <li class="flex-h">
18
-          <span>渠道code:</span>
21
+          <span>渠道:</span>
19
           <div class="flex-item">
22
           <div class="flex-item">
20
             <div style="width:50%">
23
             <div style="width:50%">
21
               <el-input
24
               <el-input
22
-                placeholder="请输入渠道code"
23
-                v-model="postData.channelCode"
25
+                placeholder="请输入渠道"
26
+                v-model="postData.ChannelName"
24
                 clearable>
27
                 clearable>
25
               </el-input>
28
               </el-input>
26
             </div>
29
             </div>
36
 </template>
39
 </template>
37
 
40
 
38
 <script>
41
 <script>
42
+import { mapState } from 'vuex'
39
 export default {
43
 export default {
40
   name: '',
44
   name: '',
41
   data () {
45
   data () {
42
     return {
46
     return {
43
       postData: {
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
   components: {},
73
   components: {},
50
   methods: {
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
     cancel () {
104
     cancel () {
55
-      this.$router.go(-1)
105
+      this.$router.push({ name: 'channelList' })
56
     }
106
     }
57
   },
107
   },
58
-  mounted () {}
108
+  mounted () { }
59
 }
109
 }
60
 </script>
110
 </script>
61
 
111
 

+ 12
- 15
src/pages/system/channelManager/channelList/index.vue View File

26
     </div>
26
     </div>
27
     <div class="system-table-box">
27
     <div class="system-table-box">
28
       <el-table
28
       <el-table
29
-        :data="tableData"
29
+        :data="currentList"
30
         stripe
30
         stripe
31
         style="width: 100%">
31
         style="width: 100%">
32
         <el-table-column
32
         <el-table-column
33
-          prop="channelName"
34
-          label="渠道名">
33
+          prop="CaseName"
34
+          label="案场">
35
         </el-table-column>
35
         </el-table-column>
36
         <el-table-column
36
         <el-table-column
37
-          prop="channelCode"
38
-          label="渠道code">
37
+          prop="ChannelName"
38
+          label="渠道名称">
39
         </el-table-column>
39
         </el-table-column>
40
         <el-table-column label="操作">
40
         <el-table-column label="操作">
41
           <template slot-scope="scope">
41
           <template slot-scope="scope">
70
     return {
70
     return {
71
       total: 0,
71
       total: 0,
72
       postData: { // 表格搜索条件
72
       postData: { // 表格搜索条件
73
-        CaseId: '', // 案场id
73
+        caseid: '', // 案场id
74
         page: 1, // 当前页码
74
         page: 1, // 当前页码
75
         pagesize: 10, // 请求数据量
75
         pagesize: 10, // 请求数据量
76
       },
76
       },
87
     }),
87
     }),
88
     CaseId: {
88
     CaseId: {
89
       get () {
89
       get () {
90
-        return this.postData.CaseId || this.defaultCaseId
90
+        return this.postData.caseid || this.defaultCaseId
91
       },
91
       },
92
       set (val) {
92
       set (val) {
93
-        this.postData.CaseId = val
93
+        this.postData.caseid = val
94
       }
94
       }
95
     }
95
     }
96
   },
96
   },
101
       this.getList()
101
       this.getList()
102
     },
102
     },
103
     getList () { // 获取列表
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
       }).then(res => {
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
         this.currentList = res.list
108
         this.currentList = res.list
112
         this.postData.page = res.page
109
         this.postData.page = res.page
113
         this.total = res.pagenum
110
         this.total = res.pagenum
117
       this.getList()
114
       this.getList()
118
     },
115
     },
119
     handleEdit (index, row) { // 编辑
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
     handleDelete (index, row) { // 删除
119
     handleDelete (index, row) { // 删除
123
       let name = '确认删除规格“' + row.TypeName + '”?'
120
       let name = '确认删除规格“' + row.TypeName + '”?'

+ 33
- 89
src/pages/system/dataStatistics/frontEndUserList/index.vue View File

3
     <div class="system-table-search">
3
     <div class="system-table-search">
4
       <div class="flex-h">
4
       <div class="flex-h">
5
         <div class="flex-item flex-h"></div>
5
         <div class="flex-item flex-h"></div>
6
-        <tableSearch value="请输入用户名称" @exportSearchKey="searchList"></tableSearch>
6
+        <tableSearch value="请输入用户手机号" @exportSearchKey="searchList"></tableSearch>
7
       </div>
7
       </div>
8
       <div class="moreFilter"></div>
8
       <div class="moreFilter"></div>
9
     </div>
9
     </div>
10
     <div class="system-table-box">
10
     <div class="system-table-box">
11
       <el-table
11
       <el-table
12
-        :data="tableData"
12
+        :data="currentList"
13
         stripe
13
         stripe
14
         style="width: 100%">
14
         style="width: 100%">
15
         <el-table-column
15
         <el-table-column
16
-          prop="name"
16
+          prop="Name"
17
           label="姓名">
17
           label="姓名">
18
         </el-table-column>
18
         </el-table-column>
19
         <el-table-column
19
         <el-table-column
20
-          prop="phone"
20
+          prop="Phone"
21
           label="手机号">
21
           label="手机号">
22
         </el-table-column>
22
         </el-table-column>
23
         <el-table-column
23
         <el-table-column
24
-          prop="nickName"
24
+          prop="CustomerName"
25
           label="微信昵称">
25
           label="微信昵称">
26
         </el-table-column>
26
         </el-table-column>
27
         <el-table-column
27
         <el-table-column
28
-          prop="recommendName"
28
+          prop="RecommendName"
29
           label="推荐人">
29
           label="推荐人">
30
         </el-table-column>
30
         </el-table-column>
31
         <el-table-column
31
         <el-table-column
32
-          prop="integral"
32
+          prop="Points"
33
           label="积分">
33
           label="积分">
34
-          <template slot-scope="scope">
35
-            -
36
-          </template>
37
         </el-table-column>
34
         </el-table-column>
38
         <el-table-column
35
         <el-table-column
39
-          prop="openId"
36
+          prop="OpenId"
40
           label="openId">
37
           label="openId">
41
         </el-table-column>
38
         </el-table-column>
42
-        <el-table-column
43
-          prop="creatTime"
44
-          label="创建时间">
45
-        </el-table-column>
46
       </el-table>
39
       </el-table>
47
     </div>
40
     </div>
48
     <el-pagination
41
     <el-pagination
49
-      @size-change="handleSizeChange"
50
       @current-change="handleCurrentChange"
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
       layout="prev, pager, next, jumper"
45
       layout="prev, pager, next, jumper"
54
-      :total="100">
46
+      :total="total">
55
     </el-pagination>
47
     </el-pagination>
56
   </div>
48
   </div>
57
 </template>
49
 </template>
58
 
50
 
59
 <script>
51
 <script>
60
 import tableSearch from '@/components/tableSearch/index'
52
 import tableSearch from '@/components/tableSearch/index'
61
-import { createNamespacedHelpers } from 'vuex'
62
-
63
-const { mapState: mapCaseState } = createNamespacedHelpers('case')
64
 
53
 
65
 export default {
54
 export default {
66
   name: '',
55
   name: '',
67
   data () {
56
   data () {
68
     return {
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
   components: {
67
   components: {
115
     tableSearch,
68
     tableSearch,
116
   },
69
   },
70
+  created () {
71
+    this.getList()
72
+  },
117
   methods: {
73
   methods: {
118
-    handleSizeChange (val) {
119
-      console.log(`每页 ${val} 条`)
120
-    },
121
     handleCurrentChange (val) {
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 View File

3
     <div class="system-header flex-h">
3
     <div class="system-header flex-h">
4
       <i class="iconfont icon-yinchenglogo"></i>
4
       <i class="iconfont icon-yinchenglogo"></i>
5
       <span>银城-城的空间</span>
5
       <span>银城-城的空间</span>
6
-      <div class="flex-item flex-h">
6
+      <div class="flex-item flex-h" style="overflow: visible;">
7
         <div class="flex-item"></div>
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
       </div>
18
       </div>
11
     </div>
19
     </div>
12
     <div class="flex-item flex-h">
20
     <div class="flex-item flex-h">
24
         </div>
32
         </div>
25
       </div>
33
       </div>
26
     </div>
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
   </div>
51
   </div>
28
 </template>
52
 </template>
29
 
53
 
36
   name: '',
60
   name: '',
37
   data () {
61
   data () {
38
     return {
62
     return {
63
+      dialogFormVisible: false,
64
+      postData: {
65
+        oriPasswd: '', // 旧密码
66
+        newPasswd: '', // 新密码
67
+      },
39
     }
68
     }
40
   },
69
   },
41
   computed: {
70
   computed: {
42
     ...mapState({
71
     ...mapState({
43
       breadCrumb: x => x.app.breadcrumb,
72
       breadCrumb: x => x.app.breadcrumb,
44
       pageMenu: x => x.app.menus,
73
       pageMenu: x => x.app.menus,
74
+      user: x => x.app.user,
45
     })
75
     })
46
   },
76
   },
47
   components: {
77
   components: {
53
     this.updateBread({ routerData, Url: this.$route.name })
83
     this.updateBread({ routerData, Url: this.$route.name })
54
   },
84
   },
55
   methods: {
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
     ...mapMutations([
118
     ...mapMutations([
57
       'updateBread'
119
       'updateBread'
58
     ]),
120
     ]),

+ 43
- 0
src/pages/system/page.scss View File

58
     border-radius: 100%;
58
     border-radius: 100%;
59
     background: #eee;
59
     background: #eee;
60
     margin: 0 20px 0 10px;
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 View File

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

+ 33
- 6
src/pages/system/systemSet/userManager/index.vue View File

65
           label="创建时间"
65
           label="创建时间"
66
           width="200">
66
           width="200">
67
         </el-table-column>
67
         </el-table-column>
68
-        <el-table-column label="操作" fixed='right' width="300">
68
+        <el-table-column label="操作" fixed='right' width="350">
69
           <template slot-scope="scope">
69
           <template slot-scope="scope">
70
             <el-button
70
             <el-button
71
               size="mini"
71
               size="mini"
75
               size="mini"
75
               size="mini"
76
               type="danger"
76
               type="danger"
77
               @click="handleDelete(scope.$index, scope.row)">删除</el-button>
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
           </template>
86
           </template>
83
         </el-table-column>
87
         </el-table-column>
84
       </el-table>
88
       </el-table>
185
     this.getList()
189
     this.getList()
186
   },
190
   },
187
   methods: {
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
     bindRoles () { // 绑定角色
214
     bindRoles () { // 绑定角色
189
       this.$ajax(this.$api.systemSet.bindRoles.url, {
215
       this.$ajax(this.$api.systemSet.bindRoles.url, {
190
         method: this.$api.systemSet.bindRoles.method,
216
         method: this.$api.systemSet.bindRoles.method,
271
       }).then(res => {
297
       }).then(res => {
272
         if (res !== null) this.tags = res
298
         if (res !== null) this.tags = res
273
         this.currentEditItem = row
299
         this.currentEditItem = row
300
+        this.getRole()
274
         this.dialogTableVisible = true
301
         this.dialogTableVisible = true
275
       })
302
       })
276
     },
303
     },
291
     getRole () { // 绑定角色搜索事件,发送请求搜索角色列表
318
     getRole () { // 绑定角色搜索事件,发送请求搜索角色列表
292
       this.$ajax(this.$api.caseManager.getRolesList.url, {
319
       this.$ajax(this.$api.caseManager.getRolesList.url, {
293
         method: this.$api.caseManager.getRolesList.method,
320
         method: this.$api.caseManager.getRolesList.method,
294
-        data: this.postData
321
+        queryData: this.postData
295
       }).then(res => {
322
       }).then(res => {
296
         this.searchTagList = res.list
323
         this.searchTagList = res.list
297
       })
324
       })

+ 7
- 1
src/store/app.js View File

20
   let cp = data.slice()
20
   let cp = data.slice()
21
   const res = []
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
   data.forEach((it, inx) => {
29
   data.forEach((it, inx) => {
24
     let found = false
30
     let found = false
25
     for (let i = 0; i < cp.length; i += 1) {
31
     for (let i = 0; i < cp.length; i += 1) {
32
       }
38
       }
33
     }
39
     }
34
 
40
 
35
-    if (!found) {
41
+    if (!found && cp[inx].IsShow === 1) {
36
       res.push(cp[inx])
42
       res.push(cp[inx])
37
     }
43
     }
38
   })
44
   })

+ 32
- 4
src/store/system/role.js View File

6
   state: {
6
   state: {
7
     roleList: [],
7
     roleList: [],
8
     roleInfo: {},
8
     roleInfo: {},
9
+    roleMenus: [],
9
   },
10
   },
10
   mutations: {
11
   mutations: {
11
     updateList (state, payload) {
12
     updateList (state, payload) {
14
     updateInfo (state, payload) {
15
     updateInfo (state, payload) {
15
       state.roleInfo = payload || {}
16
       state.roleInfo = payload || {}
16
     },
17
     },
18
+    updateRoleMenus (state, payload) {
19
+      state.roleMenus = payload || {}
20
+    },
17
   },
21
   },
18
   actions: {
22
   actions: {
19
     GetRolesList ({ commit }, payload) {
23
     GetRolesList ({ commit }, payload) {
55
       }).then(res => {
59
       }).then(res => {
56
       })
60
       })
57
     },
61
     },
58
-    DelRole ({ commit }, payload) {
62
+    DelRole ({ commit }, { id, callback }) {
59
       ajax(api.role.delete.url, {
63
       ajax(api.role.delete.url, {
60
         method: api.role.delete.method,
64
         method: api.role.delete.method,
61
-        data: {
62
-          ...payload
65
+        urlData: {
66
+          id: id,
63
         }
67
         }
64
       }).then(res => {
68
       }).then(res => {
69
+        callback()
65
       })
70
       })
66
     },
71
     },
67
     SetRoleNull ({ commit }) {
72
     SetRoleNull ({ commit }) {
68
       commit('updateInfo', {})
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 View File

13
     init: { // 初始化菜单
13
     init: { // 初始化菜单
14
       method: 'get',
14
       method: 'get',
15
       url: `${baseUrl}${common}/system/init`
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
   systemSet: {
26
   systemSet: {
19
     getUserList: { // 获取用户列表
27
     getUserList: { // 获取用户列表
36
       method: 'delete',
44
       method: 'delete',
37
       url: `${baseUrl}/common/user/:id`
45
       url: `${baseUrl}/common/user/:id`
38
     },
46
     },
47
+    resetPassword: { // 重置用户密码
48
+      method: 'put',
49
+      url: `${baseUrl}/common/user/password/reset`
50
+    },
39
     bindRoles: { // 绑定角色
51
     bindRoles: { // 绑定角色
40
       method: 'put',
52
       method: 'put',
41
       url: `${baseUrl}/common/userrole`
53
       url: `${baseUrl}/common/userrole`
48
   channelManager: {
60
   channelManager: {
49
     getChannelList: { // 渠道列表
61
     getChannelList: { // 渠道列表
50
       method: 'get',
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
   caseManager: {
78
   caseManager: {
344
       method: 'delete',
368
       method: 'delete',
345
       url: `${baseUrl}${common}/role/:id`
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
 export default $api
387
 export default $api