whychdw
2021-05-24 393c717d50fe8933e57d3014c6932b2acb750a50
提交内容
6个文件已修改
2个文件已添加
251 ■■■■ 已修改文件
src/assets/css/science-blue.css 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/dialog/LoadTestDialog.vue 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/dialog/testStart.vue 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/dialog/testStepCheck.vue 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/js/api.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/js/const.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/loadTest.vue 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/test/noLoadTest.vue 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/css/science-blue.css
@@ -990,3 +990,10 @@
.el-dialog__wrapper.position-absolute {
    position: absolute;
}
.test-explain p{
    line-height: 1.32rem;
}
.text-indent-two {
    text-indent: 2rem;
}
src/pages/test/dialog/LoadTestDialog.vue
@@ -1,4 +1,5 @@
<template>
    <div class="el-dialog-wrapper">
    <el-dialog
        :visible.sync="dialogVisible" class="position-absolute dialog-center dialog-no-header" width="840px"
        top="0" :modal="false" :destroy-on-close="true" :close-on-press-escape="false" :close-on-click-modal="false"
@@ -20,6 +21,15 @@
            </div>
        </div>
    </el-dialog>
        <el-dialog
            :visible.sync="testStepCheck" class="position-absolute dialog-center dialog-no-header"
            width="840px" top="0"
            :modal="false" :destroy-on-close="true"
            :close-on-press-escape="false" :close-on-click-modal="false"
            :modal-append-to-body="false">
            <test-start :type="type" @startTest="startTest" v-if="testStepCheck"></test-start>
        </el-dialog>
    </div>
