Ver Fonte

图表渲染切换英文,以及一些样式和bug

cxmo há 2 anos atrás
pai
commit
241457b01b

+ 20 - 7
src/views/chartETA/ChartDetail.vue

@@ -28,6 +28,8 @@ let routeQueryData=reactive({
     chartClassifyId:route.query.chartClassifyId,
 })
 
+let currentLang = ref('')
+
 //获取图详情
 let chartInfoData=null
 let chartInfo=ref(null)
@@ -70,7 +72,7 @@ async function getChartDetail(e){
                 },
             },
             renderId:'chart-box',
-            lang:'zh',
+            lang:currentLang.value,
             changeLangIsCheck:false,
             showChartTitle:false
         })
@@ -78,6 +80,7 @@ async function getChartDetail(e){
     
 }
 onMounted(() => {
+    currentLang.value = localStorage.getItem('chartETALange')==='EN'?'en':'zh'
     getChartDetail('init')
 })
 
@@ -202,7 +205,7 @@ function handleConfirmLimitChange(){
     highChart.value = chartRender({
         data:data,
         renderId:'chart-box',
-        lang:'zh',
+        lang:currentLang.value,
         changeLangIsCheck:false,
         showChartTitle:false
     })
@@ -320,7 +323,7 @@ async function getShareLink(){
 }
 function checkChartEnOption(){
     if(!chartInfo.value.ChartNameEn) return false
-    for(const data of edbList){
+    for(const data of chartInfoData.EdbInfoList){
         if(data.EdbNameEn==""||(data.UnitEn==""&&data.Unit!="")){
             return false
         }
@@ -438,18 +441,27 @@ async function handleSwitchChart(type){
     }else{
         item=index===chartSortListData.value.length-1?chartSortListData.value[0]:chartSortListData.value[index+1]
     }
+    //切换前重置chartState
+    initChartState()
     routeQueryData.id=item.ChartInfoId
     routeQueryData.chartType=item.ChartType
     routeQueryData.chartClassifyId=item.ChartClassifyId
     getChartDetail('init')
 }
+function initChartState(){
+    chartState.showTimePop=false
+    chartState.startTime=''
+    chartState.endTime='',
+    chartState.yearVal='',
+    chartState.calendarType='公历'
+}
 
 
 </script>
 
 <template>
     <div class="chart-detail-page" v-if="chartInfo">
-        <div class="chart-title">{{chartInfo.ChartName}}</div>
+        <div class="chart-title">{{currentLang==='en'?(chartInfo.ChartNameEn||chartInfo.ChartName):chartInfo.ChartName}}</div>
 
         <!-- 一般曲线图选择时间区间或者季节图选择日期 -->
         <div 
@@ -911,6 +923,9 @@ async function handleSwitchChart(type){
             display: flex;
             gap:0 20px;
             border-bottom: 1px solid #DCDFE6;
+            &:last-child{
+                border-bottom: none;
+            }
             .edb-name{
                 flex: 1;
                 /* text-align: center; */
@@ -1108,6 +1123,7 @@ async function handleSwitchChart(type){
             border-top: 1px solid $border-color;
             width: 100vw;
             padding: 0 30px;
+            margin-top: 20px;
             .pad-limit-set-btn{
                 display: block;
                 text-align: right;
@@ -1123,9 +1139,6 @@ async function handleSwitchChart(type){
                 border: 1px solid $border-color;
                 .list-item{
                     padding: 18px;
-                    &:last-child{
-                        border-bottom: none;
-                    }
                 }
             }
         }

+ 11 - 1
src/views/chartETA/components/SetChartEnName.vue

@@ -189,13 +189,18 @@ function initForm(){
 
 const showCellEditDialog = ref(false)
 const currentCell = ref({})
+let tempValue=''
 function handleCellClick(cell){
     if(cell.noEdit) return
     currentCell.value = cell
+    tempValue = cell.Value
     showCellEditDialog.value = true
 }
 function handleConfirmEditCell(){
-    console.log('check',currentCell.value)
+    //console.log('check',currentCell.value)
+}
+function handleCancelEditCell(){
+    currentCell.value.Value = tempValue
 }
 function handleSave(){
     let params = {
@@ -281,6 +286,7 @@ async function saveChartEn(params){
             title="设置英文名称" 
             show-cancel-button
             confirmButtonText="确定"
+            @cancel="handleCancelEditCell"
             @confirm="handleConfirmEditCell"
         >
             <div class="name">{{ currentCell.cnValue||'无'}}</div>
@@ -294,6 +300,7 @@ async function saveChartEn(params){
 <style lang="scss">
 .set-name-pop-wrap{
     .van-collapse{
+        flex: 1;
         background-color:#F6F6F6;
     }
     .van-collapse-item{
@@ -351,6 +358,9 @@ async function saveChartEn(params){
 </style>
 <style scoped lang="scss">
 .set-name-pop-wrap{
+    height: 100%;
+    display: flex;
+    flex-direction: column;
     .tool-box{
         position:sticky;
         z-index: 99;

+ 3 - 0
src/views/chartETA/components/SourceDetail.vue

@@ -76,6 +76,8 @@ function flatTreeData(tree){
         flex-direction: column;
         padding:40px 80px;
         gap:40px;
+        max-height: 600px;
+        overflow-y:scroll;
         .source-item{
             position: relative;
             .text{
@@ -116,6 +118,7 @@ function flatTreeData(tree){
         .source-arr-wrap{
             padding:20px 40px;
             gap:20px;
+            max-height: 300px;
             .source-item{
                 .text{
                     margin: 8px 0;