Pārlūkot izejas kodu

fix:把弹窗的关闭按钮文本改成取消、处理二氧化碳上下限、处理监测点配置页面点击返回文本也能返回、处理名称必须是以编号或型号开头

lh_hub 6 mēneši atpakaļ
vecāks
revīzija
89f5642cd8

+ 1 - 1
snowy-admin-web/src/views/basicset/devicetype/form.vue

@@ -133,7 +133,7 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>

+ 1 - 1
snowy-admin-web/src/views/basicset/mem/configForm.vue

@@ -157,7 +157,7 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>

+ 1 - 1
snowy-admin-web/src/views/basicset/mem/form copy.vue

@@ -241,7 +241,7 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>

+ 1 - 1
snowy-admin-web/src/views/basicset/mem/form.vue

@@ -148,7 +148,7 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>

+ 1 - 1
snowy-admin-web/src/views/basicset/monitor/configForm.vue

@@ -160,7 +160,7 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>

+ 1 - 1
snowy-admin-web/src/views/basicset/monitor/form copy.vue

@@ -254,7 +254,7 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>

+ 1 - 1
snowy-admin-web/src/views/basicset/monitor/form.vue

@@ -28,7 +28,7 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>

+ 1 - 1
snowy-admin-web/src/views/biz/monitor/devicetype/form.vue

@@ -133,7 +133,7 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>

+ 1 - 1
snowy-admin-web/src/views/biz/monitor/mem/configForm.vue

@@ -157,7 +157,7 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>

+ 26 - 4
snowy-admin-web/src/views/biz/monitor/mem/form.vue

@@ -19,6 +19,7 @@
 						<a-select
 							ref="select"
 							v-model:value="formData.modelName"
+							:disabled="formData.id"
 							:options="modeOptions"
 							placeholder="请选择设备型号"
 							@change="modelNameChange"
@@ -39,7 +40,13 @@
 				</a-col>
 				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
 					<a-form-item label="设备名称" name="deviceName">
-						<a-input v-model:value="formData.deviceName" placeholder="请输入设备名称" allow-clear />
+						<a-input
+							:value="formData.deviceName"
+							:disabled="!formData.deviceCode"
+							placeholder="请输入设备名称"
+							allow-clear
+							@input="deviceNameInput"
+						/>
 					</a-form-item>
 				</a-col>
 
@@ -156,20 +163,21 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>
 </template>
 
 <script setup>
+	import { message } from 'ant-design-vue'
 	import { required, rules } from '@/utils/formRules'
 	import devicetypeApi from '@/api/basicset/devicetypeApi'
 	import memApi from '@/api/basicset/memApi'
 	const emit = defineEmits({ successful: null })
 	const visible = ref(false) // 默认是关闭状态
 	const formRef = ref()
-	const formData = ref({ sortCode: 99 }) // 表单数据
+	const formData = ref({ sortCode: 99, status: '1' }) // 表单数据
 	const modeOptions = ref([]) // 设备型号
 	const sensorRouteMax = ref(1) //传感器最大值默认1
 
@@ -229,7 +237,7 @@
 		if (record) {
 			formData.value = Object.assign({}, record)
 		} else {
-			formData.value = { sortCode: 99 }
+			formData.value = { sortCode: 99, status: '1' }
 		}
 	}
 
@@ -240,6 +248,20 @@
 		}
 	}
 
+	// 设备名称改变
+	const deviceNameInput = (e) => {
+		const val = e.target.value
+		if (!val.startsWith(formData.value.deviceCode)) {
+			formData.value.deviceName = formData.value.deviceCode
+			message.warning({
+				content: `设备名称必须以设备编号:${formData.value.deviceCode} 开头`,
+				key: 'deviceName'
+			})
+		} else {
+			formData.value.deviceName = val
+		}
+	}
+
 	// 关闭抽屉
 	const onClose = () => {
 		formRef.value.resetFields()

+ 3 - 3
snowy-admin-web/src/views/biz/monitor/object/form.vue

@@ -28,7 +28,7 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>
@@ -50,7 +50,7 @@
 	}
 
 	// 表单数据
