whychdw
2021-05-25 1426657d8a2542f6afd55fca2af4a92802267009
提交内容
8个文件已修改
2个文件已添加
426 ■■■■■ 已修改文件
src/assets/css/science-blue.css 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/smallModule/mwDrawer.vue 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/smallModule/preOptionList.vue 157 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/dialog/pointTest.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/dialog/testStart.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/dialog/testStepCheck.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/js/api.js 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/loadTest.vue 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/noLoadTest.vue 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/css/science-blue.css
@@ -997,3 +997,14 @@
.text-indent-two {
    text-indent: 2rem;
}
.useless-btn-title {
    position: relative;
}
.useless-btn {
    position: absolute;
    right: 16px;
    top: 4px;
    z-index: 1001;
}
src/components/smallModule/mwDrawer.vue
New file
@@ -0,0 +1,71 @@
<template>
    <div class="mw-drawer" v-show="visible">
        <div class="mw-mask" @click="close"></div>
        <div class="mw-drawer-content">
            <div class="mw-drawer-wrapper">
                <div class="mw-drawer-title">
                    <slot name="title"></slot>
                </div>
                <div class="mw-drawer-content">
                    <slot></slot>
                </div>
                <div class="mw-drawer-footer">
                    <slot name="footer"></slot>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    name: "mwDrawer",
    props: {
        visible: {
            type: Boolean,
            default: false,
        }
    },
    methods: {
        close() {
            this.$emit('update:visible', false);
        }
    }
}
</script>
<style scoped>
.mw-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1002;
}
.mw-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #00000030;
    z-index: 1003;
}
.mw-drawer-content {
    position: absolute;
    width: 400px;
    height: 100%;
    right: 0;
    background-color: #171350;
    z-index: 1004;
}
.mw-drawer-wrapper {
    display: flex;
    flex-direction: column;
}
.mw-drawer-content {
    flex: 1;
    overflow-y: auto;
}
</style>
src/components/smallModule/preOptionList.vue
New file
@@ -0,0 +1,157 @@
<template>
    <div class="pre-option-list">
        <table>
            <thead>
            <tr>
                <th>状态名称</th>
                <th>状态</th>
            </tr>
            </thead>
            <tbody>
            <tr v-for="(item, key) in list" :key="'key'+key">
                <td>{{item.label}}</td>
                <td>
                    <el-switch v-model="item.value" @change="changeOption(item)"></el-switch>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</template>
