【web】 信息采集修改

dev
Wangxin 8 months ago
parent 7796455523
commit 387952c9c5
  1. 107
      ALOps_sys_fe/alops-ui/src/views/device/deviceInformation/index.vue
  2. 4
      ALOps_sys_fe/alops-ui/src/views/inMonitoring/devicesState/detail.vue

@ -19,23 +19,32 @@
<el-row v-if="queryParams.ruleType == 0">
<el-col :span="24">
<el-form-item label="采集频率" prop="frequency">
<el-form-item label="采集间隔" prop="frequency">
<el-input-number v-model="queryParams.frequency" controls-position="right" :min="1"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="采集时间限制" prop="dateRange">
<el-form-item label="采集时间限制">
<el-date-picker
v-model="queryParams.dateRange"
@change="handleDateRangeChange"
v-model="queryParams.startTime"
@change="handleStartTimeChange"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
type="datetime"
placeholder="开始日期"
:required="true"
:picker-options="{ disabledDate: disablePastDate }"
>
</el-date-picker>
<span style="margin: 0 10px;"></span>
<el-date-picker
v-model="queryParams.endTime"
@change="handleEndTimeChange"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="结束日期"
:picker-options="endDatePickerOptions"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
@ -105,17 +114,22 @@ export default {
frequency: 1,
gatherTime: null,
startTime: null,
endTime: null,
//
dateRange: [],
endTime: null
},
//
endDatePickerOptions: {
disabledDate: (time) => {
//
if (this.queryParams.startTime) {
const startDate = new Date(this.queryParams.startTime).getTime();
return time.getTime() < startDate;
}
return false;
}
},
//
rules: {
dateRange: [
{ required: true, message: "采集时间不能为空", trigger: "blur" }
],
}
rules: {}
}
},
watch: {
@ -139,20 +153,33 @@ export default {
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
//
if (!this.queryParams.startTime) {
this.$message.warning("请选择开始日期");
return;
}
//
if (this.queryParams.endTime && this.queryParams.startTime) {
const endTime = new Date(this.queryParams.endTime).getTime();
const startTime = new Date(this.queryParams.startTime).getTime();
if (endTime < startTime) {
this.$message.warning("结束时间不能早于开始时间");
return;
}
}
addRule(this.queryParams).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
})
},
handleDateRangeChange(value) {
//
if (value && value[0]) {
const selectedDate = new Date(value[0]);
//
handleStartTimeChange(value) {
if (value) {
const selectedDate = new Date(value);
const now = new Date();
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const selectedDay = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), selectedDate.getDate());
@ -171,18 +198,32 @@ export default {
nextMinute.getMinutes().toString().padStart(2, '0') + ':' +
nextMinute.getSeconds().toString().padStart(2, '0');
//
const newRange = [formattedDate, value[1] || formattedDate];
this.queryParams.dateRange = newRange;
this.queryParams.startTime = newRange[0];
this.queryParams.endTime = newRange[1];
return;
this.queryParams.startTime = formattedDate;
}
//
if (this.queryParams.endTime) {
const endTime = new Date(this.queryParams.endTime).getTime();
const startTime = new Date(this.queryParams.startTime).getTime();
if (endTime < startTime) {
this.queryParams.endTime = null;
}
}
}
},
//
handleEndTimeChange(value) {
//
if (value && this.queryParams.startTime) {
const endTime = new Date(value).getTime();
const startTime = new Date(this.queryParams.startTime).getTime();
//
this.queryParams.startTime = value ? value[0] : null;
this.queryParams.endTime = value ? value[1] : null;
if (endTime < startTime) {
this.queryParams.endTime = this.queryParams.startTime;
}
}
},
//

@ -112,7 +112,7 @@
<span class="info-label">
<i class="fas fa-layer-group"></i> 安装日期
</span>
<span class="info-value">{{parseTime(details.installDate) || '暂无'}}</span>
<span class="info-value">{{details.installDate || '暂无'}}</span>
</div>
<div class="info-item">
<span class="info-label">
@ -141,7 +141,7 @@
<span class="info-label">
<i class="fas fa-layer-group"></i> 预警总数
</span>
<span class="info-value">{{details.handledAlertCount || '暂无'}}</span>
<span class="info-value">{{details.alertCount || '暂无'}}</span>
</div>
</div>
</div>

Loading…
Cancel
Save