Browse Source

修改bug

wangxy 2 days ago
parent
commit
f7c554eb2c

+ 2 - 0
api/hetong.js

@@ -46,3 +46,5 @@ export function getHetongInfo(data = {}) {
 }
 }
 
 
 
 
+
+

+ 11 - 0
api/sanfang.js

@@ -127,3 +127,14 @@ export function getSanfangShengxiao(data = {}) {
 }
 }
 
 
 
 
+export function getHetongSanfangMoban(data = {}) {
+  return request({
+    url: '/app/guanliyuan/sanfang/moban/preview',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}

+ 10 - 2
pages/admin/Hetong/addSanfangHetong.vue

@@ -69,6 +69,7 @@
 	import qiTaYueDingVue from "./components/qiTaYueDing.vue";
 	import qiTaYueDingVue from "./components/qiTaYueDing.vue";
 	import commonDialog from '@/components/dialog/commonDialog.vue';
 	import commonDialog from '@/components/dialog/commonDialog.vue';
 	import pdfPreviewVue from "./components/pdfPreview.vue";
 	import pdfPreviewVue from "./components/pdfPreview.vue";
+	import {toast} from "@/utils/common.js"
 
 
 	import {
 	import {
 		useHetong
 		useHetong
@@ -149,8 +150,15 @@
 	}
 	}
 
 
 	function handlePreviewPdf() {
 	function handlePreviewPdf() {
-		const imgList = data.mobanList[data.mobanIndex] && data.mobanList[data.mobanIndex].base64List;
-		imgList && pdfRef.value.showPDF(imgList)
+		const id = data.mobanList[data.mobanIndex] && data.mobanList[data.mobanIndex].id;
+		
+		if (id) {
+			httpApi.getHetongSanfangMoban({id: id}).then(res => {
+				 pdfRef.value.showPDF(res.data.base64List)
+			}).finally(() => {
+				
+			})
+		}
 	}
 	}
 
 
 	function goUpPage() {
 	function goUpPage() {

+ 61 - 2
pages/admin/Hetong/components/addKh.vue

@@ -35,15 +35,21 @@
     	<button type="default" class="phone-green-btn info-btn" @click="saveBtn">保存</button>
     	<button type="default" class="phone-green-btn info-btn" @click="saveBtn">保存</button>
     </view>
     </view>
   </uni-popup>
   </uni-popup>
+  
+  <commonDialogVue ref="comRef" :content="content" @confirm-btn="htAdd2"></commonDialogVue>
 </template>
 </template>
 
 
 <script setup>
 <script setup>
 import {ref,reactive,nextTick} from "vue";
 import {ref,reactive,nextTick} from "vue";
 import {onLoad} from "@dcloudio/uni-app";
 import {onLoad} from "@dcloudio/uni-app";
-import * as khApi from "@/api/kehu.js"
+import * as khApi from "@/api/kehu.js";
+import commonDialogVue from "@/components/dialog/commonDialog.vue";
 
 
 const emits = defineEmits('success')
 const emits = defineEmits('success')
 
 
+const comRef = ref(null);
+const content = ref('');
+
 const formData = reactive({
 const formData = reactive({
 	realName: '',
 	realName: '',
 	userName: '',
 	userName: '',
@@ -58,6 +64,7 @@ function goback2() {
   formData.userName = '';
   formData.userName = '';
   formData.idcard = '';
   formData.idcard = '';
   formData.idtype = '1';
   formData.idtype = '1';
+  content.value = null;
   
   
 }
 }
 
 
@@ -103,9 +110,60 @@ function htAdd(){
 		userName: formData.userName,
 		userName: formData.userName,
 		idtype: formData.idtype,
 		idtype: formData.idtype,
 		idcard: formData.idcard,
 		idcard: formData.idcard,
+		checked: 0
+	}
+	khApi.getKehuAdd(opt).then(res => {
+		if (res.data.result) {
+			uni.showToast({
+				title: '新增成功'
+			})
+			goback2();
+			emits('success')
+			nextTick(() => {
+				formData.realName = '';
+				formData.userName = '';
+				formData.idcard = '';
+				formData.idtype = '1';
+				content.value = null;
+			})
+		} else {
+			// 有重复数据
+			content.value = res.data.message;
+			comRef.value.handleShow();
+		}
+	}).finally(()=>{
+		uni.hideLoading()
+	})
+}
+
+function htAdd2(){
+	let arr = [];
+	if (!formData.realName) {
+		arr.push('姓名');
+	}
+	if (!formData.userName) {
+		arr.push('电话');
+	}
+	if (!formData.realName || !formData.userName) {
+		uni.showToast({
+			icon: 'none',
+			title: `请完善${arr.join('、')}信息!`
+		})
+		return;
+	}
+	uni.showLoading({
+	      title: '新增中...',
+	      mask: true
+	    });
+	const opt = {
+		realName: formData.realName,
+		userName: formData.userName,
+		idtype: formData.idtype,
+		idcard: formData.idcard,
+		checked: 1
 	}
 	}
 	khApi.getKehuAdd(opt).then(res => {
 	khApi.getKehuAdd(opt).then(res => {
-		if (res.data) {
+		if (res.data.result) {
 			uni.showToast({
 			uni.showToast({
 				title: '新增成功'
 				title: '新增成功'
 			})
 			})
@@ -116,6 +174,7 @@ function htAdd(){
 				formData.userName = '';
 				formData.userName = '';
 				formData.idcard = '';
 				formData.idcard = '';
 				formData.idtype = '1';
 				formData.idtype = '1';
+				content.value = null;
 			})
 			})
 		}
 		}
 	}).finally(()=>{
 	}).finally(()=>{

+ 229 - 126
pages/admin/kehu/kehuInfo.vue

@@ -7,14 +7,12 @@
 		<view>
 		<view>
 			<view class="form-label-input">
 			<view class="form-label-input">
 				<view class="phone-form-label"><text class="form-label-require">*</text>姓名</view>
 				<view class="phone-form-label"><text class="form-label-require">*</text>姓名</view>
-				<uni-easyinput v-model="formData.realName"
-					placeholder="请输入姓名" />
+				<uni-easyinput v-model="formData.realName" placeholder="请输入姓名" />
 			</view>
 			</view>
-			
+
 			<view class="form-label-input">
 			<view class="form-label-input">
 				<view class="phone-form-label"><text class="form-label-require">*</text>手机号</view>
 				<view class="phone-form-label"><text class="form-label-require">*</text>手机号</view>
-				<uni-easyinput type="number" v-model="formData.userName"
-					placeholder="请输入手机号" maxlength="11" />
+				<uni-easyinput type="number" v-model="formData.userName" placeholder="请输入手机号" maxlength="11" />
 			</view>
 			</view>
 			<view class="form-label-input">
 			<view class="form-label-input">
 				<view class="phone-form-label">
 				<view class="phone-form-label">
@@ -32,149 +30,254 @@
 			</view>
 			</view>
 		</view>
 		</view>
 		<button type="default" class="phone-green-btn info-btn" @click="saveBtn">保存</button>
 		<button type="default" class="phone-green-btn info-btn" @click="saveBtn">保存</button>
+
+		<commonDialogVue ref="comRefAdd" :content="contentAdd" @confirm-btn="htAdd2"></commonDialogVue>
+		<commonDialogVue ref="comRefEditor" :content="contentEditor" @confirm-btn="htAdd2"></commonDialogVue>
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-import {ref,reactive} from "vue";
-import {onLoad} from "@dcloudio/uni-app";
-import * as khApi from "@/api/kehu.js"
-const formData = reactive({
-	realName: '',
-	userName: '',
-	idcard: '',
-	idtype: '1',
-	
-jutidizhi: '',
-	pageFlag:'add',
-	id:null,
-	userId:null,
-})
-
-// 返回
-function goUpPage() {
-	uni.redirectTo({
-		url: '/pages/admin/kehu/kehuList'
+	import {
+		ref,
+		reactive
+	} from "vue";
+	import {
+		onLoad
+	} from "@dcloudio/uni-app";
+	import * as khApi from "@/api/kehu.js"
+	const formData = reactive({
+		realName: '',
+		userName: '',
+		idcard: '',
+		idtype: '1',
+
+		jutidizhi: '',
+		pageFlag: 'add',
+		id: null,
+		userId: null,
 	})
 	})
-}
-function idCardChange(data) {
-	formData.idtype = formData.idtype == 1 ? 2 : 1;
-}
-
-// 保存
-function saveBtn(){
-	if(formData.pageFlag==='editor'){
-		htEditor();
-	}else{
-		htAdd();
+
+	const contentAdd = ref('');
+	const contentEditor = ref('');
+
+	const comRefAdd = ref(null);
+	const comRefEditor = ref(null)
+
+	// 返回
+	function goUpPage() {
+		uni.redirectTo({
+			url: '/pages/admin/kehu/kehuList'
+		})
 	}
 	}
-}
-
-// 新增
-function htAdd(){
-	
-	let arr = [];
-	if (!formData.realName) {
-		arr.push('姓名');
+
+	function idCardChange(data) {
+		formData.idtype = formData.idtype == 1 ? 2 : 1;
 	}
 	}
-	if (!formData.userName) {
-		arr.push('电话');
+
+	// 保存
+	function saveBtn() {
+		if (formData.pageFlag === 'editor') {
+			htEditor();
+		} else {
+			htAdd();
+		}
 	}
 	}
-	if (!formData.realName || !formData.userName) {
-		uni.showToast({
-			icon: 'none',
-			title: `请完善${arr.join('、')}信息!`
+
+	// 新增
+	function htAdd() {
+
+		let arr = [];
+		if (!formData.realName) {
+			arr.push('姓名');
+		}
+		if (!formData.userName) {
+			arr.push('电话');
+		}
+		if (!formData.realName || !formData.userName) {
+			uni.showToast({
+				icon: 'none',
+				title: `请完善${arr.join('、')}信息!`
+			})
+			return;
+		}
+
+		uni.showLoading({
+			title: '新增中...',
+			mask: true
+		});
+		const opt = {
+			realName: formData.realName,
+			userName: formData.userName,
+			idtype: formData.idtype,
+			idcard: formData.idcard,
+			jutidizhi: formData.jutidizhi,
+			checked: 0
+		}
+		khApi.getKehuAdd(opt).then(res => {
+			if (res.data.result) {
+				uni.showToast({
+					title: '新增成功'
+				})
+				goUpPage();
+			} else {
+				contentAdd.value = res.data.message;
+				comRefAdd.value.handleShow();
+			}
+		}).finally(() => {
+			uni.hideLoading()
 		})
 		})
-		return;
 	}
 	}
-	
-	uni.showLoading({
-	      title: '新增中...',
-	      mask: true
-	    });
-	const opt = {
-		realName: formData.realName,
-		userName: formData.userName,
-		idtype: formData.idtype,
-		idcard: formData.idcard,
-		jutidizhi: formData.jutidizhi,
-	}
-	khApi.getKehuAdd(opt).then(res => {
-		if (res.data) {
+
+	function htAdd2() {
+
+		let arr = [];
+		if (!formData.realName) {
+			arr.push('姓名');
+		}
+		if (!formData.userName) {
+			arr.push('电话');
+		}
+		if (!formData.realName || !formData.userName) {
 			uni.showToast({
 			uni.showToast({
-				title: '新增成功'
+				icon: 'none',
+				title: `请完善${arr.join('、')}信息!`
 			})
 			})
-			goUpPage();
+			return;
 		}
 		}
-	}).finally(()=>{
-		uni.hideLoading()
-	})
-}
-
-// 编辑
-function handleEditor() {
-	khApi.getKehuInfo({
-		userId: formData.userId,
-		id:formData.id,
-	}).then(res => {
-		formData.realName = res.data.realName,
-		formData.userName = res.data.userName,
-		formData.idcard = res.data.idcard;
-		formData.idtype = res.data.idtype;
-		formData.addres = res.data.addres;
-		formData.jutidizhi = res.data.jutidizhi;
-		formData.idtype = res.data.idtype;
-				
-	})
-}
 
 
-function htEditor(){
-	let arr = [];
-	if (!formData.realName) {
-		arr.push('姓名');
-	}
-	if (!formData.userName) {
-		arr.push('电话');
+		uni.showLoading({
+			title: '新增中...',
+			mask: true
+		});
+		const opt = {
+			realName: formData.realName,
+			userName: formData.userName,
+			idtype: formData.idtype,
+			idcard: formData.idcard,
+			jutidizhi: formData.jutidizhi,
+			checked:1
+		}
+		khApi.getKehuAdd(opt).then(res => {
+			if (res.data) {
+				uni.showToast({
+					title: '新增成功'
+				})
+				goUpPage();
+			}
+		}).finally(() => {
+			uni.hideLoading()
+		})
 	}
 	}
-	if (!formData.realName || !formData.userName) {
-		uni.showToast({
-			icon: 'none',
-			title: `请完善${arr.join('、')}信息!`
+
+
+	// 编辑
+	function handleEditor() {
+		khApi.getKehuInfo({
+			userId: formData.userId,
+			id: formData.id,
+		}).then(res => {
+			formData.realName = res.data.realName,
+				formData.userName = res.data.userName,
+				formData.idcard = res.data.idcard;
+			formData.idtype = res.data.idtype;
+			formData.addres = res.data.addres;
+			formData.jutidizhi = res.data.jutidizhi;
+			formData.idtype = res.data.idtype;
+
 		})
 		})
-		return;
 	}
 	}
-	uni.showLoading({
-	      title: '更新中...',
-	      mask: true
-	    });
-	const opt = {
-		userId: formData.userId,
-		realName: formData.realName,
-		userName: formData.userName,
-		idtype: formData.idtype,
-		idcard: formData.idcard,
-		jutidizhi: formData.jutidizhi,
+
+	function htEditor() {
+		let arr = [];
+		if (!formData.realName) {
+			arr.push('姓名');
+		}
+		if (!formData.userName) {
+			arr.push('电话');
+		}
+		if (!formData.realName || !formData.userName) {
+			uni.showToast({
+				icon: 'none',
+				title: `请完善${arr.join('、')}信息!`
+			})
+			return;
+		}
+		uni.showLoading({
+			title: '更新中...',
+			mask: true
+		});
+		const opt = {
+			userId: formData.userId,
+			realName: formData.realName,
+			userName: formData.userName,
+			idtype: formData.idtype,
+			idcard: formData.idcard,
+			jutidizhi: formData.jutidizhi,
+			checked: 0
+		}
+		khApi.getKehuUpdate(opt).then(res => {
+			if (res.data.result) {
+				uni.showToast({
+					title: '编辑成功'
+				})
+				goUpPage();
+			} else {
+				contentEditor.value = res.data.message;
+				comRefEditor.value.handleShow();
+			}
+		}).finally(() => {
+			uni.hideLoading()
+		})
 	}
 	}
-	khApi.getKehuUpdate(opt).then(res => {
-		if (res.data) {
+
+	function htEditor2() {
+		let arr = [];
+		if (!formData.realName) {
+			arr.push('姓名');
+		}
+		if (!formData.userName) {
+			arr.push('电话');
+		}
+		if (!formData.realName || !formData.userName) {
 			uni.showToast({
 			uni.showToast({
-				title: '编辑成功'
+				icon: 'none',
+				title: `请完善${arr.join('、')}信息!`
 			})
 			})
-			goUpPage();
+			return;
 		}
 		}
-	}).finally(()=>{
-		uni.hideLoading()
-	})
-}
-	
-onLoad((options) => {
-	if(options.id && options.userId){
-		formData.pageFlag = 'editor';
-		formData.id = options.id;
-		formData.userId = options.userId;
-		handleEditor();
+		uni.showLoading({
+			title: '更新中...',
+			mask: true
+		});
+		const opt = {
+			userId: formData.userId,
+			realName: formData.realName,
+			userName: formData.userName,
+			idtype: formData.idtype,
+			idcard: formData.idcard,
+			jutidizhi: formData.jutidizhi,
+			checked: 1
+		}
+		khApi.getKehuUpdate(opt).then(res => {
+			if (res.data) {
+				uni.showToast({
+					title: '编辑成功'
+				})
+				goUpPage();
+			}
+		}).finally(() => {
+			uni.hideLoading()
+		})
 	}
 	}
-})
+
+	onLoad((options) => {
+		if (options.id && options.userId) {
+			formData.pageFlag = 'editor';
+			formData.id = options.id;
+			formData.userId = options.userId;
+			handleEditor();
+		}
+	})
 </script>
 </script>
 
 
 <style>
 <style>