From df481aebfb7a19eea5d6c02f93c6f5776b0fdc19 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 23 五月 2025 18:30:41 +0800
Subject: [PATCH] 界面大模式

---
 pages/selpsn/index.vue |  260 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 151 insertions(+), 109 deletions(-)

diff --git a/pages/selpsn/index.vue b/pages/selpsn/index.vue
index 8445b92..3eb218a 100644
--- a/pages/selpsn/index.vue
+++ b/pages/selpsn/index.vue
@@ -1,50 +1,8 @@
-<style>
-	.content {
-		width: 100vw;
-		height: 93vh;
-		background: #EAEAEA;
-		padding: 14rpx 0rpx 0rpx 0rpx;
-	}
-	input{
-		border: 1px solid #d5d5d5;
-		width: 77%;
-		height: 80rpx;
-		border-radius: 60rpx!important;
-		padding: 0 60rpx 0 66rpx;
-		margin: 0rpx 20rpx 10rpx 20rpx;
-		background: #FFF;
-	}
-	.dv_query_body {
-	    height: 91%;
-		overflow: auto;
-	    background-color: #fff;
-	    border: 2rpx solid #d5d5d5;
-	    padding: 14rpx;
-	}
-	.psn {
-	    margin: 0 12rpx 12rpx 0;
-	    padding: 8rpx 20rpx 10rpx;
-	    background-color: #55a1dd;
-	    font-size: 30rpx;
-	    color: #fff;
-	    border-radius: 20rpx;
-	    display: inline-block;
-	    cursor: pointer;
-	}
-	button.btn_sava {
-		margin-top: 47rpx;
-		padding: 20rpx;
-		line-height: 1.2;
-		background: #27A6E1;
-		border: none;
-		color: #fff;
-	}
-</style>
-
 <template>
-	<view class="content">
+	<view class="uni-page-selpsn" :class="largeMode?'large-mode':''">
 		<view style="height:90%;">
-			<input type="text" class="txt_search" v-model="searchVal" @input="onkeyup" placeholder="璇疯緭鍏ヤ汉鍛樺鍚嶆垨绠�嫾杩涜鏌ヨ" >
+			<input type="text" class="txt_search" v-model="searchVal" @input="onkeyup"
+				:placeholder="translate('input_user_name_jp_query')">
 			<!-- <div class="dv_query_body" >
 				<div class="psn">
 					<checkbox-group class="ischeck" @change="onchange" data-ischeck="false" data-index="0" >
@@ -57,7 +15,7 @@
 			</div> -->
 			<div class="dv_query_body">
 				<div class="psn" v-for="(psn,index) in data">
-					<checkbox-group class="ischeck" @change="onchange" :data-ischeck="psn.ischeck" :data-index="index" >
+					<checkbox-group class="ischeck" @change="onchange" :data-ischeck="psn.ischeck" :data-index="index">
 						<label>
 							<checkbox :checked="psn.ischeck" />
 							<text>{{psn.Name}}</text>
@@ -65,103 +23,187 @@
 					</checkbox-group>
 				</div>
 			</div>
-			
-			<button type="default" @tap="sava" class="btn_sava">纭畾</button>
+
+			<button type="default" @tap="sava" class="btn_sava">{{translateSys("ok")}}</button>
 		</view>
-		
+
 	</view>
-</template> 
+</template>
 
 <script>
