Kaynağa Gözat

feat:仓库:字段+按钮权限

zhangxin 1 hafta önce
ebeveyn
işleme
27cfdd8066

+ 26 - 25
pages/wareHouse/components/detail.vue

@@ -48,7 +48,7 @@
48
         <!-- 核心信息区域 -->
48
         <!-- 核心信息区域 -->
49
         <view class="core_info">
49
         <view class="core_info">
50
             <view class="section_title">核心信息</view>
50
             <view class="section_title">核心信息</view>
51
-            <view class="info_row">
51
+            <view class="info_row" v-if="getWarehouseFieldPermissions('dictLabel','read')">
52
                 <view class="info_label">品牌</view>
52
                 <view class="info_label">品牌</view>
53
                 <view class="info_value" @click.stop="showBrandlList()">
53
                 <view class="info_value" @click.stop="showBrandlList()">
54
                     <!-- <u-input v-if="editMode.dictLabel" v-model="tempValues.dictLabel" :autoFocus="true" @blur="!globalEditMode && saveEditField('dictLabel', tempValues.dictLabel, 'dictLabel')" /> -->
54
                     <!-- <u-input v-if="editMode.dictLabel" v-model="tempValues.dictLabel" :autoFocus="true" @blur="!globalEditMode && saveEditField('dictLabel', tempValues.dictLabel, 'dictLabel')" /> -->
@@ -56,7 +56,7 @@
56
                     <BrandList ref="brandListRef" @selectedBrand="handleSelectedBrand"></BrandList>
56
                     <BrandList ref="brandListRef" @selectedBrand="handleSelectedBrand"></BrandList>
57
                 </view>
57
                 </view>
58
             </view>
58
             </view>
59
-            <view class="info_row">
59
+            <view class="info_row" v-if="getWarehouseFieldPermissions('model','read')">
60
                 <view class="info_label">型号</view>
60
                 <view class="info_label">型号</view>
61
                 <view class="info_value" @click.stop="toggleEditField('model', coreInfo.model)">
61
                 <view class="info_value" @click.stop="toggleEditField('model', coreInfo.model)">
62
                     <u-input v-if="editMode.model" v-model="tempValues.model" :autoFocus="true"
62
                     <u-input v-if="editMode.model" v-model="tempValues.model" :autoFocus="true"
@@ -64,7 +64,7 @@
64
                     <span v-else>{{ coreInfo.model || '-' }}</span>
64
                     <span v-else>{{ coreInfo.model || '-' }}</span>
65
                 </view>
65
                 </view>
66
             </view>
66
             </view>
67
-            <view class="info_row">
67
+            <view class="info_row" v-if="getWarehouseFieldPermissions('indentifyCode','read')">
68
                 <view class="info_label">独立编码</view>
68
                 <view class="info_label">独立编码</view>
69
                 <view class="info_value code" @click.stop="toggleEditField('indentifyCode', coreInfo.indentifyCode)">
69
                 <view class="info_value code" @click.stop="toggleEditField('indentifyCode', coreInfo.indentifyCode)">
70
                     <u-input v-if="editMode.indentifyCode" v-model="tempValues.indentifyCode" :autoFocus="true"
70
                     <u-input v-if="editMode.indentifyCode" v-model="tempValues.indentifyCode" :autoFocus="true"
@@ -72,23 +72,23 @@
72
                     <span v-else>{{ coreInfo.indentifyCode || '-' }}</span>
72
                     <span v-else>{{ coreInfo.indentifyCode || '-' }}</span>
73
                 </view>
73
                 </view>
74
             </view>
74
             </view>
75
-            <view class="info_row">
75
+            <view class="info_row" v-if="getWarehouseFieldPermissions('stockStatus','read')">
76
                 <view class="info_label">是否入库</view>
76
                 <view class="info_label">是否入库</view>
77
                 <view class="info_value">{{ stockStatusFormatter(coreInfo.stockStatus) }}</view>
77
                 <view class="info_value">{{ stockStatusFormatter(coreInfo.stockStatus) }}</view>
78
             </view>
78
             </view>
79
-            <view class="info_row">
79
+            <view class="info_row" v-if="getWarehouseFieldPermissions('createTime','read')">
80
                 <view class="info_label">入库日期</view>
80
                 <view class="info_label">入库日期</view>
81
                 <view class="info_value">{{ coreInfo.createTime || '-' }}</view>
81
                 <view class="info_value">{{ coreInfo.createTime || '-' }}</view>
82
             </view>
82
             </view>
83
-            <view class="info_row">
83
+            <view class="info_row" v-if="getWarehouseFieldPermissions('payType','read')">
84
                 <view class="info_label">付款方式</view>
84
                 <view class="info_label">付款方式</view>
85
                 <view class="info_value">{{ payTypeFormatter(coreInfo.payType) }}</view>
85
                 <view class="info_value">{{ payTypeFormatter(coreInfo.payType) }}</view>
86
             </view>
86
             </view>
87
-            <view class="info_row">
87
+            <view class="info_row" v-if="getWarehouseFieldPermissions('recycleSituation','read')">
88
                 <view class="info_label">回收情况</view>
88
                 <view class="info_label">回收情况</view>
89
                 <view class="info_value">{{ recycleSituationFormatter(coreInfo.recycleSituation) }}</view>
89
                 <view class="info_value">{{ recycleSituationFormatter(coreInfo.recycleSituation) }}</view>
90
             </view>
90
             </view>
91
-            <view class="info_row col">
91
+            <view class="info_row col" v-if="getWarehouseFieldPermissions('desc','read')">
92
                 <view class="info_label">备注信息</view>
92
                 <view class="info_label">备注信息</view>
93
                 <view class="info_value note" @click.stop="toggleEditField('desc', coreInfo.desc)">
93
                 <view class="info_value note" @click.stop="toggleEditField('desc', coreInfo.desc)">
94
                     <textarea v-if="editMode.desc" v-model="tempValues.desc" :autoFocus="true" rows="3"
94
                     <textarea v-if="editMode.desc" v-model="tempValues.desc" :autoFocus="true" rows="3"
@@ -101,8 +101,8 @@
101
         <!-- 财务与价格区域 -->
101
         <!-- 财务与价格区域 -->
102
         <view class="finance_price">
102
         <view class="finance_price">
103
             <view class="section_title">财务与价格</view>
103
             <view class="section_title">财务与价格</view>
104
-            <view class="price_group" v-if="isWareHouser">
105
-                <view class="price_item">
104
+            <view class="price_group">
105
+                <view class="price_item" v-if="getWarehouseFieldPermissions('costPrice','read')">
106
                     <view class="price_label">总成本价</view>
106
                     <view class="price_label">总成本价</view>
