Parcourir la source

认证的修改

刘远航 il y a 4 ans
Parent
commit
0bd1fa1755
1 fichiers modifiés avec 92 ajouts et 171 suppressions
  1. 92 171
      pages/login/doctorRenzheng.vue

+ 92 - 171
pages/login/doctorRenzheng.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -13,19 +13,19 @@
 		<view style="padding: 0 28rpx;">
 			<view class="flex align-center justify-between" style="margin: 20rpx 0;">
 				<view style="width: 30%;font-weight: bold;" class="felx align-center">医生姓名</view>
-				<text v-if="allupload">form.name</text>
+				<text v-if="allupload">{{form.name}}</text>
 				<u-input v-model="form.name" type="text" :border="false" placeholder="请填写真实姓名" input-align="right" maxlength="6" v-else/>
 			</view>
 			<u-line color="#f0f2f5" />
 			<view class="flex align-center justify-between" style="margin: 20rpx 0;">
 				<view style="width: 30%;font-weight: bold;" class="felx align-center">性别</view>
-				<text v-if="allupload">form.sex</text>
+				<text v-if="allupload">{{form.sex}}</text>
 				<u-icon name="arrow-down" color="#dddfe1" @click="sexshow = true" :label="form.sex==''?'请选择性别':form.sex" label-pos="left" :label-color="form.sex==''?'#c7c9ca':'#000000'" v-else></u-icon>
 			</view>
 			<u-line color="#f0f2f5" />
 			<view class="flex align-center justify-between" style="margin: 20rpx 0;">
 				<view style="width: 30%;font-weight: bold;" class="felx align-center">身份证</view>
-				<text v-if="allupload">form.ID</text>
+				<text v-if="allupload">{{form.ID}}</text>
 				<u-input v-model="form.ID" type="idcard" :border="false" placeholder="请填写身份证号" input-align="right" maxlength="18" v-else/>
 			</view>
 		</view>
@@ -123,6 +123,7 @@
 			this.provinceconfirm()
 			this.addmechanism()
 			this.docterInfos();
