xiaomj пре 3 година
родитељ
комит
911b4dfa61
2 измењених фајлова са 54 додато и 57 уклоњено
  1. 9 0
      src/api/policy_list.js
  2. 45 57
      src/views/pset/login_setting.vue

+ 9 - 0
src/api/policy_list.js

@@ -300,6 +300,15 @@ export function addImgCarousel(params) {
   })
 }
 
+//修改轮播图
+export function editImgCarousel(params) {
+  return request({
+    url:'/record/update',
+    method: 'post',
+    data: params
+  })
+}
+
 //批量删除轮播图
 export function delImgData(params) {
   return request({

+ 45 - 57
src/views/pset/login_setting.vue

@@ -24,6 +24,7 @@
         fit
         highlight-current-row
         stripe
+        @selection-change="handleSelectionChange"
       >
         <el-table-column type="selection" width="55" align="center">
         </el-table-column>
@@ -230,15 +231,13 @@
     import Pagination from "@/components/Pagination";
     import ImageUpload from '@/components/Common/image-upload.vue';
     import {
-        delTypeData,
-        addData,
-        updateType,
         getProductList,
         getImgCarouseList,
         handleImgIsShow,
         addImgCarousel,
         delImgData,
         addCompany,
+        editImgCarousel,
     } from "@/api/policy_list";
 
     export default {
@@ -308,20 +307,7 @@
                     },
 
                 ],
-                options: [
-                    {
-                        value: "",
-                        label: "状态",
-                    },
-                    {
-                        value: 1,
-                        label: "显示",
-                    },
-                    {
-                        value: 0,
-                        label: "隐藏",
-                    },
-                ],
+
                 rules: {
                     imgCarouselName: [
                         { required: true, message: "请输入轮播图名称", trigger: "blur" },
@@ -335,7 +321,7 @@
                 },
                 productList: [],
                 fileList: [],
-
+                multipleSelection: [],
             };
         },
         methods: {
@@ -356,7 +342,6 @@
                 //   this.listLoading = false;
                 // });
                 getImgCarouseList(params).then((res) => {
-                    console.log(res.data);
                     this.dataList = res.data;
                     this.listLoading = false;
                 });
@@ -389,7 +374,7 @@
             },
             hanleEdit(item) {
                 this.dialogForm = {
-                    // id: item.id,
+                    id: item.id,
                     companyRecordManageId: item.companyRecordManageId,
                     imgCarouselName: item.imgCarouselName,
                     imgCarouselUrl: item.imgCarouselUrl,
@@ -417,47 +402,15 @@
             },
 
             addImgCarousel(){
-                this.$refs.dialogForm.validate((valid) => {
-                    //console.log(...this.dialogForm)
-                    if (valid) {
-                        this.dialogForm.imgCarouselUrl = "http://hg.zfire.top/api/img/get?key=" + this.fileList[0].url
-                        const params = {
-                            ...this.dialogForm,
-                        };
-                        addImgCarousel(params).then((res) => {
-                            this.$successMsg("添加成功");
-                            this.hanleReset();
-                        });
-                    } else {
-                        console.log("error submit!!");
-                        return false;
-                    }
-                });
-            },
-
-            //添加公司信息
-            addComPany(){
-
-                //console.log(...this.dialogForm)
-                const params = {
-                    ...this.comPanyDialogForm,
-                };
-                addCompany(params).then((res) => {
-                    this.$successMsg("添加成功");
-                    this.hanleReset();
-                });
-
-            },
-
-            handelInfo() {
                 if (this.type == 1) {
                     this.$refs.dialogForm.validate((valid) => {
+                        //console.log(...this.dialogForm)
                         if (valid) {
+                            this.dialogForm.imgCarouselUrl = "http://hg.zfire.top/api/img/get?key=" + this.fileList[0].url
                             const params = {
                                 ...this.dialogForm,
                             };
-                            addData(params).then((res) => {
-                                console.log(res);
+                            addImgCarousel(params).then((res) => {
                                 this.$successMsg("添加成功");
                                 this.hanleReset();
                             });
@@ -470,15 +423,30 @@
                     const upParams = {
                         ...this.dialogForm,
                     };
-                    updateType(upParams).then((res) => {
+                    editImgCarousel(upParams).then((res) => {
                         this.$successMsg("修改成功");
-
                         this.hanleReset();
                     });
                 } else {
                     this.dialogVisible = false;
                 }
             },
+            // 表格选择
+            handleSelectionChange(val) {
+                this.multipleSelection = val;
+            },
+
+            //添加公司信息
+            addComPany(){
+                const params = {
+                    ...this.comPanyDialogForm,
+                };
+                addCompany(params).then((res) => {
+                    this.$successMsg("添加成功");
+                    this.hanleReset();
+                });
+
+            },
             resetForm(formName) {
                 this.$refs.dialogForm.resetFields();
             },
@@ -494,6 +462,26 @@
                 this.dialogVisible = false;
                 this.getList();
             },
+            batchDelete() {
+                if(this.multipleSelection.length < 1) {
+                    return this.$errorMsg('请选择信息');
+                }
+                this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(() => {
+                    let ids = [];
+                    this.multipleSelection.forEach(item => {
+                        ids.push(item.id);
+                    });
+                    delImgData({ids: ids.join(',')}).then(res => {
+                        this.$successMsg('删除成功');
+                        this.hanleReset();
+                    })
+                }).catch(() => {});
+            },
+
         },
         components: {
             Pagination,