Explorar o código

Merge branch 'master' of http://git.nzklabs.com:3000/huangyuanhao/jfcloud-coldchain

jackzhou hai 6 meses
pai
achega
01eeb2c92b

+ 28 - 0
snowy-admin-web/src/api/basicset/devicetypeApi.js

@@ -0,0 +1,28 @@
+import { baseRequest } from '@/utils/request'
+
+const request = (url, ...arg) => baseRequest(`/coldchain/monitordevicetype/` + url, ...arg)
+
+// 设备类型
+export default {
+	// 获取列表数据分页
+	devicetypePage(data) {
+		return request('page', data, 'get')
+	},
+	//不分页
+	devicetypeList(data) {
+		return request('list', data, 'get')
+	},
+
+	// 提交表单 edit为true时为编辑,默认为新增
+	submitForm(data, edit = false) {
+		return request(edit ? 'edit' : 'add', data)
+	},
+	// 删除
+	devicetypeDelete(data) {
+		return request('delete', data)
+	},
+	// 详情
+	devicetypeDetail(data) {
+		return request('detail', data, 'get')
+	}
+}

+ 0 - 221
snowy-admin-web/src/views/basicset/devicetype/category.vue

@@ -1,221 +0,0 @@
-<template>
-	<div class="table_item">
-		<s-table ref="tableRef" :columns="columns" :data="loadData" :row-key="(record) => record.code">
-			<template #operator>
-				<!-- 其他操作区域 -->
-				<div class="table-head-btn">
-					<div class="btn-left">
-						<a-button type="primary" @click="onOpen()">
-							<template #icon><plus-outlined /></template>新增
-						</a-button>
-					</div>
-				</div>
-			</template>
-			<template #bodyCell="{ column, record }">
-				<template v-if="column.dataIndex === 'action'">
-					<a-button type="link" size="small" @click="onOpen(record)">编辑</a-button>
-					<a-popconfirm title="确定要删除吗?" @confirm="deleteData(record)">
-						<a-button type="link" danger size="small">删除</a-button>
-					</a-popconfirm>
-				</template>
-			</template>
-		</s-table>
-
-		<!-- 弹框 -->
-		<xn-form-container
-			:title="formData.code ? '编辑' : '新增'"
-			:width="'500px'"
-			:visible="visible"
-			:destroy-on-close="true"
-			@close="onClose"
-		>
-			<a-form
-				ref="formRef"
-				:model="formData"
-				:rules="formRules"
-				layout="inline"
-				:label-col="{ style: { width: '80px', justifyContent: 'end' } }"
-			>
-				<a-form-item label="类别编码" name="code">
-					<a-input v-model:value="formData.code" placeholder="请输入类别编码" allow-clear style="width: 100%" />
-				</a-form-item>
-				<a-form-item label="类别名称" name="name">
-					<a-input v-model:value="formData.name" placeholder="请输入类别名称" allow-clear />
-				</a-form-item>
-				<a-form-item label="备注">
-					<a-textarea
-						v-model:value="formData.remarks"
-						placeholder="请输入备注"
-						allow-clear
-						:maxlength="200"
-						:rows="4"
-					/>
-				</a-form-item>
-			</a-form>
-
-			<template #footer>
-				<a-button class="xn-mr8" @click="onClose">退出</a-button>
-				<a-button type="primary" @click="onSubmit">保存</a-button>
-			</template>
-		</xn-form-container>
-	</div>
-</template>
-
-<script setup>
-	import tool from '@/utils/tool'
-	import jobApi from '@/api/dev/jobApi'
-	import { required } from '@/utils/formRules'
-	const searchFormState = ref({})
-	const tableRef = ref()
-	const columns = [
-		{
-			title: '类别编号',
-			dataIndex: 'code',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '类别名称',
-			dataIndex: 'name',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '描述',
-			dataIndex: 'describe',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '创立日期',
-			dataIndex: 'date',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '创建人',
-			dataIndex: 'creator',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '操作',
-			dataIndex: 'action',
-			align: 'center',
-			width: 150
-		}
-	]
-
-	const loadData = (parameter) => {
-		return jobApi.jobPage(Object.assign(parameter, searchFormState.value)).then((res) => {
-			// return res
-			const obj = {
-				current: 1,
-				pages: 1,
-				records: [
-					{
-						code: 'Y6578945621',
-						name: '20241105123456',
-						describe: '对象类型管理描述描述描述描述描述描述描述描述描述',
-						date: '2024-09-28 07:03:24',
-						creator: 'ADMIN'
-					},
-					{
-						code: 'Y6578945622',
-						name: '20241105223456',
-						describe: '对象类型管理描述描述描述描述描述描述描述描述描述',
-						date: '2024-09-28 09:21:51',
-						creator: 'ADMIN'
-					},
-					{
-						code: 'Y6578945623',
-						name: '202411051323456',
-						describe: '对象类型管理描述描述描述描述描述描述描述描述描述',
-						date: '2024-09-28 11:06:20',
-						creator: 'ADMIN'
-					},
-					{
-						code: 'Y6578945624',
-						name: '202411051423456',
-						describe: '对象类型管理描述描述描述描述描述描述描述描述描述',
-						date: '2024-09-28 11:54:19',
-						creator: 'ADMIN'
-					},
-					{
-						code: 'Y6578945625',
-						name: '202411051523456',
-						describe: '对象类型管理描述描述描述描述描述描述描述描述描述',
-
-						date: '2024-09-28 16:17:36',
-						creator: 'ADMIN'
-					},
-					{
-						code: 'Y6578945626',
-						name: '202411051463456',
-						describe: '对象类型管理描述描述描述描述描述描述描述描述描述',
-						date: '2024-09-28 19:35:58',
-						creator: 'ADMIN'
-					}
-				],
-				size: 10,
-				total: 6
-			}
-			return obj
-		})
-	}
-
-	// 删除
-	const deleteData = (record) => {
-		console.log(record, '删除')
-	}
-
-	const visible = ref(false)
-	const formRef = ref()
-	// 表单数据
-	const formData = ref({})
-	// 默认要校验的
-	const formRules = {
-		name: [required('请输入类别名称')],
-		code: [required('请输入类别编码')]
-	}
-	// 新增编辑打开弹框
-	const onOpen = (record) => {
-		visible.value = true
-		if (record) {
-			formData.value = Object.assign({}, record)
-		} else {
-			formData.value = {}
-		}
-	}
-	// 关闭弹框
-	const onClose = () => {
-		formRef.value.resetFields()
-		visible.value = false
-	}
-	// 验证并提交数据
-	const onSubmit = () => {
-		formRef.value
-			.validate()
-			.then(() => {
-				console.log(formData.value.list, '提交数据')
-				// 	onClose()
-			})
-			.catch((error) => {
-				console.log(error)
-			})
-	}
-</script>
-
-<style lang="less" scoped>
-	.table_item {
-		padding: 15px 20px;
-
-		:deep(.ant-table-pagination-right) {
-			justify-content: center !important;
-		}
-	}
-	:deep(.ant-form-item) {
-		width: 100%;
-		margin-bottom: 10px;
-	}
-</style>

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