+	import {
+		querySelPsn
+	} from "@/api/index.js"
 	export default {
 		data() {
 			return {
-				title: '閫夋嫨浜哄憳',
-				mulit:'',
-				param:{},
-				searchVal:'',
-				ischecked:false,
-				data:[]
+					largeMode: getApp().globalData.largeMode || false,
+				title: this.translate('select_user'),
+				mulit: '',
+				param: {},
+				searchVal: '',
+				ischecked: false,
+				data: []
 			}
 		},
 		onLoad(options) {
 			console.log(options);
 			var param = JSON.parse(options.param);
-			this.$data.param=param;
-			this.$data.mulit=options.mulit;
-			// console.log(this.$data.param);
+			this.param = param;
+			this.mulit = options.mulit;
+			// console.log(this.param);
 		},
 		methods: {
+			setData(obj) {
+				let that = this;
+				let keys = [];
+				let val, data;
+			
+				Object.keys(obj).forEach(function(key) {
+					keys = key.split(".");
+					val = obj[key];
+					data = that.$data;
+					keys.forEach(function(key2, index) {
+						if (index + 1 == keys.length) {
+							that.$set(data, key2, val);
+						} else {
+							if (!data[key2]) {
+								that.$set(data, key2, {});
+							}
+						}
+						data = data[key2];
+					});
+				});
+			},
+			
 			onkeyup(e) {
 				console.log(e);
-				console.log(this.$data.searchVal);
-				if(this.$data.searchVal){
-					var datainfo ={ jp: this.$data.searchVal, dept_id: '' };
-					// console.log(datainfo);
-					this.$store.dispatch('querySelpsn',datainfo).then(success=>{
-						console.log(success);
-						if (success.code=='00000') { //Mobox2
-							for(var i in success.data){
-								success.data[i].ischeck=false;
-							}
-							this.$data.data = success.data;
-						} else if(success.err_code == 0){ //Mobox3
-							var json =[];
-							for(var i in success.result){
+				console.log(this.searchVal);
+				if (this.searchVal) {
+					var datainfo = {
+						jp: this.searchVal,
+						dept_id: ''
+					};
+					querySelPsn(datainfo).then(res => {
+							const result = res || []
+							var json = [];
+							for (var i in result) {
 								json.push({
-									Login: success.result[i].login,
-									Name: success.result[i].name,
-									NamePY: success.result[i].name_py,
-									Sex: success.result[i].gender,
-									State: success.result[i].status,
-									Level: success.result[i].level,
+									Login: result[i].login,
+									Name: result[i].name,
+									NamePY: result[i].name_py,
+									Sex: result[i].gender,
+									State: result[i].status,
+									Level: result[i].level,
 									Depart: "",
 									Unit: "",
-									ischeck:false
+									ischeck: false
 								})
 							}
-							this.$data.data = json;
-						} else{
-							uni.showModal({title:"閿欒",content:success.msg?success.msg:success.err_msg,showCancel:false,confirmText:"鍙栨秷"});
-						}
-					}).catch(ex=>{
-						// console.log(ex);
-						uni.showModal({title:"閿欒",content:ex.errMsg,showCancel:false,confirmText:"鍙栨秷"});
-					});
-				} else 
-					this.$data.data = [];
+							this.data = json;
+						})
+						.catch(ex => {
+							// console.log(ex);
+							uni.showModal({
+								title: this.translateSys("error"),
+								content: ex.errMsg,
+								showCancel: false,
+								confirmText: this.translateSys("close")
+							});
+						});
+				} else
+					this.data = [];
 			},
 			onchange(e) {
 				// console.log(e.target);
-				var data = this.$data.data;
-				this.$data.data=[];
-				if(this.$data.mulit=="false"){
-					for(var i in data){
-						data[i].ischeck=false;
+				var data = this.data;
+				this.data = [];
+				if (this.mulit == "false") {
+					for (var i in data) {
+						data[i].ischeck = false;
 					}
 				}
-				
-				data[e.target.dataset.index].ischeck=e.target.dataset.ischeck?false:true
-				this.$data.data=data;
+
+				data[e.target.dataset.index].ischeck = e.target.dataset.ischeck ? false : true
+				this.data = data;
 			},
-			sava(){ //鐐瑰嚮鍔熻兘鐐硅烦杞〉闈�+			sava() { //鐐瑰嚮鍔熻兘鐐硅烦杞〉闈� 				var data = [];
-				for(var i in this.$data.data){
-					if(this.$data.data[i].ischeck==true){
-						data.push(this.$data.data[i]);
+				for (var i in this.data) {
+					if (this.data[i].ischeck == true) {
+						data.push(this.data[i]);
 					}
 				}
-				if(data.length==0){
-					uni.showModal({title:"鎻愮ず",content:'鏈�鎷╀汉鍛橈紒',showCancel:false,confirmText:"鍙栨秷"});
+				if (data.length == 0) {
+					uni.showModal({
+						title: this.translateSys("tip"),
+						content: this.translate('tip_no_select_user'),
+						showCancel: false,
+						confirmText: this.translateSys("close")
+					});
 					return;
 				}
-				const eventChannel = this.$scope.eventChannel;
+				const eventChannel = this.getOpenerEventChannel();
 				// const eventChannel = this.getOpenerEventChannel();
-				eventChannel.emit('AddPer',data,this.$data.param);
-				
+				eventChannel.emit('AddPer', data, this.param);
+
 				uni.navigateBack()
-			}
-		
+			},
+			translate(t) {
+				if (typeof this.$t == "function") return this.$t(`page.${t}`)
+				else return t;
+			},
+			translateSys(t) {
+				if (typeof this.$t == "function") return this.$t(`sys.${t}`)
+				else return t;
+			},
+
 		}
 	}
 </script>
+<style lang="scss">
+	.uni-page-selpsn {
+		width: 100vw;
+		height: 93vh;
+		background: #EAEAEA;
+		padding: 14rpx 0rpx 0rpx 0rpx;
+
+		input {
+			border: 1px solid #d5d5d5;
+			width: 77%;
+			height: 80rpx;
+			border-radius: 60rpx !important;
+			padding: 0 60rpx 0 66rpx;
+			margin: 0rpx 20rpx 10rpx 20rpx;
+			background: #FFF;
+		}
+
+		.dv_query_body {
+			height: 91%;
+			overflow: auto;
+			background-color: #fff;
+			border: 2rpx solid #d5d5d5;
+			padding: 14rpx;
+		}
+
+		.psn {
+			margin: 0 12rpx 12rpx 0;
+			padding: 8rpx 20rpx 10rpx;
+			background-color: #55a1dd;
+			font-size: 30rpx;
+			color: #fff;
+			border-radius: 20rpx;
+			display: inline-block;
+			cursor: pointer;
+		}
+
+		button.btn_sava {
+			margin-top: 47rpx;
+			padding: 20rpx;
+			line-height: 1.2;
+			background: #27A6E1;
+			border: none;
+			color: #fff;
+		}
+	}
+</style>
\ No newline at end of file

--
Gitblit v1.9.1