Переглянути джерело

Merge branch 'demand-155'

cxmo 5 місяців тому
батько
коміт
202b0f1a6d

+ 4 - 0
src/lang/modules/systemManage/ChartSet.js

@@ -4,6 +4,8 @@
 
 /* 英文 */
 export const ChartSetEn = {
+    label00:'Chart Data Source Setting',
+    label00_hint:'Enabling the switch means data source visibility is on by default for new charts and can be toggled manually. Conversely, if disabled, it applies to new charts only, not historical ones.',
     label01:'Chart Types',
     label02:'Chart Library Default Theme',
     add_btn:'Add Custom Theme',
@@ -44,6 +46,8 @@ export const ChartSetEn = {
   
 /* 中文 */
 export const ChartSetZh = {
+    label00:'图表的数据来源',
+    label00_hint:'开启状态表示新建图表时,数据来源展示开关默认开启,可手动切换,关闭状态同理,仅对新增图表生效,历史图表不处理',
     label01:'图表类型',
     label02:'图库默认主题',
     add_btn:'添加自定义主题',

+ 1 - 0
src/utils/buttonConfig.js

@@ -762,6 +762,7 @@ export const chartThemePermission = {
     chartTheme_add:'chartTheme:add',//添加
     chartTheme_edit:'chartTheme:edit',//编辑
     chartTheme_del:'chartTheme:del',//删除
+    chartTheme_chartsource:'chartTheme:chartsource',//图表的数据来源
 }
 
 

+ 1 - 0
src/views/dataEntry_manage/addChart.vue

@@ -934,6 +934,7 @@ export default {
 	},
   mounted() {
 		this.getMenu();
+		this.getChartBaseSetting()
 		this.getThemeList('init');
 		window.addEventListener('resize', this.reloadRightWid);
 	},

+ 1 - 0
src/views/dataEntry_manage/editChart.vue

@@ -1033,6 +1033,7 @@ export default {
 	},
   mounted() {
 		this.getMenu();
+		this.getChartBaseSetting()
 		this.getChartInfo();
 		this.reloadRightWid();
 		window.addEventListener('resize', this.reloadRightWid);

+ 9 - 1
src/views/dataEntry_manage/mixins/addOreditMixin.js

@@ -1,6 +1,7 @@
 import { dataBaseInterface } from '@/api/api.js';
 import * as preDictEdbInterface from '@/api/modules/predictEdbApi.js';
 import * as chartThemeInterface from '@/api/modules/chartThemeApi';
+import {etaBaseConfigInterence} from '@/api/modules/etaBaseConfigApi.js';
 import { defaultOpts } from '@/utils/defaultOptions';
 import { mapState } from 'vuex';
 
@@ -1075,7 +1076,14 @@ export default {
 				? chartTypeMap[this.chartInfo.ChartType]() 
 				: this.setChartOptionHandle(this.tableData);
 		},
-
+		//获取图表全局设置
+		async getChartBaseSetting(){
+			//目前是用基本配置的接口,后续有多个配置再改
+			const res = await etaBaseConfigInterence.getBaseConfig()
+			if(res.Ret!==200) return 
+			const {ChartSourceDisplay} = res.Data||{}
+			this.chartInfo.SourcesFromVisable = ChartSourceDisplay==='true'?true:false
+		},
 		/* 数据来源显示隐藏 */
 		changeSourceVisable() {
 			this.chartInfo.SourcesFrom = JSON.stringify({

+ 62 - 6
src/views/system_manage/chartTheme/index.vue

@@ -1,5 +1,22 @@
 <template>
   <div class="chartTheme-page">
+    <!-- 全局配置 -->
+    <div class="setting-box" v-if="permissionBtn.isShowBtn('chartThemePermission','chartTheme_chartsource')">
+        <div class="setting-item">
+            <span>
+                {{$t('SystemManage.ChartSet.label00')}}
+                <el-tooltip class="item" effect="dark" :content="$t('SystemManage.ChartSet.label00_hint')" placement="top">
+                    <i class="el-icon-warning"></i>
+                </el-tooltip>
+            </span>
+            <el-switch 
+                @change="saveSetting"
+                v-model="ChartSourceDisplay" 
+                active-value="true" 
+                inactive-value="false"/>
+        </div>
+    </div>
+
     <div class="header">
       <div style="display: flex;gap:20px;">
         <div class="select-item">
@@ -30,7 +47,9 @@
 
       <el-button type="primary" v-permission="permissionBtn.chartThemePermission.chartTheme_edit" @click="setConfigTheme">{{$t('Dialog.confirm_save_btn')}}</el-button>
     </div>
-
+    <div class="gap-box">
+        <span style="flex:1;background-color: #C8CDD9;"></span>
+    </div>
     <!-- 主题列表 -->
     <div class="main">
       <ul class="list-wrap">
@@ -61,7 +80,6 @@
 
     </div>
 
-
    <!-- 弹窗 -->
     <m-dialog 
       :title="`${addThemeForm.id?$t('SystemManage.ChartSet.edit_btn'):$t('SystemManage.ChartSet.edit_btn')}`" 
@@ -94,6 +112,7 @@
 </template>
 <script>
 import * as chartThemeInterface from '@/api/modules/chartThemeApi';
+import {etaBaseConfigInterence} from '@/api/modules/etaBaseConfigApi.js';
 import mDialog from '@/components/mDialog.vue';
 export default {
   components: { mDialog },
@@ -110,10 +129,13 @@ export default {
       isOpenThemeDia: false,
       addThemeForm: {
         themeName: '',
-      }
+      },
+      ChartSourceDisplay:'true',
+      baseConfig:{}
     };
   },
   mounted() {
+    this.getChartBaseSetting()
     this.getChartType()
   },
   methods: {
@@ -197,6 +219,23 @@ export default {
       this.isOpenThemeDia = false;
 
       this.getThemeList()
+    },
+    async getChartBaseSetting(){
+        //目前是用基本配置的接口,后续有多个配置再改
+        const res = await etaBaseConfigInterence.getBaseConfig()
+        if(res.Ret!==200) return 
+        const {ChartSourceDisplay} = res.Data||{}
+        this.baseConfig = res.Data
+        this.ChartSourceDisplay = ChartSourceDisplay||'true'
+    },
+    async saveSetting(){
+        etaBaseConfigInterence.saveBaseConfig({
+            ...this.baseConfig,
+            ChartSourceDisplay:this.ChartSourceDisplay
+        }).then(res=>{
+            if(res.Ret!==200) return 
+            this.$message.success(this.$t('MsgPrompt.saved_msg'))
+        })
     }
   },
 };
@@ -210,22 +249,36 @@ export default {
     display: flex;
     align-items: center;
   }
-  .header,.main {
+  .header,.main,.setting-box {
     padding: 20px 30px;
     background: #fff;
     position: relative;
     border: 1px solid #ececec;
     border-radius: 4px;
-    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
+    /* box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05); */
   }
   .header {
     display: flex;
     justify-content: space-between;
-    margin-bottom: 30px;
+    /* margin-bottom: 30px; */
     gap: 20px;
+    border-bottom: none;
+    border-bottom-left-radius: 0;
+    border-bottom-right-radius: 0;
+  }
+  .gap-box{
+    border-left: 1px solid #ececec;
+    border-right: 1px solid #ececec;
+    height:1px;
+    background-color: white;
+    display: flex;
+    padding:0 30px;
   }
   .main {
      min-height: calc(100vh - 240px);
+     border-top: none;
+     border-top-right-radius: 0;
+     border-top-left-radius: 0;
   }
   .list-wrap {
     display: flex;
@@ -274,6 +327,9 @@ export default {
       }
     }
   }
+  .setting-box{
+    margin-bottom: 30px;
+  }
 }
 </style>
 <style lang="scss">