@@ -0,0 +1,183 @@
+<template>
+	<xn-form-container
+		:title="formData.id ? '编辑设备型号' : '新增设备型号'"
+		:width="'800px'"
+		:visible="visible"
+		:destroy-on-close="true"
+		@close="onClose"
+	>
+		<a-form
+			ref="formRef"
+			:model="formData"
+			:rules="formRules"
+			layout="inline"
+			:label-col="{ style: { width: '100px', justifyContent: 'end' } }"
+		>
+			<a-row :gutter="10">
+				<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-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="型号编号" name="code">
+						<a-input v-model:value="formData.code" placeholder="请输入型号编号" allow-clear />
+					</a-form-item>
+				</a-col>
+
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="温度上限" name="temperatureUp">
+						<a-input-number
+							id="inputNumber"
+							v-model:value="formData.temperatureUp"
+							placeholder="请输入温度上限"
+							allow-clear
+							style="width: 100%"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="温度下限" name="temperatureDown">
+						<a-input-number
+							id="inputNumber"
+							v-model:value="formData.temperatureDown"
+							placeholder="请输入温度下限"
+							allow-clear
+							style="width: 100%"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="湿度上限" name="humidityUp">
+						<a-input-number
+							id="inputNumber"
+							v-model:value="formData.humidityUp"
+							placeholder="请输入湿度上限"
+							allow-clear
+							style="width: 100%"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="湿度下限" name="humidityDown">
+						<a-input-number
+							id="inputNumber"
+							v-model:value="formData.humidityDown"
+							placeholder="请输入湿度下限"
+							allow-clear
+							style="width: 100%"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="CO2上限" name="co2Up">
+						<a-input-number
+							id="inputNumber"
+							v-model:value="formData.co2Up"
+							placeholder="请输入CO2上限"
+							allow-clear
+							style="width: 100%"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="CO2下限" name="co2Down">
+						<a-input-number
+							id="inputNumber"
+							v-model:value="formData.co2Down"
+							placeholder="请输入CO2下限"
+							allow-clear
+							style="width: 100%"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="传感器路数" name="sensorCount">
+						<a-input-number
+							v-model:value="formData.sensorCount"
+							placeholder="请输入传感器路数"
+							allow-clear
+							:min="1"
+							:max="100000"
+							style="width: 100%"
+							:precision="0"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="排序:" name="sortCode">
+						<a-input-number class="xn-wd" v-model:value="formData.sortCode" :max="100" />
+					</a-form-item>
+				</a-col>
+			</a-row>
+		</a-form>
+
+		<template #footer>
+			<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 { required } from '@/utils/formRules'
+	import devicetypeApi from '@/api/basicset/devicetypeApi'
+	const emit = defineEmits({ successful: null })
+	const visible = ref(false) // 默认是关闭状态
+	const formRef = ref()
+	const formData = ref({ sortCode: 99 }) // 表单数据
+	// 默认要校验的
+	const formRules = {
+		name: [required('请输入型号名称')],
+		code: [required('请输入型号编号')],
+		temperatureUp: [required('请输入温度上限')],
+		temperatureDown: [required('请输入温度下限')],
+		humidityUp: [required('请输入湿度上限')],
+		humidityDown: [required('请输入湿度下限')],
+		co2Up: [required('请输入CO2上限')],
+		co2Down: [required('请输入CO2下限')],
+		sensorCount: [required('请输入传感器路数')]
+	}
+
+	// 打开抽屉
+	const onOpen = (record) => {
+		visible.value = true
+		if (record) {
+			formData.value = Object.assign({}, record)
+		} else {
+			formData.value = { sortCode: 99 }
+		}
+	}
+	// 关闭抽屉
+	const onClose = () => {
+		formRef.value.resetFields()
+		visible.value = false
+	}
+
+	// 验证并提交数据
+	const onSubmit = () => {
+		formRef.value
+			.validate()
+			.then(() => {
+				devicetypeApi.submitForm(formData.value, formData.value.id).then(() => {
+					onClose()
+					emit('successful')
+				})
+			})
+			.catch((error) => {
+				console.log(error)
+			})
+	}
+
+	// 调用这个函数将子组件的一些数据和方法暴露出去
+	defineExpose({
+		onOpen
+	})
+</script>
+
+<style lang="less" scoped>
+	:deep(.ant-form-item) {
+		width: 100%;
+		margin-bottom: 10px;
+	}
+</style>

