1
lzhe
2024-05-14 6815d4a6a0c69cb6879e957404dfeb500cf7c4b5
1
已修改4个文件
248 ■■■■ 文件已修改
src/views/console/system/meta-object-type/index.vue 157 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/components/recordChartsByDate.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/status-record.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/time-analysis.vue 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/console/system/meta-object-type/index.vue
@@ -2,7 +2,7 @@
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-03-26 10:28:33
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-05-13 16:28:30
 * @LastEditTime: 2024-05-14 16:22:28
 * @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
-->
@@ -33,8 +33,8 @@
            </div>
            <div class="right-content">
                <div class="content-title">编码字段</div>
                <el-select v-model="metaForm.test">
                    <el-option v-for="item in refCodeList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
                <el-select v-model="metaForm.code">
                    <el-option v-for="item in refCodeList" :key="item.columnName" :label="item.columnName" :value="item.columnName"/>
                </el-select>
            </div>
            <div class="right-content">
@@ -43,39 +43,51 @@
            </div>
            <el-table ref="searchDataListRef" :data="searchDataList" border style="width: 100%;margin-top: 20px;" class="multipleTableRef">
                <el-table-column prop="fcode" label="字段编码">
                    <template #default="scope">
                        <el-select v-if="scope.row.isEdit" v-model="tableForm.fcode">
                            <el-option v-for="item in refCodeList" :key="item.columnName" :label="item.columnName" :value="item.columnName"/>
                        </el-select>
                    <template #default="scope">
                        <div v-if="scope.row.isEdit">
                            <span class="important-star">*</span>
                            <el-select v-model="tableForm.fcode" style="width: 90%;">
                                <el-option v-for="item in refCodeList" :key="item.columnName" :label="item.columnName" :value="item.columnName"/>
                            </el-select>
                        </div>
                        <div v-else>{{scope.row.fcode}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="fname" label="字段标题">
                    <template #default="scope">
                        <el-input v-if="scope.row.isEdit" v-model="tableForm.fname"></el-input>
                        <div v-if="scope.row.isEdit">
                            <span class="important-star">*</span>
                            <el-input v-model="tableForm.fname" style="width: 90%;"></el-input>
                        </div>
                        <div v-else>{{scope.row.fname}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="field" label="实体属性">
                    <template #default="scope">
                        <el-input v-if="scope.row.isEdit" v-model="tableForm.field"></el-input>
                        <div v-if="scope.row.isEdit">
                            <span class="important-star">*</span>
                            <el-input v-model="tableForm.field" style="width: 90%;"></el-input>
                        </div>
                        <div v-else>{{scope.row.field}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="elementTypeName" label="元素类型">
                    <template #default="scope">
                        <el-select v-if="scope.row.isEdit" v-model="tableForm.elementTypeName">
                            <el-option v-for="item in dictionaryType" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
                        </el-select>
                <el-table-column prop="elementType" label="元素类型">
                    <template #default="scope">
                        <div v-if="scope.row.isEdit">
                            <span class="important-star">*</span>
                            <el-select v-model="tableForm.elementType" @change="elementTypeNameChange" style="width: 90%;">
                                <el-option v-for="item in dictionaryType" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
                            </el-select>
                        </div>
                        <div v-else>{{scope.row.elementTypeName}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="enumType" label="枚举类型">
                    <template #default="scope">
                        <el-select v-if="scope.row.isEdit" v-model="tableForm.enumType" disabled>
                            <el-option v-for="item in testList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
                        <el-select v-if="scope.row.isEdit" v-model="tableForm.enumType" :disabled="tableForm.elementType!='4'" @change = enumTypeChange>
                            <el-option v-for="item in dictList" :key="item.id" :label="item.code" :value="item.id"/>
                        </el-select> 
                        <div v-else>{{scope.row.enumType}}</div>
                        <div v-else>{{scope.row.enumTypeZn}}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="seq" label="字段顺序">
@@ -86,10 +98,8 @@
                </el-table-column>
                <el-table-column prop="refObjectTypeId" label="引用关系">
                    <template #default="scope">
                        <el-select v-if="scope.row.isEdit" v-model="tableForm.refObjectTypeId" disabled>
                            <el-option v-for="item in testList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
                        </el-select>
                        <div v-else>{{scope.row.refObjectTypeId}}</div>
                        <el-tree-select v-if="scope.row.isEdit" node-key="id" :props="defalutProps" v-model="tableForm.refObjectTypeId" :data="tableData" :render-after-expand="false" :disabled="tableForm.elementType!='5'" @node-click="handleNodeClick1"/>
                        <div v-else>{{scope.row.refObjectTypeIdZn}}</div>
                    </template>
                </el-table-column>
                <el-table-column label="操作">
@@ -99,14 +109,14 @@
                            <el-button size="small" @click="cancelTable">取消</el-button>
                        </div>
                        <div v-else>
                            <el-icon class="operationIcon"><Edit /></el-icon>
                            <el-icon class="operationIcon"><Delete /></el-icon>
                            <!-- <el-icon class="operationIcon" @click="editTable(scope.$index)"><Edit /></el-icon> -->
                            <el-icon class="operationIcon" @click="deleteTable(scope.$index)"><Delete /></el-icon>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
            <div class="saveBtn">
                <el-button type="primary" @click="saveBtn">保存</el-button>
                <el-button type="primary" @click="saveBtn" :disabled="isAdd">保存</el-button>
            </div>
        </div>
    </div>
@@ -121,12 +131,15 @@
        name: "metaObject",
        data(){
            return {
                dictList: [],  //枚举类型
                elementTypeValue: "",
                detailobj: {},
                testList: [],
                tableForm: {
                    fcode: "",
                    fname: "",
                    field: "",
                    elementTypeName: "",
                    elementType: "",
                    enumType: "",
                    seq: 0,
                    refObjectTypeId: ""
@@ -139,7 +152,8 @@
                metaForm: {
                    tableName: "",
                    refCode: "",
                    refName: ""
                    refName: "",
                    code: ""
                },
                classificationRules: {
                    classify: [
@@ -168,16 +182,53 @@
        },
        mounted(){
            this.getDictionary();  //字典类型
            this.getDict(); //枚举类型
        },
        components: {
            ...ElementPlusIconsVue
        },
        methods: {
            getDict() {  //枚举类型
                this.$HTTP.get("/api/blade-system/dict/list").then(res=> {  //物理表
                    if(res.code == 200) {
                        this.dictList = res.data;
                    }
                })
            },
            editTable(index) {
                this.isAdd = true;
                var obj = Object.assign({},this.searchDataList[index],{isEdit: true});
                this.searchDataList.splice(index,1,obj);
                console.log(obj,this.searchDataList[index])
            },
            deleteTable(index) {
                this.searchDataList.splice(index,1);
            },
            enumTypeChange(val) {  //枚举类型
                this.dictList.forEach(item=> {
                    if(item.id == val) {
                        this.tableForm.enumTypeZn = item.code;
                    }
                })
            },
            elementTypeNameChange(val) {  //元素类型
                this.dictionaryType.forEach(item=> {
                    if(item.dictKey == val) {
                        this.elementTypeValue = item.dictValue;
                    }
                })
                this.tableForm.enumType = "";
                this.tableForm.refObjectTypeId = "";
            },
            saveBtn() {
                var obj = Object.assign(this.detailobj,this.metaForm);
                console.log(this.searchDataList,'okla');
            },
            comfirmTable() {
                this.cancelTable();  //还原
                this.cancelTable();
                this.tableForm.elementTypeName = this.elementTypeValue;
                this.tableForm.id = null;
                this.tableForm.objectId = this.detailobj.objectId;
                this.searchDataList.unshift(this.tableForm);
            },
            cancelTable() {
@@ -185,8 +236,19 @@
                this.isAdd = false;
            },
            addParameter() {
                this.tableForm = {
                    fcode: "",
                    fname: "",
                    field: "",
                    elementType: "",
                    enumType: "",
                    seq: 0,
                    refObjectTypeId: ""
                }
                this.isAdd = true;
                this.searchDataList.unshift({isEdit: true});
                var obj = Object.assign({},this.tableForm,{isEdit: true})
                obj.id = null;
                this.searchDataList.unshift(obj);
            },
            getDictionary() {  //字典类型
                this.$HTTP.get("/api/blade-system/dict/dictionary?code=element_type").then(res=> {  //物理表
@@ -217,15 +279,19 @@
            gettableName() {
                this.$HTTP.get(`/api/blade-system/meta-object-type/detail?fId=${this.dictKey}`).then(res=> {  //物理表数据
                    if(res.code == 200) {
                        console.log(this.tableNameList,res.data.tableName,'gi')
                        this.tableNameList.forEach(item=> {
                            if(res.data.tableName == item.tableName) {
                                this.refCodeList = item.tableColumns;
                            }
                        })
                        console.log(this.refCodeList,111)
                        this.metaForm.tableName = res.data.tableName;
                        this.metaForm.refCode = res.data.refCode;
                        this.metaForm.refName = res.data.refName;
                        this.metaForm.code = res.data.code;
                        this.detailobj = res.data;
                        this.detailobj.objectId = res.data.fid;
                        console.log(this.detailobj,888)
                    }
                })
            },
@@ -233,7 +299,11 @@
                this.$HTTP.get(`/api/blade-system/meta-object-type-field/list?objectId=${this.dictKey}`).then(res=> {  //表格数据
                    if(res.code == 200) {
                        this.searchDataList = res.data;
                        this.dictionaryType.forEach(item=> {
                        res.data.forEach(item=> {
                            item.enumTypeZn = item.enumType;  //枚举类型
                            item.refObjectTypeIdZn = item.refObjectTypeId;  //引用关系
                        })
                        this.dictionaryType.forEach(item=> {  //元素类型
                            this.searchDataList.forEach(item1=> {
                                if(item1.elementType == item.dictKey) {
                                    item1.elementTypeName = item.dictValue;
@@ -252,24 +322,9 @@
                    this.$refs.dialogForm.resetFields();
                };
            },
            classificationSubmit() {
                this.$refs.dialogForm.validate(async (valid) => {
                    if (valid) {
                        this.isSaveing = false;
                        // this.$HTTP.post("/api/blade-system/data-scope/submit",obj).then(res=> {
                        //     this.isSaveing = false;
                        //     if(res.code == 200) {
                        //         this.$emit('success', this.addDictForm, this.mode);
                        //         this.visible = false;
                        //         this.$message.success("操作成功");
                        //     }else {
                        //         this.$alert(res.message, "提示", {type: 'error'});
                        //     }
                        // })
                    }else{
                        return false;
                    }
                })
            handleNodeClick1(data) {
                if(this.firstChild.includes(data.id)) return;  //一级菜单返回
                this.tableForm.refObjectTypeIdZn = data.dictValue;
            },
            handleNodeClick(data) {
                if(!this.firstChild.includes(data.id)) {
@@ -369,4 +424,8 @@
    margin-top: 20px;
    text-align: right;
}
.important-star {
    margin-right: 4px;
    color: red;
}
</style>
src/views/mdc/components/recordChartsByDate.vue
@@ -14,7 +14,7 @@
import * as echarts from 'echarts';
export default {
    components: {saveDialog},
    props: ['collectionstatus','date','workstationInfoList'],
    props: ['achievements','date','workstationInfoList'],
    watch: {
        date(val) {
            this.current = "1";
@@ -75,8 +75,9 @@
        },
        getColor(name) {
            var color = '';
            this.collectionstatus.forEach(item=> {
                if(item.name == name) {
            console.log(this.achievements,name);
            this.achievements.forEach(item=> {
                if(item.code == name) {
                    color = item.color;
                }
            })
@@ -103,7 +104,8 @@
                            var startTime = moment(item1.startTime).diff(moment(initstart + " 00:00:00"), 'minutes');
                            var endTime = moment(item1.endTime).diff(moment(initstart + " 00:00:00"), 'minutes');
                            var diff = moment(item1.endTime).diff(moment(item1.startTime), 'minutes') //开始了多久
                            var color = this.getColor(item1.wcsDesc);
                            var color = this.getColor(item1.wcs);
                            console.log(color,222)
                            item1.value = [index,startTime,endTime,diff];
                            item1.itemStyle = {"normal": {"color": color}};
                            item1.code = item.workstationInfo.code;
@@ -114,6 +116,7 @@
                    })
                    this.total = res.data.total;
                    //渲染图表
                    console.log(yAxisData,newData,111)
                    this.setCharts(yAxisData,newData);
                    // 检查是否存在id为'parentNodeDom'的DOM元素,有就先删除
                    var parentNodeDom = document.getElementById('parentNodeDom');  
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-04-26 18:07:52
 * @LastEditTime: 2024-05-14 18:41:53
 * @FilePath: /smart-web/src/views/mdc/status-record.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@@ -42,7 +42,7 @@
                    <!-- collectionstatus 反馈状态
                    date 日期
                    workstationInfoList 工位list -->
                    <record-charts-by-date :collectionstatus="collectionstatus" :date="date" :workstationInfoList="workstationInfoList" v-if="collectionstatus.length != 0"></record-charts-by-date>
                    <record-charts-by-date :achievements="achievements" :date="date" :workstationInfoList="workstationInfoList" v-if="achievements.length != 0"></record-charts-by-date>
                </el-tab-pane>
                <el-tab-pane label="按工位查看" name="time">
                    <div class="fact-analysis-realtim">
src/views/mdc/time-analysis.vue
@@ -2,7 +2,7 @@
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-04-26 09:36:18
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-05-02 20:46:36
 * @LastEditTime: 2024-05-14 18:30:07
 * @FilePath: /smart-web/src/views/mdc/status-record.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@@ -48,7 +48,7 @@
                            <el-collapse v-model="activeNames" accordion>
                            <el-collapse-item v-for="(item,index) in setTitle" :name="index + 1">
                                <template #title>
                                    <el-icon size="16" color="#409eff"><Memo /></el-icon>
                                    <el-icon size="16" color="#3b8e8e"><Memo /></el-icon>
                                    <span class="collr-title">班次{{index + 1}}</span>
                                    <el-button size="small">{{item.indexName}}</el-button>
                                </template>
@@ -81,7 +81,7 @@
                            <el-collapse v-model="activeNames1" accordion>
                                <el-collapse-item v-for="(item,index) in setTitle1" :name="index + 1">
                                    <template #title>
                                        <el-icon size="16" color="#409eff"><Memo /></el-icon>
                                        <el-icon size="16" color="#3b8e8e"><Memo /></el-icon>
                                        <span class="collr-title">{{item.name}}</span>
                                        <el-button size="small" v-if="index != 0">{{item.indexName}}</el-button>
                                    </template>
@@ -136,6 +136,7 @@
            btnLeftList: [{title: "按工位统计",id:"1"},{title: "按工位组统计",id:"2"}],
            btnLeftctive: "1",
            isshowempty: true,
            getGlobalColorList: [],
            shortcuts: [
                {
                    text: '最近3天',
@@ -180,6 +181,7 @@
                        params.forEach(item=> {
                            dom += `<div>${item.marker}${item.seriesName}:${item.data}%</div>`
                        })
                        console.log(params)
                        return dom;
                    }
                },
@@ -198,7 +200,7 @@
                    show: true,
                    axisLabel: {
                        formatter: function (value) {
                            return value * 100 + "%";
                            return value + "%";
                        }
                    },
                    data: [2,20,40,60,80,100]
@@ -322,8 +324,16 @@
        this.init();
        this.getTree2List();  //按工位统计树
        this.getDataA();
        this.getGlobal(); //获取颜色
    },
    methods: {
        getGlobal() {
            this.$HTTP.get(`/api/blade-cps/global_wcs/list`).then(res=> {
                if(res.code == 200) {
                    this.getGlobalColorList = res.data;
                }
            })
        },
        getDataA() {
            if(this.btnLeftctive == 1) {  //按工位统计
                var obj = {
@@ -369,17 +379,43 @@
            
            // 排除运行时间为0的情况  
            var totalRunTime = timeSums[0] || 1;  
            // 计算每个状态的百分比数据  
            var lastData = Object.keys(resultObject).map(key => {
                var data = resultObject[key].map((item, index) => {
                    if (index === 0) { // 只计算时间的百分比
                        return item == 0?0:Number((item / totalRunTime * 100).toFixed(2));
                    } else {
                        return item; // 计数保持不变
                    }
                });
                return {
            // var lastData = Object.keys(resultObject).map(key => {
            //     var data = resultObject[key].map((item, index) => {
            //         if (index === 0) { // 只计算时间的百分比
            //             return item == 0?0:Number((item / totalRunTime * 100).toFixed(2));
            //         } else {
            //             return item; // 计数保持不变
            //         }
            //     });
            //     return {
            //         name: key,
            //         type: 'bar',
            //         stack: 'total',
            //         label: {
            //             show: false
            //         },
            //         emphasis: {
            //             focus: 'series'
            //         },
            //         barWidth: 60,
            //         data
            //     }
            // });
            var lastData = [];
            var colorObj = {};  //设置颜色
            this.getGlobalColorList.forEach(item=> {
                colorObj[item.name] = item.color;
            })
            Object.keys(resultObject).map(key => {
                resultObject[key].forEach((item,index)=> {
                    if(item != 0) {
                        var num = item/timeSums[index]* 100;
                        item = num.toFixed(2);
                    }
                    resultObject[key][index] = item;
                })
                lastData.push({
                    name: key,
                    type: 'bar',
                    stack: 'total',
@@ -389,11 +425,14 @@
                    emphasis: {
                        focus: 'series'
                    },
                    itemStyle: {
                        "color": colorObj[key]
                    },
                    barWidth: 60,
                    data
                }
            });
            return lastData;
                    data: resultObject[key]
                })
            })
            return lastData.reverse();
        },
        getDataChartsA(index) {
            var obj = {
@@ -424,6 +463,7 @@
                    this.chartOptionA.series = this.formatChartData(res.data.countStatus);
                    var myChart = echarts.init(recordDom);
                    myChart.setOption(this.chartOptionA);
                    console.log(JSON.stringify(this.chartOptionA))
                }
            })
        },