弹框单选问题

This commit is contained in:
Ledo 2025-06-26 15:45:26 +08:00
parent ae449377a3
commit 979bd2c4a2

View File

@ -22,7 +22,9 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<el-table ref="multipleTableRef" v-loading="loading" :data="list" :stripe="true" highlight-current-row @current-change="handleCurrentChange" :show-overflow-tooltip="true" class="hl-table"> <el-table
ref="multipleTableRef" v-loading="loading" :data="list" :stripe="true"
@row-click="clickRow" @selection-change="handleCurrentChange" :show-overflow-tooltip="true" class="hl-table">
<el-table-column <el-table-column
type="selection" type="selection"
width="55"/> width="55"/>
@ -114,12 +116,28 @@ const getList = async () => {
} }
const clickItem = ref([]) const clickItem = ref([])
const handleCurrentChange = (val) => { const handleCurrentChange = (val) => {
multipleTableRef.value!.clearSelection()
clickItem.value = val; clickItem.value = val;
if(val.length > 1){
multipleTableRef.value!.clearSelection()
multipleTableRef.value!.toggleRowSelection(val.pop())
}
}
const clickRow = (row) => {
//
if ( clickItem.value[0] == row) {
//
clickItem.value = [];
multipleTableRef.value!.clearSelection()
} else {
//
clickItem.value.push(row);
multipleTableRef.value!.clearSelection()
multipleTableRef.value!.toggleRowSelection(row, true);
}
}
multipleTableRef.value!.toggleRowSelection(val, undefined)
};
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { const handleQuery = () => {
queryParams.pageNo = 1 queryParams.pageNo = 1
@ -162,7 +180,8 @@ const emit = defineEmits(['success'])
// emit('success', multipleSelection.value) // emit('success', multipleSelection.value)
const success = () =>{ const success = () =>{
dialogVisible.value = false; dialogVisible.value = false;
emit('success',rowid.value,clickItem.value.storageOkQty,clickItem.value.id,clickItem.value.matCode) console.log(clickItem.value)
emit('success',rowid.value,clickItem.value[0].storageOkQty,clickItem.value[0].id,clickItem.value[0].matCode)
} }
const handleRg = async (rgid) => { const handleRg = async (rgid) => {
pnCurrentList.value =[] pnCurrentList.value =[]