Browse Source

修复业务项目显示错误

HW 4 years ago
parent
commit
60355d0ab3

+ 32 - 32
config/proxy.ts

@@ -6,44 +6,44 @@
  * https://pro.ant.design/docs/deploy
  */
 export default {
-  dev: {
-    '/api/': {
-      target: 'http://uat.jishutao.com',
-      changeOrigin: true,                //target为域名时设为true
-    },
-    '/managesignin':{
-      target: 'http://uat.jishutao.com',
-      changeOrigin: true,                //target为域名时设为true
-    },
-    '/login':{
-      target: 'http://uat.jishutao.com',
-      changeOrigin: true,                //target为域名时设为true
-    }
-  },
   // dev: {
   //   '/api/': {
-  //     target: 'http://172.16.0.188:8080',
-  //     changeOrigin: false,                //target为域名时设为true
+  //     target: 'http://uat.jishutao.com',
+  //     changeOrigin: true,                //target为域名时设为true
   //   },
   //   '/managesignin':{
-  //     target: 'http://172.16.0.188:8080',
-  //     changeOrigin: false,                //target为域名时设为true
-  //   },
-  //   '/login':{
-  //     target: 'http://172.16.0.188:8080',
-  //     changeOrigin: false,                //target为域名时设为true
-  //   }
-  // },
-  // test: {
-  //   '/api/': {
   //     target: 'http://uat.jishutao.com',
-  //     changeOrigin: true,               //target为域名时设为true
+  //     changeOrigin: true,                //target为域名时设为true
   //   },
-  // },
-  // pre: {
-  //   '/api/': {
+  //   '/login':{
   //     target: 'http://uat.jishutao.com',
-  //     changeOrigin: true,
-  //   },
+  //     changeOrigin: true,                //target为域名时设为true
+  //   }
   // },
+  dev: {
+    '/api/': {
+      target: 'http://172.16.0.188:8080',
+      changeOrigin: false,                //target为域名时设为true
+    },
+    '/managesignin':{
+      target: 'http://172.16.0.188:8080',
+      changeOrigin: false,                //target为域名时设为true
+    },
+    '/login':{
+      target: 'http://172.16.0.188:8080',
+      changeOrigin: false,                //target为域名时设为true
+    }
+  },
+  test: {
+    '/api/': {
+      target: 'http://uat.jishutao.com',
+      changeOrigin: true,               //target为域名时设为true
+    },
+  },
+  pre: {
+    '/api/': {
+      target: 'http://uat.jishutao.com',
+      changeOrigin: true,
+    },
+  },
 };

+ 6 - 0
config/routes.ts

@@ -34,6 +34,12 @@
     component: './admin/business/project',
     access: 'project',
   },
