瀏覽代碼

fix(bugs): 修改问题

tangning 3 年之前
父節點
當前提交
a07d216a52

+ 1 - 1
src/locales/lang/zh-CN/routes/devices.ts

@@ -45,7 +45,7 @@ export default {
   bindErr: '账号已被该企业绑定',
   excess: '账号数量已满!',
   unbindWarning: '确定要解绑该账号?',
-  addeduser: '已添加员工',
+  addeduser: '已添加员工',
   num: '设备数量',
   subNum: '可添加员工总数',
 

+ 1 - 0
src/locales/lang/zh-CN/routes/rightsEnterprises.ts

@@ -39,5 +39,6 @@ export default {
   },
   addcamera: '新增相机权益',
   maxlength: '请输入合理的数量!',
+  integer: '权益数应为正整数!',
   cameraTitle: '相机权益',
 };

+ 1 - 0
src/locales/lang/zh-CN/routes/staff.ts

@@ -4,6 +4,7 @@ export default {
   nickName: '员工昵称',
   setpaswd: '修改密码',
   mobile: '手机',
+  permList: '权益',
   createTime: '创建时间',
   staffList: '员工列表',
   updateBtn: '修改密码',

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

@@ -224,6 +224,24 @@ export const useUserStore = defineStore({
       }
       return (intersection(value, roleList) as RoleEnum[]).length > 0;
     },
+
+    getEquity(value): boolean {
+      //拍摄1  带看 2
+      function isContained(a, b) {
+        if (!(a instanceof Array) || !(b instanceof Array)) return false;
+        if (a.length < b.length) return false;
+        const aStr = a.toString();
+        for (let i = 0, len = b.length; i < len; i++) {
+          if (aStr.indexOf(b[i]) == -1) return false;
+        }
+        return true;
+      }
+      if (value.isArray) {
+        return isContained(this.permList, value);
+      } else {
+        return isContained(this.permList, [value]);
+      }
+    },
   },
 });
 

+ 40 - 0
src/views/advertisement/schemas.ts

@@ -63,11 +63,31 @@ export const padsSchemas: FormSchema[] = [
     label: '排序',
     defaultValue: 0,
     componentProps: {
+      maxLength: 5,
       placeholder: '推荐排序',
       type: 'number',
       min: 0,
     },
     required: true,
+    rules: [
+      {
+        required: true,
+        // @ts-ignore
+        validator: async (rule, value) => {
+          const regPos = /(^[1-9]\d*$)/; // 非负整数
+          // var reg = /\S+@\S+\.\S+/;
+          if (!value) {
+            return Promise.reject('请输入排序数');
+          }
+          if (!regPos.test(value)) {
+            /* eslint-disable-next-line */
+            return Promise.reject('请输入正确的排序数');
+          }
+          return Promise.resolve();
+        },
+        trigger: 'change',
+      },
+    ],
   },
   // {
   //   field: 'connectId',
@@ -118,11 +138,31 @@ export const schemas: FormSchema[] = [
     label: '轮播排序',
     defaultValue: 0,
     componentProps: {
+      maxLength: 5,
       placeholder: '轮播排序',
       type: 'number',
       min: 0,
     },
     required: true,
+    rules: [
+      {
+        required: true,
+        // @ts-ignore
+        validator: async (rule, value) => {
+          const regPos = /(^[1-9]\d*$)/; // 非负整数
+          // var reg = /\S+@\S+\.\S+/;
+          if (!value) {
+            return Promise.reject('请输入排序数');
+          }
+          if (!regPos.test(value)) {
+            /* eslint-disable-next-line */
+            return Promise.reject('请输入正确的排序数');
+          }
+          return Promise.resolve();
+        },
+        trigger: 'change',
+      },
+    ],
   },
   // {
   //   field: 'url',

+ 1 - 1
src/views/corporation/SubaccountModal.vue

