Ver código fonte

修复天气台账中表格高度的问题

ZaiZai 2 anos atrás
pai
commit
c1c6438a13

+ 24 - 12
src/global/components/hc-tabs-simple/index.vue

@@ -1,15 +1,17 @@
 <template>
-    <div class="hc-sb-table">
-        <svg class="svg-tabs" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="40px" height="45px">
+    <div :class="menuBarShow?'is-menu-bar':''" class="hc-sb-table">
+        <svg class="svg-tabs" height="45px" width="40px" xmlns="http://www.w3.org/2000/svg"
+             xmlns:xlink="http://www.w3.org/1999/xlink">
             <clipPath id="tabs">
-                <path fill-rule="evenodd" d="M40,45C15,36,33,0,0,0v45H40z"/>
+                <path d="M40,45C15,36,33,0,0,0v45H40z" fill-rule="evenodd"/>
             </clipPath>
         </svg>
-        <el-tabs v-model="curKey" :class="curIndex === 0 ? 'first' : curIndex === datas.length-1 ? 'fourth' : ''" @tab-change="tabClick">
+        <el-tabs v-model="curKey" :class="curIndex === 0 ? 'first' : curIndex === datas.length-1 ? 'fourth' : ''"
+                 @tab-change="tabClick">
             <el-tab-pane v-for="item in datas" :label="item.label" :name="item.key">
                 <template #label>
-                    <HcIcon :name="item.icon" class="icon" v-if="item.icon"/>
-                    <span class="name">{{item.label}}</span>
+                    <HcIcon v-if="item.icon" :name="item.icon" class="icon"/>
+                    <span class="name">{{ item.label }}</span>
                 </template>
                 <slot :name='`tab-${item.key}`'/>
             </el-tab-pane>
@@ -20,13 +22,17 @@
 <script setup>
 import {nextTick, ref, watch} from "vue";
 import {getIndex} from "vue-utils-plus"
+import {useAppStore} from "~src/store";
+
+const useAppState = useAppStore()
+
 const props = defineProps({
     datas: {
         type: Array,
         default: () => []
     },
     cur: {
-        type: [String,Number],
+        type: [String, Number],
         default: ''
     }
 })
