1
lzhe
2024-04-14 3830233baf564fe39d5887ad5fd02207aba91f34
1
已修改7个文件
已添加1个文件
478 ■■■■ 文件已修改
src/layout/components/NavMenu.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/console/resource/attach.vue 264 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/home/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/home/widgets/components/about.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/home/widgets/components/ver.vue 128 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/home/widgets/components/welcome.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login/components/passwordForm.vue 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/NavMenu.vue
@@ -13,7 +13,7 @@
        </el-menu-item>
        <el-sub-menu v-else :index="navMenu.path">
            <template #title>
                <el-icon v-if="navMenu.meta&&navMenu.meta.icon"><component :is="navMenu.meta.icon || 'el-icon-menu'"/></el-icon>
                <!-- <el-icon v-if="navMenu.meta&&navMenu.meta.icon"><component :is="navMenu.meta.icon || 'el-icon-menu'"/></el-icon> -->
                <span>{{navMenu.meta.title}}</span>
                <span v-if="navMenu.meta.tag" class="menu-tag">{{navMenu.meta.tag}}</span>
            </template>
@@ -33,6 +33,9 @@
            hasChildren(item) {
                return item.children && !item.children.every(item => item.meta.hidden)
            }
        },
        mounted(){
        }
    }
</script>
src/router/index.js
@@ -81,7 +81,6 @@
        if (to.matched.length == 0) {
            router.push(to.fullPath);
        }
        console.log(menuRouter,router)
        isGetRouter = true;
    }
    beforeEach(to, from)
