瀏覽代碼

采集器管理新增编辑表单

like 6 月之前
父節點
當前提交
9017515285

+ 0 - 315
snowy-admin-web/src/views/basicset/mem/collector.vue

@@ -1,315 +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-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
-									<a-form-item label="所属中继" name="sszj">
-										<a-select v-model:value="searchFormState.sszj" placeholder="请选择所属中继">
-											<a-select-option value="1">虚拟中继</a-select-option>
-										</a-select>
-									</a-form-item></a-col
-								>
-								<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
-									<a-form-item label="运行状态" name="yxzt">
-										<a-select v-model:value="searchFormState.yxzt" 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-option value="4">闲置维修</a-select-option>
-										</a-select>
-									</a-form-item></a-col
-								>
-								<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-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
-									<a-form-item label="型号" name="xh">
-										<a-select v-model:value="searchFormState.xh" 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-option value="4">wifi采集</a-select-option>
-										</a-select>
-									</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">显示新设备</a-button>
-					</div>
-
-					<div class="btn-right">
-						<a-button>
-							<template #icon><download-outlined /></template>导出
-						</a-button>
-					</div>
-				</div>
-			</template>
-			<template #bodyCell="{ column, record }">
-				<template v-if="column.dataIndex === 'state'">
-					<span>
-						<a-tag :color="record.state == '1' ? '#87d068' : record.state == '2' ? '#cd201f' : '#50cd7c'">
-							{{ record.stateValue }}
-						</a-tag>
-					</span>
-				</template>
-				<template v-if="column.dataIndex === 'action'">
-					<a-button type="link" size="small">编辑</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 }">
-				<a-tabs v-model:activeKey="record.activeKey" size="small" type="card">
-					<a-tab-pane key="1" tab="基本信息">
-						<div class="list">
-							<a-descriptions bordered size="small">
-								<a-descriptions-item label="采集器名称" :span="2">{{ '90160206' }}</a-descriptions-item>
-								<a-descriptions-item label="采集器编码" :span="2">{{ '90160206' }}</a-descriptions-item>
-								<a-descriptions-item label="采集器设备状态" :span="2">{{ '正常' }}</a-descriptions-item>
-								<a-descriptions-item label="创建时间" :span="2">{{ '2024-10-09 09:36:21' }}</a-descriptions-item>
-							</a-descriptions>
-						</div>
-					</a-tab-pane>
-					<a-tab-pane key="2" tab="1路">
-						<div class="list">
-							<a-descriptions bordered size="small">
-								<a-descriptions-item label="传感器类型" :span="2">{{ '温度' }}</a-descriptions-item>
-								<a-descriptions-item label="传感器路数" :span="2">{{ '1' }}</a-descriptions-item>
-							</a-descriptions>
-						</div>
-					</a-tab-pane>
-				</a-tabs>
-			</template>
-		</s-table>
-	</div>
-</template>
-
-<script setup>
-	import tool from '@/utils/tool'
-	import jobApi from '@/api/dev/jobApi'
-	const searchFormRef = ref()
-	const searchFormState = ref({})
-	const tableRef = ref()
-	const value1 = ref('1')
-	const columns = [
-		{
-			title: '所属部门',
-			dataIndex: 'ssbm',
-			align: 'center',
-			ellipsis: true,
-
-			width: 200
-		},
-		{
-			title: '采集器编号',
-			dataIndex: 'code',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '采集器名称',
-			dataIndex: 'name',
-			align: 'center',
-			ellipsis: true,
-
-			width: 200
-		},
-		{
-			title: '型号',
-			dataIndex: 'xh',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '最后心跳时间',
-			dataIndex: 'date',
-			align: 'center',
-			ellipsis: true,
-
-			width: 200
-		},
-		{
-			title: '设备状态',
-			dataIndex: 'state',
-			align: 'center',
-			ellipsis: true
-		},
-
-		{
-			title: '传感器路数',
-			dataIndex: 'bjsxx',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '对应监控对象',
-			dataIndex: 'dyjkdx',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '监控对象位置',
-			dataIndex: 'jkdxwz',
-			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: [
-					{
-						ssbm: '广州海关技术中心',
-						code: 'Y6578945621',
-						name: 'ABSL-3超低温冰箱123456',
-						xh: '三代GPRS采集-VH',
-						date: '2024-09-28 07:03:24',
-						state: '1',
-						stateValue: '正常',
-						bjsxx: '1',
-						dyjkdx: 'BSL-3超低温冰箱',
-						jkdxwz: 'ABCLSY冰箱三层'
-					},
-					{
-						ssbm: '广州海关技术中心',
-						code: 'Y6578945622',
-						name: 'ABSL-3超低温冰箱123456',
-						xh: '三代GPRS采集-VH',
-						date: '2024-11-05 07:12:42',
-						state: '1',
-						stateValue: '正常',
-						bjsxx: '1',
-						dyjkdx: 'BSL-3超低温冰箱',
-						jkdxwz: 'ABCLSY冰箱三层'
-					},
-					{
-						ssbm: '广州海关技术中心',
-						code: 'Y6578945623',
-						name: 'ABSL-3超低温冰箱123456',
-						xh: '三代GPRS采集-VH',
-						date: '2024-11-05 09:22:45',
-						state: '1',
-						stateValue: '正常',
-						bjsxx: '1',
-						dyjkdx: 'BSL-3超低温冰箱',
-						jkdxwz: 'ABCLSY冰箱三层'
-					},
-					{
-						ssbm: '广州海关技术中心',
-						code: 'Y6578945624',
-						name: 'ABSL-3超低温冰箱123456',
-						xh: '三代GPRS采集-VH',
-						date: '2024-11-05 09:27:55',
-						state: '1',
-						stateValue: '正常',
-						bjsxx: '1',
-						dyjkdx: 'BSL-3超低温冰箱',
-						jkdxwz: 'ABCLSY冰箱三层'
-					},
-					{
-						ssbm: '广州海关技术中心',
-						code: 'Y6578945625',
-						name: 'ABSL-3超低温冰箱123456',
-						xh: '三代GPRS采集-VH',
-						date: '2024-11-05 10:16:11',
-						state: '2',
-						stateValue: '异常',
-						bjsxx: '1',
-						dyjkdx: 'BSL-3超低温冰箱',
-						jkdxwz: 'ABCLSY冰箱三层'
-					},
-					{
-						ssbm: '广州海关技术中心',
-						code: 'Y6578945626',
-						name: 'ABSL-3超低温冰箱123456',
-						xh: '三代GPRS采集-VH',
-						date: '2024-11-05 14:57:31',
-						state: '2',
-						stateValue: '异常',
-						bjsxx: '1',
-						dyjkdx: 'BSL-3超低温冰箱',
-						jkdxwz: 'ABCLSY冰箱三层'
-					}
-				],
-				size: 10,
-				total: 6
-			}
-			return obj
-		})
-	}
-	// 重置
-	const reset = () => {
-		searchFormRef.value.resetFields()
-		tableRef.value.refresh(true)
-	}
-	// 删除
-	const deleteData = (record) => {
-		console.log(record, '删除')
-	}
-</script>
-
-<style lang="less" scoped>
-	.table_item {
-		padding: 15px 20px;
-
-		:deep(.ant-table-pagination-right) {
-			justify-content: center !important;
-		}
-	}
-	.list {
-		width: 60%;
-		padding: 10px 20px;
-		border-radius: 10px;
-		background-color: #ffffff;
-
-		:deep(.ant-descriptions) {
-			margin-bottom: 10px;
-		}
-		:deep(.ant-descriptions-header) {
-			margin: 0;
-			padding: 10px;
-			border: 1px solid #f0f0f0;
-			border-bottom: none;
-		}
-	}
-</style>

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

