Przeglądaj źródła

feat: 商机增加数据权限

lanjianrong 5 lat temu
rodzic
commit
b5d5b32040
1 zmienionych plików z 18 dodań i 7 usunięć
  1. 18 7
      src/pages/Customer/Business/index.jsx

+ 18 - 7
src/pages/Customer/Business/index.jsx

@@ -11,12 +11,12 @@ import { useTableScroll } from '@/hooks/useAutoTable'
 import CompanyDetail from '../Company/components/CompanyDetail'
 import { Funnel } from '@ant-design/charts'
 
-const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
+const Business = ({ dispatch, groupList, shouldUpdate, permData, loading }) => {
   const tRef = useRef(null)
   const { toggleDrawer, setDrawerProps } = useModal()
   const [state, setState] = useState({
     orderIds: [],
-    businessGroupId: null,
+    params: { businessGroupId: null },
     funnelData: []
   })
   useEffect(() => {
@@ -29,7 +29,7 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
       const group = groupList[0]
       setState({
         ...state,
-        businessGroupId: group.value,
+        params: { ...state.params, businessGroupId: group.value },
         funnelData: group.items
           ?.filter(item => !item.endProcess)
           ?.map(item => ({ ...item, percentage: parseInt(item.percentage, 10) }))
@@ -161,11 +161,11 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
       </div>
       <div className="w-17/20">
         <div className="ml-8 bg-white shadow-card">
-          {state.businessGroupId ? (
+          {state.params.businessGroupId ? (
             <ProTable
               bordered
               actionRef={tRef}
-              params={{ businessGroupId: state.businessGroupId }}
+              params={state.params}
               rowKey={record => record.id}
               columns={columns}
               onLoadingChange={loadingStatus => {
@@ -184,6 +184,16 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
                   total
                 }
               }}
+              headerTitle={
+                <Select
+                  defaultValue="oneself"
+                  dropdownMatchSelectWidth={false}
+                  onChange={e => {
+                    setState({ ...state, params: { ...state.params, dataPermission: e } })
+                  }}
+                  options={permData?.customer || []}
+                />
+              }
               search={false}
               toolbar={{
                 actions: [
@@ -202,8 +212,9 @@ const Business = ({ dispatch, groupList, shouldUpdate, loading }) => {
   )
 }
 
-export default connect(({ business, refresh, loading }) => ({
+export default connect(({ business, refresh, global, loading }) => ({
   groupList: business.groupList,
   loading: loading.models.business,
-  shouldUpdate: refresh.business
+  shouldUpdate: refresh.business,
+  permData: global.premData
 }))(Business)