@@ -34,14 +40,17 @@ const props = defineProps({
 //初始变量
 const curKey = ref(props.cur)
 const curIndex = ref(0)
+const menuBarShow = ref(useAppState.menuBarShow)
 
 //监听
 watch(() => [
     props.cur,
-    props.datas
-], ([cur, datas]) => {
+    props.datas,
+    useAppState.menuBarShow
+], ([cur, datas, menuShow]) => {
     curKey.value = cur
     getCurIndex(datas, cur)
+    menuBarShow.value = menuShow
 })
 
 //挂载完成
@@ -50,7 +59,7 @@ nextTick(() => {
 })
 
 //获取索引
-const getCurIndex = (datas,key) => {
+const getCurIndex = (datas, key) => {
     curIndex.value = getIndex(datas, 'key', key)
 }
 
@@ -140,7 +149,7 @@ const tabClick = (key) => {
             right: -40px;
         }
         &::before {
-            left:-40px;
+            left: -40px;
             right: auto;
             // 水平翻转
             transform: scaleX(-1);
@@ -166,7 +175,7 @@ const tabClick = (key) => {
         padding: 0;
         background: #f1f5f8;
         border-radius: 0 10px 10px 10px;
-        height: calc(100% - 46px);
+        height: calc(100vh - 170px);
         .el-tab-pane {
             position: relative;
             height: 100%;
@@ -178,4 +187,7 @@ const tabClick = (key) => {
         }
     }
 }
+.hc-sb-table.is-menu-bar .el-tabs .el-tabs__content {
+    height: calc(100vh - 210px);
+}
 </style>

+ 1 - 1
src/layout/index.vue

@@ -37,7 +37,7 @@
                         <el-cascader ref="ElCascaderRef" v-model="projectValue" :options="projectContract"
                                      :props="projectProps" placeholder="请选择项目" @change="projectContractChange"/>
                     </div>
-                    <MenuStretchBar/>
+                    <!--MenuStretchBar/-->
                     <HelpInfoBar></HelpInfoBar>
                     <ConfigBar></ConfigBar>
                     <UserInfoBar></UserInfoBar>

+ 1 - 1
src/store/index.js

@@ -31,7 +31,7 @@ export const useAppStore = defineStore('main', {
         shotWebRtc: getStoreData('shotWebRtc') || 0, //WebRtc截图方式: 0关闭,1开启
         fullScreen: getStoreData('fullScreen') || 0, //全屏截图:0关闭,1开启
         isCollapse: getStoreData('isCollapse') || false, //菜单折叠
-        menuBarShow: getStoreData('menuBarShow') || true, //顶部菜单是否显示
+        menuBarShow: false, //顶部菜单是否显示 getStoreData('menuBarShow') ||
         isScreenShort: false,
         barMenuName: '',
     }),

+ 0 - 2
src/views/data-fill/components/ListItem.vue

@@ -225,8 +225,6 @@
                 </div>
             </div>
         </div>
-
-
     </HcDialog>
     <!-- 选择要插入的数据 -->
     <HcDialog :show="insertDataShow" saveText="保存" title="选择需要插入的数据" widths="84%" @close="cancelinsertData"

+ 21 - 20
src/views/ledger/components/weather.vue

@@ -2,10 +2,10 @@
     <HcCard>
         <template #header>
             <div class="w-64">
-                <HcDatePicker :dates="weatherTime" size="large" clearable @change="weatherTimeUpdate"/>
+                <HcDatePicker :dates="weatherTime" clearable size="large" @change="weatherTimeUpdate"/>
             </div>
             <div class="ml-2">
-                <el-button type="primary" size="large" @click="searchWeatherClick">搜索</el-button>
+                <el-button size="large" type="primary" @click="searchWeatherClick">搜索</el-button>
             </div>
         </template>
         <template #extra>
@@ -16,11 +16,11 @@
                 </el-button>
             </HcTooltip>
         </template>
-        <HcTable :column="tableWeatherColumn" :datas="tableWeatherData" :loading="tableWeatherLoading" >
-            <template #tempLow="{row}">{{row['tempLow']}} ~ {{row['tempHigh']}}</template>
+        <HcTable :column="tableWeatherColumn" :datas="tableWeatherData" :loading="tableWeatherLoading">
+            <template #tempLow="{row}">{{ row['tempLow'] }} ~ {{ row['tempHigh'] }}</template>
             <template #action="{row}">
                 <HcTooltip keys="write_weather_edit">
-                    <el-button type="primary" plain size="small" @click="tableWeatherEdit(row)">
+                    <el-button plain size="small" type="primary" @click="tableWeatherEdit(row)">
                         <HcIcon name="edit"/>
                         <span>编辑</span>
                     </el-button>
@@ -33,8 +33,9 @@
     </HcCard>
 
     <!--编辑天气台账-->
-    <el-dialog v-model="showWeatherEditModal" title="编辑天气台账" width="38rem" class="hc-modal-border">
-        <el-form ref="weatherFormRef" :model="weatherFormModel" :rules="weatherFormRules" label-width="auto" size="large">
+    <el-dialog v-model="showWeatherEditModal" class="hc-modal-border" title="编辑天气台账" width="38rem">
+        <el-form ref="weatherFormRef" :model="weatherFormModel" :rules="weatherFormRules" label-width="auto"
+                 size="large">
             <el-form-item label="日期">
                 <el-input v-model="weatherFormModel.recordTime" disabled/>
             </el-form-item>
@@ -42,10 +43,10 @@
                 <el-input v-model="weatherFormModel.weather" placeholder="天气"/>
             </el-form-item>
             <el-form-item label="最低温度" prop="tempLow">
-                <el-input type="number" v-model="weatherFormModel.tempLow" placeholder="最低温度"/>
+                <el-input v-model="weatherFormModel.tempLow" placeholder="最低温度" type="number"/>
             </el-form-item>
             <el-form-item label="最高温度" prop="tempHigh">
-                <el-input type="number" v-model="weatherFormModel.tempHigh" placeholder="最高温度"/>
+                <el-input v-model="weatherFormModel.tempHigh" placeholder="最高温度" type="number"/>
             </el-form-item>
             <el-form-item label="风力" prop="windLevel">
                 <el-input v-model="weatherFormModel.windLevel" placeholder="风力"/>
@@ -57,7 +58,7 @@
                     <HcIcon name="close"/>
                     <span>取消</span>
                 </el-button>
-                <el-button type="primary" hc-btn :loading="saveWeatherLoading" @click="saveWeatherClick">
+                <el-button :loading="saveWeatherLoading" hc-btn type="primary" @click="saveWeatherClick">
                     <HcIcon name="save"/>
                     <span>提交保存</span>
                 </el-button>
@@ -75,11 +76,11 @@ import weatherApi from '~api/ledger/weather';
 //参数
 const props = defineProps({
     projectId: {
-        type: [String,Number],
+        type: [String, Number],
         default: ''
     },
     contractId: {
-        type: [String,Number],
+        type: [String, Number],
         default: ''
     }
 })
@@ -98,7 +99,7 @@ const searchWeatherForm = ref({recordTime: '', current: 1, size: 20, total: 0})
 
 //日期时间被选择
 const weatherTime = ref(null)
-const weatherTimeUpdate = ({query,arr}) => {
+const weatherTimeUpdate = ({query, arr}) => {
     weatherTime.value = arr
     searchWeatherForm.value.recordTime = query
 }
@@ -118,12 +119,12 @@ const pageWeatherChange = ({current, size}) => {
 
 //天气台账表头
 const tableWeatherColumn = ref([
-    {key:'recordTime', name: '日期'},
-    {key:'weather', name: '天气'},
-    {key:'tempLow', name: '温度 ℃'},
-    {key:'airTemp', name: '平均温度 ℃'},
-    {key:'windLevel', name: '风力'},
-    {key:'action', name: '操作', width: 100}
+    {key: 'recordTime', name: '日期'},
+    {key: 'weather', name: '天气'},
+    {key: 'tempLow', name: '温度 ℃'},
+    {key: 'airTemp', name: '平均温度 ℃'},
+    {key: 'windLevel', name: '风力'},
+    {key: 'action', name: '操作', width: 100}
 ])
 const tableWeatherData = ref([])
 
@@ -218,7 +219,7 @@ const saveWeatherClick = async () => {
             ...weatherFormModel.value,
             projectId: projectId.value,
             contractId: contractId.value
-        },false)
+        }, false)
         //处理数据
         saveWeatherLoading.value = false
         if (!error && code === 200) {