@@ -0,0 +1,445 @@
+<template>
+	<xn-form-container
+		:title="formData.id ? '编辑采集器' : '新增采集器'"
+		:width="'60%'"
+		: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-tabs v-model:activeKey="activeKey" type="editable-card" @edit="onEdit">
+				<a-tab-pane tab="对象信息" key="object" :closable="false">
+					<a-row :gutter="10">
+						<a-col :xs="24" :sm="24" :md="12" :lg="8" :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="8" :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="8" :xl="12">
+							<a-form-item label="采集器条码" name="barcode">
+								<a-input v-model:value="formData.barcode" placeholder="请输入采集器条码" allow-clear />
+							</a-form-item>
+						</a-col>
+						<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="12">
+							<a-form-item label="品牌" name="brand">
+								<a-input v-model:value="formData.brand" placeholder="请输入品牌" allow-clear />
+							</a-form-item>
+						</a-col>
+
+						<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="12">
+							<a-form-item label="状态" name="state">
+								<a-select ref="select" v-model:value="formData.state">
+									<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-option value="4">报废</a-select-option>
+								</a-select>
+							</a-form-item>
+						</a-col>
+						<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="12">
+							<a-form-item label="所属部门">
+								<a-input v-model:value="formData.division" placeholder="请输入所属部门" allow-clear />
+							</a-form-item>
+						</a-col>
+						<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="12">
+							<a-form-item label="采集时间">
+								<a-time-range-picker v-model:value="formData.collectionTime" style="width: 100%" />
+							</a-form-item>
+						</a-col>
+						<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+							<a-form-item label="位置">
+								<a-input v-model:value="formData.location" placeholder="请输入位置" allow-clear />
+							</a-form-item>
+						</a-col>
+						<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+							<a-form-item label="备注">
+								<a-textarea
+									v-model:value="formData.remarks"
+									placeholder="请输入备注"
+									allow-clear
+									:maxlength="200"
+									:rows="4"
+								/>
+							</a-form-item>
+						</a-col>
+					</a-row>
+				</a-tab-pane>
+				<a-tab-pane tab="报警信息" key="report" :closable="false">
+					<a-form-item :label-col="{ style: { width: '200px' } }">
+						<template #label>
+							<a-tooltip>
+								<template #title>
+									重复通知间隔:同一设备同一故障类型出现报警进行过一次报警通知后,进行下一次报普通知的间隔时间,如果在这个时间间隔内该设备同一故障类型
+									还在产生报警则不再进行通知。
+									最多报警次数:同一设备同一故障类型连续报警最多报警通知次数,在达到最多报警次数后如果报警还未及时处理,系统也不再进行报警通知。
+									延时时间:为屏蔽误报,系统报警在达到延时时间之后才进行报警通知。
+								</template>
+								<question-circle-outlined />
+							</a-tooltip>
+							重复发送通知:
+						</template>
+
+						<a-radio-group v-model:value="formData.repeat">
+							<a-radio value="1">1次</a-radio>
+							<a-radio value="2">多次</a-radio>
+						</a-radio-group>
+					</a-form-item>
+					<a-form-item label="延时报警" :label-col="{ style: { width: '200px' } }">
+						<a-radio-group v-model:value="formData.delayed">
+							<a-radio value="1">是</a-radio>
+							<a-radio value="0">否</a-radio>
+						</a-radio-group>
+					</a-form-item>
+					<a-form-item label="报警关闭发送通知" :label-col="{ style: { width: '200px' } }">
+						<a-radio-group v-model:value="formData.close">
+							<a-radio value="1">是</a-radio>
+							<a-radio value="0">否</a-radio>
+						</a-radio-group>
+					</a-form-item>
+					<a-form-item label="多级报警" :label-col="{ style: { width: '200px' } }">
+						<a-radio-group v-model:value="formData.multistage">
+							<a-radio value="1">是</a-radio>
+							<a-radio value="0">否</a-radio>
+						</a-radio-group>
+					</a-form-item>
+
+					<a-form-item label="报警通知方式" :label-col="{ style: { width: '200px' } }">
+						<a-checkbox-group v-model:value="formData.noticeway" style="width: 100%">
+							<a-checkbox value="1">短信</a-checkbox>
+							<a-checkbox value="2">电话</a-checkbox>
+							<a-checkbox value="3">微信</a-checkbox>
+							<a-checkbox value="4">电子邮件</a-checkbox>
+							<a-checkbox value="5">弹出</a-checkbox>
+							<a-checkbox value="6">音乐</a-checkbox>
+						</a-checkbox-group>
+					</a-form-item>
+
+					<!-- 表格区域 -->
+					<div>
+						<a-button type="primary" style="margin-left: 90%; margin-bottom: 5px" @click="tableAdd">
+							<template #icon><plus-outlined /></template>新增
+						</a-button>
+						<a-table
+							ref="tableRef"
+							bordered
+							:columns="columns"
+							:data-source="formData.loadData"
+							:row-key="(record) => record.startTime"
+						>
+							<template #bodyCell="{ column, record, index }">
+								<!-- 表格内容 -->
+								<template v-if="column.dataIndex === 'startTime'">
+									<a-date-picker
+										v-model:value="record.startTime"
+										show-time
+										format="YYYY-MM-DD HH:mm:ss"
+										value-format="YYYY-MM-DD HH:mm:ss"
+										style="width: 100%"
+									/>
+								</template>
+
+								<template v-if="column.dataIndex === 'endTime'">
+									<a-date-picker
+										v-model:value="record.endTime"
+										show-time
+										format="YYYY-MM-DD HH:mm:ss"
+										value-format="YYYY-MM-DD HH:mm:ss"
+										style="width: 100%"
+									/>
+								</template>
+
+								<template v-if="column.dataIndex === 'name'">
+									<a-input v-model:value="record.name" placeholder="请输入姓名" />
+								</template>
+
+								<template v-if="column.dataIndex === 'remindType'">
+									<a-select v-model:value="record.remindType" placeholder="请选择提醒方式" style="width: 100%">
+										<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-option value="4">邮件报警</a-select-option>
+										<a-select-option value="5">弹出报警</a-select-option>
+										<a-select-option value="6">音乐报警</a-select-option>
+									</a-select>
+								</template>
+
+								<template v-if="column.dataIndex === 'level'">
+									<a-select v-model:value="record.level" placeholder="请选择提醒方式" style="width: 100px">
+										<a-select-option value="1">1</a-select-option>
+										<a-select-option value="2">2</a-select-option>
+										<a-select-option value="3">3</a-select-option>
+										<a-select-option value="4">4</a-select-option>
+										<a-select-option value="5">5</a-select-option>
+									</a-select>
+								</template>
+
+								<template v-if="column.dataIndex === 'phone'">
+									<a-input v-model:value="record.phone" placeholder="请输入电话号码" />
+								</template>
+
+								<template v-if="column.dataIndex === 'action'">
+									<a-popconfirm title="确定要删除吗?" @confirm="tableDelete(record, index)">
+										<a-button type="link" danger size="small">删除</a-button>
+									</a-popconfirm>
+								</template>
+							</template>
+						</a-table>
+					</div>
+				</a-tab-pane>
+
+				<a-tab-pane v-for="pane in panes" :key="pane.key" :tab="pane.title" :closable="pane.closable">
+					<!-- 新增路数-->
+					<div v-for="(item, index) in formData.list" :key="index">
+						<a-row :gutter="10" v-if="activeKey == item.key">
+							<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="12">
+								<a-form-item label="传感器路数">
+									<a-input v-model:value="item.number" placeholder="请输入传感器路数" allow-clear />
+								</a-form-item>
+							</a-col>
+
+							<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="12">
+								<a-form-item label="传感器类型">
+									<a-select ref="select" v-model:value="item.sensorType" 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="24" :lg="24" :xl="24">
+								<a-form-item label="备注">
+									<a-textarea
+										v-model:value="item.numberRemarks"
+										placeholder="请输入备注"
+										allow-clear
+										:maxlength="200"
+										:rows="4"
+									/>
+								</a-form-item>
+							</a-col>
+						</a-row>
+					</div>
+				</a-tab-pane>
+			</a-tabs>
+		</a-form>
+
+		<template #footer>
+			<a-button class="xn-mr8" @click="onClose">退出</a-button>
+			<a-button type="primary" @click="onSubmit">保存</a-button>
+		</template>
+		<Icon-selector ref="iconSelectorRef" @iconCallBack="iconCallBack" />
+	</xn-form-container>
+</template>
+
+<script setup>
+	import jobApi from '@/api/dev/jobApi'
+	import { required } from '@/utils/formRules'
+	import moduleApi from '@/api/sys/resource/moduleApi'
+
+	import IconSelector from '@/components/Selector/iconSelector.vue'
+	// 默认是关闭状态
+	const visible = ref(false)
+	const emit = defineEmits({ successful: null })
+	const formRef = ref()
+	const iconSelectorRef = ref()
+
+	const tableRef = ref()
+
+	const columns = [
+		{
+			title: '开始时间',
+			dataIndex: 'startTime',
+			rules: [{ required: true, message: '请选择开始时间' }]
+		},
+		{
+			title: '结束时间',
+			dataIndex: 'endTime',
+			rules: [{ required: true, message: '请选择结束时间' }]
+		},
+		{
+			title: '姓名',
+			dataIndex: 'name',
+			rules: [{ required: true, message: '请输入姓名' }]
+		},
+		{
+			title: '提醒方式',
+			dataIndex: 'remindType',
+			rules: [{ required: true, message: '请选择提醒方式' }]
+		},
+		{
+			title: '级别',
+			dataIndex: 'level',
+			rules: [{ required: true, message: '请选择级别' }]
+		},
+		{
+			title: '电话号码',
+			dataIndex: 'phone',
+			rules: [
+				{ required: true, message: '请输入电话号码' },
+				{ pattern: /^[0-9]{11}$/, message: '请输入有效的电话号码' }
+			]
+		},
+		{
+			title: '操作',
+			dataIndex: 'action',
+			scopedSlots: { customRender: 'action' }
+		}
+	]
+	// 表单数据
+	const formData = ref({
+		repeat: '1',
+		delayed: '0',
+		close: '1',
+		multistage: '0',
+		noticeway: ['1'],
+		loadData: [],
+		list: []
+	})
+
+	// 打开抽屉
+	const onOpen = (record) => {
+		visible.value = true
+		activeKey.value = 'object'
+		panes.value = []
+		newTabIndex.value = 1
+		if (record) {
+			formData.value = Object.assign({}, record)
+		} else {
+			formData.value = {
+				repeat: '1',
+				delayed: '0',
+				close: '1',
+				multistage: '0',
+				noticeway: ['1'],
+				loadData: [],
+				list: []
+			}
+		}
+	}
+	// 关闭抽屉
+	const onClose = () => {
+		formRef.value.resetFields()
+		visible.value = false
+	}
+
+	// 默认要校验的
+	const formRules = {
+		name: [required('请输入采集器名称')],
+		code: [required('请输入采集器编号')]
+	}
+
+	// 表格添加一行空数据
+	const tableAdd = () => {
+		const newRow = {
+			startTime: null,
+			endTime: null,
+			name: '',
+			level: '',
+			phone: ''
+		}
+		formData.value.loadData.push(newRow)
+	}
+
+	// 删除某一行
+	const tableDelete = (record, index) => {
+		formData.value.loadData.splice(index, 1)
+	}
+
+	// 验证并提交数据
+	const onSubmit = async () => {
+		try {
+			// 校验主表单数据
+			await formRef.value.validate()
+			console.log('主表单数据验证通过')
+
+			// 校验表格行数据
+			for (const [index, row] of formData.value.loadData.entries()) {
+				const rowForm = tableRef.value.$el.querySelectorAll('.ant-form')[index]
+				console.log(rowForm, 'rowForm')
+
+				// const formInstance = rowForm.__vue__
+				// await formInstance.validate() // 校验单行表单
+			}
+
+			console.log('表单数据验证通过,开始提交...')
+		} catch (error) {
+			console.log('表单验证失败', error)
+		}
+	}
+
+	// 新增或删除路数
+	const onEdit = (targetKey, action) => {
+		if (action === 'add') {
+			add()
+		} else {
+			remove(targetKey)
+		}
+	}
+	const activeKey = ref('object') //选中的tabs
+	const panes = ref([]) //tabs数组
+	const newTabIndex = ref(1)
+	// 添加tabs
+	const add = () => {
+		const newIndex = newTabIndex.value++
+		if (panes.value.length >= 5) return //最多只能5路
+		panes.value.push({
+			title: `${newIndex}路`,
+			key: newIndex
+		})
+
+		formData.value.list.push({
+			title: `${newIndex}路`,
+			key: newIndex
+		})
+	}
+
+	// 删除tabs
+	const remove = (targetKey) => {
+		let lastIndex = 0
+		panes.value.forEach((pane, i) => {
+			if (pane.key === targetKey) {
+				lastIndex = i - 1
+			}
+		})
+		panes.value = panes.value.filter((pane) => pane.key !== targetKey)
+		if (panes.value.length && activeKey.value === targetKey) {
+			if (lastIndex >= 0) {
+				activeKey.value = panes.value[lastIndex].key
+			} else {
+				activeKey.value = panes.value[0].key
+			}
+		}
+
+		if (panes.value.length == 0) {
+			activeKey.value = 'object'
+		}
+
+		formData.value.list = formData.value.list.filter((item) => item.key !== targetKey) //删除表单
+	}
+
+	// 调用这个函数将子组件的一些数据和方法暴露出去
+	defineExpose({
+		onOpen
+	})
+</script>
+
+<style lang="less" scoped>
+	.ant-tabs {
+		width: 100%;
+	}
+	:deep(.ant-col) {
+		margin-bottom: 10px;
+	}
+</style>

