From 08b2db8f26e6b508c7ed9a59006cff3005db5895 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 06 六月 2025 16:03:39 +0800
Subject: [PATCH] test

---
 pages/selPrj/index.vue |  306 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 188 insertions(+), 118 deletions(-)

diff --git a/pages/selPrj/index.vue b/pages/selPrj/index.vue
index 855c14a..09989bb 100644
--- a/pages/selPrj/index.vue
+++ b/pages/selPrj/index.vue
@@ -1,56 +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%;
-	    background-color: #fff;
-	    border: 2rpx solid #d5d5d5;
-	    padding: 14rpx;
-		overflow-y: auto;
-	}
-	.psn {
-		width: 93%;
-	    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;
-	}
-	.dv_title{
-		display: inline-block;
-		width: 90%;
-		vertical-align: middle;
-	}
-	button.btn_sava {
-		margin-top: 60rpx;
-		padding: 20rpx;
-		line-height: 1.2;
-		background: #27A6E1;
-		border: none;
-		color: #fff;
-	}
-</style>
-
 <template>
-	<view class="content">
+	<view class="uni-page-selprj" :class="largeMode?'large-mode':''">
 		<view style="height:90%;">
-			<input type="text" class="txt_search" v-model="searchVal"  @keyup="onkeyup" placeholder="璇疯緭鍏ラ」鐩悕绉拌繘琛屾煡璇� >
+			<input type="text" class="txt_search" v-model="searchVal" @keyup="onkeyup"
+				:placeholder="translate('input_project_name_query')">
 			<!-- <div class="dv_query_body" >
 				<div class="psn">
 					<checkbox-group class="ischeck" @change="onchange" data-ischeck="false" data-index="0" >
@@ -61,116 +13,234 @@
 					</checkbox-group>
 				</div>
 			</div> -->
-			
+
 			<div class="dv_query_body">
 				<div class="psn" v-for="(prj,index) in data">
-					<checkbox-group class="ischeck" @change="onchange" :data-ischeck="prj.ischeck" :data-index="index" >
+					<checkbox-group class="ischeck" @change="onchange" :data-ischeck="prj.ischeck" :data-index="index">
 						<label>
