Browse Source

修复bug

Yue 2 years ago
parent
commit
33fceb40c0

+ 14 - 1
src/components/Forms/VbFormItem.vue

@@ -1,6 +1,6 @@
 <script setup lang="ts">
 import { withDefaults, onMounted, computed, type WritableComputedRef } from "vue"
-import { ElSelect, ElRadioGroup, ElCheckboxGroup } from "element-plus"
+import { ElSelect, ElRadioGroup, ElCheckboxGroup, ElDatePicker } from "element-plus"
 import type { FormItemRule } from "element-plus/es/components/form/src/types"
 import type { VbFormItem } from "@/components/Forms/models"
 import getConfigRule, { RULE_KEYS } from "@/core/config/rules"
@@ -92,6 +92,19 @@ onMounted(() => {
       <div v-else-if="item.component === 'innerText'" :class="item.class" :style="item.style">
         {{ item.innerText || data[item.field] }}
       </div>
+      <template v-else-if="item.component == ElDatePicker">
+        <el-date-picker
+          v-model="data[item.field]"
+          v-model:value="data[item.field]"
+          :required="item.required"
+          :class="item.class"
+          :style="item.style"
+          :size="item.size"
+          :placeholder="item.placeholder ?? item.props?.placeholder ?? item.label"
+          v-bind="item.props"
+          v-on="item.listeners"
+        ></el-date-picker>
+      </template>
       <template v-else>
         <component
           :is="item.component"

+ 1 - 1
src/components/Forms/models.ts

@@ -21,7 +21,7 @@ export type VbFormItem = {
   ruleFormat?: Array<Array<string | number> | undefined> //数组索引对应rules顺序,对应的rule是自定义的(或者没有format数据)要填undefined  eg: [[0,1],undfiend,["名称"]]
   data?: Array<{ label: string; value: string | number; class?: string; style?: string; disabled?: boolean }>
   itemProps?: object // 注入到 el-form-item 的属性
-  props?: object // 当 component 为渲染组件时,注入到渲染组件当中的属性
+  props?: any // 当 component 为渲染组件时,注入到渲染组件当中的属性
   listeners?: object // 当 component 为渲染组件时,注入到渲染组件当中的事件
 }
 

+ 6 - 1
src/layouts/main-layout/header/Navbar.vue

@@ -13,7 +13,7 @@
       </div>
     </div> -->
     <!--end::Activities-->
-    <div class="app-navbar-item ms-1 ms-lg-3">
+    <div class="app-navbar-item ms-1 ms-lg-3" v-if="user?.userType == '1'">
       <div
         class="btn btn-icon btn-custom btn-icon-muted btn-active-light btn-active-color-primary w-30px h-30px w-md-40px h-md-40px"
       >
@@ -116,7 +116,12 @@ export default defineComponent({
       return store.themeMode
     })
 
+    const user = computed(() => {
+      return appStore.authStore.user
+    })
+
     return {
+      user,
       themeMode,
       getAssetPath,
     }

+ 65 - 69
src/views/dashboard/DataCenter.vue

@@ -8,7 +8,7 @@ import ChartPf from "./Screen/ChartPf.vue"
 import { useRouter } from "vue-router"
 import Rs from "@/core/services/RequestService"
 const router = useRouter()
-const themeClass="dark01"
+const themeClass = "dark01"
 const title = "餐饮油烟在线监测平台"
 const baseInfo = ref({
   company: {
@@ -37,33 +37,32 @@ const today = ref({
   week: "",
   time: { hour: "00", minute: "00", second: "00" },
 })
-const chartData = ref({ areaOverChartData: {chartData:{}} })
+const chartData = ref({ areaOverChartData: { chartData: {} } })
 
 const theme = ref({
   color: ["rgba(56, 164, 90, 0.9)", "rgba(19, 165, 165, 0.9)", "rgba(236, 90, 90, 0.9)", "rgba(223, 148, 83, 0.9)"],
-  legend:
-  {
+  legend: {
     show: true,
-    type: 'scroll',
-    orient: 'vertical',
-    x: '60%',
-    y: 'center',
-    icon:"circle",
+    type: "scroll",
+    orient: "vertical",
+    x: "60%",
+    y: "center",
+    icon: "circle",
     itemWidth: 7,
     itemHeight: 7,
     textStyle: {
-      fontSize: 18
+      fontSize: 18,
     },
   },
   pieRadius: ["59%", "88%"],
   pieCenter: ["30%", "50%"],
   titleText: "净化设施数量",
-  titleUnit:"家",
+  titleUnit: "家",
   title: {
     x: "29%",
     y: "35%",
     show: true,
-    textAlign: 'center',
+    textAlign: "center",
     textStyle: {
       rich: {
         title: {
@@ -86,12 +85,12 @@ const theme = ref({
     },
   },
 })
-const  theme2= computed( ()=> {
+const theme2 = computed(() => {
   return Object.assign({}, theme.value, {
     titleText: "监控仪数量",
     pieCenter: ["30%", "54%"],
     color: ["rgba(56, 164, 90, 0.8)", "rgba(236, 90, 90, 0.8)"],
-  });
+  })
 })
 const barTheme = ref({
   legend: {},
@@ -113,7 +112,7 @@ const barTheme = ref({
 //   params: {},
 // })
 
-const  getChartData2= computed( ()=> {
+const getChartData2 = computed(() => {
   const data = {
     chartData: {
       title: "净化设施数量",
@@ -136,10 +135,10 @@ const  getChartData2= computed( ()=> {
         },
       ],
     },
-  };
-  return data;
+  }
+  return data
 })
-const  getChartData3= computed( ()=> {
+const getChartData3 = computed(() => {
   const data = {
     chartData: {
       title: "监控仪数量",
@@ -154,78 +153,76 @@ const  getChartData3= computed( ()=> {
         },
       ],
     },
-  };
-  return data;
+  }
+  return data
 })
 
-
-const  companyPer=(val:number)=> {
+const companyPer = (val: number) => {
   // if (!baseInfo.value.company.total) {
   //   return 50;
   // }
   // return (val * 100) / baseInfo.value.company.total;
-  console.debug(val);
-  return 50;
+  console.debug(val)
+  return 50
 }
 
-const   facilitiesPer=(val:number)=> {
+const facilitiesPer = (val: number) => {
   // if (!baseInfo.value.facilities.total) {
   //   return 50;
   // }
   // return (val * 100) / baseInfo.value.facilities.total;
-  console.debug(val);
-  return 25;
+  console.debug(val)
+  return 25
 }
 
-const   monitorPer=(val:number) =>{
+const monitorPer = (val: number) => {
   // if (!baseInfo.value.facilities.total) {
   //   return 50;
   // }
   // return (val * 100) / baseInfo.value.monitor.total
-  console.debug(val);
-  return 50;
+  console.debug(val)
+  return 50
 }
 
-function jump(type:number) {
+function jump(type: number) {
   switch (type) {
-  case 0:
-    router.push({
-      path: "/",
-    })
-    break
+    case 0:
+      router.push({
+        path: "/",
+      })
+      break
   }
 }
 
 function initCurrentDateTime() {
-  let date = new Date();
-  today.value.date = `${date.getFullYear()}年${date.getMonth()}月${date.getDate()}日`;
-  today.value.week = `星期${"日一二三四五六".charAt(date.getDay())}`;
+  let date = new Date()
+  today.value.date = `${date.getFullYear()}年${date.getMonth()}月${date.getDate()}日`
+  today.value.week = `星期${"日一二三四五六".charAt(date.getDay())}`
   setInterval(() => {
-    date = new Date();
-    today.value.time.hour = (date.getHours() + "").padStart(2, "0");
-    today.value.time.minute = (date.getMinutes() + "").padStart(2, "0");
-    today.value.time.second = (date.getSeconds() + "").padStart(2, "0");
-  }, 1000);
+    date = new Date()
+    today.value.time.hour = (date.getHours() + "").padStart(2, "0")
+    today.value.time.minute = (date.getMinutes() + "").padStart(2, "0")
+    today.value.time.second = (date.getSeconds() + "").padStart(2, "0")
+  }, 1000)
 }
 
 function getBaseInfo() {
-  Rs.get("sys/dataBoard/selectBaseInfo").then(
-    (res:any) => {
-      const bsInfo = res.data;
-      baseInfo.value.company.operate = bsInfo.operate_num;
-      baseInfo.value.company.rest = bsInfo.company_num - bsInfo.operate_num;
-      baseInfo.value.company.total = bsInfo.company_num;
-      baseInfo.value.company.outlet = bsInfo.outlet_num;
-      baseInfo.value.company.stove = bsInfo.stove_num;
-      baseInfo.value.facilities.normal = bsInfo.facilities_normal;
-      baseInfo.value.facilities.rest = bsInfo.facilities_rest;
-      baseInfo.value.facilities.over = bsInfo.facilities_over;
-      baseInfo.value.facilities.abnormal = bsInfo.facilities_abnormal;
-      baseInfo.value.facilities.total = bsInfo.facilities;
-      baseInfo.value.monitor.normal = bsInfo.monitor_normal;
-      baseInfo.value.monitor.abnormal = bsInfo.monitor_abnormal;
-      baseInfo.value.monitor.total = bsInfo.monitor_normal + bsInfo.monitor_abnormal;
-      /*
+  Rs.get("sys/dataBoard/selectBaseInfo").then((res: any) => {
+    const bsInfo = res.data
+    baseInfo.value.company.operate = bsInfo.operate_num
+    baseInfo.value.company.rest = bsInfo.company_num - bsInfo.operate_num
+    baseInfo.value.company.total = bsInfo.company_num
+    baseInfo.value.company.outlet = bsInfo.outlet_num
+    baseInfo.value.company.stove = bsInfo.stove_num
+    baseInfo.value.facilities.normal = bsInfo.facilities_normal
+    baseInfo.value.facilities.rest = bsInfo.facilities_rest
+    baseInfo.value.facilities.over = bsInfo.facilities_over
+    baseInfo.value.facilities.abnormal = bsInfo.facilities_abnormal
+    baseInfo.value.facilities.total = bsInfo.facilities
+    baseInfo.value.monitor.normal = bsInfo.monitor_normal
+    baseInfo.value.monitor.abnormal = bsInfo.monitor_abnormal
+    baseInfo.value.monitor.total = bsInfo.monitor_normal + bsInfo.monitor_abnormal
+    /*
           company_num: 3 公司商户
           facilities: 105 净化设施
           facilities_abnormal: 25 异常
@@ -238,19 +235,18 @@ function getBaseInfo() {
           outlet_num: 4 排口
           stove_num: 4 灶头
           */
-    }
-  );
+  })
 }
 
-function getBarChart(type:number) {
-  Rs.get("sys/dataBoard/selectOverdueByOrg?type="+type).then((res:any) => {
+function getBarChart(type: number) {
+  Rs.get("sys/dataBoard/selectOverdueByOrg?type=" + type).then((res: any) => {
     chartData.value.areaOverChartData = {
       chartData: res.data.chartData,
-    };
-  });
+    }
+  })
 }
 function fullScreen() {
-  //全屏状态下刷新会退出全屏 F11全屏没有此bug 
+  //全屏状态下刷新会退出全屏 F11全屏没有此bug
   document.documentElement.requestFullscreen()
 }
 
@@ -2898,7 +2894,7 @@ onMounted(() => {
   width: 100%;
   height: 100%;
   overflow: hidden;
-  background: url("./media/screen/bg.png");
+  background: url("/media/screen/bg.png");
   display: flex;
   flex-direction: column;
   flex: 1;

+ 2 - 1
src/views/dashboard/Screen/Alarm.vue

@@ -87,7 +87,8 @@ function scroll() {
 }
 function init() {
   Rs.post("sys/pushEvent/getList", {
-    data: { pageIndex: 1, pageSize: props.max, params: {}, successAlert: false },
+    data: { pageIndex: 1, pageSize: props.max, params: {} },
+    successAlert: false,
   }).then((res) => {
     alarmData.value = res.data
     if (alarmData.value.length > props.scrollLength) {

+ 35 - 36
src/views/dashboard/Screen/Clean.vue

@@ -1,6 +1,6 @@
 <!-- eslint-disable prettier/prettier -->
 <script setup lang="ts">
-import { ref,  withDefaults, onBeforeUnmount, onMounted,nextTick } from "vue"
+import { ref, withDefaults, onBeforeUnmount, onMounted, nextTick } from "vue"
 import { useRouter } from "vue-router"
 import Rs from "@/core/services/RequestService"
 
@@ -8,8 +8,8 @@ const props = withDefaults(defineProps<{ polling?: number }>(), { polling: () =>
 const list1 = ref<Array<any>>([])
 const list2 = ref<Array<any>>([])
 let scrollTimer1: any, scrollTimer2: any
-const  animate1 = ref(false)
-const  animate2 = ref(false)
+const animate1 = ref(false)
+const animate2 = ref(false)
 
 const router = useRouter()
 function beforeDestroy() {
@@ -18,62 +18,61 @@ function beforeDestroy() {
 }
 function jump(type: number) {
   switch (type) {
-  case 0:
-    router.push({
-      path: "/AnalysisInfo/clean",
-      query: { current: 0, needBack: 1 },
-    })
-    break
-  case 1:
-    router.push({
-      path: "/AnalysisInfo/clean",
-      query: { current: 1, needBack: 1 },
-    })
-    break
+    case 0:
+      router.push({
+        path: "/AnalysisInfo/clean",
+        query: { current: 0, needBack: 1 },
+      })
+      break
+    case 1:
+      router.push({
+        path: "/AnalysisInfo/clean",
+        query: { current: 1, needBack: 1 },
+      })
+      break
   }
 }
 
 function init() {
-  Rs.get('sys/dataBoard/selectCleanCompany').then((res:any) => {
-    list1.value=res.data.data.overdue_companyList
-    list2.value = res.data.data.week_clean_companyList
+  Rs.get("sys/dataBoard/selectCleanCompany").then((res: any) => {
+    list1.value = res.data.overdue_companyList
+    list2.value = res.data.week_clean_companyList
     setTimeout(() => {
       if (
         Number((document.querySelector(".clean-box.over .list") as HTMLElement).offsetHeight) >
         Number((document.querySelector(".clean-box.over .box-body") as HTMLElement).offsetHeight)
       ) {
         nextTick(() => {
-          scrollTimer1 = setInterval(() => scroll(1), 5000);
-        });
+          scrollTimer1 = setInterval(() => scroll(1), 5000)
+        })
       }
       if (
         Number((document.querySelector(".clean-box.week .list") as HTMLElement).offsetHeight) >
-        Number((document.querySelector(".clean-box.week .box-body") as HTMLElement).offsetHeight
-        ))
-      {
+        Number((document.querySelector(".clean-box.week .box-body") as HTMLElement).offsetHeight)
+      ) {
         nextTick(() => {
-          scrollTimer2 = setInterval(() => scroll(2), 5000);
-        });
+          scrollTimer2 = setInterval(() => scroll(2), 5000)
+        })
       }
     }, props.polling)
   })
 }
 
-function scroll(type:number) {
+function scroll(type: number) {
   if (type == 1) {
-    animate1.value = true;
+    animate1.value = true
     setTimeout(() => {
-      list1.value.push(list1.value[0]);
-      list1.value.shift();
-      animate1.value = false;
-    }, 2000);
+      list1.value.push(list1.value[0])
+      list1.value.shift()
+      animate1.value = false
+    }, 2000)
   } else {
-    animate2.value = true;
+    animate2.value = true
     setTimeout(() => {
-      list2.value.push(list1.value[0]);
-      list2.value.shift();
-      animate2.value = false;
-    }, 2000);
+      list2.value.push(list1.value[0])
+      list2.value.shift()
+      animate2.value = false
+    }, 2000)
   }
 }
 onMounted(() => {

+ 9 - 0
src/views/goLineData/_ViewCompany_Alarm.vue

@@ -95,5 +95,14 @@ onMounted(() => {
         </el-form-item>
       </el-form>
     </template>
+    <template #warn_starttime="{ row }">
+      {{ moment(row.warn_starttime, "YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") }}
+    </template>
+    <template #warn_endtime="{ row }">
+      {{ moment(row.warn_endtime, "YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") }}
+    </template>
+    <template #stay_time="{ row }">
+      {{ moment(row.warn_endtime, "YYYYMMDDHHmmss").diff(moment(row.warn_starttime, "YYYYMMDDHHmmss"), "m") }} 分钟
+    </template>
   </VbDataTable>
 </template>

+ 3 - 0
src/views/goLineData/_ViewCompany_General.vue

@@ -14,6 +14,9 @@ const titles = ref(["", "", "", ""])
 const chartData = ref<any>([{}, {}, {}, {}])
 const lineOptions = {
   titleText: " ",
+  legend: {
+    width: 450,
+  },
 }
 function onOverDateChange(type: number) {
   queryChart(type)