+  // 业务项目查询
+  {
+    path: '/projectQuery/:isReadOnly',
+    component: './admin/business/project',
+    access: 'projectReadOnly',
+  },
   // 组织机构
   {
     path: '/mechanism',

+ 1 - 0
src/access.ts

@@ -8,6 +8,7 @@ const routers = {
   mechanism: false,
   category: false,
   project: false,
+  projectQuery: false,
   archives: false,
 }
 

+ 17 - 15
src/pages/admin/business/project/components/AddBusinessNorms.jsx

@@ -78,16 +78,18 @@ class AddBusinessNorms extends Component{
         visible={this.props.visible}
         preserve={false}
         title={(this.props.businessNormsInfor ? '编辑项目规格(' : '新增项目规格(')+this.props.projectInfor.bname+')'}
+        layout={this.props.isReadOnly?'horizontal':'vertical'}
         modalProps={{
           width: 520,
           maskClosable: true,
           onCancel: (e) => {e.stopPropagation();this.props.onCancel();},
         }}
-        onFinish={this.props.businessNormsInfor ? this.orgProjectSize:this.addProjectSize}
+        onFinish={this.props.isReadOnly? ()=>{this.props.onCancel();} :this.props.businessNormsInfor ? this.orgProjectSize:this.addProjectSize}
       >
         <ProForm.Group>
           <ProFormText
-            width='s'
+            readonly={this.props.isReadOnly}
+            width='xs'
             rules={[
               {
                 required:true,
@@ -99,35 +101,36 @@ class AddBusinessNorms extends Component{
             label="规格名称"
           />
           <ProFormDigit
+            readonly={this.props.isReadOnly}
             name="price"
-            width='s'
+            width='xs'
             label="市场价"
             placeholder="请输入市场价"
           />
-        </ProForm.Group>
-        <ProForm.Group>
           <ProFormDigit
+            readonly={this.props.isReadOnly}
             name="activityPrice"
-            width='s'
+            width='xs'
             label="活动价"
             placeholder="请输入活动价"
           />
           <ProFormDigit
+            readonly={this.props.isReadOnly}
             name="offset"
-            width='s'
+            width='xs'
             label="最低折扣"
             placeholder="请输入最低折扣"
           />
-        </ProForm.Group>
-        <ProForm.Group>
           <ProFormDigit
+            readonly={this.props.isReadOnly}
             name="memberPrice"
-            width='s'
+            width='xs'
             label="会员价"
             placeholder="请输入会员价"
           />
           <ProFormSelect
-            width='s'
+            readonly={this.props.isReadOnly}
+            width='xs'
             name="activityFlag"
             label="活动生效"
             placeholder="请选择活动生效"
@@ -142,11 +145,10 @@ class AddBusinessNorms extends Component{
               },
             ]}
           />
-        </ProForm.Group>
-        <ProForm.Group>
           {this.props.businessNormsInfor && <>
             <ProFormSelect
-              width='s'
+              readonly={this.props.isReadOnly}
+              width='xs'
               name="status"
               label="项目状态"
               placeholder="请选择项目状态"
@@ -162,7 +164,7 @@ class AddBusinessNorms extends Component{
               ]}
             />
             <ProFormText
-              width='s'
+              width='xs'
               name="createName"
               label="创建人"
               readonly

+ 16 - 6
src/pages/admin/business/project/components/addProject.jsx

@@ -8,6 +8,9 @@ import {getAddressSelect} from "@/utils/tools";
 class AddProject extends Component{
   constructor(props) {
     super(props);
+    this.state={
+      addressList: []
+    }
   }
 
   getAllCname=async ()=>{
@@ -43,12 +46,19 @@ class AddProject extends Component{
     }
   }
 
-  render() {
-    let addressSelect = getAddressSelect()
-    addressSelect.unshift({
-      label: '全国',
-      value: 0,
+  componentDidMount() {
+    getAddressSelect().then(v=>{
+      v.unshift({
+        label: '全国',
+        value: 0,
+      });
+      this.setState({
+        addressList :v
+      })
     })
+  }
+
+  render() {
     return (
       <ModalForm
         preserve={false}
@@ -107,7 +117,7 @@ class AddProject extends Component{
             style={{
               width: '329px',
             }}
-            options={addressSelect}
+            options={this.state.addressList}
             placeholder='请选择省-市-区'/>
         </Form.Item>
       </ModalForm>

+ 50 - 39
src/pages/admin/business/project/components/basicInformation.jsx

@@ -18,6 +18,7 @@ class BasicInformation extends Component{
       createTimeFormattedDate: '',
       createName: '',
       address: [],
+      addressList: [],
     }
   }
 
@@ -111,25 +112,32 @@ class BasicInformation extends Component{
 
   componentDidMount() {
     this.getOrgProject();
+    getAddressSelect().then(v=>{
+      v.unshift({
+        label: '全国',
+        value: 0,
+      });
+      this.setState({
+        addressList :v
+      })
+    })
   }
 
   formRef=React.createRef();
 
   render() {
-    let addressSelect = getAddressSelect()
-    addressSelect.unshift({
-      label: '全国',
-      value: 0,
-    })
     return (
       <ProForm
         formRef={this.formRef}
         onFinish={this.updateProject}
+        layout={this.props.isReadOnly?'horizontal':'vertical'}
+        submitter={!this.props.isReadOnly}
       >
         <ProForm.Group>
           <ProFormText
+            readonly={this.props.isReadOnly}
             name="bname"
-            width='m'
+            width='s'
             label="项目名称"
             placeholder="请输入项目名称"
             rules={[
@@ -140,8 +148,9 @@ class BasicInformation extends Component{
             ]}
           />
           <ProFormSelect
+            readonly={this.props.isReadOnly}
             name="cid"
-            width='m'
+            width='s'
             label='业务品类'
             placeholder="请选择业务品类"
             request={this.getAllCname}
@@ -152,8 +161,6 @@ class BasicInformation extends Component{
               },
             ]}
           />
-        </ProForm.Group>
-        <ProForm.Group>
           <Form.Item
             label="省-市-区:"
             name='address'
@@ -164,22 +171,23 @@ class BasicInformation extends Component{
               }
             ]}
           >
-            <Cascader
+            {this.props.isReadOnly ? this.formRef.current && this.formRef.current.getFieldsValue(['address']).address : <Cascader
               changeOnSelect
               style={{
-                width: '329px',
+                width: '216px',
               }}
-              options={addressSelect}
+              options={this.state.addressList}
               onChange={()=>{
                 this.setState({
                   address: ''
                 })
               }}
-              placeholder='请选择省-市-区'/>
+              placeholder='请选择省-市-区'/>}
           </Form.Item>
           <ProFormDigit
+            readonly={this.props.isReadOnly}
             name="price"
-            width='m'
+            width='s'
             label="市场价"
             placeholder="请输入市场价"
             rules={[
@@ -189,12 +197,11 @@ class BasicInformation extends Component{
               },
             ]}
           />
-        </ProForm.Group>
-        <ProForm.Group>
           <ProFormDigit
+            readonly={this.props.isReadOnly}
             name="firstPayment"
             label="首付金额"
-            width='m'
+            width='s'
             placeholder="请输入首付金额"
             rules={[
               {
@@ -204,29 +211,29 @@ class BasicInformation extends Component{
             ]}
           />
           <ProFormDigit
+            readonly={this.props.isReadOnly}
             name="activityPrice"
-            width='m'
+            width='s'
             label="活动价"
             placeholder="请输入活动价"
           />
-        </ProForm.Group>
-        <ProForm.Group>
           <ProFormDigit
+            readonly={this.props.isReadOnly}
             name="offset"
             label="最低折扣"
-            width='m'
+            width='s'
             placeholder="请输入最低折扣"
           />
           <ProFormDigit
+            readonly={this.props.isReadOnly}
             name="memberPrice"
             label="会员价"
-            width='m'
+            width='s'
             placeholder="请输入会员价"
           />
-        </ProForm.Group>
-        <ProForm.Group>
           <ProFormSelect
-            width="m"
+            readonly={this.props.isReadOnly}
+            width="s"
             name="activityFlag"
             label="活动生效"
             placeholder="请选择活动生效"
@@ -242,7 +249,8 @@ class BasicInformation extends Component{
             ]}
           />
           <ProFormSelect
-            width="m"
+            readonly={this.props.isReadOnly}
+            width="s"
             name="status"
             label="项目状态"
             placeholder="请选择项目状态"
@@ -257,10 +265,9 @@ class BasicInformation extends Component{
               },
             ]}
           />
-        </ProForm.Group>
-        <ProForm.Group>
           <ProFormSelect
-            width="m"
+            readonly={this.props.isReadOnly}
+            width="s"
             name="type"
             label="项目分类"
             placeholder="请选择项目分类"
@@ -295,19 +302,20 @@ class BasicInformation extends Component{
               }
             ]}
           />
-          <div style={{display:'flex',alientItem:'center',paddingBottom:'25px'}}>
-            <div style={{paddingRight:'35px'}}>
-              <span>创建人:</span>
-              <span style={{paddingLeft:'15px'}}>{this.state.createName}</span>
-            </div>
-            <div style={{paddingRight:'35px'}}>
-              <span>创建时间:</span>
-              <span style={{paddingLeft:'15px'}}>{this.state.createTimeFormattedDate}</span>
-            </div>
-          </div>
         </ProForm.Group>
+        <div style={{display:'flex',alientItem:'center',paddingBottom:'25px'}}>
+          <div style={{paddingRight:'35px'}}>
+            <span>创建人:</span>
+            <span style={{paddingLeft:'15px'}}>{this.state.createName}</span>
+          </div>
+          <div style={{paddingRight:'35px'}}>
+            <span>创建时间:</span>
+            <span style={{paddingLeft:'15px'}}>{this.state.createTimeFormattedDate}</span>
+          </div>
+        </div>
         <ProForm.Group>
           <ProFormTextArea
+            readonly={this.props.isReadOnly}
             name="projectUrl"
             width='m'
             label="项目地址"
@@ -316,6 +324,7 @@ class BasicInformation extends Component{
         </ProForm.Group>
         <ProForm.Group>
           <ProFormTextArea
+            readonly={this.props.isReadOnly}
             name="introduce"
             width='m'
             label="业务项目服务内容"
@@ -324,6 +333,7 @@ class BasicInformation extends Component{
         </ProForm.Group>
         <ProForm.Group>
           <ProFormTextArea
+            readonly={this.props.isReadOnly}
             name="valueEffect"
             width='m'
             label="业务项目价值及作用"
@@ -332,6 +342,7 @@ class BasicInformation extends Component{
         </ProForm.Group>
         <ProForm.Group>
           <ProFormTextArea
+            readonly={this.props.isReadOnly}
             name="clientSize"
             width='m'
             label="业务项目客户基本条件"

+ 3 - 2
src/pages/admin/business/project/components/businessNorms.jsx

@@ -5,6 +5,7 @@ import {getGameState} from '@/utils/tools';
 import { PlusOutlined } from '@ant-design/icons';
 import {Button, message, Popconfirm} from "antd";
 import {deleteProjectSize} from '../services/API';
+import {ProFormText} from "@ant-design/pro-form";
 
 class BusinessNorms extends Component{
   constructor(props) {
@@ -76,7 +77,7 @@ class BusinessNorms extends Component{
               okText="确认"
               cancelText="取消"
               placement="topLeft">
-              <Button type='primary' danger onClick={(e)=>e.stopPropagation()}>删除</Button>
+              <Button disabled={this.props.isReadOnly} type='primary' danger onClick={(e)=>e.stopPropagation()}>删除</Button>
             </Popconfirm>
           ) }
         }
@@ -120,7 +121,7 @@ class BusinessNorms extends Component{
               })
             }
           })}
-          toolBarRender={[
+          toolBarRender={!this.props.isReadOnly && [
             <Button type="primary" key='addProject' onClick={()=>{
               this.setState({
                 visible: true,

+ 19 - 17
src/pages/admin/business/project/index.jsx

@@ -170,22 +170,23 @@ class Project extends Component{
                 city: v[1] || '',
                 district: v[2] || '',
               }
-            }
-          },
-          renderFormItem: (item, props) => {
-            let addressSelect = getAddressSelect()
-            addressSelect.unshift({
-              label: '全国',
-              value: 0,
-            })
-            return (
-              <Cascader
-                changeOnSelect
-                options={addressSelect}
-                placeholder='请选择省-市-区'/>
-            );
+            },
+            renderFormItem: (item, props) => {
+              let addressSelect = getAddressSelect()
+              addressSelect.unshift({
+                label: '全国',
+                value: 0,
+              })
+              return (
+                <Cascader
+                  changeOnSelect
+                  options={addressSelect}
+                  placeholder='请选择省-市-区'/>
+              );
+            },
           },
-        },{
+        },
+        {
           title: '操作',
           dataIndex: 'id',
           key: 'id',
@@ -197,7 +198,7 @@ class Project extends Component{
               okText="确认"
               cancelText="取消"
               placement="topLeft">
-              <Button type='primary' danger onClick={(e)=>e.stopPropagation()}>删除</Button>
+              <Button disabled={this.props.match.params.isReadOnly === 'readOnly'} type='primary' danger onClick={(e)=>e.stopPropagation()}>删除</Button>
             </Popconfirm>
           ) }
         }
@@ -271,11 +272,12 @@ class Project extends Component{
               })
             }
           })}
-          toolBarRender={[
+          toolBarRender={this.props.match.params.isReadOnly !== 'readOnly' && [
             <AddProject formRef={ref}  key='addProject'/>
           ]}
         />
         {this.state.visible && <UpadateProject
+          isReadOnly={this.props.match.params.isReadOnly === 'readOnly'}
           formRef={ref}
           visible={this.state.visible}
           projectInfor={this.state.projectInfor}