107
                     <view class="price_value original"
107
                     <view class="price_value original"
108
                         @click.stop="toggleEditField('costPrice', coreInfo.costPrice)">
108
                         @click.stop="toggleEditField('costPrice', coreInfo.costPrice)">
@@ -111,7 +111,7 @@
111
                         <span v-else>¥{{ coreInfo.costPrice || '-' }}</span>
111
                         <span v-else>¥{{ coreInfo.costPrice || '-' }}</span>
112
                     </view>
112
                     </view>
113
                 </view>
113
                 </view>
114
-                <view class="price_item">
114
+                <view class="price_item" v-if="getWarehouseFieldPermissions('peerPrice','read')">
115
                     <view class="price_label">同行价格</view>
115
                     <view class="price_label">同行价格</view>
116
                     <view class="price_value additional"
116
                     <view class="price_value additional"
117
                         @click.stop="toggleEditField('peerPrice', coreInfo.peerPrice)">
117
                         @click.stop="toggleEditField('peerPrice', coreInfo.peerPrice)">
@@ -122,7 +122,7 @@
122
                 </view>
122
                 </view>
123
             </view>
123
             </view>
124
             <view class="price_group">
124
             <view class="price_group">
125
-                <view class="price_item">
125
+                <view class="price_item" v-if="getWarehouseFieldPermissions('agentPrice','read')">
126
                     <view class="price_label">代理价格</view>
126
                     <view class="price_label">代理价格</view>
127
                     <view class="price_value agent" @click.stop="toggleEditField('agentPrice', coreInfo.agentPrice)">
127
                     <view class="price_value agent" @click.stop="toggleEditField('agentPrice', coreInfo.agentPrice)">
128
                         <u-input v-if="editMode.agentPrice" v-model="tempValues.agentPrice" :autoFocus="true"
128
                         <u-input v-if="editMode.agentPrice" v-model="tempValues.agentPrice" :autoFocus="true"
@@ -130,7 +130,7 @@
130
                         <span v-else>¥{{ coreInfo.agentPrice || '-' }}</span>
130
                         <span v-else>¥{{ coreInfo.agentPrice || '-' }}</span>
131
                     </view>
131
                     </view>
132
                 </view>
132
                 </view>
133
-                <view class="price_item">
133
+                <view class="price_item" v-if="getWarehouseFieldPermissions('price','read')">
134
                     <view class="price_label">官方指导价</view>
134
                     <view class="price_label">官方指导价</view>
135
                     <view class="price_value original" @click.stop="toggleEditField('price', coreInfo.price)">
135
                     <view class="price_value original" @click.stop="toggleEditField('price', coreInfo.price)">
136
                         <u-input v-if="editMode.price" v-model="tempValues.price" :autoFocus="true"
136
                         <u-input v-if="editMode.price" v-model="tempValues.price" :autoFocus="true"
@@ -140,8 +140,8 @@
140
                 </view>
140
                 </view>
141
                 
141
                 
142
             </view>
142
             </view>
143
-            <view class="price_group" v-if="isWareHouser">
144
-                <view class="price_item">
143
+            <view class="price_group">
144
+                <view class="price_item" v-if="getWarehouseFieldPermissions('salePrice','read')">
145
                     <view class="price_label">销售价格</view>
145
                     <view class="price_label">销售价格</view>
146
                     <view class="price_value suggested"
146
                     <view class="price_value suggested"
147
                         @click.stop="toggleEditField('salePrice', coreInfo.salePrice)">
147
                         @click.stop="toggleEditField('salePrice', coreInfo.salePrice)">
@@ -150,7 +150,7 @@
150
                         <span v-else>¥{{ coreInfo.salePrice || '-' }}</span>
150
                         <span v-else>¥{{ coreInfo.salePrice || '-' }}</span>
151
                     </view>
151
                     </view>
152
                 </view>
152
                 </view>
153
-                <view class="price_item">
153
+                <view class="price_item" v-if="getWarehouseFieldPermissions('actualPrice','read')">
154
                     <view class="price_label">实价</view>
154
                     <view class="price_label">实价</view>
155
                     <view class="price_value suggested"
155
                     <view class="price_value suggested"
156
                         @click.stop="toggleEditField('actualPrice', coreInfo.actualPrice)">
156
                         @click.stop="toggleEditField('actualPrice', coreInfo.actualPrice)">
@@ -165,7 +165,7 @@
165
         <!-- 溯源与位置区域 -->
165
         <!-- 溯源与位置区域 -->
166
         <view class="traceability_productPosition">
166
         <view class="traceability_productPosition">
167
             <view class="section_title">溯源与位置</view>
167
             <view class="section_title">溯源与位置</view>
168
-            <view class="info_row">
168
+            <view class="info_row" v-if="getWarehouseFieldPermissions('productPosition','read')">
169
                 <view class="info_label">商品位置</view>
169
                 <view class="info_label">商品位置</view>
170
                 <view class="info_value" @click.stop="toggleEditField('productPosition', coreInfo.productPosition)">
170
                 <view class="info_value" @click.stop="toggleEditField('productPosition', coreInfo.productPosition)">
171
                     <u-input v-if="editMode.productPosition" v-model="tempValues.productPosition" :autoFocus="true"
171
                     <u-input v-if="editMode.productPosition" v-model="tempValues.productPosition" :autoFocus="true"
@@ -173,7 +173,7 @@
173
                     <span v-else>{{ coreInfo.productPosition || '-' }}</span>
173
                     <span v-else>{{ coreInfo.productPosition || '-' }}</span>
174
                 </view>
174
                 </view>
175
             </view>
175
             </view>
176
-            <view class="info_row">
176
+            <view class="info_row" v-if="getWarehouseFieldPermissions('recyclePerson','read')">
177
                 <view class="info_label">回收人员</view>
177
                 <view class="info_label">回收人员</view>
178
                 <view class="info_value" @click.stop="showRecyclePersonPicker">
178
                 <view class="info_value" @click.stop="showRecyclePersonPicker">
179
                     <span>{{ coreInfo.recyclePerson || '-' }}</span>
179
                     <span>{{ coreInfo.recyclePerson || '-' }}</span>
@@ -182,7 +182,7 @@
182
                     </personPicker>
182
                     </personPicker>
183
                 </view>
183
                 </view>
184
             </view>
184
             </view>
185
-            <view class="info_row">
185
+            <view class="info_row" v-if="getWarehouseFieldPermissions('identifyingPerson','read')">
186
                 <view class="info_label">鉴定人员</view>
186
                 <view class="info_label">鉴定人员</view>
187
                 <view class="info_value" @click.stop="showIdentifyingPersonPicker">
