Sfoglia il codice sorgente

删除,批量删除,静态完成,对接

Ming 4 anni fa
parent
commit
41bcec57b0

+ 42 - 36
pages/deviceManage/deviceManage.vue

@@ -8,8 +8,8 @@
 		<!-- 设备注册列表start -->
 		<block class="">
 			<view class="processList deviceRegistList" style="height: calc(100vh - 241px);">
-				<checkbox-group  @change="changeCheckbox">
-				<view class="cu-list menu-avatar ">
+				<checkbox-group @change="changeCheckbox">
+					<view class="cu-list menu-avatar ">
 						<view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''"
 							v-for="(item,index) in newDeviceManage" :key="index" :data-target="'move-box-' + index">
 							<view class="cu-form-group margin-top">
@@ -31,7 +31,7 @@
 
 								<view class="showDetail" v-if="item.isShow">
 									<view @tap="goDeviceEdit(item)">修改设备</view>
-									<view @tap="deleteItem2" data-target="DialogModal2" :data-id='item.id'>删除设备</view>
+									<view @tap="deleteItem2" data-target="DialogModal2" :data-id='item.id'  :data-index='index'>删除设备</view>
 								</view>
 							</view>
 							<view class="nav-right num">
@@ -43,7 +43,7 @@
 								</view>
 							</view>
 						</view>
-				</view>
+					</view>
 				</checkbox-group>
 			</view>
 		</block>
@@ -57,7 +57,7 @@
 			</view>
 			<view class="share-item  text-center">
 				<view><text class="icon iconfont margin-xs" style="color:#FF0303">&#xe66c;</text></view>
-				<view @tap="deleteItem;pindex=index" data-target="DialogModal2">删除</view>
+				<view @tap="deleteItem" data-target="DialogModal2">删除</view>
 			</view>
 			<view class="share-item  text-center">
 				<view><text class="icon iconfont margin-xs" style="color:#FF642E">&#xe66e;</text></view>
@@ -77,7 +77,7 @@
 		<!-- 分享区域  end-->
 
 		<!-- 导出弹框 -->
-		<export-modal :modalName='modalName'  @fatherHideModal="hideModal()"></export-modal>
+		<export-modal :modalName='modalName' @fatherHideModal="hideModal()"></export-modal>
 		<!-- 导出弹框 end -->
 
 		<!-- 删除弹框 -->
@@ -90,7 +90,8 @@
 				</view>
 				<view class="padding-sm bg-white">
 					<image src="../../static/chart3-2.png" style="width:100rpx;height:100rpx"></image>
-					<view style="margin:20rpx 0">确定删除该设备吗?</view>
+					<view style="margin:20rpx 0" v-if="checkedArr.length>1">确定删除这些设备吗?</view>
+					<view style="margin:20rpx 0" v-else>确定删除该设备吗?</view>
 				</view>
 				<view class="cu-bar operate bg-white" style="min-height: 100rpx;">
 					<view class="action margin-0   " @tap="hideModal">
@@ -134,7 +135,9 @@
 
 	export default {
 		components: {
-			validCode,searchArea,exportModal
+			validCode,
+			searchArea,
+			exportModal
 		},
 		data() {
 			return {
@@ -147,14 +150,15 @@
 
 				deviceManage: json.deviceManage,
 				siteListRes: 0,
-			
+
 				type: '0',
 				siteListData: [],
 				modalName: null,
 				listTouchStart: 0,
 				listTouchDirection: null,
 				CustomBar: this.CustomBar,
-				
+
+				deleteIndex:'',
 				deleteId:'',
 
 
@@ -190,6 +194,7 @@
 					this.deviceManage.forEach(item => {
 						item.isShow = false
 					})
+					
 				}
 			})
 		},
