田源
2023-12-19 09321fa9f47984e06df5c29b57233dc59ee5a13a
Source/UBCS-WEB/src/views/statistic/statisticPage.vue
@@ -4,35 +4,13 @@
    <div style=" display: flex; justify-content: flex-end;">
      <el-button plain type="primary" @click="addHandler">配置</el-button>
    </div>
    <!--  新增对话框-->
    <el-dialog
      :visible.sync="addVisible"
      append-to-body
      class="avue-dialog avue-dialog--top"
      title="配置数据统计分析"
      top="-50px"
    >
      <el-table
        ref="table"
        :data="tableData"
        border
        style="width: 100%"
        @selection-change="selectChange"
      >
        <el-table-column
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column
          align="center"
          label="主数据库名"
          prop="menuName"
          width="300">
        </el-table-column>
        <el-table-column
          align="center"
          label="类型"
          prop="codeType">
    <!--新增对话框-->
    <el-dialog :visible.sync="addVisible" append-to-body class="avue-dialog avue-dialog--top" title="配置数据统计分析"
               top="-50px">
      <el-table ref="table" :data="tableData" border style="width: 100%" @selection-change="selectChange">
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column align="center" label="主数据库名" prop="menuName" width="300"></el-table-column>
        <el-table-column align="center" label="类型" prop="codeType">
          <template slot-scope="{ row }">
            <el-select v-model="row.codeType" :multiple="true" limit="4" placeholder="请选择图表类型" style="width: 400px">
              <el-option v-for="(item) in selectList" :label="item.label" :value="item.value"></el-option>
@@ -45,16 +23,28 @@
    <el-button type="primary" @click="addSaveHandler">保存</el-button>
  </span>
    </el-dialog>
    <!--    echarts组件-->
    <!--echarts组件-->
    <div style="margin-top: 15px;padding-bottom: 35px">
      <lineChart v-for="(item,index) in lineList" :key="index" :chartName="item.menuName"
                 :lineData="item.menuData"></lineChart>
      <pieChart v-for="(item,index) in pieList" :key="index" :chartName="item.menuName"
                :pieData="item.menuData"></pieChart>
      <ColumnarChart v-for="(item,index) in columnarList" :key="index" :chartName="item.menuName"
                     :columnarData="item.menuData"></ColumnarChart>
      <mixCart v-for="(item,index) in mixList" :key="index" :chartName="item.menuName"
               :mixData="item.menuData"></mixCart>
      <lineChart
        v-for="(item,index) in lineList"
        :key="index"
        :chartName="item.menuName"
        :lineData="item.menuData"></lineChart>
      <pieChart
        v-for="(item,index) in pieList"
        :key="index"
        :chartName="item.menuName"
        :pieData="item.menuData"></pieChart>
      <ColumnarChart
        v-for="(item,index) in columnarList"
        :key="index"
        :chartName="item.menuName"
        :columnarData="item.menuData"></ColumnarChart>
      <mixCart
        v-for="(item,index) in mixList"
        :key="index"
        :chartName="item.menuName"
        :mixData="item.menuData"></mixCart>
    </div>
  </div>
</template>
@@ -64,7 +54,7 @@
import pieChart from "../../components/StatisticsComponent/pieChart"
import ColumnarChart from "../../components/StatisticsComponent/ColumnarChart"
import mixCart from "../../components/StatisticsComponent/mixCart"
import {getStatisticAnalysis,getBtmAndChart,saveStatisticAnalysis} from "@/api/statistic/chart"
import {getStatisticAnalysis, getBtmAndChart, saveStatisticAnalysis, deleteChartId} from "@/api/statistic/chart"
import {getList} from "@/api/system/statistic";
export default {
@@ -110,24 +100,32 @@
  },
  created() {
    this.getMasterList();
    this.getEcharts()
    this.getEcharts();
    // deleteChartId({btmname:'zxssaac',chartId:'3'}).then(res=>{
    //   console.log('res',res)
    // })
  },
  methods: {
    getMasterList() {
      const userId = localStorage.getItem('userId');
      getList({userId: userId}).then(res => {
        this.tableData = res.data.data;
      }).catch(error=>{
      }).catch(error => {
        this.$message.error(error)
      })
    },
    getEcharts(){
      getBtmAndChart().then(res=>{
        const btmNames = Object.keys(res.data.data).join(',');
        console.log(btmNames);
        if(btmNames){
          getStatisticAnalysis({btmNames}).then(item=>{
            console.log(item)
    getEcharts() {
      getBtmAndChart().then(firstResponse => {
        console.log('btm', firstResponse)
        const btmNames = Object.keys(firstResponse.data.data).join(',');
        const firstData = firstResponse.data.data;
        Object.keys(firstData).forEach((item,index) => {
          let firstIndex = firstData[item].split(',');
          console.log('firstIndex',firstIndex);
        });
        if (btmNames) {
          getStatisticAnalysis({btmNames}).then(secondResponse => {
            console.log('getStatisticAnalysis', secondResponse)
          })
        }
      })
@@ -141,7 +139,7 @@
      this.addVisible = false;
    },
    //保存
     async addSaveHandler() {
    async addSaveHandler() {
      if (this.selectData.length <= 0) {
        this.$message.warning('请至少选择一条数据!');
        return;
@@ -158,13 +156,13 @@
          chartIds: item.codeType.join(',')
        }
      })
       saveStatisticAnalysis(newArray).then(res => {
          this.menuList = res.data.data;
          this.nextSave();
          this.$message.success('保存成功')
        }).catch(error=>{
          this.$message.error(error)
        });
      saveStatisticAnalysis(newArray).then(res => {
        this.menuList = res.data.data;
        this.nextSave();
        this.$message.success('保存成功')
      }).catch(error => {
        this.$message.error(error)
      });
    },
    nextSave() {
      const typeList = {
@@ -198,6 +196,7 @@
    },
  }
}
</script>
<style lang="scss" scoped>