-	const formData = ref({})
+	const formData = ref({ status: '1' })
 
 	// 打开抽屉
 	const onOpen = (record) => {
@@ -58,7 +58,7 @@
 		if (record) {
 			formData.value = Object.assign({}, record)
 		} else {
-			formData.value = {}
+			formData.value = { status: '1' }
 		}
 	}
 	// 关闭抽屉

+ 7 - 2
snowy-admin-web/src/views/biz/monitor/object/index.vue

@@ -69,9 +69,14 @@
 					<a-popconfirm title="确定要删除吗?" @confirm="deleteData(record)">
 						<a-button type="link" danger size="small">删除</a-button>
 					</a-popconfirm>
-					<a-button type="link" size="small" @click="leaveFor('/biz/monitor/point', record)" v-if="record.status == '1'"
-						>监测点配置</a-button
+					<a-button
+						v-if="record.status == '1'"
+						type="link"
+						size="small"
+						@click="leaveFor('/biz/monitor/point', record)"
 					>
+						监测点
+					</a-button>
 				</template>
 			</template>
 

+ 32 - 9
snowy-admin-web/src/views/biz/monitor/point/form.vue

@@ -27,7 +27,7 @@
 				</a-col>
 				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
 					<a-form-item label="点位名称" name="name">
-						<a-input v-model:value="formData.name" placeholder="请输入点位名称" allow-clear />
+						<a-input :value="formData.name" placeholder="请输入点位名称" allow-clear @input="nameInput" />
 					</a-form-item>
 				</a-col>
 				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
@@ -158,6 +158,7 @@
 								placeholder="请输入CO2上限"
 								allow-clear
 								:max="co2Max.upMax"
+								:min="co2Max.downMax"
 								style="width: 100%"
 							/>
 						</a-form-item>
@@ -169,7 +170,8 @@
 								v-model:value="formData.co2Down"
 								placeholder="请输入CO2下限"
 								allow-clear
-								:max="co2Max.downMax"
+								:max="co2Max.upMax"
+								:min="co2Max.downMax"
 								style="width: 100%"
 							/>
 						</a-form-item>
@@ -179,13 +181,16 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>
 </template>
 
 <script setup>
+	import { message } from 'ant-design-vue'
+	import { debounce } from 'lodash-es'
+
 	import tool from '@/utils/tool'
 	import { required } from '@/utils/formRules'
 	import locationApi from '@/api/basicset/locationApi.js'
