Bläddra i källkod

增加档案权限

yukai 1 år sedan
förälder
incheckning
f59f52f4c4

+ 19 - 26
src/views/iot/property/attribute/edit.vue

@@ -1,12 +1,5 @@
 <template>
-	<el-dialog
-		class="api-edit"
-		v-model="showDialog"
-		:title="`${formData.id ? '编辑设备档案属性' : '新增设备档案属性'}`"
-		width="800px"
-		:close-on-click-modal="false"
-		:close-on-press-escape="false"
-	>
+	<el-dialog class="api-edit" v-model="showDialog" :title="`${formData.id ? '编辑设备档案属性' : '新增设备档案属性'}`" width="800px" :close-on-click-modal="false" :close-on-press-escape="false">
 		<el-form class="inline-form" ref="formRef" :model="formData" :rules="ruleForm" label-width="120px">
 			<el-form-item label="所属产品" prop="productKey">
 				<el-select v-model="formData.productKey" placeholder="请选择产品" class="w100" disabled>
@@ -23,11 +16,11 @@
 				<el-input v-model.trim="formData.title" placeholder="请输入字段标题" />
 			</el-form-item>
 			<el-form-item label="字段类型" prop="types">
-						<el-select v-model="formData.types" placeholder="请字段类型" class="w100" clearable>
-							<el-option v-for="item in typesData" :key="item.value" :label="item.name" :value="item.value">
-						</el-option>
-						</el-select>
-					</el-form-item>
+				<el-select v-model="formData.types" placeholder="请字段类型" class="w100" clearable>
+					<el-option v-for="item in typesData" :key="item.value" :label="item.name" :value="item.value">
+					</el-option>
+				</el-select>
+			</el-form-item>
 
 			<el-form-item label="字段描述" prop="desc">
 				<el-input v-model.trim="formData.desc" placeholder="请输入字段描述" />
@@ -53,19 +46,19 @@ const emit = defineEmits(['getList'])
 
 const showDialog = ref(false)
 const formRef = ref()
-const productData=ref();
+const productData = ref();
 const typesData = ref([{
-	value:'input',
-	name:'输入框',
-},{
-	value:'textarea',
-	name:'文本框',
-},{
-	value:'date',
-	name:'日期',
-},{
-	value:'file',
-	name:'上传图片',
+	value: 'input',
+	name: '输入框',
+}, {
+	value: 'textarea',
+	name: '文本框',
+}, {
+	value: 'date',
+	name: '日期',
+}, {
+	value: 'file',
+	name: '上传图片',
 }])
 const baseForm = {
 	id: undefined,
@@ -116,7 +109,7 @@ const open = async (row: any, productInfo: any) => {
 		api.product.getLists({}).then((res: any) => {
 			productData.value = res.product
 		})
-	
+
 		formData.productKey = productInfo.key
 	})
 }

+ 88 - 78
src/views/iot/property/attribute/index.vue

@@ -15,57 +15,57 @@
 					</el-button>
 				</el-form-item>
 				<el-form-item>
-					<el-button type="success" @click="addOrEdit()" v-if="productIno">
+					<el-button type="success" @click="addOrEdit()" v-auth="'add'" v-if="productIno">
 						<el-icon>
 							<ele-FolderAdd />
 						</el-icon>
 						新增属性
 					</el-button>
 
-				
 
-					<!-- <el-button type="danger" @click="addOrEdit()">
+
+					<el-button type="danger" @click="batchdel()" v-auth="'batchdel'">
 						<el-icon>
 							<ele-FolderAdd />
 						</el-icon>
-						删除
-					</el-button> -->
+						批量删除
+					</el-button>
 				</el-form-item>
 			</el-form>
 		</div>
 		<el-row>
 			<el-col :span="6">
-				<el-tree :data="mergedData" :props="defaultProps" accordion default-expand-all	 @node-click="handleNodeClick" style="border: 1px solid #eee;padding: 10px;margin-right: 10px;">
+				<el-tree :data="mergedData" :props="defaultProps" accordion default-expand-all @node-click="handleNodeClick" style="border: 1px solid #eee;padding: 10px;margin-right: 10px;">
 					<template #default="{ node, data }">
 						<span :style="data.is_type === '2' ? { color: '#409eff' } : {}">
