修改清空表格选项-liyuchen

This commit is contained in:
李宇辰 2023-04-17 18:11:08 +08:00
parent 7ef200e879
commit 933ed73ed7
1 changed files with 9 additions and 2 deletions

View File

@ -11,7 +11,7 @@
search
</el-button>
</div>
<el-table :data="state.tableData.data" :row-key="getRowKeys" @selection-change="handleSelectionChange">
<el-table :data="state.tableData.data" :row-key="getRowKeys" @selection-change="handleSelectionChange" ref="tableRef">
<el-table-column type="selection" width="55" :reserve-selection="true"/>
<el-table-column property="dictValue" label="DisasterType" width="150" />
<el-table-column property="disasterCountry" label="DisasterCountry" width="200" />
@ -43,9 +43,10 @@
<script setup>
import en from 'element-plus/dist/locale/en.mjs'
import {getPage,updateDisasterManage} from '/@/api/disasterInfo/index.js';
import {reactive} from "vue";
import {reactive, ref} from "vue";
import {ElMessage} from "element-plus";
const emit = defineEmits(['callback']);
const tableRef = ref();
const state = reactive({
isShowDialog:false,
table:false,
@ -86,11 +87,17 @@ const getDisaterInfo = () => {
//
const closeDialog = () => {
state.isShowDialog = false;
state.multipleSelection = [];
tableRef.value.clearSelection();
};
const onCancel = () => {
closeDialog();
}
const onSubmit = () => {
if(state.multipleSelection.length == 0){
ElMessage.warning("Please check the data first");
return false;
}
//{"id":"","chiefId":""}
const saveRes = state.multipleSelection.map(item=> ({id:item.id,chiefId:state.chiefId}))
updateDisasterManage(saveRes).then(res=>{