<script>
import MwSwitch from '@/components/smallModule/mwSwitch.vue';
import {changePreOption, checkPrecondition} from "@/pages/test/js/api";
export default {
    name: "preOptionList",
    props: {
        type: {
            type: String,
            default: ""
        }
    },
    components: {
        MwSwitch
    },
    data() {
        return {
            list: [
                {
                    id: 1,
                    key: 1,
                    label: '进线屏开关状态',
                    value: true,
                    on: 1,
                    off: 0
                },
                {
                    id: 2,
                    label: '大功率整流电源电压',
                    value: true,
                    on: 500,
                    off: 400
                },
                {
                    id: 3,
                    label: '直流配电板A排电压',
                    value: true,
                    on: 500,
                    off: 400
                },
                {
                    id: 4,
                    label: '直流配电板B排电压',
                    value: true,
                    on: 0,
                    off: 100
                },
                {
                    id: 5,
                    label: '油站',
                    value: true,
                    on: 1,
                    off: 0
                },
                {
                    id: 6,
                    label: '水站',
                    value: true,
                    on: 1,
                    off: 0
                },
                {
                    id: 7,
                    label: '被试电机通讯',
                    value: true,
                    on: 1,
                    off: 0
                },
            ]
        }
    },
    methods: {
        checkPrecondition() {
            checkPrecondition(this.type).then(res => {
                let rs = res.data;
                let data = [];
                if (rs.code != 0) {
                    data = rs.data;
                }
                data.map(item=>{
                    for(let i=0; i<this.list.length; i++) {
                        if(item.name == this.list[i].label) {
                            this.list[i].value = item.status?true: false;
                        }
                    }
                });
            }).catch(error => {
                this.loading = false;
                console.log(error);
            });
        },
        changeOption(data) {
            let value = data.value?data.on:data.off;
            changePreOption(data.id, value).then(res=>{
                let rs = res.data;
                if(rs.code == 1) {
                    this.$layer.msg("修改成功");
                }else {
                    this.$layer.msg("修改失败");
                }
                this.$nextTick(()=>{
                    this.checkPrecondition();
                });
            }).catch(error=>{
            });
        }
    },
    mounted() {
        this.checkPrecondition();
    }
}
</script>
<style scoped>
.pre-option-list {
    font-size: 16px;
    color: #FFFFFF;
}
.pre-option-list table {
    width: 100%;
    border-collapse: collapse;
}
.pre-option-list table th,
.pre-option-list table td {
    border: 2px solid #6261CB;
    padding: 8px 8px;
    text-align: center;
}
.pre-option-list table th {
    color: #FFF034;
    border-top: 2px solid #797979;
    border-left: 2px solid #797979;
    border-right: 2px solid #797979;
}
</style>
src/pages/index.vue
@@ -18,6 +18,7 @@
<script>
  import PageMenu from '@/components/PageMenu'
  import PageHeader from '@/components/PageHeader'
  export default {
    components: {
      PageMenu,
@@ -36,6 +37,9 @@
        this.hover = false
      }
    },
    mounted() {
    }
  }
</script>
src/pages/test/dialog/pointTest.vue
@@ -22,12 +22,13 @@
                            </el-col>
                        </el-row>
                    </div>
                    <test-step-check :type="type"></test-step-check>
                    <test-step-check :type="type" @checkStatus="checkStatus" ref="testStepCheck"></test-step-check>
                </div>
            </el-form>
        </div>
        <div class="footer-button">
            <el-button type="primary" size="small" @click="proceedTest">继续试验</el-button>
            <el-button type="primary" size="small" @click="reCheck" >重新检查</el-button>
            <el-button type="primary" size="small" @click="proceedTest" :disabled="!status">继续试验</el-button>
        </div>
    </div>
</template>
@@ -55,12 +56,20 @@
        }
    },
    data() {
        return {}
        return {
            status: false,
        }
    },
    methods: {
        proceedTest() {
            this.$emit('proceedTest', this.point);
        },
        checkStatus(status) {
            this.status = status;
        },
        reCheck() {
            this.$refs.testStepCheck.checkPrecondition();
        }
    }
}
</script>
src/pages/test/dialog/testStart.vue
@@ -8,10 +8,11 @@
                <p class="p-h">当前步骤</p>
                <p class="text-indent-two">① 被试电机在额定频率,额定电压及额定负载下运行到温升稳定</p>
            </div>
            <test-step-check :type="type"></test-step-check>
            <test-step-check :type="type" @checkStatus="checkStatus" ref="testStepCheck"></test-step-check>
        </div>
        <div class="footer-button">
            <el-button type="primary" size="small" @click="startTest">开始下一步</el-button>
            <el-button type="primary" size="small" @click="reCheck" >重新检查</el-button>
            <el-button type="primary" size="small" @click="startTest" :disabled="!status">开始下一步</el-button>
        </div>
    </div>
</template>
@@ -28,11 +29,20 @@
        }
    },
    data() {
        return {}
        return {
            status: false,
            check: true,
        }
    },
    methods: {
        startTest() {
            this.$emit('startTest');
        },
        checkStatus(status) {
            this.status = status;
        },
        reCheck() {
            this.$refs.testStepCheck.checkPrecondition();
        }
    }
}
src/pages/test/dialog/testStepCheck.vue
@@ -13,7 +13,7 @@
                <tr v-for="(item, key) in list" :key="'item'+key">
                    <td class="td-name">{{ item.name }}</td>
                    <td>{{ item.valueDescription }}</td>
                    <td class="td-status">{{ item.status ? "检查正常" : "检查异常" }}</td>
                    <td class="td-status" :class="{'td-status-error':!item.status}">{{ item.status ? "检查正常" : "检查异常" }}</td>
                </tr>
                </tbody>
            </table>
