|
@@ -87,49 +87,50 @@
|
|
|
:stripe="false"
|
|
|
:border="false"
|
|
|
height="240"
|
|
|
- :data="[]"
|
|
|
+ @row-dblclick="tabFuncRowClickHandle"
|
|
|
+ :data="funcMsg"
|
|
|
>
|
|
|
- <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>
|
|
|
+ <el-table-column min-width="50%">
|
|
|
+ <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-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>
|
|
|
+ <el-table-column min-width="50%">
|
|
|
+ <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-popover>
|
|
|
- </template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="运算符">
|
|
|
- <!-- <el-button-group>
|
|
|
+ <el-button-group>
|
|
|
<el-button
|
|
|
v-for="item in operator"
|
|
|
:key="item"
|
|
|
plain
|
|
|
type="primary"
|
|
|
- @click="elInputSplit(item)"
|
|
|
- style="width: 60px; margin: 7px 12px; height: 40px"
|
|
|
+ @click="scorRuleSplit(item)"
|
|
|
+ style="width: 60px; margin: 7px 12px; height: 40px; border: 1px solid #409EFF;"
|
|
|
>
|
|
|
{{ item }}
|
|
|
</el-button>
|
|
|
- </el-button-group> -->
|
|
|
+ </el-button-group>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</div>
|
|
@@ -137,7 +138,7 @@
|
|
|
<div>
|
|
|
<div style="display:flex">
|
|
|
<el-checkbox style="margin-right: 10px" v-model="isrepresentation" @change="changeRep" />
|
|
|
- <el-tag style="margin-bottom: 5px">表达式</el-tag>
|
|
|
+ <el-tag style="margin-bottom: 5px">公式</el-tag>
|
|
|
</div>
|
|
|
<el-input
|
|
|
type="textarea"
|
|
@@ -195,6 +196,8 @@ export default {
|
|
|
indicItem: '',
|
|
|
isrepresentation: true,
|
|
|
isrange: false,
|
|
|
+ funcMsg: [],
|
|
|
+ operator: [],
|
|
|
itemForm: {
|
|
|
representation: '',
|
|
|
range: '',
|
|
@@ -210,6 +213,204 @@ export default {
|
|
|
dialogVisible: false
|
|
|
}
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.funcMsg = [
|
|
|
+ {
|
|
|
+ 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: "" },
|
|
|
+ ]
|
|
|
+ this.operator = ["+", "-", "*", "/", "(", ")", ">", ">=", "<", "<=", "==", "!=",
|
|
|
+ "&&", "||", "!", "%", "true", "false", ".", ]
|
|
|
+ },
|
|
|
methods: {
|
|
|
init(row) {
|
|
|
this.editEvaluaVisible = true
|
|
@@ -253,8 +454,40 @@ export default {
|
|
|
changeRank(val) {
|
|
|
this.isrepresentation = !val
|
|
|
},
|
|
|
+ tabFuncRowClickHandle(row) {
|
|
|
+ let elInput = null
|
|
|
+ if (this.isrepresentation) {
|
|
|
+ elInput = document.getElementById("representation");
|
|
|
+ } else {
|
|
|
+ elInput = document.getElementById("range");
|
|
|
+ }
|
|
|
+ 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();
|
|
|
+ },
|
|
|
rowDbclick(row) {
|
|
|
- let optionCode = row.optionCode
|
|
|
+ this.scorRuleSplit(row.optionCode);
|
|
|
+ },
|
|
|
+ scorRuleSplit(val) {
|
|
|
let elInput = null
|
|
|
if (this.isrepresentation) {
|
|
|
elInput = document.getElementById("representation");
|
|
@@ -265,7 +498,7 @@ export default {
|
|
|
let endPos = elInput.selectionEnd;
|
|
|
if (startPos === undefined || endPos === undefined) return;
|
|
|
let txt = elInput.value;
|
|
|
- let txtSplit = optionCode;
|
|
|
+ let txtSplit = val;
|
|
|
let result = txt.substring(0, startPos) + txtSplit + txt.substring(endPos);
|
|
|
elInput.value = result;
|
|
|
elInput.focus();
|
|
@@ -297,7 +530,9 @@ export default {
|
|
|
},
|
|
|
saverulesDetailMsg() {
|
|
|
let that = this
|
|
|
- if (that.itemForm.representation === '' || that.itemForm.range === '' || that.itemForm.desc === '') return
|
|
|
+ let repre = document.getElementById("representation").value
|
|
|
+ let range = document.getElementById("range").value
|
|
|
+ if (repre === '' || range === '' || that.itemForm.desc === '') return
|
|
|
that.saveAndEditIndicatorData()
|
|
|
},
|
|
|
//新增/修改指标数据
|