@@ -257,7 +257,7 @@
         // },
         {
           field: 'addeduser',
-          label: `${t('routes.devices.addeduser')}`,
+          label: ` `,
           labelWidth: 200,
           slot: 'addeduser',
           component: 'Input',

+ 14 - 2
src/views/product/list.data.ts

@@ -7,7 +7,7 @@ import { useMessage } from '/@/hooks/web/useMessage';
 import { useI18n } from '/@/hooks/web/useI18n';
 import { useUserStore } from '/@/store/modules/user';
 const userStore = useUserStore();
-const { getCheckRole } = userStore;
+const { getCheckRole, getEquity } = userStore;
 export const searchForm: Partial<FormProps> = {
   labelWidth: 100,
   schemas: [
@@ -140,8 +140,20 @@ export const columns: BasicColumn[] = [
     title: '操作',
     dataIndex: '',
     slots: { customRender: 'action' },
-    ifShow: !getCheckRole('tourist'),
+    ifShow: showAction,
     fixed: 'right',
     width: 120,
   },
 ];
+function showAction(): boolean {
+  if (getCheckRole(['staff']) && getEquity([1, 2])) {
+    return true;
+  }
+  if (getCheckRole(['company_admin']) && getEquity([1])) {
+    return true;
+  }
+  if (getCheckRole(['super', 'plat_admin', 'company_admin'])) {
+    return true;
+  }
+  return false;
+}

+ 14 - 1
src/views/product/list.vue

@@ -90,7 +90,7 @@
       const { t } = useI18n();
       const [registerDrawer, { openDrawer }] = useDrawer();
       const userStore = useUserStore();
-      const { getCheckRole } = userStore;
+      const { getCheckRole, getEquity } = userStore;
       const [registerTable, { reload, getSelectRowKeys }] = useTable({
         title: '商品列表',
         api: ListApi,
@@ -175,8 +175,21 @@
           nextTick(reload);
         }
       }
+      function showAction(): boolean {
+        if (getCheckRole(['staff']) && getEquity([1, 2])) {
+          return true;
+        }
+        if (getCheckRole(['company_admin']) && getEquity([1])) {
+          return true;
+        }
+        if (getCheckRole(['super', 'plat_admin', 'company_admin'])) {
+          return true;
+        }
+        return false;
+      }
       return {
         registerTable,
+        showAction,
         createMessage,
         t,
         go,

+ 19 - 0
src/views/rightsEnterprises/addCameraModal.vue

@@ -107,6 +107,25 @@
           componentProps: {
             maxLength: 3,
           },
+          rules: [
+            {
+              required: true,
+              // @ts-ignore
+              validator: async (rule, value) => {
+                var regPos = /(^[1-9]\d*$)/; // 非负整数
+                // var reg = /\S+@\S+\.\S+/;
+                if (!value) {
+                  return Promise.reject('请输入权益数');
+                }
+                if (!regPos.test(value)) {
+                  /* eslint-disable-next-line */
+                  return Promise.reject('请输入正确的权益数');
+                }
+                return Promise.resolve();
+              },
+              trigger: 'change',
+            },
+          ],
         },
         {
           field: 'incrementEndTime',

+ 4 - 1
src/views/rightsEnterprises/addModal.vue

@@ -80,8 +80,11 @@
           edit: true,
           // slots: { customRender: 'subNum' },
           editRule: async (text) => {
+            var regPos = /(^[1-9]\d*$)/; // 非负整数
             if (text > 999 || text < -1) {
               return t('routes.rightsEnterprises.maxlength');
+            } else if (!regPos.test(text)) {
+              return t('routes.rightsEnterprises.integer');
             }
             return '';
           },
@@ -139,7 +142,7 @@
         },
         columns,
         bordered: true,
-        // pagination: false,
+        pagination: false,
       });
 
       const [register, { closeModal }] = useModalInner((data) => {

+ 7 - 7
src/views/rightsEnterprises/camera.vue

@@ -235,13 +235,13 @@
         openModal(true, modelRef);
       }
       function handleCreate() {
-        if (
-          getCheckRole([RoleEnum.COMPANY_ADMIN]) &&
-          surplusSubNum.value.lookNum == 0 &&
-          surplusSubNum.value.shotNum == 0
-        ) {
-          return createMessage.error('新增失败,可添加员工数量为0个');
-        }
+        // if (
+        //   getCheckRole([RoleEnum.COMPANY_ADMIN]) &&
+        //   surplusSubNum.value.lookNum == 0 &&
+        //   surplusSubNum.value.shotNum == 0
+        // ) {
+        //   return createMessage.error('新增失败,可添加员工数量为0个');
+        // }
         openDetaileModal(true, {});
       }
       function handleEdit(record: Recordable) {

+ 7 - 7
src/views/rightsEnterprises/list.vue

@@ -250,13 +250,13 @@
         });
       }
       function handleCreate() {
-        if (
-          getCheckRole([RoleEnum.COMPANY_ADMIN]) &&
-          surplusSubNum.value.lookNum == 0 &&
-          surplusSubNum.value.shotNum == 0
-        ) {
-          return createMessage.error('新增失败,可添加员工数量为0个');
-        }
+        // if (
+        //   getCheckRole([RoleEnum.COMPANY_ADMIN]) &&
+        //   surplusSubNum.value.lookNum == 0 &&
+        //   surplusSubNum.value.shotNum == 0
+        // ) {
+        //   return createMessage.error('新增失败,可添加员工数量为0个');
+        // }
         openDetaileModal(true, {});
       }
       function handleEdit(record: Recordable) {

+ 7 - 7
src/views/rightsEnterprises/staff.vue

@@ -226,13 +226,13 @@
         openModal(true, record);
       }
       function handleCreate() {
-        if (
-          getCheckRole([RoleEnum.COMPANY_ADMIN]) &&
-          surplusSubNum.value.lookNum == 0 &&
-          surplusSubNum.value.shotNum == 0
-        ) {
-          return createMessage.error('新增失败,可添加员工数量为0个');
-        }
+        // if (
+        //   getCheckRole([RoleEnum.COMPANY_ADMIN]) &&
+        //   surplusSubNum.value.lookNum == 0 &&
+        //   surplusSubNum.value.shotNum == 0
+        // ) {
+        //   return createMessage.error('新增失败,可添加员工数量为0个');
+        // }
         openDetaileModal(true, {});
       }
       function handleEdit(record: Recordable) {

+ 4 - 3
src/views/scenes/list.vue

@@ -42,7 +42,7 @@
                   {
                     color: 'error',
                     label: t('routes.scenes.makeLiveCover'),
-                    ifShow: record.lived !== true,
+                    ifShow: record.lived !== true && getEquity([1, 2]),
                     onClick: generateDefaultLiveRoom.bind(null, record),
                   },
                 ]
