lanjianrong 5 år sedan
förälder
incheckning
f8518aee92

+ 7 - 6
src/pages/Customer/Business/model.js

@@ -4,7 +4,7 @@ import { getBusinessGroupList } from '@/services/customer'
 export default {
   namespace: 'business',
   state: {
-    groupList: []
+    groupList: null
   },
   effects: {
     *fetchGroup({ payload }, { call, put }) {
@@ -14,11 +14,12 @@ export default {
           type: 'changeState',
           payload: {
             key: 'groupList',
-            data: response.data.map(item => ({
-              label: item.name,
-              value: item.id,
-              items: item.status
-            }))
+            data:
+              response.data.map(item => ({
+                label: item.name,
+                value: item.id,
+                items: item.status
+              })) || []
           }
         })
       }

+ 1 - 6
src/pages/Customer/Client/components/AddClient/index.jsx

@@ -67,7 +67,6 @@ const AddClient = props => {
           <ProFormSelect
             name="gender"
             label="性别"
-            rules={[{ required: true, message: '请选择性别' }]}
             options={[
               { label: '男', value: '男' },
               { label: '女', value: '女' }
@@ -78,11 +77,7 @@ const AddClient = props => {
             name="telephone"
             rules={[{ required: true, message: '请输入手机号码' }]}
           />
-          <ProFormText
-            label="电话"
-            name="phone"
-            rules={[{ required: true, message: '请输入电话/座机号' }]}
-          />
+          <ProFormText label="电话" name="phone" />
           <ProFormText label="联系人地址" name="address" />
           <ProFormText label="联系人地标" name="landmarks" />
         </Col>

+ 1 - 1
src/pages/Customer/Company/components/AddCompany/index.jsx

@@ -79,7 +79,7 @@ const AddCompanyModal = ({ dataId, dataType, onConfirm, dispatch, natures }) =>
         <LazyCascader />
       </Form.Item>
       <ProFormCheckbox.Group name="natureIds" label="客户性质" options={natures} />
-      <ProFormText name="address" label="客户地址" placeholder="" rules={[{ required: true }]} />
+      <ProFormText name="address" label="客户地址" placeholder="" />
       <Row>
         <Col span={12}>
           <ProFormText name="fax" label="客户传真" placeholder="" />

+ 5 - 5
src/pages/Customer/Company/components/CompanyDetail/Form.jsx

@@ -34,24 +34,24 @@ const CompanyForm = props => {
   const columns = [
     {
       dataIndex: 'companyName',
-      label: '公司全称',
+      label: '客户全称',
       span: 24
     },
     {
       dataIndex: 'districtIds',
-      label: '公司地区',
+      label: '客户地区',
       editCellType: 'cascader',
       span: 24
     },
     {
       dataIndex: 'natureIds',
-      label: '公司性质',
+      label: '客户性质',
       editCellType: 'select',
       span: 24
     },
     {
       dataIndex: 'fax',
-      label: '公司传真',
+      label: '客户传真',
       span: 24
     },
     {
@@ -61,7 +61,7 @@ const CompanyForm = props => {
     },
     {
       dataIndex: 'address',
-      label: '公司地址',
+      label: '客户地址',
       span: 24,
       editCellType: 'textarea'
     },

+ 21 - 90
src/pages/workbench/Dashboard/index.jsx

@@ -21,8 +21,7 @@ const Dashboard = ({ dispatch, permData = {}, groupList = [] }) => {
     businessChainRatio: {},
     serviceLogChainRatio: {},
     aggregation: {},
-    char: [],
-    thread: [],
+    businessChar: {},
     params: { businessGroupId: null, dataPermission: 'oneself', cyclical: 'month' }
   })
   const { toggleModal, setModalProps } = useModal()
@@ -46,8 +45,7 @@ const Dashboard = ({ dispatch, permData = {}, groupList = [] }) => {
         businessChainRatio = {},
         serviceLogChainRatio = {},
         aggregation = {},
-        char = [],
-        thread = []
+        businessChar = {}
       }
     } = await queryDashboard(payload)
     if (code === consts.RET_CODE.SUCCESS) {
@@ -60,21 +58,23 @@ const Dashboard = ({ dispatch, permData = {}, groupList = [] }) => {
         businessChainRatio,
         serviceLogChainRatio,
         aggregation,
-        char,
-        thread
+        businessChar
       })
     }
   }
   useEffect(() => {
-    if (!groupList.length) {
+    if (!groupList) {
       dispatch({
         type: 'business/fetchGroup'
       })
     }
-    if (groupList[0]?.value) {
-      initData({ ...state.params, businessGroupId: groupList[0]?.value })
+    if (groupList?.length) {
+      setState({ ...state, params: { ...state.params, businessGroupId: groupList[0]?.value } })
     }
-  }, [state.params, groupList])
+  }, [groupList])
+  useEffect(() => {
+    state.params.businessGroupId && initData(state.params)
+  }, [state.params.businessGroupId, state.params.cyclical, state.params.dataPermission])
   const columns = [
     {
       title: '超过周期未服务提醒',
@@ -148,87 +148,18 @@ const Dashboard = ({ dispatch, permData = {}, groupList = [] }) => {
     }
   ]
 
-  const charData = state.char
-  const threadData = state.thread
-  // const uvBillData = [
-  //   {
-  //     time: '验证阶段',
-  //     value: 350,
-  //     type: '上个月'
-  //   },
-  //   {
-  //     time: '开发阶段',
-  //     value: 900,
-  //     type: '上个月'
-  //   },
-  //   {
-  //     time: '提案阶段',
-  //     value: 300,
-  //     type: '上个月'
-  //   },
-  //   {
-  //     time: '赢单',
-  //     value: 450,
-  //     type: '上个月'
-  //   },
-  //   {
-  //     time: '输单',
-  //     value: 470,
-  //     type: '上个月'
-  //   },
-  //   {
-  //     time: '验证阶段',
-  //     value: 220,
-  //     type: '本月'
-  //   },
-  //   {
-  //     time: '开发阶段',
-  //     value: 300,
-  //     type: '本月'
-  //   },
-  //   {
-  //     time: '提案阶段',
-  //     value: 250,
-  //     type: '本月'
-  //   },
-  //   {
-  //     time: '赢单',
-  //     value: 220,
-  //     type: '本月'
-  //   },
-  //   {
-  //     time: '输单',
-  //     value: 362,
-  //     type: '本月'
-  //   }
-  // ]
-  // const transformData = [
-  //   {
-  //     time: '验证阶段',
-  //     增幅: 800
-  //   },
-  //   {
-  //     time: '开发阶段',
-  //     增幅: 600
-  //   },
-  //   {
-  //     time: '提案阶段',
-  //     增幅: 400
-  //   },
-  //   {
-  //     time: '赢单',
-  //     增幅: 380
-  //   },
-  //   {
-  //     time: '输单',
-  //     增幅: 220
-  //   }
-  // ]
+  const { char, thread } = state.businessChar
   const config = {
-    data: [charData, threadData],
+    data: [char, thread],
+    legend: { position: 'top' },
     height: 230,
     xField: 'time',
-    yField: ['value', '增幅'],
+    yField: ['value', 'increment'],
+    meta: {
+      increment: {
+        alias: '增幅'
+      }
+    },
     geometryOptions: [
       {
         geometry: 'column',
@@ -369,7 +300,7 @@ const Dashboard = ({ dispatch, permData = {}, groupList = [] }) => {
               <div className="relative">
                 <span>销售漏斗</span>
                 <div className="absolute right-1 top-0">
-                  {groupList[0]?.value ? (
+                  {groupList ? (
                     <Select
                       defaultValue={groupList[0]?.value}
                       options={groupList}
@@ -381,7 +312,7 @@ const Dashboard = ({ dispatch, permData = {}, groupList = [] }) => {
                 </div>
               </div>
               <Divider />
-              <DualAxes {...config} />
+              {char && thread && <DualAxes {...config} />}
             </div>
           </Col>
           <Col className="gutter-row" span={8}>