187
                 <view class="info_value" @click.stop="showIdentifyingPersonPicker">
188
                     <span>{{ coreInfo.identifyingPerson || '-' }}</span>
188
                     <span>{{ coreInfo.identifyingPerson || '-' }}</span>
@@ -239,7 +239,7 @@
239
 import BrandList from '@/components/brand-list/index.vue'
239
 import BrandList from '@/components/brand-list/index.vue'
240
 import personPicker from '@/components/person-picker/index.vue'
240
 import personPicker from '@/components/person-picker/index.vue'
241
 import imgsRowScroll from '@/components/imgs-row-scroll/index.vue'
241
 import imgsRowScroll from '@/components/imgs-row-scroll/index.vue'
242
-import { permissionCheck } from '@/utils/util.js'
242
+import { getWarehouseButtonPermissions,getWarehouseFieldPermissions } from '@/utils/util.js'
243
 import { recycleSituationList } from '../js/public.js'
243
 import { recycleSituationList } from '../js/public.js'
244
 export default {
244
 export default {
245
     components: {
245
     components: {
@@ -276,7 +276,6 @@ export default {
276
             downStatus: '',//下架状态 0:已下架 1:已上架
276
             downStatus: '',//下架状态 0:已下架 1:已上架
277
             showEditImgsModal: false,
277
             showEditImgsModal: false,
278
             tempImgsUrl: [],
278
             tempImgsUrl: [],
279
-            isWareHouser: permissionCheck('WAREHOUSER',false),
280
         }
279
         }
281
     },
280
     },
282
     onLoad(options) {
281
     onLoad(options) {
@@ -284,6 +283,8 @@ export default {
284
         this.getGoodsDetail();
283
         this.getGoodsDetail();
285
     },
284
     },
286
     methods: {
285
     methods: {
286
+        getWarehouseButtonPermissions:getWarehouseButtonPermissions,
287
+        getWarehouseFieldPermissions:getWarehouseFieldPermissions,
287
         // 分享
288
         // 分享
288
         handleShare() {
289
         handleShare() {
289
             uni.showToast({
290
             uni.showToast({
@@ -379,7 +380,7 @@ export default {
379
         },
380
         },
380
         // 显示品牌列表
381
         // 显示品牌列表
381
         showBrandlList() {
382
         showBrandlList() {
382
-            if(!permissionCheck('WAREHOUSER')) return false
383
+            if(!this.getWarehouseFieldPermissions('dictValue','edit')) return false
383
             this.$refs.brandListRef.showBrandList();
384
             this.$refs.brandListRef.showBrandList();
384
         },
385
         },
385
         // 处理选中品牌
386
         // 处理选中品牌
@@ -487,7 +488,7 @@ export default {
487
         },
488
         },
488
         // 切换单个字段的编辑状态
489
         // 切换单个字段的编辑状态
489
         toggleEditField(field, value) {
490
         toggleEditField(field, value) {
490
-            if(!permissionCheck('WAREHOUSER')) return false
491
+            if(!getWarehouseButtonPermissions('edit')) return false
491
             // 如果不是全局编辑模式
492
             // 如果不是全局编辑模式
492
             if (!this.globalEditMode) {
493
             if (!this.globalEditMode) {
493
                 // 重置所有编辑状态
494
                 // 重置所有编辑状态
@@ -508,7 +509,7 @@ export default {
508
         },
509
         },
509
         // 进入全局编辑模式
510
         // 进入全局编辑模式
510
         enterGlobalEdit() {
511
         enterGlobalEdit() {
511
-            if(!permissionCheck('WAREHOUSER')) return false
512
+            if(!getWarehouseButtonPermissions('edit')) return false
512
             this.globalEditMode = true;
513
             this.globalEditMode = true;
513
             // 设置所有可编辑字段为编辑状态
514
             // 设置所有可编辑字段为编辑状态
514
             this.editMode = {
515
             this.editMode = {
@@ -656,7 +657,7 @@ export default {
656
             })
657
             })
657
         },
658
         },
658
         handleEditImgs() {
659
         handleEditImgs() {
659
-            if(!permissionCheck('WAREHOUSER')) return false
660
+            if(!this.getWarehouseFieldPermissions('goodPicFileList','edit')) return false
660
             this.showEditImgsModal = true;
661
             this.showEditImgsModal = true;
661
             this.tempImgsUrl = this.imgsUrl
662
             this.tempImgsUrl = this.imgsUrl
662
         },
663
         },

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

@@ -26,7 +26,7 @@
26
                                 @click="handlePasteRecognition(recognitionContent)"></u-button>
26
                                 @click="handlePasteRecognition(recognitionContent)"></u-button>
27
                         </view>
27
                         </view>
28
                     </u-form-item>
28
                     </u-form-item>
29
-                    <u-form-item v-if="getWarehouseFieldPermissions('goodPicFileList','read')" :label="'商品图片('+formData.goodPicFileList.length+'张)'" required prop="goodPicFileList" borderBottom>
29
+                    <u-form-item v-if="getWarehouseFieldPermissions('goodPicFileList','read')" :label="'商品图片('+formData.goodPicFileList.length+'张)'" required  borderBottom>
30
                         <view class="imgs_scroll">
30
                         <view class="imgs_scroll">
31
                             <DragUpload ref="dragUpload" :images="formData.goodPicFileList" :isDelete="true" :isPreview="true" @imagesChanged="goodPicFileListImagesChanged" @uploadComplete="goodPicFileListUploadComplete"></DragUpload>
31
                             <DragUpload ref="dragUpload" :images="formData.goodPicFileList" :isDelete="true" :isPreview="true" @imagesChanged="goodPicFileListImagesChanged" @uploadComplete="goodPicFileListUploadComplete"></DragUpload>
32
                             <!-- <ImgsRowScroll  v-if="formData.goodPicFileList.length > 0" :isShowDeleteIcon="true"
32
                             <!-- <ImgsRowScroll  v-if="formData.goodPicFileList.length > 0" :isShowDeleteIcon="true"
@@ -276,7 +276,7 @@ import BrandList from '@/components/brand-list/index.vue'
276
 import ImgsRowScroll from '@/components/imgs-row-scroll/index.vue'
276
 import ImgsRowScroll from '@/components/imgs-row-scroll/index.vue'
277
 import DragUpload from '@/components/drag-upload/index.vue'
277
 import DragUpload from '@/components/drag-upload/index.vue'
278
 import PersonPicker from '@/components/person-picker/index.vue'
278
 import PersonPicker from '@/components/person-picker/index.vue'
279
-import { permissionCheck,getRoles,getWarehouseFieldPermissions } from '@/utils/util.js'
279
+import { getRoles,getWarehouseFieldPermissions,getWarehouseButtonPermissions } from '@/utils/util.js'
280
 import moreInfo from './moreInfo.vue'
280
 import moreInfo from './moreInfo.vue'
281
 import { productConditionList,productAttributeList,stockStatusList,recycleTypeList,labelList,paymentTabList,recycleSituationList } from '../js/public.js'
281
 import { productConditionList,productAttributeList,stockStatusList,recycleTypeList,labelList,paymentTabList,recycleSituationList } from '../js/public.js'
282
 export default {
282
 export default {
@@ -400,7 +400,6 @@ export default {
400
             echoInfoProductCondition:'',//入库回显的时候 商品成色回显
400
             echoInfoProductCondition:'',//入库回显的时候 商品成色回显
401
             echoInfoStockStatus:'',//入库回显的时候 是否入库回显
401
             echoInfoStockStatus:'',//入库回显的时候 是否入库回显
402
             echoInfoRecycleSituation:'0',//入库回显的时候 回收情况回显
402
             echoInfoRecycleSituation:'0',//入库回显的时候 回收情况回显
403
-            isWareHouser: permissionCheck('WAREHOUSER',false),
404
             formType: '',//表单类型 add:新增 edit:编辑
403
             formType: '',//表单类型 add:新增 edit:编辑
405
             xhlSystemSetList: [],//系统设置-列表
404
             xhlSystemSetList: [],//系统设置-列表
406
             productConditionList:productConditionList,
405
             productConditionList:productConditionList,
@@ -457,6 +456,7 @@ export default {
457
     },
456
     },
458
     methods: {
457
     methods: {
459
         getWarehouseFieldPermissions,
458
         getWarehouseFieldPermissions,
459
+        getWarehouseButtonPermissions,
460
         getXhlSystemSetList(){
460
         getXhlSystemSetList(){
461
             uni.$u.api.xhlSystemSetList({
461
             uni.$u.api.xhlSystemSetList({
462
                 pageNum: 1,
462
                 pageNum: 1,
@@ -506,7 +506,7 @@ export default {
506
             })
506
             })
507
         },
507
         },
508
         handleMoreInfoConfirm() {
508
         handleMoreInfoConfirm() {
509
-            if(!permissionCheck('WAREHOUSER')) return false
509
+            if(!this.getWarehouseButtonPermissions('edit')) return false
510
             this.submitForm(this.submitType)
510
             this.submitForm(this.submitType)
511
         },
511
         },
512
         // 提交表单
512
         // 提交表单

+ 4 - 3
pages/wareHouse/components/fakeRegistration.vue

@@ -69,7 +69,7 @@
69
 </template>
69
 </template>
70
 
70
 
71
 <script>
71
 <script>
72
-import { permissionCheck } from '../../../utils/util.js'
72
+import { getWarehouseButtonPermissions } from '../../../utils/util.js'
73
 export default {
73
 export default {
74
   name: 'FakeRegistration',
74
   name: 'FakeRegistration',
75
   data() {
75
   data() {
@@ -118,6 +118,7 @@ export default {
118
     this.getWareHouseFakeList()
118
     this.getWareHouseFakeList()
119
   },
119
   },
120
   methods: {
120
   methods: {
121
+    getWarehouseButtonPermissions:getWarehouseButtonPermissions,
121
     handleLoadMore() {
122
     handleLoadMore() {
122
       if (this.pageNum * this.pageSize >= this.total) {
123
       if (this.pageNum * this.pageSize >= this.total) {
123
         this.loadStatus = 'noMore'
124
         this.loadStatus = 'noMore'
@@ -141,7 +142,7 @@ export default {
141
       })
142
       })
142
     },
143
     },
143
     handleAdd() {
144
     handleAdd() {
144
-      if(!permissionCheck('WAREHOUSER')) return false
145
+      if(!this.getWarehouseButtonPermissions('edit')) return false
145
       this.isAdd = true
146
       this.isAdd = true
146
       this.currentEditItem = null
147
       this.currentEditItem = null
147
       this.formData = {
148
       this.formData = {
@@ -172,7 +173,7 @@ export default {
172
       this.showEditDialog = true
173
       this.showEditDialog = true
173
     },
174
     },
174
     handleSubmit() {
175
     handleSubmit() {
175
-      if(!permissionCheck('WAREHOUSER')) return false
176
+      if(!this.getWarehouseButtonPermissions('edit')) return false
176
       this.$refs.formRef.validate().then(() => {
177
       this.$refs.formRef.validate().then(() => {
177
         if (this.isAdd) {
178
         if (this.isAdd) {
178
           uni.$u.api.wareHouseFakeAdd(this.formData).then(res => {
179
           uni.$u.api.wareHouseFakeAdd(this.formData).then(res => {

+ 1 - 1
pages/wareHouse/components/fieldPermissions.vue

@@ -426,7 +426,7 @@ export default {
426
 }
426
 }
427
 
427
 
428
 .list-wrap {
428
 .list-wrap {
429
-	max-height: 60vh;
429
+	max-height: 30vh;
430
 }
430
 }
431
 
431
 
432
 .loading-wrap {
432
 .loading-wrap {

+ 73 - 42
pages/wareHouse/index.vue

@@ -12,10 +12,12 @@
12
 					<text class="asset-value">{{ wareHouseCard.totalCost }}</text>
12
 					<text class="asset-value">{{ wareHouseCard.totalCost }}</text>
13
 				</view>
13
 				</view>
14
 				<view class="btn-group">
14
 				<view class="btn-group">
15
-					<u-button type="primary" shape="circle" plain size="mini" @click="navigateToFieldPermissions">字段权限</u-button>
15
+					<u-button v-if="isAdmin" type="primary" shape="circle" plain size="mini"
16
+						@click="navigateToFieldPermissions">字段权限</u-button>
16
 					<u-button type="success" shape="circle" plain size="mini" @click="openOrderList">开单记录</u-button>
17
 					<u-button type="success" shape="circle" plain size="mini" @click="openOrderList">开单记录</u-button>
17
 					<order-list ref="orderListRef"></order-list>
18
 					<order-list ref="orderListRef"></order-list>
18
-					<u-button type="primary" shape="circle" plain size="mini" @click="navigateToFakeRegistration">假货登记</u-button>
19
+					<u-button type="primary" shape="circle" plain size="mini"
20
+						@click="navigateToFakeRegistration">假货登记</u-button>
19
 				</view>
21
 				</view>
20
 			</view>
22
 			</view>
21
 			<view class="data-cards">
23
 			<view class="data-cards">
@@ -39,8 +41,9 @@
39
 			</view>
41
 			</view>
40
 
42
 
41
 			<view class="category-tabs-wrap">
43
 			<view class="category-tabs-wrap">
42
-				<u-tabs :list="tabList" :is-scroll="true" active-color="#007aff" inactive-color="#666666" font-size="28rpx"
43
-					keyName="dictLabel" border-bottom="none" @change="switchTab" class="u-tabs-custom"></u-tabs>
44
+				<u-tabs :list="tabList" :is-scroll="true" active-color="#007aff" inactive-color="#666666"
45
+					font-size="28rpx" keyName="dictLabel" border-bottom="none" @change="switchTab"
46
+					class="u-tabs-custom"></u-tabs>
44
 			</view>
47
 			</view>
45
 
48
 
46
 			<view class="filter-bar">
49
 			<view class="filter-bar">
@@ -52,7 +55,8 @@
52
 				</view>
55
 				</view>
53
 				<view class="price-layout-btn">
56
 				<view class="price-layout-btn">
54
 					<view class="price-btn" type="text" @click="priceVisibleChange">
57
 					<view class="price-btn" type="text" @click="priceVisibleChange">
55
-						<u-icon :name="priceVisible ? 'eye' : 'eye-off'" size="18" color="#1890ff" class="price-icon"></u-icon>
58
+						<u-icon :name="priceVisible ? 'eye' : 'eye-off'" size="18" color="#1890ff"
59
+							class="price-icon"></u-icon>
56
 						<text class="price-text">价格可见</text>
60
 						<text class="price-text">价格可见</text>
57
 					</view>
61
 					</view>
58
 					<view class="dept-btn" @click="recycleDeptClick">
62
 					<view class="dept-btn" @click="recycleDeptClick">
@@ -61,9 +65,9 @@
61
 						</view>
65
 						</view>
62
 						<image src="/static/icons/dept.png" mode="aspectFill"></image>
66
 						<image src="/static/icons/dept.png" mode="aspectFill"></image>
63
 					</view>
67
 					</view>
64
-					<ba-tree-picker :selectParent="true" ref="recycleDeptRef" :multiple='false' @select-change="deptSeletchang"
65
-						border title="机构部门" :localdata="deptList" valueKey="deptId" textKey="deptName" childrenKey="children"
66
-						:selectedValues="deptId" :personNames="deptName" />
68
+					<ba-tree-picker :selectParent="true" ref="recycleDeptRef" :multiple='false'
69
+						@select-change="deptSeletchang" border title="机构部门" :localdata="deptList" valueKey="deptId"
70
+						textKey="deptName" childrenKey="children" :selectedValues="deptId" :personNames="deptName" />
67
 					<view class="layout-btn" type="text" size="mini" @click="openSearchFilter">
71
 					<view class="layout-btn" type="text" size="mini" @click="openSearchFilter">
68
 						<image class="filter-icon" src="/static/icons/select.png" mode="aspectFill"></image>
72
 						<image class="filter-icon" src="/static/icons/select.png" mode="aspectFill"></image>
69
 						筛选
73
 						筛选
@@ -73,24 +77,28 @@
73
 					<searchFilter ref="searchFilter" @confirm="handleSearch"></searchFilter>
77
 					<searchFilter ref="searchFilter" @confirm="handleSearch"></searchFilter>
74
 				</view>
78
 				</view>
75
 			</view>
79
 			</view>
76
-			<u-notice-bar class="custom-notice-bar" icon="" :text="selectText" mode="closable" speed="40"></u-notice-bar>
77
-			<scroll-view ref="scrollView" class="goods-list" scroll-y @scrolltolower="handleLoadMore" @scroll="handleScroll"
78
-				enable-back-to-top>
80
+			<u-notice-bar class="custom-notice-bar" icon="" :text="selectText" mode="closable"
81
+				speed="40"></u-notice-bar>
82
+			<scroll-view ref="scrollView" class="goods-list" scroll-y @scrolltolower="handleLoadMore"
83
+				@scroll="handleScroll" enable-back-to-top>
79
 				<view @click.stop="clickItem(goods)" class="goods-item" v-for="(goods, goodsIndex) in goodsList"
84
 				<view @click.stop="clickItem(goods)" class="goods-item" v-for="(goods, goodsIndex) in goodsList"
80
 					:key="`goods-${goodsIndex}`">
85
 					:key="`goods-${goodsIndex}`">
81
 					<u-swipe-action ref="swipeRef">
86
 					<u-swipe-action ref="swipeRef">
82
-						<u-swipe-action-item :options="swipeOptions" @click="(e) => handleSwipeClick(e, goods, goodsIndex)">
87
+						<u-swipe-action-item :options="swipeOptions"
88
+							@click="(e) => handleSwipeClick(e, goods, goodsIndex)">
83
 							<view class="goods-info">
89
 							<view class="goods-info">
84
-								<view class="goods-img-container" v-if="getWarehouseFieldPermissions('goodPicFileList','read')">
85
-									<image class="goods-img" :src="goods.imgUrl ? goods.imgUrl : '/static/no-img.png'" mode="aspectFill"
86
-										lazy-load></image>
90
+								<view class="goods-img-container"
91
+									v-if="getWarehouseFieldPermissions('goodPicFileList', 'read')">
92
+									<image class="goods-img" :src="goods.imgUrl ? goods.imgUrl : '/static/no-img.png'"
93
+										mode="aspectFill" lazy-load></image>
87
 									<!-- <image class="goods-img" src="/static/no-img.png" mode="aspectFill" lazy-load></image> -->
94
 									<!-- <image class="goods-img" src="/static/no-img.png" mode="aspectFill" lazy-load></image> -->
88
-									<view :class="['stock-indicator', goods.downStatus == '1' ? 'up-indicator' : 'down-indicator']">
95
+									<view
96
+										:class="['stock-indicator', goods.downStatus == '1' ? 'up-indicator' : 'down-indicator']">
89
 									</view>
97
 									</view>
90
 								</view>
98
 								</view>
91
 								<view class="info-content">
99
 								<view class="info-content">
92
 									<view class="goods-brand">
100
 									<view class="goods-brand">
93
-										<view v-if="getWarehouseFieldPermissions('dictLabel','read')">
101
+										<view v-if="getWarehouseFieldPermissions('dictLabel', 'read')">
94
 											{{ goods.dictLabel || '-' }}
102
 											{{ goods.dictLabel || '-' }}
95
 										</view>
103
 										</view>
96
 										<!-- <image v-if="goods.indentifyCode" src="../../static/icons/code.png"
104
 										<!-- <image v-if="goods.indentifyCode" src="../../static/icons/code.png"
@@ -99,35 +107,43 @@
99
 											{{ goods.indentifyCode || '' }}
107
 											{{ goods.indentifyCode || '' }}
100
 										</view> -->
108
 										</view> -->
101
 									</view>
109
 									</view>
102
-									<text class="goods-name" v-if="getWarehouseFieldPermissions('model','read')">型号:{{ goods.model || '-' }}</text>
103
-									<text class="goods-name" v-if="getWarehouseFieldPermissions('indentifyCode','read')">编码:{{ goods.indentifyCode || '-' }}</text>
110
+									<text class="goods-name" v-if="getWarehouseFieldPermissions('model', 'read')">型号:{{
111
+										goods.model || '-' }}</text>
112
+									<text class="goods-name"
113
+										v-if="getWarehouseFieldPermissions('indentifyCode', 'read')">编码:{{
114
+											goods.indentifyCode || '-' }}</text>
104
 									<view class="price-group">
115
 									<view class="price-group">
105
-										<view class="price-item" v-if="getWarehouseFieldPermissions('costPrice','read')">
116
+										<view class="price-item"
117
+											v-if="getWarehouseFieldPermissions('costPrice', 'read')">
106
 											<text class="price-type">成本价</text>
118
 											<text class="price-type">成本价</text>
107
 											<text class="price">¥{{ priceVisible ? goods.costPrice || '-' : '****'
119
 											<text class="price">¥{{ priceVisible ? goods.costPrice || '-' : '****'
108
 											}}</text>
120
 											}}</text>
109
 										</view>
121
 										</view>
110
-										<view class="price-item" v-if="getWarehouseFieldPermissions('salePrice','read')">
122
+										<view class="price-item"
123
+											v-if="getWarehouseFieldPermissions('salePrice', 'read')">
111
 											<text class="price-type">销售价</text>
124
 											<text class="price-type">销售价</text>
112
 											<text class="price sales">¥{{ priceVisible ? goods.salePrice || '-' : '****'
125
 											<text class="price sales">¥{{ priceVisible ? goods.salePrice || '-' : '****'
113
 											}}</text>
126
 											}}</text>
114
 										</view>
127
 										</view>
115
-										<view class="price-item" v-if="getWarehouseFieldPermissions('peerPrice','read')">
128
+										<view class="price-item"
129
+											v-if="getWarehouseFieldPermissions('peerPrice', 'read')">
116
 											<text class="price-type">同行价</text>
130
 											<text class="price-type">同行价</text>
117
 											<text class="price">¥{{ priceVisible ? goods.peerPrice || '-' : '****'
131
 											<text class="price">¥{{ priceVisible ? goods.peerPrice || '-' : '****'
118
 											}}</text>
132
 											}}</text>
119
 										</view>
133
 										</view>
120
-										<view class="price-item" v-if="getWarehouseFieldPermissions('agentPrice','read')">
134
+										<view class="price-item"
135
+											v-if="getWarehouseFieldPermissions('agentPrice', 'read')">
121
 											<text class="price-type">代理价</text>
136
 											<text class="price-type">代理价</text>
122
 											<text class="price">¥{{ priceVisible ? goods.agentPrice || '-' : '****'
137
 											<text class="price">¥{{ priceVisible ? goods.agentPrice || '-' : '****'
123
 											}}</text>
138
 											}}</text>
124
 										</view>
139
 										</view>
125
-										<view class="price-item" v-if="getWarehouseFieldPermissions('actualPrice','read')">
140
+										<view class="price-item"
141
+											v-if="getWarehouseFieldPermissions('actualPrice', 'read')">
126
 											<text class="price-type">实价</text>
142
 											<text class="price-type">实价</text>
127
 											<text class="price">¥{{ priceVisible ? goods.actualPrice || '-' : '****'
143
 											<text class="price">¥{{ priceVisible ? goods.actualPrice || '-' : '****'
128
 											}}</text>
144
 											}}</text>
129
 										</view>
145
 										</view>
130
-										<view class="price-item" v-if="getWarehouseFieldPermissions('price','read')">
146
+										<view class="price-item" v-if="getWarehouseFieldPermissions('price', 'read')">
131
 											<text class="price-type">指导价</text>
147
 											<text class="price-type">指导价</text>
132
 											<text class="price">¥{{ priceVisible ? goods.price || '-' : '****' }}</text>
148
 											<text class="price">¥{{ priceVisible ? goods.price || '-' : '****' }}</text>
133
 										</view>
149
 										</view>
@@ -146,7 +162,8 @@
146
 									<view @click.stop="showMoreOptions(goods)">
162
 									<view @click.stop="showMoreOptions(goods)">
147
 										<u-icon name="more-dot-fill" size="16" color="#666666"></u-icon>
163
 										<u-icon name="more-dot-fill" size="16" color="#666666"></u-icon>
148
 									</view>
164
 									</view>
149
-									<text class="goods-stock" v-if="getWarehouseFieldPermissions('stock','read')">数量:{{ goods.stock || 0 }}</text>
165
+									<text class="goods-stock" v-if="getWarehouseFieldPermissions('stock', 'read')">数量:{{
166
+										goods.stock || 0 }}</text>
150
 								</view>
167
 								</view>
151
 
168
 
152
 							</view>
169
 							</view>
@@ -154,35 +171,43 @@
154
 							<view class="more-info-container">
171
 							<view class="more-info-container">
155
 								<view class="more-info-header" @click.stop="toggleMoreInfo(goods)">
172
 								<view class="more-info-header" @click.stop="toggleMoreInfo(goods)">
156
 									<text class="more-info-title">更多信息</text>
173
 									<text class="more-info-title">更多信息</text>
157
-									<u-icon :name="goods.showMoreInfo ? 'arrow-up' : 'arrow-down'" size="14" color="#666666"></u-icon>
174
+									<u-icon :name="goods.showMoreInfo ? 'arrow-up' : 'arrow-down'" size="14"
175
+										color="#666666"></u-icon>
158
 								</view>
176
 								</view>
159
 								<transition name="more-info">
177
 								<transition name="more-info">
160
 									<view class="more-info-content" v-if="goods.showMoreInfo">
178
 									<view class="more-info-content" v-if="goods.showMoreInfo">
161
-										<view class="info-row" v-if="getWarehouseFieldPermissions('recycleTime','read')">
179
+										<view class="info-row"
180
+											v-if="getWarehouseFieldPermissions('recycleTime', 'read')">
162
 											<text class="info-label">回收时间:</text>
181
 											<text class="info-label">回收时间:</text>
163
 											<text class="info-value">{{ formatterTime(goods.recycleTime) }}</text>
182
 											<text class="info-value">{{ formatterTime(goods.recycleTime) }}</text>
164
 										</view>
183
 										</view>
165
-										<view class="info-row" v-if="getWarehouseFieldPermissions('warehouseDate','read')">
184
+										<view class="info-row"
185
+											v-if="getWarehouseFieldPermissions('warehouseDate', 'read')">
166
 											<text class="info-label">入库时间:</text>
186
 											<text class="info-label">入库时间:</text>
167
 											<text class="info-value">{{ formatterTime(goods.warehouseDate) }}</text>
187
 											<text class="info-value">{{ formatterTime(goods.warehouseDate) }}</text>
168
 										</view>
188
 										</view>
169
-										<view class="info-row" v-if="getWarehouseFieldPermissions('productPosition','read')">
189
+										<view class="info-row"
190
+											v-if="getWarehouseFieldPermissions('productPosition', 'read')">
170
 											<text class="info-label">商品位置:</text>
191
 											<text class="info-label">商品位置:</text>
171
 											<text class="info-value">{{ goods.productPosition || '-' }}</text>
192
 											<text class="info-value">{{ goods.productPosition || '-' }}</text>
172
 										</view>
193
 										</view>
173
-										<view class="info-row" v-if="getWarehouseFieldPermissions('identifyingPerson','read')">
194
+										<view class="info-row"
195
+											v-if="getWarehouseFieldPermissions('identifyingPerson', 'read')">
174
 											<text class="info-label">鉴定人员:</text>
196
 											<text class="info-label">鉴定人员:</text>
175
 											<text class="info-value">{{ goods.identifyingPerson || '-' }}</text>
197
 											<text class="info-value">{{ goods.identifyingPerson || '-' }}</text>
176
 										</view>
198
 										</view>
177
-										<view class="info-row" v-if="getWarehouseFieldPermissions('recyclePerson','read')">
199
+										<view class="info-row"
200
+											v-if="getWarehouseFieldPermissions('recyclePerson', 'read')">
178
 											<text class="info-label">回收人员:</text>
201
 											<text class="info-label">回收人员:</text>
179
 											<text class="info-value">{{ goods.recyclePerson || '-' }}</text>
202
 											<text class="info-value">{{ goods.recyclePerson || '-' }}</text>
180
 										</view>
203
 										</view>
181
-										<view class="info-row" v-if="getWarehouseFieldPermissions('stockStatus','read')">
204
+										<view class="info-row"
205
+											v-if="getWarehouseFieldPermissions('stockStatus', 'read')">
182
 											<text class="info-label">是否入库:</text>
206
 											<text class="info-label">是否入库:</text>
183
-											<text class="info-value">{{ goods.stockStatus == '1' ? '已入库' : '未入库' }}</text>
207
+											<text class="info-value">{{ goods.stockStatus == '1' ? '已入库' : '未入库'
208
+												}}</text>
184
 										</view>
209
 										</view>
185
-										<view class="info-row" v-if="getWarehouseFieldPermissions('payType','read')">
210
+										<view class="info-row" v-if="getWarehouseFieldPermissions('payType', 'read')">
186
 											<text class="info-label">付款方式:</text>
211
 											<text class="info-label">付款方式:</text>
187
 											<text class="info-value">{{ payFormatter(goods.payType) }}</text>
212
 											<text class="info-value">{{ payFormatter(goods.payType) }}</text>
188
 										</view>
213
 										</view>
@@ -204,7 +229,7 @@
204
 <script>
229
 <script>
205
 import searchFilter from './components/searchFilter.vue'
230
 import searchFilter from './components/searchFilter.vue'
206
 import moreInfo from './components/moreInfo.vue'
231
 import moreInfo from './components/moreInfo.vue'
207
-import { permissionCheck,getWarehouseFieldPermissions } from '../../utils/util.js'
232
+import { getWarehouseButtonPermissions, getWarehouseFieldPermissions,getRoles } from '../../utils/util.js'
208
 import orderList from './components/orderList/index.vue'
233
 import orderList from './components/orderList/index.vue'
209
 import { paymentTabList,productAttributeList } from './js/public.js'
234
 import { paymentTabList,productAttributeList } from './js/public.js'
210
 import jtimePickerPopup from '@/uni_modules/jtime-picker-popup/components/JTimePicker/JTimePicker.vue';
235
 import jtimePickerPopup from '@/uni_modules/jtime-picker-popup/components/JTimePicker/JTimePicker.vue';
@@ -215,6 +240,11 @@ export default {
215
 		orderList,
240
 		orderList,
216
 		jtimePickerPopup
241
 		jtimePickerPopup
217
 	},
242
 	},
243
+	computed: {
244
+		isAdmin() {
245
+			return getRoles().some(v => v.includes('admin' || 'ADMIN'))
246
+		}
247
+	},
218
 	data() {
248
 	data() {
219
 		return {
249
 		return {
220
 			searchString: '',//搜索编号、名称、品牌...
250
 			searchString: '',//搜索编号、名称、品牌...
@@ -304,7 +334,7 @@ export default {
304
 			},
334
 			},
305
 			paymentTabList: paymentTabList,
335
 			paymentTabList: paymentTabList,
306
 			productAttributeList: productAttributeList,
336
 			productAttributeList: productAttributeList,
307
-			selectText:'暂无筛选条件'
337
+			selectText: '暂无筛选条件'
308
 		};
338
 		};
309
 	},
339
 	},
310
 	onLoad() {
340
 	onLoad() {
@@ -349,6 +379,7 @@ export default {
349
 			this.$refs.moreInfoRef.showMoreInfo();
379
 			this.$refs.moreInfoRef.showMoreInfo();
350
 		},
380
 		},
351
 		getWarehouseFieldPermissions,
381
 		getWarehouseFieldPermissions,
382
+		getWarehouseButtonPermissions,
352
 		handleMoreInfoConfirm() {
383
 		handleMoreInfoConfirm() {
353
 			this.$refs.moreInfoRef.closeModal();
384
 			this.$refs.moreInfoRef.closeModal();
354
 		},
385
 		},
@@ -400,7 +431,7 @@ export default {
400
 			if (!attr || attr.length == 0) {
431
 			if (!attr || attr.length == 0) {
401
 				return '暂无'
432
 				return '暂无'
402
 			}
433
 			}
403
-			return attr.map(a=>this.productAttributeList.find(b=>b.value == a))?.map(item=>item.name).join(' ') || '暂无'
434
+			return attr.map(a => this.productAttributeList.find(b => b.value == a))?.map(item => item.name).join(' ') || '暂无'
404
 		},
435
 		},
405
 		formatterStockStatus(status) {
436
 		formatterStockStatus(status) {
406
 			if (!status) {
437
 			if (!status) {
@@ -427,7 +458,7 @@ export default {
427
 		handleSwipeClick(e, item, goodsIndex) {
458
 		handleSwipeClick(e, item, goodsIndex) {
428
 			if (e.index == 0) {//删除
459
 			if (e.index == 0) {//删除
429
 				this.isSwipeClick = true;
460
 				this.isSwipeClick = true;
430
-				if (!permissionCheck('WAREHOUSER')) return false
461
+				if (!this.getWarehouseButtonPermissions('delete')) return false
431
 				uni.$u.api.wareHouseDelete({
462
 				uni.$u.api.wareHouseDelete({
432
 					id: item.id
463
 					id: item.id
433
 				}).then(() => {
464
 				}).then(() => {
@@ -520,7 +551,7 @@ export default {
520
 			return false;
551
 			return false;
521
 		},
552
 		},
522
 	},
553
 	},
523
-	
554
+
524
 	onShow() {
555
 	onShow() {
525
 		// 尝试恢复页面状态
556
 		// 尝试恢复页面状态
526
 		if (!this.restorePageState()) {
557
 		if (!this.restorePageState()) {
@@ -528,7 +559,7 @@ export default {
528
 			this.pageNum = 1;
559
 			this.pageNum = 1;
529
 			this.getList();
560
 			this.getList();
530
 		}
561
 		}
531
-		
562
+
532
 		this.getCard();
563
 		this.getCard();
533
 		// 监听数据更新事件
564
 		// 监听数据更新事件
534
 		this.updateListener = uni.$on('warehouse-data-updated', () => {
565
 		this.updateListener = uni.$on('warehouse-data-updated', () => {
@@ -542,7 +573,7 @@ export default {
542
 	onHide() {
573
 	onHide() {
543
 		// 页面隐藏时保存状态
574
 		// 页面隐藏时保存状态
544
 		this.savePageState();
575
 		this.savePageState();
545
-		
576
+
546
 		// 移除事件监听器
577
 		// 移除事件监听器
547
 		if (this.updateListener) {
578
 		if (this.updateListener) {
548
 			uni.$off('warehouse-data-updated', null);
579
 			uni.$off('warehouse-data-updated', null);

+ 2 - 1
store/getters.js

@@ -16,6 +16,7 @@ const getters = {
16
   dialing : (state) => state.app.dialing,
16
   dialing : (state) => state.app.dialing,
17
   permissions: (state) => state.user.permissions,
17
   permissions: (state) => state.user.permissions,
18
   roles: (state) => state.user.userInfo.roles || [],
18
   roles: (state) => state.user.userInfo.roles || [],
19
-  warehouseFieldPermissions: (state) => state.user.warehouseFieldPermissions || []
19
+  warehouseFieldPermissions: (state) => state.user.warehouseFieldPermissions || [],
20
+  warehouseButtonPermissions: (state) => state.user.warehouseButtonPermissions || []
20
 }
21
 }
21
 export default getters
22
 export default getters

+ 11 - 0
store/modules/user.js

@@ -47,6 +47,7 @@ export default {
47
 		currentRoleIndex: 0, // 当前选中的角色索引
47
 		currentRoleIndex: 0, // 当前选中的角色索引
48
 		showRoleSwitch: false, // 是否显示切换权限按钮
48
 		showRoleSwitch: false, // 是否显示切换权限按钮
49
 		warehouseFieldPermissions: [], // 仓库字段权限 [{ fieldName, read, edit }, ...],登录后按当前用户角色合并
49
 		warehouseFieldPermissions: [], // 仓库字段权限 [{ fieldName, read, edit }, ...],登录后按当前用户角色合并
50
+		warehouseButtonPermissions: [], // 仓库按钮权限 
50
 	},
51
 	},
51
 	mutations: {
52
 	mutations: {
52
 		SET_REDIRECTURL(state, data) {
53
 		SET_REDIRECTURL(state, data) {
@@ -177,6 +178,9 @@ export default {
177
 		SET_WAREHOUSE_FIELD_PERMISSIONS: (state, list) => {
178
 		SET_WAREHOUSE_FIELD_PERMISSIONS: (state, list) => {
178
 			state.warehouseFieldPermissions = Array.isArray(list) ? list : [];
179
 			state.warehouseFieldPermissions = Array.isArray(list) ? list : [];
179
 		},
180
 		},
181
+		SET_WAREHOUSE_BUTTON_PERMISSIONS: (state, list) => {
182
+			state.warehouseButtonPermissions = Array.isArray(list) ? list : [];
183
+		},
180
 		SWITCH_ROLE({}, role) {
184
 		SWITCH_ROLE({}, role) {
181
 			setTimeout(() => {
185
 			setTimeout(() => {
182
 				const allIndices = [0, 1, 2, 3, 4, 5, 6];
186
 				const allIndices = [0, 1, 2, 3, 4, 5, 6];
@@ -233,6 +237,13 @@ export default {
233
 					}).catch(() => {
237
 					}).catch(() => {
234
 						commit("SET_WAREHOUSE_FIELD_PERMISSIONS", []);
238
 						commit("SET_WAREHOUSE_FIELD_PERMISSIONS", []);
235
 					});
239
 					});
240
+					// 登录后拉取仓库按钮权限并存到 store(按当前用户角色合并)
241
+					uni.$u.api.wareHouseButtonPermissions({}).then((permRes) => {
242
+						const list = (permRes && permRes.data && Array.isArray(permRes.data)) ? permRes.data : [];
243
+						commit("SET_WAREHOUSE_BUTTON_PERMISSIONS", list);
244
+					}).catch(() => {
245
+						commit("SET_WAREHOUSE_BUTTON_PERMISSIONS", []);
246
+					});
236
 					commit("SET_BELONGSYSTEM", {
247
 					commit("SET_BELONGSYSTEM", {
237
 						code: state.system.value,
248
 						code: state.system.value,
238
 						callback: (flag) => {
249
 						callback: (flag) => {

+ 9 - 0
utils/util.js

@@ -414,3 +414,12 @@ export function getWarehouseFieldPermissions(field,permission) {
414
     const permissionItem = store.state.user.warehouseFieldPermissions?.find(item=>item.fieldName === field);
414
     const permissionItem = store.state.user.warehouseFieldPermissions?.find(item=>item.fieldName === field);
415
     return permissionItem ? permissionItem[permission] : false;
415
     return permissionItem ? permissionItem[permission] : false;
416
 }
416
 }
417
+export function getWarehouseButtonPermissions(buttonKey) {
418
+    const permissionItem = store.state.user.warehouseButtonPermissions?.find(item=>item.buttonKey === buttonKey);
419
+	console.log(permissionItem)
420
+	if(!permissionItem.enabled){
421
+		uni.$u.toast('无权限');
422
+	}else{
423
+		return true
424
+	}
425
+}