@@ -96,7 +96,7 @@
       const [registerEditorModal, { openModal: openEditorModal }] = useModal();
       const { t } = useI18n();
       const userStore = useUserStore();
-      const { getCheckRole } = userStore;
+      const { getCheckRole, getEquity } = userStore;
       const columns: BasicColumn[] = [
         {
           title: 'ID',
@@ -182,7 +182,7 @@
           title: t('common.operation'),
           dataIndex: '',
           slots: { customRender: 'action' },
-          ifShow: !getCheckRole('tourist'),
+          ifShow: !getCheckRole('tourist') && getEquity(1),
           width: 330,
           fixed: 'right',
         },
@@ -318,6 +318,7 @@
         registerDownloadModal,
         generateDefaultLiveRoom,
         openSceneEditorModal,
+        getEquity,
       };
     },
   });

+ 28 - 23
src/views/scenes/live.vue

@@ -4,7 +4,7 @@
       <template #toolbar>
         <a-button
           type="primary"
-          v-show="!getCheckRole(['host', 'tourist', 'company_viewer']) && permList.includes(1)"
+          v-show="!getCheckRole(['host', 'tourist', 'company_viewer']) && getEquity([1, 2])"
           @click="handleAddLiveScene"
         >
           新增</a-button
@@ -25,26 +25,30 @@
 
       <template #action="{ record }">
         <TableAction
