From cddad7249f0d5ac0aa2800e13774920d205655bf Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 31 May 2021 17:35:34 +0800
Subject: [PATCH] 风险评估新增客户下拉

---
 pages/infoRegistration/infoCheck.vue        |    7 
 pages/infoRegistration/infoRegistration.vue |  238 ++++++++++++++++++++-------------
 pages/riskReporting/riskReporting.vue       |   61 +++++++-
 pages/visitRecord/visitRecord.vue           |   99 +++++++++++++
 4 files changed, 293 insertions(+), 112 deletions(-)

diff --git a/pages/infoRegistration/infoCheck.vue b/pages/infoRegistration/infoCheck.vue
index 7402ecb..c8d8776 100644
--- a/pages/infoRegistration/infoCheck.vue
+++ b/pages/infoRegistration/infoCheck.vue
@@ -57,7 +57,9 @@
 				tenantNameArrayType:'---请选择---',
 				typeArray:["学校","医院","小区"],
 				typeArrayIndex:0,
-				typeArrayType:'---请选择---'
+				typeArrayType:'---请选择---',
+				pathUrl:"https://web.byisf.com/api/blade-system",
+				// pathUrl: "http://localhost:8106"
 			}
 		},
 		onLoad() {
@@ -72,7 +74,7 @@
 			getTenantList(){
 				var that = this;
 				uni.request({
-					url: 'https://web.byisf.com/api/blade-system/tenant/page',
+					url: this.pathUrl + '/tenant/page',
 					method:'GET',
 					success: (res) => {
 						that.tenantArr = res.data.data.records;
@@ -96,6 +98,7 @@
 				for (var i = 0; i < that.tenantArr.length; i++) {
 					if(that.tenantArr[i].tenantName==that.tenantNameArrayType){
 						that.id = that.tenantArr[i].id;
+						that.tenantName = that.tenantArr[i].tenantName;
 						that.linkman = that.tenantArr[i].linkman;
 						that.contactNumber = that.tenantArr[i].contactNumber;
 						that.address = that.tenantArr[i].address;
diff --git a/pages/infoRegistration/infoRegistration.vue b/pages/infoRegistration/infoRegistration.vue
index 5e1bb8a..84ab8d3 100644
--- a/pages/infoRegistration/infoRegistration.vue
+++ b/pages/infoRegistration/infoRegistration.vue
@@ -1,101 +1,146 @@
 <template>
 	<view class="content">
-		<view class="row regis-info">
-			<text class="info-title">
-				<!-- <span style="color: red;">* --></span>客户名称:
-			</text>
-			<input class="input" type="text" v-model="tenantName" placeholder="请输入客户名称"
-				placeholder-class="placeholder" />
+	        <view class="row regis-info">
+				<text class="info-title"><!-- <span style="color: red;">* --></span>客户名称: </text>
+				<!-- <picker @change="tenantNameSelect" :range="tenantNameArray" class="tenant-select">
+					  <label class="" v-model="tenantName">{{ tenantNameArrayType }}</label>
+				</picker> -->
+	            <input class="input" type="text"  v-model="tenantName" placeholder="请输入客户名称" placeholder-class="placeholder" />
+			</view>
+			<view class="row regis-info-linkman">
+				<text class="info-title"><!-- <span style="color: red;">* --></span>联系人: </text>
+			    <input class="input" type="text"  v-model="linkman" placeholder="请输入联系人名称" placeholder-class="placeholder" />
+			</view>
+			<view class="row regis-info">
+				<text class="info-title"><!-- <span style="color: red;">* --></span>联系电话: </text>
+			    <input class="input" type="text"  v-model="contactNumber" placeholder="请输入联系电话" placeholder-class="placeholder" />
+			</view>
+			<view class="row regis-info">
+				<text class="info-title"><!-- <span style="color: red;">* --></span>客户地址: </text>
+			    <input class="input" type="text"  v-model="address" placeholder="请输入客户地址" placeholder-class="placeholder" />
+			</view>
+			<view class="row regis-info">
+				<text class="info-title"><!-- <span style="color: red;">* --></span>客户类型: </text>
+				<picker @change="typeSelect" :range="typeArray" class="type-select">
+					  <label class="" v-model="typeArrayType">{{ typeArrayType }}</label>
+				</picker>
+			    <!-- <input class="input" type="text"  v-model="type" placeholder="请输入客户类型" placeholder-class="placeholder" /> -->
+			</view>
+			<view class="row regis-info-desc">
+				<text class="info-title"><!-- <span style="color: red;">* --></span>域名地址: </text>
+			    <input class="input" type="text"  v-model="domain" placeholder="请输入域名地址" placeholder-class="placeholder" />
+			</view>
+			
+			<button class="btn" @click="confirm">上传</button>
 		</view>
-		<view class="row regis-info-linkman">
-			<text class="info-title">
-				<!-- <span style="color: red;">* --></span>联系人:
-			</text>
-			<input class="input" type="text" v-model="linkman" placeholder="请输入联系人名称" placeholder-class="placeholder" />
-		</view>
-		<view class="row regis-info">
-			<text class="info-title">
-				<!-- <span style="color: red;">* --></span>联系电话:
-			</text>
-			<input class="input" type="text" v-model="contactNumber" placeholder="请输入联系电话"
-				placeholder-class="placeholder" />
-		</view>
-		<view class="row regis-info">
-			<text class="info-title">
-				<!-- <span style="color: red;">* --></span>客户地址:
-			</text>
-			<input class="input" type="text" v-model="address" placeholder="请输入客户地址" placeholder-class="placeholder" />
-		</view>
-		<view class="row regis-info">
-			<text class="info-title">
-				<!-- <span style="color: red;">* --></span>客户类型:
-			</text>
-			<picker @change="typeSelect" :range="typeArray" class="type-select">
-				<label class="" v-model="typeArrayType">{{ typeArrayType }}</label>
-			</picker>
-			<!-- <input class="input" type="text"  v-model="type" placeholder="请输入客户类型" placeholder-class="placeholder" /> -->
-		</view>
-		<view class="row regis-info-desc">
-			<text class="info-title">
-				<!-- <span style="color: red;">* --></span>域名地址:
-			</text>
-			<input class="input" type="text" v-model="domain" placeholder="请输入域名地址" placeholder-class="placeholder" />
-		</view>
-
-		<button class="btn" @click="confirm">上传</button>
-	</view>
 	</view>
 </template>
 
 <script>
-	export default {
-		data() {
+	export default{
+		data () {
 			return {
-				tenantName: "",
-				linkman: "",
-				contactNumber: "",
-				address: "",
-				type: null,
-				domain: "",
-				display: 'none',
-				display1: 'none',
-				display2: 'none',
-				display3: 'none',
-				typeArray: ["学校", "医院", "小区"],
-				typeArrayIndex: 0,
-				typeArrayType: '---请选择---',
-				pathUrl:"https://web.byisf.com/api/blade-system"
-				// pathUrl: "http://localhost:8106"
+				// id:"",
+				tenantName:"",
+				linkman:"",
+				contactNumber:"",
+				address:"",
+				type:null,
+				domain:"",
+				display:'none',
+				display1:'none',
+				display2:'none',
+				display3:'none',
+				tenantArr:[],
+				tenantNameArray:[],
+				tenantNameArrayIndex:0,
+				tenantNameArrayType:'---请选择---',
+				typeArray:["学校","医院","小区"],
+				typeArrayIndex:0,
+				typeArrayType:'---请选择---',
+				pathUrl:"https://web.byisf.com/api/blade-system",
+				// pathUrl: "http://localhost:8106",
 			}
 		},
 		onLoad() {
-
+			
 		},
+		// mounted(){
+		// 	// this.getTenantList();
+		// },
 		methods: {
+			
+			//获取客户信息
+			// getTenantList(){
+			// 	var that = this;
+			// 	uni.request({
+			// 		url: 'https://web.byisf.com/api/blade-system/tenant/page',
+			// 		method:'GET',
+			// 		success: (res) => {
+			// 			that.tenantArr = res.data.data.records;
+			// 			if(that.tenantArr.length>0 ){
+			// 				for (var i = 0; i < that.tenantArr.length; i++) {
+			// 					if(that.tenantArr[i].tenantName!=""){
+			// 						that.tenantNameArray.push(that.tenantArr[i].tenantName);
+			// 					}
+			// 				}
+			// 			}
+			// 		}
+			// 	});
+			// },
+			
+			//客户名称下拉改变事件
+			// tenantNameSelect(e) {
+			// 	var that = this;
+			// 	this.tenantNameArrayIndex = e.target.value;
+			// 	this.tenantNameArrayType=this.tenantNameArray[this.tenantNameArrayIndex];
+			// 	//获取id
+			// 	for (var i = 0; i < that.tenantArr.length; i++) {
+			// 		if(that.tenantArr[i].tenantName==that.tenantNameArrayType){
+			// 			that.id = that.tenantArr[i].id;
+			// 			that.tenantName = that.tenantArr[i].tenantName;
+			// 			that.linkman = that.tenantArr[i].linkman;
+			// 			that.contactNumber = that.tenantArr[i].contactNumber;
+			// 			that.address = that.tenantArr[i].address;
+			// 			that.type = that.tenantArr[i].type;
+			// 			if(that.tenantArr[i].type=="1"){
+			// 				that.typeArrayType = '学校';
+			// 			}
+			// 			if(that.tenantArr[i].type=="2"){
+			// 				that.typeArrayType = '医院';
+			// 			}
+			// 			if(that.tenantArr[i].type=="3"){
+			// 				that.typeArrayType = '小区';
+			// 			}
+			// 			that.domain = that.tenantArr[i].domain;
+			// 		}
+			// 	}
+				
+			// },
+			
 			//客户类型下拉改变事件
-			typeSelect(e) {
+			typeSelect(e){
 				var that = this;
 				this.typeArrayIndex = e.target.value;
-				this.typeArrayType = this.typeArray[this.typeArrayIndex];
-				if (that.typeArrayType == '学校') {
+				this.typeArrayType=this.typeArray[this.typeArrayIndex];
+				if(that.typeArrayType == '学校'){
 					that.type = 1;
 				}
-				if (that.typeArrayType == '医院') {
+				if(that.typeArrayType =='医院'){
 					that.type = 2;
 				}
-				if (that.typeArrayType == '小区') {
+				if(that.typeArrayType =='小区'){
 					that.type = 3;
 				}
 			},
-
-			//提交信息
-			confirm() {
-				var that = this;
+			
+			//提交修改
+			confirm(){
 				uni.request({
-					url: that.pathUrl + "/tenant/submit",
-					method: 'POST',
-					data: {
-							"id":this.id,
+					url: this.pathUrl + '/tenant/save',
+					method:'POST',
+					data:{
+							// "id":this.id,
 							"tenantName":this.tenantName,
 							"linkman":this.linkman,
 							"contactNumber":this.contactNumber,
@@ -104,15 +149,16 @@
 							"domain":this.domain
 					},
 					success: (res) => {
-						if (res.data.code == 200) {
+						if(res.data.code==200){
 							uni.showToast({
-								title: '提交成功!',
-								duration: 2000
+							    title: '提交成功!',
+							    duration: 2000
 							});
 						}
 					}
 				});
 			}
+					
 		}
 	}
 </script>
@@ -125,63 +171,69 @@
 		left: 20rpx;
 		border-bottom: 0.05px solid #B4BCCC;
 	}
-
+	
 	.regis-info-desc {
 		width: 100%;
 		height: 100rpx;
 		position: relative;
 		left: 20rpx;
 	}
-
-	.regis-info-desc input {
+	
+	.regis-info-desc input{
 		position: relative;
 		left: 40rpx;
 		top: 27rpx;
 		letter-spacing: 1rpx;
 	}
-
-	.regis-info-linkman {
+	
+	.regis-info-linkman{
 		width: 100%;
 		height: 100rpx;
 		position: relative;
 		left: 20rpx;
 		border-bottom: 0.05px solid #B4BCCC;
 	}
-
-	.regis-info-linkman input {
+	
+	.regis-info-linkman input{
 		position: relative;
 		left: 70rpx;
 		top: 27rpx;
 		letter-spacing: 1rpx;
 	}
-
-	.info-title {
+	
+	.info-title{
 		letter-spacing: 1rpx;
 		float: left;
 		line-height: 100rpx;
 		font-weight: 530;
 	}
-
-	.regis-info input {
+	
+	.regis-info input{
 		position: relative;
 		left: 40rpx;
 		top: 27rpx;
 		letter-spacing: 1rpx;
 	}
-
-	.btn {
+	
+	.btn{
 		position: relative;
 		top: 40rpx;
 		background-color: #007AFF;
 		width: 180rpx;
 		height: 180rpx;
 		border-radius: 100rpx;
-		line-height: 180rpx;
+		line-height:180rpx;
 		color: #FFFFFF;
 		letter-spacing: 2rpx;
 	}
-
-	.type-select {
+	
+/* 	.tenant-select{
+		position: relative;
+		left: 35rpx;
+		top: 28rpx;
+	} */
+	
+	.type-select{
 		position: relative;
 		left: 45rpx;
 		top: 28rpx;
diff --git a/pages/riskReporting/riskReporting.vue b/pages/riskReporting/riskReporting.vue
index 371f653..42aa41d 100644
--- a/pages/riskReporting/riskReporting.vue
+++ b/pages/riskReporting/riskReporting.vue
@@ -6,7 +6,10 @@
 			</view>
 			<view class="row regis-info">
 				<text class="info-title"><!-- <span style="color: red;">* --></span>客户名称: </text>
-				<input class="input" type="text" v-model="tenantName" placeholder="请选择客户" placeholder-class="placeholder" />
+				<picker @change="tenantNameSelect" :range="tenantNameArray" class="tenant-select">
+					  <label class="" v-model="tenantName">{{ tenantNameArrayType }}</label>
+				</picker>
+				<!-- <input class="input" type="text" v-model="tenantName" placeholder="请选择客户" placeholder-class="placeholder" /> -->
 			</view>
 	        <view class="row regis-info">
 				<text class="info-title"><!-- <span style="color: red;">* --></span>风险等级: </text>
@@ -37,6 +40,7 @@
 		data () {
 			return {
 				riskTime:"",
+				tenantId:"",
 				tenantName:"",
 				riskClass:"",
 				riskDescribe:"",
@@ -50,28 +54,56 @@
 				// pathUrl: "http://localhost:89",
 				riskClassArray:["一级","二级","三级","四级"],
 				riskClassArrayIndex:0,
-				riskClassArrayType:'---请选择---'
+				riskClassArrayType:'---请选择---',
+				tenantArr:[],
+				tenantNameArray:[],
+				tenantNameArrayIndex:0,
+				tenantNameArrayType:'---请选择---'
 			}
 		},
 		onLoad() {
 			
 		},
 		methods: {
+			//获取客户信息
+			getTenantList(){
+				var that = this;
+				uni.request({
+					url: this.pathUrl + '/tenant/page',
+					method:'GET',
+					success: (res) => {
+						that.tenantArr = res.data.data.records;
+						if(that.tenantArr.length>0 ){
+							for (var i = 0; i < that.tenantArr.length; i++) {
+								if(that.tenantArr[i].tenantName!=""){
+									that.tenantNameArray.push(that.tenantArr[i].tenantName);
+								}
+							}
+						}
+					}
+				});
+			},
+			
+			//客户名称下拉改变事件
+			tenantNameSelect(e) {
+				var that = this;
+				this.tenantNameArrayIndex = e.target.value;
+				this.tenantNameArrayType=this.tenantNameArray[this.tenantNameArrayIndex];
+				//获取id
+				for (var i = 0; i < that.tenantArr.length; i++) {
+					if(that.tenantArr[i].tenantName==that.tenantNameArrayType){
+						that.tenantId = that.tenantArr[i].id;
+						that.tenantName = that.tenantArr[i].tenantName;
+					}
+				}
+				
+			},
 			
 			//风险等级下拉改变事件
 			riskClassSelect(e){
 				var that = this;
 				this.riskClassArrayIndex = e.target.value;
 				this.riskClassArrayType=this.riskClassArray[this.riskClassArrayIndex];
-				// if(that.typeArrayType == '学校'){
-				// 	that.type = 1;
-				// }
-				// if(that.typeArrayType =='医院'){
-				// 	that.type = 2;
-				// }
-				// if(that.typeArrayType =='小区'){
-				// 	that.type = 3;
-				// }
 			},
 			
 			
@@ -83,6 +115,7 @@
 					data:{
 							"riskTime":this.riskTime,
 							"riskNumber":this.$store.state.puserID,
+							"tenantId":this.tenantId,
 							"tenantName":this.tenantName,
 							"riskClass":this.riskClass,
 							"riskDescribe":this.riskDescribe,
@@ -172,4 +205,10 @@
 		left: 45rpx;
 		top: 28rpx;
 	}
+	
+	.tenant-select{
+		position: relative;
+		left: 45rpx;
+		top: 28rpx;
+	}
 </style>
diff --git a/pages/visitRecord/visitRecord.vue b/pages/visitRecord/visitRecord.vue
index c40a158..366bb61 100644
--- a/pages/visitRecord/visitRecord.vue
+++ b/pages/visitRecord/visitRecord.vue
@@ -9,11 +9,17 @@
 			</view>
 			<view class="row regis-info">
 				<text class="info-title"><!-- <span style="color: red;">* --></span>客户名称: </text>
-			    <input class="input" type="text"  v-model="yname" placeholder="请输客户名称" placeholder-class="placeholder" />
+				<picker @change="ynameSelect" :range="ynameArray" class="yname-select">
+					  <label class="" v-model="yname">{{ ynameArrayType }}</label>
+				</picker>
+			    <!-- <input class="input" type="text"  v-model="yname" placeholder="请输客户名称" placeholder-class="placeholder" /> -->
 			</view>
 			<view class="row regis-info">
 				<text class="info-title"><!-- <span style="color: red;">* --></span>客户类型: </text>
-			    <input class="input" type="text"  v-model="type" placeholder="请输客户类型" placeholder-class="placeholder" />
+				<picker @change="typeSelect" :range="typeArray" class="type-select">
+					  <label class="" v-model="typeArrayType">{{ typeArrayType }}</label>
+				</picker>
+			    <!-- <input class="input" type="text"  v-model="type" placeholder="请输客户类型" placeholder-class="placeholder" /> -->
 			</view>
 			<view class="row regis-info">
 				<text class="info-title"><!-- <span style="color: red;">* --></span>联系电话: </text>
@@ -41,6 +47,7 @@
 		data () {
 			return {
 				vistime:"",
+				ynumber:"",
 				yname:"",
 				type:"",
 				phone:"",
@@ -52,18 +59,85 @@
 				display2:'none',
 				display3:'none',
 				pathUrl:"https://web.byisf.com/api/blade-jfpts",
-				// pathUrl: "http://localhost:89"
+				// pathUrl: "http://localhost:89",
+				tenantArr:[],
+				ynameArray:[],
+				ynameArrayIndex:0,
+				ynameArrayType:'---请选择---',
+				typeArray:["学校","医院","小区"],
+				typeArrayIndex:0,
+				typeArrayType:'---请选择---'
 			}
 		},
 		onLoad() {
 			//进入页面后查询客户信息
-			this.getTenantInfo();
+			this.getTenantList();
 		},
 		methods: {
-			//查询客户信息
-			getTenantInfo(){
+			//获取客户信息
+			getTenantList(){
+				var that = this;
+				uni.request({
+					url: 'https://web.byisf.com/api/blade-system/tenant/page',
+					method:'GET',
+					success: (res) => {
+						that.tenantArr = res.data.data.records;
+						if(that.tenantArr.length>0 ){
+							for (var i = 0; i < that.tenantArr.length; i++) {
+								if(that.tenantArr[i].tenantName!=""){
+									that.ynameArray.push(that.tenantArr[i].tenantName);
+								}
+							}
+						}
+					}
+				});
+			},
+			
+			//客户名称下拉改变事件
+			ynameSelect(e) {
+				var that = this;
+				this.ynameArrayIndex = e.target.value;
+				this.ynameArrayType=this.ynameArray[this.ynameArrayIndex];
+				//获取id
+				for (var i = 0; i < that.tenantArr.length; i++) {
+					if(that.tenantArr[i].tenantName==that.ynameArrayType){
+						that.ynumber = that.tenantArr[i].id;
+						that.yname = that.tenantArr[i].tenantName;
+						that.linkman = that.tenantArr[i].linkman;
+						that.phone = that.tenantArr[i].contactNumber;
+						that.address = that.tenantArr[i].address;
+						that.type = that.tenantArr[i].type;
+						if(that.tenantArr[i].type=="1"){
+							that.typeArrayType = '学校';
+						}
+						if(that.tenantArr[i].type=="2"){
+							that.typeArrayType = '医院';
+						}
+						if(that.tenantArr[i].type=="3"){
+							that.typeArrayType = '小区';
+						}
+					}
+				}
 				
 			},
+			
+			//客户类型下拉改变事件
+			typeSelect(e){
+				var that = this;
+				this.typeArrayIndex = e.target.value;
+				this.typeArrayType=this.typeArray[this.typeArrayIndex];
+				if(that.typeArrayType == '学校'){
+					that.type = 1;
+				}
+				if(that.typeArrayType =='医院'){
+					that.type = 2;
+				}
+				if(that.typeArrayType =='小区'){
+					that.type = 3;
+				}
+			},
+			
+			
 			//提交修改
 			confirm(){
 				uni.request({
@@ -75,6 +149,7 @@
 							"vistime":this.vistime,
 							"snumber":this.$store.state.puserID,
 							"yname":this.yname,
+							"ynumber":this.ynumber,
 							"type":this.type,
 							"phone":this.phone,
 							"address":this.address,
@@ -150,4 +225,16 @@
 		top: 7rpx;
 		left: 20rpx;
 	}
+	
+	.yname-select{
+		position: relative;
+		left: 45rpx;
+		top: 28rpx;
+	}
+	
+	.type-select{
+		position: relative;
+		left: 45rpx;
+		top: 28rpx;
+	}
 </style>

--
Gitblit v1.9.3