Handy_Cao 7 månader sedan
förälder
incheckning
3d586ccf76

+ 27 - 3
src/packages/pc/views/member/institution/operation/components/modify/index.vue

@@ -11,6 +11,15 @@
                     <el-button @click="openComponent('Roles')">查看</el-button>
                 </el-form-item>
             </fieldset>
+            <fieldset class="g-fieldset el-form--vertical">
+                <legend class="g-fieldset__legend">商品查询权限</legend>
+                <el-form-item v-for="item in data?.markets" v-bind:key="item.marketid" :label="item.marketname" prop="marketid" >
+                    <el-checkbox-group v-model="formData.goodsids">
+                        <el-checkbox v-for="goods in data?.goodsinfo.filter(e => e.marketid === item.marketid)" v-bind:key="goods.goodsid" 
+                            :label="goods.goodsname" :value="goods.goodsid"/>
+                    </el-checkbox-group>
+                </el-form-item>
+            </fieldset>
         </el-form>
         <template #footer>
             <el-button @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
@@ -25,7 +34,7 @@ import { shallowRef, PropType, ref, defineAsyncComponent, onMounted } from 'vue'
 import { ElMessage, FormInstance, FormRules } from 'element-plus'
 import { useComponent } from '@/hooks/component'
 import { i18n } from '@/stores'
-import { roleadd, initAdd } from '@/services/api/member'
+import { roleadd, initAdd, queryRoleDetail } from '@/services/api/member'
 import AppSelectMember from '@pc/components/modules/select-member/index.vue'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
 import { useRequest } from '@/hooks/request'
@@ -46,6 +55,11 @@ const formRef = ref<FormInstance>()
 const show = shallowRef(true)
 const refresh = shallowRef(false)
 
+
+const formData = ref<Partial<Member.RoleAddReq>>({
+    roleid: 2
+})
+
 const { data, loading } = useRequest(initAdd, {
     params: {
         role: 'operate'
@@ -55,8 +69,18 @@ const { data, loading } = useRequest(initAdd, {
     }
 })
 
-const formData = ref<Partial<Member.RoleAddReq>>({
-    roleid: 2
+useRequest(queryRoleDetail, {
+    params: {
+        rolename: 'operate',
+        userid: props.record?.userid
+    },
+    onSuccess: (res) => {
+        formData.value.goodsids = res.data.operategoodsinfo.map(e => e.goodsid)
+        formData.value.marketids = res.data.markets.map(e => e.marketid)
+    },
+    onError: (err) => {
+        ElMessage.error(err)
+    }
 })
 
 // 表单验证规则