ソースを参照

fix(bugs): 更新多个权限控制

tangning 3 年 前
コミット
9cc2ce44ce

+ 7 - 8
src/directives/permission.ts

@@ -31,17 +31,16 @@ const mounted = (el: Element, binding: DirectiveBinding<any>) => {
 const powermounted = (el: Element, binding: DirectiveBinding<any>) => {
   isPower(el, binding);
 };
-const authDirective: Directive = (val) => {
-  if (val) {
-    return powermounted;
-  } else {
-    return mounted;
-  }
-};
 
+const powerDirective: Directive = {
+  mounted: powermounted,
+};
+const authDirective: Directive = {
+  mounted,
+};
 export function setupPermissionDirective(app: App) {
   app.directive('auth', authDirective);
-  app.directive('power', authDirective);
+  app.directive('power', powerDirective);
 }
 
 export default authDirective;

+ 9 - 0
src/store/modules/user.ts

@@ -68,6 +68,7 @@ export const useUserStore = defineStore({
     },
     setRoleList(roleList: RoleEnum[]) {
       this.roleList = roleList;
+      console.log('setRoleList', roleList);
       setAuthCache(ROLES_KEY, roleList);
     },
     setUserInfo(info: UserInfo | null) {
@@ -203,6 +204,14 @@ export const useUserStore = defineStore({
       if (!isArray(value)) {
         return roleList?.includes(value as RoleEnum);
       }
+      console.log(
+        (intersection(value, roleList) as RoleEnum[]).length > 0,
+        'intersection(value, roleList)',
+        intersection(value, roleList),
+        'value, roleList',
+        value,
+        roleList,
+      );
       return (intersection(value, roleList) as RoleEnum[]).length > 0;
     },
   },

+ 7 - 1
src/views/advertisement/listDrawer.vue

@@ -1,5 +1,11 @@
 <template>
-  <BasicDrawer v-bind="$attrs" width="50%" :title="getTitle" @register="registerDrawer">
+  <BasicDrawer
+    v-bind="$attrs"
+    width="50%"
+    :showDetailBack="false"
+    :title="getTitle"
+    @register="registerDrawer"
+  >
     <BasicForm @register="registerForm" />
   </BasicDrawer>
 </template>

+ 2 - 2
src/views/advertisement/pads.vue

@@ -72,8 +72,8 @@
         },
         {
           title: '链接',
-          dataIndex: 'liveRoomUrl',
-          width: 260,
+          dataIndex: 'sceneUrl',
+          width: 300,
         },
         {
           title: '编辑时间',

+ 7 - 1
src/views/advertisement/padsDrawer.vue

@@ -1,5 +1,11 @@
 <template>
-  <BasicDrawer v-bind="$attrs" width="50%" :title="getTitle" @register="registerDrawer">
+  <BasicDrawer
+    v-bind="$attrs"
+    width="50%"
+    :showDetailBack="false"
+    :title="getTitle"
+    @register="registerDrawer"
+  >
     <BasicForm @register="registerForm" />
   </BasicDrawer>
 </template>

+ 1 - 1
src/views/advertisement/schemas.ts

@@ -103,7 +103,7 @@ export const schemas: FormSchema[] = [
     required: true,
   },
   {
-    field: 'link',
+    field: 'url',
     component: 'Input',
     label: '链接',
     componentProps: {

+ 18 - 0
src/views/product/category.vue

@@ -104,6 +104,24 @@
         columns: columns,
         isTreeTable: true,
         useSearchForm: true,
+        formConfig: {
+          labelWidth: 100,
+          schemas: [
+            {
+              field: 'name',
+              label: '分类名称',
+              component: 'Input',
+              componentProps: {
+                placeholder: '请输入分类名称',
+                maxLength: 100,
+              },
+              colProps: {
+                xl: 6,
+                xxl: 6,
+              },
+            },
+          ],
+        },
         showTableSetting: true,
         tableSetting: { fullScreen: true },
         showIndexColumn: true,

+ 22 - 19
src/views/product/drawer.data.ts

@@ -26,15 +26,15 @@ export const formSchema: FormSchema[] = [
       },
     },
   },
-  {
-    field: 'goodsSn',
-    label: '序列号',
-    component: 'Input',
-    required: true,
-    componentProps: {
-      maxLength: 3,
-    },
-  },
+  // {
+  //   field: 'goodsSn',
+  //   label: '序列号',
+  //   component: 'Input',
+  //   required: true,
+  //   componentProps: {
+  //     maxLength: 3,
+  //   },
+  // },
   {
     field: 'name',
     label: '商品名称',
@@ -44,19 +44,22 @@ export const formSchema: FormSchema[] = [
       maxLength: 25,
     },
   },
-  {
-    field: 'goodsSimpleDesc',
-    label: '商品描述',
-    component: 'Input',
-    required: true,
-    componentProps: {
-      maxLength: 200,
-    },
-  },
+  // {
+  //   field: 'goodsSimpleDesc',
+  //   label: '商品描述',
+  //   component: 'Input',
+  //   required: true,
+  //   componentProps: {
+  //     maxLength: 200,
+  //   },
+  // },
   {
     field: 'brandId',
-    label: '直播间',
+    label: '直播间名称',
     component: 'ApiSelect',
+    itemProps: {
+      validateTrigger: 'blur',
+    },
     componentProps: {
       api: BrandListApi,
       labelField: 'name',

+ 21 - 20
src/views/product/goodsSpecs.vue

@@ -88,7 +88,7 @@
         let parentList: FormSchema[] = [
           {
             field: 'name_' + number,
-            label: '规格名',
+            label: '商品属性',
             component: 'ApiTreeSelect',
             colProps: {
               span: 18,
@@ -196,28 +196,29 @@
         //初始化组装数据
         let goodsgg = [],
           setVlaue: {};
-        if (props.editdata.guigeArr) {
-          let guigeArr = JSON.parse(props.editdata.guigeArr);
+        console.log('ele', props.editdata);
+        if (props.editdata.goodsSpecificationList) {
+          let guigeArr = props.editdata.goodsSpecificationList;
           guigeArr.map((ele, index) => {
             console.log('ele', ele);
             if (index == 0) {
-              if (ele.val.length == 1) {
-                //不需要新增form item 可直接赋值
-                setVlaue = {
-                  ...setVlaue,
-                  name_1: ele.specificationId,
-                  goodsSn_1_1: ele.val[0].name,
-                  picUrl_1_1: [ele.val[0].picUrl],
-                };
-              } else {
-                //新增一个属性值item
-                setVlaue[`name_${index}`] = ele.specificationId;
-                for (var valIndex = 1; valIndex < ele.val.length; valIndex++) {
-                  addBut(`add_${valIndex}`);
-                  setVlaue[`goodsSn_${index}_${valIndex}`] = ele.val[valIndex].name;
-                  // setVlaue[`picUrl_${index}_${valIndex}`] = ele.val[valIndex].picUrl;
-                }
-              }
+              // if (ele.val.length == 1) {
+              //不需要新增form item 可直接赋值
+              setVlaue = {
+                ...setVlaue,
+                name_1: ele.specificationId,
+                goodsSn_1_1: ele.goodsId,
+                picUrl_1_1: [ele.picUrl],
+              };
+              // } else {
+              //   //新增一个属性值item
+              //   setVlaue[`name_${index}`] = ele.specificationId;
+              //   for (var valIndex = 1; valIndex < ele.val.length; valIndex++) {
+              //     addBut(`add_${valIndex}`);
+              //     setVlaue[`goodsSn_${index}_${valIndex}`] = ele.val[valIndex].name;
+              //     // setVlaue[`picUrl_${index}_${valIndex}`] = ele.val[valIndex].picUrl;
+              //   }
+              // }
             } else {
               setVlaue[`name_${index}`] = ele.specificationId;
               for (var valIndex = 1; valIndex < ele.val.length; valIndex++) {

+ 1 - 0
src/views/product/productDrawer.vue

@@ -3,6 +3,7 @@
     v-bind="$attrs"
     @register="registerDrawer"
     :isDetail="true"
+    :showDetailBack="false"
     showFooter
     :title="getTitle"
     @ok="handleSubmit"

+ 1 - 0
src/views/scenes/liveDrawer.vue

@@ -4,6 +4,7 @@
     @register="registerDrawer"
     showFooter
     :title="getTitle"
+    :showDetailBack="false"
     width="60%"
     @ok="handleSubmit"
     @close="handleClose"

+ 3 - 1
src/views/staff/list.vue

@@ -6,7 +6,7 @@
           >新增</a-button
         >
       </template>
-      <template #headerTop>
+      <template #headerTop v-if="getCheckRole([RoleEnum.COMPANY_ADMIN])">
         <Alert :message="`可添加员工数为${surplusSubNum}人`" type="info" />
       </template>
       <template #role="{ record }">
@@ -86,6 +86,7 @@
       const [registerDelList, { openModal: openDelListeModal }] = useModal();
       const { createConfirm, createMessage } = useMessage();
       const userStore = useUserStore();
+      const { getCheckRole } = userStore;
       const roleList = computed(() => userStore.getRoleList);
       console.log('getRoleList', roleList);
       const go = useGo();
@@ -266,6 +267,7 @@
         uploadApi: uploadApi as any,
         RoleEnum,
         surplusSubNum,
+        getCheckRole,
       };
     },
   });

+ 3 - 1
src/views/system/account/index.vue

@@ -19,12 +19,14 @@
             // },
             {
               icon: 'clarity:note-edit-line',
+              label: '编辑',
               tooltip: '编辑用户资料',
               onClick: handleEdit.bind(null, record),
             },
             {
               icon: 'ant-design:delete-outlined',
               color: 'error',
+              label: '删除',
               tooltip: '删除此账号',
               popConfirm: {
                 title: '是否确认删除',
@@ -84,7 +86,7 @@
           return info;
         },
         actionColumn: {
-          width: 120,
+          width: 140,
           title: '操作',
           dataIndex: 'action',
           slots: { customRender: 'action' },

+ 1 - 0
src/views/system/menu/MenuDrawer.vue

@@ -3,6 +3,7 @@
     v-bind="$attrs"
     @register="registerDrawer"
     showFooter
+    :showDetailBack="false"
     :title="getTitle"
     width="50%"
     @ok="handleSubmit"

+ 1 - 0
src/views/system/role/RoleDrawer.vue

@@ -3,6 +3,7 @@
     v-bind="$attrs"
     @register="registerDrawer"
     showFooter
+    :showDetailBack="false"
     :title="getTitle"
     width="500px"
     @ok="handleSubmit"

+ 3 - 1
src/views/system/role/index.vue

@@ -9,10 +9,12 @@
           :actions="[
             {
               icon: 'clarity:note-edit-line',
+              label: '编辑',
               onClick: handleEdit.bind(null, record),
             },
             {
               icon: 'ant-design:delete-outlined',
+              label: '删除',
               color: 'error',
               popConfirm: {
                 title: '是否确认删除',
@@ -54,7 +56,7 @@
         bordered: true,
         showIndexColumn: false,
         actionColumn: {
-          width: 80,
+          width: 130,
           title: '操作',
           dataIndex: 'action',
           slots: { customRender: 'action' },