|
@@ -0,0 +1,845 @@
|
|
|
+<template>
|
|
|
+ <!-- 编辑弹出框 -->
|
|
|
+ <el-dialog
|
|
|
+ :visible="visible"
|
|
|
+ width="1100px"
|
|
|
+ :before-close="dialogBeforeClose"
|
|
|
+ @open="dialogOpenHandle"
|
|
|
+ @close="dialogCloseHandle"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ ref="form"
|
|
|
+ :model="form"
|
|
|
+ :rules="rules"
|
|
|
+ label-position="top"
|
|
|
+ label-width="200px"
|
|
|
+ :disabled="dialogStatus == 2"
|
|
|
+ >
|
|
|
+ <el-row type="flex" justify="space-between" align="middle" :gutter="10">
|
|
|
+ <el-col :span="15">
|
|
|
+ <el-form-item prop="name">
|
|
|
+ <el-tag slot="label">规则名称</el-tag>
|
|
|
+ <el-input v-model="form.name" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="9" style="display:flex;justify-content:space-between;align-items:center">
|
|
|
+ <el-form-item prop="category">
|
|
|
+ <el-tag slot="label">报警类别</el-tag>
|
|
|
+ <el-select v-model="form.category" class="select-mini">
|
|
|
+ <el-option key="1" label="风机" value="1" />
|
|
|
+ <el-option key="2" label="电气" value="2" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="rank">
|
|
|
+ <el-tag slot="label">报警级别</el-tag>
|
|
|
+ <el-select v-model="form.rank" class="select-mini">
|
|
|
+ <el-option key="1" label="低" value="1" />
|
|
|
+ <el-option key="2" label="中低" value="2" />
|
|
|
+ <el-option key="3" label="中" value="3" />
|
|
|
+ <el-option key="4" label="中高" value="4" />
|
|
|
+ <el-option key="5" label="高" value="5" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="enabled">
|
|
|
+ <el-tag slot="label">是否启用</el-tag>
|
|
|
+ <el-switch
|
|
|
+ v-model="form.enabled"
|
|
|
+ active-value="1"
|
|
|
+ inactive-value="0"
|
|
|
+ active-color="#13ce66"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item prop="station">
|
|
|
+ <el-tag slot="label">风场</el-tag>
|
|
|
+ <el-select v-model="form.station" style="width:100%">
|
|
|
+ <el-option
|
|
|
+ v-for="item in stationList"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="modelId" v-show="isWindturbine">
|
|
|
+ <el-tag slot="label">风机类型</el-tag>
|
|
|
+ <el-select v-model="form.modelId" style="width:100%">
|
|
|
+ <el-option v-for="item in modelList" :key="item" :label="item" :value="item" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="relatedParts" v-show="isWindturbine">
|
|
|
+ <el-tag slot="label">所属部件</el-tag>
|
|
|
+ <el-select v-model="form.relatedParts" style="width:100%">
|
|
|
+ <el-option
|
|
|
+ v-for="i in relatePartList"
|
|
|
+ :key="i.partCode"
|
|
|
+ :value="i.partCode"
|
|
|
+ :label="i.name"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="9">
|
|
|
+ <el-form-item prop="expression">
|
|
|
+ <el-tag slot="label">表达式</el-tag>
|
|
|
+ <el-input
|
|
|
+ type="textarea"
|
|
|
+ rows="12"
|
|
|
+ v-model="form.expression"
|
|
|
+ :value="form.expression"
|
|
|
+ id="expressionInput"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="9">
|
|
|
+ <el-tabs type="border-card">
|
|
|
+ <el-tab-pane label="AI测点">
|
|
|
+ <el-input v-model="AIPointSearch" @input="AIInputChange">
|
|
|
+ <el-button slot="append" icon="el-icon-search" />
|
|
|
+ </el-input>
|
|
|
+ <el-table
|
|
|
+ size="mini"
|
|
|
+ fit
|
|
|
+ :show-header="false"
|
|
|
+ :highlight-current-row="true"
|
|
|
+ :stripe="false"
|
|
|
+ :border="false"
|
|
|
+ height="200"
|
|
|
+ :data="AIPointList"
|
|
|
+ @row-dblclick="tbAI_DBClickHandle"
|
|
|
+ >
|
|
|
+ <el-table-column prop="uniformCode" />
|
|
|
+ <el-table-column prop="name" />
|
|
|
+ </el-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="DI测点">
|
|
|
+ <el-input v-model="DIPointSearch" @input="DIInputChange">
|
|
|
+ <el-button slot="append" icon="el-icon-search" />
|
|
|
+ </el-input>
|
|
|
+ <el-table
|
|
|
+ size="mini"
|
|
|
+ fit
|
|
|
+ :show-header="false"
|
|
|
+ :highlight-current-row="true"
|
|
|
+ :stripe="false"
|
|
|
+ :border="false"
|
|
|
+ height="200"
|
|
|
+ :data="DIPointList"
|
|
|
+ @row-dblclick="tbDI_DBClickHandle"
|
|
|
+ >
|
|
|
+ <el-table-column prop="uniformCode" />
|
|
|
+ <el-table-column prop="name" />
|
|
|
+ </el-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="函数">
|
|
|
+ <el-table
|
|
|
+ size="mini"
|
|
|
+ fit
|
|
|
+ :show-header="false"
|
|
|
+ :highlight-current-row="true"
|
|
|
+ :stripe="false"
|
|
|
+ :border="false"
|
|
|
+ height="230"
|
|
|
+ :data="func"
|
|
|
+ @row-dblclick="tabFuncRowClickHandle"
|
|
|
+ >
|
|
|
+ <el-table-column min-width="60%">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-popover trigger="hover" placement="bottom">
|
|
|
+ <p>描述:{{ scope.row.describe }}</p>
|
|
|
+ <p>参数:{{ scope.row.param }}</p>
|
|
|
+ <div slot="reference">
|
|
|
+ <span size="medium" transition="fade-in-linear">{{ scope.row.lab }}</span>
|
|
|
+ </div>
|
|
|
+ </el-popover>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column min-width="40%">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-popover trigger="hover" placement="bottom">
|
|
|
+ <p>描述:{{ scope.row.describe }}</p>
|
|
|
+ <p>参数:{{ scope.row.param }}</p>
|
|
|
+ <div slot="reference">
|
|
|
+ <span size="medium" transition="fade-in-linear">{{ scope.row.name }}</span>
|
|
|
+ </div>
|
|
|
+ </el-popover>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="运算符">
|
|
|
+ <el-button-group>
|
|
|
+ <el-button
|
|
|
+ v-for="item in operator"
|
|
|
+ :key="item"
|
|
|
+ plain
|
|
|
+ type="primary"
|
|
|
+ @click="btnOperatorClickHandle(item)"
|
|
|
+ style="width:60px;margin:8px;height:40px"
|
|
|
+ >{{item}}</el-button>
|
|
|
+ </el-button-group>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-form-item prop="description">
|
|
|
+ <el-tag slot="label">规则描述</el-tag>
|
|
|
+ <el-input type="textarea" rows="2" v-model="form.description" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="btnCancelClickHandle">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submit">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import {
|
|
|
+ fetchAIPointList,
|
|
|
+ fetchDIPointList,
|
|
|
+ alert_rule_postSave,
|
|
|
+} from "../../api/requestAPI";
|
|
|
+import axios from "axios";
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ visible: this.isVisible,
|
|
|
+ isWindturbine: true,
|
|
|
+ form: {
|
|
|
+ id: "",
|
|
|
+ name: "",
|
|
|
+ description: "",
|
|
|
+ expression: "111111",
|
|
|
+ tag: "",
|
|
|
+ rank: "",
|
|
|
+ enabled: "1", // 1可用-0禁用
|
|
|
+ modelId: "",
|
|
|
+ ednaValue: "",
|
|
|
+ category: "",
|
|
|
+ range: "",
|
|
|
+ station: "",
|
|
|
+ windturbine: "",
|
|
|
+ line: "",
|
|
|
+ project: "",
|
|
|
+ electrical: "",
|
|
|
+ taskstart: "",
|
|
|
+ relatedParts: "",
|
|
|
+ userName: "",
|
|
|
+ },
|
|
|
+ stationList: [],
|
|
|
+ modelList: [],
|
|
|
+ s_modelList: [
|
|
|
+ { station: "MHS_FDC", model_list: ["UP77", "UP105"] },
|
|
|
+ { station: "SBQ_FDC", model_list: ["UP82", "UP97", "UP105"] },
|
|
|
+ { station: "NSS_FDC", model_list: ["UP82"] },
|
|
|
+ { station: "XS_FDC", model_list: ["UP97", "UP105"] },
|
|
|
+ { station: "QS_FDC", model_list: ["CCWE-1500"] },
|
|
|
+ ],
|
|
|
+ relatePartList: [],
|
|
|
+ AIDataSource: [],
|
|
|
+ DIDataSource: [],
|
|
|
+ AIPointList: [],
|
|
|
+ DIPointList: [],
|
|
|
+ AIPointSearch: "",
|
|
|
+ DIPointSearch: "",
|
|
|
+ func: [
|
|
|
+ {
|
|
|
+ lab: "MR",
|
|
|
+ name: "移动极差",
|
|
|
+ param: "测点名,时间(秒)",
|
|
|
+ describe: "是指两个或多个连续样本值中最大值与最小值之差",
|
|
|
+ scene: "测点的移动极差超限报警",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "MAR",
|
|
|
+ name: "均值极差",
|
|
|
+ param: "测点名,时间(秒)",
|
|
|
+ describe: "",
|
|
|
+ scene: "测点的均值极差计算",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "RiseExceed",
|
|
|
+ name: "上升趋势",
|
|
|
+ param: "测点名,时间(秒),阈值",
|
|
|
+ describe: "取测点在给定的时间范围内数据上升的量是否超过阈值",
|
|
|
+ scene: "测点值的上升速度过快等",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "Sustain",
|
|
|
+ name: "持续时间",
|
|
|
+ param: "表达式,时间(秒)",
|
|
|
+ describe:
|
|
|
+ "判定状态(表达式成立)持续的时间是否超过给定的时间判断状态持续的时间",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "LastUpdateTime",
|
|
|
+ name: "最近数据时间",
|
|
|
+ param: "测点名",
|
|
|
+ describe: "",
|
|
|
+ scene: "判定离线,状态持续时间等",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "abs",
|
|
|
+ name: "取绝对值",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "acos",
|
|
|
+ name: "反余弦",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "asin",
|
|
|
+ name: "反正弦",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "atan",
|
|
|
+ name: "反正切",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "atan2",
|
|
|
+ name: "xy坐标转为极坐标",
|
|
|
+ param: "x,y",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "ceiling",
|
|
|
+ name: "向上取整",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "cos",
|
|
|
+ name: "余弦",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "cosh",
|
|
|
+ name: "双曲线余弦",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "exp",
|
|
|
+ name: "欧拉数 e 的 double 次幂的值",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "floor",
|
|
|
+ name: "向下取整",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "log",
|
|
|
+ name: "自然对数",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "log10",
|
|
|
+ name: "底数为 10 的对数",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "max",
|
|
|
+ name: "比较最大值",
|
|
|
+ param: "double a, double b",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "min",
|
|
|
+ name: "比较最小值",
|
|
|
+ param: "double a, double b",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "pow",
|
|
|
+ name: "返回第一个参数的第二个参数次幂的值",
|
|
|
+ param: "double a, double b",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "round",
|
|
|
+ name: "返回最接近参数的 long,或int",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "sign",
|
|
|
+ name: "负数返回-1.0,整数返回1.0,0返回0.0",
|
|
|
+ param: "float f/double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "sin",
|
|
|
+ name: "三角正弦值",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "sinh",
|
|
|
+ name: "双曲线正弦",
|
|
|
+ param: "double x",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "sqrt",
|
|
|
+ name: "正平方根",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "tan",
|
|
|
+ name: "正切",
|
|
|
+ param: "double a",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lab: "tanh",
|
|
|
+ name: "双曲线余弦",
|
|
|
+ param: "double x",
|
|
|
+ describe: "",
|
|
|
+ scene: "",
|
|
|
+ },
|
|
|
+ { lab: "PI", name: "圆周率", param: "", describe: "", scene: "" },
|
|
|
+ { lab: "E", name: "自然对数", param: "", describe: "", scene: "" },
|
|
|
+ ],
|
|
|
+ operator: [
|
|
|
+ "+",
|
|
|
+ "-",
|
|
|
+ "*",
|
|
|
+ "/",
|
|
|
+ "(",
|
|
|
+ ")",
|
|
|
+ ">",
|
|
|
+ ">=",
|
|
|
+ "<",
|
|
|
+ "<=",
|
|
|
+ "==",
|
|
|
+ "!=",
|
|
|
+ "&&",
|
|
|
+ "||",
|
|
|
+ "!",
|
|
|
+ "%",
|
|
|
+ "true",
|
|
|
+ "false",
|
|
|
+ ".",
|
|
|
+ ],
|
|
|
+ rules: {
|
|
|
+ name: [{ required: true, message: "请输入规则名称", trigger: "blur" }],
|
|
|
+ category: [
|
|
|
+ { required: true, message: "请选择报警类别", trigger: "change" },
|
|
|
+ ],
|
|
|
+ rank: [
|
|
|
+ { required: true, message: "请选择报警级别", trigger: "change" },
|
|
|
+ ],
|
|
|
+ station: [{ required: true, message: "请选择风场", trigger: "change" }],
|
|
|
+ expression: [
|
|
|
+ { required: true, message: "表达式不能为空", trigger: "change" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ isVisible: Boolean,
|
|
|
+ dialogStatus: Number, //窗口状态:0-新增;1-修改;2-查看
|
|
|
+ rowData: Object,
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ isVisible(val) {
|
|
|
+ this.visible = val;
|
|
|
+ },
|
|
|
+ rowData(val) {
|
|
|
+ this.form = JSON.parse(JSON.stringify(val));
|
|
|
+ },
|
|
|
+ "form.station": {
|
|
|
+ handler(val) {
|
|
|
+ if (this.form.category !== undefined && val !== undefined) {
|
|
|
+ if (this.form.category === "1") {
|
|
|
+ // 风机
|
|
|
+ if (this.form.modelId !== undefined) {
|
|
|
+ this.queryWindturbine_AI_DI_Point(val, this.form.modelId);
|
|
|
+ }
|
|
|
+ } else if (this.form.category === "2") {
|
|
|
+ // 电气
|
|
|
+ this.queryElectrical_AI_DI_Point(val);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 场站变更 - 加载设备类型
|
|
|
+ if (val !== undefined) {
|
|
|
+ let sel_station = this.s_modelList.filter(function (item) {
|
|
|
+ return item.station == val;
|
|
|
+ });
|
|
|
+ if (sel_station.length > 0)
|
|
|
+ this.modelList = sel_station[0].model_list;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ "form.category": {
|
|
|
+ handler(val) {
|
|
|
+ if (val !== undefined) {
|
|
|
+ if (val === "1") {
|
|
|
+ // 风机
|
|
|
+ if (
|
|
|
+ this.form.station !== undefined &&
|
|
|
+ this.form.modelId !== undefined
|
|
|
+ ) {
|
|
|
+ this.queryWindturbine_AI_DI_Point(
|
|
|
+ this.form.station,
|
|
|
+ this.form.modelId
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } else if (val === "2") {
|
|
|
+ // 电气
|
|
|
+ if (this.form.station !== undefined) {
|
|
|
+ this.queryElectrical_AI_DI_Point(this.form.station);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 报警类别变更
|
|
|
+ if (this.form.category === "1") {
|
|
|
+ this.isWindturbine = true;
|
|
|
+ } else if (this.form.category === "2") {
|
|
|
+ this.isWindturbine = false;
|
|
|
+ this.form.modelId = "";
|
|
|
+ this.form.relatedParts = "";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ "form.modelId": {
|
|
|
+ handler(val) {
|
|
|
+ if (this.form.station !== undefined && val !== undefined) {
|
|
|
+ this.queryWindturbine_AI_DI_Point(this.form.station, val);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 点击取消事件
|
|
|
+ btnCancelClickHandle() {
|
|
|
+ this.visible = false;
|
|
|
+ this.$emit("cbFunc", this.visible);
|
|
|
+ },
|
|
|
+ // 窗口关闭前的回调
|
|
|
+ dialogBeforeClose(done) {
|
|
|
+ this.$confirm("确认关闭?")
|
|
|
+ .then((_) => {
|
|
|
+ done();
|
|
|
+ this.visible = false;
|
|
|
+ this.$emit("cbFunc", this.visible);
|
|
|
+ })
|
|
|
+ .catch((_) => {});
|
|
|
+ },
|
|
|
+ // 查询风场AI、DI测点
|
|
|
+ queryWindturbine_AI_DI_Point(station, modelId) {
|
|
|
+ // 获取AI测点
|
|
|
+ fetchAIPointList(station, modelId).then((res) => {
|
|
|
+ res.sort(function (a, b) {
|
|
|
+ if (a.uniformCode < b.uniformCode) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (a.uniformCode > b.uniformCode) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ });
|
|
|
+
|
|
|
+ this.AIPointList = res;
|
|
|
+ this.AIDataSource = res;
|
|
|
+ });
|
|
|
+ // 获取DI测点
|
|
|
+ fetchDIPointList(station, modelId).then((res) => {
|
|
|
+ res.sort(function (a, b) {
|
|
|
+ if (a.uniformCode < b.uniformCode) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (a.uniformCode > b.uniformCode) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ });
|
|
|
+
|
|
|
+ this.DIPointList = res;
|
|
|
+ this.DIDataSource = res;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 函数点击事件
|
|
|
+ tabFuncRowClickHandle(row) {
|
|
|
+ let _row = this.deepClone(row);
|
|
|
+ let elInput = document.getElementById("expressionInput");
|
|
|
+ let startPos = elInput.selectionStart; //第0个字符到选中的字符
|
|
|
+ let endPos = elInput.selectionEnd; //选中字符到末尾字符
|
|
|
+ if (startPos === undefined || endPos === undefined) return;
|
|
|
+ let txt = elInput.value;
|
|
|
+ let func;
|
|
|
+ if (
|
|
|
+ row.lab === "MR" ||
|
|
|
+ row.lab === "MAR" ||
|
|
|
+ row.lab === "RiseExceed" ||
|
|
|
+ row.lab === "Sustain" ||
|
|
|
+ row.lab === "LastUpdateTime"
|
|
|
+ ) {
|
|
|
+ func = row.lab + "()";
|
|
|
+ } else if (row.lab === "PI" || row.lab === "E") {
|
|
|
+ func = "Math." + row.lab;
|
|
|
+ } else {
|
|
|
+ func = "Math." + row.lab + "()";
|
|
|
+ }
|
|
|
+ // 将插值添加到选中光标位置
|
|
|
+ let result = txt.substring(0, startPos) + func + txt.substring(endPos);
|
|
|
+ elInput.value = result;
|
|
|
+ // 重新定义光标位置
|
|
|
+ elInput.focus();
|
|
|
+ if (row.lab === "PI" || row.lab === "E") {
|
|
|
+ elInput.selectionStart = startPos + func.length;
|
|
|
+ elInput.selectionEnd = startPos + func.length;
|
|
|
+ } else {
|
|
|
+ elInput.selectionStart = startPos + func.length - 1;
|
|
|
+ elInput.selectionEnd = startPos + func.length - 1;
|
|
|
+ }
|
|
|
+ this.form.expression = result; // 赋值给表单中的的字段
|
|
|
+ },
|
|
|
+ // 运算符点击事件
|
|
|
+ btnOperatorClickHandle(row) {
|
|
|
+ this.elInputSplit(row);
|
|
|
+ },
|
|
|
+ //提交表单
|
|
|
+ submit() {
|
|
|
+ this.form.expression = document.getElementById("expressionInput").value;
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let loginUser = sessionStorage.getItem("ms_username");
|
|
|
+ this.form.userName = loginUser;
|
|
|
+
|
|
|
+ this.$confirm("确认关闭?")
|
|
|
+ .then(() => {
|
|
|
+ switch (this.dialogStatus) {
|
|
|
+ //窗口状态:0-新增;1-修改;2-查看
|
|
|
+ case 0:
|
|
|
+ custombj_postSave(this.form)
|
|
|
+ .then((response) => {
|
|
|
+ if (response.data.success) {
|
|
|
+ this.$message.success("保存成功");
|
|
|
+ // 关闭窗口
|
|
|
+ this.visible = false;
|
|
|
+ this.$emit("cbFunc", this.visible);
|
|
|
+ } else if (
|
|
|
+ response.data.status != null &&
|
|
|
+ response.data.status == 521
|
|
|
+ ) {
|
|
|
+ this.$message.error("登陆过期");
|
|
|
+ this.$router.push("/login");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.data.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ custombj_postSave(this.form)
|
|
|
+ .then((response) => {
|
|
|
+ if (response.data.success) {
|
|
|
+ this.$message.success("保存成功");
|
|
|
+ // 关闭窗口
|
|
|
+ this.visible = false;
|
|
|
+ this.$emit("cbFunc", this.visible);
|
|
|
+ } else if (
|
|
|
+ response.data.status != null &&
|
|
|
+ response.data.status == 521
|
|
|
+ ) {
|
|
|
+ this.$message.error("登陆过期");
|
|
|
+ this.$router.push("/login");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.data.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ // 关闭窗口
|
|
|
+ this.visible = false;
|
|
|
+ this.$emit("cbFunc", this.visible);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 窗口打开事件 - 做重置表单操作
|
|
|
+ dialogOpenHandle() {
|
|
|
+ // 重置表单
|
|
|
+ if (this.dialogStatus === 0) {
|
|
|
+ this.isWindturbine = true;
|
|
|
+ (this.AIDataSource = []),
|
|
|
+ (this.DIDataSource = []),
|
|
|
+ (this.AIPointList = []),
|
|
|
+ (this.DIPointList = []),
|
|
|
+ (this.AIPointSearch = ""),
|
|
|
+ (this.DIPointSearch = ""),
|
|
|
+ (this.form = { enabled: "1" });
|
|
|
+ if (this.$refs["form"] != undefined) {
|
|
|
+ this.$refs["form"].resetFields();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.AIPointSearch = "";
|
|
|
+ this.DIPointSearch = "";
|
|
|
+ if (this.form.category === "1") {
|
|
|
+ this.isWindturbine = true;
|
|
|
+ } else if (this.form.category === "2") {
|
|
|
+ this.isWindturbine = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取关联部件
|
|
|
+ fetchRelatePart().then((res) => {
|
|
|
+ this.relatePartList = res;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 窗口关闭事件 - 做重置表单操作
|
|
|
+ dialogCloseHandle() {
|
|
|
+ // 重置表单
|
|
|
+ if (this.dialogStatus === 0) {
|
|
|
+ this.isWindturbine = true;
|
|
|
+ (this.AIDataSource = []),
|
|
|
+ (this.DIDataSource = []),
|
|
|
+ (this.AIPointList = []),
|
|
|
+ (this.DIPointList = []),
|
|
|
+ (this.AIPointSearch = ""),
|
|
|
+ (this.DIPointSearch = ""),
|
|
|
+ (this.form = { enabled: "1" });
|
|
|
+ if (this.$refs["form"] != undefined) {
|
|
|
+ this.$refs["form"].resetFields();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.AIPointSearch = "";
|
|
|
+ this.DIPointSearch = "";
|
|
|
+ if (this.form.category === "1") {
|
|
|
+ this.isWindturbine = true;
|
|
|
+ } else if (this.form.category === "2") {
|
|
|
+ this.isWindturbine = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // AI测点模糊查询
|
|
|
+ AIInputChange() {
|
|
|
+ this.AIPointList = this.AIDataSource.filter((i) => {
|
|
|
+ return i.name.indexOf(this.AIPointSearch) != -1;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // DI测点模糊查询
|
|
|
+ DIInputChange() {
|
|
|
+ this.DIPointList = this.DIDataSource.filter((i) => {
|
|
|
+ return i.name.indexOf(this.DIPointSearch) != -1;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ tbAI_DBClickHandle(row) {
|
|
|
+ this.elInputSplit(row.uniformCode);
|
|
|
+ },
|
|
|
+ tbDI_DBClickHandle(row) {
|
|
|
+ this.elInputSplit(row.uniformCode);
|
|
|
+ },
|
|
|
+ deepClone(obj) {
|
|
|
+ let _obj = JSON.stringify(obj),
|
|
|
+ objClone = JSON.parse(_obj);
|
|
|
+ return objClone;
|
|
|
+ },
|
|
|
+ // 表达式字符串拼接
|
|
|
+ elInputSplit(val) {
|
|
|
+ let elInput = document.getElementById("expressionInput");
|
|
|
+ let startPos = elInput.selectionStart;
|
|
|
+ let endPos = elInput.selectionEnd;
|
|
|
+ if (startPos === undefined || endPos === undefined) return;
|
|
|
+ let txt = elInput.value;
|
|
|
+ let txtSplit = val;
|
|
|
+ let result =
|
|
|
+ txt.substring(0, startPos) + txtSplit + txt.substring(endPos);
|
|
|
+ elInput.value = result;
|
|
|
+ elInput.focus();
|
|
|
+ elInput.selectionStart = startPos + txtSplit.length;
|
|
|
+ elInput.selectionEnd = startPos + txtSplit.length;
|
|
|
+ // this.form.expression = result;
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style>
|
|
|
+.col-box {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+}
|
|
|
+.select-mini {
|
|
|
+ width: 120px;
|
|
|
+}
|
|
|
+.el-tabs__content {
|
|
|
+ padding: 0 !important;
|
|
|
+}
|
|
|
+.el-tabs--border-card {
|
|
|
+ -webkit-box-shadow: none;
|
|
|
+ box-shadow: none;
|
|
|
+}
|
|
|
+.border {
|
|
|
+ border: solid red 1px;
|
|
|
+}
|
|
|
+.el-table--mini td {
|
|
|
+ padding: 3px 0;
|
|
|
+}
|
|
|
+.el-button-group .el-button--primary {
|
|
|
+ border: none;
|
|
|
+}
|
|
|
+.el-form--label-top .el-form-item__label {
|
|
|
+ padding: 0;
|
|
|
+}
|
|
|
+</style>
|