1
lzhe
2024-11-08 4f17438e8199eb44c98d6fcc888dc08ece3bab19
1
已修改2个文件
78 ■■■■ 文件已修改
src/views/mdc/state-feedback.vue 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/time-analysis.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/state-feedback.vue
@@ -2,7 +2,7 @@
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-03-26 10:28:33
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-11-01 14:56:23
 * @LastEditTime: 2024-11-08 18:11:39
 * @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
-->
@@ -12,10 +12,10 @@
            <el-container style="height: 100%;">
                <el-aside width="300px" style="height: 100%;">
                    <el-container style="flex-direction: column;">
                        <div class="left-title">工位</div>
                        <el-main style="padding: 12px 20px 20px;">
                            <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-main>
                        <div class="aposcope-left">
                            <el-row style="margin: 8px;font-size: 14px;">工位</el-row>
                            <MYTree v-model="treeChecked" @loaded="query"></MYTree>
                        </div>
                    </el-container>
                </el-aside>
                <el-container>
@@ -65,19 +65,20 @@
            </el-container>
        </el-card>
    </el-main>
    <save-dialog v-if="dialog.save" ref="saveDialog" :feedBackStatusList="feedBackStatusList" :workstationId="lastLevelId" @success="addfeedbackSuccess" @closed="dialog.save=false"></save-dialog>
    <save-dialog v-if="dialog.save" ref="saveDialog" :feedBackStatusList="feedBackStatusList" :workstationId="treeChecked.toString()" @success="addfeedbackSuccess" @closed="dialog.save=false"></save-dialog>
</template>
<script>
    import { useTransitionFallthroughEmits } from 'element-plus';
    import MYTree from './MYTree.vue'
    import saveDialog from './add-feedback'
    export default {
        name: "state-feedback",
        data(){
            return {
                treeChecked: [],
                dialog: {
                    save: false
                },
                lastLevelId: "",
                feedBackStatusList: [],
                current: "1",
                size: "15",
@@ -104,11 +105,15 @@
            
        },
        mounted(){
            this.getTreeList();
            this.getfeedBackStatusList();  //获取状态list
        },
        components: {
            saveDialog
            saveDialog,MYTree
        },
        watch: {
            treeChecked() {
                this.query()
            }
        },
        methods: {
            table_del(row) {
@@ -173,11 +178,10 @@
                var d = diffDays == 0?"":diffDays + "天";
                return d + diffHours + "小时 " + diffMinutes + "分钟 " + diffSeconds + "秒"
            },
            handleNodeClick(data) {
                if(data.code) {
                    this.lastLevelId = data.id;
            query() {
                if (!this.treeChecked.toString()) return;
                    var obj = {
                        workstationId: this.lastLevelId,
                    workstationId: this.treeChecked.toString(),
                    }
                    if(this.searchData.feedBackStatus.length != 0) {
                        obj.feedBackStatus = this.searchData.feedBackStatus;
@@ -193,27 +197,6 @@
                            this.searchDataList = res.data.records;
                        }
                    })
                }
            },
            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 = {};  
@@ -250,26 +233,9 @@
                })
                return tree;
            },
            getTreeList(flag) {
                var obj = {
                    groupCategory: 1,
                    groupType: "group_workstation"
                }
                this.$HTTP.post("/api/smis/group/groupWorkstation/type",obj).then(res=> {
                    if(res.code == 200) {
                        var treeDisabled = this.addTreeDisable(res.data);
                        this.tableData = this.buildTree(treeDisabled);  //从扁平化变为树状结构
                        this.$nextTick(()=> {
                            this.lastLevelId = this.getLastLevelIds(this.tableData).lastLevelId;
                            this.$refs.treeRef.setCurrentKey(this.lastLevelId);  //第一个节点的第一个子节点最后一级默认选中
                            this.getlist();  //渲染反馈列表
                        })
                    }
                })
            },
            getlist() {
                var obj = {
                    workstationId: this.lastLevelId,
                    workstationId: this.treeChecked.toString(),
                }
                if(this.searchData.feedBackStatus != 0) {
                    obj.feedBackStatus = this.searchData.feedBackStatus;
@@ -322,10 +288,10 @@
    margin: 8px;
}
.aposcope-left {
    width: 240px;
    margin-right: 8px;
    padding: 4px;
    padding: 20px;
    background-color: #fff;
    padding-top: 20px;
}
.aposcope-right {
    flex: 1;
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-11-04 12:11:01
 * @LastEditTime: 2024-11-08 18:13:17
 * @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;">
                            <el-row>
                                <el-col style="margin-bottom: 12px;">日期</el-col>