|
@@ -21,12 +21,16 @@
|
|
|
<el-form-item label="告警时间:">
|
|
|
<el-date-picker
|
|
|
v-model="timeBegin"
|
|
|
- type="datetimerange"
|
|
|
- range-separator="至"
|
|
|
- start-placeholder="开始日期"
|
|
|
- end-placeholder="结束日期"
|
|
|
+ type="date"
|
|
|
+ placeholder="选择日期"
|
|
|
@change="changeBeginTime"
|
|
|
- />
|
|
|
+ :clearable="false"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ <!-- 减少一天 -->
|
|
|
+ <el-button style="margin: 0 5px" @click="decreaseDay" icon="ArrowLeft"></el-button>
|
|
|
+ <!-- 增加一天 -->
|
|
|
+ <el-button @click="increaseDay" icon="ArrowRight" :disabled="isIncreaseDay"></el-button>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="handleQuery"> 查询 </el-button>
|
|
@@ -100,20 +104,51 @@ const pageable = ref<any>({
|
|
|
});
|
|
|
|
|
|
const as_code_list = ref('')
|
|
|
-const timeBegin = ref()
|
|
|
-
|
|
|
-function changeBeginTime(value) {
|
|
|
- // 获取开始日期的时间戳
|
|
|
- const startTimestamp = new Date(value[0]).getTime()/1000;
|
|
|
- // 获取结束日期的时间戳
|
|
|
- const endTimestamp = new Date(value[1]).getTime()/1000;
|
|
|
+const timeBegin = ref<Date | null>(null);
|
|
|
+const isIncreaseDay =ref(true)
|
|
|
+
|
|
|
+const changeBeginTime = (value: Date | string | null) => {
|
|
|
+ if (!value) return;
|
|
|
+ const timeStamp = new Date(value).getTime();
|
|
|
+ const startTime = timeStamp + 60 * 1000; // 添加1分钟(60秒)
|
|
|
+ const endTime = timeStamp + 24 * 60 * 60 * 1000; // 添加一天(24小时)
|
|
|
+ pageable.value.begin_time = startTime / 1000;
|
|
|
+ pageable.value.end_time = endTime / 1000;
|
|
|
+
|
|
|
+
|
|
|
+ const newDate = new Date(value);
|
|
|
+ const today = new Date();
|
|
|
+ today.setHours(0, 0, 0, 0); // 将时间设置为当天的0点0分0秒
|
|
|
+ if (newDate < today) {
|
|
|
+ isIncreaseDay.value = false
|
|
|
+ }else {
|
|
|
+ isIncreaseDay.value = true
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
- pageable.value.begin_time = startTimestamp
|
|
|
- pageable.value.end_time = endTimestamp
|
|
|
-}
|
|
|
+const tact_state =ref(0)
|
|
|
|
|
|
+const decreaseDay = () => {
|
|
|
+ if (timeBegin.value) {
|
|
|
+ pageable.value.pageNum = 1;
|
|
|
+ const newDate = new Date(timeBegin.value);
|
|
|
+ newDate.setDate(newDate.getDate() - 1);
|
|
|
+ timeBegin.value = newDate;
|
|
|
+ changeBeginTime(newDate);
|
|
|
+ getList()
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
-const tact_state =ref(0)
|
|
|
+const increaseDay = () => {
|
|
|
+ if (timeBegin.value) {
|
|
|
+ pageable.value.pageNum = 1;
|
|
|
+ const newDate = new Date(timeBegin.value);
|
|
|
+ newDate.setDate(newDate.getDate() + 1);
|
|
|
+ timeBegin.value = newDate;
|
|
|
+ changeBeginTime(newDate);
|
|
|
+ getList()
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
const tactList = [
|
|
|
{
|
|
@@ -193,29 +228,37 @@ const handleQuery = () => {
|
|
|
|
|
|
//清空查询
|
|
|
const resetQuery = () => {
|
|
|
- const allCodes = platformList.value.map(item => item.as_code);
|
|
|
- pageable.value.as_code_list = allCodes
|
|
|
- selectedData.value = []
|
|
|
-
|
|
|
+ selectedData.value = firstPlatform.value
|
|
|
+ pageable.value.as_code_list = firstPlatform.value
|
|
|
pageable.value.pageNum = 1;
|
|
|
pageable.value.begin_time=undefined
|
|
|
pageable.value.end_time=undefined
|
|
|
as_code_list.value = ''
|
|
|
timeBegin.value = undefined
|
|
|
+ getTime()
|
|
|
getList()
|
|
|
};
|
|
|
|
|
|
//搜索站号
|
|
|
-const selectedData= ref([])
|
|
|
+const selectedData= ref()
|
|
|
const selectedItems =(data)=>{
|
|
|
if(data.length>0){
|
|
|
pageable.value.as_code_list = data
|
|
|
+ selectedData.value = data
|
|
|
}else {
|
|
|
- const allCodes = platformList.value.map(item => item.as_code);
|
|
|
- pageable.value.as_code_list = allCodes
|
|
|
+ selectedData.value = firstPlatform.value
|
|
|
+ pageable.value.as_code_list = firstPlatform.value
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const firstPlatform = computed(() => {
|
|
|
+ if (platformList.value && platformList.value.length > 0) {
|
|
|
+ return [platformList.value[0].as_code];
|
|
|
+ } else {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
/**
|
|
|
* @description 每页条数改变
|
|
|
* @param {Number} val 当前条数
|
|
@@ -266,11 +309,19 @@ const getList = async () => {
|
|
|
};
|
|
|
|
|
|
onMounted(() => {
|
|
|
- const allCodes = platformList.value.map(item => item.as_code);
|
|
|
- pageable.value.as_code_list = allCodes
|
|
|
+ getTime()
|
|
|
+ selectedData.value = firstPlatform.value
|
|
|
+ pageable.value.as_code_list = firstPlatform.value
|
|
|
getList()
|
|
|
})
|
|
|
|
|
|
+const getTime=()=>{
|
|
|
+ const defaultDate = new Date();
|
|
|
+ defaultDate.setHours(0, 0, 0, 0); // 将时间设置为当天的0点0分0秒
|
|
|
+ timeBegin.value = defaultDate;
|
|
|
+ changeBeginTime(defaultDate); // 调用changeBeginTime方法
|
|
|
+}
|
|
|
+
|
|
|
const userStore = useUserStore();
|
|
|
const platformList =ref<any>(computed(() => userStore.stations))
|
|
|
|