Bläddra i källkod

客户档案和企业面谈对外投资控股企业增加企业关联功能

雷佳斌 1 vecka sedan
förälder
incheckning
b85afe0c26

+ 216 - 0
src/components/common/CustomerProjectSelect/index.jsx

@@ -0,0 +1,216 @@
+import React, { Component } from "react";
+import { View, Text } from "@tarojs/components";
+import { AtFloatLayout, AtButton, AtIcon, AtListItem, AtSearchBar } from "taro-ui";
+import Taro from "@tarojs/taro";
+import { getUserByName } from "../../../utils/servers/servers";
+import 'taro-ui/dist/style/components/float-layout.scss';
+import 'taro-ui/dist/style/components/icon.scss';
+import 'taro-ui/dist/style/components/button.scss';
+import './index.less';
+
+
+class CustomerProjectSelect extends Component {
+	constructor(props) {
+		super(props);
+		this.state = {
+			checkboxOption: props.options || [],
+			checkedList: [],
+			value: '',
+			list: [],
+			listState: '',
+			listVisible: false
+		}
+
+		this.handleClose = this.handleClose.bind(this);
+		this.handleChange = this.handleChange.bind(this);
+		this.handleConfirm = this.handleConfirm.bind(this);
+		this.onChange = this.onChange.bind(this);
+	}
+
+	componentDidUpdate(prevProps) {
+		if (JSON.stringify(this.props.checkedList) != JSON.stringify(prevProps.checkedList)) {
+			this.setState({ checkedList: this.props.checkedList });
+		}
+	}
+
+	handleClose() {
+		this.setState({ checkedList: [], value: '', list: [], listState: '', listVisible: false });
+		this.props.onClose();
+	}
+
+	handleChange(e) {
+		this.setState({ checkedList: e });
+	}
+
+	handleConfirm() {
+		const { checkedList } = this.state;
+		this.props.onConfirm(checkedList);
+		this.handleClose();
+	}
+
+	onChange(value, lv = true) {
+		this.setState({
+			value,
+		});
+		if (value.length < 2 && !lv) {
+			Taro.showToast({ title: "最少输入两个字符", icon: "none" });
+			return;
+		}
+		if (value.length < 4 && lv) {
+			return;
+		}
+		this.getList(value);
+	}
+
+	getList(value = this.state.value, pageNo = 1) {
+		this.setState({
+			listState: "LOADING",
+		});
+		getUserByName({
+			name: value,
+			type: 1,
+			pageNo: pageNo,
+			pageSize: 10,
+		})
+			.then((msg) => {
+				if (msg.error.length === 0) {
+					if (msg.data.totalCount === 0) {
+						this.setState({
+							listState: "NO_DATA",
+						});
+					} else if (
+						msg.data.totalCount === this.state.list.length &&
+						pageNo !== 1
+					) {
+						Taro.showToast({ title: "没有更多数据了", icon: "none" });
+						this.setState({
+							listState: "NO_MORE_DATA",
+						});
+					} else {
+						if (
+							msg.data.totalCount ===
+							(pageNo === 1
+								? msg.data.list
+								: this.state.list.concat(msg.data.list)
+							).length
+						) {
+							this.setState({
+								listState: "NO_MORE_DATA",
+							});
+						}
+					}
+					this.setState({
+						list:
+							pageNo === 1
+								? msg.data.list
+								: this.state.list.concat(msg.data.list),
+						pageNo: msg.data.pageNo,
+					});
+				} else {
+					Taro.showToast({ title: msg.error[0].message, icon: "none" });
+					this.setState({
+						listState: msg.error[0].field === "403" ? "NO_DATA" : "RELOAD",
+					});
+				}
+			})
+			.catch(() => {
+				this.setState({
+					listState: "RELOAD",
+				});
+			});
+	}
+
+	handleAddClick(data) {
+		const { checkedList } = this.state;
+		if (checkedList.find(item => item.name == data.name)) {
+			Taro.showToast({ title: `${data.name}已存在!`, icon: "none" });
+			return;
+		}
+    checkedList.push({ id: data.id, name: data.name });
+		this.setState({ checkedList });
+	}
+
+	handleCloseComp(idx) {
+		const { checkedList } = this.state;
+		checkedList.splice(idx, 1);
+		this.setState({ checkedList });
+	}
+
+	render() {
+		const { checkedList } = this.state;
+		return (
+			<AtFloatLayout isOpened={this.props.isOpened} title={this.props.title} scrollY onClose={this.handleClose}>
+				<View style={{ paddingBottom: '90rpx' }}>
+					<View className="tag-list">
+						{checkedList.map((item, idx) => {
+							return (
+								<View className="tag-list-item">
+									<Text>{item.name}</Text>
+									<AtIcon value="close" size="16" color="#F00" onClick={() => this.handleCloseComp(idx)} />
+								</View>
+							)
+						})}
+					</View>
+
+					<View className="cltips">搜索可增加已存在的企业,新增可直接增加企业,删除企业:点击“X”删除</View>
+
+					<View style={{ display: 'flex', alignItems: 'center' }}>
+						<View style={{ flex: 1 }}>
+							<AtSearchBar
+								placeholder="请输入企业/渠道"
+								showActionButton
+								value={this.state.value}
+								onChange={this.onChange}
+								onActionClick={() => {
+									this.setState({
+										listVisible: false,
+									});
+									this.onChange(this.state.value, false);
+								}}
+								onConfirm={() => {
+									this.onChange(this.state.value, false);
+								}}
+								onClear={() => {
+									this.setState({
+										value: "",
+										list: [],
+										listState: "NO_DATA",
+										pageNo: 1,
+										listVisible: false,
+									});
+								}}
+							/>
+						</View>
+
+						<AtButton
+							type="primary"
+							size="small"
+							className="add-btn"
+							onClick={() => {
+								this.handleAddClick({id: '0', name: this.state.value})
+							}}
+						>新增</AtButton>
+					</View>
+					{
+						this.state.list.map((v, k) => (
+							<View key={k}>
+								<AtListItem
+									title={v.name}
+									arrow="right"
+									iconInfo={{ size: 25, color: "#000000", value: "bookmark" }}
+									onClick={() => this.handleAddClick(v)}
+								/>
+							</View>
+						))
+					}
+
+					< View className='operate-btn' >
+						<AtButton type='primary' size='normal' onClick={this.handleConfirm}>确定</AtButton>
+					</View>
+				</View>
+			</AtFloatLayout>
+		)
+	}
+}
+
+export default CustomerProjectSelect;