+ 310 - 51
snowy-admin-web/src/views/basicset/mem/index.vue

@@ -1,68 +1,327 @@
 <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.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-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
+									<a-form-item label="所属中继" name="sszj">
+										<a-select v-model:value="searchFormState.sszj" placeholder="请选择所属中继">
+											<a-select-option value="1">虚拟中继</a-select-option>
+										</a-select>
+									</a-form-item></a-col
+								>
+								<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
+									<a-form-item label="运行状态" name="yxzt">
+										<a-select v-model:value="searchFormState.yxzt" 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-option value="4">闲置维修</a-select-option>
+										</a-select>
+									</a-form-item></a-col
+								>
+								<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-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
+									<a-form-item label="型号" name="xh">
+										<a-select v-model:value="searchFormState.xh" 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-option value="4">wifi采集</a-select-option>
+										</a-select>
+									</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">
-			<Collector ref="collectorRef" v-if="activeKey == '1'" />
-			<Repeater ref="repeaterRef" 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 class="btn-right">
+						<a-button>
+							<template #icon><download-outlined /></template>导出
+						</a-button>
+					</div>
+				</div>
+			</template>
+			<template #bodyCell="{ column, record }">
+				<template v-if="column.dataIndex === 'state'">
+					<span>
+						<a-tag :color="record.state == '1' ? '#87d068' : record.state == '2' ? '#cd201f' : '#50cd7c'">
+							{{ record.stateValue }}
+						</a-tag>
+					</span>
+				</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)">
+						<a-button type="link" danger size="small">删除</a-button>
+					</a-popconfirm>
+					<a-button type="link" size="small">记录</a-button>
+				</template>
+			</template>
+			<template #expandedRowRender="{ record }">
+				<a-tabs v-model:activeKey="record.activeKey" size="small" type="card">
+					<a-tab-pane key="1" tab="基本信息">
+						<div class="list">
+							<a-descriptions bordered size="small">
+								<a-descriptions-item label="采集器名称" :span="2">{{ '90160206' }}</a-descriptions-item>
+								<a-descriptions-item label="采集器编码" :span="2">{{ '90160206' }}</a-descriptions-item>
+								<a-descriptions-item label="采集器设备状态" :span="2">{{ '正常' }}</a-descriptions-item>
+								<a-descriptions-item label="创建时间" :span="2">{{ '2024-10-09 09:36:21' }}</a-descriptions-item>
+							</a-descriptions>
+						</div>
+					</a-tab-pane>
+					<a-tab-pane key="2" tab="1路">
+						<div class="list">
+							<a-descriptions bordered size="small">
+								<a-descriptions-item label="传感器类型" :span="2">{{ '温度' }}</a-descriptions-item>
+								<a-descriptions-item label="传感器路数" :span="2">{{ '1' }}</a-descriptions-item>
+							</a-descriptions>
+						</div>
+					</a-tab-pane>
+				</a-tabs>
+			</template>
+		</s-table>
+
+		<Form ref="formRef" @successful="tableRef.refresh(true)" />
 	</div>
 </template>
