Bladeren bron

1. 优化

MONSTER-ygh 1 jaar geleden
bovenliggende
commit
9b0951e18a

+ 28 - 1
src/api/CURD.js

@@ -59,4 +59,31 @@ export function getTableDeatilsByIdApi(url,params) {
       method: 'delete',
       params
     })
-  }
+  }
+
+
+  /**  通用接口  */
+  // get
+  export function publicByGetApi(url,params) {
+    return request({
+      url: url,
+      method: 'get',
+      params
+    })
+  }
+  // post
+  export function publicByPostApi(url,data) {
+    return request({
+      url: url,
+      method: 'post',
+      data: data
+    })
+  }
+  // put
+  export function publicByPutApi(url,data) {
+    return request({
+      url: url,
+      method: 'put',
+      data: data
+    })
+  }

+ 1 - 1
src/views/tourism/scenicAreaManagement/contentManagement/attractionInfoManagement.vue

@@ -259,7 +259,7 @@
       /** 删除按钮操作 */
       handleDelete(row) {
         const ids = row.id || this.ids;
-        this.$modal.confirm('是否确认删除用户编号为"' + ids + '"的数据项?').then( () => {
+        this.$modal.confirm('是否确认删除编号为"' + ids + '"的数据项?').then( () => {
           return delTableParamsApi(this.configUrl.delect,{
             id: ids
           });

+ 22 - 5
src/views/tourism/scenicAreaManagement/contentManagement/carouselAdvertis.vue

@@ -107,13 +107,12 @@
           >
             <template slot-scope="scope" v-if="scope.row.id !== 1">
               <el-button
-                v-if="false"
                 size="mini"
                 type="text"
                 icon="el-icon-document"
-                @click="handleDetails(scope.row)"
-                v-hasPermi="configPermi.details"
-              >详情</el-button>
+                @click="handleRelease(scope.row)"
+                v-hasPermi="configPermi.release"
+              >{{ scope.row.onlineStatus == 0 ? '上线' : '下线' }}</el-button>
               <el-button
                 size="mini"
                 type="text"
@@ -155,6 +154,7 @@
 import { 
   listTableApi, 
   delTableParamsApi, 
+  publicByPutApi as releaseApi
   } from "@/api/CURD";
 import addAndEdit from "./formBox/carouselAdvertisForm.vue"
 import detailsBox from "./detailsBox/navigationManagementDetails.vue"
@@ -172,6 +172,7 @@ export default {
         edit: ['system:user:edit'], // 编辑权限
         upload: ['system:user:upload'],// 导入权限
         export: ['system:user:export'],// 导出权限
+        release: ['system:user:release']
       },
       configUrl: {
         list: '/merchant/advList/pageList', // 列表地址
@@ -179,6 +180,7 @@ export default {
         upload: '',// 导入地址
         download:'', // 下载模板地址
         export: '',// 导出地址
+        release: '/merchant/advList/updateStatus',// 发布接口
       },
       // 遮罩层
       loading: true,
@@ -207,7 +209,7 @@ export default {
         { key: 2, label: `banner图片`, visible: true },
         { key: 3, label: `类型`, visible: true },
         { key: 4, label: `状态`, visible: true },
-        { key: 4, label: `创建时间`, visible: true },
+        { key: 5, label: `创建时间`, visible: true },
       ],
     };
   },
@@ -305,6 +307,21 @@ export default {
         })
       }
     },
+    /** 发布  */
+    handleRelease(row) {
+      const ids = row.id;
+      this.$modal.confirm(`是否确认${row.onlineStatus == 0 ? '上线' : '下线'}编号为"${ids}"的数据项?`).then( () => {
+        return releaseApi(this.configUrl.release,{
+          id: ids,
+          onlineStatus: row.onlineStatus == 0 ? 1 : 0
+        });
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess(`${row.onlineStatus == 0 ? '上线' : '下线'}成功`);
+      }).catch((e) => {
+        console.error("发布失败====",e)
+      });
+    }
   }
 };
 </script>

+ 1 - 1
src/views/tourism/scenicAreaManagement/contentManagement/eventNotifications.vue

@@ -276,7 +276,7 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除用户编号为"' + ids + '"的数据项?').then( () => {
+      this.$modal.confirm('是否确认删除编号为"' + ids + '"的数据项?').then( () => {
         return delTableApi(this.configUrl.delect,ids);
       }).then(() => {
         this.getList();