Selaa lähdekoodia

fix:权限+其他优化

zhangxin 1 kuukausi sitten
vanhempi
commit
e181cd0eb6

+ 10 - 30
pages/setting/index.vue

@@ -73,46 +73,26 @@
73 73
 			handleSwitchRole(){
74 74
 					this.columns = [];
75 75
 					let roles = this.$store.state.user.availableRoles;
76
+					console.log(roles);
77
+					
76 78
 					let roleOptions = [];
77
-					const hasAdminRole = roles.some(role => role == 'admin');
79
+					
80
+					const hasAdminRole = roles.some(role => role.includes('admin'));
78 81
 					const hasCrmRole = roles.some(role => role.includes('CRM'));
79
-					const hasWarehouser = roles.some(role => role == 'WAREHOUSER');
80
-					const hasSalesman = roles.some(role => role == 'SALESMAN');
81
-
82
-					if(hasAdminRole){
83
-						roleOptions.push(
84
-							{ label: 'CRM权限', value: 'CRM' },
85
-							{ label: '仓库权限', value: 'WAREHOUSER' },
86
-							{ label: '销售权限', value: 'SALESMAN' },
87
-						);
88
-					}else if(hasWarehouser && hasSalesman && hasCrmRole){
89
-						roleOptions.push(
90
-							{ label: 'CRM权限', value: 'CRM' },
91
-							{ label: '仓库权限', value: 'WAREHOUSER' },
92
-							{ label: '销售权限', value: 'SALESMAN' }
93
-						);
94
-					}else if(hasCrmRole && hasWarehouser){
82
+					const hasWAREandSALE = roles.some(role => role.includes('WAREandSALE'));
83
+					if(hasAdminRole || (hasCrmRole && hasWAREandSALE) ){//管理员、crm+仓库、crm+销售、仓库+销售
95 84
 						roleOptions.push(
96 85
 							{ label: 'CRM权限', value: 'CRM' },
97
-							{ label: '仓库权限', value: 'WAREHOUSER' }
86
+							{ label: '仓库和销售权限', value: 'WAREandSALE' },
98 87
 						);
99
-					}else if(hasCrmRole && hasSalesman){
88
+					}else if(hasCrmRole){//只有crm	
100 89
 						roleOptions.push(
101 90
 							{ label: 'CRM权限', value: 'CRM' },
102
-							{ label: '仓库权限', value: 'WAREHOUSER' },
103
-							{ label: '销售权限', value: 'SALESMAN' }
104 91
 						);
105
-					}else if(hasWarehouser && hasSalesman){
92
+					}else if(hasWarehouser || hasSalesman){//只有仓库或销售
106 93
 						roleOptions.push(
107
-							{ label: '仓库权限', value: 'WAREHOUSER' },
108
-							{ label: '销售权限', value: 'SALESMAN' }
94
+							{ label: '仓库和销售权限', value: 'WAREandSALE' },
109 95
 						);
110
-					}else if(hasCrmRole){
111
-						roleOptions.push({ label: 'CRM权限', value: 'CRM' });
112
-					}else if(hasWarehouser){
113
-						roleOptions.push({ label: '仓库权限', value: 'WAREHOUSER' });
114
-					}else if(hasSalesman){
115
-						roleOptions.push({ label: '销售权限', value: 'SALESMAN' },{ label: '仓库权限', value: 'WAREHOUSER' });
116 96
 					}
117 97
 					
118 98
 					this.columns = [roleOptions];

+ 2 - 2
pages/wareHouse/components/edit.vue

@@ -426,7 +426,7 @@ export default {
426 426
 实价:${res.data.actualPrice || '-'}
427 427
 型号:${res.data.model || '-'}
428 428
 编码:${res.data.indentifyCode || '-'}
429
-日期:${res.data.recycleTime || '-'}
429
+日期:${res.data.cardYear || '-'}
430 430
 备注:${res.data.productDesc || '-'}
431 431
 付款方式:${this.paymentTabList.find(item => item.value == res.data.payType)?.name || '-'}
432 432
 `
@@ -798,7 +798,7 @@ export default {
798 798
                     this.formData.indentifyCode = result['编码'];
799 799
                 }
800 800
                 if (result['日期']) {
801
-                    this.formData.recycleTime = result['日期'];
801
+                    this.formData.cardYear = result['日期'];
802 802
                 }
803 803
                 if (result['备注']) {
804 804
                     this.formData.productDesc = result['备注'];

+ 35 - 38
pages/wareHouse/components/fakeRegistration.vue

@@ -12,30 +12,29 @@
12 12
             v-for="(item, index) in tableData" 
13 13
             :key="item.id || index"
14 14
             :class="{ 'selected': selectedIndex === index }"
15
-            @click="handleItemClick(index, item)"
15
+            @click="handleSwipeClick(item, index)"
16 16
             >
17
-            <u-swipe-action ref="swipeRef">
18
-              <u-swipe-action-item :options="swipeOptions" @click="(e) => handleSwipeClick(item, e, index)">
19
-                <view class="item_header">
20
-                  <view class="name">{{ item.name }}</view>
21
-                  <view class="phone">{{ item.phone }}</view>
17
+              <view class="item_header">
18
+                <view class="name">{{ item.name }}</view>
19
+              </view>
20
+              <view class="item_body">
21
+                <view class="info_item">
22
+                  <view class="label">手机号:</view>
23
+                  <view class="value">{{ item.phone }}</view>
22 24
                 </view>
23
-                <view class="item_body">
24
-                  <view class="info_item">
25
-                    <view class="label">身份证号:</view>
26
-                    <view class="value">{{ item.idCard }}</view>
27
-                  </view>
28
-                  <view class="info_item">
29
-                    <view class="label">物品:</view>
30
-                    <view class="value">{{ item.itemName }}</view>
31
-                  </view>
32
-                  <view class="info_item" v-if="item.remark">
33
-                    <view class="label">备注:</view>
34
-                    <view class="value">{{ item.remark }}</view>
35
-                  </view>
25
+                <view class="info_item">
26
+                  <view class="label">身份证号:</view>
27
+                  <view class="value">{{ item.idCard }}</view>
36 28
                 </view>
37
-              </u-swipe-action-item>
38
-            </u-swipe-action>
29
+                <view class="info_item">
30
+                  <view class="label">物品:</view>
31
+                  <view class="value">{{ item.itemName }}</view>
32
+                </view>
33
+                <view class="info_item" v-if="item.remark">
34
+                  <view class="label">备注:</view>
35
+                  <view class="value">{{ item.remark }}</view>
36
+                </view>
37
+              </view>
39 38
           </view>
40 39
         <u-loadmore :status="loadStatus" :loading-text="'加载中...'" :finished-text="'没有更多了'" @loadmore="handleLoadMore"></u-loadmore>
41 40
       </view>
@@ -70,6 +69,7 @@
70 69
 </template>
71 70
 
72 71
 <script>
72
+import { permissionCheck } from '../../../utils/util.js'
73 73
 export default {
74 74
   name: 'FakeRegistration',
75 75
   data() {
@@ -141,6 +141,7 @@ export default {
141 141
       })
142 142
     },
143 143
     handleAdd() {
144
+      if(!permissionCheck('WAREHOUSER')) return false
144 145
       this.isAdd = true
145 146
       this.currentEditItem = null
146 147
       this.formData = {
@@ -156,25 +157,22 @@ export default {
156 157
     handleItemClick(index, item) {
157 158
       this.selectedIndex = index;
158 159
     },
159
-    handleSwipeClick(item, e, index) {
160
-      if(e.index == 0){//编辑
161
-        setTimeout(() => {
162
-          this.selectedIndex = index;
163
-          this.isAdd = false
164
-          this.currentEditItem = item
165
-          this.formData = {
166
-            id: item.id,
167
-            name: item.name,
168
-            idCard: item.idCard,
169
-            phone: item.phone,
170
-            itemName: item.itemName,
171
-            remark: item.remark || ''
172
-          }
173
-          this.showEditDialog = true
174
-        }, 300);
160
+    handleSwipeClick(item,index) {
161
+      this.selectedIndex = index;
162
+      this.isAdd = false
163
+      this.currentEditItem = item
164
+      this.formData = {
165
+        id: item.id,
166
+        name: item.name,
167
+        idCard: item.idCard,
168
+        phone: item.phone,
169
+        itemName: item.itemName,
170
+        remark: item.remark || ''
175 171
       }
172
+      this.showEditDialog = true
176 173
     },
177 174
     handleSubmit() {
175
+      if(!permissionCheck('WAREHOUSER')) return false
178 176
       this.$refs.formRef.validate().then(() => {
179 177
         if (this.isAdd) {
180 178
           uni.$u.api.wareHouseFakeAdd(this.formData).then(res => {
@@ -189,7 +187,6 @@ export default {
189 187
           uni.$u.api.wareHouseFakeEdit(this.formData).then(res => {
190 188
             if (res.code == 200) {
191 189
               uni.$u.toast('编辑成功')
192
-              this.$refs.swipeRef[this.selectedIndex].closeOther()
193 190
               this.showEditDialog = false
194 191
               this.getWareHouseFakeList()
195 192
             }

+ 1 - 0
pages/wareHouse/index.vue

@@ -310,6 +310,7 @@ export default {
310 310
 		handleSwipeClick(e, item,goodsIndex) {
311 311
 			if (e.index == 0) {//删除
312 312
 				this.isSwipeClick = true;
313
+				if(!permissionCheck('WAREHOUSER')) return false 
313 314
 				uni.$u.api.wareHouseDelete({
314 315
 					id: item.id
315 316
 				}).then(() => {

+ 1 - 14
pages/wareHouse/styles/fakeRegistration.scss

@@ -20,6 +20,7 @@
20 20
 
21 21
                 &.selected {
22 22
                     box-shadow: 0 12rpx 32rpx rgba(71, 130, 241, 0.2);
23
+                    transform: scale(1.02);
23 24
                     border-color: #4782f1;
24 25
                     border-width: 2rpx;
25 26
                 }
@@ -36,20 +37,6 @@
36 37
                         font-size: 32rpx;
37 38
                         font-weight: 700;
38 39
                         color: #212529;
39
-                        position: relative;
40
-                        padding-left: 20rpx;
41
-
42
-                        &::before {
43
-                            content: '';
44
-                            position: absolute;
45
-                            left: 0;
46
-                            top: 50%;
47
-                            transform: translateY(-50%);
48
-                            width: 8rpx;
49
-                            height: 8rpx;
50
-                            border-radius: 50%;
51
-                            background-color: #4782f1;
52
-                        }
53 40
                     }
54 41
 
55 42
                     .phone {

+ 26 - 50
store/modules/user.js

@@ -29,7 +29,7 @@ export default {
29 29
 		netConfig: {
30 30
 			// http://59.42.9.166:9520/proxy
31 31
 			// http://10.0.7.100:9500
32
-			ip: "https://crm.nanjingshiyu.com/prod-api", // ip
32
+			ip: "https://crm.nanjingshiyu.com/prod-api/", // ip
33 33
 			// ip: "https://crmtest.nanjingshiyu.com/prod-api", // 测试环境ip
34 34
 			// ip : "/api", // 测试环境ip
35 35
 			// ip : "http://47.113.184.101", // 测试环境ip
@@ -65,41 +65,21 @@ export default {
65 65
 			const hasWarehouser = roles.some(role => role.roleKey === 'WAREHOUSER');
66 66
 			const hasSalesman = roles.some(role => role.roleKey === 'SALESMAN');
67 67
 
68
-			if (hasAdminRole) {//管理员
69
-				if (hasCrmRole) validRoles.push('CRM');
70
-				if (hasWarehouser) validRoles.push('WAREHOUSER');
71
-				if (hasSalesman) validRoles.push('SALESMAN');
68
+			if(hasAdminRole){//管理员
72 69
 				validRoles.push('admin');
73 70
 				state.showRoleSwitch = true;
74
-			} else if(hasWarehouser && hasSalesman && hasCrmRole) {//仓库和销售和crm
75
-				validRoles.push('CRM');
76
-				validRoles.push('WAREHOUSER');
77
-				validRoles.push('SALESMAN');
78
-				state.showRoleSwitch = true;
79
-			} else if (hasCrmRole && hasWarehouser) {//crm和仓库
80
-				validRoles.push('CRM');
81
-				validRoles.push('WAREHOUSER');
71
+			}else if( (hasCrmRole && hasWarehouser) || (hasCrmRole && hasSalesman)){//crm+仓库、crm+销售
72
+				validRoles.push('CRM','WAREandSALE');
82 73
 				state.showRoleSwitch = true;
83
-			} else if ((hasCrmRole && hasSalesman)) {//crm和销售
84
-				validRoles.push('CRM');
85
-				validRoles.push('WAREHOUSER');
86
-				validRoles.push('SALESMAN');
87
-				state.showRoleSwitch = true;
88
-			}else if(hasWarehouser && hasSalesman) {//只有仓库和销售
89
-				validRoles.push('WAREHOUSER');
90
-				validRoles.push('SALESMAN');
91
-				state.showRoleSwitch = true;
92
-			}
93
-			else if (hasCrmRole) {//只有crm
74
+			}else if(hasWarehouser && hasSalesman){
75
+				validRoles.push('WAREandSALE');
76
+				state.showRoleSwitch = false;
77
+			}else if(hasCrmRole){//只有crm
94 78
 				validRoles.push('CRM');
95 79
 				state.showRoleSwitch = false;
96
-			} else if(hasWarehouser){//只有仓库
97
-				validRoles.push('WAREHOUSER');
80
+			}else if(hasWarehouser || hasSalesman){//只有仓库或销售
81
+				validRoles.push('WAREandSALE');
98 82
 				state.showRoleSwitch = false;
99
-			}else if (hasSalesman) {//只有销售
100
-				if (hasWarehouser) validRoles.push('WAREHOUSER');
101
-				if (hasSalesman) validRoles.push('SALESMAN');
102
-				state.showRoleSwitch = true;
103 83
 			}
104 84
 
105 85
 			state.availableRoles = validRoles;
@@ -110,18 +90,20 @@ export default {
110 90
 				allIndices.forEach(index => {
111 91
 					uni.setTabBarItem({ index, visible: false });
112 92
 				});
113
-				
114 93
 				const currentRole = validRoles[0] || '';
115
-				
116 94
 				switch (currentRole) {
117
-					case 'SALESMAN':
118
-						// 展示核价中心、询价中心、我的
119
-						uni.setTabBarItem({ index: 3, visible: true }); // 询价中心
120
-						uni.setTabBarItem({ index: 4, visible: true }); // 核价中心
95
+					case 'admin':
96
+						// 展示首页、线索公海、销售线索、接单中心、我的
97
+						uni.setTabBarItem({ index: 0, visible: true }); // 首页
98
+						uni.setTabBarItem({ index: 1, visible: true }); // 线索公海
99
+						uni.setTabBarItem({ index: 5, visible: true }); // 销售线索
100
+						uni.setTabBarItem({ index: 6, visible: true }); // 接单中心
121 101
 						break;
122
-					case 'WAREHOUSER':
123
-						// 展示仓库中心、我的
102
+					case 'WAREandSALE':
103
+						// 展示仓库、核价中心、询价中心、我的
124 104
 						uni.setTabBarItem({ index: 2, visible: true }); // 仓库
105
+						uni.setTabBarItem({ index: 3, visible: true }); // 询价中心
106
+						uni.setTabBarItem({ index: 4, visible: true }); // 核价中心
125 107
 						break;
126 108
 					case 'CRM':
127 109
 						// 展示首页、线索公海、销售线索、接单中心、我的
@@ -198,15 +180,12 @@ export default {
198 180
 					uni.setTabBarItem({ index, visible: false });
199 181
 				});
200 182
 				switch (role.value) {
201
-					case 'SALESMAN':
202
-						// 展示核价中心、询价中心、我的
183
+					case 'WAREandSALE':
184
+						// 展示仓库、核价中心、询价中心、我的
185
+						uni.setTabBarItem({ index: 2, visible: true }); // 仓库
203 186
 						uni.setTabBarItem({ index: 3, visible: true }); // 询价中心
204 187
 						uni.setTabBarItem({ index: 4, visible: true }); // 核价中心
205 188
 						break;
206
-					case 'WAREHOUSER':
207
-						// 展示仓库中心、我的
208
-						uni.setTabBarItem({ index: 2, visible: true }); // 仓库
209
-						break;
210 189
 					case 'CRM':
211 190
 						// 展示首页、线索公海、销售线索、接单中心、我的
212 191
 						uni.setTabBarItem({ index: 0, visible: true }); // 首页
@@ -308,15 +287,12 @@ export function setupTabBar(userInfo, availableRoles, currentRoleIndex) {
308 287
 		
309 288
 		// 根据当前角色显示对应的tabbar
310 289
 		switch (currentRole) {
311
-			case 'SALESMAN':
312
-				// 展示核价中心、询价中心、我的
290
+			case 'WAREandSALE':
291
+				// 展示仓库、核价中心、询价中心、我的
292
+				uni.setTabBarItem({ index: 2, visible: true }); // 仓库
313 293
 				uni.setTabBarItem({ index: 3, visible: true }); // 询价中心
314 294
 				uni.setTabBarItem({ index: 4, visible: true }); // 核价中心
315 295
 				break;
316
-			case 'WAREHOUSER':
317
-				// 展示仓库中心、我的
318
-				uni.setTabBarItem({ index: 2, visible: true }); // 仓库
319
-				break;
320 296
 			case 'CRM':
321 297
 				// 展示首页、线索公海、销售线索、接单中心、我的
322 298
 				uni.setTabBarItem({ index: 0, visible: true }); // 首页