-							<checkbox :checked="prj.ischeck"  />
+							<checkbox :checked="prj.ischeck" />
 							<div class="dv_title">{{prj.PrjCode}}-{{prj.Name}}-({{prj.PMName}})</div>
 						</label>
 					</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 {
+		projectGetAnalysisList
+	} from "@/api/index.js"
 	export default {
 		data() {
 			return {
-				title: '閫夋嫨椤圭洰',
-				relation:'-1',
-				param:{},
-				searchVal:'',
-				ischecked:false,
-				data:[]
+					largeMode: getApp().globalData.largeMode || false,
+				title: this.translate('select_project'),
+				relation: '-1',
+				param: {},
+				searchVal: '',
+				ischecked: false,
+				data: []
 			}
 		},
 		onLoad(options) {
 			// console.log(options);
 			var param = JSON.parse(options.param);
-			this.$data.param=param;
-			this.$data.relation= options.relation;
-			// console.log(this.$data.param);
-			
-			
-			var datainfo ={ relation: this.$data.relation, tag: '', type: '', kw: '', pindex: 1, psize: 999999999, state: '', order: 'CN_T_CREATE DESC', kwpmname: '', kwcode: '', sessionid: '' };
-			
+			this.param = param;
+			this.relation = options.relation;
+			// console.log(this.param);
+
+
+			var datainfo = {
+				relation: this.relation,
+				tag: '',
+				type: '',
+				kw: '',
+				pindex: 1,
+				psize: 999999999,
+				state: '',
+				order: 'CN_T_CREATE DESC',
+				kwpmname: '',
+				kwcode: '',
+				sessionid: ''
+			};
+
 			// console.log(datainfo);
-			this.$store.dispatch('ProjectGetAnalysisList',datainfo).then(success=>{
-				console.log(success);
-				if (success.code=='00000') {
-					for(var i in success.data.Body){
-						success.data.Body[i].ischeck=false;
-					}
-					
-					this.$data.data = success.data.Body;
-					
-				}else{
-					uni.showModal({title:"閿欒1",content:success.msg,showCancel:false,confirmText:"鍙栨秷"});
+			projectGetAnalysisList(datainfo).then(res => {
+				console.log(res);
+				const list = res?.Body || []
+				for (var i in list) {
+					list[i].ischeck = false;
 				}
-			}).catch(ex=>{
+				this.data = list;
+			}).catch(ex => {
 				// console.log(ex);
-				uni.showModal({title:"閿欒1.1",content:ex.errMsg,showCancel:false,confirmText:"鍙栨秷"});
+				uni.showModal({
+					title: this.translateSys("error") + "1.1",
+					content: ex.errMsg,
+					showCancel: false,
+					confirmText: this.translateSys("close")
+				});
 			});
 		},
 		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.target);
-				// console.log(this.$data.searchVal);
-				var datainfo ={ relation: this.$data.priRel, tag: '', type: '', kw: this.$data.searchVal, pindex: 1, psize: 999999999, state: '', order: 'CN_T_CREATE DESC', kwpmname: '', kwcode: '', sessionid: '' };
-				this.$store.dispatch('ProjectGetAnalysisList',datainfo).then(success=>{
-					console.log(success);
-					if (success.code=='00000') {
-						for(var i in success.data.Body){
-							success.data.Body[i].ischeck=false;
-						}
-						
-						this.$data.data = success.data.Body;
-					}else{
-						uni.showModal({title:"閿欒2",content:success.msg,showCancel:false,confirmText:"鍙栨秷"});
+				// console.log(this.searchVal);
+				var datainfo = {
+					relation: this.priRel,
+					tag: '',
+					type: '',
+					kw: this.searchVal,
+					pindex: 1,
+					psize: 999999999,
+					state: '',
+					order: 'CN_T_CREATE DESC',
+					kwpmname: '',
+					kwcode: '',
+					sessionid: ''
+				};
+				projectGetAnalysisList(datainfo).then(res => {
+					console.log(res);
+					const list = res?.Body || []
+					for (var i in list) {
+						list[i].ischeck = false;
 					}
-				}).catch(ex=>{
+					this.data = list;
+
+
+				}).catch(ex => {
 					// console.log(ex);
-					uni.showModal({title:"閿欒2.1",content:ex.errMsg,showCancel:false,confirmText:"鍙栨秷"});
+					uni.showModal({
+						title: this.translateSys("error") + "2.1",
+						content: ex.errMsg,
+						showCancel: false,
+						confirmText: this.translateSys("close")
+					});
 				});
-				
+
 			},
 			onchange(e) {
 				// console.log(e.target);
-				var data = this.$data.data;
-				this.$data.data=[];
-				for(var i in data){
-					data[i].ischeck=false;
+				var data = this.data;
+				this.data = [];
+				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(){ //鐐瑰嚮鍔熻兘鐐硅烦杞〉闈�-				// console.log(this.$data.data);
+			sava() { //鐐瑰嚮鍔熻兘鐐硅烦杞〉闈�+				// console.log(this.data);
 				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_project'),
+						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-uni-page-selprj {
+		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%;
+			background-color: #fff;
+			border: 2rpx solid #d5d5d5;
+			padding: 14rpx;
+			overflow-y: auto;
+		}
+
+		.psn {
+			width: 93%;
+			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;
+		}
+
+		.dv_title {
+			display: inline-block;
+			width: 90%;
+			vertical-align: middle;
+		}
+
+		button.btn_sava {
+			margin-top: 60rpx;
+			padding: 20rpx;
+			line-height: 1.2;
+			background: #27A6E1;
+			border: none;
+			color: #fff;
+		}
+	}
+</style>
\ No newline at end of file

--
Gitblit v1.9.1