新增设备信息勾选

This commit is contained in:
zhujiyan
2024-06-14 16:15:07 +08:00
parent 2ce6656e0b
commit b551db602b

View File

@@ -60,17 +60,20 @@
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
<!-- 新增设备信息 --> <!-- 新增设备信息 -->
<el-dialog v-model="dialogVisible" width="65%" title="添加设备" draggable :append-to-body="true"> <el-dialog v-model="dialogVisible" width="65%" title="添加设备" draggable :append-to-body="true">
<vxe-table <vxe-table
border border
show-overflow show-overflow
ref="tableRef" ref="checkTableRef"
:loading="loading" :loading="loading"
align="center" align="center"
:data="tableData" :data="tableData"
:edit-config="{ trigger: 'manual', mode: 'row' }" :edit-config="{ trigger: 'manual', mode: 'row' }"
@checkbox-all="selectAllChangeEvent"
@checkbox-change="selectChangeEvent"
> >
<!-- <vxe-column type="seq" width="60"></vxe-column> --> <!-- <vxe-column type="seq" width="60"></vxe-column> -->
<vxe-column type="checkbox" width="60"></vxe-column>
<vxe-column field="name" title="设备名称"> <vxe-column field="name" title="设备名称">
<template #edit="{ row }"> <template #edit="{ row }">
<vxe-input v-model="row.name" type="text"></vxe-input> <vxe-input v-model="row.name" type="text"></vxe-input>
@@ -103,7 +106,7 @@
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
<template #footer=""> <template #footer="">
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="close"> </el-button>
<el-button type="primary" @click="submit"> </el-button> <el-button type="primary" @click="submit"> </el-button>
</template> </template>
</el-dialog> </el-dialog>
@@ -129,7 +132,7 @@ interface RowVO {
} }
const tableRef: any = ref(null) const tableRef: any = ref(null)
const checkTableRef:any=ref(null)
const loading = ref(false) const loading = ref(false)
const tableData = ref([ const tableData = ref([
{ {
@@ -232,6 +235,22 @@ const cancelRowEvent = (row: RowVO) => {
} }
} }
const selectAllChangeEvent = (checked: any) => {
const $table = checkTableRef.value
if ($table) {
const records = $table.getCheckboxRecords()
console.log(checked ? '所有勾选事件' : '所有取消事件', records)
}
}
const selectChangeEvent = (checked: any) => {
const $table = checkTableRef.value
if ($table) {
const records = $table.getCheckboxRecords()
console.log(checked ? '勾选事件' : '取消事件', records)
}
}
//删除设备 //删除设备
const delDevice = (row: any) => { const delDevice = (row: any) => {
console.log(row, '8888') console.log(row, '8888')
@@ -247,6 +266,10 @@ const open = () => {
const submit = () => { const submit = () => {
console.log(6666) console.log(6666)
} }
const close=()=>{
dialogVisible.value = false;
checkTableRef.value.clearCheckboxRow()
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.table { .table {