-          :actions="[
-            {
-              label: t('routes.scenes.bindAnchor'),
-              color: 'success',
-              onClick: handleBindAnchor.bind(null, record),
-            },
-            {
-              color: 'warning',
-              label: '编辑',
-              onClick: handleEditLiveScene.bind(null, record),
-            },
-            {
-              color: 'error',
-              label: '删除',
-              popConfirm: {
-                title: '是否确认删除',
-                confirm: handleDeleteLiveScene.bind(null, record),
-              },
-            },
-          ]"
+          :actions="
+            permList.includes(2)
+              ? [
+                  {
+                    label: t('routes.scenes.bindAnchor'),
+                    color: 'success',
+                    onClick: handleBindAnchor.bind(null, record),
+                  },
+                  {
+                    color: 'warning',
+                    label: '编辑',
+                    onClick: handleEditLiveScene.bind(null, record),
+                  },
+                  {
+                    color: 'error',
+                    label: '删除',
+                    popConfirm: {
+                      title: '是否确认删除',
+                      confirm: handleDeleteLiveScene.bind(null, record),
+                    },
+                  },
+                ]
+              : []
+          "
         />
       </template>
     </BasicTable>
@@ -81,7 +85,7 @@
     setup() {
       const { createMessage } = useMessage();
       const userStore = useUserStore();
-      const { getCheckRole } = userStore;
+      const { getCheckRole, getEquity } = userStore;
       const { t } = useI18n();
       const [registerBindModal, { openModal: openBindModal }] = useModal();
 
@@ -153,7 +157,7 @@
           title: t('common.operation'),
           dataIndex: '',
           slots: { customRender: 'action' },
-          ifShow: !getCheckRole(['host', 'tourist']),
+          ifShow: !getCheckRole(['host', 'tourist']) && getEquity(2),
           width: 220,
           fixed: 'right',
         },
@@ -305,6 +309,7 @@
         handleDeleteLiveScene,
         handleEditLiveScene,
         getCheckRole,
+        getEquity,
       };
     },
   });

+ 2 - 2
src/views/staff/detailsModal.vue

@@ -247,7 +247,7 @@
             field: 'roleId',
             component: 'ApiSelect',
             componentProps: {
-              disabled: data.id ? getCheckRole('plat_admin') : false,
+              disabled: data.roleId == 2 ? false : data.id ? getCheckRole('plat_admin') : false,
               api: getRoleListByParam,
               labelField: 'roleName',
               valueField: 'roleId',
@@ -272,7 +272,7 @@
           {
             field: 'permList',
             componentProps: {
-              disabled: data.id ? true : false,
+              disabled: data.roleId == 2 ? false : data.id ? true : false,
               params: {
                 companyId: data.companyId || companyId,
               },

+ 17 - 14
src/views/staff/list.vue

@@ -136,13 +136,16 @@
           sorter: true,
           width: 80,
         },
-        // {
-        //   title: t('common.state'),
-        //   dataIndex: 'status',
-        //   slots: { customRender: 'status' },
-        //   // sorter: true,
-        //   width: 80,
-        // },
+        {
+          title: t('routes.staff.permList'),
+          dataIndex: 'permList',
+          // slots: { customRender: 'status' },
+          // sorter: true,
+          width: 80,
+          customRender: ({ record }) => {
+            return record.permList && record.permList.join();
+          },
+        },
 
         {
           title: t('routes.staff.createTime'),
@@ -236,13 +239,13 @@
         openModal(true, record);
       }
       function handleCreate() {
-        if (
-          getCheckRole([RoleEnum.COMPANY_ADMIN]) &&
-          surplusSubNum.value.lookNum == 0 &&
-          surplusSubNum.value.shotNum == 0
-        ) {
-          return createMessage.error('新增失败,可添加员工数量为0个');
-        }
+        // if (
+        //   getCheckRole([RoleEnum.COMPANY_ADMIN]) &&
+        //   surplusSubNum.value.lookNum == 0 &&
+        //   surplusSubNum.value.shotNum == 0
+        // ) {
+        //   return createMessage.error('新增失败,可添加员工数量为0个');
+        // }
         openDetaileModal(true, {});
       }
       function handleEdit(record: Recordable) {