فهرست منبع

feat: 处理、文章管理、广播分类、启动页、猫王精选电台详情、多添加一层谨慎操作提示

Damon 9 ماه پیش
والد
کامیت
7b2ac8157f
1فایلهای تغییر یافته به همراه122 افزوده شده و 63 حذف شده
  1. 122 63
      src/views/operation/startPage/index.vue

+ 122 - 63
src/views/operation/startPage/index.vue

@@ -1,22 +1,45 @@
+<!-- 运营管理 启动页 -->
 <template>
   <div class="app-container">
     <!-- 搜索 -->
     <el-form inline size="mini">
       <el-form-item label="当前状态:">
         <el-select v-model="form.status" placeholder="请选择当前状态" clearable>
-          <el-option v-for="item in currentOptions" :key="item.value" :label="item.label" :value="item.value" />
+          <el-option
+            v-for="item in currentOptions"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          />
         </el-select>
       </el-form-item>
       <el-form-item label="跳转页面:">
-        <el-select v-model="form.forwardType" placeholder="请选择跳转页面" clearable>
-          <el-option v-for="item in typeOptions" :key="item.value" :label="item.label" :value="item.value" />
+        <el-select
+          v-model="form.forwardType"
+          placeholder="请选择跳转页面"
+          clearable
+        >
+          <el-option
+            v-for="item in typeOptions"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          />
         </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" icon="el-icon-search" @click="getSearch">搜索</el-button>
+        <el-button type="primary" icon="el-icon-search" @click="getSearch"
+          >搜索</el-button
+        >
         <el-button icon="el-icon-refresh" @click="getRefresh">重置</el-button>
-        <el-button type="primary" icon="el-icon-plus" plain @click="getDetail"
-          v-hasPermi="['operation:startPage:add']">新增</el-button>
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          plain
+          @click="getDetail"
+          v-hasPermi="['operation:startPage:add']"
+          >新增</el-button
+        >
       </el-form-item>
     </el-form>
     <!-- 列表 -->
@@ -32,25 +55,52 @@
           <div>{{ scope.row.startTime }} 至 {{ scope.row.endTime }}</div>
         </template>
       </el-table-column>
-      <el-table-column label="跳转" prop="forwardType" align="center" :formatter="forwardFomatter" />
-      <el-table-column label="当前状态" prop="currentStatus" align="center" :formatter="currentFormatter" />
+      <el-table-column
+        label="跳转"
+        prop="forwardType"
+        align="center"
+        :formatter="forwardFomatter"
+      />
+      <el-table-column
+        label="当前状态"
+        prop="currentStatus"
+        align="center"
+        :formatter="currentFormatter"
+      />
       <el-table-column label="操作" align="center">
         <template slot-scope="scope">
-          <el-button type="text" @click="getDetail(scope.row, true)">查看</el-button>
-          <el-button type="text" @click="getDetail(scope.row)" v-hasPermi="['operation:startPage:edit']">编辑</el-button>
-          <el-button type="delete" @click="getDelete(scope.row)"
-            v-hasPermi="['operation:startPage:delete']">删除</el-button>
+          <el-button type="text" @click="getDetail(scope.row, true)"
+            >查看</el-button
+          >
+          <el-button
+            type="text"
+            @click="getDetail(scope.row)"
+            v-hasPermi="['operation:startPage:edit']"
+            >编辑</el-button
+          >
+          <el-button
+            type="delete"
+            @click="getDelete(scope.row)"
+            v-hasPermi="['operation:startPage:delete']"
+            >删除</el-button
+          >
         </template>
       </el-table-column>
     </el-table>
-    <pagination v-show="total > 0" :total="total" :page.sync="form.pageNum" :limit.sync="form.pageSize"
-      @pagination="getList" />
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="form.pageNum"
+      :limit.sync="form.pageSize"
+      @pagination="getList"
+    />
   </div>
 </template>
 
 <script>
-import { page, remove } from '@/api/operation/startPage'
-import { currentMixin } from '@/mixin/index'
+import { page, remove } from "@/api/operation/startPage";
+import { currentMixin } from "@/mixin/index";
+import { dialogCallBack } from "@/utils/DialogUtil";
 export default {
   mixins: [currentMixin],
   data() {
@@ -60,91 +110,100 @@ export default {
       // 表单
       form: {
         pageNum: 1,
-        pageSize: 10
+        pageSize: 10,
       },
       // 列表
       tableData: [],
       total: 0,
       // 跳转类型
-      typeOptions: [{
-        value: 0,
-        label: '指定页面'
-      }, {
-        value: 1,
-        label: '指定URL'
-      }]
-    }
+      typeOptions: [
+        {
+          value: 0,
+          label: "指定页面",
+        },
+        {
+          value: 1,
+          label: "指定URL",
+        },
+      ],
+    };
   },
   mounted() {
-    this.getList()
+    this.getList();
   },
   methods: {
     // 搜索
     getSearch() {
-      this.form.pageNum = 1
-      this.form.pageSize = 10
-      this.getList()
+      this.form.pageNum = 1;
+      this.form.pageSize = 10;
+      this.getList();
     },
 
     // 重置
     getRefresh() {
       this.form = {
         pageNum: 1,
-        pageSize: 10
-      }
-      this.getList()
+        pageSize: 10,
+      };
+      this.getList();
     },
 
     // 列表
     getList() {
-      this.loading = true
-      page(this.form).then(res => {
+      this.loading = true;
+      page(this.form).then((res) => {
         if (res.code === 0) {
-          this.tableData = res.data.records
-          this.total = res.data.total
-          this.loading = false
+          this.tableData = res.data.records;
+          this.total = res.data.total;
+          this.loading = false;
         }
-      })
+      });
     },
 
     // 新增 编辑
     getDetail(row, boolean) {
       this.$router.push({
-        path: '/operation/startPage/detail',
+        path: "/operation/startPage/detail",
         query: {
           id: row.id,
-          boolean: boolean
-        }
-      })
+          boolean: boolean,
+        },
+      });
     },
 
     // 删除
     getDelete(row) {
-      this.$confirm(`是否删除${row.name}`, '提示', {
-        confirmButtonText: '确认',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        remove({
-          id: row.id
-        }).then(res => {
-          if (res.code === 0) {
-            this.$message.success('删除成功!')
-            this.getList()
-          }
-        })
-      }).catch(() => {
-        this.$message.info('取消删除!')
-      })
+      var that = this;
+      dialogCallBack(that, function () {
+        that
+          .$confirm(`是否删除${row.name}`, "提示", {
+            confirmButtonText: "确认",
+            cancelButtonText: "取消",
+            type: "warning",
+          })
+          .then(() => {
+            remove({
+              id: row.id,
+            }).then((res) => {
+              if (res.code === 0) {
+                that.$message.success("删除成功!");
+                that.getList();
+              }
+            });
+          })
+          .catch(() => {
+            that.$message.info("取消删除!");
+          });
+      });
     },
 
     // 字典翻译
     forwardFomatter(row) {
-      return this.selectDictLabel(this.typeOptions, row.forwardType)
+      return this.selectDictLabel(this.typeOptions, row.forwardType);
     },
     currentFormatter(row) {
-      return this.selectDictLabel(this.currentOptions, row.currentStatus)
-    }
-  }
-}
+      return this.selectDictLabel(this.currentOptions, row.currentStatus);
+    },
+  },
+};
 </script>