zhuf 1 year ago
parent
commit
680a201e2d
5 changed files with 466 additions and 437 deletions
  1. 1 1
      auto-imports.d.ts
  2. 1 3
      components.d.ts
  3. 420 394
      pnpm-lock.yaml
  4. 41 36
      src/pages/xdjy/qjygl/zytj.vue
  5. 3 3
      src/router/index.ts

+ 1 - 1
auto-imports.d.ts

@@ -1,5 +1,5 @@
 // Generated by 'unplugin-auto-import'
 export {}
 declare global {
-
+  const ElMessage: typeof import('element-plus/es')['ElMessage']
 }

+ 1 - 3
components.d.ts

@@ -10,6 +10,7 @@ declare module '@vue/runtime-core' {
     ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
     ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
     ElDialog: typeof import('element-plus/es')['ElDialog']
+    ElEmpty: typeof import('element-plus/es')['ElEmpty']
     ElForm: typeof import('element-plus/es')['ElForm']
     ElFormItem: typeof import('element-plus/es')['ElFormItem']
     ElInput: typeof import('element-plus/es')['ElInput']
@@ -17,8 +18,6 @@ declare module '@vue/runtime-core' {
     ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
     ElOption: typeof import('element-plus/es')['ElOption']
     ElPagination: typeof import('element-plus/es')['ElPagination']
-    ElPopover: typeof import('element-plus/es')['ElPopover']
-    ElProgress: typeof import('element-plus/es')['ElProgress']
     ElRadio: typeof import('element-plus/es')['ElRadio']
     ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
     ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
@@ -26,7 +25,6 @@ declare module '@vue/runtime-core' {
     ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
     ElTable: typeof import('element-plus/es')['ElTable']
     ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
-    ElUpload: typeof import('element-plus/es')['ElUpload']
     FileLink: typeof import('./src/components/FileLink/index.vue')['default']
     FileUpload: typeof import('./src/components/FileUpload/index.vue')['default']
     ImportButton: typeof import('./src/components/ImportButton/index.vue')['default']

File diff suppressed because it is too large
+ 420 - 394
pnpm-lock.yaml


+ 41 - 36
src/pages/xdjy/qjygl/zytj.vue

@@ -1,7 +1,7 @@
 <script setup>
-import { ref, onMounted } from "vue";
-import request, { download } from '~/utils/request';
-import typeUrl from '~/assets/type.png'
+import { ref } from "vue";
+import typeUrl from '~/assets/type.png';
+import request from '~/utils/request';
 
 import * as echarts from 'echarts';
 
@@ -11,7 +11,7 @@ const tableKey = 'xqzt_id'
 
 const queryFormData = ref({})
 
-const tableData = ref([])
+const tableData = ref()
 const cardData = ref([])
 
 
@@ -28,16 +28,20 @@ function queryApi() {
     }
   }).then(response => {
     const { data } = response
+    const str = JSON.stringify(data.content_json)
+    if(str==='{}'){
+      throw new Error('暂无数据')
+    }
     tableData.value = data.content_json
-    cardData.value = data.content_json.card
+    cardData.value = data.content_json.card ?? []
     return response
   }).then(() => {
     loading.value = false
   }).then(() => {
 
     const size = boxRef.value.getBoundingClientRect()
-    const chartData = tableData.value.chart
-    const xAxisType = chartData.xk
+    const chartData = tableData.value?.chart
+    const xAxisType = chartData?.xk
 
 
     const chart1 = echarts.init(canvasRef1.value, 'default', { width: size.width * 0.6, height: size.height / 2 })
@@ -217,6 +221,10 @@ function queryApi() {
         },
       ]
     })
+  }).catch(err => {
+    console.log(err)
+    loading.value = false
+    ElMessage.error(err.message)
   })
 }
 queryApi()
@@ -244,14 +252,14 @@ const canvasRef5 = ref()
           </div>
           <div>
             <div>资源数量</div>
-            <div class="text-black text-2xl mt-1">{{ cardData[0]?.zysl }}</div>
+            <div class="text-black text-2xl mt-1">{{ cardData[0]?.zysl ??'-'}}</div>
           </div>
         </div>
         <div class="divider"></div>
-        <div class="flex justify-between py-1"><span>本月新增</span><span
-            class="text-black">{{ cardData[0]?.byxz }}</span></div>
-        <div class="flex justify-between py-1"><span>资源类型数</span><span
-            class="text-black">{{ cardData[0]?.zylxs }}</span></div>
+        <div class="flex justify-between py-1"><span>本月新增</span><span class="text-black">{{ cardData[0]?.byxz ??'-'}}</span>
+        </div>
+        <div class="flex justify-between py-1"><span>资源类型数</span><span class="text-black">{{ cardData[0]?.zylxs ??'-'}}</span>
+        </div>
       </div>
 
       <div class="card w-19/100">
@@ -262,14 +270,14 @@ const canvasRef5 = ref()
           </div>
           <div>
             <div>下载数量</div>
-            <div class=" text-black text-2xl mt-1">{{ cardData[1]?.xzsl }}</div>
+            <div class=" text-black text-2xl mt-1">{{ cardData[1]?.xzsl ??'-'}}</div>
           </div>
         </div>
         <div class="divider"></div>
