Kaynağa Gözat

22.1.7(添加数据统计)

彬彬 4 yıl önce
ebeveyn
işleme
10006bf80d

+ 1 - 0
package.json

@@ -16,6 +16,7 @@
     "babel-polyfill": "^6.26.0",
     "classlist-polyfill": "^1.2.0",
     "crypto-js": "^4.0.0",
+    "echarts": "^5.2.2",
     "element-ui": "^2.15.1",
     "js-base64": "^2.5.1",
     "js-cookie": "^2.2.0",

+ 20 - 0
src/api/sing_goods/helpgoods.js

@@ -48,3 +48,23 @@ export const update = (row) => {
   })
 }
 
+export const shelves = (ids) => {
+  return request({
+    url: '/api/sing_goods/helpgoods/shelves',
+    method: 'post',
+    params :{
+      ids
+    }
+  })
+}
+
+export const UnShelves = (ids) => {
+  return request({
+    url: '/api/sing_goods/helpgoods/UnShelves',
+    method: 'post',
+    params :{
+      ids
+    }
+  })
+}
+

+ 20 - 0
src/api/sing_goods/pointgoods.js

@@ -48,3 +48,23 @@ export const update = (row) => {
   })
 }
 
+export const shelves = (ids) => {
+  return request({
+    url: '/api/sing_goods/pointgoods/shelves',
+    method: 'post',
+    params :{
+      ids
+    }
+  })
+}
+
+export const UnShelves = (ids) => {
+  return request({
+    url: '/api/sing_goods/pointgoods/UnShelves',
+    method: 'post',
+    params :{
+      ids
+    }
+  })
+}
+

+ 10 - 0
src/api/wel/index.js

@@ -23,3 +23,13 @@ export const censusTodayTotal = (current, size, params) => {
     }
   })
 }
+
+export const activeTotal = () => {
+  return request({
+    url: '/api/app/index/census/activeTotal',
+    method: 'get',
+    params: {
+
+    }
+  })
+}

+ 9 - 0
src/views/sing_active/activeproductrecord.vue

@@ -163,6 +163,15 @@ export default {
               trigger: "blur"
             }]
           },
+          {
+            label: "参赛者",
+            prop: "player",
+            rules: [{
+              required: true,
+              message: "请输入活动图片地址",
+              trigger: "blur"
+            }]
+          },
           {
             label: "活动",
             prop: "activeId",

+ 20 - 0
src/views/sing_goods/goodsrecord.vue

@@ -91,6 +91,20 @@
                 trigger: "blur"
               }]
             },
+            {
+              label: "创建时间",
+              prop: "createTime",
+              format: "yyyy-MM-dd HH:mm:ss",
+              searchRange: true,
+              type: "datetime",
+              search: true,
+              valueFormat: "yyyy-MM-dd HH:mm:ss",
+              rules: [{
+                required: true,
+                message: "请输入创建时间",
+                trigger: "blur"
+              }]
+            },
           ]
         },
         data: []