-							<el-icon  v-if="data.is_type == '2'"><Expand /></el-icon>
-						{{ node.label }}
+							<el-icon v-if="data.is_type == '2'">
+								<Expand />
+							</el-icon>
+							{{ node.label }}
 						</span>
 					</template>
-					</el-tree>
+				</el-tree>
 			</el-col>
-			<el-col :span="18"><el-table :data="tableData" style="width: 100%" row-key="id" v-loading="loading">
+			<el-col :span="18"><el-table :data="tableData" @selection-change="handleSelectionChange" style="width: 100%" row-key="id" v-loading="loading">
 					<el-table-column type="selection" width="55" align="center" />
 
-					<el-table-column prop="id" label="ID" min-width="100" show-overflow-tooltip></el-table-column>
-					<el-table-column prop="name" label="字段名称" show-overflow-tooltip></el-table-column>
-					<el-table-column prop="title" label="字段标题" show-overflow-tooltip></el-table-column>
-					<el-table-column prop="types" label="字段类型" show-overflow-tooltip></el-table-column>
-					
+					<el-table-column prop="id" v-col="'id'" label="ID" min-width="100" show-overflow-tooltip></el-table-column>
+					<el-table-column prop="name" v-col="'name'" label="字段名称" show-overflow-tooltip></el-table-column>
+					<el-table-column prop="title" v-col="'title'" label="字段标题" show-overflow-tooltip></el-table-column>
+					<el-table-column prop="types" v-col="'types'" label="字段类型" show-overflow-tooltip></el-table-column>
+
 
-					<el-table-column prop="createdAt" label="创建时间" width="160" align="center"></el-table-column>
+					<el-table-column prop="createdAt" v-col="'createdAt'" label="创建时间" width="160" align="center"></el-table-column>
 					<el-table-column label="操作" width="200" align="center">
 						<template #default="scope">
-						
-							<el-button size="small" text type="warning" 
-								@click="addOrEdit(scope.row)">编辑</el-button>
 
-							<el-button size="small" text type="info"  @click="del(scope.row)">删除</el-button>
+							<el-button size="small" text v-auth="'edit'" type="warning" @click="addOrEdit(scope.row)">编辑</el-button>
+
+							<el-button size="small" text v-auth="'del'" type="info" @click="del(scope.row)">删除</el-button>
 						</template>
 					</el-table-column>
 				</el-table>
-				<pagination v-if="params.total" :total="params.total" v-model:page="params.pageNum"
-					v-model:limit="params.pageSize" @pagination="getList()" />
+				<pagination v-if="params.total" :total="params.total" v-model:page="params.pageNum" v-model:limit="params.pageSize" @pagination="getList()" />
 			</el-col>
 		</el-row>
 
@@ -76,19 +76,19 @@
 <script lang="ts" setup>
 import device from '/@/api/device'
 import { useSearch } from '/@/hooks/useCommon'
-import {  Expand } from '@element-plus/icons-vue';
+import { Expand } from '@element-plus/icons-vue';
 
 import { ElMessageBox, ElMessage } from 'element-plus'
 import EditForm from './edit.vue'
 interface Tree {
-  label: string
-  children?: Tree[]
+	label: string
+	children?: Tree[]
 }
-import { ref,onMounted} from 'vue'
+import { ref, onMounted } from 'vue'
 import { useRouter } from 'vue-router'
 const defaultProps = {
-  children: 'children',
-  label: 'label',
+	children: 'children',
+	label: 'label',
 }
 
 const queryRef = ref()
@@ -97,24 +97,22 @@ const productData = ref([])
 const mergedData = ref()
 const cateData = ref()
 const editFormRef = ref()
-const productIno=ref();
-
+const productIno = ref();
+const ids = ref<number[]>([])
 
