修bug
This commit is contained in:
@@ -113,17 +113,17 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="传感器类型" prop="sensor_type" required>
|
||||
<el-select v-model="form.sensor_type" placeholder="请选择" :disabled="isEdit">
|
||||
<el-option v-for="(label, key) in SensorType" :key="key" :label="label" :value="key"></el-option>
|
||||
<el-option v-for="(label, key) in SensorType" :key="key" :label="label" :value="label"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="告警等级" prop="level" required>
|
||||
<el-select v-model="form.level" placeholder="请选择">
|
||||
<el-option v-for="(label, key) in SeverityLevel" :key="key" :label="label" :value="key"></el-option>
|
||||
<el-option v-for="(label, key) in SeverityLevel" :key="key" :label="label" :value="label"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作符" prop="operator" required>
|
||||
<el-select v-model="form.operator" placeholder="请选择">
|
||||
<el-option v-for="(label, key) in Operator" :key="key" :label="label" :value="key"></el-option>
|
||||
<el-option v-for="(label, key) in Operator" :key="key" :label="label" :value="label"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="阈值" prop="thresholds" required>
|
||||
@@ -322,9 +322,25 @@ export default {
|
||||
async createRule() {
|
||||
const { id, ...requestBody } = this.form;
|
||||
if (this.activeTab === 'area') {
|
||||
await AlarmApi.createAreaThresholdAlarm(requestBody);
|
||||
// 区域告警只传递区域主控相关的字段
|
||||
const areaRequestBody = {
|
||||
area_controller_id: requestBody.area_controller_id,
|
||||
sensor_type: requestBody.sensor_type,
|
||||
level: requestBody.level,
|
||||
operator: requestBody.operator,
|
||||
thresholds: requestBody.thresholds,
|
||||
};
|
||||
await AlarmApi.createAreaThresholdAlarm(areaRequestBody);
|
||||
} else {
|
||||
await AlarmApi.createDeviceThresholdAlarm(requestBody);
|
||||
// 设备告警只传递设备相关的字段
|
||||
const deviceRequestBody = {
|
||||
device_id: requestBody.device_id,
|
||||
sensor_type: requestBody.sensor_type,
|
||||
level: requestBody.level,
|
||||
operator: requestBody.operator,
|
||||
thresholds: requestBody.thresholds,
|
||||
};
|
||||
await AlarmApi.createDeviceThresholdAlarm(deviceRequestBody);
|
||||
}
|
||||
},
|
||||
async updateRule() {
|
||||
|
||||
Reference in New Issue
Block a user