20260712212917

This commit is contained in:
oneao committed 2026-07-12 21:29:17 +08:00
1 parent 4677f6c519
commit 00472688ab
361 files changed
-153949

No files matched your search

@@ -1,56 +0,0 @@
<script setup>
import { ElMessageBox } from "element-plus";
import { computed } from "vue";
// 👉 支持 v-model:modelValue
const props = defineProps({
modelValue: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["update:modelValue", "confirm", "cancel"]);
const visible = computed({
get() {
return props.modelValue;
},
set(val) {
emit("update:modelValue", val);
},
});
function handleClose(done) {
ElMessageBox.confirm("Are you sure to close this dialog?")
.then(() => {
done();
})
.catch(() => {
// do nothing
});
}
function handleCancel() {
emit("update:modelValue", false);
emit("cancel");
}
function handleConfirm() {
emit("update:modelValue", false);
emit("confirm");
}
</script>
<template>
<el-dialog v-model="visible" title="Tips" width="500" :before-close="handleClose">
<span>This is a message</span>
<template #footer>
<div class="dialog-footer">
<el-button @click="handleCancel"> Cancel </el-button>
<el-button type="primary" @click="handleConfirm"> Confirm </el-button>
</div>
</template>
</el-dialog>
</template>
@@ -1,65 +0,0 @@
<script setup>
import { computed, ref } from "vue";
const props = defineProps({
excludeIds: {
type: Array,
default: () => [],
},
});
const emit = defineEmits(["select"]);
const visible = defineModel();
const sourceData = ref([
{ id: "1", name: "数据A" },
{ id: "2", name: "数据B" },
{ id: "3", name: "数据C" },
{ id: "4", name: "数据D" },
{ id: "5", name: "数据E" },
]);
const filteredData = computed(() => {
const idSet = new Set(props.excludeIds);
return sourceData.value.filter((item) => !idSet.has(item.id));
});
const currentSelection = ref([]);
function handleSelection(rows) {
currentSelection.value = rows;
console.log(currentSelection.value);
}
/**
* 挑选
*/
function handlePick() {
if (!currentSelection.value.length) return;
emit("select", [...currentSelection.value]);
// 清空本次勾选
currentSelection.value = [];
}
</script>
<template>
<el-dialog v-model="visible" title="选择数据" width="600">
<el-table :data="filteredData" border height="300" @selection-change="handleSelection">
<el-table-column type="selection" width="55" />
<el-table-column prop="id" label="ID" width="120" />
<el-table-column prop="name" label="名称" />
</el-table>
<template #footer>
<el-button type="primary" @click="handlePick"> 挑选 </el-button>
<el-button @click="visible = false"> 关闭 </el-button>
</template>
</el-dialog>
</template>