1
lzhe
2024-04-10 3ca71791b839d7c9731643a8653c0b6fe1c6233a
src/views/console/system/component-classification.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-04-09 22:18:47
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-04-10 10:26:42
 * @LastEditTime: 2024-04-10 17:07:52
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/system/component-classification.vue
 * 分类维护
-->
@@ -12,7 +12,7 @@
            <el-button @click="del" plain type="danger" :disabled="selection.length == 0">删除</el-button>
        </el-header>
        <el-main>
            <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="id" border default-expand-all lazy :load="tableLoad">
            <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="id" border default-expand-all>
                <el-table-column type="selection" width="55" />
                <el-table-column prop="name" label="分类名称" />
                <el-table-column prop="icon" label="分类图标">
@@ -54,8 +54,18 @@
        this.queryList()
    },
    methods: {
        tableLoad(row,treeNode,resolve) {
                resolve(row.children);
        removeHasChildren(arr) {
            return arr.map(item => {
                // 创建一个不包含hasChildren的新对象
                const newItem = { ...item };
                delete newItem.hasChildren; // 删除hasChildren字段
                // 如果children字段存在且是数组,则递归处理children
                if (Array.isArray(newItem.children)) {
                newItem.children = this.removeHasChildren(newItem.children);
                }
                return newItem;
            });
        },
        add () {
            alert(2)
@@ -65,8 +75,7 @@
        },
        queryList () {
            this.$API.setting.getList.get().then(res => {
                this.tableData = res.data;
                console.log(this.tableData,222)
                this.tableData = this.removeHasChildren(res.data);
            })
            // this.$HTTP.get("/api/blade-system/menu/lazy-list",this.searchData).then(res=> {
         //       if(res.code == 200) {