Browse Source

优化多选组件回显

雷佳斌 2 months ago
parent
commit
fddb1045c2

+ 1 - 0
src/components/common/CheckboxPicker/index.jsx

@@ -30,6 +30,7 @@ class CheckboxPicker extends Component {
   }
 
   handleClose() {
+    this.setState({ checkedList: [] });
     this.props.onClose();
   }
 

+ 15 - 4
src/pages/customerProfile/index.jsx

@@ -334,6 +334,9 @@ class CustomerProfile extends Component {
 
   onSaveAllData() {
     const { dtails } = this.state;
+    const externalInvestIdArr = dtails.externalInvestName.split[','].map(() => {
+        return '0';
+    })
     const params = {
         id: dtails.id,
         uid: dtails.uid,
@@ -358,7 +361,7 @@ class CustomerProfile extends Component {
         externalInvestCount: dtails.externalInvestCount,
         externalInvestIndustry: dtails.externalInvestIndustry,
         externalInvestIndustryName: dtails.externalInvestIndustryName,
-        externalInvestId: '0,0',
+        externalInvestId: externalInvestIdArr.join(','),
         externalInvestName: dtails.externalInvestName,
         financialRevenue: dtails.financialRevenue,
         financialTax: dtails.financialTax,
@@ -505,6 +508,12 @@ class CustomerProfile extends Component {
                     icon: "none",
                 });
                 return;
+            } else if (info.examineStatus == 2 && info.examineStatusOther.split(',').length > 1) {
+                Taro.showToast({
+                    title: "复审年份只能选择一个",
+                    icon: "none",
+                });
+                return;
             } else {
                 params.examineStatus = info.examineStatus;
                 params.examineStatusOther = info.examineStatus == 2 ? info.examineStatusOther : '';
@@ -533,7 +542,7 @@ class CustomerProfile extends Component {
             Taro.showToast({
                 title: "项目新增成功!",
             });
-            this.setState({ isOpened: false })
+            this.setState({ isOpened: false, checkProject: [] })
             this.getProjectList();
         } else {
             Taro.showToast({
@@ -1398,7 +1407,9 @@ class CustomerProfile extends Component {
                             </>
                         ) : null }
 
-                        <AtButton type="primary" onClick={this.onSaveAllData.bind(this)}>保存</AtButton>
+                        <View style={{ marginTop: '24rpx'}}>
+                            <AtButton type="primary" onClick={this.onSaveAllData.bind(this)}>保存</AtButton>
+                        </View>
                     </View>
                   </View>
               }
@@ -2150,7 +2161,7 @@ class CustomerProfile extends Component {
             title={this.state.multiplePickerTitle}
             options={this.state.multiplePickerOptions}
             checkedList={this.state.multiplePickerCheckedList}
-            onClose={() => {this.setState({multiplePickerShow: false})}}
+            onClose={() => {this.setState({multiplePickerShow: false, multiplePickerCheckedList: []})}}
             onConfirm={this.handleMultipleConfirm}
         ></CheckboxPicker>