From c5e49c10499435802a6551b98772f95660c6f85a Mon Sep 17 00:00:00 2001
From: 王飞 <14095171+wang-fei12345@user.noreply.gitee.com>
Date: 星期五, 07 三月 2025 09:15:56 +0800
Subject: [PATCH] 定位app首次提交

---
 pages/index/fence.vue |  417 ++++++++++++++++++++++++++++-------------------------------
 1 files changed, 197 insertions(+), 220 deletions(-)

diff --git a/pages/index/fence.vue b/pages/index/fence.vue
index bc90b95..e0cfce7 100644
--- a/pages/index/fence.vue
+++ b/pages/index/fence.vue
@@ -2,7 +2,7 @@
 	<view class="template-job tn-safe-area-inset-bottom tn-skeleton">
 
 		<!-- 椤堕儴鑷畾涔夊鑸� -->
-		<tn-nav-bar fixed style="position: absolute;z-index: 999999999;">
+		<tn-nav-bar :isBack="false" fixed style="position: absolute;z-index: 999999999;">
 
 			<text class="title_linespan" @click="goTag">缁樺埗</text>
 			<text v-if="isAchor==false" class="title_linespan"
@@ -45,7 +45,7 @@
 						</view>
 
 						<view style="display: flex;margin-top: 10px;font-size: 17px;">
-							{{item.baoliu7}}
+
 							鏄惁鍚敤锛�<tn-switch v-model="item.baoliu7==1 ? true : false"
 								style="position: absolute;left: 85%;" @change="isopen(item, $event)"
 								:size="num"></tn-switch>
@@ -67,10 +67,12 @@
 							<tn-input disabled v-model="form.type" @click="show1 = true" inputAlign="right" />
 						</tn-form-item>
 						<tn-form-item label="鍏宠仈閮ㄩ棬:" labelWidth='100rpx'>
-							<tn-input v-model="form.bumen" type="select" @click="show2 = true" inputAlign="right"
-								placeholder="璇烽�夋嫨鍏宠仈閮ㄩ棬" />
-							<tn-action-sheet :disabled="form.disable" :list="bumenList" v-model="show2"
-								@click="bymenCallback"></tn-action-sheet>
+							<!-- <tn-input v-model="form.bumen" type="select" @click="show2 = true" inputAlign="right"
+								placeholder="璇烽�夋嫨鍏宠仈閮ㄩ棬" /> -->
+							<uni-data-select placeholder="璇烽�夋嫨鍏宠仈閮ㄩ棬" v-show="form.disable" v-model="form.bumen"
+								:localdata="bumenList" @change="bymenCallback"></uni-data-select>
+							<!-- <tn-action-sheet :disabled="form.disable" :list="bumenList" v-model="show2"
+								@click="bymenCallback"></tn-action-sheet> -->
 						</tn-form-item>
 						<tn-form-item label="鍥存爮楂樺害:" labelWidth='100rpx'>
 							<tn-input disabled v-model="form.baoliu1" inputAlign="right"
@@ -88,7 +90,7 @@
 
 		<tn-skeleton :show="showSkeleton"></tn-skeleton>
 		<successCom ref="refSuccess"></successCom>
-		<drawCom v-show="lock==true" :formfence="formfence" @goAchor="goAchor"></drawCom>
+		<drawCom v-show="lock==true" @goAchor="goAchor" @manualRefresh="manualRefresh"></drawCom>
 		<tn-modal v-model="show" :title="title" :content="content" :button="button" @click="modalclick"></tn-modal>
 	</view>
 </template>
@@ -189,6 +191,7 @@
 					type: '杩涘叆鎶ヨ',
 					list: [],
 					disable: false,
+					company: this.company,
 				},
 				num: 40,
 				isAchor: false,
