【web】 信息采集修改

dev
Wangxin 8 months ago
parent 7796455523
commit 387952c9c5
  1. 175
      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,22 +19,31 @@
<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>
<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-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -78,44 +87,49 @@ export default {
name: "User", name: "User",
components: { Treeselect, Splitpanes, Pane }, components: { Treeselect, Splitpanes, Pane },
data() { data() {
return { return {
// //
radio: 1, radio: 1,
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
single: true, single: true,
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
userList: null, userList: null,
// //
title: "", title: "",
// //
open: false, open: false,
// //
queryParams: { queryParams: {
ruleType: 0, ruleType: 0,
frequency: 1, frequency: 1,
gatherTime: null, gatherTime: null,
startTime: null, startTime: null,
endTime: null, endTime: null
// },
dateRange: [], //
}, endDatePickerOptions: {
disabledDate: (time) => {
// //
rules: { if (this.queryParams.startTime) {
dateRange: [ const startDate = new Date(this.queryParams.startTime).getTime();
{ required: true, message: "采集时间不能为空", trigger: "blur" } return time.getTime() < startDate;
], }
} return false;
}
},
//
rules: {}
} }
}, },
watch: { watch: {
@ -139,20 +153,33 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { //
if (valid) { if (!this.queryParams.startTime) {
addRule(this.queryParams).then(response => { this.$message.warning("请选择开始日期");
this.$modal.msgSuccess("新增成功") return;
this.open = false }
this.getList()
}) //
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) { //
// 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;
}
} }
} }
},
// //
this.queryParams.startTime = value ? value[0] : null; handleEndTimeChange(value) {
this.queryParams.endTime = value ? value[1] : null; //
if (value && this.queryParams.startTime) {
const endTime = new Date(value).getTime();
const startTime = new Date(this.queryParams.startTime).getTime();
if (endTime < startTime) {
this.queryParams.endTime = this.queryParams.startTime;
}
}
}, },
// //

@ -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