+ 166 - 51
snowy-admin-web/src/views/basicset/devicetype/index.vue

@@ -1,67 +1,182 @@
 <template>
-	<div class="query-box">
-		<div class="query-head">
-			<div class="query-tbas">
-				<div class="tbas-title" :class="activeKey == '1' ? 'active' : ''" @click="activeclick('1')">对象类别管理</div>
-				<a-divider type="vertical" style="height: 15px; background-color: #f4f5f7; margin: 8px 20px" />
-				<div class="tbas-title" :class="activeKey == '2' ? 'active' : ''" @click="activeclick('2')">对象型号管理</div>
-			</div>
-		</div>
+	<div class="table_item">
+		<s-table ref="tableRef" :columns="columns" :data="loadData" :row-key="(record) => record.id">
+			<template #operator>
+				<!-- 搜索区域 -->
+				<div class="table-search">
+					<div class="table-search-form">
+						<a-row :gutter="10">
+							<a-form
+								ref="searchFormRef"
+								name="advanced_search"
+								layout="inline"
+								:label-col="{ style: { width: '70px', justifyContent: 'end' } }"
+								:model="searchFormState"
+								class="ant-advanced-search-form"
+							>
+								<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8"
+									><a-form-item label="型号名称" name="name">
+										<a-input v-model:value="searchFormState.name" placeholder="请输入型号名称" /> </a-form-item
+								></a-col>
+							</a-form>
+						</a-row>
+					</div>
+					<div class="table-search-buttons">
+						<a-button type="primary" @click="tableRef.refresh(true)">查询</a-button>
+						<a-button class="xn-mg08" @click="reset">重置</a-button>
+					</div>
+				</div>
 
-		<div class="query-body">
-			<Category ref="categoryRef" v-if="activeKey == '1'" />
-			<Model ref="modelRef" v-if="activeKey == '2'" />
-		</div>
+				<!-- 其他操作区域 -->
+				<div class="table-head-btn">
+					<div class="btn-left">
+						<a-button type="primary" @click="formRef.onOpen()">
+							<template #icon><plus-outlined /></template>新增
+						</a-button>
+					</div>
+				</div>
+			</template>
+			<template #bodyCell="{ column, record }">
+				<template v-if="column.dataIndex === 'action'">
+					<a-button type="link" size="small" @click="formRef.onOpen(record)">编辑</a-button>
+					<a-popconfirm title="确定要删除吗?" @confirm="deleteData(record)">
+						<a-button type="link" danger size="small">删除</a-button>
+					</a-popconfirm>
+				</template>
+			</template>
+		</s-table>
+
+		<Form ref="formRef" @successful="tableRef.refresh(true)" />
 	</div>
 </template>
