Browse Source

项目投资走势修改

duy 7 tháng trước cách đây
mục cha
commit
bd7db74ea4
2 tập tin đã thay đổi với 12 bổ sung7 xóa
  1. 7 2
      src/views/home/datav.vue
  2. 5 5
      src/views/home/modules/charts.vue

+ 7 - 2
src/views/home/datav.vue

@@ -188,7 +188,7 @@
                     <div class="hc-datav-row-line relative">
                         <div class="title">项目投资走势</div>
                         <div class="hc-full relative">
-                            <HcDatavCharts v-if="isDatavCharts" />
+                            <HcDatavCharts v-if="isDatavCharts" :datas="chartsData" />
                         </div>
                     </div>
                 </el-col>
@@ -447,12 +447,17 @@ const investStat = ref({
     fourFinished:0,
     fourUnFinished:0,
 })
+const chartsData = ref({})
 const getDataInvestStat = async ()=>{
     const { error, code, data } = await projectApi.dataInvestStat(searchForm.value)
     //处理数据
     if (!error && code === 200) {
         investStat.value = getObjValue(data)
         tableData1.value = getArrValue(data['list'])
+        if (tableData1.value.length > 0) {
+            chartsData.value = getObjValue(tableData1.value[0]['map'])
+        }
+        
     } else {
         investStat.value = {
             oneFinished:0,
@@ -509,7 +514,7 @@ const tableData1 = ref([])
 //表格被点击
 const isDatavCharts = ref(true)
 const tableRowClick = (row) => {
-    console.log(row)
+    chartsData.value = getObjValue(row.map)
     //模拟改变图表
     isDatavCharts.value = false
     setTimeout(() => {

+ 5 - 5
src/views/home/modules/charts.vue

@@ -8,8 +8,8 @@ import { getNumber, getRandom } from 'js-fast-way'
 
 const props = defineProps({
     datas: {
-        type: Array,
-        default: () => ([]),
+        type: Object,
+        default: () => ({}),
     },
 })
 
@@ -57,17 +57,17 @@ const setClassifyChartsOption = (data) => {
             {
                 name: '计划投资',
                 type: 'line',
-                data: [getNumber(3), getNumber(3), getNumber(3), getNumber(3)],
+                data: data?.a,
             },
             {
                 name: '实际完成投资',
                 type: 'line',
-                data: [getNumber(3), getNumber(3), getNumber(3), getNumber(3)],
+                data: data?.b,
             },
             {
                 name: '未完成投资',
                 type: 'line',
-                data: [getNumber(3), getNumber(3), getNumber(3), getNumber(3)],
+                data: data?.c,
             },
         ],
     }