ouyang 3 سال پیش
والد
کامیت
066e803226
2فایلهای تغییر یافته به همراه20 افزوده شده و 9 حذف شده
  1. 19 8
      src/main/vue/src/views/Dashboard.vue
  2. 1 1
      src/main/vue/src/widgets/PriceWidget.vue

+ 19 - 8
src/main/vue/src/views/Dashboard.vue

@@ -44,19 +44,30 @@ export default {
     created() {},
     data() {
         return {
-            layout: [
-                { x: 6, y: 0, w: 6, h: 16, i: '5', name: 'LineChartWidget' },
-                { x: 0, y: 0, w: 3, h: 4, i: '2', name: 'PriceWidget' },
-                { x: 3, y: 0, w: 3, h: 4, i: '1', name: 'NumWidget' },
-                // { x: 0, y: 12, w: 6, h: 6, i: '4', name: 'BarChartWidget' },
-                { x: 0, y: 4, w: 6, h: 12, i: '6', name: 'PieChartWidget' },
-                { x: 0, y: 20, w: 12, h: 10, i: '6', name: 'TopWidget' }
-            ],
+            layout: [],
             editable: false,
             info: {}
         };
     },
     mounted() {
+        if (this.$store.state.userInfo.company) {
+            this.layout = [
+                { x: 0, y: 0, w: 6, h: 4, i: '2', name: 'PriceWidget' },
+                { x: 6, y: 0, w: 6, h: 4, i: '1', name: 'NumWidget' },
+                // { x: 0, y: 12, w: 6, h: 6, i: '4', name: 'BarChartWidget' },
+                { x: 0, y: 4, w: 12, h: 12, i: '6', name: 'PieChartWidget' }
+            ];
+        } else {
+            this.layout = [
+                { x: 6, y: 0, w: 6, h: 16, i: '5', name: 'LineChartWidget' },
+                { x: 0, y: 0, w: 3, h: 4, i: '2', name: 'PriceWidget' },
+                { x: 3, y: 0, w: 3, h: 4, i: '1', name: 'NumWidget' },
+                // { x: 0, y: 12, w: 6, h: 6, i: '4', name: 'BarChartWidget' },
+                { x: 0, y: 4, w: 6, h: 12, i: '6', name: 'PieChartWidget' },
+                // { x: 0, y: 20, w: 6, h: 10, i: '8', name: 'MonthWidget' },
+                { x: 6, y: 20, w: 12, h: 10, i: '7', name: 'TopWidget' }
+            ];
+        }
         this.$http.get('/statistic/total').then(res => {
             this.info = res;
         });

+ 1 - 1
src/main/vue/src/widgets/PriceWidget.vue

@@ -3,7 +3,7 @@
         <i class="fa-fw fas fa-shopping-basket fa-3x" style="color: #40c9c6;"></i>
         <div class="info">
             <div class="text">官方交易额/二手市场(万元)</div>
-            <div class="num">{{ getNum(info.officialPrice) }}/{{ getNum(info.transferPrice) }}</div>
+            <div class="num">{{ getNum(info.officialPrice || 0) }}/{{ getNum(info.transferPrice || 0) }}</div>
         </div>
     </widget-card>
 </template>