Browse Source

Merge branch 'master' of http://git.techwx.com/framework/SMO

章志文 4 months ago
parent
commit
264fc142c0

+ 3 - 3
src/components/SelectItem/index.vue

@@ -48,12 +48,12 @@ const filteredList = computed(() => {
   if (!searchQuery.value) {
     return props.selectList || [];
   }
+  const upperCaseSearchQuery = searchQuery.value.toUpperCase(); // 将搜索查询转换为大写
   return (props.selectList || []).filter(item =>
-    item.as_code.includes(searchQuery.value) ||
-    item.as_name.includes(searchQuery.value)
+    item.as_code.toUpperCase().includes(upperCaseSearchQuery) || // 将数据项转换为大写后比较
+    item.as_name.toUpperCase().includes(upperCaseSearchQuery) // 将数据项转换为大写后比较
   );
 });
-
 const all = () => {
   const allCodes = props.selectList.map(item => item.as_code);
   if (checkboxList.value.length === allCodes.length) {

+ 16 - 0
src/styles/element.scss

@@ -168,6 +168,9 @@
         .el-table__body tr.el-table__row--striped td.el-table__cell {
             background: var(--el-disabled-bg-color);
         }
+        .caret-wrapper {
+         width: 10px!important;
+        }
         .el-table__header th {
             height: 45px;
             font-size: 14px;
@@ -339,6 +342,19 @@
     padding: 0 12px 0 0;
 }
 
+.form-item__label2 {
+  align-items: flex-start;
+  box-sizing: border-box;
+  color: var(--el-text-color-regular);
+  display: inline-flex;
+  flex: 0 0 auto;
+  font-size: var(--el-form-label-font-size);
+  height: 32px;
+  justify-content: flex-end;
+  line-height: 32px;
+  padding: 0 12px 0 0;
+}
+
 .operation-img {
     width: 15px;
     height: 15px;

+ 5 - 4
src/views/alarm/allData/index.vue

@@ -505,14 +505,14 @@ const changeSelected = (index) =>{
 
 const updateColumns = () => {
   const column = [
-    { prop: "as_name", label: "站名", width: 100,fixed:true },
-    { prop: "as_code", label: "站号", width: 100,fixed:true },
+    { prop: "as_name", label: "站名", width: 80,fixed:true },
+    { prop: "as_code", label: "站号", width: 70,fixed:true },
     { prop: "data_time_i", label: "观测时间", width: 145,fixed:true,sortable: true, }
   ];
 
   const newColumns = customizeColumns.value.map(item => ({
     prop: item.data_id.toString(),
-    label: item.data_name +'('+item.data_unit+')',
+    label: item.data_name +''+item.data_unit+'',
     sortable: true,
     // width: calculateTextLengthInPixels(item.data_name)
   }));
@@ -639,6 +639,7 @@ function loadCustomizeColumns() {
 let intervalId;
 
 onActivated(() => {
+  getList();
   intervalId = setInterval(() => {
     getList();
   }, 30 * 1000);
@@ -653,7 +654,7 @@ const renderHeader = ({ column }: { column: any }) => {
   const span = document.createElement('span');
   span.innerText = column.label;
   document.body.appendChild(span);
-  column.minWidth = span.getBoundingClientRect().width+35;
+  column.minWidth = span.getBoundingClientRect().width+21;
   document.body.removeChild(span);
 };
 

+ 7 - 1
src/views/alarm/allDevice/index.vue

@@ -311,7 +311,7 @@ const getDeviceStatus = async () => {
           state.normal.push(item.as_code);
         }
         // state.normal++;
-      } else if (sta.state === 2) { // 注意:你的要求中提到了state为2的个数,但原始数据中并没有state为2的例子,这里我假设你需要统计它  
+      } else if (sta.state === 2) { // 注意:你的要求中提到了state为2的个数,但原始数据中并没有state为2的例子,这里我假设你需要统计它
         if (!state.warning.includes(item.as_code)) {
           state.warning.push(item.as_code);
         }
@@ -734,6 +734,12 @@ onMounted(() => {
 let intervalId;
 
 onActivated(() => {
+  weatherInfo()
+  getCertificate();
+  getFTP();
+  getDeviceStatus();
+  getArrive();
+
   intervalId = setInterval(() => {
     // getList();
     weatherInfo()

+ 6 - 3
src/views/alarm/allWeather/index.vue

@@ -6,7 +6,7 @@
         <div class="header-button-lf">
           <el-form :model="pageable" label-width="auto"  :inline="true">
             <el-form-item label="站号:">
-              <SelectItem :select-data="selectedData" :select-list="platformList" :is-checkbox="true" @update:selectedItems="selectedItems" style="width: 200px"> </SelectItem>
+              <SelectItem :select-data="selectedData" :select-list="platformList" :is-checkbox="false" @update:selectedItems="selectedItems" style="width: 200px"> </SelectItem>
             </el-form-item>
             <el-form-item>
               <el-button type="primary" @click="handleQuery"> 查询 </el-button>
@@ -181,8 +181,10 @@ const selectedItems =(data)=>{
   if(data.length>0){
     pageable.value.as_code_list = data
   }else {
-    const firstCode = platformList.value[0]?.as_code ?? null;
-    pageable.value.as_code_list = firstCode ? [firstCode] : [];
+    // const firstCode = platformList.value[0]?.as_code ?? null;
+    // pageable.value.as_code_list = firstCode ? [firstCode] : [];
+    const allCodes = platformList.value.map(item => item.as_code);
+    pageable.value.as_code_list = allCodes
   }
 };
 
@@ -245,6 +247,7 @@ onMounted(() => {
 });
 
 onActivated(() => {
+  getList();
   intervalId = setInterval(() => {
     getList();
   }, 30 * 1000);

+ 1 - 0
src/views/alarm/software/index.vue

@@ -152,6 +152,7 @@ onMounted(() => {
 
 let intervalId;
 onActivated(() => {
+  getList()
   intervalId = setInterval(() => {
     getList()
   }, 30 * 1000);

+ 3 - 3
src/views/query/deviceHealth/index.vue

@@ -674,8 +674,8 @@ const submitForm = () => {
 
 const updateColumns = () => {
   const column = [
-    { prop: "as_name", label: "站名", width: 100,fixed:true },
-    { prop: "as_code", label: "站号", width: 100,fixed:true },
+    { prop: "as_name", label: "站名", width: 80,fixed:true },
+    { prop: "as_code", label: "站号", width: 70,fixed:true },
     { prop: "data_time_i", label: "观测时间", width: 140,fixed:true }
   ];
   const newColumns = customizeColumns.value.map(item => ({
@@ -693,7 +693,7 @@ const updateColumns = () => {
 
 // 大概计算字符串长度
 function calculateTextLengthInPixels(text) {
-  return (text.length * 14)+30;
+  return (text.length * 14)+20;
 }
 
 const changeCodeList =(value)=>{

+ 76 - 25
src/views/query/hazardousWeather/index.vue

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

+ 10 - 9
src/views/query/queryObservationData/index.vue

@@ -9,6 +9,7 @@
               <el-checkbox v-model="isStand" @change="changeStand" label="多站" />
               <SelectItem v-show="isStand" :select-data="selectedData" :select-list="platformList" :is-checkbox="false"
                 @update:selectedItems="selectedItems" style="width: 200px;margin:0 10px"> </SelectItem>
+
               <el-form-item label="观测时间:" v-if="isStand">
                 <el-switch v-model="hot" inline-prompt active-text="正点" size="default" inactive-text="分钟"
                   @change="changeHot" />
@@ -25,24 +26,24 @@
 
               <SelectItem v-show="!isStand" :select-data="selectedData" :select-list="platformList" :is-checkbox="true"
                 @update:selectedItems="selectedItems2" style="width: 200px;margin:0 10px"> </SelectItem>
+
+
+              
               <el-form-item label="观测时间:" v-if="!isStand">
                 <el-switch v-model="hot" inline-prompt active-text="正点" size="default" inactive-text="分钟"
                   @change="changeHot" />
-
-                <span class="form-item__label">日界:</span>
+                <span class="form-item__label2">日界:</span>
                 <el-switch v-model="points" inline-prompt active-text="0点" size="default" inactive-text="18点"
                   @change="changePoints" />
-
                 <el-date-picker style="margin-left: 10px" v-model="singleTime" type="date" placeholder="请选择"
                   @change="changeTime" />
               </el-form-item>
 
               <el-form-item v-if="!hot" label="数据密度:">
-                <el-select v-model="pageable.time_space" style="width: 240px" filterable placeholder="请选择" clearable>
+                <el-select v-model="pageable.time_space" style="width: 100px" filterable placeholder="请选择" clearable>
                   <el-option v-for="item in timeSpaceList" :key="item.value" :label="item.label" :value="item.value" />
                 </el-select>
               </el-form-item>
-
             </el-form-item>
             <el-form-item>
               <el-button type="primary" @click="handleQuery"> 查询 </el-button>
@@ -724,14 +725,14 @@ let customizeColumns = ref<any>([
 
 const updateColumns = () => {
   const column = [
-    { prop: "as_name", label: "站名", width: 100,fixed:true },
-    { prop: "as_code", label: "站号", width: 100,fixed:true },
+    { prop: "as_name", label: "站名", width: 80,fixed:true },
+    { prop: "as_code", label: "站号", width: 70,fixed:true },
     { prop: "data_time_i", label: "观测时间", width: 140, sortable: true,fixed:true }
   ];
 
   const newColumns = customizeColumns.value.map(item => ({
     prop: item.data_id.toString(),
-    label: item.data_name + '(' + item.data_unit + ')',
+    label: item.data_name + '' + item.data_unit + '',
     sortable: true,
     // width: calculateTextLengthInPixels(item.data_name)
   }));
@@ -848,7 +849,7 @@ const renderHeader = ({ column }: { column: any }) => {
   const span = document.createElement('span');
   span.innerText = column.label;
   document.body.appendChild(span);
-  column.minWidth = span.getBoundingClientRect().width + 35;
+  column.minWidth = span.getBoundingClientRect().width + 21;
   document.body.removeChild(span);
 };