Преглед на файлове

feat:报警页面优化

huang, kai (Contractor) преди 2 седмици
родител
ревизия
b416c1dd80

+ 1 - 1
admin.ui.plus-master/src/api/admin/AlarmService/alarmQueryDto.ts

@@ -23,7 +23,7 @@
    /** 推送时间 */
         pushTime?: string
    /** 报警ID */
-        alarmhistoryID?: integer
+        alarmhistoryID?: string
    /** 优先级 */
         taskPriority?: integer
 

+ 2 - 1
admin.ui.plus-master/src/api/admin/AlarmService/alarmRulesDto.ts

@@ -38,7 +38,6 @@ export interface alarmRluesFilterModel {
   condition?:string | null;
   condition2?:string | null;
   cacheFilter?: Partial<alarmRluesFilterModel>;
-  
 }
 
 /**
@@ -50,6 +49,8 @@ export interface alarmRluesFilterModel_SearchFilter {
   Status?: string | null,
   upload?: string | null,
   isActive?:boolean | null
+  pushMethod?: string | null;
+
 }
 
 

+ 46 - 27
admin.ui.plus-master/src/views/admin/authorize/fuelingFTP/index.vue

@@ -18,7 +18,7 @@
               </el-form-item>
             </el-form>
           </div>
-          <div v-if="state.pwdDisplay" style="width: 100%;display: flex;justify-content: center;align-items: center;">
+          <div v-if="state.pwdDisplay" style="width: 100%;display: flex;justify-content: left;align-items: center; margin-top: 20px;">
             <el-form @submit.stop.prevent style="width: 60%;">
               <el-form-item label="FTP密码" style="width: 82%;">
                 <el-input disabled v-model="state.pwd" style="width: 100%;" placeholder="FTP密码"
@@ -29,7 +29,7 @@
               </el-form-item>
             </el-form>
           </div>
-          <div v-if="state.timeDisplay" style="width: 100%;display: flex;justify-content: center;align-items: center;">
+          <div v-if="state.timeDisplay" style="width: 100%;display: flex;justify-content: left;align-items: center;">
             <el-form @submit.stop.prevent style="width: 60%;">
               <el-form-item label="过期时间" style="width: 100%;">
                 {{ state.filter.expirationTime }}
@@ -64,8 +64,8 @@
               :label="column.label" />
           </el-table>
           <div class="my-flex my-flex-end" style="margin-top: 20px">
-            <el-pagination v-model:currentPage="pageState.pageInput.currentPage"
-              v-model:page-size="pageState.pageInput.pageSize" :total="state.total" :page-sizes="[10, 15, 20, 50, 100]" small
+            <el-pagination v-model:currentPage="state.pageInput.CurrentPage"
+              v-model:page-size="state.pageInput.PageSize" :total="state.total" :page-sizes="[10, 15, 20, 50, 100]" small
               background @size-change="onSizeChange" @current-change="onCurrentChange"
               layout="total, sizes, prev, pager, next, jumper" />
           </div>
@@ -110,7 +110,7 @@ const state = reactive({
   /**分页标识 */
   pageInput: {
     CurrentPage: 1,
-    PageSize: 10,
+    PageSize: 15,
   } as pageInput,
   /**分页总数 */
   total: 0,
@@ -132,27 +132,39 @@ const state = reactive({
 })
 
 /**初始化 */
