1
lzhe
2024-10-07 9516d95bdcc481b71d4b090bbdcfff39a84b26d6
1
已修改3个文件
67 ■■■■■ 文件已修改
src/utils/tool.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/home/widgets/index.vue 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/realtime-status/index.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/tool.js
@@ -2,7 +2,7 @@
 * @Descripttion: 工具集
 * @version: 1.2
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-10-07 00:52:31
 * @LastEditTime: 2024-10-07 22:35:14
 */
import CryptoJS from 'crypto-js';
src/views/home/widgets/index.vue
@@ -17,9 +17,9 @@
                    </div>
                    <el-row :gutter="15">
                        <el-col v-for="(item, index) in grid.layout" v-bind:key="index" :md="item" :xs="24">
                            <draggable v-model="grid.copmsList[index]" animation="200" handle=".customize-overlay" group="people" item-key="com" dragClass="aaaaa" force-fallback fallbackOnBody class="draggable-box">
                            <draggable v-model="grid.copmsList[index]" animation="200" handle=".customize-overlay" group="people" item-key="com" dragClass="aaaaa" force-fallback fallbackOnBody class="draggable-box" @add="endDraggable">
                                <template #item="{ element }">
                                    <div class="widgets-item">
                                    <div class="widgets-item" :ref="element">
                                        <component :is="allComps[element]"></component>
                                        <div v-if="customizing" class="customize-overlay">
                                            <el-button class="close" type="danger" plain icon="el-icon-close" size="small" @click="remove(element)"></el-button>
@@ -41,7 +41,7 @@
                </el-header>
                <el-header style="height:auto">
                    <div class="selectLayout">
                        <div class="selectLayout-item item01" :class="{active:grid.layout.join(',')=='12,6,6'}" @click="setLayout([12,6,6])">
                        <!-- <div class="selectLayout-item item01" :class="{active:grid.layout.join(',')=='12,6,6'}" @click="setLayout([12,6,6])">
                            <el-row :gutter="2">
                                <el-col :span="12"><span></span></el-col>
                                <el-col :span="6"><span></span></el-col>
@@ -61,7 +61,7 @@
                                <el-col :span="24"><span></span></el-col>
                                <el-col :span="24"><span></span></el-col>
                            </el-row>
                        </div>
                        </div> -->
                        <div class="selectLayout-item item04" :class="{active:grid.layout.join(',').indexOf('24,12,6,6')>-1}" @click="setLayout([24,12,6,6])">
                            <el-row :gutter="2">
                                <el-col :span="24"><span></span></el-col>
@@ -133,14 +133,7 @@
                        description: allComps[key].description
                    })
                }
                var myCopmsList = this.grid.copmsList.reduce(function(a, b){return a.concat(b)})
                for(let comp of allCompsList){
                    const _item = myCopmsList.find((item)=>{return item === comp.key})
                    if(_item){
                        comp.disabled = true
                    }
                }
                return allCompsList
                return allCompsList;
            },
            myCompsList(){
                var copmsList = [];
@@ -150,7 +143,6 @@
                })
                var myGrid = copmsList;
                this.$TOOL.data.set("DASHBOARDGRID", copmsList);
                //return this.allCompsList.filter(item => !item.disabled && myGrid.includes(item.key))
                return this.allCompsList;
            },
            nowCompsList(){
@@ -163,6 +155,9 @@
            }
        },
        methods: {
            endDraggable(e) {
                console.log(e,this.grid)
            },
            getWorkbenchCarList() {
                var data = this.$TOOL.data.get("MENU");
                this.workid = data[0].children[0].id;  //记录第一个children的id
@@ -193,6 +188,9 @@
                            return 0;
                        });            
                        var layout = [...new Set(cards.map(v => v.cardWide *2))];  //布局
                        if(layout.length < 3) {
                            layout = [24,12,6,6];
                        }
                        var result = {}
                        //排序
                        cards.forEach(v=> {
@@ -218,17 +216,23 @@
                                return obj.cardKey;  
                            });  
                        });  
                        //保证有4个数组,才能拖拽
                        var neededLength = 4 - copmsList.length;
                        for (var i = 0; i < neededLength; i++) {
                            copmsList.push([]);
                        }
                        this.$CONFIG.DEFAULT_GRID.copmsList = copmsList;
                        this.$CONFIG.DEFAULT_GRID.layout = layout;
                        this.$CONFIG.DEFAULT_GRID.data = cards;
                        this.defaultGrid = this.$CONFIG.DEFAULT_GRID;
                        this.grid = this.$TOOL.data.get("grid") || JSON.parse(JSON.stringify(this.defaultGrid));
                        console.log(this.$TOOL.data.get("grid"),JSON.parse(JSON.stringify(this.defaultGrid)),555)
                    }
                })
            },
            //开启自定义
            custom(){
                this.customizing = true
                this.customizing = true;
                const oldWidth = this.$refs.widgets.offsetWidth
                this.$nextTick(() => {
                    const scale =  this.$refs.widgets.offsetWidth / oldWidth
@@ -246,8 +250,23 @@
            },
            //追加
            push(item){
                let target = this.grid.copmsList[0]
                target.push(item.key)
                var that = this;
                var target = this.grid;
                if(this.grid.copmsList.length == 0) {
                    target.copmsList.push([item.key]);
                }else {
                    target.copmsList[0].push(item.key)
                }
                this.$nextTick(()=> {
                    var height = String(Math.floor(this.$refs.Access[0].offsetHeight/ 57));
                    item.cardLength = height;
                    item.cardWide = '12';
                    item.xcoordinate = '0';
                    //item.ycoordinate = '4';
                    item.cardKey = item.key;
                    item.workbenchId = that.workid;
                    target.data.push(item);
                })
            },
            //隐藏组件
            remove(item){
@@ -275,7 +294,6 @@
                        this.$message.success("操作成功");
                    }
                })
                console.log(this.grid,111)
            },
            //恢复默认
            backDefaul(){
src/views/mdc/realtime-status/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-04-09 22:11:21
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-10-07 00:51:38
 * @LastEditTime: 2024-10-07 21:48:45
 * @FilePath: /mdc/Users/mache/Documents/demo/cps-web/src/views/mdc/realtime-status/index.vue
 实时看板
-->
@@ -194,11 +194,18 @@
            this.$HTTP.get("/api/blade-cps/group/get-mdc-group").then(res => {
                if (res.code == 200) {
                    this.stationlabelList = res.data;
                    if(res.data.length != 0) {
                    this.stationlabel = res.data[0].groupName;
                    }
                }
            })
        },
        changestatus(name) {
            if(this.stationlabelList.length == 0) {
                this.station = "状态视图";
                //this.$message.error("不能点击");
                return;
            }
            this.station = name;
            if (this.station == '状态视图') {
                this.workStationGroupIdList = [];
@@ -241,7 +248,8 @@
            }
        },
        goSet() {
            this.$router.push('/mdc/configuration');
            //console.log(this.$TOOL.data.get("MENU"));name == "配置中心"
            this.$router.push('/mdc/configuration');  //分析设置
        },
        gostatus(item) {
            this.$router.push('/mdc/station-live?code=' + item.id);
@@ -382,7 +390,6 @@
                            }
                        });
                    };
                    console.log(this.timestatus,214)
                    // var len = res.data.records.length;
                    // intervalId = setInterval(function() {  
                    //     if (num === len) {