|
|
@@ -56,38 +56,28 @@
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="周期" prop="alertCycleValue">
|
|
|
<el-col :span="16">
|
|
|
- <el-input-number
|
|
|
+ <el-input
|
|
|
v-model="formData.alertCycleValue"
|
|
|
placeholder="请输入"
|
|
|
size="small"
|
|
|
- :min="0"
|
|
|
- :precision="1"
|
|
|
- :controls="false"
|
|
|
- style="width: 100%"
|
|
|
+ @input="handleInput"
|
|
|
/>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-select v-model="formData.alertCycleUnit" size="small">
|
|
|
- <el-option
|
|
|
- v-for="(value, key) in cycleUnitOpt"
|
|
|
- :key="key"
|
|
|
- :label="value"
|
|
|
- :value="key"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
+ <el-form-item prop="alertCycleUnit" label-width="0px">
|
|
|
+ <el-select v-model="formData.alertCycleUnit" size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="(value, key) in cycleUnitOpt"
|
|
|
+ :key="key"
|
|
|
+ :label="value"
|
|
|
+ :value="key"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <!-- 阈值 -->
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="阈值" prop="thresholdValue">
|
|
|
- <el-input
|
|
|
- v-model="formData.thresholdValue"
|
|
|
- placeholder="请输入"
|
|
|
- size="small"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
+
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="状态" prop="enabled">
|
|
|
<el-select
|
|
|
@@ -98,14 +88,6 @@
|
|
|
<el-option label="生效" :value="1">生效</el-option>
|
|
|
<el-option label="失效" :value="0">失效</el-option>
|
|
|
</el-select>
|
|
|
- <!-- <el-switch
|
|
|
- v-model="formData.enabled"
|
|
|
- active-text="生效"
|
|
|
- inactive-text="失效"
|
|
|
- :active-value="1"
|
|
|
- :inactive-value="0"
|
|
|
- >
|
|
|
- </el-switch> -->
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -133,24 +115,49 @@
|
|
|
:rules="contentConfigFormRules.targetAddressName"
|
|
|
>
|
|
|
<el-input
|
|
|
+ placeholder="请选择"
|
|
|
v-model="scope.row.targetAddressName"
|
|
|
@focus="handleAddInfo(scope.row, scope.$index)"
|
|
|
- ></el-input>
|
|
|
- <!-- <el-select
|
|
|
- v-model="scope.row.manager"
|
|
|
- placeholder="请选择"
|
|
|
- style="width: 100%"
|
|
|
- filterable
|
|
|
- multiple
|
|
|
>
|
|
|
+ <template #suffix>
|
|
|
+ <el-badge :value="NumberOfPeople"></el-badge>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="alertLevel" label="预警级别" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'actionList.' + scope.$index + '.alertLevel'"
|
|
|
+ label-width="0"
|
|
|
+ :rules="contentConfigFormRules.alertLevel"
|
|
|
+ >
|
|
|
+ <el-select size="small" v-model="scope.row.alertLevel">
|
|
|
<el-option
|
|
|
- v-for="item in managerData"
|
|
|
- :key="item.id"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </el-select> -->
|
|
|
+ v-for="(value, key) in allAlertLevelData"
|
|
|
+ :key="key"
|
|
|
+ :label="value"
|
|
|
+ :value="key"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="thresholdValue" label="阈值" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item
|
|
|
+ :prop="'actionList.' + scope.$index + '.thresholdValue'"
|
|
|
+ label-width="0"
|
|
|
+ :rules="contentConfigFormRules.thresholdValue"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.thresholdValue"
|
|
|
+ placeholder="请输入"
|
|
|
+ @input="
|
|
|
+ handleInputByTable(scope.row.thresholdValue, scope.$index)
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -173,22 +180,6 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <!-- <el-table-column prop="urgent" label="紧急程度" width="120">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- :prop="'actionList.' + scope.$index + '.urgent'"
|
|
|
- label-width="0"
|
|
|
- :rules="contentConfigFormRules.urgent"
|
|
|
- >
|
|
|
- <DictSelection
|
|
|
- dictName="紧急程度"
|
|
|
- v-model="scope.row.urgent"
|
|
|
- :disabled="isBindPlan"
|
|
|
- >
|
|
|
- </DictSelection>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column> -->
|
|
|
<el-table-column
|
|
|
prop="alertMessageTempateCode"
|
|
|
label="模板编码"
|
|
|
@@ -206,6 +197,7 @@
|
|
|
placeholder="请选择"
|
|
|
v-model="scope.row.alertMessageTempateCode"
|
|
|
@change="changeTemplate(scope.row, scope.$index)"
|
|
|
+ filterable
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in templateData"
|
|
|
@@ -218,7 +210,7 @@
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="content" label="内容" width="240">
|
|
|
+ <el-table-column prop="content" label="内容">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
@@ -229,7 +221,7 @@
|
|
|
></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作">
|
|
|
+ <el-table-column label="操作" width="80">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
type="text"
|
|
|
@@ -258,10 +250,7 @@
|
|
|
import {
|
|
|
saveOrUpdate,
|
|
|
getCode,
|
|
|
- getDetail,
|
|
|
- listAllRulesObj,
|
|
|
- listAllDateUnit,
|
|
|
- listAllActionType
|
|
|
+ getDetail
|
|
|
} from '@/api/ruleManagement/earlyWarning';
|
|
|
import { notifyTemplatePageAPI } from '@/api/notifyManage';
|
|
|
import { getUserPage } from '@/api/system/organization';
|
|
|
@@ -290,14 +279,14 @@
|
|
|
ruleObjCode: '',
|
|
|
alertCycleValue: '1',
|
|
|
alertCycleUnit: '',
|
|
|
- thresholdValue: '',
|
|
|
enabled: 1,
|
|
|
actionList: [
|
|
|
{
|
|
|
targetAddress: '',
|
|
|
targetAddressName: '',
|
|
|
actionType: '',
|
|
|
- // urgent: '',
|
|
|
+ alertLevel: '',
|
|
|
+ thresholdValue: '',
|
|
|
alertMessageTempateCode: '',
|
|
|
content: ''
|
|
|
}
|
|
|
@@ -313,19 +302,24 @@
|
|
|
ruleObjCode: [
|
|
|
{ required: true, message: '请选择预警对象', trigger: 'blur' }
|
|
|
],
|
|
|
+ alertCycleUnit: [
|
|
|
+ { required: true, message: '请输入周期单位', trigger: 'blur' }
|
|
|
+ ],
|
|
|
alertCycleValue: [
|
|
|
{ required: true, message: '请输入周期', trigger: 'blur' }
|
|
|
],
|
|
|
-
|
|
|
+ alertLevel: [
|
|
|
+ { required: true, message: '请选择紧急程度', trigger: 'blur' }
|
|
|
+ ],
|
|
|
targetAddressName: [
|
|
|
{ required: true, message: '请选择通知人', trigger: 'blur' }
|
|
|
],
|
|
|
actionType: [
|
|
|
{ required: true, message: '请选择操作类型', trigger: 'blur' }
|
|
|
],
|
|
|
- // urgent: [
|
|
|
- // { required: true, message: '请选择紧急程度', trigger: 'blur' }
|
|
|
- // ],
|
|
|
+ thresholdValue: [
|
|
|
+ { required: true, message: '请输入阈值', trigger: 'blur' }
|
|
|
+ ],
|
|
|
alertMessageTempateCode: [
|
|
|
{ required: true, message: '请选择模板编码', trigger: 'blur' }
|
|
|
]
|
|
|
@@ -333,9 +327,12 @@
|
|
|
isBindPlan: '',
|
|
|
managerData: [],
|
|
|
templateData: [],
|
|
|
+ NumberOfPeople: '',
|
|
|
+
|
|
|
allRulesData: {},
|
|
|
cycleUnitOpt: {},
|
|
|
- operationTypeData: {}
|
|
|
+ operationTypeData: {},
|
|
|
+ allAlertLevelData: {}
|
|
|
};
|
|
|
},
|
|
|
watch: {},
|
|
|
@@ -343,27 +340,60 @@
|
|
|
this.gettemplateList();
|
|
|
this.getInfo();
|
|
|
},
|
|
|
-
|
|
|
+ mounted() {
|
|
|
+ const str1 = localStorage.getItem('allRulesData');
|
|
|
+ if (str1) {
|
|
|
+ this.allRulesData = JSON.parse(str1);
|
|
|
+ }
|
|
|
+ const str2 = localStorage.getItem('cycleUnitOpt');
|
|
|
+ if (str2) {
|
|
|
+ this.cycleUnitOpt = JSON.parse(str2);
|
|
|
+ }
|
|
|
+ const str3 = localStorage.getItem('operationTypeData');
|
|
|
+ if (str3) {
|
|
|
+ this.operationTypeData = JSON.parse(str3);
|
|
|
+ }
|
|
|
+ const str4 = localStorage.getItem('allAlertLevelData');
|
|
|
+ if (str4) {
|
|
|
+ this.allAlertLevelData = JSON.parse(str4);
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
- async getAllRulesObj() {
|
|
|
- const res = await listAllRulesObj();
|
|
|
- this.allRulesData = res;
|
|
|
- },
|
|
|
- async getAllDateUnit() {
|
|
|
- const res = await listAllDateUnit();
|
|
|
- this.cycleUnitOpt = res;
|
|
|
+ handleInput(value) {
|
|
|
+ //表单输入框 只保留数字和小数点
|
|
|
+ // const filteredValue = value.replace(/[^0-9.]/g, '');
|
|
|
+ // let finalValue = '';
|
|
|
+ // const dotIndex = filteredValue.indexOf('.');
|
|
|
+ // if (dotIndex !== -1) {
|
|
|
+ // finalValue = filteredValue.slice(0, dotIndex + 3);
|
|
|
+ // } else {
|
|
|
+ // finalValue = filteredValue;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // 只能输入数字
|
|
|
+ this.formData.alertCycleValue = value.replace(/[^0-9]/g, '');
|
|
|
},
|
|
|
- async getAllActionType() {
|
|
|
- const res = await listAllActionType();
|
|
|
- this.operationTypeData = res;
|
|
|
+ handleInputByTable(value, index) {
|
|
|
+ // 表内限制输入框 只保留数字和小数点
|
|
|
+ const filteredValue = value.replace(/[^0-9.]/g, '');
|
|
|
+ let finalValue = '';
|
|
|
+ const dotIndex = filteredValue.indexOf('.');
|
|
|
+ if (dotIndex !== -1) {
|
|
|
+ finalValue = filteredValue.slice(0, dotIndex + 3);
|
|
|
+ } else {
|
|
|
+ finalValue = filteredValue;
|
|
|
+ }
|
|
|
+ this.formData.actionList[index].thresholdValue = finalValue;
|
|
|
},
|
|
|
+
|
|
|
handleAddInfo(row, index) {
|
|
|
this.formData.actionList[index].targetAddress = '';
|
|
|
this.formData.actionList[index].targetAddressName = '';
|
|
|
this.$refs.selectPersonDialogRef.open(row, index);
|
|
|
},
|
|
|
changeParent(list, index) {
|
|
|
- console.log(list, 'list', this.isBindPlan);
|
|
|
+ this.NumberOfPeople = list.length;
|
|
|
+ console.log(list.length, 'list', this.isBindPlan);
|
|
|
let ids = list
|
|
|
.map((item) => {
|
|
|
return item.id;
|
|
|
@@ -392,7 +422,10 @@
|
|
|
pageNum: 1,
|
|
|
size: 999
|
|
|
});
|
|
|
- this.templateData = res?.list;
|
|
|
+ if (res?.list) {
|
|
|
+ this.templateData = res.list;
|
|
|
+ localStorage.setItem('templateData', JSON.stringify(res.list));
|
|
|
+ }
|
|
|
},
|
|
|
async getInfo() {
|
|
|
getUserPage({
|
|
|
@@ -402,12 +435,8 @@
|
|
|
});
|
|
|
},
|
|
|
async openDialog(row, type) {
|
|
|
- this.addMatterDialog = true;
|
|
|
this.isBindPlan = type;
|
|
|
-
|
|
|
- await this.getAllRulesObj();
|
|
|
- await this.getAllDateUnit();
|
|
|
- await this.getAllActionType();
|
|
|
+ // await this.getAllData();
|
|
|
if (type != 'add') {
|
|
|
this.getRuleInfo(row.id, type);
|
|
|
} else {
|
|
|
@@ -418,6 +447,7 @@
|
|
|
if (type != 'edit') {
|
|
|
this.getOrderCode();
|
|
|
}
|
|
|
+ this.addMatterDialog = true;
|
|
|
},
|
|
|
|
|
|
async getRuleInfo(id, type) {
|
|
|
@@ -460,8 +490,10 @@
|
|
|
if (this.formData.actionList) {
|
|
|
this.formData.actionList.push({
|
|
|
targetAddress: '',
|
|
|
+ targetAddressName: '',
|
|
|
actionType: '',
|
|
|
- // urgent: '',
|
|
|
+ alertLevel: '',
|
|
|
+ thresholdValue: '',
|
|
|
alertMessageTempateCode: '',
|
|
|
content: ''
|
|
|
});
|
|
|
@@ -469,8 +501,10 @@
|
|
|
let arr = [
|
|
|
{
|
|
|
targetAddress: '',
|
|
|
+ targetAddressName: '',
|
|
|
actionType: '',
|
|
|
- // urgent: '',
|
|
|
+ alertLevel: '',
|
|
|
+ thresholdValue: '',
|
|
|
alertMessageTempateCode: '',
|
|
|
content: ''
|
|
|
}
|
|
|
@@ -497,8 +531,6 @@
|
|
|
this.handleClose();
|
|
|
this.$emit('done');
|
|
|
}
|
|
|
- } else {
|
|
|
- this.$message.warning('请将信息补充完整!');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -587,4 +619,8 @@
|
|
|
::v-deep .el-input-number .el-input__inner {
|
|
|
text-align: left !important;
|
|
|
}
|
|
|
+
|
|
|
+ ::v-deep .el-badge__content {
|
|
|
+ font-size: 10px;
|
|
|
+ }
|
|
|
</style>
|