|
@@ -1,989 +0,0 @@
|
|
|
-<template>
|
|
|
- <!--编辑弹出框-->
|
|
|
- <el-dialog
|
|
|
- v-model="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>规则名称</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>报警类别</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>报警级别</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>是否启用</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>风场</el-tag>
|
|
|
- <el-select
|
|
|
- v-model="form.station"
|
|
|
- style="width: 100%"
|
|
|
- @change="stationChange"
|
|
|
- >
|
|
|
- <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>风机类型</el-tag>
|
|
|
- <el-select v-model="form.modelId" style="width: 100%">
|
|
|
- <el-option
|
|
|
- v-for="item in modelList"
|
|
|
- :key="item.code"
|
|
|
- :value="item.code"
|
|
|
- :label="item.code"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="relatedParts" v-show="isWindturbine">
|
|
|
- <el-tag>所属部件</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-form-item prop="fault">
|
|
|
- <el-tag>预警类型</el-tag>
|
|
|
- <el-select v-model="form.project" style="width: 100%">
|
|
|
- <el-option
|
|
|
- v-for="i in faultList"
|
|
|
- :key="i.value"
|
|
|
- :value="i.value"
|
|
|
- :label="i.name"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="9">
|
|
|
- <el-form-item prop="expression">
|
|
|
- <el-tag>表达式</el-tag>
|
|
|
- <el-input
|
|
|
- type="textarea"
|
|
|
- rows="14"
|
|
|
- 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 icon="el-icon-search" />
|
|
|
- </el-input>
|
|
|
- <el-table
|
|
|
- size="mini"
|
|
|
- fit
|
|
|
- :show-header="false"
|
|
|
- :highlight-current-row="true"
|
|
|
- :stripe="false"
|
|
|
- :border="false"
|
|
|
- height="240"
|
|
|
- :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 icon="el-icon-search" />
|
|
|
- </el-input>
|
|
|
- <el-table
|
|
|
- size="mini"
|
|
|
- fit
|
|
|
- :show-header="false"
|
|
|
- :highlight-current-row="true"
|
|
|
- :stripe="false"
|
|
|
- :border="false"
|
|
|
- height="240"
|
|
|
- :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="270"
|
|
|
- :data="func"
|
|
|
- @row-dblclick="tabFuncRowClickHandle"
|
|
|
- >
|
|
|
- <el-table-column min-width="60%">
|
|
|
- <template #default="scope">
|
|
|
- <el-popover trigger="hover" placement="bottom">
|
|
|
- <p>描述:{{ scope.row.describe }}</p>
|
|
|
- <p>参数:{{ scope.row.param }}</p>
|
|
|
- <template #reference>
|
|
|
- <span size="medium" transition="fade-in-linear">{{
|
|
|
- scope.row.lab
|
|
|
- }}</span>
|
|
|
- </template>
|
|
|
- </el-popover>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column min-width="40%">
|
|
|
- <template #default="scope">
|
|
|
- <el-popover trigger="hover" placement="bottom">
|
|
|
- <p>描述:{{ scope.row.describe }}</p>
|
|
|
- <p>参数:{{ scope.row.param }}</p>
|
|
|
- <template #reference>
|
|
|
- <span size="medium" transition="fade-in-linear">{{
|
|
|
- scope.row.name
|
|
|
- }}</span>
|
|
|
- </template>
|
|
|
- </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 :gutter="24">
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item prop="description">
|
|
|
- <el-tag>规则描述</el-tag>
|
|
|
- <el-input type="textarea" rows="4" v-model="form.description" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
- <span>
|
|
|
- <el-button @click="btnCancelClickHandle">取 消</el-button>
|
|
|
- <el-button type="primary" @click="submit">确 定</el-button>
|
|
|
- </span>
|
|
|
- </el-dialog>
|
|
|
-</template>
|
|
|
-<script>
|
|
|
-import {
|
|
|
- fetchAIPointList,
|
|
|
- fetchDIPointList,
|
|
|
- fetchStationList,
|
|
|
- fetchRelatePart,
|
|
|
- custombj_postSave,
|
|
|
- fetch_electrical_point_ai,
|
|
|
- fetch_electrical_point_di,
|
|
|
- tree,
|
|
|
- equipmentmodel_list,
|
|
|
-} from "/@/api/api.js";
|
|
|
-// fetch_electrical_point_di} from '../../../../api/requestAPI';
|
|
|
-// /@/api/api.js
|
|
|
-import axios from "axios";
|
|
|
-import { warn } from "@vue/runtime-core";
|
|
|
-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: 0,
|
|
|
- station: "",
|
|
|
- windturbine: "",
|
|
|
- line: "",
|
|
|
- project: "",
|
|
|
- electrical: "",
|
|
|
- taskstart: "",
|
|
|
- relatedParts: "",
|
|
|
- userName: "",
|
|
|
- },
|
|
|
- stationList: [],
|
|
|
- modelList: [],
|
|
|
- relatePartList: [],
|
|
|
- faultList: [
|
|
|
- {
|
|
|
- value: "sensors",
|
|
|
- name: "传感器异常",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "parts",
|
|
|
- name: "零部件隐患",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "control",
|
|
|
- name: "控制参数优化",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "performance",
|
|
|
- name: "性能下降",
|
|
|
- },
|
|
|
- ],
|
|
|
- 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,
|
|
|
- },
|
|
|
- created() {
|
|
|
- // this.RelatePartEdit();
|
|
|
- },
|
|
|
- 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) {
|
|
|
- // // await this.getequipmentmodel_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: {
|
|
|
- stationChange(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) {
|
|
|
- this.getequipmentmodel_list();
|
|
|
- }
|
|
|
- },
|
|
|
- // 机型
|
|
|
- async getequipmentmodel_list() {
|
|
|
- const res = await equipmentmodel_list(this.form.station);
|
|
|
- console.warn(res);
|
|
|
- if (res.equipmentmodel == null) {
|
|
|
- res.equipmentmodel = [];
|
|
|
- res.modelList.forEach((e) => {
|
|
|
- res.equipmentmodel.push({ code: e });
|
|
|
- });
|
|
|
- }
|
|
|
- this.modelList = res.equipmentmodel;
|
|
|
- },
|
|
|
- // 所属部件修改
|
|
|
- // async RelatePartEdit() {
|
|
|
- // const res = await tree();
|
|
|
- // let arr = [];
|
|
|
- // let data = res.children[1].children;
|
|
|
- // data.forEach((v) => {
|
|
|
- // let obj = {};
|
|
|
- // obj["partCode"] = v.node.code;
|
|
|
- // obj["name"] = v.node.name;
|
|
|
- // arr.push(obj);
|
|
|
- // });
|
|
|
- // console.warn(arr);
|
|
|
- // this.relatePartList = arr;
|
|
|
- // },
|
|
|
- // 点击取消事件
|
|
|
- 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;
|
|
|
- });
|
|
|
- },
|
|
|
- // 查询电气AI、DI测点
|
|
|
- queryElectrical_AI_DI_Point(station) {
|
|
|
- // 电气AI点
|
|
|
- fetch_electrical_point_ai(station)
|
|
|
- .then((res) => {
|
|
|
- res.sort(function (a, b) {
|
|
|
- if (a.uniformCode < b.uniformCode) {
|
|
|
- return -1;
|
|
|
- }
|
|
|
- if (a.uniformCode > b.uniformCode) {
|
|
|
- return 1;
|
|
|
- }
|
|
|
- return 0;
|
|
|
- });
|
|
|
- this.AIDataSource = res;
|
|
|
- this.AIPointList = res;
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.log(err);
|
|
|
- });
|
|
|
- // 电气DI点
|
|
|
- fetch_electrical_point_di(station)
|
|
|
- .then((res) => {
|
|
|
- res.sort(function (a, b) {
|
|
|
- if (a.uniformCode < b.uniformCode) {
|
|
|
- return -1;
|
|
|
- }
|
|
|
- if (a.uniformCode > b.uniformCode) {
|
|
|
- return 1;
|
|
|
- }
|
|
|
- return 0;
|
|
|
- });
|
|
|
- this.DIDataSource = res;
|
|
|
- this.DIPointList = res;
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.log(err);
|
|
|
- });
|
|
|
- },
|
|
|
- // 函数点击事件
|
|
|
- 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.form.range = "0";
|
|
|
- this.$confirm("确认保存?")
|
|
|
- .then(() => {
|
|
|
- switch (this.dialogStatus) {
|
|
|
- //窗口状态:0-新增;1-修改;2-查看
|
|
|
- case 0:
|
|
|
- custombj_postSave(this.form)
|
|
|
- .then((response) => {
|
|
|
- if (response.status) {
|
|
|
- if (response.success) {
|
|
|
- this.$message.success("保存成功");
|
|
|
- // 关闭窗口
|
|
|
- this.visible = false;
|
|
|
- this.$emit("cbFunc", this.visible);
|
|
|
- } else {
|
|
|
- this.$message.error(response.msg);
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.log(err);
|
|
|
- });
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- custombj_postSave(this.form)
|
|
|
- .then((response) => {
|
|
|
- if (response.success) {
|
|
|
- this.$message.success("保存成功");
|
|
|
- // 关闭窗口
|
|
|
- this.visible = false;
|
|
|
- this.$emit("cbFunc", this.visible);
|
|
|
- }
|
|
|
- })
|
|
|
- .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;
|
|
|
- }
|
|
|
- }
|
|
|
- // 获取风场数据
|
|
|
- fetchStationList().then((res) => {
|
|
|
- this.stationList = res;
|
|
|
- });
|
|
|
- // 获取关联部件
|
|
|
- fetchRelatePart().then(res => {
|
|
|
- console.warn(res);
|
|
|
- this.relatePartList = res;
|
|
|
- });
|
|
|
- // this.RelatePartEdit();
|
|
|
- },
|
|
|
- // 窗口关闭事件 - 做重置表单操作
|
|
|
- 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;
|
|
|
- }
|
|
|
- }
|
|
|
- // 获取风场数据
|
|
|
- fetchStationList().then((res) => {
|
|
|
- this.stationList = res;
|
|
|
- });
|
|
|
- // 获取关联部件
|
|
|
- fetchRelatePart().then(res => {
|
|
|
- this.relatePartList = res;
|
|
|
- });
|
|
|
- // this.RelatePartEdit();
|
|
|
- },
|
|
|
- // AI测点模糊查询
|
|
|
- AIInputChange() {
|
|
|
- console.warn(this.AIDataSource);
|
|
|
- console.warn(this.AIPointList);
|
|
|
-
|
|
|
- this.AIPointList = this.AIDataSource.filter((i) => {
|
|
|
- return (
|
|
|
- i.name.indexOf(this.AIPointSearch) != -1 ||
|
|
|
- i.uniformCode.indexOf(this.AIPointSearch) != -1
|
|
|
- );
|
|
|
- });
|
|
|
- },
|
|
|
- // DI测点模糊查询
|
|
|
- DIInputChange() {
|
|
|
- this.DIPointList = this.DIDataSource.filter((i) => {
|
|
|
- return (
|
|
|
- i.name.indexOf(this.DIPointSearch) != -1 ||
|
|
|
- i.uniformCode.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>
|