</template>
<script>
@@ -28,6 +38,7 @@
import TestDataInput from "@/pages/test/dialog/testDataInput";
import TestStepConfirm from "@/pages/test/dialog/testStepConfirm";
import testStepConfirmKz from "@/pages/test/dialog/testStepConfirmKz";
import TestStart from "@/pages/test/dialog/testStart";
import {addKzFzTest} from "@/pages/test/js/api";
export default {
@@ -47,13 +58,15 @@
        TestDataInput,
        mwStep,
        newTest,
        testStepConfirmKz
        testStepConfirmKz,
        TestStart
    },
    data() {
        return {
            loading: false,
            step: 0,
            dialogVisible: false,
            testStepCheck: false,
            params: {
                baseData: {
                    experimentId: "",           // 试验编号
@@ -113,11 +126,11 @@
            this.loading = true;
            addKzFzTest(this.params).then(res => {
                let rs = res.data;
                console.log(rs);
                if (rs.code == 1) {
                    this.dialogVisible = false;
                    this.$nextTick(() => {
                        this.$layer.msg("生成试验成功");
                        this.testStepCheck = true;
                    });
                } else {
                    this.$layer.msg("生成试验失败");
@@ -128,6 +141,9 @@
                this.loading = false;
            });
        },
        startTest() {
            console.log(123);
        }
    },
    mounted() {
        this.params.type = this.type;
src/pages/test/dialog/testStart.vue
New file
@@ -0,0 +1,38 @@
<template>
    <div class="params-container params-container-flex">
        <div class="form-title">
        </div>
        <div class="form-wrapper">
            <div class="test-explain">
                <p class="p-h">当前步骤</p>
                <p class="text-indent-two">① 被试电机在额定频率,额定电压及额定负载下运行到温升稳定</p>
            </div>
            <test-step-check :type="type"></test-step-check>
        </div>
        <div class="footer-button">
        </div>
    </div>
</template>
<script>
import TestStepCheck from "@/pages/test/dialog/testStepCheck";
export default {
    name: "testStart",
    components: {TestStepCheck},
    props: {
        type: {
            type: String,
            default: "",
        }
    },
}
</script>
<style scoped>
.p-h {
    font-size: 18px;
    font-weight: 700;
}
</style>
src/pages/test/dialog/testStepCheck.vue
@@ -1,17 +1,104 @@
<template>
    <div class="params-container params-container-flex">
        <div class="form-wrapper">
    <div class="test-check">
        <div class="test-explain">
            <p class="p-h">前置条件检查</p>
        </div>
        <div class="test-explain"
            v-loading="loading"
            element-loading-text="检查中"
            element-loading-spinner="el-icon-loading"
            element-loading-background="rgba(0, 0, 0, 0)">
            <table>
                <tbody>
                <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>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="test-check-button" v-if="showButton">
            <el-button type="primary" size="small" @click="startTest">开始试验</el-button>
        </div>
    </div>
</template>
<script>
import {checkPrecondition} from "@/pages/test/js/api";
export default {
    name: "testStepCheck"
    name: "testStepCheck",
    props: {
        type: {
            type: String,
            default: ""
        }
    },
    data() {
        return {
            loading: false,
            showButton: false,
            list: [],
        }
    },
    methods: {
        checkPrecondition() {
            this.loading = true;
            this.$nextTick(() => {
                checkPrecondition(this.type).then(res => {
                    let rs = res.data;
                    let data = [];
                    if (rs.code == 1) {
                        data = rs.data;
                    }
                    this.list = data;
                    this.loading = false;
                    this.showButton = true;
                }).catch(error => {
                    this.loading = false;
                    console.log(error);
                });
            });
        },
        startTest() {
            this.$emit('startTest');
        }
    },
    mounted() {
        this.checkPrecondition();
    }
}
</script>
<style scoped>
.p-h {
    font-size: 18px;
    font-weight: 700;
}
.test-check {
    min-height: 300px;
}
.test-explain table {
    margin-left: 32px;
}
.test-explain table td {
    padding: 4px 16px;
}
.test-explain table td.td-name {
    text-align: right;
}
.test-explain table td.td-status {
    font-weight: 700;
}
.test-check-button {
    padding: 8px 16px;
    text-align: right;
}
</style>
src/pages/test/js/api.js
@@ -127,3 +127,18 @@
    });
}
/**
 * 检查前置条件
 * @param type
 * @returns {AxiosPromise}
 */
export const checkPrecondition = (type) => {
    return axios({
        method: "GET",
        url: "/experiment/checkPrecondition",
        params: {
            type: type,
        }
    });
}
src/pages/test/js/const.js
New file
@@ -0,0 +1,14 @@
export const constTestType = [
    {
        label: '空载试验',
        value: 'kz',
    },
    {
        label: '负载试验',
        value: 'fz',
    },
    {
        label: '绕阻试验',
        value: 'rz'
    }
];
src/pages/test/loadTest.vue
@@ -202,15 +202,7 @@
                </div>
            </div>
        </div>
        <load-test-dialog type="fz" :visible="dialogVisible"></load-test-dialog>
        <el-dialog
            :visible.sync="testStepCheck" class="position-absolute dialog-center dialog-no-header"
            width="840px" top="0"
            :modal="false" :destroy-on-close="true"
            :close-on-press-escape="false" :close-on-click-modal="false"
            :modal-append-to-body="false">
        </el-dialog>
        <load-test-dialog :type="type" :visible="dialogVisible"></load-test-dialog>
    </div>
</template>
@@ -225,6 +217,8 @@
import absPanel from '@/components/smallModule/absPanel.vue';
import LoadTestDialog from "@/pages/test/dialog/LoadTestDialog";
import {getExitTest} from "@/pages/test/js/api";
import {constTestType} from "@/pages/test/js/const";
import {getLabel} from "@/assets/js/tools";
let diagram;
export default {
@@ -241,6 +235,7 @@
    },
    data() {
        return {
            type: 'fz',
            dialogVisible: false,
            speedValue: 0,
            nbmspeedValue: 0,
@@ -387,7 +382,6 @@
                    unit: "V",
                },
            ],
            testStepCheck: false,
        }
    },
    watch: {
@@ -479,7 +473,17 @@
            getExitTest().then(res=>{
                let rs = res.data;
                if(rs.code ==  1) {
                    this.$layer.msg('已存在试验');
                    let data = rs.data;
                    if(data.type != this.type) {
                        let testType = getLabel(data.type, constTestType);
                        this.$alert("当前已开启试验:"+testType+"。如需要进行其他试验需先关闭此试验。", '系统提示', {
                            callback:()=>{
                                this.$router.push('/index/testManager/testing');
                            }
                        });
                    }else {
                        console.log('查询试验步骤');
                    }
                }else {
                    this.dialogVisible = true;
                }
src/pages/test/noLoadTest.vue
@@ -71,7 +71,8 @@
            </div>
            <div class="chartTitle">受试电机电流</div>
            <div class="chartTitle mw-process-warp">
              <mw-section-process title="当前电压 2200mA" leftText="-20mA" rightText="+20mA"></mw-section-process>
                            <mw-section-process title="当前电压 2200mA" leftText="-20mA"
                                                rightText="+20mA"></mw-section-process>
            </div>
          </div>
        </div>
@@ -86,7 +87,8 @@
            <div class="flexCon">
              <el-button type="primary" size="mini" @click="changeSpeed('add')">加速</el-button>
              <el-button type="primary" size="mini" @click="changeSpeed('reduce')">减速</el-button>
              <el-input v-model="nbmspeedValue" placeholder="请输入内容" size="mini" class="speedInput"></el-input>
                            <el-input v-model="nbmspeedValue" placeholder="请输入内容" size="mini"
                                      class="speedInput"></el-input>
              <el-button type="primary" size="mini">确认调速</el-button>
            </div>
          </div>
@@ -118,17 +120,20 @@
              <div class="status lineCon">
                <div class="line">
                  <div class="text">VF</div>
                  <el-input v-model="VFValue" placeholder="请输入内容" size="mini" class="input"></el-input>
                                    <el-input v-model="VFValue" placeholder="请输入内容" size="mini"
                                              class="input"></el-input>
                  <div class="text">参考值1~50</div>
                </div>
                <div class="line">
                  <div class="text">SVC</div>
                  <el-input v-model="SVCValue" placeholder="请输入内容" size="mini" class="input"></el-input>
                                    <el-input v-model="SVCValue" placeholder="请输入内容" size="mini"
                                              class="input"></el-input>
                  <div class="text">参考值1~200</div>
                </div>
                <div class="line">
                  <div class="text">FVC</div>
                  <el-input v-model="FVCValue" placeholder="请输入内容" size="mini" class="input"></el-input>
                                    <el-input v-model="FVCValue" placeholder="请输入内容" size="mini"
                                              class="input"></el-input>
                  <div class="text">参考值1~1000</div>
                </div>
              </div>
@@ -177,7 +182,8 @@
          <div class="title">试验状态</div>
          <div class="con" style="position:relative;overflow:auto;">
            <div class="stepCont">
              <step-list v-for="(item, index) in list" :key="'key'+index" :data="item" :end="(list.length-1) == index"
                            <step-list v-for="(item, index) in list" :key="'key'+index" :data="item"
                                       :end="(list.length-1) == index"
                size="mini">
              </step-list>
            </div>
@@ -189,7 +195,7 @@
        </div>
      </div>
    </div>
    <load-test-dialog type="kz" :visible="dialogVisible"></load-test-dialog>
        <load-test-dialog :type="type" :visible="dialogVisible"></load-test-dialog>
  </div>
</template>
@@ -209,6 +215,9 @@
    getExitTest,
    experimentPoint
  } from "@/pages/test/js/api";
import {getLabel} from "@/assets/js/tools";
import {constTestType} from "@/pages/test/js/const";
  let diagram;
  export default {
    components: {
@@ -225,6 +234,7 @@
    },
    data() {
      return {
            type: 'kz',
        dialogVisible: false,
        dcBox: [{
            label: '电压:',
@@ -352,8 +362,16 @@
        getExitTest().then(res => {
          let rs = res.data;
          if (rs.code == 1) {
            this.$layer.msg('已存在试验');
            if (rs.data.id.indexOf('kz') != -1) {
                    let data = rs.data;
                    if(data.type != this.type) {
                        let testType = getLabel(data.type, constTestType);
                        this.$alert("当前已开启试验:"+testType+"。如需要进行其他试验需先关闭此试验。", '系统提示', {
                            callback:()=>{
                                this.$router.push('/index/testManager/testing');
                            }
                        });
                    }else {
                        console.log('查询试验步骤');
              this.experimentPoint(rs.data.id)
            }
          } else {