@@ -203,65 +208,66 @@
 			},
 			goDeviceEdit(item) {
 				uni.navigateTo({
-					url: '/pages/deviceManage/deviceEdit/deviceEdit?type='+item.id+'',
+					url: '/pages/deviceManage/deviceEdit/deviceEdit?type=' + item.id + '',
 				});
 			},
 			//导出弹框
 			showModal(e) {
 				// alert(1)
-				if(this.checkedArr.length==0){
+				if (this.checkedArr.length == 0) {
 					alert('请选择至少一条需要导出的数据')
-				}else{
+				} else {
 					this.modalName = e.currentTarget.dataset.target
 				}
 			},
-			
+
 			//关闭弹框
 			hideModal(e) {
 				this.modalName = null
 			},
+			
 			//删除弹出框操作
 			deleteItem(e) {
-				if(this.checkedArr.length==0){
+				if (this.checkedArr.length == 0) {
 					alert('请选择至少一条需要删除的数据')
-				}else{
+				} else {
 					this.modalName = e.currentTarget.dataset.target;
 				}
 			},
 			deleteItem2(e) {
-				this.deleteId=e.target.dataset.id;
-				console.log('e.target.dataset');
-				console.log(e.target.dataset);
-				console.log(e.target.dataset.id);
+				this.checkedArr.push(e.target.dataset.id);
+				this.deleteIndex=e.target.dataset.index;
+				console.log('this.checkedArr  单个点击删除按钮 存入要删除的索引')
+				console.log(this.checkedArr)
 				this.modalName = e.currentTarget.dataset.target;
-				// this.todos.splice(index, 1);
 			},
-			confirmDelete(){
-				// alert(this.deleteId)
-				
-				// alert(this.pindex)
-				// this.deviceManage.splice(this.deleteId,1);
-				var arr=["1"]
-				
-// this.deviceManage = this.deviceManage.filter((item) => !arr.includes(item.id));
-this.deviceManage.filter((item) => !arr.includes(item.id));
-console.log(this.deviceManage)
+			confirmDelete() {
+				// alert(this.deleteIndex)
+				// this.deviceManage.splice(this.deleteIndex,1);
 				
+				this.deviceManage = this.deviceManage.filter((item) => !this.checkedArr.includes(item.id));
+				console.log('this.deviceManage')
+				console.log(this.deviceManage)
+				this.modalName = null
 			},
 			//再次确认弹框
 			openConfirmModal(e) {
 				this.modalName = e.currentTarget.dataset.target;
-			
 			},
 
-			
-			
+
 			// 隐藏显示
 			showDetail(e) {
 				// console.log('e')
 				// console.log(e)
 				// 存储点击那一项的状态
 				const nowStatu = e.isShow;
+				
+			   //判断如果长摁弹框出来时,情况选中状态 ???
+				if(!nowStatu){
+					this.checkedArr=[];
+					this.allChecked = false;
+				}
 				// 将每一项列表的isShow设置为false,让所有的列表都隐藏
 				this.deviceManage.forEach(item => {
 					item.isShow = false
@@ -269,8 +275,8 @@ console.log(this.deviceManage)
 				// 用于再次点击该项的取反
 				e.isShow = !nowStatu
 			},
-			
-			
+
+
 			// 多选复选框改变事件
 			changeCheckbox(e) {
 				this.checkedArr = e.detail.value;

+ 9 - 2
pages/index/components/chart/chart.vue

@@ -32,12 +32,16 @@
 
 	export default {
 		name: 'chart',
-	
+		props: {
+			bindData: {
+				type: Object,
+				default: ''
+			}
+		},
 		data() {
 			return {
 
 				option: {
-
 					tooltip: {
 						formatter: function() {
 							var html = '';
@@ -132,6 +136,9 @@
 			}
 		},
 		onLoad() {
+			alert(1)
+			console.log('this.bindData')
+			console.log(this,bindData)
 
 		},
 		methods: {

+ 11 - 11
pages/index/components/searchSelect/searchSelect.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		
+
 		<view class="searchSelect shadow" v-if="flag">
 			<view class="cu-bar search bg-white">
 				<view class="search-form round" style="margin-top:0">
@@ -15,7 +15,7 @@
 					:key="index">{{item}}</view>
 			</view>
 		</view>
-		
+
 	</view>
 </template>
 
@@ -38,19 +38,19 @@
 		},
 		data() {
 			return {
-				
+
 				searchInput: '',
 				// flag: false,
 				// searchList: [],
 				// searchList2: [],
-				
+
 			}
 		},
-		onload(){
+		onload() {
 			this.getSearchList();
 		},
 		methods: {
-			
+
 			//请求
 			async getSearchList(ming = {}) {
 				const res = await this.$myRequest({
@@ -73,20 +73,20 @@
 				var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
 				this.searchList = newlist
 			},
-			
-			
+
+
 			InputFocus(e) {
 				this.InputBottom = e.detail.height
 			},
 			InputBlur(e) {
 				this.InputBottom = 0
 			},
-			
+
 			changeTab(Inv) {
 				that.navIdx = Inv;
-			
-			}
+
 			}
+		}
 	}
 </script>
 

+ 21 - 8
pages/index/index.vue

@@ -1,5 +1,7 @@
 <template>
 	<view style="background:#f1f1f1;" class="padding-sm">
+		
+		
 		<!-- 下拉选择 -->
 		<view class="searchSelect shadow" v-if="flag">
 			<view class="cu-bar search bg-white">
@@ -96,7 +98,7 @@
 
 		data() {
 			return {
-				staticData: json.staticData.data[0],
+				staticData: {},
 				alarmCount: json.staticData.data[0].alarmCount,
 				cuIconList: json.cuIconList,
 				Inv: 0,
@@ -201,14 +203,14 @@
 			
 
 			//请求
-			async getSearchList(ming = {}) {
+			async getSearchList(param = {}) {
 				const res = await this.$myRequest({
-					url: 'Index/getSiteDropDownBox',
-					data: ming
+					url: 'Index/getCompanyList',
+					data: param
 				})
 				res.data.data.forEach(item => {
-					this.searchList.push(item.siteName)
-					this.searchList2.push(item.siteName)
+					this.searchList.push(item.owner_name)
+					this.searchList2.push(item.owner_name)
 				});
 			},
 			
@@ -229,8 +231,7 @@
 				this.searchList = newlist
 			},
 
-			
-
+		
 			InputFocus(e) {
 				this.InputBottom = e.detail.height
 			},
@@ -242,6 +243,18 @@
 				that.navIdx = Inv;
 
 			},
+			
+			//请求
+			async getSearchList(param = {}) {
+				const res = await this.$myRequest({
+					url: 'Index/getHomePageData',
+					data: param
+				})
+				console.log('首页请求staticData')
+				console.log(res.data.data[0])
+				this.staticData=res.data.data[0]
+				
+			},
 
 
 		

+ 1 - 3
util/api.js

@@ -1,5 +1,4 @@
-const BASE_URL = 'https://iot.usky.cn/USKYOF/USKYOF.php/Home/'
-// const BASE_URL='https://qhome.usky.cn/USKYOF/USKYOF.php/Home/'
+const BASE_URL = 'https://iot.usky.cn/USKYZHAF/USKYZHAF.php/Home/'
 // 同时发送异步代码的次数,防止一次点击中有多次请求,用于处理
 let ajaxTimes = 0;
 
@@ -14,7 +13,6 @@ export const myRequest = (options) => {
 			title: "加载中",
 			mask: true,
 		});
-
 	}
 
 	return new Promise((resolve, reject) => {