shaogen1995 4 лет назад
Родитель
Сommit
fec1cf14f4
3 измененных файлов с 21 добавлено и 7 удалено
  1. 10 5
      src/views/home/index.vue
  2. 10 1
      src/views/statistics/statistics0.vue
  3. 1 1
      src/views/statistics/statistics1.vue

+ 10 - 5
src/views/home/index.vue

@@ -76,6 +76,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
+import { getReport } from '@/apis/statistics0'
 // ---------------------echarts
 // ---------------------echarts
 import * as echarts from 'echarts/core'
 import * as echarts from 'echarts/core'
 import { TooltipComponent } from 'echarts/components'
 import { TooltipComponent } from 'echarts/components'
@@ -177,6 +178,14 @@ export default {
     col2.data.list.forEach(v => {
     col2.data.list.forEach(v => {
       if (v.status === 1 || v.status === 0) this.dingdong[5].inoc++
       if (v.status === 1 || v.status === 0) this.dingdong[5].inoc++
     })
     })
+    // 文物类别数据处理
+    const Datares = await getReport()
+    const Datatemp = Datares.data.goodsType
+    Datatemp.forEach((v) => {
+      v.value = v.amount
+      v.name += Number(v.percent * 100).toFixed(1) + '%'
+    })
+
     // 图表
     // 图表
     const chartDom = document.querySelector('.echarts')
     const chartDom = document.querySelector('.echarts')
     const myChart = echarts.init(chartDom)
     const myChart = echarts.init(chartDom)
@@ -189,11 +198,7 @@ export default {
         {
         {
           type: 'pie',
           type: 'pie',
           radius: ['40%', '70%'],
           radius: ['40%', '70%'],
-          data: [
-            { value: 1048, name: '陶瓷 10.00%' },
-            { value: 735, name: '青铜 10.00%' },
-            { value: 580, name: '铁 10.00%' }
-          ],
+          data: Datatemp,
           emphasis: {
           emphasis: {
             itemStyle: {
             itemStyle: {
               shadowBlur: 10,
               shadowBlur: 10,

+ 10 - 1
src/views/statistics/statistics0.vue

@@ -51,7 +51,7 @@
             <i class="el-icon-delete" @click="delTow" v-show="userLogo.del"></i>
             <i class="el-icon-delete" @click="delTow" v-show="userLogo.del"></i>
           </div>
           </div>
           <!-- 表格 -->
           <!-- 表格 -->
-          <div class="table">
+          <div class="table" v-if="towList.name">
             <el-table
             <el-table
               :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
               :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
               :data="tableData"
               :data="tableData"
@@ -80,6 +80,7 @@
               </el-table-column>
               </el-table-column>
             </el-table>
             </el-table>
           </div>
           </div>
+          <div v-else class="mydis">请先新建仓库</div>
           <!-- 分页器 -->
           <!-- 分页器 -->
           <div class="paging" v-if="0">
           <div class="paging" v-if="0">
             <el-pagination
             <el-pagination
@@ -528,6 +529,14 @@ export default {
       }
       }
     }
     }
     .conten_right {
     .conten_right {
+      .mydis{
+        position: absolute;
+        left: 50%;
+        top: 50%;
+        transform: translate(-50%,-50%);
+        color: black;
+        font-size: 30px;
+      }
       position: relative;
       position: relative;
       .table {
       .table {
         /deep/.el-table__body-wrapper{
         /deep/.el-table__body-wrapper{

+ 1 - 1
src/views/statistics/statistics1.vue

@@ -97,7 +97,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { getReport } from '../../apis/statistics0'
+import { getReport } from '@/apis/statistics0'
 // ---------------------echarts
 // ---------------------echarts
 import * as echarts from 'echarts/core'
 import * as echarts from 'echarts/core'
 import { TooltipComponent } from 'echarts/components'
 import { TooltipComponent } from 'echarts/components'