Ver Fonte

更新模块控制功能

丁烨烨 há 1 ano atrás
pai
commit
66f081f2d2

+ 2 - 1
.env.development

@@ -1 +1,2 @@
-VITE_APP_BASE_URL = 'http://172.16.102.52:8080'
+//VITE_APP_BASE_URL = 'http://172.16.102.52:8080'
+VITE_APP_BASE_URL = 'http://192.168.110.235:8080'

+ 15 - 9
pages.json

@@ -54,23 +54,29 @@
 			}
 		}
 	],
+	"globalStyle": {
+		"navigationBarTextStyle": "black",
+		"navigationBarTitleText": "集成控制",
+		"navigationBarBackgroundColor": "#F8F8F8",
+		"backgroundColor": "#F8F8F8"
+	},
 	"tabBar": {
-		"color": "#999999",
-		"selectedColor": "#black",
-		"backgroundColor": "#ffffff",
 		"borderStyle": "black",
+		"backgroundColor": "#2979ff",
+		"color": "#8F8F94",
+		"selectedColor": "#fff",
 		"list": [
 		{
 			"pagePath": "pages/index/index",
-			"text": "首页",
-			"iconPath": "/static/uni.png",
-			"selectedIconPath": "/static/uni.png"
+			"iconPath": "/static/img/tabBar/home.png",
+			"selectedIconPath": "/static/img/tabBar/homeative.png",
+			"text": "首页"
 		},
 		{
 			"pagePath": "pages/security/index",
-			"text": "安保",
-			"iconPath": "/static/uni.png",
-			"selectedIconPath": "/static/uni.png"
+			"iconPath": "/static/img/tabBar/security.png",
+			"selectedIconPath": "/static/img/tabBar/securityative.png",
+			"text": "安保"
 		}
 		// {
 		// 	"pagePath": "pages/my/index",

+ 208 - 219
pages/VisualControl/index.vue

@@ -1,227 +1,216 @@
-
 <template>
-  <view class="container">
-    <!-- 天气控制 -->
-    <view class="weather-section">
-      <view 
-        v-for="(weather, index) in weathers" 
-        :key="index"
-        :class="['weather-item', { active: currentWeather === weather.type }]"
-        @click="handleWeatherChange(weather.type)"
-      >
-        <uni-icons :type="weather.icon" size="30" :color="currentWeather === weather.type ? '#ffffff' : '#333333'" />
-        <text class="weather-text">{{ weather.name }}</text>
-      </view>
-    </view>
-
-    <!-- 时区控制 -->
-    <view class="time-section">
-      <view 
-        v-for="(time, index) in times" 
-        :key="index"
-        :class="['time-item', { active: currentTime === time.type }]"
-        @click="handleTimeChange(time.type)"
-      >
-        <uni-icons :type="time.icon" size="24" :color="currentTime === time.type ? '#ffffff' : '#333333'" />
-        <text class="time-text">{{ time.name }}</text>
-      </view>
-    </view>
-
-    <!-- 模块控制 -->
-    <view class="module-section">
-      <view 
-        v-for="(module, index) in modules" 
-        :key="index"
-        class="module-item"
-        @click="handleModuleClick(module.type)"
-      >
-        <view class="module-icon">
-          <uni-icons :type="module.icon" size="36" color="#2979ff" />
-        </view>
-        <text class="module-name">{{ module.name }}</text>
-        <text class="module-status">{{ module.status }}</text>
-      </view>
-    </view>
-	
-	<view class="initialization">
-		<button type="primary">
-			初始化选项
-		</button>
+	<view class="container">
+		<!-- 天气控制 -->
+		<view class="section weather-section">
+			<view v-for="(weather, index) in weathers" :key="index"
+				:class="['control-item', { active: currentWeather === weather.type }]"
+				@click="handleControlChange('weather', weather.type)">
+				<uni-icons :type="weather.icon" size="30"
+					:color="currentWeather === weather.type ? activeTextColor : textColor" />
+				<text class="control-text">{{ weather.name }}</text>
+			</view>
+		</view>
+
+		<!-- 时区控制 -->
+		<view class="section time-section">
+			<view v-for="(time, index) in times" :key="index"
+				:class="['control-item', { active: currentTime === time.type }]"
+				@click="handleControlChange('time', time.type)">
+				<uni-icons :type="time.icon" size="24"
+					:color="currentTime === time.type ? activeTextColor : textColor" />
+				<text class="control-text">{{ time.name }}</text>
+			</view>
+		</view>
+
+		<!-- 模块控制 -->
+		<view class="module-section">
+			<view v-for="(module, index) in modules" :key="index" class="module-item"
+				@click="handleControlChange('module', module.type)">
+				<view class="module-icon">
+					<uni-icons :type="module.icon" size="36" :color="iconColor" />
+				</view>
+				<text class="module-name">{{ module.name }}</text>
+				<text class="module-status">{{ module.status }}</text>
+			</view>
+		</view>
+
+		<view class="initialization">
+			<button type="primary" @click="handleControlChange('module', 'BacktoOverview')">
+				初始化选项
+			</button>
+		</view>
 	</view>
-  </view>
 </template>
 
 <script lang="ts" setup>
-import { ref } from 'vue';
-
-// 天气类型
-type WeatherType = 'sunny' | 'foggy' | 'rainy' | 'snowy';
-const currentWeather = ref<WeatherType>('sunny');
-
-// 时间类型
-type TimeType = 'morning' | 'noon' | 'night';
-const currentTime = ref<TimeType>('morning');
-
-// 模块类型
-type ModuleType = 'overview' | 'security' | 'energy' | 'fire' | 'lamp' | 'passage';
-
-// 天气数据
-const weathers = [
-  { type: 'sunny', name: '晴天', icon: 'sun' },
-  { type: 'foggy', name: '雾天', icon: 'cloud' },
-  { type: 'rainy', name: '雨天', icon: 'rain' },
-  { type: 'snowy', name: '雪天', icon: 'snow' }
-];
-
-// 时间数据
-const times = [
-  { type: 'morning', name: '早上', icon: 'sun' },
-  { type: 'noon', name: '中午', icon: 'sun-filled' },
-  { type: 'night', name: '夜晚', icon: 'moon' }
-];
-
-// 模块数据
-const modules = [
-  { type: 'overview', name: '园区总览', icon: 'map', status: '运行正常' },
-  { type: 'security', name: '智慧安防', icon: 'contact', status: '无异常' },
-  { type: 'energy', name: '智慧能耗', icon: 'list', status: '节能运行' },
-  { type: 'fire', name: '智慧消防', icon: 'fire', status: '系统正常' },
-  { type: 'lamp', name: '智慧灯杆', icon: 'map-pin-ellipse', status: '照明正常' },
-  { type: 'passage', name: '智慧通行', icon: 'staff', status: '通行顺畅' }
-];
-
-// 处理天气变化
-const handleWeatherChange = (type: WeatherType) => {
-  currentWeather.value = type;
-};
-
-// 处理时间变化
-const handleTimeChange = (type: TimeType) => {
-  currentTime.value = type;
-};
-
-// 处理模块点击
-const handleModuleClick = (type: ModuleType) => {
-  console.log('点击模块:', type);
-};
+	import { ref } from 'vue';
+	import { clientPut } from '../../utils/request';
+
+	// 类型定义
+	type WeatherType = 'WeatherSunny' | 'WeatherCloudy' | 'WeatherFoggy' | 'WeatherRain' | 'WeatherSnow';
+	type TimeType = 'TimeMorning' | 'TimeNoon' | 'TimeNight' | 'TimeRealTime';
+	type ModuleType = 'BacktoOverview' | 'OpenSmartSecurity' | 'OpenSmartEnergy' | 'OpenSmartFireControl' | 'OpenSmartLamp' | 'OpenSmartParking';
+
+	// 响应式状态
+	const currentWeather = ref<WeatherType>('WeatherSunny');
+	const currentTime = ref<TimeType>('TimeMorning');
+
+	// 样式常量
+	const activeColor = '#2979ff';
+	const activeTextColor = '#ffffff';
+	const textColor = '#333333';
+	const iconColor = '#2979ff';
+
+	// 数据配置
+	const weathers = [
+		{ type: 'WeatherSunny', name: '晴天', icon: 'sun' },
+		{ type: 'WeatherCloudy', name: '多云', icon: 'cloud' },
+		{ type: 'WeatherFoggy', name: '雾天', icon: 'cloud' },
+		{ type: 'WeatherRain', name: '雨天', icon: 'rain' },
+		{ type: 'WeatherSnow', name: '雪天', icon: 'snow' }
+	];
+
+	const times = [
+		{ type: 'TimeMorning', name: '早上', icon: 'sun' },
+		{ type: 'TimeNoon', name: '中午', icon: 'sun-filled' },
+		{ type: 'TimeNight', name: '夜晚', icon: 'moon' },
+		{ type: 'TimeRealTime', name: '实时', icon: 'moon' }
+	];
+
+	const modules = [
+		{ type: 'BacktoOverview', name: '园区总览', icon: 'map', status: '运行正常' },
+		{ type: 'OpenSmartSecurity', name: '智慧安防', icon: 'contact', status: '无异常' },
+		{ type: 'OpenSmartEnergy', name: '智慧能耗', icon: 'list', status: '节能运行' },
+		{ type: 'OpenSmartFireControl', name: '智慧消防', icon: 'fire', status: '系统正常' },
+		{ type: 'OpenSmartLamp', name: '智慧灯杆', icon: 'map-pin-ellipse', status: '照明正常' },
+		{ type: 'OpenSmartParking', name: '智慧通行', icon: 'staff', status: '通行顺畅' }
+	];
+
+	// 统一处理控制项变化
+	const handleControlChange = async (category : 'weather' | 'time' | 'module', type : string) => {
+		try {
+			// 更新本地状态
+			if (category === 'weather') {
+				currentWeather.value = type as WeatherType;
+			} else if (category === 'time') {
+				currentTime.value = type as TimeType;
+			}
+			uni.request({
+				method: 'PUT',
+				url: 'http://192.168.110.96:30010/remote/preset/RemoteControlPreset/function/' + type, //仅为示例,并非真实接口地址。
+				data: {
+					"Parameters": {},
+					"GenerateTransaction": false
+				},
+				success: (res) => {
+					console.log(1111)
+				}
+			});
+			
+			console.log(`${category} 控制请求成功:`, type);
+		} catch (error) {
+			console.error(`${category} 控制请求失败:`, error);
+			// 可以在这里添加错误处理逻辑,例如恢复之前的状态
+		}
+	};
 </script>
 
 <style>
-page {
-  height: 100%;
-}
-
-.container {
-  min-height: 100%;
-  padding: 30rpx;
-  background-color: #f5f5f5;
-}
-
-.weather-section {
-  display: flex;
-  justify-content: space-between;
-  padding: 20rpx;
-  background-color: #ffffff;
-  border-radius: 16rpx;
-  margin-bottom: 30rpx;
-}
-
-.weather-item {
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  padding: 20rpx 30rpx;
-  border-radius: 12rpx;
-  transition: all 0.3s;
-}
-
-.weather-item.active {
-  background-color: #2979ff;
-}
-
-.weather-text {
-  margin-top: 10rpx;
-  font-size: 14px;
-  color: #333333;
-}
-
-.weather-item.active .weather-text {
-  color: #ffffff;
-}
-
-.time-section {
-  display: flex;
-  justify-content: space-around;
-  padding: 20rpx;
-  background-color: #ffffff;
-  border-radius: 16rpx;
-  margin-bottom: 30rpx;
-}
-
-.time-item {
-  display: flex;
-  align-items: center;
-  padding: 16rpx 40rpx;
-  border-radius: 12rpx;
-  transition: all 0.3s;
-}
-
-.time-item.active {
-  background-color: #2979ff;
-}
-
-.time-text {
-  margin-left: 10rpx;
-  font-size: 14px;
-  color: #333333;
-}
-
-.time-item.active .time-text {
-  color: #ffffff;
-}
-
-.module-section {
-  display: grid;
-  grid-template-columns: repeat(2, 1fr);
-  gap: 20rpx;
-}
-
-.module-item {
-  background-color: #ffffff;
-  border-radius: 16rpx;
-  padding: 30rpx;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  transition: transform 0.3s;
-}
-
-.module-item:active {
-  transform: scale(0.98);
-}
-
-.module-icon {
-  width: 80rpx;
-  height: 80rpx;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  margin-bottom: 20rpx;
-}
-
-.module-name {
-  font-size: 16px;
-  color: #333333;
-  margin-bottom: 10rpx;
-}
-
-.module-status {
-  font-size: 12px;
-  color: #666666;
-}
-
-.initialization{
-	margin-top: 12px;
-}
-</style>
-
+	:root {
+		--section-bg: #ffffff;
+		--active-bg: #2979ff;
+		--text-main: #333333;
+		--text-secondary: #666666;
+		--section-radius: 16rpx;
+		--section-spacing: 30rpx;
+	}
+
+	page {
+		height: 100%;
+		background-color: #f5f5f5;
+	}
+
+	.container {
+		min-height: 100%;
+		padding: var(--section-spacing);
+	}
+
+	/* 通用控制项样式 */
+	.section {
+		padding: 20rpx;
+		background-color: var(--section-bg);
+		border-radius: var(--section-radius);
+		margin-bottom: var(--section-spacing);
+		display: flex;
+		justify-content: space-around;
+	}
+
+	.control-item {
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		padding: 20rpx 30rpx;
+		border-radius: 12rpx;
+		transition: all 0.3s;
+	}
+
+	.control-item.active {
+		background-color: var(--active-bg);
+		color: white;
+	}
+
+	.control-text {
+		margin-top: 10rpx;
+		font-size: 14px;
+		color: var(--text-main);
+	}
+
+	.control-item.active .control-text {
+		color: var(--active-text-color);
+	}
+
+	/* 模块控制样式 */
+	.module-section {
+		display: grid;
+		grid-template-columns: repeat(2, 1fr);
+		gap: 20rpx;
+	}
+
+	.module-item {
+		background-color: var(--section-bg);
+		border-radius: var(--section-radius);
+		padding: 30rpx;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		transition: transform 0.3s;
+	}
+
+	.module-item:active {
+		transform: scale(0.98);
+	}
+
+	.module-icon {
+		width: 80rpx;
+		height: 80rpx;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		margin-bottom: 20rpx;
+	}
+
+	.module-name {
+		font-size: 16px;
+		color: var(--text-main);
+		margin-bottom: 10rpx;
+	}
+
+	.module-status {
+		font-size: 12px;
+		color: var(--text-secondary);
+	}
+
+	.initialization {
+		margin-top: 12px;
+	}
+</style>

+ 41 - 37
pages/security/index.vue

@@ -6,12 +6,14 @@
 			<view class="security-list">
 				<view v-for="(item, index) in securityList" :key="index" class="security-card">
 					<view class="card-left">
-						<image class="avatar" :src="item.avatar" mode="aspectFill" />
+						<image class="avatar"
+							:src="item.gender === '男' ? '../../static/img/anbaoimg/male.png' : '../../static/img/anbaoimg/female.png'"
+							mode="aspectFill" />
 					</view>
 					<view class="card-middle">
 						<text class="name">{{ item.name }}</text>
-						<text class="phone">{{ item.phone }}</text>
-						<text class="position">{{ item.position }}</text>
+						<text class="phone">联系方式:{{ item.contactPhone }}</text>
+						<text class="position">籍贯:{{ item.nativePlace }}</text>
 					</view>
 					<view class="card-right">
 						<view class="action-buttons">
@@ -27,45 +29,47 @@
 
 <script lang="ts" setup>
 	import { ref } from 'vue';
-
+	import { clientGet } from '../../utils/request';
 	interface SecurityPerson {
-		id : number;
-		name : string;
-		phone : string;
-		position : string;
-		status : string;
-		avatar : string;
+		name : string,
+		birthDate : string,
+		contactPhone : string,
+		createBy : string,
+		createTime : string,
+		currentAddress : string,
+		email : string,
+		ethnicity : string,
+		gender : string,
+		id : number,
+		idNumber : string,
+		maritalStatus : string,
+		nativePlace : string,
+		updateBy : string,
+		updateTime : string
 	}
 
 	const isRefreshing = ref(false);
+	const currentPage = ref(1);
+	const pageSize = ref(100);
+	const total = ref(0);
+	const securityList = ref<SecurityPerson[]>([]);
 
-	const securityList = ref<SecurityPerson[]>([
-		{
-			id: 1,
-			name: '张明',
-			phone: '13800138000',
-			position: '安保主管',
-			status: '在岗',
-			avatar: 'https://ai-public.mastergo.com/ai/img_res/0e24afc38826cc6acd7c21f9423bfff1.jpg'
-		},
-		{
-			id: 2,
-			name: '李强',
-			phone: '13800138001',
-			position: '安保队长',
-			status: '休息',
-			avatar: 'https://ai-public.mastergo.com/ai/img_res/5c69aa860f81bf5bcf6592deb7391099.jpg'
-		},
-		{
-			id: 3,
-			name: '王华',
-			phone: '13800138002',
-			position: '安保员',
-			status: '在岗',
-			avatar: 'https://ai-public.mastergo.com/ai/img_res/4b109fb7399df8f30756530cac9e9004.jpg'
-		}
-	]);
 
+	const getEventList = async () => {
+		const res = await clientGet("/park/securityPersonnel/findByPage", {
+			pageNum: currentPage.value,
+			pageSize: pageSize.value,
+		})
+		if (res.code !== 200) {
+			uni.showToast({
+				title: "请求数据失败",
+				duration: 2000
+			})
+		}
+		console.log("获取数据", res);
+		securityList.value = res.records
+	}
+	getEventList()
 	const onRefresh = () => {
 		isRefreshing.value = true;
 		setTimeout(() => {
@@ -95,7 +99,7 @@
 	.scroll-container {
 		flex: 1;
 		overflow: auto;
-	} 
+	}
 
 	.security-list {
 		padding: 20rpx;

BIN
static/img/anbaoimg/female.png


BIN
static/img/anbaoimg/male.png


BIN
static/img/tabBar/home.png


BIN
static/img/tabBar/homeative.png


BIN
static/img/tabBar/security.png


BIN
static/img/tabBar/securityative.png