src/views/console/resource/attach.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,264 @@
<!--
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-03-26 10:28:33
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-04-02 17:48:31
 * @FilePath: /smart-web/src/views/master/person/main/index.vue
 * @Description: è¿™æ˜¯é»˜è®¤è®¾ç½®,请设置`customMade`, æ‰“å¼€koroFileHeader查看配置 è¿›è¡Œè®¾ç½®: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <div class="dict-main">
        <el-form :inline="true" :model="searchData" abel-width="120px">
            <el-form-item label="字典编号">
                <el-input v-model="searchData.code" placeholder="字典编号" clearable />
            </el-form-item>
            <el-form-item label="字典名称">
                <el-input v-model="searchData.dictValue" placeholder="字典名称" clearable></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="searchclick">搜索</el-button>
                <el-button @click="searchClearBtn">清空</el-button>
            </el-form-item>
        </el-form>
        <div>
            <div class="dict-Btn">
                <div class="dict-btn-bottom">
                    <el-button type="primary" @click="addData">+ æ–°å¢ž</el-button>
                    <el-button type="danger" plain @click="delData">删除</el-button>
                </div>
            </div>
            <div class="dict-table">
                <el-table ref="multipleTableRef" :data="tableData" border style="width: 100%" class="multipleTableRef" @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="55" />
                    <el-table-column prop="code" label="字典编号">
                        <template #default="scope">
                            <el-check-tag type="info" checked @change="table_allocation(scope.row, scope.$index)">{{scope.row.code}}</el-check-tag>
                        </template>
                    </el-table-column>
                    <el-table-column prop="dictValue" label="字典名称"></el-table-column>
                    <el-table-column prop="sort" label="字典排序"></el-table-column>
                    <el-table-column prop="isSealed" label="封存">
                        <template #default="scope">
                            <div>{{scope.row.isSealed == 0?"否":"是"}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column fixed="right" label="操作">
                        <template #default="scope">
                            <el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
                            <el-button type="text" size="small" @click="table_edit(scope.row, scope.$index)">编辑</el-button>
                            <el-button text type="primary" size="small" @click="table_del(scope.row, scope.$index)">删除</el-button>
                            <el-button text type="primary" size="small" @click="table_allocation(scope.row, scope.$index)">字典配置</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination
                    style="margin-top: 12px;"
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="currentPage4"
                    :page-sizes="[15, 50, 100]"
                    :page-size="15"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="total">
                </el-pagination>
            </div>
        </div>
    </div>
</template>
<script>
    export default {
        name: "attach",
        data(){
            return {
                getModalData: [],
                selection: [],
                total: 0,
                searchData: {
                    code: "",
                    dictValue: "",
                    current: "1",
                    size: "15"
                },
                dialog: {
                    save: false,
                    allocation: false
                },
                leftActive: true,
                input: '',
                options: [{
                    value: '选项1',
                    label: '黄金糕'
                }],
                input3: '',
                tableData: []
            }
        },
        created(){
        },
        mounted(){
            this.searchBtn();
        },
        components: {
        },
        methods: {
            codeClick() {
            },
            addDictSuccess(addDictForm) {
                this.searchClearBtn();
            },
            searchClearBtn() {
                this.searchData = {
                    code: "",
                    dictValue: "",
                    current: "1",
                    size: "15"
                }
                this.searchBtn();
            },
            searchclick() {
                this.searchData.current = "1";
                this.searchData.size = "15";
                this.searchBtn();
            },
            searchBtn() {
                this.$HTTP.get("/api/blade-system/dict/parent-list",this.searchData).then(res=> {
                    if(res.code == 200) {
                        this.tableData = res.data.records;
                        this.total = res.data.total;
                    }
                })
            },
            //字典配置
            table_allocation(row) {
                this.dialog.allocation = true;
                this.$nextTick(() => {
                    this.$refs.allocationDialog.open('edit').setData(row);
                })
            },
            //删除
            table_del(row) {
                var that = this;
                this.$confirm(`确定将选择数据删除?`, '', {
                    type: 'warning'
                }).then(() => {
                    this.$HTTP.post("/api/blade-system/dict/remove?ids="+row.id).then(res=> {
                        if(res.code == 200) {
                            that.$message.success("操作成功");
                            that.searchBtn();
                        }
                    })
                }).catch(() => {
                })
            },
            //添加
            addData(){
                this.dialog.save = true
                this.$nextTick(() => {
                    this.$refs.saveDialog.open()
                })
            },
            table_edit(row){
                this.dialog.save = true
                this.$HTTP.get("/api/blade-system/dict/detail?id="+row.id).then(res=> {
                    if(res.code == 200) {
                        this.dialog.save = true;
                        this.$nextTick(() => {
                            this.$refs.saveDialog.open('edit').setData(res.data);
                        })
                    }
                })
            },
            //查看
            table_show(row){
                this.dialog.save = true
                this.$nextTick(() => {
                    this.$refs.saveDialog.open('show').setData(row)
                })
            },
            handleSelectionChange(selection) {
                this.selection = selection;
            },
            delData() {
                if(this.selection.length == 0) {
                    this.$message({
                      message: '请选择至少一条数据',
                      type: 'warning'
                    });
                    return;
                }
                var selStr = "";
                this.selection.map(item=> {
                    selStr += item.id + ","
                })
                selStr = selStr.replace(/,$/, '');
                var that = this;
                this.$HTTP.post("/api/blade-system/dict/remove?ids="+selStr).then(res=> {
                    if(res.code == 200) {
                        that.$message.success("操作成功");
                        that.searchclick();
                    }
                })
            },
            changeDepartment() {
                this.departmentVisible = true;
            },
            changeTab(name) {
                if(name == 1) {
                    this.leftActive = true;
                }else {
                    this.leftActive = false;
                }
            },
            handleSizeChange(val) {
                console.log(`每页 ${val} æ¡`);
                this.searchData.current = "1";
                this.searchData.size = val;
                this.searchBtn();
            },
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
                this.searchData.current = val;
                this.searchBtn();
            }
        }
    }
</script>
<style scoped>
    .dict-main {
        background-color: #fff;
        margin: 8px;
        padding: 8px;
    }
    .dict-Btn {
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid #dcdfe6;
        margin-bottom: 8px;
        padding-left: 8px;
        padding-right: 8px;
    }
    .searchStatus {
        margin-right: 6px;
        width: 200px;
    }
    .dict-btn-bottom {
        padding-left: 8px;
        padding-right: 8px;
        margin-bottom: 8px;
    }
    .dict-table {
        padding-left: 8px;
        padding-right: 8px;
        margin-bottom: 8px;
    }
    .multipleTableRef {
        margin-bottom: 8px;
    }
