1
lzhe
2024-11-08 8edd1467e836501162115ef00b51cfbbafa5599c
1
已修改3个文件
141 ■■■■■ 文件已修改
src/views/mdc/components/recordChartsByDate.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/station-live.vue 135 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/status-record.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/components/recordChartsByDate.vue
@@ -85,6 +85,7 @@
            return stauts;
        },
        getCharts() {
            console.log(this.workstationInfoList,111)
            if(this.date == "") return;
            var obj = {
                date: this.date,
src/views/mdc/station-live.vue
@@ -2,15 +2,15 @@
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-03-26 10:28:33
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-10-23 10:34:29
 * @LastEditTime: 2024-11-08 15:55:24
 * @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="aposcope-main">
        <div class="aposcope-left">
            <div class="left-title">查询条件</div>
            <el-tree :data="tableData" node-key="id" default-expand-all :expand-on-click-node="false" :props="defalutProps" @node-click="handleNodeClick" ref="treeRef" highlight-current />
            <el-row style="margin: 8px;font-size: 14px;">工位</el-row>
            <MYTree v-model="treeChecked" @loaded="query"></MYTree>
        </div>
        <div class="aposcope-right">
            <div class="content-machine-box">
@@ -121,17 +121,19 @@
             </el-tabs>
        </div>
    </div>
    <save-dialog v-if="dialog.save" ref="saveDialog"  @success="addfeedbackSuccess" :workstationId="lastLevelId" @closed="dialog.save=false"></save-dialog>
    <save-dialog v-if="dialog.save" ref="saveDialog"  @success="addfeedbackSuccess" :workstationId="treeChecked.toString()" @closed="dialog.save=false"></save-dialog>
</template>
<script>
    import station from "./station.png";
    import moment from 'moment'
    import * as echarts from 'echarts';
    import saveDialog from './add-station-status'
    import saveDialog from './add-station-status';
    import MYTree from './MYTree.vue';
    export default {
        name: "state-feedback",
        data(){
            return {
                treeChecked: [],
                achievements: [],
                collectionstatus: [],
                humanFeedback: "",
@@ -261,7 +263,6 @@
                dialog: {
                    save: false
                },
                lastLevelId: "",
                current: "1",
                size: "15",
                searchData: {
@@ -294,18 +295,22 @@
        created(){
            
        },
        watch: {
            treeChecked() {
                this.query()
            }
        },
        mounted(){
            this.newDate();  //获取当前日期
            this.getTreeList(this.$route.query.code);
        },
        components: {
            saveDialog
            saveDialog,MYTree
        },
        methods: {
            table_edit(){
                this.dialog.save = true
                this.$nextTick(() => {
                    this.$refs.saveDialog.open('edit').setData(this.lastLevelId);
                    this.$refs.saveDialog.open('edit').setData(this.treeChecked.toString());
                })
            },
            alarmSizeChange(val) {
@@ -320,7 +325,7 @@
                this.alarmsearchBtn();
            },
            alarmsearchBtn() {
                this.$HTTP.get(`/api/mdc/work-station-analysis/alarm/${this.lastLevelId}?current=${this.alarmsearchData.current}&size=${this.alarmsearchData.size}`).then(res=> {
                this.$HTTP.get(`/api/mdc/work-station-analysis/alarm/${this.treeChecked.toString()}?current=${this.alarmsearchData.current}&size=${this.alarmsearchData.size}`).then(res=> {
                    if(res.code == 200) {
                        this.alarmtableData = res.data.records;
                        this.alarmtotal = res.data.total;
@@ -338,7 +343,7 @@
                var obj = {
                    date: this.wcsDate,
                    humanFeedback: this.humanFeedback,
                    workstationId: this.lastLevelId
                    workstationId: this.treeChecked.toString()
                }
                this.$HTTP.post(`/api/mdc/status-record/shift-index-status-record-table`,obj).then(res=> {
                    if(res.code == 200) {
@@ -414,7 +419,7 @@
                    date: this.wcsDate,
                    //date : "2024-05-15",
                    humanFeedback: this.humanFeedback,
                    workstationId: this.lastLevelId
                    workstationId: this.treeChecked.toString()
                }
                this.$HTTP.post(`/api/mdc/status-record/shift-index-status-record-chart`,obj).then(res=> {
                    if(res.code == 200) {
@@ -562,7 +567,7 @@
                var obj = {
                    date: this.wcsDate,
                    humanFeedback: this.humanFeedback,
                    workstationId: this.lastLevelId
                    workstationId: this.treeChecked.toString()
                }
                this.$HTTP.post(`/api/mdc/status-record/time-distribution`,obj).then(res=> {
                    if(res.code == 200) {
@@ -601,7 +606,7 @@
                var obj = {
                    date: this.wcsDate,
                    humanFeedback: this.humanFeedback,
                    workstationId: this.lastLevelId
                    workstationId: this.treeChecked.toString()
                }
                this.$HTTP.post(`/api/mdc/status-record/equipment-efficiency`,obj).then(res=> {
                    if(res.code == 200) {
@@ -627,35 +632,33 @@
            addfeedbackSuccess() {
                
            },
            handleNodeClick(data) {
                if(data.code) {
                    this.lastLevelId = data.id;
                    this.$HTTP.get(`/api/smis/workstation/get?workstationId=${this.lastLevelId}`).then(res=> {
                        if(res.code == 200) {
                            if(res.data.avatar == "") {
                                res.data.avatar = station;
                            }
                            this.stationForm = res.data;
                            this.getdmp(this.lastLevelId,this.stationForm.machineId);
                            //this.newDate();  //获取当前日期
                            this.getwcsR();
                            this.getwscLvalue();  //左侧图表
                            this.alarmsearchBtn();  //机器履历
                            this.getrecord();  //班次状态记录table
                            this.getlogcart();  //班次状态记录chart
            query() {
                if (!this.treeChecked.toString()) return;
                this.$HTTP.get(`/api/smis/workstation/get?workstationId=${this.treeChecked.toString()}`).then(res=> {
                    if(res.code == 200) {
                        if(res.data.avatar == "") {
                            res.data.avatar = station;
                        }
                    })
                }
                        this.stationForm = res.data;
                        this.getdmp(this.stationForm.machineId);
                        //this.newDate();  //获取当前日期
                        this.getwcsR();
                        this.getwcsLcolor();  //左侧图表
                        this.alarmsearchBtn();  //机器履历
                        this.getrecord();  //班次状态记录table
                        this.getlogcart();  //班次状态记录chart
                    }
                })
            },
            getdmp(lastLevelId,machineId) {
                this.$HTTP.get(`/api/smis/workstation/listDatapointsByWorkstationId?machineId=${machineId}&workstationId=${lastLevelId}`).then(res=> {
            getdmp(machineId) {
                this.$HTTP.get(`/api/smis/workstation/listDatapointsByWorkstationId?machineId=${machineId}&workstationId=${this.treeChecked.toString()}`).then(res=> {
                    if(res.code == 200) {
                        this.dmpList = [];
                        var that = this;
                        //发送websocket
                        var obj = {
                            type: "realTimeData",
                            workstationIdList: [lastLevelId]
                            workstationIdList: this.treeChecked
                        }
                        if(res.data.dpConfig == null || res.data.dpConfig.length == 0) return;  //没值不用循环
                        if(this.$TOOL.socket.websocket == null) {  //没有建立先建立
@@ -712,26 +715,6 @@
                    }
                })
            },
            getLastLevelIds(tree) {
                if (tree.length === 0) return ""; // 如果没有根节点,返回空
                const lastLevelIds = [];
                const lastLevelCodes = [];
                function traverseTree(node) {
                    if(!node.code) {
                        lastLevelCodes.push(node.id);
                    }
                    if (node.children.length > 0) {
                        node.children.forEach(traverseTree); // 递归遍历子节点
                    } else {
                        if(node.code) {
                            lastLevelIds.push(node.id); // 有code才行
                        }
                    }
                }
                // 只遍历第一个根节点
                traverseTree(tree[0]);
                return {lastLevelCodes,lastLevelId:lastLevelIds[0]}; // 返回lastLevelCodes:没有code的数组。lastLevelId:有code的第一个id
            },
            buildTree(items) {  
              const idMap = {};  
              const tree = [];  
@@ -767,36 +750,6 @@
                })
                return tree;
            },
            getTreeList(id) {
                var obj = {
                    groupCategory: 1,
                    groupType: "group_workstation"
                }
                this.$HTTP.post("/api/smis/group/groupWorkstation/type",obj).then(res=> {
                    if(res.code == 200) {
                        if (res.code == 200) {
                            var treeDisabled = this.addTreeDisable(res.data);
                            this.tableData = this.buildTree(treeDisabled);  //从扁平化变为树状结构
                            this.$nextTick(()=> {
                                if(id) {
                                    this.lastLevelId = id;  //指定id
                                }else {
                                    this.lastLevelId = this.getLastLevelIds(this.tableData).lastLevelId;
                                }
                                this.$refs.treeRef.setCurrentKey(this.lastLevelId);  //第一个节点的第一个子节点最后一级默认选中
                                //以下是初始化数据
                                this.getlist();  //渲染详情和(状态list)
                                this.getwcsLcolor();  //左侧图表
                                this.getwcsR();  //右侧图标
                                this.getachievements();  //班次状态记录采集状态
                                this.getrecord();  //班次状态记录table
                                this.getlogcart();  //班次状态记录chart
                            })
                        }
                    }
                })
            },
            getachievements() { //班次状态记录采集状态
                this.$HTTP.get(`/api/smis/global_wcs/wcs-achievements`).then(res=> {
                    if(res.code == 200) {
@@ -815,17 +768,6 @@
                        this.allwcs = res.data;
                    }
                })
            },
            getlist() {
                this.$HTTP.get(`/api/smis/workstation/get?workstationId=${this.lastLevelId}`).then(res=> {
                    if(res.code == 200) {
                        if(res.data.avatar == "") {
                            res.data.avatar = station;
                        }
                        this.stationForm = res.data;
                        this.getdmp(this.lastLevelId,this.stationForm.machineId);
                    }
                })
            }
        }
    }
@@ -841,6 +783,7 @@
    margin-right: 8px;
    padding: 4px;
    background-color: #fff;
    padding-top: 20px;
}
.aposcope-right {
    flex: 1;
src/views/mdc/status-record.vue
@@ -2,7 +2,7 @@
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-04-26 09:36:18
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-09-19 10:11:58
 * @LastEditTime: 2024-11-08 16:34:22
 * @FilePath: /smart-web/src/views/mdc/status-record.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@@ -12,7 +12,7 @@
            <el-container style="height: 100%;">
                <el-aside width="300px" style="height: 100%;">
                    <el-container>
                        <div class="left-title">查询条件</div>
                        <!-- <div class="left-title">查询条件</div> -->
                        <el-main style="padding: 20px;">
                            <div class="left-title-col">日期</div>
                            <el-date-picker v-model="time" type="daterange" :shortcuts="shortcuts" range-separator="-" size="small" style="width: 100%;" value-format="YYYY-MM-DD"/>
@@ -104,6 +104,7 @@
    },
    watch: {
        treeChecked(select) {
            console.log(select,111)
            var arr = [];
            select.forEach(item=> {
                arr.push({id: item.id,name: item.code})