Explorar el Código

Merge branch 'fixbug' into 'master'

Fixbug

See merge request tian-group/skyeye-admin-fe!86
楼航飞 hace 2 años
padre
commit
62c94b2270

+ 40 - 25
src/views/cameras/overview/components/ShareCameraDetail.vue

@@ -2,6 +2,7 @@
   <div>
     <div style="margin-top: 28px">
       <el-form
+        ref="ruleFormRef"
         class="ip-form"
         :inline="true"
         :model="shareData"
@@ -95,11 +96,11 @@
   import { BasicColumn, BasicTable, TableActionIcons } from '@/components/Table';
   import { CameraShareItem, CameraShowItem } from '../type';
   import deleteIcon from '@/assets/images/table/table-delete.png';
-  import { rules, authorityTypeSelect, timeTypeSelect, getColumns } from '../constant';
+  import { authorityTypeSelect, timeTypeSelect, getColumns } from '../constant';
   import useCameraShare from '../stores/useCameraShare';
   import { getVerify } from '@/api/camera/camera-share';
   import dayjs from 'dayjs';
-  import { ElMessage } from 'element-plus';
+  import { ElMessage, FormInstance, FormRules } from 'element-plus';
 
   const useShare = useCameraShare();
   const { cameraShareList, queryCameraId, conditionSearch, handleDel, handleAdd, handleEdit } =
@@ -107,6 +108,14 @@
 
   const props = defineProps<{ formData?: CameraShowItem | null }>();
 
+  const rules = reactive<FormRules>({
+    tenantCode: [{ required: true, message: '请输入企业账号', trigger: 'blur' }],
+    permission: [{ required: true, message: '', trigger: 'change' }],
+    tenantName: [{ required: true, message: '请验证企业账号', trigger: 'change' }],
+    time: [{ required: true, message: '', trigger: 'change' }],
+    shareList: [{ required: true, message: '', trigger: 'blur' }],
+  });
+
   // onMounted(() => {});
   onMounted(() => {
     //获取数据
@@ -115,6 +124,8 @@
     conditionSearch();
   });
 
