Browse Source

Merge branch 'dev' of http://git.izouma.com/xiongzhu/raex_back into dev

wangqifan 3 years ago
parent
commit
2f43f63f2c

+ 88 - 27
src/main/vue/src/views/Dashboard.vue

@@ -1,30 +1,90 @@
 <template>
     <div class="dashboard">
-        <grid-layout
-            style="margin: 0 -10px;"
-            :layout="layout"
-            :col-num="12"
-            :row-height="30"
-            :is-draggable="editable"
-            :is-resizable="editable"
-            :is-mirrored="false"
-            :vertical-compact="true"
-            :margin="[10, 10]"
-            :use-css-transforms="true"
-        >
-            <grid-item
-                v-for="item in layout"
-                class="widget-wrapper"
-                :x="item.x"
-                :y="item.y"
-                :w="item.w"
-                :h="item.h"
-                :i="item.i"
-                :key="item.i"
+        <el-tabs type="border-card" v-if="companyId === 1 || companyId === '1'">
+            <el-tab-pane label="Raex绿洲">
+                <grid-layout
+                    style="margin: 0 -10px;"
+                    :layout="layout"
+                    :col-num="12"
+                    :row-height="30"
+                    :is-draggable="editable"
+                    :is-resizable="editable"
+                    :is-mirrored="false"
+                    :vertical-compact="true"
+                    :margin="[10, 10]"
+                    :use-css-transforms="true"
+                >
+                    <grid-item
+                        v-for="item in layout"
+                        class="widget-wrapper"
+                        :x="item.x"
+                        :y="item.y"
+                        :w="item.w"
+                        :h="item.h"
+                        :i="item.i"
+                        :key="item.i"
+                    >
+                        <component :is="item.name" :info="info"></component>
+                    </grid-item>
+                </grid-layout>
+            </el-tab-pane>
+            <el-tab-pane label="业绩统计">
+                <grid-layout
+                    style="margin: 0 -10px;"
+                    :layout="layout"
+                    :col-num="12"
+                    :row-height="30"
+                    :is-draggable="editable"
+                    :is-resizable="editable"
+                    :is-mirrored="false"
+                    :vertical-compact="true"
+                    :margin="[10, 10]"
+                    :use-css-transforms="true"
+                >
+                    <grid-item
+                        v-for="item in layout2"
+                        class="widget-wrapper"
+                        :x="item.x"
+                        :y="item.y"
+                        :w="item.w"
+                        :h="item.h"
+                        :i="item.i"
+                        :key="item.i"
+                    >
+                        <component :is="item.name" :info="info"></component>
+                    </grid-item>
+                </grid-layout>
+            </el-tab-pane>
+        </el-tabs>
+
+        <template v-else>
+            <grid-layout
+                style="margin: 0 -10px;"
+                :layout="layout"
+                :col-num="12"
+                :row-height="30"
+                :is-draggable="editable"
+                :is-resizable="editable"
+                :is-mirrored="false"
+                :vertical-compact="true"
+                :margin="[10, 10]"
+                :use-css-transforms="true"
             >
-                <component :is="item.name" :info="info"></component>
-            </grid-item>
-        </grid-layout>
+                <grid-item
+                    v-for="item in layout"
+                    class="widget-wrapper"
+                    :x="item.x"
+                    :y="item.y"
+                    :w="item.w"
+                    :h="item.h"
+                    :i="item.i"
+                    :key="item.i"
+                >
+                    <component :is="item.name" :info="info"></component>
+                </grid-item>
+            </grid-layout>
+        </template>
+
         <!-- <el-button v-if="editable" @click="save">保存</el-button>
         <el-button v-else @click="editable = true">编辑</el-button> -->
     </div>
@@ -48,6 +108,7 @@ export default {
     data() {
         return {
             layout: [],
+            layout2: [],
             editable: false,
             info: {}
         };
@@ -70,16 +131,16 @@ export default {
                     { 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: 6, h: 10, i: '7', name: 'TopWidget' },
-                    { x: 6, y: 20, w: 12, h: 10, i: '9', name: 'UserHoldTop' },
-                    { x: 6, y: 20, w: 12, h: 10, i: '10', name: 'OtherStatistic' }
+                    { x: 6, y: 20, w: 12, h: 10, i: '9', name: 'UserHoldTop' }
                 ];
+                this.layout2 = [{ x: 6, y: 0, w: 12, h: 12, i: '10', name: 'OtherStatistic' }];
             } else {
                 this.layout = [
                     { x: 0, y: 0, w: 6, h: 4, i: '2', name: 'PriceWidget' },
                     { x: 6, y: 3, 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: 6, h: 12, i: '6', name: 'PieChartWidget' },
-                    { x: 6, y: 4, w: 6, h: 12, i: '8', name: 'MonthWidget' },
+                    { x: 6, y: 4, w: 6, h: 12, i: '8', name: 'MonthWidget' }
                 ];
             }
         }

+ 42 - 10
src/main/vue/src/views/company/CompanyTheme.vue