@@ -216,6 +230,12 @@
       },
       onLoad(page, params = {}) {
         this.loading = true;
+        Object.assign(params, this.query);
+        if (params.createTime) {
+          params.beginTime = params.createTime[0];
+          params.lastTime = params.createTime[1];
+          params.createTime = null;
+        }
         getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
           const data = res.data.data;
           this.page.total = data.total;

+ 57 - 1
src/views/sing_goods/helpgoods.vue

@@ -43,13 +43,25 @@
                    v-if="permission.helpgoods_delete"
                    @click="handleDelete">删 除
         </el-button>
+        <el-button type="success"
+                   size="small"
+                   icon="el-icon-upload2"
+                   plain
+                   @click="goodsShelves">上 架
+        </el-button>
+        <el-button type="warning"
+                   size="small"
+                   icon="el-icon-download"
+                   plain
+                   @click="goodsUnShelves">下 架
+        </el-button>
       </template>
     </avue-crud>
   </basic-container>
 </template>
 
 <script>
-  import {getList, getDetail, add, update, remove} from "@/api/sing_goods/helpgoods";
+  import {getList, getDetail, add, update, remove,UnShelves,shelves} from "@/api/sing_goods/helpgoods";
   import {mapGetters} from "vuex";
 
   export default {
@@ -295,6 +307,50 @@
       }
     },
     methods: {
+      goodsShelves(){
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return shelves(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      goodsUnShelves(){
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return UnShelves(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
       rowSave(row, done, loading) {
         add(row).then(() => {
           this.onLoad(this.page);

+ 57 - 1
src/views/sing_goods/pointgoods.vue

@@ -43,13 +43,25 @@
                    v-if="permission.pointgoods_delete"
                    @click="handleDelete">删 除
         </el-button>
+        <el-button type="success"
+                   size="small"
+                   icon="el-icon-upload2"
+                   plain
+                   @click="goodsShelves">上 架
+        </el-button>
+        <el-button type="warning"
+                   size="small"
+                   icon="el-icon-download"
+                   plain
+                   @click="goodsUnShelves">下 架
+        </el-button>
       </template>
     </avue-crud>
   </basic-container>
 </template>
 
 <script>
-import {add, getDetail, getList, remove, update} from "@/api/sing_goods/pointgoods";
+import {add, getDetail, getList, remove, update,shelves,UnShelves} from "@/api/sing_goods/pointgoods";
 import {mapGetters} from "vuex";
 
 export default {
@@ -278,6 +290,50 @@ export default {
       }
     },
     methods: {
+      goodsShelves(){
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return shelves(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      goodsUnShelves(){
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return UnShelves(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
       rowSave(row, done, loading) {
         add(row).then(() => {
           this.onLoad(this.page);

+ 1 - 1
src/views/sing_point/userpufapoint.vue

@@ -73,7 +73,7 @@
               }]
             },
             {
-              label: "用户普法积分",
+              label: "用户平台积分",
               prop: "pufaPoint",
               rules: [{
                 required: true,

+ 183 - 9
src/views/wel/index.vue

@@ -24,17 +24,21 @@
         </router-link>
       </div>
     </div>
+    <h3>活动作品数统计</h3>
+    <div id="myChart" :style="{width: '100%', height: '600px'}">
+    </div>
   </div>
 </template>
 
 <script>
-import {censusAllTotal, censusTodayTotal} from "@/api/wel/index";
+  import {activeTotal, censusAllTotal, censusTodayTotal} from "@/api/wel/index";
 
-export default {
+  var echarts = require('echarts');
+  export default {
     name: "wel",
     data() {
       return {
-        option:{
+        option: {
           xAxis: {
             type: 'category',
             data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
@@ -209,20 +213,179 @@ export default {
     created() {
       this.init()
     },
+    mounted() {
+      this.drawLine();
+    },
     methods: {
-      init(){
+        drawLine() {
+/*            activeTotal().then(res => {
+            const titleList = [];
+            const countList = [];
+            res.data.data.forEach(ele => {
+              titleList.push(ele.name);
+              countList.push(ele.value);
+            })
+            // 基于准备好的dom,初始化echarts实例
+            let myChart = echarts.init(document.getElementById('myChart'))
+            // 绘制图表
+            myChart.setOption({
+              title: {
+                text: '活动作品统计'
+              },
+              tooltip: {},
+              xAxis: {
+                data: titleList,
+                name: "活动名称",
+                axisLabel : {//坐标轴刻度标签的相关设置。
+                  formatter : function(params){
+                    var newParamsName = "";// 最终拼接成的字符串
+                    var paramsNameNumber = params.length;// 实际标签的个数
+                    var provideNumber = 6;// 每行能显示的字的个数
+                    var rowNumber = Math.ceil(paramsNameNumber / provideNumber);// 换行的话,需要显示几行,向上取整
+                    // 条件等同于rowNumber>1
+                    if (paramsNameNumber > provideNumber) {
+
+                      for (var p = 0; p < rowNumber; p++) {
+                        var tempStr = "";// 表示每一次截取的字符串
+                        var start = p * provideNumber;// 开始截取的位置
+                        var end = start + provideNumber;// 结束截取的位置
+                        // 此处特殊处理最后一行的索引值
+                        if (p == rowNumber - 1) {
+                          // 最后一次不换行
+                          tempStr = params.substring(start, paramsNameNumber);
+                        } else {
+                          // 每一次拼接字符串并换行
+                          tempStr = params.substring(start, end) + "\n";
+                        }
+                        newParamsName += tempStr;// 最终拼成的字符串
+                      }
+
+                    } else {
+                      // 将旧标签的值赋给新标签
+                      newParamsName = params;
+                    }
+                    //将最终的字符串返回
+                    return newParamsName
+                  }
+
+                }
+              },
+              yAxis: {},
+              series: [{
+                name: '作品数',
+                type: 'bar',
+                data: countList
+              }],
+              grid:{//直角坐标系内绘图网格
+                bottom:"40%" //
+              },
+
+            });
+          });*/
+          /*activeTotal().then(res => {
+            let myChart = echarts.init(document.getElementById('myChart'))
+            myChart.setOption({
+              //backgroundColor: "#fff",
+              title: {
+                text: '活动作品统计',
+                left: 'center',
+                top: 20,
+                textStyle: {
+                  color: '#000'
+                }
+              },
+              tooltip: {
+                trigger: 'item'
+              },
+              visualMap: {
+                show: false,
+                min: 80,
+                max: 600,
+                inRange: {
+                  colorLightness: [0, 1]
+                }
+              },
+              series: [
+                {
+                  name: '作品数',
+                  type: 'pie',
+                  radius: '55%',
+                  center: ['50%', '50%'],
+                  data: res.data.data
+                  .sort(function (a, b) {
+                    return a.value - b.value;
+                  }),
+                  roseType: 'radius',
+                  label: {
+                    color: '#000'
+                  },
+                  labelLine: {
+                    lineStyle: {
+                      color: '#000'
+                    },
+                    smooth: 0.2,
+                    length: 10,
+                    length2: 20
+                  },
+                  itemStyle: {
+                    color: '#c23531',
+                    shadowBlur: 200,
+                    shadowColor: 'rgba(0, 0, 0, 0.5)'
+                  },
+                  animationType: 'scale',
+                  animationEasing: 'elasticOut',
+                  animationDelay: function () {
+                    return Math.random() * 200;
+                  }
+                }
+              ]
+            })
+          })*/
+         activeTotal().then(res => {
+           var myChart = echarts.init(document.getElementById("myChart"));
+           myChart.setOption({
+             backgroundColor: '#fff',
+             title: {
+               left: 'center'
+             },
+             tooltip: {
+               trigger: 'item'
+             },
+             // legend: {
+             //   orient: 'vertical',
+             //   left: 'left'
+             // },
+             series: [
+               {
+                 name: '作品数',
+                 type: 'pie',
+                 radius: '50%',
+                 data: res.data.data,
+                 emphasis: {
+                   itemStyle: {
+                     shadowBlur: 10,
+                     shadowOffsetX: 0,
+                     shadowColor: 'rgba(0, 0, 0, 0.5)'
+                   }
+                 }
+               }
+             ],
+           })
+         })
+      },
+      init() {
         censusAllTotal().then(res => {
-          let { data } = res.data
+          let {data} = res.data
           this.dataSummaryData.map(item => {
             return (item.count = data[item.key]) && item
           })
-        })
-        censusTodayTotal().then(res=>{
-          let { data } = res.data
+        });
+        censusTodayTotal().then(res => {
+          let {data} = res.data
           this.addedTodayData.map(item => {
             return (item.count = data[item.key]) && item
           })
-        })
+        });
       }
     },
   };
@@ -256,20 +419,25 @@ export default {
           &:nth-child(1) {
             background-color: #4065E0;
           }
+
           &:nth-child(2) {
             background-color: #6F7FFA;
           }
+
           &:nth-child(3) {
             background-color: #6FCAFA;
           }
+
           &:nth-child(4) {
             background-color: #1DD3B7;
           }
+
           .info {
             margin-left: 40px;
             display: flex;
             flex-direction: column;
             align-items: center;
+
             .count {
               font-weight: bold;
               font-size: 36px;
@@ -279,20 +447,24 @@ export default {
         }
       }
     }
+
     .added-today {
       border-radius: 10px;
+
       .list-item {
         display: flex;
         justify-content: center;
         align-items: center;
         height: 280px;
         background-color: #fff;
+
         .item {
           flex: 1;
           display: flex;
           flex-direction: column;
           justify-content: center;
           align-items: center;
+
           .icon {
             width: 90px;
             height: 90px;
@@ -302,12 +474,14 @@ export default {
             justify-content: center;
             align-items: center;
           }
+
           .count {
             color: #409EFF;
             font-weight: bold;
             font-size: 36px;
             margin: 30px 0 20px;
           }
+
           .tips {
             font-size: 14px;
             color: #888;