Explorar el Código

feat:1.权限挪到我的页面 2.组织架构放到仓库列表页 3.用户退出软件在本地存储当前tab 4.版本1.3.3

zhangxin hace 1 mes
padre
commit
ea57cd15b1

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
2 2
     "name" : "小葫芦",
3 3
     "appid" : "__UNI__DDAE2E0",
4 4
     "description" : "",
5
-    "versionName" : "1.3.2",
6
-    "versionCode" : 132,
5
+    "versionName" : "1.3.3",
6
+    "versionCode" : 133,
7 7
     "transformPx" : false,
8 8
     "app-plus" : {
9 9
         "webView" : {

+ 43 - 0
pages/person/index.vue

@@ -21,6 +21,8 @@
21 21
 								<u-switch v-model="onlineStatus" active-value='0' inactive-value='1'
22 22
 									:loading="onlineLoading" @change="changeOnlineStatus"></u-switch>
23 23
 								<text class="identity">{{ onlineStatus === '0' ? '上线' : '下线' }}</text>
24
+								<!-- 只有当showRoleSwitch为true时才显示切换权限按钮 -->
25
+								<view class="identity" v-if="$store.state.user.showRoleSwitch" @click="handleSwitchRole">切换权限</view>
24 26
 							</view>
25 27
 							<view class="info_bottom">
26 28
 								<text>{{ userInfo.phonenumber }}</text>
@@ -60,6 +62,7 @@
60 62
 			</view>
61 63
 		</template>
62 64
 		<u-loading-page :loading="true" v-else></u-loading-page>
65
+		<u-picker :show="showSwitchRole" :columns="columns" keyName="label" :defaultIndex="defaultIndex" @confirm="confirmSwitchRole" @cancel="showSwitchRole = false"></u-picker>
63 66
 	</view>
64 67
 </template>
65 68
 
@@ -80,6 +83,13 @@ export default {
80 83
 			navbarInitTop: 0, //导航栏初始化距顶部的距离
81 84
 			isFixedTop: true, //是否固定顶部
82 85
 			background: "", // 为了实现渐变背景颜色
86
+			showModal: false,
87
+			showSwitchRole: false,
88
+			columns: [],
89
+			defaultIndex: [this.$store.state.user.currentRoleIndex],
90
+			isHaveCRM: false,
91
+			isHaveSalesman: false,
92
+			isHaveWarehouse: false,
83 93
 		};
84 94
 	},
85 95
 	computed: {
@@ -155,6 +165,39 @@ export default {
155 165
 		},
156 166
 	},
157 167
 	methods: {
168
+		handleSwitchRole(){
169
+			this.columns = [];
170
+			let roles = this.$store.state.user.availableRoles;
171
+			let roleOptions = [];
172
+			
173
+			const hasAdminRole = roles.some(role => role.includes('admin'));
174
+			const hasCrmRole = roles.some(role => role.includes('CRM'));
175
+			const hasWAREandSALE = roles.some(role => role.includes('WAREandSALE'));
176
+			if(hasAdminRole || (hasCrmRole && hasWAREandSALE) ){//管理员、crm+仓库、crm+销售、仓库+销售
177
+				roleOptions.push(
178
+					{ label: 'CRM权限', value: 'CRM' },
179
+					{ label: '仓库和销售权限', value: 'WAREandSALE' },
180
+				);
181
+			}else if(hasCrmRole){//只有crm	
182
+				roleOptions.push(
183
+					{ label: 'CRM权限', value: 'CRM' },
184
+				);
185
+			}else if(hasWAREandSALE){//只有仓库或销售
186
+				roleOptions.push(
187
+					{ label: '仓库和销售权限', value: 'WAREandSALE' },
188
+				);
189
+			}
190
+			
191
+			this.columns = [roleOptions];
192
+			this.showSwitchRole = true;
193
+		},
194
+		confirmSwitchRole(e) {
195
+			this.showSwitchRole = false;
196
+			this.$store.commit('user/SET_CURRENT_ROLE_INDEX', e.indexs[0]);
197
+			setTimeout(()=>{
198
+				this.$store.commit('user/SWITCH_ROLE', e.value[0]);
199
+			},50)
200
+		},
158 201
 		changeOnlineStatus(val) {
159 202
 			this.onlineLoading = true;
160 203
 			uni.$u.api.changeOnlineStatus({ userId: this.$store.state.user.userInfo.userId, onlineStatus: val });

+ 4 - 57
pages/setting/index.vue

@@ -2,16 +2,6 @@
2 2
 	<view class="setting_wrap">
3 3
 		<u-navbar title="我的设置" :autoBack="true" :placeholder="true" v-hideNav></u-navbar>
4 4
 		<view class="option_list">
5
-			<!-- 只有当showRoleSwitch为true时才显示切换权限按钮 -->
6
-			<view v-if="$store.state.user.showRoleSwitch" class="option_item" @click="handleSwitchRole">
7
-				<view class="item_left" >
8
-					<image src="@/static/parson/permission.png" mode=""></image>
9
-					<text class="label">切换权限</text>
10
-				</view>
11
-				<view class="item-right">
12
-					<u-icon name="arrow-right" color="#aaa"></u-icon>
13
-				</view>
14
-			</view>
15 5
 			<view class="option_item" @click="toPersonal">
16 6
 				<view class="item_left">
17 7
 					<image src="@/static/parson/icon-gezl.png" mode=""></image>
@@ -37,7 +27,7 @@
37 27
 		<view class="logout_btn">
38 28
 			<u-button type="warning" :plain="true" text="退出账号" size="large" @click="handleShowModal"></u-button>
39 29
 		</view>
40
-		<u-picker :show="showSwitchRole" :columns="columns" keyName="label" :defaultIndex="defaultIndex" @confirm="confirmSwitchRole" @cancel="showSwitchRole = false"></u-picker>
30
+		
41 31
 		<u-modal :show="showModal" 
42 32
 			@confirm="confirm" 
43 33
 			ref="uModal" 
@@ -60,44 +50,11 @@
60 50
 		},
61 51
 		data() {
62 52
 			return {
63
-				showModal: false,
64
-				showSwitchRole: false,
65
-				columns: [],
66
-				defaultIndex: [this.$store.state.user.currentRoleIndex],
67
-				isHaveCRM: false,
68
-				isHaveSalesman: false,
69
-				isHaveWarehouse: false,
53
+				
70 54
 			}
71 55
 		},
72 56
 		methods: {
73
-			handleSwitchRole(){
74
-					this.columns = [];
75
-					let roles = this.$store.state.user.availableRoles;
76
-					console.log(roles);
77
-					
78
-					let roleOptions = [];
79
-					
80
-					const hasAdminRole = roles.some(role => role.includes('admin'));
81
-					const hasCrmRole = roles.some(role => role.includes('CRM'));
82
-					const hasWAREandSALE = roles.some(role => role.includes('WAREandSALE'));
83
-					if(hasAdminRole || (hasCrmRole && hasWAREandSALE) ){//管理员、crm+仓库、crm+销售、仓库+销售
84
-						roleOptions.push(
85
-							{ label: 'CRM权限', value: 'CRM' },
86
-							{ label: '仓库和销售权限', value: 'WAREandSALE' },
87
-						);
88
-					}else if(hasCrmRole){//只有crm	
89
-						roleOptions.push(
90
-							{ label: 'CRM权限', value: 'CRM' },
91
-						);
92
-					}else if(hasWarehouser || hasSalesman){//只有仓库或销售
93
-						roleOptions.push(
94
-							{ label: '仓库和销售权限', value: 'WAREandSALE' },
95
-						);
96
-					}
97
-					
98
-					this.columns = [roleOptions];
99
-					this.showSwitchRole = true;
100
-				},
57
+			
101 58
 			handleEditPassword(){
102 59
 				uni.navigateTo({
103 60
 					url : "/pages/changePw/index"
@@ -129,17 +86,7 @@
129 86
 					},1000)
130 87
 				})
131 88
 			},
132
-			confirmSwitchRole(e) {
133
-				uni.navigateBack({
134
-					delta: 1
135
-				}).then(()=>{
136
-					this.showSwitchRole = false;
137
-					this.$store.commit('user/SET_CURRENT_ROLE_INDEX', e.indexs[0]);
138
-					setTimeout(()=>{
139
-						this.$store.commit('user/SWITCH_ROLE', e.value[0]);
140
-					},50)
141
-				})
142
-			}
89
+			
143 90
 		}
