|
|
@@ -56,24 +56,24 @@
|
|
|
<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"
|
|
|
- :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>
|
|
|
@@ -88,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>
|
|
|
@@ -162,6 +154,9 @@
|
|
|
<el-input
|
|
|
v-model="scope.row.thresholdValue"
|
|
|
placeholder="请输入"
|
|
|
+ @input="
|
|
|
+ handleInputByTable(scope.row.thresholdValue, scope.$index)
|
|
|
+ "
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
@@ -255,11 +250,7 @@
|
|
|
import {
|
|
|
saveOrUpdate,
|
|
|
getCode,
|
|
|
- getDetail,
|
|
|
- listAllRulesObj,
|
|
|
- listAllDateUnit,
|
|
|
- listAllActionType,
|
|
|
- listAllAlertLevel
|
|
|
+ getDetail
|
|
|
} from '@/api/ruleManagement/earlyWarning';
|
|
|
import { notifyTemplatePageAPI } from '@/api/notifyManage';
|
|
|
import { getUserPage } from '@/api/system/organization';
|
|
|
@@ -311,6 +302,9 @@
|
|
|
ruleObjCode: [
|
|
|
{ required: true, message: '请选择预警对象', trigger: 'blur' }
|
|
|
],
|
|
|
+ alertCycleUnit: [
|
|
|
+ { required: true, message: '请输入周期单位', trigger: 'blur' }
|
|
|
+ ],
|
|
|
alertCycleValue: [
|
|
|
{ required: true, message: '请输入周期', trigger: 'blur' }
|
|
|
],
|
|
|
@@ -333,10 +327,11 @@
|
|
|
isBindPlan: '',
|
|
|
managerData: [],
|
|
|
templateData: [],
|
|
|
+ NumberOfPeople: '',
|
|
|
+
|
|
|
allRulesData: {},
|
|
|
cycleUnitOpt: {},
|
|
|
operationTypeData: {},
|
|
|
- NumberOfPeople: '',
|
|
|
allAlertLevelData: {}
|
|
|
};
|
|
|
},
|
|
|
@@ -345,22 +340,52 @@
|
|
|
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;
|
|
|
- const res2 = await listAllAlertLevel();
|
|
|
- this.allAlertLevelData = res2;
|
|
|
+ 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 = '';
|
|
|
@@ -397,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({
|
|
|
@@ -408,9 +436,7 @@
|
|
|
},
|
|
|
async openDialog(row, type) {
|
|
|
this.isBindPlan = type;
|
|
|
- await this.getAllRulesObj();
|
|
|
- await this.getAllDateUnit();
|
|
|
- await this.getAllActionType();
|
|
|
+ // await this.getAllData();
|
|
|
if (type != 'add') {
|
|
|
this.getRuleInfo(row.id, type);
|
|
|
} else {
|