修改清空表格选项-liyuchen
This commit is contained in:
parent
7ef200e879
commit
933ed73ed7
|
@ -11,7 +11,7 @@
|
||||||
search
|
search
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</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 type="selection" width="55" :reserve-selection="true"/>
|
||||||
<el-table-column property="dictValue" label="DisasterType" width="150" />
|
<el-table-column property="dictValue" label="DisasterType" width="150" />
|
||||||
<el-table-column property="disasterCountry" label="DisasterCountry" width="200" />
|
<el-table-column property="disasterCountry" label="DisasterCountry" width="200" />
|
||||||
|
@ -43,9 +43,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import en from 'element-plus/dist/locale/en.mjs'
|
import en from 'element-plus/dist/locale/en.mjs'
|
||||||
import {getPage,updateDisasterManage} from '/@/api/disasterInfo/index.js';
|
import {getPage,updateDisasterManage} from '/@/api/disasterInfo/index.js';
|
||||||
import {reactive} from "vue";
|
import {reactive, ref} from "vue";
|
||||||
import {ElMessage} from "element-plus";
|
import {ElMessage} from "element-plus";
|
||||||
const emit = defineEmits(['callback']);
|
const emit = defineEmits(['callback']);
|
||||||
|
const tableRef = ref();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
isShowDialog:false,
|
isShowDialog:false,
|
||||||
table:false,
|
table:false,
|
||||||
|
@ -86,11 +87,17 @@ const getDisaterInfo = () => {
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
const closeDialog = () => {
|
const closeDialog = () => {
|
||||||
state.isShowDialog = false;
|
state.isShowDialog = false;
|
||||||
|
state.multipleSelection = [];
|
||||||
|
tableRef.value.clearSelection();
|
||||||
};
|
};
|
||||||
const onCancel = () => {
|
const onCancel = () => {
|
||||||
closeDialog();
|
closeDialog();
|
||||||
}
|
}
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
|
if(state.multipleSelection.length == 0){
|
||||||
|
ElMessage.warning("Please check the data first");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
//将选中的灾害转为{"id":"","chiefId":""}格式
|
//将选中的灾害转为{"id":"","chiefId":""}格式
|
||||||
const saveRes = state.multipleSelection.map(item=> ({id:item.id,chiefId:state.chiefId}))
|
const saveRes = state.multipleSelection.map(item=> ({id:item.id,chiefId:state.chiefId}))
|
||||||
updateDisasterManage(saveRes).then(res=>{
|
updateDisasterManage(saveRes).then(res=>{
|
||||||
|
|
Loading…
Reference in New Issue