This commit is contained in:
sjl
2024-11-11 11:09:20 +08:00
parent 50bebf451d
commit 3526432052
11 changed files with 351 additions and 64 deletions

View File

@@ -24,28 +24,20 @@
</template>
</ProTable>
<!-- 新增/编辑资源对话框 -->
<ResourceDialog
:visible="dialogFormVisible"
:dialogTitle="dialogTitle"
:formData="dialogForm"
@update:visible="dialogFormVisible = $event"
@submit="submitForm"
/>
</div>
</template>
<script setup lang='tsx' name='useProTable'>
import { defineComponent,ref ,reactive} from 'vue'
import { type Resource } from '@/api/resource/interface'
import { type Function } from '@/api/function/interface'
import ProTable from '@/components/ProTable/index.vue'
import ResourceDialog from "@/views/authority/resource/components/ResourceDialog.vue"; // 导入子组件
import {CirclePlus, Delete, EditPen,HomeFilled} from '@element-plus/icons-vue'
import resourceDataList from '@/api/resource/resourceData'
import resourceDataList from '@/api/function/functionExample'
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
import { ElMessage, ElMessageBox, inputEmits } from 'element-plus';
import { useDictStore } from '@/stores/modules/dict'
import { el } from 'element-plus/es/locale';
const dictStore = useDictStore()
let multipleSelection = ref<string[]>([]);
@@ -54,7 +46,7 @@ import { el } from 'element-plus/es/locale';
const isEditMode = ref(false);
const dialogTitle = ref('新增菜单')
const dialogForm = ref<Resource.ResResourceList>({
const dialogForm = ref<Function.ResFunction>({
id: '',
pid:'',
pids:'',
@@ -72,7 +64,7 @@ import { el } from 'element-plus/es/locale';
const proTable = ref<ProTableInstance>()
// 表格配置项
const columns = reactive<ColumnProps<Resource.ResResourceList>[]>([
const columns = reactive<ColumnProps<Function.ResFunction>[]>([
{ type: 'selection', fixed: 'left', width: 70 },
{
prop: 'name',
@@ -162,40 +154,40 @@ const openEditDialog = (resource: Resource.ResResourceList) => {
};
//批量删除
const handleDelList =()=>{
ElMessageBox.confirm(
`是否删除所选菜单信息?`, // 使用模板字符串来插值
'温馨提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
resourceData.value = resourceData.value.filter(item => !multipleSelection.value.includes(item.id));
multipleSelection.value = []; // Clear selected rows
ElMessage.success("批量删除成功");
})
// ElMessageBox.confirm(
// `是否删除所选菜单信息?`, // 使用模板字符串来插值
// '温馨提示',
// {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning',
// }
// )
// .then(() => {
// resourceData.value = resourceData.value.filter(item => !multipleSelection.value.includes(item.id));
// multipleSelection.value = []; // Clear selected rows
// ElMessage.success("批量删除成功");
// })
}
// 删除资源
const deleteResource = (params: Resource.ResResourceList) => {
ElMessageBox.confirm(
`是否删除【${params.name}】菜单?`, // 使用模板字符串来插值
'温馨提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
resourceData.value = resourceData.value.filter(item => item.id !== params.id); // 过滤掉被删除的资源
ElMessage({
type: 'success',
message: `删除${params.name}成功!`
})
})
// ElMessageBox.confirm(
// `是否删除【${params.name}】菜单?`, // 使用模板字符串来插值
// '温馨提示',
// {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning',
// }
// )
// .then(() => {
// resourceData.value = resourceData.value.filter(item => item.id !== params.id); // 过滤掉被删除的资源
// ElMessage({
// type: 'success',
// message: `删除${params.name}成功!`
// })
// })
};