+
 <script setup>
-	import Category from './category.vue'
-	import Model from './model.vue'
+	import devicetypeApi from '@/api/basicset/devicetypeApi'
+	import Form from './form.vue'
+	const formRef = ref()
+	const searchFormRef = ref()
+	const searchFormState = ref({})
+	const tableRef = ref()
 
-	const activeKey = ref('1')
-	const categoryRef = ref(null)
-	const modelRef = ref(null)
+	const columns = [
+		{
+			title: '型号名称',
+			dataIndex: 'name',
+			align: 'center',
+			ellipsis: true
+		},
+		{
+			title: '型号编号',
+			dataIndex: 'code',
+			align: 'center',
+			ellipsis: true
+		},
+		{
+			title: '传感器路数',
+			dataIndex: 'sensorCount',
+			align: 'center',
+			ellipsis: true
+		},
+		{
+			title: '温度上限',
+			dataIndex: 'temperatureUp',
+			align: 'center',
+			ellipsis: true
+		},
+		{
+			title: '温度下限',
+			dataIndex: 'temperatureDown',
+			align: 'center',
+			ellipsis: true
+		},
+		{
+			title: '湿度上限',
+			dataIndex: 'humidityUp',
+			align: 'center',
+			ellipsis: true
+		},
 
-	onMounted(() => {})
+		{
+			title: '湿度下限',
+			dataIndex: 'humidityDown',
+			align: 'center',
+			ellipsis: true
+		},
+		{
+			title: 'CO2上限',
+			dataIndex: 'co2Up',
+			align: 'center',
+			ellipsis: true
+		},
+		{
+			title: 'CO2下限',
+			dataIndex: 'co2Down',
+			align: 'center',
+			ellipsis: true
+		},
 
-	onBeforeMount(() => {})
+		{
+			title: '排序码',
+			dataIndex: 'sortCode',
+			align: 'center',
+			ellipsis: true,
+			sorter: true
+		},
+
+		{
+			title: '操作',
+			dataIndex: 'action',
+			align: 'center',
+			width: 150
+		}
+	]
 