-const { params, tableData, getList, loading } = useSearch<any[]>(device.dev_asset_metadata.getList, 'Data', { keyWord: ''})
-getList()
-const toDetail = (id: number) => {
-	router.push(`/device/dossier/manage/${id}`)
-}
+const { params, tableData, getList, loading } = useSearch<any[]>(device.dev_asset_metadata.getList, 'Data', { keyWord: '' })
 onMounted(() => {
 	getCateList()
-
 });
+const handleSelectionChange = (selection: any[]) => {
+	ids.value = selection.map((item) => item.id);
+};
 const addOrEdit = async (row?: any) => {
 	if (row) {
-		editFormRef.value.open(row,productIno.value)
+		editFormRef.value.open(row, productIno.value)
 		return
 	} else {
-		editFormRef.value.open({},productIno.value)
+		editFormRef.value.open({}, productIno.value)
 	}
 }
 
@@ -125,6 +123,8 @@ const getCateList = () => {
 
 		device.product.getLists({}).then((res: any) => {
 			productData.value = res.product;
+			params.productKey = res.product[0].key
+			getList()
 			mergedData.value = matchProductsToCategories(productData.value, cateData.value);
 		})
 
@@ -132,63 +132,73 @@ const getCateList = () => {
 }
 
 const handleNodeClick = (data: any) => {
-	if(data.is_type==='2'){
+	if (data.is_type === '2') {
 		productIno.value = data;
 		params.productKey = data.key
 		getList()
 
-	}else{
-		productIno.value='';
+	} else {
+		productIno.value = '';
 
 	}
 }
 
-const matchProductsToCategories = (productData:any, cateData:any) => {
-  const treeData = []
-  for (let category of cateData) {
-    const treeNode = buildTree(category, productData)
-    treeData.push(treeNode)
-  }
-  return treeData
+const matchProductsToCategories = (productData: any, cateData: any) => {
+	const treeData = []
+	for (let category of cateData) {
+		const treeNode = buildTree(category, productData)
+		treeData.push(treeNode)
+	}
+	return treeData
 }
 
-const buildTree = (category:any, productData:any) => {
-  const treeNode = {
-    id: category.id,
-    label: category.name,
-	key: category.key,
-    is_type: '1', // 1是分类
-    children: [],
-  }
-
-  if (category.children && category.children.length > 0) {
-    for (let child of category.children) {
-      const childNode = buildTree(child, productData)
-      treeNode.children.push(childNode)
-    }
-  } else {
-    const products = productData.filter((product:any) => product.categoryId === category.id)
-    for (let product of products) {
-      const productNode = {
-        id: product.id,
-        label: product.name,
-        key: product.key,
-        is_type: '2', // 2是产品
-      }
-      treeNode.children.push(productNode)
-    }
-  }
-
-  return treeNode
-}
+const buildTree = (category: any, productData: any) => {
+	const treeNode = {
+		id: category.id,
+		label: category.name,
+		key: category.key,
+		is_type: '1', // 1是分类
+		children: [],
+	}
 
+	if (category.children && category.children.length > 0) {
+		for (let child of category.children) {
+			const childNode = buildTree(child, productData)
+			treeNode.children.push(childNode)
+		}
+	} else {
+		const products = productData.filter((product: any) => product.categoryId === category.id)
+		for (let product of products) {
+			const productNode = {
+				id: product.id,
+				label: product.name,
+				key: product.key,
+				is_type: '2', // 2是产品
+			}
+			treeNode.children.push(productNode)
+		}
+	}
+
+	return treeNode
+}
+const batchdel = () => {
+	ElMessageBox.confirm('是否确认要批量删除这些数据吗?', '提示', {
+		confirmButtonText: '确认',
+		cancelButtonText: '取消',
+		type: 'warning',
+	}).then(async () => {
+		await device.dev_asset_metadata.delete({ ids: ids.value })
+		ElMessage.success('删除成功')
+		getList()
+	})
+}
 const del = (row: any) => {
 	ElMessageBox.confirm('是否确认删除名称为:"' + row.name + '"的数据项?', '提示', {
 		confirmButtonText: '确认',
 		cancelButtonText: '取消',
 		type: 'warning',
 	}).then(async () => {
-		await device.dev_asset_metadata.delete({ids:row.id})
+		await device.dev_asset_metadata.delete({ ids: row.id })
 		ElMessage.success('删除成功')
 		getList()
 	})

+ 12 - 24
src/views/iot/property/dossier/component/from.vue

@@ -10,32 +10,19 @@
 			</el-form-item>
 
 			<el-form-item v-if="item.types === 'date'" :label="item.title + ':'">
-				<el-date-picker
-					v-model="formData[item.name]"
-					:default-value="item.value"
-					type="date"
-					value-format="YYYY-MM-DD"
-					placeholder="请选择时间"
-					class="w100"
-					clearable
-					@change="saveData()"
-				/>
+				<el-date-picker v-model="formData[item.name]" :default-value="item.value" type="date" value-format="YYYY-MM-DD" placeholder="请选择时间" class="w100" clearable @change="saveData()" />
 			</el-form-item>
 
 			<el-form-item :label="item.title + ':'" prop="path" v-if="item.types === 'file'">
 
-		
 
-			<el-upload
-				class="avatar-uploader"
-				:action="uploadUrl"
-				:headers="headers"
-				:show-file-list="false"
-				:on-success="customCallback(item.name)"
-			>
-				<img v-if="formData[item.name]" :src="formData[item.name]" class="avatar" />
-				<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
-			</el-upload>
+
+				<el-upload class="avatar-uploader" :action="uploadUrl" :headers="headers" :show-file-list="false" :on-success="customCallback(item.name)">
+					<img v-if="formData[item.name]" :src="formData[item.name]" class="avatar" />
+					<el-icon v-else class="avatar-uploader-icon">
+						<Plus />
+					</el-icon>
+				</el-upload>
 
 
 			</el-form-item>
@@ -97,10 +84,11 @@ const saveData = () => {
 .form-item {
 	flex: 0 0 25%;
 }
+
 .avatar-uploader .avatar {
-  width: 178px;
-  height: 178px;
-  display: block;
+	width: 178px;
+	height: 178px;
+	display: block;
 }
 </style>
 <style>

+ 128 - 128
src/views/iot/property/dossier/edit.vue

@@ -81,7 +81,7 @@
       </el-row>
 
       <el-divider content-position="left">自定义属性</el-divider>
-      <FromData :Datalist="Datalist"  @SetSaveData="SetSaveData" v-if="Datalist && Datalist.length>0"></FromData>
+      <FromData :Datalist="Datalist" @SetSaveData="SetSaveData" v-if="Datalist && Datalist.length > 0"></FromData>
     </el-form>
 
 
@@ -97,155 +97,155 @@
 </template>
 
 <script lang="ts" setup>
-  import { ref, reactive, nextTick } from 'vue';
-  import api from '/@/api/device'
-  import system from '/@/api/system';
-  import FromData from './component/from.vue';
-
-  import { ruleRequired } from '/@/utils/validator';
-  import { ElMessage } from 'element-plus';
-
-  const emit = defineEmits(['getList']);
-
-  const showDialog = ref(false);
-  const formRef = ref();
-  const orgData = ref();
-  const deviceList = ref();
-  const productData = ref();
-  const deptData = ref();
-  const Datalist = ref();
-  const newData = ref([]);
-  const baseForm = {
-    id: undefined,
-    productKey: '',
-    deviceKey: '',
-    deviceName: '',
-    area: "",
-    deviceNumber: '',
-    deviceCategory: '',
-    installTime: '',
-    deptId: '',
-    data: [],
-
-  };
-
-
-  const SetSaveData = (data: any) => {
-    formData.data = data;
+import { ref, reactive, nextTick } from 'vue';
+import api from '/@/api/device'
+import system from '/@/api/system';
+import FromData from './component/from.vue';
+
+import { ruleRequired } from '/@/utils/validator';
+import { ElMessage } from 'element-plus';
+
+const emit = defineEmits(['getList']);
+
+const showDialog = ref(false);
+const formRef = ref();
+const orgData = ref();
+const deviceList = ref();
+const productData = ref();
+const deptData = ref();
+const Datalist = ref();
+const newData = ref([]);
+const baseForm = {
+  id: undefined,
+  productKey: '',
+  deviceKey: '',
+  deviceName: '',
+  area: "",
+  deviceNumber: '',
+  deviceCategory: '',
+  installTime: '',
+  deptId: '',
+  data: [],
+
+};
+
+
+const SetSaveData = (data: any) => {
+  formData.data = data;
+}
+const formData = reactive({
+  ...baseForm,
+});
+
+const ruleForm = {
+  productKey: [ruleRequired('所属产品不能为空')],
+  deviceName: [ruleRequired('设备名称不能为空')],
+  deviceKey: [ruleRequired('设备不能为空')],
+};
+const handleSelectionChange = (value: any) => {
+  const selectedOption = deviceList.value.find(option => option.key === value);
+  if (selectedOption) {
+    formData.deviceName = selectedOption.name;
+  } else {
+    formData.deviceName = '';
   }
-  const formData = reactive({
-    ...baseForm,
-  });
+}
 
-  const ruleForm = {
-    productKey: [ruleRequired('所属产品不能为空')],
-    deviceName: [ruleRequired('设备名称不能为空')],
-    deviceKey: [ruleRequired('设备不能为空')],
-  };
-  const handleSelectionChange = (value: any) => {
-    const selectedOption = deviceList.value.find(option => option.key === value);
-    if (selectedOption) {
-      formData.deviceName = selectedOption.name;
-    } else {
-      formData.deviceName = '';
-    }
-  }
+const onSubmit = async () => {
+  await formRef.value.validate();
 
-  const onSubmit = async () => {
-    await formRef.value.validate();
+  const theApi = formData.id ? api.dev_asset.edit : api.dev_asset.add;
 
-    const theApi = formData.id ? api.dev_asset.edit : api.dev_asset.add;
+  await theApi(formData);
 
-    await theApi(formData);
+  ElMessage.success('操作成功');
+  resetForm();
+  showDialog.value = false;
+  emit('getList');
+};
 
-    ElMessage.success('操作成功');
-    resetForm();
-    showDialog.value = false;
-    emit('getList');
-  };
+const resetForm = async () => {
+  Object.assign(formData, { ...baseForm });
+  Datalist.value = ''
+  formRef.value && formRef.value.resetFields();
+};
 
-  const resetForm = async () => {
-    Object.assign(formData, { ...baseForm });
-    Datalist.value=''
-    formRef.value && formRef.value.resetFields();
-  };
-
-  const getIdByKey = (key: string) => {
-    for (let i = 0; i < productData.value.length; i++) {
-      if (productData.value[i].key === key) {
-        return productData.value[i].id;
-      }
+const getIdByKey = (key: string) => {
+  for (let i = 0; i < productData.value.length; i++) {
+    if (productData.value[i].key === key) {
+      return productData.value[i].id;
     }
-    return null; // 如果没有找到匹配的key,则返回null(或者其他合适的值)
   }
-
-  const open = async (row: any, productInfo: any) => {
-    resetForm();
-    showDialog.value = true;
-    nextTick(() => {
-      //获取区域
-      system.org.getList({ status: 1 }).then((res: any) => {
-        res.forEach((item) => {
-          item.id = item.id.toString();
-        });
-        orgData.value = res || [];
+  return null; // 如果没有找到匹配的key,则返回null(或者其他合适的值)
+}
+
+const open = async (row: any, productInfo: any) => {
+  resetForm();
+  showDialog.value = true;
+  nextTick(() => {
+    //获取区域
+    system.org.getList({ status: 1 }).then((res: any) => {
+      res.forEach((item) => {
+        item.id = item.id.toString();
       });
+      orgData.value = res || [];
+    });
 
-      //获取 所有的产品
-      api.product.getLists({}).then((resp: any) => {
-        productData.value = resp.product;
-        if (row.id) {
-          productInfo = {
-            id: getIdByKey(row.productKey),
-            key: row.productKey,
-          }
+    //获取 所有的产品
+    api.product.getLists({}).then((resp: any) => {
+      productData.value = resp.product;
+      if (row.id) {
+        productInfo = {
+          id: getIdByKey(row.productKey),
+          key: row.productKey,
+        }
 
 
-        }
-        //根据产品ID获取设备列表
-        api.device.allList({ productId: productInfo.id }).then((resd: any) => {
-          deviceList.value = resd.device || [];
-        });
+      }
+      //根据产品ID获取设备列表
+      api.device.allList({ productId: productInfo.id }).then((resd: any) => {
+        deviceList.value = resd.device || [];
+      });
 
-      })
+    })
 
 
 
-      //获取部门
-      api.dept.getList({ status: -1 }).then((res: any) => {
-        res.forEach((item) => {
-          item.deptId = item.deptId.toString();
-        });
-        deptData.value = res || [];
+    //获取部门
+    api.dept.getList({ status: -1 }).then((res: any) => {
+      res.forEach((item) => {
+        item.deptId = item.deptId.toString();
       });
+      deptData.value = res || [];
+    });
 
 
-      if (row.id) {
-        api.dev_asset.detail({ deviceKey: row.deviceKey }).then((resde: any) => {
-          Object.assign(formData, { ...resde });
-          formData.productKey = row.productKey
-          const newArray = resde.data.map(obj => {
-            const { name, value, ...rest } = obj;
-            const newObj = { name, value, ...rest };
-            newObj[name] = value?value:'';
-            return newObj;
-          });
-          Datalist.value = newArray
+    if (row.id) {
+      api.dev_asset.detail({ deviceKey: row.deviceKey }).then((resde: any) => {
+        Object.assign(formData, { ...resde });
+        formData.productKey = row.productKey
+        const newArray = resde.data.map(obj => {
+          const { name, value, ...rest } = obj;
+          const newObj = { name, value, ...rest };
+          newObj[name] = value ? value : '';
+          return newObj;
         });
-      } else {
-        //获取档案属性
-        api.dev_asset_metadata.getList({ productKey: productInfo.key, pageSize: 50, pageNum: 1, status: -1, total: 0 }).then((res: any) => {
-          Datalist.value = res.Data || [];
-          formData.productKey = productInfo.key
-        });
-      }
-    });
-  };
+        Datalist.value = newArray
+      });
+    } else {
+      //获取档案属性
+      api.dev_asset_metadata.getList({ productKey: productInfo.key, pageSize: 50, pageNum: 1, status: -1, total: 0 }).then((res: any) => {
+        Datalist.value = res.Data || [];
+        formData.productKey = productInfo.key
+      });
+    }
+  });
+};
 
-  defineExpose({ open });
+defineExpose({ open });
 </script>
 <style scoped lang="scss">
-  .demo-form-inline .el-input {
-    --el-input-width: 320px;
-  }
+.demo-form-inline .el-input {
+  --el-input-width: 320px;
+}
 </style>

+ 30 - 21
src/views/iot/property/dossier/index.vue

@@ -15,7 +15,7 @@
 					</el-button>
 				</el-form-item>
 				<el-form-item>
-					<el-button type="success" @click="addOrEdit()" v-if="productIno">
+					<el-button type="success" @click="addOrEdit()" v-auth="'add'" v-if="productIno">
 						<el-icon>
 							<ele-FolderAdd />
 						</el-icon>
@@ -29,45 +29,39 @@
 						批量添加
 					</el-button> -->
 
-					<!-- <el-button type="danger" @click="addOrEdit()">
+					<el-button type="danger" @click="batchdel()" v-auth="'batchdel'">
 						<el-icon>
 							<ele-FolderAdd />
 						</el-icon>
 						批量删除
-					</el-button> -->
+					</el-button>
 				</el-form-item>
 			</el-form>
 		</div>
 		<el-row>
 			<el-col :span="6">
-				<el-tree
-					:data="mergedData"
-					:props="defaultProps"
-					accordion
-					default-expand-all
-					@node-click="handleNodeClick"
-					style="border: 1px solid #eee; padding: 10px; margin-right: 10px"
-				>
+				<el-tree :data="mergedData" :props="defaultProps" accordion default-expand-all @node-click="handleNodeClick" style="border: 1px solid #eee; padding: 10px; margin-right: 10px">
 					<template #default="{ node, data }">
 						<span :style="data.is_type === '2' ? { color: '#409eff' } : {}">
-							<el-icon v-if="data.is_type == '2'"><Check /></el-icon>
+							<el-icon v-if="data.is_type == '2'">
+								<Check />
+							</el-icon>
 							{{ node.label }}
 						</span>
 					</template>
 				</el-tree>
 			</el-col>
-			<el-col :span="18"
-				><el-table :data="tableData" style="width: 100%" row-key="id" v-loading="loading">
+			<el-col :span="18"><el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange" row-key="id" v-loading="loading">
 					<el-table-column type="selection" width="55" align="center" />
 
-					<el-table-column prop="deviceName" label="设备名称" min-width="100" show-overflow-tooltip></el-table-column>
-					<el-table-column prop="deviceKey" label="设备KEY" show-overflow-tooltip></el-table-column>
+					<el-table-column prop="deviceName" v-col="'deviceName'" label="设备名称" min-width="100" show-overflow-tooltip></el-table-column>
+					<el-table-column prop="deviceKey" v-col="'deviceKey'" label="设备KEY" show-overflow-tooltip></el-table-column>
 
-					<el-table-column prop="deviceNumber" label="设备编码" show-overflow-tooltip></el-table-column>
+					<el-table-column prop="deviceNumber" v-col="'deviceNumber'" label="设备编码" show-overflow-tooltip></el-table-column>
 
-					<el-table-column prop="deviceCategory" label="设备类型" show-overflow-tooltip></el-table-column>
+					<el-table-column prop="deviceCategory" v-col="'deviceCategory'" label="设备类型" show-overflow-tooltip></el-table-column>
 
-					<el-table-column prop="installTime" label="安装时间" width="160" align="center"></el-table-column>
+					<el-table-column prop="installTime" v-col="'installTime'" label="安装时间" width="160" align="center"></el-table-column>
 					<el-table-column label="操作" width="200" align="center">
 						<template #default="scope">
 							<el-button size="small" text type="warning" v-auth="'edit'" @click="addOrEdit(scope.row)">编辑</el-button>
@@ -107,10 +101,13 @@ const mergedData = ref()
 const cateData = ref()
 const editFormRef = ref()
 const productIno = ref()
+const ids = ref<number[]>([])
 
 const { params, tableData, getList, loading } = useSearch<any[]>(device.dev_asset.getList, 'Data', { keyWord: '' })
 getList()
-
+const handleSelectionChange = (selection: any[]) => {
+	ids.value = selection.map((item) => item.id);
+};
 onMounted(() => {
 	getCateList()
 })
@@ -183,13 +180,25 @@ const buildTree = (category: any, productData: any) => {
 	return treeNode
 }
 
+const batchdel = () => {
+	ElMessageBox.confirm('是否确认要批量删除这些数据吗?', '提示', {
+		confirmButtonText: '确认',
+		cancelButtonText: '取消',
+		type: 'warning',
+	}).then(async () => {
+		await device.dev_asset.delete({ ids: ids.value })
+		ElMessage.success('删除成功')
+		getList()
+	})
+}
+
 const del = (row: any) => {
 	ElMessageBox.confirm('是否确认删除名称为:"' + row.deviceName + '"的数据项?', '提示', {
 		confirmButtonText: '确认',
 		cancelButtonText: '取消',
 		type: 'warning',
 	}).then(async () => {
-		await device.dev_asset.delete({ids:row.id})
+		await device.dev_asset.delete({ ids: row.id })
 		ElMessage.success('删除成功')
 		getList()
 	})