+  const ruleFormRef = ref<FormInstance>();
+
   const shareData = ref<CameraShareItem>({
     tenantCode: undefined,
     toTenantId: undefined,
@@ -195,31 +206,35 @@
   };
 
   const handleConfirm = () => {
-    if (shareData.value.time === 'Indefinite') {
-      shareData.value.endTime = dayjs().add(-1, 'day').format('YYYY-MM-DD HH:mm:ss');
-    } else {
-      shareData.value.endTime = dayjs()
-        .add(shareData.value.days!, 'day')
-        .format('YYYY-MM-DD HH:mm:ss');
-    }
+    if (!ruleFormRef.value) return;
 
-    console.log('endd', shareData.value.endTime);
+    ruleFormRef.value.validate((valid) => {
+      if (!valid) {
+        return;
+      }
+      if (shareData.value.time === 'Indefinite') {
+        shareData.value.endTime = dayjs().add(-1, 'day').format('YYYY-MM-DD HH:mm:ss');
+      } else {
+        shareData.value.endTime = dayjs()
+          .add(shareData.value.days!, 'day')
+          .format('YYYY-MM-DD HH:mm:ss');
+      }
 
-    //接口
-    console.log('shareData', shareData.value);
-    const currentDate = new Date();
-    console.log('currentDate', currentDate);
-    const addShareItem = {
-      cameraId: props.formData?.id,
-      toTenantId: shareData.value.toTenantId,
-      permission: shareData.value.permission,
-      endTime: shareData.value.endTime,
-      isAdd: false,
-      remark: shareData.value.remark,
-    };
-    queryCameraId.value = props.formData?.id;
-    handleAdd(addShareItem); //数据未调整
-    resetData();
+      //接口
+      const currentDate = new Date();
+      console.log('currentDate', currentDate);
+      const addShareItem = {
+        cameraId: props.formData?.id,
+        toTenantId: shareData.value.toTenantId,
+        permission: shareData.value.permission,
+        endTime: shareData.value.endTime,
+        isAdd: false,
+        remark: shareData.value.remark,
+      };
+      queryCameraId.value = props.formData?.id;
+      handleAdd(addShareItem); //数据未调整
+      resetData();
+    });
   };
 </script>
 

+ 10 - 22
src/views/dashboard/home/components/AlgoDataPanel.vue

@@ -165,19 +165,23 @@
   //   };
   // });
 
+  //动态获取title的left比例
+  const screenWidth = window.innerWidth;
+  const titleLeft = computed(() => ((screenWidth * 0.3 - 350 * 0.2) * 100) / screenWidth + '%');
+
   const option = computed(() => {
     return {
       title: {
         text: '算法占比', // 设置标题文本
-        left: '25%', // 标题居中对齐
+        left: titleLeft.value, // 标题居中对齐
         top: 'center',
         textStyle: {
           fontSize: 20,
         },
       },
-      tooltip: {
-        trigger: 'item',
-      },
+      // tooltip: {
+      //   trigger: 'item',
+      // },
       grid: {
         left: '10px',
         right: '4%',
@@ -227,9 +231,9 @@
           emphasis: {
             label: {
               show: true,
-              fontSize: 20,
+              fontSize: 16,
               fontWeight: 'bold',
-              formatter: '{b}:   {c}',
+              formatter: '{b}:   {d}%',
             },
             itemStyle: {
               shadowBlur: 10,
@@ -255,15 +259,6 @@
 </script>
 
 <style scoped>
-  /* .algo-data {
-    width: 484px;
-    padding: 12px 27px;
-    border-left: 2px solid #e8e8e8;
-    display: flex;
-    flex-direction: column;
-    align-items: flex-start;
-  } */
-
   .algo-header {
     display: flex;
     justify-content: space-between;
@@ -280,11 +275,6 @@
   }
 
   .algo-tit {
-    /* font-size: 16px;
-    font-weight: 500;
-    margin-bottom: 10px;
-    line-height: 44px;
-    color: #2e2e2e; */
     font-size: 16px;
     margin-top: 17px;
     margin-left: 18px;
@@ -312,8 +302,6 @@
     width: 1px;
     height: 40px;
     background: #e9e9e9;
-    /* margin-left: 29px;
-    margin-right: 27px; */
   }
 
   .el-divider--vertical {

+ 19 - 6
src/views/dashboard/home/components/Score.vue

@@ -9,10 +9,16 @@
       </div>
       <el-divider />
       <div class="score-show">
-        <VChart class="pic-show" :option="options" />
+        <VChart
+          v-if="scoreInfoList.length > 0"
+          class="pic-show"
+          :option="options"
+          :style="{ height: updateChartHeight }"
+        />
+        <div v-else class="pic-none">暂无数据</div>
       </div>
     </div>
-    <div class="score-divider"></div>
+    <div class="score-divider" :style="{ height: updateLineHeight }"></div>
     <div class="score-right">
       <div class="concern-title">重点关注车间</div>
       <ul v-if="workshopList.length > 0" class="concern-workspace">
@@ -72,6 +78,9 @@
   const timeSelect = ref<TimeEnum>(TimeEnum.DAY);
   //const workspaceList = ['车间1', '车间2', '车间3'];
 
+  const updateChartHeight = computed(() => window.innerHeight - 670 + 'px');
+  const updateLineHeight = computed(() => window.innerHeight - 618 + 'px');
+
   const dataZoomConfig = computed(() => [
     {
       type: 'slider',
@@ -216,10 +225,7 @@
 
   .score-divider {
     width: 1px;
-    height: 320px;
     background: #e9e9e9;
-    /* margin-left: 29px;
-    margin-right: 27px; */
   }
 
   .el-divider--horizontal {
@@ -228,7 +234,6 @@
 
   .pic-show {
     flex-grow: 1;
-    height: 270px;
   }
 
   .concern-title {
@@ -269,4 +274,12 @@
     color: rgba(0, 0, 0, 0.45);
     font-size: 10px;
   }
+
+  .pic-none {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    height: 100%;
+    font-size: 20px;
+  }
 </style>

+ 1 - 7
src/views/dashboard/home/hooks/useScoreInfo.ts

@@ -8,13 +8,7 @@ import {
 } from '@/api/home/home-score.ts';
 
 export function useScoreInfo() {
-  const scoreInfoList = ref<ScoreType[]>([
-    {
-      date: '2024-05-06',
-      score: 99,
-      workshopList: ['ARJ21总装车间', 'C919部装车间', '维修交付中心'],
-    },
-  ]);
+  const scoreInfoList = ref<ScoreType[]>([]);
 
   const getDailyScoreList = () => {
     getDailyScore().then((res) => {