-const init = async () => {
-  state.filter.info = ''
-  state.filter.name = ''
-  state.filter.applyDate = ''
-  state.filter.expirationTime = ''
-  state.pwd = ''
-  state.btnDisplay = true
-  state.msgDisplay = false
-  state.pwdDisplay = false
-  state.timeDisplay = false
-  const res: any = await new FuelingFtpAPI().getFtpDate({ ...state.pageInput, filter: state.filter }).catch(() => {
-    state.loading = false
-  })
-  //console.log(res.data.list)
-  state.total = res.data.total
-  state.tableModel = res.data.list
-}
+const init = async (showLoading: boolean = true) => {
+  if (showLoading) {
+    state.loading = true;
+  }
+
+  state.filter.info = '';
+  state.filter.name = '';
+  state.filter.applyDate = '';
+  state.filter.expirationTime = '';
+  state.pwd = '';
+  state.btnDisplay = true;
+  state.msgDisplay = false;
+  state.pwdDisplay = false;
+  state.timeDisplay = false;
+
+  try {
+    const res: any = await new FuelingFtpAPI().getFtpDate({
+      ...state.pageInput,
+      filter: state.filter
+    });
+
+    state.total = res.data.total;
+    state.tableModel = res.data.list;
+  } catch (error) {
+    console.error('请求失败:', error);
+    ElMessage.error('数据加载失败');
+  } finally {
+    state.loading = false;
+  }
+};
 
 onMounted(() => {
   // 初始化分页大小
-state.pageInput.pageSize = pageState.pageInput.pageSize;
   init()
   eventBus.off('refreshView')
   eventBus.on('refreshView', async () => {
@@ -231,15 +243,22 @@ const flattenObject = (obj, parentKey = '') => {
 
   return result;
 }
+
 /**页条数变化*/
-const onSizeChange = () => {
-  init()
+const onSizeChange = (val: number) => {
+  pageState.pageInput.pageSize = val
+  state.pageInput.PageSize = val
+  state.pageInput.CurrentPage = 1 // 通常切换size会回到第一页
+  init(true)
 }
 
 /**页数变化*/
-const onCurrentChange = () => {
-  init()
+const onCurrentChange = (val: number) => {
+  pageState.pageInput.currentPage = val
+  state.pageInput.CurrentPage = val
+  init(true)
 }
+
 const padZero = (num: any) => {
   return num < 10 ? '0' + num : num
 }

+ 44 - 28
admin.ui.plus-master/src/views/admin/authorize/fuelingFTPofDate/index.vue

@@ -121,7 +121,7 @@ const state = reactive({
   /**分页标识 */
   pageInput: {
     CurrentPage: 1,
-    PageSize: 10,
+    PageSize: 15,
   } as pageInput,
   /**分页总数 */
   total: 0,
@@ -144,28 +144,40 @@ const state = reactive({
 })
 
 /**初始化 */
-const init = async () => {
-  state.filter.info = ''
-  state.filter.name = ''
-  state.filter.applyDate = ''
-  state.filter.expirationTime = ''
-  state.filter.useDate = ''
-  state.pwd = ''
-  state.btnDisplay = true
-  state.msgDisplay = false
-  state.pwdDisplay = false
-  state.timeDisplay = false
-  const res: any = await new FuelingFtpAPI().getFtpDate({ ...state.pageInput, filter: state.filter }).catch(() => {
-    state.loading = false
-  })
-  //console.log(res.data.list)
-  state.total = res.data.total
-  state.tableModel = res.data.list
-}
+const init = async (showLoading: boolean = true) => {
+  if (showLoading) {
+    state.loading = true;
+  }
+
+  state.filter.info = '';
+  state.filter.name = '';
+  state.filter.applyDate = '';
+  state.filter.expirationTime = '';
+  state.pwd = '';
+  state.btnDisplay = true;
+  state.msgDisplay = false;
+  state.pwdDisplay = false;
+  state.timeDisplay = false;
+
+  try {
+    const res: any = await new FuelingFtpAPI().getFtpDate({
+      ...state.pageInput,
+      filter: state.filter
+    });
+
+    state.total = res.data.total;
+    state.tableModel = res.data.list;
+  } catch (error) {
+    console.error('请求失败:', error);
+    ElMessage.error('数据加载失败');
+  } finally {
+    state.loading = false;
+  }
+};
 
 onMounted(() => {
   // 初始化分页大小
-state.pageInput.PageSize = pageState.pageInput.pageSize;
+// state.pageInput.PageSize = pageState.pageInput.pageSize;
   init()
   eventBus.off('refreshView')
   eventBus.on('refreshView', async () => {
@@ -248,15 +260,19 @@ const flattenObject = (obj, parentKey = '') => {
 
   return result;
 }
-/**页条数变化*/
-const onSizeChange = () => {
-  init()
-}
+const onSizeChange = (val: number) => {
+  pageState.pageInput.pageSize = val;
+  state.pageInput.PageSize = val;
+  state.pageInput.CurrentPage = 1;
+  init(true); // 显示 loading
+};
+
+const onCurrentChange = (val: number) => {
+  pageState.pageInput.currentPage = val;
+  state.pageInput.CurrentPage = val;
+  init(true); // 显示 loading
+};
 
-/**页数变化*/
-const onCurrentChange = () => {
-  init()
-}
 const padZero = (num: any) => {
   return num < 10 ? '0' + num : num
 }

+ 12 - 4
admin.ui.plus-master/src/views/admin/statement/alarmManagement/index.vue

@@ -84,7 +84,7 @@
                 width="150">
                 <template #default="{ row }">
     <el-link class="my-el-link mr12 ml12" :href="row.linkUrl" type="primary" icon="ele-Download" size="small"
-      :underline="false" target="_blank" @click="toList">报警推送记录</el-link>
+      :underline="false" target="_blank" @click="toList(row.alarmHistoryID)">报警推送记录</el-link>
       <el-link class="my-el-link mr12 ml12" :href="row.linkUrl" type="primary" icon="ele-Edit" size="small"
       :underline="false" target="_blank" @click="toPage(row)">油机详情</el-link>
       <el-link class="my-el-link mr12 ml12" :href="row.linkUrl" type="primary" icon="ele-InfoFilled" size="small"
@@ -264,9 +264,17 @@ const toPage = (row: {fuelId: any;
   router.push({ path: `/statement/${row.fuelId}` })
 }
 
-const toList = () =>{
-  router.push({ path:`/authorize/statement/alarmQuery`})
-}
+const toList = (alarmHistoryID?: string) => {
+  if (alarmHistoryID) {
+    router.push({
+      path: `/authorize/statement/alarmQuery`,
+      query: { alarmHistoryID } // 传递 alarmHistoryID 作为查询参数
+    });
+  } else {
+    // 没有 alarmHistoryID 时的默认行为
+    router.push({ path: `/authorize/statement/alarmQuery` });
+  }
+};
 
 /**
  * 执行推送规则

+ 3 - 1
admin.ui.plus-master/src/views/admin/yujing/alarmRules/components/add-alarmRules.vue

@@ -658,7 +658,7 @@ const openDialog = (row: alarmRluesFilterModel) => {
   console.log(row)
   if(row){
     console.log(Data.Filter)
-    const { triggerMethod, maintenanceTriggerMethod, ruleName, roleMappingId, labelId,pushUserid,condition,condition2,isExclusive,isExclusiveMaintenance, ...rest } = Data.Filter;
+    const { triggerMethod, maintenanceTriggerMethod, ruleName, roleMappingId, labelId,pushUserid,condition,condition2,isExclusive,isExclusiveMaintenance,regular,...rest } = Data.Filter;
     Data.Filter = { ...rest, ...row };
     Data.Filter.triggerMethod = triggerMethod || Data.Filter.triggerMethod;
     Data.Filter.maintenanceTriggerMethod = maintenanceTriggerMethod || Data.Filter.maintenanceTriggerMethod;
@@ -668,6 +668,8 @@ const openDialog = (row: alarmRluesFilterModel) => {
     Data.Filter.labelId = labelId || Data.Filter.labelId;
     Data.Filter.ruleName = ruleName || Data.Filter.ruleName;
     Data.Filter.pushUserid = pushUserid || Data.Filter.pushUserid;
+    Data.Filter.regular = regular || Data.Filter.regular;
+
 
 
     Data.Filter.isExclusive = Boolean(row.isExclusive);

+ 5 - 5
admin.ui.plus-master/src/views/admin/yujing/alarmRules/index.vue

@@ -21,10 +21,9 @@
                            </el-col>
                            <el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="6" class="mb20">
                               <el-form-item label="推送方式">
-                                  <el-select  placeholder="请选择推送方式">
+                                  <el-select v-model="Data.Filter.pushMethod" placeholder="请选择推送方式">
                                    <el-option label="所有" :value="''"></el-option>
-                                   <el-option label="电子邮箱" :value="''"></el-option>
-                                   <el-option label="微信" :value="''"></el-option>
+                    <el-option v-for="(value, key) in upload" :key="key" :label="value" :value="key" />
                                  </el-select>
                              </el-form-item>
                            </el-col>
@@ -111,6 +110,7 @@ const Data = reactive({
     ruleName: "",
     Status:"",
     upload:"",
+    pushMethod:"",
     isActive:undefined
   } as alarmRluesFilterModel_SearchFilter,
   /**表格信息 */
@@ -146,8 +146,8 @@ const StatusOptions = [
 ];
 
 enum upload {
-  email="电子邮箱",
-  vx="微信"
+  "电子邮箱"="电子邮箱",
+  "微信"="微信"
 }
 
 /**引入组件*/