144 91
 	}
145 92
 </script>

+ 11 - 48
pages/wareHouse/components/searchFilter.vue

@@ -15,19 +15,12 @@
15 15
             </u-form-item>
16 16
             <u-form-item label="回收时间" labelWidth="70" @click="openTimePicker">
17 17
                 <Cell :val="time" :isDelete="true" :border="true" @handleClear="clear('time')">  </Cell>
18
-                <jtimePickerPopup :isShowShortTimeList="true" shortTimeTitle="快捷时间" :shortTimeList="shortTimeList"
18
+                <JTimePicker :isShowShortTimeList="true" shortTimeTitle="快捷时间" :shortTimeList="shortTimeList"
19 19
                     :isShowSeletTimeTitle="true" seletTimeTitle="时间选择" cancelText="取消" confirmText="确认"
20 20
                     :endSelectMonth="-1" :endSelectDay="-1" beginTimePlaceHolder='开始时间' endTimePlaceHolder="结束时间"
21 21
                     :isDateTypeRange="true" :isShowSelectedTimeEcho="true" @confirm="getSelectTime" :defaultSelect="0"
22 22
                     ref="jtimePickerPopupRef">
23
-                </jtimePickerPopup>
24
-            </u-form-item>
25
-            <u-form-item label="机构部门" labelWidth="70" @click="recycleDeptClick">
26
-                <Cell :val="formData.deptName" :isDelete="true" :border="true" @handleClear="clear('dept')"></Cell>
27
-                <ba-tree-picker :selectParent="true" v-if="deptList.length > 0" ref="recycleDeptRef" :multiple='false'
28
-							@select-change="deptSeletchang" border title="机构部门" :localdata="deptList" valueKey="deptId"
29
-							textKey="deptName" childrenKey="children" :selectedValues="formData.deptId"
30
-							:personNames="formData.deptName" />
23
+                </JTimePicker>
31 24
             </u-form-item>