@@ -51,7 +51,16 @@
                    }
                    this.list = data;
                    this.loading = false;
                    let checkStatus = true;
                    for(let i=0; i<data.length; i++) {
                        let item = data[i];
                        if(item.status == 0) {
                            checkStatus = false;
                            break;
                        }
                    }
                    this.showButton = true;
                    this.$emit('checkStatus', checkStatus);
                }).catch(error => {
                    this.loading = false;
                    console.log(error);
@@ -75,7 +84,7 @@
}
.test-check {
    min-height: 150px;
    min-height: 200px;
}
.test-explain table {
@@ -93,4 +102,7 @@
.test-explain table td.td-status {
    font-weight: 700;
}
.td-status.td-status-error {
    color: #FF0000;
}
</style>
src/pages/test/js/api.js
@@ -171,6 +171,11 @@
}
/**
 * 完成试验
 * @param experimentId
 * @returns {AxiosPromise}
 */
export const completeTest = (experimentId)=>{
    return axios({
        method: "POST",
@@ -180,3 +185,29 @@
        },
    });
}
/**
 * 手动结束试验测试点
 * @param id
 * @returns {AxiosPromise}
 */
export const stopTestPoint = (id)=>{
    return axios({
        method: "POST",
        url: "/experiment/finishExperimentPoint",
        params: {
            id: id
        },
    });
}
export const changePreOption = (id, value)=> {
    return axios({
        method: "PUT",
        url: "/experiment/precondition",
        params: {
            id,
            value
        },
    });
}
src/pages/test/loadTest.vue
@@ -61,7 +61,13 @@
            </div>
            <div class="modelItemWarp top" style="width:31%;">
                <div class="content">
                    <div class="title">实时曲线</div>
                    <div class="title useless-btn-title">
                        实时曲线
                        <div class="useless-btn">
                            <el-button type="primary" size="mini" @click="drawer=true">前置条件设置</el-button>
                        </div>
                    </div>
                    <div class="double-line-wrapper">
                        <div class="h30percent">
                            <div class="chartTitle">受试电机电压电流</div>
@@ -197,12 +203,16 @@
                        <div class="stepBtnCon">
                            <el-button type="primary" size="mini">查看结果</el-button>
                            <el-button type="primary" size="mini">完成试验</el-button>
                            <el-button type="primary" size="mini" :disabled="!progressStep" @click="nextStepTest">下步试验</el-button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <load-test-dialog :type="type" :visible="dialogVisible" @updateList="updateList"></load-test-dialog>
        <mw-drawer :visible.sync="drawer">
            <pre-option-list :type="type" v-if="drawer"></pre-option-list>
        </mw-drawer>
    </div>