@@ -226,13 +231,13 @@
 	function validateTemperature(rule, value, callback) {
 		if (rule.field == 'temperatureDown') {
 			if (formData.value.temperatureUp !== null && value >= formData.value.temperatureUp) {
-				callback(new Error('温度下限不能大于或等于温度上限'))
+				callback(new Error('温度下限不能大于或等于温度上限' + formData.value.temperatureUp))
 			} else {
 				callback()
 			}
 		} else if (rule.field == 'temperatureUp') {
 			if (formData.value.temperatureDown !== null && value <= formData.value.temperatureDown) {
-				callback(new Error('温度上限不能小于或等于温度下限'))
+				callback(new Error('温度上限不能小于或等于温度下限' + formData.value.temperatureDown))
 			} else {
 				callback()
 			}
@@ -243,13 +248,13 @@
 	function validateHumidity(rule, value, callback) {
 		if (rule.field == 'humidityDown') {
 			if (formData.value.humidityUp !== null && value >= formData.value.humidityUp) {
-				callback(new Error('湿度下限不能大于或等于湿度上限'))
+				callback(new Error('湿度下限不能大于或等于湿度上限' + formData.value.humidityUp))
 			} else {
 				callback()
 			}
 		} else if (rule.field == 'humidityUp') {
 			if (formData.value.humidityDown !== null && value <= formData.value.humidityDown) {
-				callback(new Error('湿度上限不能小于或等于湿度下限'))
+				callback(new Error('湿度上限不能小于或等于湿度下限' + formData.value.humidityDown))
 			} else {
 				callback()
 			}
@@ -260,13 +265,13 @@
 	function validateCo2(rule, value, callback) {
 		if (rule.field == 'co2Down') {
 			if (formData.value.co2Up !== null && value >= formData.value.co2Up) {
-				callback(new Error('CO2下限不能大于或等于CO2上限'))
+				callback(new Error('CO2下限不能大于或等于CO2上限' + formData.value.co2Up))
 			} else {
 				callback()
 			}
 		} else if (rule.field == 'co2Up') {
 			if (formData.value.co2Down !== null && value <= formData.value.co2Down) {
-				callback(new Error('CO2上限不能小于或等于CO2下限'))
+				callback(new Error('CO2上限不能小于或等于CO2下限' + formData.value.co2Down))
 			} else {
 				callback()
 			}
@@ -284,6 +289,7 @@
 			if (formData.value.alarmUsers && formData.value.alarmUsers.length > 0) {
 				formData.value.alarmUsers = formData.value.alarmUsers.map((item) => item.openId)
 			}
+
 			sensorType.value = formData.value.sensorType
 
 			memListData(sensorType.value)
@@ -308,10 +314,25 @@
 			if (!formData.value.id) {
 				formData.value.name = list.label
 			}
+			formData.value._name = list.label
 			alarmUsersOptions.value = list.alarmUsers || []
 		})
 	}
 
+	// 名称输入
+	const nameInput = (e) => {
+		const val = e.target.value
+		if (!val.startsWith(formData.value._name)) {
+			formData.value.name = formData.value._name
+			message.warning({
+				content: '名称必须以监控对象名称:' + formData.value._name + ' 开头',
+				key: 'name'
+			})
+		} else {
+			formData.value.name = val
+		}
+	}
+
 	const sensorType = ref() //选中的传感器类型
 	// 监测设备通过传感器类型来获取, sensorType可为空
 	const memListData = (value) => {
@@ -363,10 +384,12 @@
 				upMax: data.temperatureUp,
 				downMax: data.temperatureDown
 			}
+
 			humidityMax.value = {
 				upMax: data.humidityUp,
 				downMax: data.humidityDown
 			}
+
 			co2Max.value = {
 				upMax: data.co2Up,
 				downMax: data.co2Down

+ 10 - 1
snowy-admin-web/src/views/biz/monitor/point/index.vue

@@ -1,6 +1,11 @@
 <template>
 	<div class="table_item">
-		<a-page-header title="返回" sub-title="监测点配置" @back="goBack" style="padding: 20px 0" />
+		<a-page-header sub-title="监测点配置" @back="goBack" style="padding: 20px 0">
+			<template #title>
+				<span style="font-size: 20px; cursor: pointer" @click="goBack">返回</span>
+			</template>
+		</a-page-header>
+
 		<s-table
 			ref="tableRef"
 			:columns="columns"
@@ -183,5 +188,9 @@
 		:deep(.ant-table-pagination-right) {
 			justify-content: center !important;
 		}
+
+		:deep .ant-page-header-back {
+			margin-right: 8px;
+		}
 	}
 </style>

+ 1 - 1
snowy-admin-web/src/views/motoring/location/form.vue

@@ -179,7 +179,7 @@
 		</a-form>
 
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">保存</a-button>
 		</template>
 	</xn-form-container>

+ 1 - 1
snowy-admin-web/src/views/motoring/report/components/DetailModal.vue

@@ -50,7 +50,7 @@
 			</a-form-item>
 		</a-form>
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button :loading="loading.submitLoading" type="primary" @click="onSubmit">确定</a-button>
 		</template>
 	</xn-form-container>

+ 1 - 1
snowy-admin-web/src/views/motoring/report/components/form.vue

@@ -24,7 +24,7 @@
 			</a-form-item>
 		</a-form>
 		<template #footer>
-			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button class="xn-mr8" @click="onClose">取消</a-button>
 			<a-button type="primary" @click="onSubmit">报警确定</a-button>
 		</template>
 		<Icon-selector ref="iconSelectorRef" @iconCallBack="iconCallBack" />