32 25
             <u-form-item label="回收人员" labelWidth="70" @click="recyclePersonClick">
33 26
                 <Cell :val="formData.recyclePerson" :isDelete="true" :border="true" @handleClear="clear('recyclePerson')"></Cell>
@@ -56,15 +49,15 @@ import Cell from '@/components/custom-cell/index.vue'
56 49
 import BrandList from '@/components/brand-list/index.vue'
57 50
 import PersonPicker from '@/components/person-picker/index.vue'
58 51
 import TabSelect from '@/components/custom-tab-select/index.vue'
52
+import JTimePicker from '@/uni_modules/jtime-picker-popup/components/JTimePicker/JTimePicker.vue'
59 53
 import { productAttributeList, stockStatusListAll,shortTimeList } from '../js/public.js'
60
-import jtimePickerPopup from '@/uni_modules/jtime-picker-popup/components/JTimePicker/JTimePicker.vue';
61 54
 export default {
62 55
     components: {
63 56
         Cell,
64 57
         BrandList,
65 58
         PersonPicker,
66 59
         TabSelect,
67
-        jtimePickerPopup,
60
+        JTimePicker,
68 61
     },
69 62
     name: 'searchFilter',
70 63
     emits: ['confirm'],
@@ -79,8 +72,6 @@ export default {
79 72
                 location: '',
80 73
                 startTime: '',
81 74
                 endTime: '',
82
-                deptId:'',
83
-                deptName:'',
84 75
                 recyclePerson:'',
85 76
                 recyclePersonId: '',
86 77
                 identifyingPerson:'',
@@ -94,32 +85,13 @@ export default {
94 85
             // 将导入的变量在data中重新定义,确保模板能够访问
95 86
             productAttributeList: productAttributeList,
96 87
             stockStatusListAll: stockStatusListAll,
97
-            deptList: [],
88
+           
98 89
         }
99 90
     },
100 91
     props: {
101 92
     },
102 93
     emits: [],
103
-    mounted() {
104
-        this.getDeptListAll();
105
-    },
106 94
     methods: {
107
-        getDeptListAll() {
108
-            const params = {
109
-                isDept:2
110
-            }
111
-            uni.$u.api.getDeptListAll(params).then(res => {
112
-                if(res.data.length > 0){
113
-                    this.deptList = res.data;
114
-                }else{
115
-                    uni.$u.toast('暂无机构部门');
116
-                }
117
-            })
118
-        },
119
-        deptSeletchang(ids, names) {
120
-            this.formData.deptId = ids[0] || '';
121
-            this.formData.deptName = names[0] || '';
122
-        },
123 95
         handleSearch() {
124 96
             this.$emit('confirm', this.formData);
125 97
             this.close();
@@ -133,8 +105,6 @@ export default {
133 105
                 location: '',
134 106
                 startTime: '',
135 107
                 endTime: '',
136
-                deptId:'',
137
-                deptName:'',
138 108
                 recyclePerson:'',
139 109
                 recyclePersonId: '',
140 110
                 identifyingPerson:'',
@@ -145,12 +115,14 @@ export default {
145 115
         },
146 116
         open() {
147 117
             this.show = true
148
-            this.$nextTick(() => {
118
+            setTimeout(() => {
149 119
                 this.$refs.jtimePickerPopupRef.handleInit();
150
-            })
120
+            }, 300)
151 121
         },
152 122
         openTimePicker() {
153
-            this.$refs.jtimePickerPopupRef.pickerShow();
123
+            this.$nextTick(()=>{
124
+                this.$refs.jtimePickerPopupRef.pickerShow();
125
+            })
154 126
         },
155 127
         close() {
156 128
             this.show = false
@@ -189,13 +161,6 @@ export default {
189 161
                 this.formData.endTime = '';
190 162
                 return;
191 163
             }
192
-            // 机构部门
193
-            if(field == 'dept'){
194
-                this.formData.deptId = '';
195
-                this.formData.deptName = '';
196
-                this.$refs.recycleDeptRef._clear();
197
-                return;
198
-            }
199 164
             this.formData[field] = '';
200 165
         },
201 166
         getSelectTime(val) {
@@ -203,9 +168,7 @@ export default {
203 168
             this.formData.endTime = this.$dayjs(val.endTime).format('YYYY-MM-DD');
204 169
             this.time = this.$dayjs(val.beginTime).format('YYYY-MM-DD') + ' 至 ' + this.$dayjs(val.endTime).format('YYYY-MM-DD');
205 170
         },
206
-        recycleDeptClick() {
207
-            this.$refs.recycleDeptRef._show();
208
-        },
171
+        
209 172
         recyclePersonClick() {
210 173
             this.$refs.recyclePersonPickerRef.open();
211 174
         },

+ 35 - 0
pages/wareHouse/index.vue

@@ -58,6 +58,13 @@
58 58
 							class="price-icon"></u-icon>
59 59
 						<text class="price-text">价格可见</text>
60 60
 					</view>
61
+					<view class="dept-btn" @click="recycleDeptClick">
62
+						<image src="/static/icons/dept.png" mode="aspectFill"></image>
63
+					</view>
64
+					<ba-tree-picker :selectParent="true" v-if="deptList.length > 0" ref="recycleDeptRef" :multiple='false'
65
+							@select-change="deptSeletchang" border title="机构部门" :localdata="deptList" valueKey="deptId"
66
+							textKey="deptName" childrenKey="children" :selectedValues="deptId"
67
+							:personNames="deptName" />
61 68
 					<view class="layout-btn" type="text" size="mini" @click="openSearchFilter">
62 69
 						<u-icon name="grid" size="20" color="#666666"></u-icon>
63 70
 						<!-- 筛选列 品牌、价格范围、位置、回收时间、回收人员、鉴定人员、商品属性 -->
@@ -156,11 +163,13 @@ import searchFilter from './components/searchFilter.vue'
156 163
 import moreInfo from './components/moreInfo.vue'
157 164
 import { permissionCheck } from '../../utils/util.js'
158 165
 import orderList from './components/orderList/index.vue'
166
+import jtimePickerPopup from '@/uni_modules/jtime-picker-popup/components/JTimePicker/JTimePicker.vue';
159 167
 export default {
160 168
 	components: {
161 169
 		searchFilter,
162 170
 		moreInfo,
163 171
 		orderList,
172
+		jtimePickerPopup
164 173
 	},
165 174
 	data() {
166 175
 		return {
@@ -240,12 +249,36 @@ export default {
240 249
 				},
241 250
 			],
242 251
 			isSwipeClick: false,
252
+			deptList: [],
253
+			deptId: '',
254
+			deptName: '',
243 255
 		};
244 256
 	},
245 257
 	onLoad() {
246 258
 		this.getTypeList();
259
+		this.getDeptListAll();
247 260
 	},
248 261
 	methods: {
262
+		getDeptListAll() {
263
+            const params = {
264
+                isDept:2
265
+            }
266
+            uni.$u.api.getDeptListAll(params).then(res => {
267
+                if(res.data.length > 0){
268
+                    this.deptList = res.data;
269
+                }else{
270
+                    uni.$u.toast('暂无机构部门');
271
+                }
272
+            })
273
+        },
274
+		deptSeletchang(ids, names) {
275
+            this.deptId = ids[0] || '';
276
+			this.deptName = names[0] || '';
277
+			this.handleSearch();
278
+        },
279
+		recycleDeptClick() {
280
+            this.$refs.recycleDeptRef._show();
281
+        },
249 282
 		showMoreOptions(goods) {
250 283
 			this.moreOptions = goods;
251 284
 			this.$refs.moreInfoRef.showMoreInfo();
@@ -268,6 +301,8 @@ export default {
268 301
 					searchString: this.searchString,
269 302
 					sortType: this.curSortType.id,
270 303
 					type: this.type,
304
+					deptId: this.deptId,
305
+					deptName: this.deptName,
271 306
 					...this.searchInfo
272 307
 				}).then(res => {
273 308
 					if (this.pageNum == 1) {

+ 7 - 0
pages/wareHouse/styles/index.scss

@@ -243,6 +243,13 @@
243 243
       justify-content: center;
244 244
       flex-shrink: 0;
245 245
     }
246
+    .dept-btn{
247
+      margin-left:18rpx;
248
+      image{
249
+        width: 30rpx;
250
+        height: 30rpx;
251
+      }
252
+    }
246 253
   }
247 254
 }
248 255
 

BIN
static/icons/dept.png


+ 8 - 8
store/modules/user.js

@@ -29,8 +29,8 @@ 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
33
-			// ip: "https://crmtest.nanjingshiyu.com/prod-api", // 测试环境ip
32
+			// ip: "https://crm.nanjingshiyu.com/prod-api/", // ip
33
+			ip: "https://crmtest.nanjingshiyu.com/prod-api", // 测试环境ip
34 34
 			// ip : "/api", // 测试环境ip
35 35
 			// ip : "http://47.113.184.101", // 测试环境ip
36 36
 			// ip: "http://172.16.7.200", // ip
@@ -61,7 +61,6 @@ export default {
61 61
 			const validRoles = [];
62 62
 			
63 63
 			const hasAdminRole = roles.some(role => role.roleKey && role.roleKey.includes('admin' || 'ADMIN'));
64
-			console.log('hasAdminRole',hasAdminRole);
65 64
 			const hasCrmRole = roles.some(role => role.roleKey && role.roleKey.includes('CRM'));
66 65
 			const hasWarehouser = roles.some(role => role.roleKey === 'WAREHOUSER');
67 66
 			const hasSalesman = roles.some(role => role.roleKey === 'SALESMAN');
@@ -84,15 +83,15 @@ export default {
84 83
 			}
85 84
 
86 85
 			state.availableRoles = validRoles;
87
-			state.currentRoleIndex = 0;
88
-			
86
+			state.currentRoleIndex = validRoles.indexOf(uni.getStorageSync('activeTab') || '') || 0;
89 87
 			setTimeout(() => {
90 88
 				const allIndices = [0, 1, 2, 3, 4, 5, 6];
91 89
 				allIndices.forEach(index => {
92 90
 					uni.setTabBarItem({ index, visible: false });
93 91
 				});
94 92
 				const currentRole = validRoles[0] || '';
95
-				switch (currentRole) {
93
+				const activeTab = uni.getStorageSync('activeTab') || currentRole;
94
+				switch (activeTab) {
96 95
 					case 'admin':
97 96
 						// 展示首页、线索公海、销售线索、接单中心、我的
98 97
 						uni.setTabBarItem({ index: 0, visible: true }); // 首页
@@ -180,6 +179,7 @@ export default {
180 179
 				allIndices.forEach(index => {
181 180
 					uni.setTabBarItem({ index, visible: false });
182 181
 				});
182
+				uni.setStorageSync('activeTab', role.value || '');
183 183
 				switch (role.value) {
184 184
 					case 'WAREandSALE':
185 185
 						// 展示仓库、核价中心、询价中心、我的
@@ -285,9 +285,9 @@ export function setupTabBar(userInfo, availableRoles, currentRoleIndex) {
285 285
 		
286 286
 		// 获取当前角色
287 287
 		const currentRole = availableRoles[currentRoleIndex] || '';
288
-		
288
+		const activeTab = uni.getStorageSync('activeTab') || currentRole;
289 289
 		// 根据当前角色显示对应的tabbar
290
-		switch (currentRole) {
290
+		switch (activeTab) {
291 291
 			case 'WAREandSALE':
292 292
 				// 展示仓库、核价中心、询价中心、我的
293 293
 				uni.setTabBarItem({ index: 2, visible: true }); // 仓库