</template>
@@ -216,6 +226,9 @@
import StepList from '@/components/smallModule/stepList.vue';
import absPanel from '@/components/smallModule/absPanel.vue';
import LoadTestDialog from "@/pages/test/dialog/LoadTestDialog";
import {stopTestPoint} from "@/pages/test/js/api";
import MwDrawer from "@/components/smallModule/mwDrawer";
import PreOptionList from "@/components/smallModule/preOptionList";
let diagram;
export default {
@@ -229,6 +242,8 @@
        MwSwitch,
        StepList,
        absPanel,
        MwDrawer,
        PreOptionList,
    },
    data() {
        return {
@@ -380,6 +395,7 @@
                    unit: "V",
                },
            ],
            drawer: false,
        }
    },
    watch: {
@@ -469,9 +485,41 @@
        },
        updateList(list) {
            this.list = list;
        },
        nextStepTest() {
            let step = this.progressStep;
            let id = step.id;
            let name = step.name;
            this.$confirm("确认手动完成"+name+'测试', "系统提示", {
                type: 'warning'
            }).then(res=>{
                stopTestPoint(id).then(res=>{
                    let rs = res.data;
                    if(rs.code == 1) {
                        this.$layer.msg("手动完成成功!");
                    }else {
                        this.$layer.msg("手动完成失败!");
                    }
                }).catch(error=>{
                    this.$layer.msg("网络通讯异常");
                });
            }).catch(error=>{});
        }
    },
    computed: {},
    computed: {
        progressStep() {
            let list = this.list;
            let step = false;
            for(let i=0; i<list.length; i++) {
                let item = list[i];
                if(item.status == 1) {
                    step = item;
                    break;
                }
            }
            return step;
        },
    },
    mounted() {
        this.initChart();
        diagram = gridCircuitDiagram(this.$refs.static, this.$refs.flush);
src/pages/test/noLoadTest.vue
@@ -55,7 +55,12 @@
            </div>
            <div class="modelItemWarp top" style="width:31%;">
                <div class="content">
                    <div class="title">实时曲线</div>
                    <div class="title useless-btn-title">
                        实时曲线
                        <div class="useless-btn">
                            <el-button type="primary" size="mini" @click="drawer=true">前置条件设置</el-button>
                        </div>
                    </div>
                    <div class="con">
                        <div class="chartTitle">空载电机电压与高速齿轮关系曲线</div>
                        <div class="lineCon">
@@ -190,12 +195,16 @@
                        <div class="stepBtnCon">
                            <el-button type="primary" size="mini">查看结果</el-button>
                            <el-button type="primary" size="mini">完成试验</el-button>
                            <el-button type="primary" size="mini" :disabled="!progressStep" @click="nextStepTest">下步试验</el-button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <load-test-dialog :type="type" :visible="dialogVisible" @updateList="updateList"></load-test-dialog>
        <mw-drawer :visible.sync="drawer">
            <pre-option-list :type="type" v-if="drawer"></pre-option-list>
        </mw-drawer>
    </div>
</template>
@@ -211,10 +220,15 @@
import MwSectionProcess from '@/components/smallModule/mwSectionProcess.vue';
import MwThermometer from '@/components/smallModule/mwThermometer.vue';
import LoadTestDialog from "@/pages/test/dialog/LoadTestDialog";
import {stopTestPoint} from "@/pages/test/js/api";
import MwDrawer from "@/components/smallModule/mwDrawer";
import PreOptionList from "@/components/smallModule/preOptionList";
let diagram;
export default {
    components: {
        PreOptionList,
        MwDrawer,
        barChart,
        DoubleLine,
        StepList,
@@ -308,7 +322,8 @@
                color: '#666ee8',
                status: true
            }],
            list: []
            list: [],
            drawer: false,
        }
    },
    watch: {
@@ -367,7 +382,41 @@
        },
        updateList(list) {
            this.list = list;
        },
        nextStepTest() {
            let step = this.progressStep;
            let id = step.id;
            let name = step.name;
            this.$confirm("确认手动完成"+name+'测试', "系统提示", {
                type: 'warning'
            }).then(res=>{
                stopTestPoint(id).then(res=>{
                    let rs = res.data;
                    if(rs.code == 1) {
                        this.$layer.msg("手动完成成功!");
                    }else {
                        this.$layer.msg("手动完成失败!");
        }
                }).catch(error=>{
                    this.$layer.msg("网络通讯异常");
                });
            }).catch(error=>{});
        }
    },
    computed: {
        progressStep() {
            let list = this.list;
            let step = false;
            for(let i=0; i<list.length; i++) {
                let item = list[i];
                if(item.status == 1) {
                    step = item;
                    break;
                }
            }
            return step;
        },
    }
}
</script>