+
 <script setup>
-	import Collector from './collector.vue'
-	import Repeater from './repeater.vue'
+	import tool from '@/utils/tool'
+	import jobApi from '@/api/dev/jobApi'
+	import Form from './form.vue'
+	const formRef = ref()
+	const searchFormRef = ref()
+	const searchFormState = ref({})
+	const tableRef = ref()
 
-	const activeKey = ref('1')
-	const collectorRef = ref(null)
-	const repeaterRef = ref(null)
+	const columns = [
+		{
+			title: '所属部门',
+			dataIndex: 'ssbm',
+			align: 'center',
+			ellipsis: true,
 
-	onMounted(() => {})
+			width: 200
+		},
+		{
+			title: '采集器编号',
+			dataIndex: 'code',
+			align: 'center',
+			ellipsis: true
+		},
+		{
+			title: '采集器名称',
+			dataIndex: 'name',
+			align: 'center',
+			ellipsis: true,
 
-	onBeforeMount(() => {})
+			width: 200
+		},
+		{
+			title: '型号',
+			dataIndex: 'xh',
+			align: 'center',
+			ellipsis: true
+		},
+		{
+			title: '最后心跳时间',
+			dataIndex: 'date',
+			align: 'center',
+			ellipsis: true,
 
-	// 点击标签
-	const activeclick = (v) => {
-		activeKey.value = v
-	}
-</script>
-<style lang="less" scoped>
-	.query-box {
-		width: 100%;
+			width: 200
+		},
+		{
+			title: '设备状态',
+			dataIndex: 'state',
+			align: 'center',
+			ellipsis: true
+		},
 
-		background-color: #fff;
+		{
+			title: '传感器路数',
+			dataIndex: 'bjsxx',
+			align: 'center',
+			ellipsis: true
+		},
+		{
+			title: '对应监控对象',
+			dataIndex: 'dyjkdx',
+			align: 'center',
+			ellipsis: true
+		},
+		{
+			title: '监控对象位置',
+			dataIndex: 'jkdxwz',
+			align: 'center',
+			ellipsis: true
+		},
 
-		// 顶部
-		.query-head {
-			width: 100%;
-			height: 50px;
-			display: flex;
-			justify-content: space-between;
-			padding: 15px;
-			border-bottom: 1px solid #e7e7e7;
+		{
+			title: '操作',
+			dataIndex: 'action',
+			align: 'center',
+			width: 150
+		}
+	]
 
-			.query-tbas {
-				width: 95%;
-				display: flex;
+	const loadData = (parameter) => {
+		return jobApi.jobPage(Object.assign(parameter, searchFormState.value)).then((res) => {
+			// return res
+			const obj = {
+				current: 1,
+				pages: 1,
+				records: [
+					{
+						id: '11111',
+						ssbm: '广州海关技术中心',
+						code: 'Y6578945621',
+						name: 'ABSL-3超低温冰箱123456',
+						xh: '三代GPRS采集-VH',
+						date: '2024-09-28 07:03:24',
+						state: '1',
+						stateValue: '正常',
+						bjsxx: '1',
+						dyjkdx: 'BSL-3超低温冰箱',
+						jkdxwz: 'ABCLSY冰箱三层'
+					},
+					{
+						id: '22222',
+						ssbm: '广州海关技术中心',
+						code: 'Y6578945622',
+						name: 'ABSL-3超低温冰箱123456',
+						xh: '三代GPRS采集-VH',
+						date: '2024-11-05 07:12:42',
+						state: '1',
+						stateValue: '正常',
+						bjsxx: '1',
+						dyjkdx: 'BSL-3超低温冰箱',
+						jkdxwz: 'ABCLSY冰箱三层'
+					},
+					{
+						id: '33333',
+						ssbm: '广州海关技术中心',
+						code: 'Y6578945623',
+						name: 'ABSL-3超低温冰箱123456',
+						xh: '三代GPRS采集-VH',
+						date: '2024-11-05 09:22:45',
+						state: '1',
+						stateValue: '正常',
+						bjsxx: '1',
+						dyjkdx: 'BSL-3超低温冰箱',
+						jkdxwz: 'ABCLSY冰箱三层'
+					},
+					{
+						id: '44444',
+						ssbm: '广州海关技术中心',
+						code: 'Y6578945624',
+						name: 'ABSL-3超低温冰箱123456',
+						xh: '三代GPRS采集-VH',
+						date: '2024-11-05 09:27:55',
+						state: '1',
+						stateValue: '正常',
+						bjsxx: '1',
+						dyjkdx: 'BSL-3超低温冰箱',
+						jkdxwz: 'ABCLSY冰箱三层'
+					},
+					{
+						id: '55555',
+						ssbm: '广州海关技术中心',
+						code: 'Y6578945625',
+						name: 'ABSL-3超低温冰箱123456',
+						xh: '三代GPRS采集-VH',
+						date: '2024-11-05 10:16:11',
+						state: '2',
+						stateValue: '异常',
+						bjsxx: '1',
+						dyjkdx: 'BSL-3超低温冰箱',
+						jkdxwz: 'ABCLSY冰箱三层'
+					},
+					{
+						id: '66666',
+						ssbm: '广州海关技术中心',
+						code: 'Y6578945626',
+						name: 'ABSL-3超低温冰箱123456',
+						xh: '三代GPRS采集-VH',
+						date: '2024-11-05 14:57:31',
+						state: '2',
+						stateValue: '异常',
+						bjsxx: '1',
+						dyjkdx: 'BSL-3超低温冰箱',
+						jkdxwz: 'ABCLSY冰箱三层'
+					}
+				],
+				size: 10,
+				total: 6
+			}
+			return obj
+		})
+	}
+	// 重置
+	const reset = () => {
+		searchFormRef.value.resetFields()
+		tableRef.value.refresh(true)
+	}
+	// 删除
+	const deleteData = (record) => {
+		console.log(record, '删除')
+	}
+</script>
 
-				.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 - 277
snowy-admin-web/src/views/basicset/mem/repeater.vue

@@ -1,277 +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-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
-									<a-form-item label="报警状态" name="bjzt">
-										<a-select v-model:value="searchFormState.yxzt" 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-option value="4">闲置维修</a-select-option>
-										</a-select>
-									</a-form-item></a-col
-								>
-								<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-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
-									<a-form-item label="型号" name="xh">
-										<a-select v-model:value="searchFormState.xh" 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-option value="4">wifi采集</a-select-option>
-										</a-select>
-									</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">显示新设备</a-button>
-					</div>
-					<div class="btn-right">
-						<a-button>
-							<template #icon><download-outlined /></template>导出
-						</a-button>
-					</div>
-				</div>
-			</template>
-			<template #bodyCell="{ column, record }">
-				<template v-if="column.dataIndex === 'state'">
-					<span>
-						<a-tag :color="record.state == '1' ? '#87d068' : record.state == '2' ? '#cd201f' : '#50cd7c'">
-							{{ record.stateValue }}
-						</a-tag>
-					</span>
-				</template>
-				<template v-if="column.dataIndex === 'action'">
-					<a-button type="link" size="small">编辑</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>
-		</s-table>
-	</div>
-</template>
-
-<script setup>
-	import tool from '@/utils/tool'
-	import jobApi from '@/api/dev/jobApi'
-	const searchFormRef = ref()
-	const searchFormState = ref({})
-	const tableRef = ref()
-	const value1 = ref('1')
-	const columns = [
-		{
-			title: '所属部门',
-			dataIndex: 'ssbm',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '485编号',
-			dataIndex: 'code1',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '中继编号',
-			dataIndex: 'code',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '中继名称',
-			dataIndex: 'name',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '型号',
-			dataIndex: 'xh',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '中继IP',
-			dataIndex: 'ip',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '最后心跳时间',
-			dataIndex: 'zhxtsj',
-			align: 'center',
-			ellipsis: true
-		},
-		{
-			title: '设备状态',
-			dataIndex: 'state',
-			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: [
-					{
-						ssbm: '广州海关技术中心',
-						code1: '123456',
-						code: 'Y6578945621',
-						name: 'ABSL-3超低温冰箱123456',
-						xh: '三代GPRS采集-VH',
-						ip: '126.145.01.14',
-						zhxtsj: '2024-09-28 07:03:24',
-						state: '1',
-						stateValue: '正常',
-
-						children: [
-							{
-								ssbm: '广州海关技术中心',
-								code1: '123456',
-								code: 'Y-01-6578945621',
-								name: 'ABSL-3超低温冰箱123456',
-								xh: '三代GPRS采集-VH',
-								ip: '126.145.01.14',
-								zhxtsj: '2024-09-28 07:03:24',
-								state: '2',
-								stateValue: '异常'
-							}
-						]
-					},
-					{
-						ssbm: '广州海关技术中心',
-						code1: '123456',
-						code: 'Y6578945622',
-						name: 'ABSL-3超低温冰箱123456',
-						xh: '三代GPRS采集-VH',
-						ip: '126.145.01.14',
-						zhxtsj: '2024-11-05 07:12:42',
-						state: '1',
-						stateValue: '正常',
-						children: [
-							{
-								ssbm: '广州海关技术中心',
-								code1: '123456',
-								code: 'Y-01-6578945622',
-								name: 'ABSL-3超低温冰箱123456',
-								xh: '三代GPRS采集-VH',
-								ip: '126.145.01.14',
-								zhxtsj: '2024-09-28 07:03:24',
-								state: '2',
-								stateValue: '异常'
-							}
-						]
-					},
-					{
-						ssbm: '广州海关技术中心',
-						code1: '123456',
-						code: 'Y6578945623',
-						name: 'ABSL-3超低温冰箱123456',
-						xh: '三代GPRS采集-VH',
-						ip: '126.145.01.14',
-						zhxtsj: '2024-11-05 09:22:45',
-						state: '1',
-						stateValue: '正常'
-					},
-					{
-						ssbm: '广州海关技术中心',
-						code1: '123456',
-						code: 'Y6578945624',
-						name: 'ABSL-3超低温冰箱123456',
-						xh: '三代GPRS采集-VH',
-						ip: '126.145.01.14',
-						zhxtsj: '2024-11-05 09:27:55',
-						state: '1',
-						stateValue: '正常'
-					},
-					{
-						ssbm: '广州海关技术中心',
-						code1: '123456',
-						code: 'Y6578945625',
-						name: 'ABSL-3超低温冰箱123456',
-						xh: '三代GPRS采集-VH',
-						ip: '126.145.01.14',
-						zhxtsj: '2024-11-05 10:16:11',
-						state: '2',
-						stateValue: '异常'
-					},
-					{
-						ssbm: '广州海关技术中心',
-						code1: '123456',
-						code: 'Y6578945626',
-						name: 'ABSL-3超低温冰箱123456',
-						xh: '三代GPRS采集-VH',
-						ip: '126.145.01.14',
-						zhxtsj: '2024-11-05 14:57:31',
-						state: '2',
-						stateValue: '异常'
-					}
-				],
-				size: 10,
-				total: 6
-			}
-			return obj
-		})
-	}
-	// 重置
-	const reset = () => {
-		searchFormRef.value.resetFields()
-		tableRef.value.refresh(true)
-	}
-	// 删除
-	const deleteData = (record) => {
-		console.log(record, '删除')
-	}
-</script>
-
-<style lang="less" scoped>
-	.table_item {
-		padding: 15px 20px;
-
-		:deep(.ant-table-pagination-right) {
-			justify-content: center !important;
-		}
-	}
-</style>

+ 1 - 0
snowy-admin-web/src/views/basicset/plan/index.vue

@@ -114,6 +114,7 @@
 <style lang="less" scoped>
 	.table_item {
 		padding: 15px 20px;
+		background-color: #ffffff;
 
 		:deep(.ant-table-pagination-right) {
 			justify-content: center !important;

+ 1 - 0
snowy-admin-web/src/views/basicset/ports/index.vue

@@ -152,6 +152,7 @@
 <style lang="less" scoped>
 	.table_item {
 		padding: 15px 20px;
+		background-color: #ffffff;
 
 		:deep(.ant-table-pagination-right) {
 			justify-content: center !important;

+ 51 - 7
snowy-admin-web/src/views/motoring/report/list.vue

@@ -1,6 +1,12 @@
 <template>
 	<div class="table_item">
-		<s-table ref="tableRef" :columns="columns" :data="loadData" :row-key="(record) => record.dxbh">
+		<s-table
+			ref="tableRef"
+			:columns="columns"
+			:data="loadData"
+			:row-key="(record) => record.dxbh"
+			:row-selection="options.rowSelection"
+		>
 			<template #operator>
 				<!-- 搜索区域 -->
 				<div class="table-search">
@@ -78,12 +84,15 @@
 				<!-- 其他操作区域 -->
 				<div class="table-head-btn">
 					<div class="btn-right">
-						<a-button class="xn-mg08">
+						<a-button class="xn-mg08" @click="handle">
 							<template #icon><logout-outlined /></template>处理
 						</a-button>
-						<a-button class="xn-mg08">
-							<template #icon><logout-outlined /></template>全部处理
-						</a-button>
+
+						<a-popconfirm title="确定全部处理吗?" @confirm="allhandle" class="xn-mg08">
+							<a-button>
+								<template #icon><logout-outlined /></template>全部处理
+							</a-button>
+						</a-popconfirm>
 						<a-button>
 							<template #icon><download-outlined /></template>导出
 						</a-button>
@@ -158,13 +167,23 @@
 </template>
 
 <script setup>
-	import tool from '@/utils/tool'
+	import { message } from 'ant-design-vue'
 	import jobApi from '@/api/dev/jobApi'
 	import Form from './form.vue'
 	const formRef = ref()
 	const searchFormRef = ref()
 	const searchFormState = ref({})
 	const tableRef = ref()
+	const selectedRowKeys = ref([]) //选中的元素
+
+	// 列表选择配置
+	const options = {
+		rowSelection: {
+			onChange: (selectedRowKey, selectedRows) => {
+				selectedRowKeys.value = selectedRowKey
+			}
+		}
+	}
 
 	const columns = [
 		{
@@ -253,7 +272,7 @@
 			ellipsis: true
 		}
 	]
-
+	const tableData = ref([]) // 用来存储表格数据
 	const loadData = (parameter) => {
 		if (searchFormState.value.searchKey) {
 			searchFormState.value.startCreateTime = searchFormState.value.searchKey[0]
@@ -343,6 +362,7 @@
 				size: 10,
 				total: 1
 			}
+			tableData.value = obj.records || [] // 将数据赋值到 tableData 中
 			return obj
 		})
 	}
@@ -351,6 +371,30 @@
 		searchFormRef.value.resetFields()
 		tableRef.value.refresh(true)
 	}
+
+	// 处理
+	const handle = () => {
+		if (selectedRowKeys.value.length < 1) {
+			message.warning('请勾选出至少一条需要处理的数据')
+		} else {
+			const params = {
+				ids: selectedRowKeys.value
+					.map((m) => {
+						return m
+					})
+					.join()
+			}
+			console.log(params, 'params')
+		}
+	}
+
+	// 全部处理
+	const allhandle = () => {
+		const params = {
+			ids: tableData.value.map((item) => item.dxbh).join()
+		}
+		console.log(params, 'params')
+	}
 </script>
 
 <style lang="less" scoped>