Ver código fonte

feat(stff): roles

gemercheung 3 anos atrás
pai
commit
937f8c268b

+ 1 - 1
src/api/corporation/list.ts

@@ -5,7 +5,7 @@ import { Result, UploadFileParams } from '/#/axios';
 
 enum Api {
   selectCompanyNum = '/zfb-api/zfb/company/selectCompanyNum',
-  listAllCompany = '/zfb-api/zfb/company/listAll',
+  listAllCompany = '/zfb-api/zfb/company/getListAll',
   selectCompanyByType = '/zfb-api/zfb/company/selectCompanyByType',
   uploadLogo = '/zfb-api/zfb/company/uploadLogo',
 }

+ 16 - 85
src/views/scenes/bindModal.vue

@@ -17,96 +17,26 @@
   import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
   // import { useMessage } from '/@/hooks/web/useMessage';
   // import { checkUserAddAble } from '/@/api/corporation/modal';
-  import { useI18n } from '/@/hooks/web/useI18n';
-  // import { bindAnchorListApi } from '/@/api/scene/live';
+  // import { useI18n } from '/@/hooks/web/useI18n';
+  import { bindAnchorListApi } from '/@/api/scene/live';
 
-  const { t } = useI18n();
+  // const { t } = useI18n();
   const schemas: FormSchema[] = [
     {
       field: 'own',
-      component: 'Input',
-      label: t('routes.devices.own'),
-      colProps: {
-        span: 24,
-      },
+      label: '主播选择:',
+      component: 'ApiSelect',
       componentProps: {
-        options: [
-          {
-            label: '全部',
-            value: '1',
-            key: '1',
-          },
-          {
-            label: '正常',
-            value: '2',
-            key: '2',
-          },
-          {
-            label: '已关闭',
-            value: '2',
-            key: '2',
-          },
-        ],
-      },
-      required: true,
-    },
-    {
-      field: 'cameraType',
-      component: 'Select',
-      label: t('routes.devices.cameraType'),
-      required: true,
-      colProps: {
-        span: 24,
-      },
-    },
-    {
-      field: 'childName',
-      component: 'Input',
-      label: t('routes.devices.childName'),
-      required: true,
-      colProps: {
-        span: 24,
-      },
-    },
-    {
-      field: 'wifiName',
-      component: 'Input',
-      label: t('routes.devices.wifiName'),
-      colProps: {
-        span: 24,
-      },
-    },
-    {
-      field: 'address',
-      component: 'Input',
-      label: t('routes.devices.address'),
-      colProps: {
-        span: 24,
-      },
-    },
-    {
-      field: 'balance',
-      component: 'Input',
-      label: t('routes.devices.balance'),
-      colProps: {
-        span: 24,
-      },
-    },
-    {
-      field: 'orderSn',
-      component: 'Input',
-      label: t('routes.devices.orderSn'),
-      colProps: {
-        span: 24,
-      },
-      required: true,
-    },
-    {
-      field: 'companyId',
-      component: 'Input',
-      label: t('routes.devices.companyId'),
-      colProps: {
-        span: 24,
+        api: bindAnchorListApi,
+        // resultField: 'list',
+        numberToString: true,
+        labelField: 'name',
+        valueField: 'id',
+        immediate: true,
+        params: {
+          page: 1,
+          limit: 1000,
+        },
       },
     },
   ];
@@ -128,6 +58,7 @@
       ] = useForm({
         labelWidth: 120,
         schemas,
+        // api: bindAnchorListApi,
         showActionButtonGroup: false,
         actionColOptions: {
           span: 24,

+ 6 - 0
src/views/staff/list.vue

@@ -133,6 +133,12 @@
         rowKey: 'id',
         pagination: { pageSize: 20 },
         bordered: true,
+        fetchSetting: {
+          pageField: 'pageNum',
+          sizeField: 'pageSize',
+          listField: 'list',
+          totalField: 'totalCount',
+        },
       });
 
       function renderRoleType(type: number): string {

+ 8 - 2
src/views/system/role/RoleDrawer.vue

@@ -38,7 +38,7 @@
     setup(_, { emit }) {
       const isUpdate = ref(true);
       const treeData = ref<TreeMenuNode[]>([]);
-
+      const roleId = ref(0);
       const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
         labelWidth: 90,
         schemas: formSchema,
@@ -57,6 +57,7 @@
         isUpdate.value = !!data?.isUpdate;
 
         if (unref(isUpdate)) {
+          roleId.value = data.record.roleId;
           setFieldsValue({
             ...data.record,
           });
@@ -69,11 +70,16 @@
         try {
           const values = await validate();
           setDrawerProps({ confirmLoading: true });
-          // TODO custom api
+
+          //TODO hardcode 转变companyIdList backend request
+          if ('companyId' in values) {
+            values.companyIdList = [values.companyId];
+          }
           let result;
           if (!unref(isUpdate)) {
             result = await saveRoleApi(values);
           } else {
+            values.roleId = roleId.value;
             result = await updateRoleApi(values);
           }
 

+ 7 - 6
src/views/system/role/role.data.ts

@@ -18,14 +18,14 @@ export const columns: BasicColumn[] = [
   },
   {
     title: '所属部门',
-    dataIndex: 'deptName',
+    dataIndex: 'companyName',
     width: 180,
   },
-  {
-    title: '排序',
-    dataIndex: 'orderNo',
-    width: 50,
-  },
+  // {
+  //   title: '显示',
+  //   dataIndex: 'canShow',
+  //   width: 50,
+  // },
   {
     title: '状态',
     dataIndex: 'canShow',
@@ -107,6 +107,7 @@ export const formSchema: FormSchema[] = [
     field: 'companyId',
     label: '公司',
     component: 'ApiSelect',
+    required: true,
     componentProps: {
       api: ListAllCompanyApi,
       resultField: 'list',