-        <div class="flex justify-between py-1"><span>本月下载</span><span
-            class="text-black">{{ cardData[1]?.byxz }}</span></div>
-        <div class="flex justify-between py-1"><span>单日最多下载数</span><span
-            class="text-black">{{ cardData[1]?.drzdxzs }}</span></div>
+        <div class="flex justify-between py-1"><span>本月下载</span><span class="text-black">{{ cardData[1]?.byxz ??'-'}}</span>
+        </div>
+        <div class="flex justify-between py-1"><span>单日最多下载数</span><span class="text-black">{{ cardData[1]?.drzdxzs
+        ??'-'}}</span></div>
       </div>
 
       <div class="card w-19/100">
@@ -280,13 +288,13 @@ const canvasRef5 = ref()
           </div>
           <div>
             <div>占有空间</div>
-            <div class=" text-black text-2xl mt-1">{{ cardData[2]?.zykj }}</div>
+            <div class=" text-black text-2xl mt-1">{{ cardData[2]?.zykj ??'-'}}</div>
           </div>
         </div>
         <div class="divider"></div>
-        <div class="flex justify-between py-1"><span>本月占有</span><span
-            class="text-black">{{ cardData[2]?.byzy }}</span></div>
-        <div class="flex justify-between py-1"><span>总空间</span><span class="text-black">{{ cardData[2]?.zkj }}</span>
+        <div class="flex justify-between py-1"><span>本月占有</span><span class="text-black">{{ cardData[2]?.byzy ??'-'}}</span>
+        </div>
+        <div class="flex justify-between py-1"><span>总空间</span><span class="text-black">{{ cardData[2]?.zkj ??'-'}}</span>
         </div>
       </div>
 
@@ -298,14 +306,14 @@ const canvasRef5 = ref()
           </div>
           <div>
             <div>总空间</div>
-            <div class=" text-black text-2xl mt-1">{{ cardData[3]?.yhsl }}</div>
+            <div class=" text-black text-2xl mt-1">{{ cardData[3]?.yhsl ??'-'}}</div>
           </div>
         </div>
         <div class="divider"></div>
-        <div class="flex justify-between py-1"><span>本年新增</span><span
-            class="text-black">{{ cardData[3]?.bnxz }}</span></div>
-        <div class="flex justify-between py-1"><span>平台总访问量</span><span
-            class="text-black">{{ cardData[3]?.ptzfwl }}</span></div>
+        <div class="flex justify-between py-1"><span>本年新增</span><span class="text-black">{{ cardData[3]?.bnxz ??'-'}}</span>
+        </div>
+        <div class="flex justify-between py-1"><span>平台总访问量</span><span class="text-black">{{ cardData[3]?.ptzfwl
+        ??'-'}}</span></div>
       </div>
 
       <div class="card w-19/100">
@@ -316,14 +324,14 @@ const canvasRef5 = ref()
           </div>
           <div>
             <div>资源评论</div>
-            <div class=" text-black text-2xl mt-1">{{ cardData[4]?.zypl }}</div>
+            <div class=" text-black text-2xl mt-1">{{ cardData[4]?.zypl ??'-'}}</div>
           </div>
         </div>
         <div class="divider"></div>
-        <div class="flex justify-between py-1"><span>本月新增</span><span
-            class="text-black">{{ cardData[4]?.byxz }}</span></div>
-        <div class="flex justify-between py-1"><span>匿名评价总数</span><span
-            class="text-black">{{ cardData[4]?.nmpjzs }}</span></div>
+        <div class="flex justify-between py-1"><span>本月新增</span><span class="text-black">{{ cardData[4]?.byxz ??'-'}}</span>
+        </div>
+        <div class="flex justify-between py-1"><span>匿名评价总数</span><span class="text-black">{{ cardData[4]?.nmpjzs
+        ??'-'}}</span></div>
       </div>
 
     </div>
@@ -331,7 +339,7 @@ const canvasRef5 = ref()
     <div class="flex-auto card flex flex-col w-full">
       <div>各学科资源统计</div>
       <div class="divider"></div>
-      <div ref="boxRef" class="flex-auto w-full">
+      <div v-if="tableData" ref="boxRef" class="flex-auto w-full">
         <div class="h-1/2 flex">
           <canvas ref="canvasRef1" class=" h-full"></canvas>
           <canvas ref="canvasRef2" class=" h-full"></canvas>
@@ -342,11 +350,8 @@ const canvasRef5 = ref()
           <canvas ref="canvasRef5" class=" h-full"></canvas>
         </div>
       </div>
+      <el-empty v-else description="暂无数据"></el-empty>
     </div>
   </div>
-
-
-
-
 </template>
 

+ 3 - 3
src/router/index.ts

@@ -1,9 +1,9 @@
 import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
-import { RouteRecordDetailRaw } from './routes.d';
 import { app_ready, app_routes } from '~/store/app';
+import { RouteRecordDetailRaw } from './routes.d';
 
-import localRoutes,{title} from './routes/xdjx';
-// import localRoutes from './routes/xdjy';
+// import localRoutes,{title} from './routes/xdjx';
+import localRoutes, { title } from './routes/xdjy';
 // import localRoutes from './routes/xdhq';
 
 document.title = title