-	// 点击标签
-	const activeclick = (v) => {
-		activeKey.value = v
+	const loadData = (parameter) => {
+		return devicetypeApi.devicetypePage(Object.assign(parameter, searchFormState.value)).then((res) => {
+			return res
+		})
+	}
+	// 重置
+	const reset = () => {
+		searchFormRef.value.resetFields()
+		tableRef.value.refresh(true)
+	}
+	// 删除
+	const deleteData = (record) => {
+		let params = [
+			{
+				id: record.id
+			}
+		]
+		devicetypeApi.devicetypeDelete(params).then(() => {
+			tableRef.value.refresh(true)
+			reset()
+		})
 	}
 </script>
-<style lang="less" scoped>
-	.query-box {
-		width: 100%;
-		background-color: #fff;
 
-		// 顶部
-		.query-head {
-			width: 100%;
-			height: 50px;
-			display: flex;
-			justify-content: space-between;
-			padding: 15px;
-			border-bottom: 1px solid #e7e7e7;
-
-			.query-tbas {
-				width: 95%;
-				display: flex;
-
-				.tbas-title {
-					height: 35px;
-					line-height: 25px;
-					color: #a7a7a7;
-					font-size: 16px;
-					cursor: pointer;
-				}
+<style lang="less" scoped>
+	.table_item {
+		padding: 15px 20px;
+		background-color: #ffffff;
+		:deep(.ant-table-pagination-right) {
+			justify-content: center !important;
+		}
+	}
+	.list {
+		width: 60%;
+		padding: 10px 20px;
+		border-radius: 10px;
+		background-color: #ffffff;
 
-				.active {
-					color: #1b8fff;
-					border-bottom: 2px solid #1b8fff;
-				}
-			}
+		:deep(.ant-descriptions) {
+			margin-bottom: 10px;
+		}
+		:deep(.ant-descriptions-header) {
+			margin: 0;
+			padding: 10px;
+			border: 1px solid #f0f0f0;
+			border-bottom: none;
 		}
 	}
 </style>

+ 0 - 266
snowy-admin-web/src/views/basicset/devicetype/model.vue

@@ -1,266 +0,0 @@
-<template>
-	<div class="table_item">
-		<s-table ref="tableRef" :columns="columns" :data="loadData" :row-key="(record) => record.code">
-			<template #operator>
-				<!-- 搜索区域 -->
-				<div class="table-search">
-					<div class="table-search-form">
-						<a-row :gutter="10">
-							<a-form
-								ref="searchFormRef"
-								name="advanced_search"
-								layout="inline"
-								:label-col="{ style: { width: '70px', justifyContent: 'end' } }"
-								:model="searchFormState"
-								class="ant-advanced-search-form"
-							>
-								<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
-									<a-form-item label="型号名称" name="code">
-										<a-input v-model:value="searchFormState.code" placeholder="请输入型号名称" /> </a-form-item
-								></a-col>
-							</a-form>
-						</a-row>
-					</div>
-					<div class="table-search-buttons">
-						<a-button type="primary" @click="tableRef.refresh(true)">查询</a-button>
-						<a-button class="xn-mg08" @click="reset">重置</a-button>
-					</div>
-				</div>
-
-				<!-- 其他操作区域 -->
-				<div class="table-head-btn">
-					<div class="btn-left">
-						<a-button type="primary" @click="onOpen()">
-							<template #icon><plus-outlined /></template>新增
-						</a-button>
-					</div>
-				</div>
-			</template>
-			<template #bodyCell="{ column, record }">
-				<template v-if="column.dataIndex === 'action'">
-					<a-button type="link" size="small" @click="onOpen(record)">编辑</a-button>
-					<a-popconfirm title="确定要删除吗?" @confirm="deleteData(record)">
-						<a-button type="link" danger size="small">删除</a-button>
-					</a-popconfirm>
-				</template>
-			</template>
-		</s-table>
-
-		<!-- 弹框 -->
-		<xn-form-container
-			:title="formData.code ? '编辑' : '新增'"
-			:width="'600px'"
-			:visible="visible"
-			:destroy-on-close="true"
-			@close="onClose"
-		>
-			<a-form
-				ref="formRef"
-				:model="formData"
-				:rules="formRules"
-				layout="inline"
-				:label-col="{ style: { width: '80px', justifyContent: 'end' } }"
-			>
-				<a-form-item label="名称" name="name">
-					<a-input v-model:value="formData.name" placeholder="请输入名称" allow-clear />
-				</a-form-item>
-				<a-form-item label="对象类别">
-					<a-select ref="select" v-model:value="formData.type" placeholder="请选择对象类别">
-						<a-select-option value="1">冰箱</a-select-option>
-						<a-select-option value="2">新装</a-select-option>
-						<a-select-option value="3">液氮罐</a-select-option>
-					</a-select>
-				</a-form-item>
-				<a-form-item label="品牌">
-					<a-input v-model:value="formData.pp" placeholder="请输入品牌" allow-clear />
-				</a-form-item>
-				<a-form-item label="型号图片" name="image">
-					<xn-upload v-model:value="formData.image" uploadMode="image" />
-				</a-form-item>
-				<a-form-item label="备注">
-					<a-textarea
-						v-model:value="formData.remarks"
-						placeholder="请输入备注"
-						allow-clear
-						:maxlength="200"
-						:rows="4"
-					/>
-				</a-form-item>
-			</a-form>
-
-			<template #footer>
-				<a-button class="xn-mr8" @click="onClose">退出</a-button>
-				<a-button type="primary" @click="onSubmit">保存</a-button>
-			</template>
-		</xn-form-container>
-	</div>
-</template>
-
-<script setup>
-	import tool from '@/utils/tool'
-	import jobApi from '@/api/dev/jobApi'
-	import { required } from '@/utils/formRules'
-	const searchFormState = ref({})
-	const tableRef = ref()
-	const columns = [
-		{
-			title: '对象类别',
-			dataIndex: 'code',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '品牌',
-			dataIndex: 'pp',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '对象型号名称',
-			dataIndex: 'name',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '对象型号图片',
-			dataIndex: 'img',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '描述',
-			dataIndex: 'describe',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '创立时间',
-			dataIndex: 'date',
-			align: 'center',
-			ellipsis: true
-		},
-
-		{
-			title: '操作',
-			dataIndex: 'action',
-			align: 'center',
-			width: 150
-		}
-	]
-
-	const loadData = (parameter) => {
-		return jobApi.jobPage(Object.assign(parameter, searchFormState.value)).then((res) => {
-			// return res
-			const obj = {
-				current: 1,
-				pages: 1,
-				records: [
-					{
-						code: 'Y6578945621',
-						name: '20241105123456',
-						describe: '对象型号管理描述描述描述描述描述描述描述描述描述',
-						date: '2024-09-28 07:03:24',
-						creator: 'ADMIN'
-					},
-					{
-						code: 'Y6578945622',
-						name: '20241105223456',
-						describe: '对象型号管理描述描述描述描述描述描述描述描述描述',
-						date: '2024-09-28 09:21:51',
-						creator: 'ADMIN'
-					},
-					{
-						code: 'Y6578945623',
-						name: '202411051323456',
-						describe: '对象型号管理描述描述描述描述描述描述描述描述描述',
-						date: '2024-09-28 11:06:20',
-						creator: 'ADMIN'
-					},
-					{
-						code: 'Y6578945624',
-						name: '202411051423456',
-						describe: '对象型号管理描述描述描述描述描述描述描述描述描述',
-						date: '2024-09-28 11:54:19',
-						creator: 'ADMIN'
-					},
-					{
-						code: 'Y6578945625',
-						name: '202411051523456',
-						describe: '对象型号管理描述描述描述描述描述描述描述描述描述',
-
-						date: '2024-09-28 16:17:36',
-						creator: 'ADMIN'
-					},
-					{
-						code: 'Y6578945626',
-						name: '202411051463456',
-						describe: '对象型号管理描述描述描述描述描述描述描述描述描述',
-						date: '2024-09-28 19:35:58',
-						creator: 'ADMIN'
-					}
-				],
-				size: 10,
-				total: 6
-			}
-			return obj
-		})
-	}
-	// 重置
-	const reset = () => {
-		searchFormRef.value.resetFields()
-		tableRef.value.refresh(true)
-	}
-
-	// 删除
-	const deleteData = (record) => {
-		console.log(record, '删除')
-	}
-	const visible = ref(false)
-	const formRef = ref()
-	// 表单数据
-	const formData = ref({})
-	// 默认要校验的
-	const formRules = {
-		name: [required('请输入类别名称')],
-		code: [required('请输入类别编码')]
-	}
-	// 新增编辑打开弹框
-	const onOpen = (record) => {
-		visible.value = true
-		if (record) {
-			formData.value = Object.assign({}, record)
-		} else {
-			formData.value = { type: '1' }
-		}
-	}
-	// 关闭弹框
-	const onClose = () => {
-		formRef.value.resetFields()
-		visible.value = false
-	}
-	// 验证并提交数据
-	const onSubmit = () => {
-		formRef.value
-			.validate()
-			.then(() => {
-				console.log(formData.value.list, '提交数据')
-				// 	onClose()
-			})
-			.catch((error) => {
-				console.log(error)
-			})
-	}
-</script>
-
-<style lang="less" scoped>
-	.table_item {
-		padding: 15px 20px;
-	}
-	:deep(.ant-table-pagination-right) {
-		justify-content: center !important;
-	}
-	:deep(.ant-form-item) {
-		width: 100%;
-		margin-bottom: 10px;
-	}
-</style>

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

@@ -1,7 +1,7 @@
 <template>
 	<xn-form-container
 		:title="formData.id ? '编辑采集器' : '新增采集器'"
-		:width="'500px'"
+		:width="'800px'"
 		:visible="visible"
 		:destroy-on-close="true"
 		@close="onClose"
@@ -13,35 +13,127 @@
 			layout="inline"
 			:label-col="{ style: { width: '100px', justifyContent: 'end' } }"
 		>
-			<a-form-item label="设备名称" name="deviceName">
-				<a-input v-model:value="formData.deviceName" placeholder="请输入设备名称" allow-clear />
-			</a-form-item>
-			<a-form-item label="设备编号" name="deviceCode">
-				<a-input v-model:value="formData.deviceCode" placeholder="请输入设备编号" allow-clear />
-			</a-form-item>
-			<a-form-item label="设备型号" name="modelName">
-				<a-select ref="select" v-model:value="formData.modelName" :options="modeOptions"> </a-select>
-			</a-form-item>
-			<a-form-item label="设备状态" name="status">
-				<a-select ref="select" v-model:value="formData.status">
-					<a-select-option value="1">正常</a-select-option>
-					<a-select-option value="2">闲置</a-select-option>
-				</a-select>
-			</a-form-item>
-			<a-form-item label="传感器路数" name="sensorCount">
-				<a-input-number
-					v-model:value="formData.sensorCount"
-					placeholder="请输入传感器路数"
-					allow-clear
-					:min="1"
-					:max="100000"
-					style="width: 100%"
-					:precision="0"
-				/>
-			</a-form-item>
-			<a-form-item label="排序:" name="sortCode">
-				<a-input-number class="xn-wd" v-model:value="formData.sortCode" :max="100" />
-			</a-form-item>
+			<a-row :gutter="10">
+				<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-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="设备编号" name="deviceCode">
+						<a-input v-model:value="formData.deviceCode" placeholder="请输入设备编号" allow-clear />
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="设备型号" name="modelName">
+						<a-select
+							ref="select"
+							v-model:value="formData.modelName"
+							:options="modeOptions"
+							placeholder="请选择设备型号"
+							@change="modelNameChange"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="设备状态" name="status">
+						<a-select ref="select" v-model:value="formData.status" placeholder="请选择设备状态">
+							<a-select-option value="1">正常</a-select-option>
+							<a-select-option value="2">闲置</a-select-option>
+						</a-select>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="温度上限" name="temperatureUp">
+						<a-input-number
+							id="inputNumber"
+							v-model:value="formData.temperatureUp"
+							placeholder="请输入温度上限"
+							allow-clear
+							disabled
+							style="width: 100%"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="温度下限" name="temperatureDown">
+						<a-input-number
+							id="inputNumber"
+							v-model:value="formData.temperatureDown"
+							placeholder="请输入温度下限"
+							allow-clear
+							disabled
+							style="width: 100%"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="湿度上限" name="humidityUp">
+						<a-input-number
+							id="inputNumber"
+							v-model:value="formData.humidityUp"
+							placeholder="请输入湿度上限"
+							allow-clear
+							disabled
+							style="width: 100%"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="湿度下限" name="humidityDown">
+						<a-input-number
+							id="inputNumber"
+							v-model:value="formData.humidityDown"
+							placeholder="请输入湿度下限"
+							allow-clear
+							disabled
+							style="width: 100%"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="CO2上限" name="co2Up">
+						<a-input-number
+							id="inputNumber"
+							v-model:value="formData.co2Up"
+							placeholder="请输入CO2上限"
+							allow-clear
+							disabled
+							style="width: 100%"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="CO2下限" name="co2Down">
+						<a-input-number
+							id="inputNumber"
+							v-model:value="formData.co2Down"
+							placeholder="请输入CO2下限"
+							allow-clear
+							disabled
+							style="width: 100%"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="传感器路数" name="sensorCount">
+						<a-input-number
+							v-model:value="formData.sensorCount"
+							placeholder="请输入传感器路数"
+							allow-clear
+							:min="1"
+							:max="sensorRouteMax"
+							style="width: 100%"
+							:precision="0"
+						/>
+					</a-form-item>
+				</a-col>
+				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+					<a-form-item label="排序:" name="sortCode">
+						<a-input-number class="xn-wd" v-model:value="formData.sortCode" :max="100" />
+					</a-form-item>
+				</a-col>
+			</a-row>
 		</a-form>
 
 		<template #footer>
@@ -52,24 +144,56 @@
 </template>
 
 <script setup>
-	import tool from '@/utils/tool'
 	import { required } 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 modeOptions = tool.dictList('COIDCHAIN') // 设备型号
+	const modeOptions = ref([]) // 设备型号
+	const sensorRouteMax = ref(1) //传感器最大值默认1
+
 	// 默认要校验的
 	const formRules = {
 		deviceName: [required('请输入设备名称')],
 		deviceCode: [required('请输入设备编号')],
 		modelName: [required('请选择设备型号')],
+		status: [required('请选择设备状态')],
 		sensorCount: [required('请输入传感器路数')]
 	}
 
+	// 获取设备型号
+	const loadData = () => {
+		devicetypeApi.devicetypeList().then((res) => {
+			modeOptions.value = (res || []).map((item) => {
+				return {
+					...item,
+					value: item['id'],
+					label: item['name']
+				}
+			})
+		})
+	}
+
+	// 选中设备型号
+	const modelNameChange = (value) => {
+		if (value) {
+			const data = modeOptions.value.find((item) => item.value === value)
+			formData.value.temperatureUp = data.temperatureUp
+			formData.value.temperatureDown = data.temperatureDown
+			formData.value.humidityUp = data.humidityUp
+			formData.value.humidityDown = data.humidityDown
+			formData.value.co2Up = data.co2Up
+			formData.value.co2Down = data.co2Down
+			formData.value.sensorCount = data.sensorCount
+			sensorRouteMax.value = data.sensorCount
+		}
+	}
+
 	// 打开抽屉
 	const onOpen = (record) => {
+		loadData()
 		visible.value = true
 		if (record) {
 			formData.value = Object.assign({}, record)

+ 2 - 5
snowy-admin-web/src/views/basicset/mem/index.vue

@@ -47,9 +47,6 @@
 				</div>
 			</template>
 			<template #bodyCell="{ column, record }">
-				<template v-if="column.dataIndex === 'modelName'">
-					{{ $TOOL.dictTypeData('COIDCHAIN', record.modelName) }}
-				</template>
 				<template v-if="column.dataIndex === 'status'">
 					<span>
 						<a-tag :color="record.status == '1' ? '#87d068' : '#cd201f'">
@@ -58,11 +55,11 @@
 					</span>
 				</template>
 				<template v-if="column.dataIndex === 'action'">
+					<!-- <a-button type="link" size="small" @click="formRef.onOpen(record)">编辑</a-button> -->
 					<a-button type="link" size="small" @click="configformRef.onOpen(record)">配置</a-button>
 					<a-popconfirm title="确定要删除吗?" @confirm="deleteData(record)">
 						<a-button type="link" danger size="small">删除</a-button>
 					</a-popconfirm>
-					<a-button type="link" size="small">记录</a-button>
 				</template>
 			</template>
 			<!-- <template #expandedRowRender="{ record }">
@@ -121,7 +118,7 @@
 		},
 		{
 			title: '设备型号',
-			dataIndex: 'modelName',
+			dataIndex: 'typeName',
 			align: 'center',
 			ellipsis: true
 		},

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

@@ -19,26 +19,6 @@
 						<a-input v-model:value="formData.name" placeholder="请输入点位名称" allow-clear />
 					</a-form-item>
 				</a-col>
-				<!-- <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-					<a-form-item label="上级区域:" name="parentId">
-						<a-tree-select
-							v-model:value="formData.parentId"
-							v-model:treeExpandedKeys="defaultExpandedKeys"
-							class="xn-wd"
-							:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
-							placeholder="请选择区域"
-							allow-clear
-							:tree-data="treeData"
-							:field-names="{
-								children: 'children',
-								label: 'name',
-								value: 'id'
-							}"
-							selectable="false"
-							treeLine
-						/>
-					</a-form-item>
-				</a-col> -->
 
 				<a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
 					<a-form-item label="监控对象" name="monitorTargetId">
@@ -138,25 +118,21 @@
 	const sensorOptions = tool.dictList('SENSORTYPE') // 传感器类型
 	const monitorTargetOptions = ref([]) // 监控对象
 	const memListOptions = ref([]) // 监控设备数据
-
 	const sensorRouteMax = ref(1) //传感器最大值默认1
 
 	// 默认要校验的
 	const formRules = {
 		name: [required('请输入区域名称')],
-		// parentId: [required('请选择上级区域')],
 		monitorTargetId: [required('请选择监控对象')],
 		monitorDeviceId: [required('请选择监控设备')],
+		sensorType: [required('请选择传感器类型')],
 		sensorRoute: [required('请输入传感器路数')],
 		limitUp: [required('请选择报警上限')],
 		limitDown: [required('请选择报警下限')]
 	}
-	// 默认展开的节点(顶级)
-	const defaultExpandedKeys = ref([0])
-	// 定义树元素
-	const treeData = ref([])
+
 	// 打开抽屉
-	const onOpen = (record, parentId) => {
+	const onOpen = (record) => {
 		loadData()
 		visible.value = true
 		if (record) {
@@ -197,7 +173,6 @@
 	const monitorDeviceIdChange = (value) => {
 		if (value) {
 			const data = memListOptions.value.find((item) => item.value === value)
-			// console.log(data, '1')
 			formData.value.sensorCode = data.deviceCode //设备编号
 			formData.value.modelName = data.modelName //监控设备型号
 			formData.value.deviceCode = data.deviceCode //冷链编号

+ 4 - 11
snowy-admin-web/src/views/motoring/location/index.vue

@@ -42,9 +42,6 @@
 				</div>
 			</template>
 			<template #bodyCell="{ column, record }">
-				<template v-if="column.dataIndex === 'modelName'">
-					{{ $TOOL.dictTypeData('COIDCHAIN', record.modelName) }}
-				</template>
 				<template v-if="column.dataIndex === 'action'">
 					<a-button type="link" size="small" @click="formRef.onOpen(record)">编辑</a-button>
 					<a-popconfirm title="确定要删除吗?" @confirm="deleteData(record)">
@@ -58,7 +55,6 @@
 </template>
 
 <script setup>
-	import tool from '@/utils/tool'
 	import locationApi from '@/api/basicset/locationApi.js'
 	import Form from './form.vue'
 	const formRef = ref()
@@ -82,7 +78,7 @@
 		},
 		{
 			title: '监控设备',
-			dataIndex: 'modelName',
+			dataIndex: 'deviceName',
 			align: 'center',
 			ellipsis: true
 		},
@@ -125,12 +121,9 @@
 		}
 	]
 
-	const loadData = () => {
-		return locationApi.locationPage(Object.assign(searchFormState.value)).then((res) => {
-			if (res) {
-				return res
-			}
-			return []
+	const loadData = (parameter) => {
+		return locationApi.locationPage(Object.assign(parameter, searchFormState.value)).then((res) => {
+			return res
 		})
 	}
 	// 重置