@@ -237,6 +240,7 @@
 			}
 		},
 		mounted() {
+			console.log(111111);
 			this.findbumenall()
 			this.topheight = this.vuex_custom_bar_height + 15
 			setTimeout(() => {
@@ -251,6 +255,21 @@
 
 		},
 		methods: {
+			manualRefresh() { //淇濆瓨鍥存爮鎴愬姛鍒锋柊鍥存爮鍒楄〃椤甸潰
+				this.isAchor = false
+				this.lock = false
+				// 璋冪敤 handleRefresh 鏂规硶锛屽埛鏂� dataList 缁勪欢
+				this.handleRefresh({
+					page: 1,
+					size: this.pageSize
+				}, () => {
+					// 鍙�夛細鍒锋柊瀹屾垚鍚庢墽琛岀殑鎿嶄綔
+					// this.$refs.refSuccess.showBox({
+					// 	type: 'success',
+					// 	txt: '鍒锋柊鎴愬姛'
+					// });
+				});
+			},
 			isopen(item, e) {
 				this.form.name = item.name
 				if (item.baoliu7 == 1) {
@@ -263,105 +282,101 @@
 					// size: data.size,
 				}
 				// item.baoliu7 = e ? 1 : 0; // 鏍规嵁寮�鍏崇姸鎬佹洿鏂�
-				if (e == true) {
+				if (this.vuex_is_login) {
+					if (e == true) {
 
-					FenceGuanBi(params).then((res) => {
-					})
-				} else {
-					FenceKaiQi(params).then((res) => {
-					})
+						FenceGuanBi(params).then((res) => {})
+					} else {
+						FenceKaiQi(params).then((res) => {})
+					}
 				}
 			},
 			submitForm() {
 				this.form.list = this.list
-				if (this.form.shape=="鍦嗗舰") {
-					console.log(this.form);
-
-
-					submitper(this.form).then((res) => {
-						console.log(res);
+				if (this.form.shape == "鍦嗗舰") {
+					if (this.vuex_is_login) {
+						submitper(this.form).then((res) => {
+							if (res.code == 0) {
+								// this.form.lonlat=res.data.baoliu2+";"+res.data.baoliu3
+								// this.tips=false
+								// this.disable=false
+							} else {
+								this.$refs.refSuccess.showBox({
+									type: 'error',
+									txt: res.msg
+								});
+							}
+						})
+					}
+				} else {
+					if (this.form.tagId == '') {
+						this.$refs.refSuccess.showBox({
+							type: 'error',
+							txt: '璇疯緭鍏ヨ澶囩紪鍙烽噰闆嗗潗鏍�'
+						});
+						return false;
+					} else if (this.form.baoliu1 == '') {
+						this.$refs.refSuccess.showBox({
+							type: 'error',
+							txt: '璇疯緭鍏ュ洿鏍忛珮搴﹂噰闆嗗潗鏍�'
+						});
+						return false;
+					} else if (this.form.name == '') {
+						this.$refs.refSuccess.showBox({
+							type: 'error',
+							txt: '璇疯緭鍏ュ洿鏍忓悕绉伴噰闆嗗潗鏍�'
+						});
+						return false;
+					} else if (this.form.shape == '鍦嗗舰') {
+						if (this.form.zuobiao == '') {
+							this.$refs.refSuccess.showBox({
+								type: 'error',
+								txt: '璇烽噰闆嗗潗鏍�'
+							});
+							return false;
+						}
+						if (this.form.banjing == '') {
+							this.$refs.refSuccess.showBox({
+								type: 'error',
+								txt: '璇疯緭鍏ュ洿鏍忓崐寰�'
+							});
+							return false;
+						}
+					} else if (this.form.shape == '澶氳竟褰�') {
+						if (this.form.list.length < 0) {
+							this.$refs.refSuccess.showBox({
+								type: 'error',
+								txt: '璇烽噰闆嗗潗鏍�'
+							});
+							return false;
+						}
+					}
+				}
+				const json = {}
+				json.name = this.form.name
+				json.bumen = this.form.bumen
+				if (this.vuex_is_login) {
+					updateFence(json).then((res) => {
 						if (res.code == 0) {
+							this.showpopup = false
+							// this.list.splice(this.deleindex,1) 
+							this.$set(this.list, this.editindex, res.data);
+							// this.form.bumen =
 							// this.form.lonlat=res.data.baoliu2+";"+res.data.baoliu3
 							// this.tips=false
 							// this.disable=false
-						}else{
+						} else {
 							this.$refs.refSuccess.showBox({
 								type: 'error',
 								txt: res.msg
 							});
 						}
 					})
-				}else{
-				if (this.form.tagId=='') {
-					this.$refs.refSuccess.showBox({
-						type: 'error',
-						txt: '璇疯緭鍏ヨ澶囩紪鍙烽噰闆嗗潗鏍�'
-					});
-					return false;
-				}else if (this.form.baoliu1=='') {
-					this.$refs.refSuccess.showBox({
-						type: 'error',
-						txt: '璇疯緭鍏ュ洿鏍忛珮搴﹂噰闆嗗潗鏍�'
-					});
-					return false;
-				}else if (this.form.name=='') {
-					this.$refs.refSuccess.showBox({
-						type: 'error',
-						txt: '璇疯緭鍏ュ洿鏍忓悕绉伴噰闆嗗潗鏍�'
-					});
-					return false;
-				}else if (this.form.shape=='鍦嗗舰') {
-					if (this.form.zuobiao=='') {
-						this.$refs.refSuccess.showBox({
-							type: 'error',
-							txt: '璇烽噰闆嗗潗鏍�'
-						});
-						return false;
-					}
-					if (this.form.banjing=='') {
-						this.$refs.refSuccess.showBox({
-							type: 'error',
-							txt: '璇疯緭鍏ュ洿鏍忓崐寰�'
-						});
-						return false;
-					}
-				}else if (this.form.shape=='澶氳竟褰�') {
-					if (this.form.list.length<0) {
-						this.$refs.refSuccess.showBox({
-							type: 'error',
-							txt: '璇烽噰闆嗗潗鏍�'
-						});
-						return false;
-					}
 				}
-				}
-				console.log(this.form);
-				console.log();
-
-				updateFence(this.form).then((res) => {
-					console.log(res);
-					if (res.code == 0) {
-						this.showpopup = false
-						// this.list.splice(this.deleindex,1) 
-						this.$set(this.list, this.editindex, res.data);
-						// this.form.bumen =
-						// this.form.lonlat=res.data.baoliu2+";"+res.data.baoliu3
-						// this.tips=false
-						// this.disable=false
-					} else {
-						this.$refs.refSuccess.showBox({
-							type: 'error',
-							txt: res.msg
-						});
-					}
-				})
-
 
 			},
 			shapeCallback(index) {
 				this.form.shape = this.shapeList[index].text;
-				// this.form.baoliu6 = this.actionSheetList[index].text;
-				console.log(this.shapeList[index].text);
 				if (this.shapeList[index].text == '鍦嗗舰') {
 					this.isshape = true
 				} else {
@@ -371,65 +386,59 @@
 
 			bymenCallback(index) {
 				this.form.bumen = this.bumenList[index].text;
-				// this.form.baoliu6 = this.actionSheetList[index].text;
-				console.log(this.bumenList[index].text);
-
 			},
 			typeCallback(index) {
 				this.form.type = this.typeList[index].text;
-				// this.form.baoliu6 = this.actionSheetList[index].text;
-				console.log(this.typeList[index].text);
-
 			},
 			findbumenall() {
-				findbumen().then((res) => {
-					console.log(res);
-					if (res.code == 0) {
-
-						for (var i = 0; i < res.data.length; i++) {
-							var json = {}
-							json.text = res.data[i].departmentName
-							// .textres.data[i]
-							this.bumenList.push(json)
+				if (this.vuex_is_login) {
+					findbumen().then((res) => {
+						console.log(res);
+						if (res.code == 0) {
+							// for (var i = 0; i < res.data.length; i++) {
+							// 	var json = {}
+							// 	json.text = res.data[i].departmentName
+							// 	// .textres.data[i]
+							// 	this.bumenList.push(json)
+							this.bumenList = res.data.map(item => ({
+								value: item.departmentName,
+								text: item.departmentName
+							}));
+							// }
+							// this.form.lonlat=res.data.baoliu2+";"+res.data.baoliu3
+							// this.tips=false
+							// this.disable=false
+						} else {
+							this.$refs.refSuccess.showBox({
+								type: 'error',
+								txt: res.msg
+							});
 						}
-
-						// this.form.lonlat=res.data.baoliu2+";"+res.data.baoliu3
-						// this.tips=false
-						// this.disable=false
-					} else {
-						this.$refs.refSuccess.showBox({
-							type: 'error',
-							txt: res.msg
-						});
-					}
-				})
+					})
+				}
 			},
 			modalclick(e) {
-				console.log(e);
 				if (e.index == 1) {
 					const params = {
 						name: this.delename,
 						// size: data.size,
 					}
 
-					deleFence(params).then((res) => {
-						console.log(res);
-						if (res.code == 0) {
-							this.delename = ''
-							console.log(this.list);
-							console.log(e.index);
-							this.list.splice(this.deleindex, 1)
-							console.log(this.list);
-							this.deleindex = -1
-						}
-					})
+					if (this.vuex_is_login) {
+						deleFence(params).then((res) => {
+							if (res.code == 0) {
+								this.delename = ''
+								this.list.splice(this.deleindex, 1)
+								this.deleindex = -1
+							}
+						})
+					}
 				}
 				this.show = false;
 			},
 			editClick(e, i) {
 				this.editindex = i
 				this.showpopup = true
-				// console.log(e);
 				this.formfence.name = e.name
 				this.formfence.baoliu1 = e.baoliu1
 				this.formfence.zuobiao = e.zuobiao
@@ -439,37 +448,21 @@
 				this.formfence.tagId = e.tagId
 				this.formfence.bumen = e.bumen
 				this.formfence.disable = true
+				this.formfence.company = this.company
 				this.form = this.formfence
-				console.log(this.formfence);
-				// this.lock = true
-				console.log(1111111);
 			},
 			deleteClick(e, i) {
-				console.log(e);
 				this.deleindex = i
 				this.delename = e.name
-				console.log(2222222);
 				this.show = true;
 
 			},
 			goAchor() {
-
 				this.isAchor = false
 				this.lock = false
-				console.log(2323323);
-				// uni.reLaunch({
-				// 	url: '/pages/index/equipmentCom'
-				// });
-				// this.$emit('goAchor');
 			},
 			goTag() {
-
-				// this.isAchor = true
-
 				this.lock = true
-				console.log(2323323);
-				// findTag
-
 			},
 
 			// 妯℃嫙璇锋眰鍔犺浇鏁版嵁
@@ -479,105 +472,89 @@
 					size: data.size,
 					company: this.company,
 				}
+				if (this.vuex_is_login) {
+					findFence(params).then((res) => {
 
-				findFence(params).then((res) => {
-					console.log(res);
-					if (res.code == 0) {
-						let list = [];
-						setTimeout(() => {
+						if (res.code == 0) {
 							let list = [];
-							for (var i = 0; i < res.data.records.length; i++) {
-								list.push(res.data.records[i]);
-							}
-							console.log(list);
-							this.list = [...this.list, ...list];
-							callback({
-								list: this.list,
-								total: res.data.total
-							});
-						}, 1500);
-					}
-				})
+							setTimeout(() => {
+								let list = [];
+								for (var i = 0; i < res.data.records.length; i++) {
+									list.push(res.data.records[i]);
+								}
+
+								this.list = [...this.list, ...list];
+								callback({
+									list: this.list,
+									total: res.data.total
+								});
+							}, 1500);
+						}
+					})
+				}else{
+					callback({
+						list: [],
+						total: 0
+					});
+				}
 			},
 			handleSearch(data, callback) {
-				console.log(555555555);
+
 				const params = {
 					current: 1,
 					size: 10,
 					objectid: this.keyword,
 					company: this.company,
 				}
+				if (this.vuex_is_login) {
+					findFence(params).then((res) => {
 
-				findFence(params).then((res) => {
-					console.log(res);
-					this.list = []
-					if (res.code == 0) {
-						let list = [];
-						setTimeout(() => {
+						this.list = []
+						if (res.code == 0) {
 							let list = [];
-							for (var i = 0; i < res.data.records.length; i++) {
-								list.push(res.data.records[i]);
-							}
-							console.log(list);
-							this.list = [...this.list, ...list];
-							callback({
-								list: this.list,
-								total: res.data.total
-							});
-						}, 1500);
-					}
-				})
-				// let name = this.keyword
-				// console.log();
-				// findPerson(name).then((res) => {
-				// 	if (res.code == 0) {
-				// 		this.perlist = res.data
-				// 		console.log(this.perlist);
-				// 	} else {
-				// 		this.$refs.refSuccess.showBox({
-				// 			type: 'error',
-				// 			txt: res.msg
-				// 		});
-				// 	}
-				// })
-
+							setTimeout(() => {
+								let list = [];
+								for (var i = 0; i < res.data.records.length; i++) {
+									list.push(res.data.records[i]);
+								}
+								this.list = [...this.list, ...list];
+								callback({
+									list: this.list,
+									total: res.data.total
+								});
+							}, 1500);
+						}
+					})
+				}
 			},
 			// 妯℃嫙璇锋眰鏁版嵁鍒锋柊
 			handleRefresh(data, callback) {
-				console.log(555555555555555);
+
 				const params = {
 					current: data.page,
 					size: data.size,
+					objectid: data.objectid,
 					company: this.company,
 				}
-				console.log(data);
-				findFence(data).then((res) => {
-					if (res.code == 0) {
-						let list = [];
-						setTimeout(() => {
+				if (this.vuex_is_login) {
+					findFence(params).then((res) => {
+						if (res.code == 0) {
 							let list = [];
-							for (var i = 0; i < res.data.records.length; i++) {
-								list.push(res.data.records[i]);
-							}
-							console.log(list);
-							this.list = []
-							this.list = [...this.list, ...list];
-							console.log(this.list);
-							callback({
-								list: this.list,
-								total: res.data.total
-							});
-						}, 1500);
-					}
-				})
-				// console.log(2222222222);
-				// setTimeout(() => {
-				// 	this.list = [];
-				// 	for (var i = 0; i < 3; i++) {
-				// 		this.list.push(i);
-				// 	}
-				// 	callback({ list: this.list, total: 30 });
-				// }, 1500);
+							setTimeout(() => {
+								let list = [];
+								for (var i = 0; i < res.data.records.length; i++) {
+									list.push(res.data.records[i]);
+								}
+								this.list = []
+								this.list = [...this.list, ...list];
+								callback({
+									list: this.list,
+									total: res.data.total
+								});
+							}, 1500);
+						}
+					})
+				}
 			},
 		}
 	}

--
Gitblit v1.9.3