Procházet zdrojové kódy

投票记录废弃/恢复

xiaoqiang před 4 roky
rodič
revize
69c799793d

+ 40 - 0
src/api/sing_active/activehelprecord.js

@@ -58,3 +58,43 @@ export const getVote = (productId) => {
     }
   })
 }
+
+export const setStatusHide = (recordIds) => {
+  return request({
+    url: '/api/sing_active/activehelprecord/recordHide',
+    method: 'post',
+    params: {
+      recordIds
+    }
+  })
+}
+
+export const setStatusShow = (recordIds) => {
+  return request({
+    url: '/api/sing_active/activehelprecord/recordShow',
+    method: 'post',
+    params: {
+      recordIds
+    }
+  })
+}
+
+export const setStatusHideByIp = (ips) => {
+  return request({
+    url: '/api/sing_active/activehelprecord/recordHideByIp',
+    method: 'post',
+    params: {
+      ips
+    }
+  })
+}
+
+export const setStatusShowByIp = (ips) => {
+  return request({
+    url: '/api/sing_active/activehelprecord/recordShowByIp',
+    method: 'post',
+    params: {
+      ips
+    }
+  })
+}

+ 79 - 11
src/views/sing_active/activehelprecord.vue

@@ -18,21 +18,28 @@
                @size-change="sizeChange"
                @refresh-change="refreshChange"
                @on-load="onLoad">
-      <!--      <template slot="menuLeft">-->
-      <!--        <el-button type="danger"-->
-      <!--                   size="small"-->
-      <!--                   icon="el-icon-delete"-->
-      <!--                   plain-->
-      <!--                   v-if="permission.activehelprecord_delete"-->
-      <!--                   @click="handleDelete">删 除-->
-      <!--        </el-button>-->
-      <!--      </template>-->
+            <template slot="menuLeft">
+              <el-button type="danger"
+                         size="small"
+                         icon="iconfont icon-yanjing"
+                         plain
+                         v-if="permission.activehelprecord_view"
+                         @click="helpRecordHide"> 废 弃
+              </el-button>
+              <el-button type="success"
+                         size="small"
+                         icon="iconfont icon-yanjing1"
+                         plain
+                         v-if="permission.activehelprecord_view"
+                         @click="helpRecordShow"> 恢 复
+              </el-button>
+            </template>
     </avue-crud>
   </basic-container>
 </template>
 
 <script>
-  import {getList, getDetail, add, update, remove} from "@/api/sing_active/activehelprecord";
+  import {getList, getDetail, add, update, remove,setStatusHide,setStatusShow} from "@/api/sing_active/activehelprecord";
   import {mapGetters} from "vuex";
 
   export default {
@@ -82,6 +89,7 @@
                 trigger: "blur"
               }]
             },
+
             // {
             //   label: "作品ID",
             //   prop: "productId",
@@ -144,6 +152,19 @@
                 trigger: "blur"
               }]
             },
+            {
+              label: "状态",
+              prop: "status",
+              type: 'select',
+              search: true,
+              dicData: [{
+                label:'正常',
+                value: 1
+              },{
+                label:'已废弃',
+                value: 0
+              }]
+            },
           ]
         },
         data: []
@@ -156,7 +177,7 @@
           addBtn: this.vaildData(this.permission.activehelprecord_add, false),
           viewBtn: this.vaildData(this.permission.activehelprecord_view, false),
           delBtn: this.vaildData(this.permission.activehelprecord_delete, false),
-          editBtn: this.vaildData(this.permission.activehelprecord_edit, false)
+          editBtn: this.vaildData(this.permission.activehelprecord_edit, false),
         };
       },
       ids() {
@@ -168,6 +189,50 @@
       }
     },
     methods: {
+      helpRecordHide(){
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据废弃?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return setStatusHide(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      helpRecordShow(){
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据恢复?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return setStatusShow(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);
@@ -281,6 +346,9 @@
           this.data = data.records;
           this.loading = false;
           this.selectionClear();
+          this.data.filter(ele=>{
+            return ele
+          })
         });
       }
     }

+ 87 - 4
src/views/sing_active/producthelpvote.vue

@@ -3,24 +3,40 @@
     <avue-crud :option="option"
                :table-loading="loading"
                :data="data"
+               :page.sync="page"
                v-model="form"
                ref="crud"
+               @selection-change="selectionChange"
                @on-load="onLoad">
       <template slot="menuLeft">
-        <el-button type="success"
+        <el-button type="primary"
                    size="small"
                    icon="el-icon-download"
                    v-if="data && data.length > 0"
                    plain
                    @click="handleDownload">导出
         </el-button>
+        <el-button type="danger"
+                   size="small"
+                   icon="iconfont icon-yanjing"
+                   v-if="data && data.length > 0"
+                   plain
+                   @click="helpRecordHideByIp"> 废 齐
+        </el-button>
+        <el-button type="success"
+                   size="small"
+                   icon="iconfont icon-yanjing1"
+                   v-if="data && data.length > 0"
+                   plain
+                   @click="helpRecordShowByIp"> 恢 复
+        </el-button>
       </template>
     </avue-crud>
   </basic-container>
 </template>
 
 <script>
-  import {getVote} from "@/api/sing_active/activehelprecord";
+  import {getVote,setStatusHideByIp,setStatusShowByIp} from "@/api/sing_active/activehelprecord";
   import {mapGetters} from "vuex";
 
   export default {
@@ -44,11 +60,11 @@
           searchShow: true,
           searchMenuSpan: 6,
           border: true,
-          index: false,
+          index: true,
           addBtn: false,
           viewBtn: false,
           menu: false,
-          selection: false,
+          selection: true,
           dialogClickModal: false,
           column: [
             {
@@ -67,6 +83,18 @@
               label: "投票次数",
               prop: "count",
             },
+            {
+              label: "状态",
+              prop: "status",
+              type: 'select',
+              dicData: [{
+                label:'正常',
+                value: 1
+              },{
+                label:'已废弃',
+                value: 0
+              }]
+            },
           ]
         },
       };
@@ -80,6 +108,61 @@
       ...mapGetters(["permission"]),
     },
     methods: {
+      helpRecordHideByIp(){
+        const arr = [];
+        this.selectionList.forEach((ele) => {
+          arr.push(ele.ip)
+        });
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据隐藏?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return setStatusHideByIp(arr.toString());
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      selectionChange(list) {
+        this.selectionList = list;
+      },
+      helpRecordShowByIp(){
+        const arr = [];
+        this.selectionList.forEach((ele) => {
+          arr.push(ele.ip)
+        });
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据显示?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return setStatusShowByIp(arr.toString());
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
       handleDownload(){
         this.$Export.excel({
           title: this.data[0].productName + "投票情况",