@@ -34,13 +34,19 @@
                                 </el-radio-group> -->
 
                                 <el-select v-model="formData.theme" placeholder="请选择">
-                                    <el-option
-                                        v-for="item in themeOptions"
-                                        :key="item.value"
-                                        :label="item.label"
-                                        :value="item.value"
+                                    <el-option-group
+                                        v-for="group in themeOptions"
+                                        :key="group.label"
+                                        :label="group.label"
                                     >
-                                    </el-option>
+                                        <el-option
+                                            v-for="item in group.options"
+                                            :key="item.value"
+                                            :label="item.label"
+                                            :value="item.value"
+                                        >
+                                        </el-option>
+                                    </el-option-group>
                                 </el-select>
                             </el-form-item>
 
@@ -132,11 +138,11 @@ export default {
         this.$http.get(`/company/get/${this.companyId}`).then(res => {
             if (res.theme) {
                 this.formData.theme = res.theme;
-                this.formData.logo = res.logo;
-                this.formData.bgImg = res.bgImg;
-                this.formData.bgColor = res.bgColor;
-                this.formData.description = res.description;
             }
+            this.formData.logo = res.logo;
+            this.formData.bgImg = res.bgImg;
+            this.formData.bgColor = res.bgColor;
+            this.formData.description = res.description;
         });
     },
     data() {
@@ -159,6 +165,32 @@ export default {
                 { label: '主题6', value: 'theme6' },
                 { label: '主题7', value: 'theme7' }
             ],
+            // themeOptions: [
+            //     {
+            //         label: '新闻公告主题',
+            //         options: [
+            //             { label: '奶油黄', value: 'theme6' },
+            //             { label: '渐变绿', value: 'theme8' },
+            //             { label: '渐变紫', value: 'theme9' },
+            //             { label: '荧光绿', value: 'theme7' }
+            //         ]
+            //     },
+            //     {
+            //         label: 'banner主题',
+            //         options: [
+            //             { label: '基础', value: 'theme1' },
+            //             { label: '光束', value: 'theme2' },
+            //             { label: '星空', value: 'theme3' }
+            //         ]
+            //     },
+            //     {
+            //         label: '简洁主题',
+            //         options: [
+            //             { label: '太空白', value: 'theme4' },
+            //             { label: '迷雾黑', value: 'theme5' }
+            //         ]
+            //     }
+            // ],
             settings: [],
             collections: [],
             showCollectionDialog: false,

+ 109 - 37
src/main/vue/src/widgets/OtherStatistic.vue

@@ -1,5 +1,5 @@
 <template>
-    <widget-card :bodyStyle="bodyStyle" ref="container">
+    <widget-card :bodyStyle="bodyStyle" ref="container" :loading="loading">
         <template #header>
             <div class="header">
                 <span>销售业绩</span>
@@ -35,11 +35,19 @@
 <script>
 import WidgetCard from './WidgetCard';
 import VueCharts from 'vue-chartjs';
-import {format} from 'date-fns';
+import { format } from 'date-fns';
 import acc from '../mixins/acc';
 import addDays from 'date-fns/esm/addDays';
 
 export default {
+    props: {
+        info: {
+            type: Object,
+            default: () => {
+                return {};
+            }
+        }
+    },
     data() {
         return {
             myChart: null,
@@ -48,13 +56,17 @@ export default {
                 alignItems: 'center',
                 justifyContent: ' space-around'
             },
-            official: 0,
-            transfer: 0,
-            userCount: 0,
-            officialNum: 0,
-            transferNum: 0,
+            // official: 0,
+            // transfer: 0,
+            // userCount: 0,
+            // officialNum: 0,
+            // transferNum: 0,
             value: '',
             options: [
+                {
+                    label: '全部(含Raex)',
+                    value: 'all'
+                },
                 {
                     label: 'MP',
                     value: 'MP'
@@ -70,12 +82,12 @@ export default {
                 {
                     label: '第九空间',
                     value: 'NINTH'
-                },
-
+                }
             ],
             numInfo: {},
             priceInfo: {},
-            config: null
+            config: null,
+            loading: true
         };
     },
     mixins: [acc],
@@ -85,40 +97,100 @@ export default {
         },
         totalNum() {
             return this.accAdd(this.officialElements, this.transferElements);
+        },
+        officialNum() {
+            if (this.value === 'all' && this.numInfo.official) {
+                let money = 0;
+                money = this.accAdd(money, this.info.officialNum);
+                Object.keys(this.numInfo.official).forEach(key => {
+                    money = this.accAdd(money, this.numInfo.official[key]);
+                });
+                return money;
+            } else {
+                return this.numInfo.official ? this.numInfo.official[this.value] || 0 : 0;
+            }
+        },
+        transferNum() {
+            if (this.value === 'all' && this.numInfo.transfer) {
+                let money = 0;
+                money = this.accAdd(money, this.info.transferNum);
+                Object.keys(this.numInfo.transfer).forEach(key => {
+                    money = this.accAdd(money, this.numInfo.transfer[key]);
+                });
+                return money;
+            } else {
+                return this.numInfo.transfer ? this.numInfo.transfer[this.value] || 0 : 0;
+            }
+        },
+        userCount() {
+            if (this.value === 'all' && this.numInfo.userCount) {
+                let money = 0;
+                money = this.accAdd(money, this.info.userNum);
+                Object.keys(this.numInfo.userCount).forEach(key => {
+                    money = this.accAdd(money, this.numInfo.userCount[key]);
+                });
+                return money;
+            } else {
+                return this.numInfo.userCount ? this.numInfo.userCount[this.value] || 0 : 0;
+            }
+        },
+        official() {
+            if (this.value === 'all' && this.priceInfo.official) {
+                let money = 0;
+                money = this.accAdd(money, this.info.officialPrice);
+                Object.keys(this.priceInfo.official).forEach(key => {
+                    money = this.accAdd(money, this.priceInfo.official[key]);
+                });
+                return money;
+            } else {
+                return this.priceInfo.official ? this.priceInfo.official[this.value] || 0 : 0;
+            }
+        },
+        transfer() {
+            if (this.value === 'all' && this.priceInfo.transfer) {
+                let money = 0;
+                money = this.accAdd(money, this.info.transferPrice);
+                Object.keys(this.priceInfo.transfer).forEach(key => {
+                    money = this.accAdd(money, this.priceInfo.transfer[key]);
+                });
+                return money;
+            } else {
+                return this.priceInfo.transfer ? this.priceInfo.transfer[this.value] || 0 : 0;
+            }
         }
     },
     mounted() {
-        this.value = 'MP';
-        this.$http
-            .get('/statistic/otherStatistic')
-            .then(res => {
-                this.numInfo = res.numInfo;
-                this.priceInfo = res.priceInfo;
-                this.$refs.chart.width = this.$refs.container.$el.offsetWidth - this.$refs.box.offsetWidth - 40;
-                this.$refs.chart.height = this.$refs.container.$el.offsetHeight - 100;
-                this.$nextTick(() => {
-                    this.config = {
-                        type: 'doughnut',
-                        data: {
-                            labels: ['官方销售额', '二手市场销售额'],
-                            datasets: []
-                        },
-                        options: {
-                            responsive: true
-                        }
-                    };
-                    this.myChart = new Chart(this.$refs.chart.getContext('2d'), this.config);
-                    this.init(this.value);
-                });
+        this.value = 'all';
+        this.loading = true;
+        this.$http.get('/statistic/otherStatistic').then(res => {
+            this.loading = false;
+            this.numInfo = res.numInfo;
+            this.priceInfo = res.priceInfo;
+            this.$refs.chart.width = this.$refs.container.$el.offsetWidth - this.$refs.box.offsetWidth - 40;
+            this.$refs.chart.height = this.$refs.container.$el.offsetHeight - 100;
+            this.$nextTick(() => {
+                this.config = {
+                    type: 'doughnut',
+                    data: {
+                        labels: ['官方销售额', '二手市场销售额'],
+                        datasets: []
+                    },
+                    options: {
+                        responsive: true
+                    }
+                };
+                this.myChart = new Chart(this.$refs.chart.getContext('2d'), this.config);
+                this.init(this.value);
             });
+        });
     },
     methods: {
         init(value) {
-            this.officialNum = this.numInfo.official ? this.numInfo.official[value] || 0 : 0;
-            this.transferNum = this.numInfo.transfer ? this.numInfo.transfer[value] || 0 : 0;
-            this.official = this.priceInfo.official ? this.priceInfo.official[value] || 0 : 0;
-            this.transfer = this.priceInfo.transfer ? this.priceInfo.transfer[value] || 0 : 0;
-            this.userCount = this.numInfo.userCount ? this.numInfo.userCount[value] || 0 : 0;
+            // this.officialNum = this.numInfo.official ? this.numInfo.official[value] || 0 : 0;
+            // this.transferNum = this.numInfo.transfer ? this.numInfo.transfer[value] || 0 : 0;
+            // this.official = this.priceInfo.official ? this.priceInfo.official[value] || 0 : 0;
+            // this.transfer = this.priceInfo.transfer ? this.priceInfo.transfer[value] || 0 : 0;
+            // this.userCount = this.numInfo.userCount ? this.numInfo.userCount[value] || 0 : 0;
             this.config.data.datasets = [
                 {
                     title: '销售额',

+ 2 - 2
src/main/vue/src/widgets/WidgetCard.vue

@@ -1,5 +1,5 @@
 <template>
-    <el-card shadow="hover" :body-style="[mBodyStyle, bodyStyle]" class="dashboard-widget-card">
+    <el-card shadow="hover" :body-style="[mBodyStyle, bodyStyle]" class="dashboard-widget-card" v-loading="loading">
         <template slot="header">
             <slot name="header"></slot>
         </template>
@@ -10,7 +10,7 @@
 </template>
 <script>
 export default {
-    props: ['bodyStyle'],
+    props: ['bodyStyle','loading'],
     data() {
         return {
             mBodyStyle: {