</style>
src/views/home/index.vue
@@ -34,7 +34,7 @@
            this.dashboard = this.$TOOL.data.get("USER_INFO").dashboard || '0';
        },
        mounted(){
        },
        methods: {
            onMounted(){
src/views/home/widgets/components/about.vue
@@ -20,6 +20,9 @@
<script>
    export default {
        title: "信息卡",
        icon: "el-icon-setting",
        description: "员工职位信息、账号信息、系统版本快速查看",
        data() {
            return {
                
src/views/home/widgets/components/ver.vue
@@ -2,7 +2,9 @@
    <div>
        <el-card shadow="hover" header="快捷入口">
            <ul>
                <li><div>人工-部门</div></li>
                <li v-for="(item,index) in titleList">
                    <div @click="goPage(item)">{{item.name}}</div>
                </li>
                <li><div class="addMenu" @click="showDrawer">+ æ·»åŠ èœå•</div></li>
            </ul>
        </el-card>
@@ -10,12 +12,16 @@
            <div v-for="(value,key,index) in menuList">
                <div class="parent-children-title">{{key}}</div>
                <div class="parent-children">
                    <span v-for="item in value">
                        {{item}}
                        <div class="triangle-topright"></div>
                        <el-icon class="icon-topright"><Select /></el-icon>
                    <span v-for="(item,index1) in value" @click="addChecked(item,key,index1)" >
                        <div class="parent-name">{{item.name}}</div>
                        <div class="triangle-topright" v-if="item.checked"></div>
                        <el-icon class="icon-topright" v-if="item.checked"><Select /></el-icon>
                    </span>
                </div>
            </div>
            <div class="drawer-foot">
                <el-button @click="closeDrawer">取消</el-button>
                <el-button type="primary" @click="drawerConfirm">确定</el-button>
            </div>
        </el-drawer>
    </div>
@@ -28,28 +34,99 @@
        icons.push(key)
    }
    export default {
        title: "快捷入口",
        icon: "el-icon-data-line",
        description: "添加常用菜单入口",
        data() {
            return {
                direction: "rtl",
                titleList: [],
                drawer: false,
                menuList: {}
                menuList: {},
                CARD_INFO: [],
                firstMenuList: [],  //存储初始化的数据
                setCard: [],
                workid: ""
            }
        },
        components: {...ElementPlusIconsVue},
        mounted() {
            var data = this.$TOOL.data.get("MENU");
            var obj = {};
            data.forEach((item,index)=> {
                if(item.name != "工作台") {
                    obj[item.name] = this.getLastLevelNames(item.children);
                }
            })
            this.menuList = obj;
            this.getCard();
        },
        methods: {
            drawerConfirm() {
                var list = [];
                for(var key in this.menuList) {
                    this.menuList[key].forEach(item=> {
                        if(item.checked) {
                            list.push(item.id);
                        }
                    })
                }
                this.setCard.forEach(item=> {
                    if(item.cardKey == "Entrance") {
                        item.textContent = list.join(",");
                    }
                })
                var obj = {
                    workbenchId: this.workid,
                    workbenchCardAddVOList: this.setCard
                }
                this.$HTTP.post(`/api/blade-system/workbench-card/create-workbench-card`,obj).then(res=> {
                    if(res.code == 200) {
                        this.drawer = false;
                        this.menuList = {};
                        this.getCard();  //重新获取快捷菜单
                    }
                })
                //console.log(this.setCard,222)
            },
            getCard() {  //获取快捷菜单
                this.$HTTP.get(`/api/blade-system/workbench-card/list?workbenchId=${this.workid}`).then(res=> {
                    if(res.code == 200) {
                        this.setCard = res.data;
                        res.data.forEach(item=> {
                            if(item.cardKey == "Entrance") {
                                this.$TOOL.data.set("CARD_INFO", item.textContent);
                            }
                        })
                        this.init(); //根据获取的快捷菜单和菜单确定最后一级和勾选状态
                    }
                })
            },
            init() {
                this.titleList = [];
                var data = this.$TOOL.data.get("MENU");
                this.workid = data[0].children[0].id;  //记录第一个children的id
                this.CARD_INFO = this.$TOOL.data.get("CARD_INFO").split(",");
                var obj = {};
                //取最后一级菜单
                data.forEach((item,index)=> {
                    if(item.name != "工作台") {
                        obj[item.name] = this.getLastLevelNames(item.children);
                    }
                })
                this.menuList = obj;
                this.firstMenuList = JSON.parse(JSON.stringify(obj));  //存储初始化的数据
                // èŽ·å–title
                for(var key in this.menuList) {
                    this.menuList[key].forEach(item=> {
                        if(item.checked) {
                            this.titleList.push(item)
                        }
                    })
                }
            },
            addChecked(item,key,index1) {
                this.menuList[key][index1].checked = !this.menuList[key][index1].checked;
            },
            goPage(item) {
                this.$router.push(item.path);
            },
            getLastLevelNames(tree) {  
              const lastLevelNames = [];
              var that = this;
              const lastLevelNames = [];
              //,checked: this.$TOOL.data.get("CARD_INFO").split(",").include(item.id)
              tree.forEach(item => {  
                if (item.children) {  
                  // é€’归调用,处理子菜单项  
@@ -58,7 +135,7 @@
                  lastLevelNames.push(...childLastLevelNames);  
                } else {  
                  // å½“前项没有子菜单项,是最后一层,添加其名称  
                  lastLevelNames.push(item.name);
                  lastLevelNames.push({name:item.name,id: item.id,checked: that.CARD_INFO.includes(item.id),path: item.path});
                }  
              });  
              
@@ -67,24 +144,29 @@
            showDrawer() {
                this.drawer = true;
            },
            closeDrawer() {
                this.menuList = JSON.parse(JSON.stringify(this.firstMenuList));
                this.drawer = false;
            },
            handleClose(done) {
                this.$confirm('确认关闭?').then(_ => {
                    done();
                 }).catch(_ => {});
             }
                this.menuList = JSON.parse(JSON.stringify(this.firstMenuList));
                done();
            }
        }
    }
</script>
<style scoped>
    ul {list-style: none;margin-bottom: 10px;overflow: hidden;}
    ul li {float: left;margin-bottom: 8px;}
    ul li div {border: 1px solid #3b8e8e;margin-top: 10px;height: 43px;margin-left: 10px;display: flex;align-items: center;justify-content: center;color: #3b8e8e;padding: 7px 15px;border-radius: 2px;border-radius: 2px;white-space: nowrap;cursor: pointer;}
    ul li div,.addMenu{border: 1px solid #3b8e8e;margin-top: 10px;height: 43px;margin-left: 10px;display: flex;align-items: center;justify-content: center;color: #3b8e8e;border-radius: 2px;border-radius: 2px;white-space: nowrap;cursor: pointer;min-width: 112px;}
    ul li div:hover {background-color: #ebf4f4;}
    .addMenu {border: 1px dashed #3b8e8e;}
    ..addMenu:hover {border: 1px dashed #104E8B;}
    .parent-children-title {margin-left: 10px;margin-top: 24px;font-weight: 700;font-size: 14px;text-align: left;color: #333;}
    .parent-children {display: flex;flex-direction: row;flex-wrap: wrap;justify-content: flex-start;align-items: flex-start;padding-left: 10px;box-sizing: border-box;}
    .parent-children span {margin-left: 10px;margin-top: 10px;width: 22%;border: 0.5px solid #20B2AA;border-radius: 2px;height: 43px;display: flex;align-items: center;justify-content: center;cursor: pointer;position: relative;}
    .parent-children span {margin-left: 10px;margin-top: 10px;width: 22%;border: 0.5px solid #20B2AA;border-radius: 2px;height: 43px;display: flex;align-items: center;justify-content: center;cursor: pointer;position: relative;min-width: 112px;}
    .parent-children span:hover {border: 1px solid #104E8B;}
    .triangle-topright {width: 0;height: 0;border-top: 28px solid #3b8e8e;border-left: 28px solid transparent;position: absolute;right: 0;top: 0;}
    .icon-topright {position: absolute;right: 2px;top: 2px;z-index: 2;color: #fff;}
    .drawer-foot {text-align: right;margin-top: 8px;margin-bottom: 8px;margin-right: 20px;}
</style>
src/views/home/widgets/components/welcome.vue
@@ -9,6 +9,9 @@
<script>
    export default {
        title: "公告",
        icon: "el-icon-setting",
        description: "系统内通知、公告通知快速查看",
        data() {
            return {
src/views/login/components/passwordForm.vue
@@ -81,6 +81,7 @@
                        });
                    }
                })
                //获取菜单
                await this.$HTTP.get("/api/blade-system/menu/routes?" + this.$TOOL.qsStringify({"appCode": "CPS"})).then(res=> {
                    if(res.data.length==0){
                        this.islogin = false
@@ -118,48 +119,37 @@
                        });  
                    }   
                    var transformedArray = addComponentToLastLevel(res.data); 
                    transformedArray[0].path = "/home";
                    transformedArray[0].children = [{
                        component: "home",
                        meta: {title: "工作台", icon: 'el-icon-menu', affix: true},
                        name: "工作台",
                        path: "/dashboard"
                    }]
                    // this.$HTTP.get("/api/blade-system/workbench/list?status=1").then(resp=> {
                    //     if(resp.data.length) {
                    //         console.log(resp.data,resp.data[0].name,333);
                            // resp.data.forEach(item=> {
                            //     item.component = "home";
                            //     item.meta = {title: item.nam, icon: 'el-icon-menu', affix: true};
                            //     item.path = "/dashboard";
                            //     item.parentId = item.id;
                            // })
                            // transformedArray[0].path = "/home";
                            // transformedArray[0].children = resp.data;
                    //     }
                    // })
                    //结束
                    var obj = {
                        dashboardGrid: ["welcome", "ver", "time", "progress", "echarts", "about"],
                        menu: transformedArray,
                        permissions: ["list.add", "list.edit", "list.delete", "user.add", "user.edit", "user.delete"]
                    }
                    console.log(transformedArray,123)
                    // this.$API.system.menu.myMenus.get().then(resp=> {
                    //     Object.assign({},transformedArray,resp.data.menu);
                    //     this.$TOOL.data.set("MENU", obj.menu)
                    //     this.$TOOL.data.set("PERMISSIONS", obj.permissions)
                    //     this.$TOOL.data.set("DASHBOARDGRID", obj.dashboardGrid)
                    // });
                    this.$TOOL.data.set("MENU", obj.menu)
                    this.$TOOL.data.set("PERMISSIONS", obj.permissions)
                    this.$TOOL.data.set("DASHBOARDGRID", obj.dashboardGrid)
                    //获取多个工作台
                    this.$HTTP.get("/api/blade-system/workbench/list?status=1").then(resp=> {
                        if(resp.data.length) {
                            //console.log(resp.data,resp.data[0].name,333);
                            resp.data.forEach((item,index)=> {
                                item.component = "home";
                                item.meta = {title: item.name, icon: 'el-icon-menu', affix: true};
                                item.path = "/dashboard";
                                item.parentId = item.id;
                            })
                            transformedArray[0].path = "/home";
                            transformedArray[0].children = resp.data;
                            var obj = {
                                dashboardGrid: ["welcome", "ver", "time", "progress", "echarts", "about"],
                                menu: transformedArray,
                                permissions: ["list.add", "list.edit", "list.delete", "user.add", "user.edit", "user.delete"]
                            }
                            this.$TOOL.data.set("MENU", obj.menu)
                            this.$TOOL.data.set("PERMISSIONS", obj.permissions)
                            this.$TOOL.data.set("DASHBOARDGRID", obj.dashboardGrid)
                            console.log(transformedArray,222)
                            this.$router.replace({
                                path: '/'
                            })
                            this.$message.success("Login Success ç™»å½•成功")
                            this.islogin = false;
                        }
                    })
                })
                this.$router.replace({
                    path: '/'
                })
                this.$message.success("Login Success ç™»å½•成功")
                this.islogin = false;
            }
        }
    }