+		
 		},
 		mounted() {},
 		data() {
@@ -133,20 +134,7 @@
 					name: '', //姓名
 					sex: '', //性别
 					ID: '', //身份证
-					works: [ // 入库数组
-						{
-							hospital: '', //医院id
-							department: '', //科室id
-							qualifications: '' ,//资质id
-							state:0
-						},
-						{
-							hospital: '', //医院id
-							department: '', //科室id
-							qualifications: '', //资质id
-							state:0
-						}
-					],
+					works: [],
 					certificate: [], //证书
 					idPhoto: [], //身份证
 					doctorQualification: [], //医生资格
@@ -167,97 +155,12 @@
 
 				//省市区选择器
 				regionShow: false,
-				regionlist: [{
-						value: 1,
-						label: '中国',
-						children: [{
-								value: 2,
-								label: '广东',
-								children: [{
-										value: 3,
-										label: '深圳'
-									},
-									{
-										value: 4,
-										label: '广州'
-									}
-								]
-							},
-							{
-								value: 5,
-								label: '广西',
-								children: [{
-										value: 6,
-										label: '南宁'
-									},
-									{
-										value: 7,
-										label: '桂林'
-									}
-								]
-							}
-						]
-					},
-					{
-						value: 8,
-						label: '美国',
-						children: [{
-							value: 9,
-							label: '纽约',
-							children: [{
-								value: 10,
-								label: '皇后街区'
-							}]
-						}]
-					}
+				regionlist: [
 				],
 				regindex: 0, //记录点击的地方
 				//机构科室资质选择器
 				hospitalShow: false,
-				hospitallist: [{
-						value: 1,
-						label: '机构1',
-						children: [{
-								value: 2,
-								label: '机构1的科室1',
-								children: [{
-										value: 3,
-										label: '机构1的科室1的主任'
-									},
-									{
-										value: 4,
-										label: '机构1的科室1的副主任'
-									}
-								]
-							},
-							{
-								value: 5,
-								label: '机构1的科室2',
-								children: [{
-										value: 6,
-										label: '机构1的科室2的主任'
-									},
-									{
-										value: 7,
-										label: '机构1的科室2的主任'
-									}
-								]
-							}
-						]
-					},
-					{
-						value: 8,
-						label: '机构2',
-						children: [{
-							value: 9,
-							label: '机构2的科室1',
-							children: [{
-								value: 10,
-								label: '机构2的科室1的主任'
-							}]
-						}]
-					}
-				],
+				hospitallist: [],
 				hosindex: 0, //记录点击的地方
 				//提交之后不能修改姓名 身份证 性别 证书
 				allupload: false //是否已经提交过并且审核通过
@@ -272,6 +175,7 @@
 				if(res.status==0){
 					if(res.data!=undefined || res.data!="undefined"){
 						if(res.data.info.length!=undefined || res.data.info.length!='undefined'){
+							this.allupload = true;
 							this.form.name = res.data.info.name;
 							this.form.sex = res.data.info.sex==1?'男':'女';
 							this.form.ID = res.data.info.card_id; 
@@ -283,11 +187,6 @@
 						if(res.data.orgList.length!=0){
 							let orglist = res.data.orgList;
 							let oqflist = res.data.oqf;
-							// {
-							// 	hospital: '', //医院id
-							// 	department: '', //科室id
-							// 	qualifications: '' //资质id
-							// },
 							this.mechanismList.length=0;
 							this.form.works.length=0;
 							for(let i=0;i<orglist.length;i++){
@@ -347,12 +246,27 @@
 			},
 			//省市区选择器确认
 			regionChoice(e) {
-				console.log(e)
+				this.mechanismList[this.hosindex].hospitalText = '';
+				this.hospitalconfirm(e[0].value,e[1].value,e[2].value);
 				this.mechanismList[this.regindex].regionText = e[0].label + '-' + e[1].label + '-' + e[2].label //利用保存的地方赋值
 			},
 			//机构选择
 			hospitalChoice(e) {
-				console.log(e)
+				if(typeof this.form.works[this.hosindex]==undefined || typeof this.form.works[this.hosindex]=='undefined'){
+					this.form.works.push({
+						hospital: e[0].value, //医院id
+						department: e[1].value, //科室id
+						qualifications: e[2].value, //资质id
+						state:0,
+					})
+				}else{
+					this.form.works[this.hosindex].hospital = e[0].value;
+					this.form.works[this.hosindex].department = e[1].value;
+					this.form.works[this.hosindex].qualifications = e[2].value;
+					this.form.works[this.hosindex].state = 0;
+				}
+				
+				
 				this.mechanismList[this.hosindex].hospitalText = e[0].label + '-' + e[1].label + '-' + e[2].label
 			},
 			//数字转文字
@@ -380,7 +294,7 @@
 			},
 			//保存机构
 			bcmechanism() {
-				if (this.mechanismList[this.mechanismList.length - 1].regionText == '' && this.mechanismList[this.mechanismList.length -
+				if (this.mechanismList[this.mechanismList.length - 1].regionText == '' || this.mechanismList[this.mechanismList.length -
 						1].hospitalText == '') {
 					uni.showToast({
 						title: '请完善机构信息',
@@ -415,6 +329,7 @@
 				// console.log('省', res.data)
 				// this.provincelist = this.provincelist2 = res.data
 				this.regionlist = res.data
+				
 			},
 			//市
 			cityconfirm: async function(e) {
@@ -458,10 +373,8 @@
 				console.log('提交的数据', c)
 				console.log('提交的数据', a)
 				console.log('医院', res.data)
-				if (this.area == 1) {
+				if(res.status==0){
 					this.hospitallist = res.data
-				} else if (this.area == 2) {
-					this.hospitallist2 = res.data
 				}
 			},
 			//科室
@@ -490,73 +403,81 @@
 			},
 			// 保存
 			bc: async function() {
-				this.allupload = true
+				
+				if(this.mechanismList[this.mechanismList.length - 1].preservation == false){
+					uni.showModal({
+						'title':'请先保存机构!'
+					})
+					return false;
+				}
 				//保存之后改变机构信息状态
-				this.mechanismList.map(val => {
+			/* 	this.mechanismList.map(val => {
 					//判断是不是新增的数据    状态为0
 					if(val.Submit==0){
 						val.Submit = 1;
 					}
-				})
+				}) */
+				
+				//照片
+				let practice = [] //证书
+				let card_photo = [] //身份证
+				let is_quali = [] //资格
+				// 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
+				// practice = this.$refs.uUpload.lists.filter(val => {
+				// 	return val.progress == 100;
+				// })
+				// card_photo = this.$refs.uUpload.lists.filter(val => {
+				// 	return val.progress == 100;
+				// })
+				// is_quail = this.$refs.uUpload.lists.filter(val => {
+				// 	return val.progress == 100;
+				// })
 				
-				// //照片
-				// let practice = [] //证书
-				// let card_photo = [] //身份证
-				// let is_quali = [] //资格
-				// // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
-				// // practice = this.$refs.uUpload.lists.filter(val => {
-				// // 	return val.progress == 100;
-				// // })
-				// // card_photo = this.$refs.uUpload.lists.filter(val => {
-				// // 	return val.progress == 100;
-				// // })
-				// // is_quail = this.$refs.uUpload.lists.filter(val => {
-				// // 	return val.progress == 100;
-				// // })
-				// // 如果您不需要进行太多的处理,直接如下即可
-				// practice = this.$refs.Upractice.lists; //证书
-				// card_photo = this.$refs.Ucard_photo.lists; //身份证
-				// is_quali = this.$refs.Uis_quali.lists; //资格
+				// 如果您不需要进行太多的处理,直接如下即可
+	/* 			practice = this.$refs.Upractice.lists; //证书
+				card_photo = this.$refs.Ucard_photo.lists; //身份证
+				is_quali = this.$refs.Uis_quali.lists; //资格
 
-				// if (typeof practice[0] == 'undefined' || typeof practice[1] == 'undefined') {
-				// 	uni.showToast({
-				// 		'title': '医师职业证书必填',
-				// 		icon: "none"
-				// 	})
-				// 	return false;
-				// }
+				if (typeof practice[0] == 'undefined' || typeof practice[1] == 'undefined') {
+					uni.showToast({
+						'title': '医师职业证书必填',
+						icon: "none"
+					})
+					return false;
+				}
 
-				// if (typeof card_photo[0] == 'undefined' || typeof card_photo[1] == 'undefined') {
-				// 	uni.showToast({
-				// 		'title': '身份证必填',
-				// 		icon: "none"
-				// 	})
-				// 	return false;
-				// }
-				// if (typeof is_quali[0] == 'undefined' || typeof is_quali[1] == 'undefined') {
-				// 	uni.showToast({
-				// 		'title': '资格证必填',
-				// 		icon: "none"
-				// 	})
-				// 	return false;
-				// }
-				// this.form.certificate = [practice[0].response.data.url, practice[1].response.data.url]
-				// this.form.idPhoto = [card_photo[0].response.data.url, card_photo[1].response.data.url]
-				// this.form.doctorQualification = [is_quali[0].response.data.url, is_quali[1].response.data.url]
+				if (typeof card_photo[0] == 'undefined' || typeof card_photo[1] == 'undefined') {
+					uni.showToast({
+						'title': '身份证必填',
+						icon: "none"
+					})
+					return false;
+				}
+				if (typeof is_quali[0] == 'undefined' || typeof is_quali[1] == 'undefined') {
+					uni.showToast({
+						'title': '资格证必填',
+						icon: "none"
+					})
+					return false;
+				}
+				this.form.certificate = [practice[0].response.data.url, practice[1].response.data.url]
+				this.form.idPhoto = [card_photo[0].response.data.url, card_photo[1].response.data.url]
+				this.form.doctorQualification = [is_quali[0].response.data.url, is_quali[1].response.data.url] */
 
 
-				// if (typeof this.form.works != 'string') {
-				// 	this.form.works = JSON.stringify(this.form.works);
-				// }
+				if (typeof this.form.works != 'string') {
+					this.form.works = JSON.stringify(this.form.works);
+				}
+				console.log('提交表单!',this.form);
 
-				// // 注意要 {'doctor_name':'ddd',doctor_sex:1....}分开传值因为我方便拦截垃圾数据
-				// let res = await this.$request.post('doctor/addthen', this.form);
-				// console.log('res...:', res);
-				// if (res.status == 0) {
-				// 	uni.switchTab({
-				// 		url: '../index/index'
-				// 	})
-				// }
+				// 注意要 {'doctor_name':'ddd',doctor_sex:1....}分开传值因为我方便拦截垃圾数据
+				let res = await this.$request.post('doctor/addthen', this.form);
+				console.log('res...:', res);
+				if (res.status == 0) {
+					uni.switchTab({
+						url: '../index/index'
+					})
+				}
 
 			},
 			ChooseImage() {