+ 33 - 0
src/components/common/CustomerProjectSelect/index.less

@@ -0,0 +1,33 @@
+.operate-btn {
+    position: fixed;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    height: 90rpx;
+    background: #fff;
+}
+.at-float-layout {
+    z-index: 99999;
+}
+
+.tag-list {
+    &-item {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        line-height: 60rpx;
+    }
+}
+
+.cltips{
+    text-align: center;
+    font-size: 24px;
+    color: #4395ff;
+    margin: 30rpx 0;
+  }
+
+.add-btn {
+    height: 56rpx;
+    line-height: 52rpx;
+    font-size: 25rpx;
+}

+ 1 - 1
src/pages/applyDepart/publicContent.jsx

@@ -149,7 +149,7 @@ class PublicContent extends Component {
       assistAidName: this.state.coorderList.length === 0 ? "" : getNameList(this.state.coorderList, this.state.cList).join(","),
     };
     if (this.props.enterpriseInfor.type == 0 && this.props.uaiIdList.length) {
-      datas.uais = this.props.uaiIdList.join(',');
+        datas.uais = this.props.uaiIdList.join(',');
     } else if (this.props.enterpriseInfor.type == 2) {
       datas = datas;
       datas = { ...datas, remarks: this.state.reason };

+ 36 - 11
src/pages/customerProfile/index.jsx

@@ -42,6 +42,7 @@ import Superior from "../../components/common/superior";
 import CheckboxPicker from "../../components/common/CheckboxPicker";
 import AddressPicker from "../../components/common/addressPicker"
 import InteractList from "./components/InteractList";
+import CustomerProjectSelect from '../../components/common/CustomerProjectSelect';
 
 class CustomerProfile extends Component {
   $instance = getCurrentInstance();
@@ -83,7 +84,10 @@ class CustomerProfile extends Component {
       interactShow: false,
       interactShowType: '',
       interactTitle: '',
-      interactList: []
+      interactList: [],
+
+      checkCompShow: false,
+    	checkCompList: []
     };
     this.queryByUidAll = this.queryByUidAll.bind(this);
     this.update = this.update.bind(this);
@@ -124,6 +128,25 @@ class CustomerProfile extends Component {
       this.setState({ dtails, addressPickerShow: false });
   }
 
+  handleSelComp() {
+		const { dtails } = this.state;
+		let externalInvestList = [];
+		if (dtails.externalInvestName) {
+			let externalInvestNameList = dtails.externalInvestName.split(',');
+			let externalInvestIdList = dtails.externalInvestId.split(',');
+			externalInvestList = externalInvestNameList.map((name, idx) => {
+				return { id: externalInvestIdList[idx] || 0, name }
+			});
+		}
+		this.setState({ checkCompShow: true, checkCompList: externalInvestList });
+	}
+
+	handleCheckCompConfirm(data) {
+		let externalInvestId = data.map(item => item.id).join(',');
+    let externalInvestName = data.map(item => item.name).join(',');
+		this.setState({ dtails: { ...this.state.dtails, externalInvestId, externalInvestName } });
+	}
+
   handleOpenMultiplePicker(type) {
       let multiplePickerOptions = [];
       let multiplePickerTitle = '';
@@ -342,12 +365,6 @@ class CustomerProfile extends Component {
             channelIndicators: dtails.channelIndicators,
         };
     } else {
-        let externalInvestIdArr = [];
-        if (!!dtails.externalInvestName) {
-            externalInvestIdArr = dtails.externalInvestName.split('、').map(() => {
-                return '0';
-            })
-        }
         params = {
             ...params,
             industry: dtails.industry,
@@ -371,7 +388,7 @@ class CustomerProfile extends Component {
             externalInvestCount: dtails.externalInvestCount,
             externalInvestIndustry: dtails.externalInvestIndustry,
             externalInvestIndustryName: dtails.externalInvestIndustryName,
-            externalInvestId: externalInvestIdArr.join(','),
+            externalInvestId: dtails.externalInvestId,
             externalInvestName: dtails.externalInvestName,
             financialRevenue: dtails.financialRevenue,
             financialTax: dtails.financialTax,
@@ -1134,9 +1151,9 @@ class CustomerProfile extends Component {
 
                     <View className="val" style={{display: 'flex'}}>
                         对外投资控股的企业名称:
-                        <View className="link" onClick={() => this.addItemDialog('externalInvestName')}>
-                            { this.state.dtails.externalInvestName || '点击新增' }
-                        </View>
+                        <View className="link" onClick={() => this.handleSelComp()}>
+													{dtails.externalInvestName || '请选择'}
+												</View>
                     </View>
 
                     <View className="tit">
@@ -2080,6 +2097,14 @@ class CustomerProfile extends Component {
             onHandleToggleShow={this.toggleAddressPicker.bind(this)}
         />
 
+        <CustomerProjectSelect
+					isOpened={this.state.checkCompShow}
+					title="选择对外关联的控股企业"
+					checkedList={this.state.checkCompList}
+					onClose={() => { this.setState({ checkCompShow: false, checkCompList: [] }) }}
+					onConfirm={this.handleCheckCompConfirm.bind(this)}
+				/>
+
       </View>
     );
   }

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1941 - 1916
src/pages/interview/index.jsx