浏览代码

feat: 大司空2.0企业版权限

outaozhen 3 年之前
父节点
当前提交
00aa8ac8af
共有 1 个文件被更改,包括 32 次插入4 次删除
  1. 32 4
      src/pages/Role/Product/index.tsx

+ 32 - 4
src/pages/Role/Product/index.tsx

@@ -57,6 +57,7 @@ const Product = () => {
         client: [],
         company: [],
         business: [],
+        enterprise: [],
         ...formatPermission('init', result.permission)
       }
       setState({
@@ -133,7 +134,8 @@ const Product = () => {
           title="确认删除吗?"
           okText="确认"
           cancelText="取消"
-          onConfirm={() => tryDeleteStaff({ id: state.id, staffId: record.staffId })}>
+          onConfirm={() => tryDeleteStaff({ id: state.id, staffId: record.staffId })}
+        >
           <div className="pl-2 text-hex-fd3995 cursor-pointer hover:text-hex-e7026e">
             <Delete />
           </div>
@@ -161,7 +163,8 @@ const Product = () => {
           <Tabs
             defaultActiveKey="1"
             type="card"
-            onChange={key => setState({ ...state, activeKey: key })}>
+            onChange={key => setState({ ...state, activeKey: key })}
+          >
             <TabPane tab="员工列表" key="1">
               <Table<API.RoleStaffListItem>
                 dataSource={state.roleStaff}
@@ -182,7 +185,8 @@ const Product = () => {
                         id: state.id
                       })
                       message.success('设置成功')
-                    }}>
+                    }}
+                  >
                     <ProFormSwitch
                       fieldProps={{
                         onChange(checked) {
@@ -215,6 +219,29 @@ const Product = () => {
                         />
                       )}
                     </ProFormDependency>
+                    <ProFormSwitch
+                      fieldProps={{
+                        onChange(checked) {
+                          if (!checked) {
+                            formRef.current?.setFieldsValue({ enterprise: [] })
+                          }
+                        }
+                      }}
+                      name="showEnterprise"
+                      label={<span className="flex items-center">企业版</span>}
+                    />
+                    <ProFormDependency name={['showEnterprise']}>
+                      {({ showEnterprise }) => (
+                        <ProFormCheckbox.Group
+                          wrapperCol={{ offset: 1 }}
+                          name="enterprise"
+                          options={[
+                            { value: 'access', label: '查看', disabled: !showEnterprise },
+                            { value: 'add', label: '添加企业', disabled: !showEnterprise }
+                          ]}
+                        />
+                      )}
+                    </ProFormDependency>
                   </ProForm>
                 )}
               </div>
@@ -235,7 +262,8 @@ const Product = () => {
                     }
                     message.success('设置成功')
                     return true
-                  }}>
+                  }}
+                >
                   <FormItem name="access" label="客户模块可见" required>
                     <Radio.Group>
                       <Space direction="vertical">