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

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

Loading…
Cancel
Save