Преглед изворни кода

feat: 解决,系统管理,字典管理,翻页面,回到之前界面数据不刷新

332777428@qq.com пре 1 месец
родитељ
комит
1f138ad62b
2 измењених фајлова са 175 додато и 91 уклоњено
  1. 43 39
      src/router/index.js
  2. 132 52
      src/views/system/dict/index.vue

+ 43 - 39
src/router/index.js

@@ -241,7 +241,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 歌单
+  // 歌单
   {
     name: 'musicMenu',
     path: '/music',
@@ -259,7 +259,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 音乐专辑
+  // 音乐专辑
   {
     name: 'musicAlbum',
     path: '/music',
@@ -277,7 +277,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 播客专辑
+  // 播客专辑
   {
     name: 'musicBlog',
     path: '/music',
@@ -295,7 +295,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 节目
+  // 节目
   {
     name: 'musicProgram',
     path: '/music',
@@ -333,7 +333,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 广播电台
+  // 广播电台
   {
     name: 'musicRadio',
     path: '/music',
@@ -351,7 +351,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 猫王精选电台
+  // 猫王精选电台
   {
     name: 'musicChoiceness',
     path: '/music',
@@ -370,7 +370,7 @@ export const dynamicRoutes = [
   },
 
 
-    //****************** 服务管理 *******************//
+  //****************** 服务管理 *******************//
 
 
   // 音乐套餐 
@@ -390,7 +390,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 流量套餐
+  // 流量套餐
   {
     name: "serviceFlow",
     path: '/service',
@@ -407,7 +407,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    //会员套餐
+  //会员套餐
   {
     name: 'serviceVip',
     path: '/service',
@@ -425,7 +425,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    //****************** 运营管理 *******************//
+  //****************** 运营管理 *******************//
 
   // 启动页
   {
@@ -438,7 +438,7 @@ export const dynamicRoutes = [
       name: 'operationStartPageDetail',
       path: 'startPage/detail',
       component: () => import('@/views/operation/startPage/detail'),
-   
+
       meta: {
         title: '启动页详情',
         activeMenu: '/operation/startPage'
@@ -446,7 +446,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 推荐管理
+  // 推荐管理
   {
     name: 'operationRecommend',
     path: '/operation',
@@ -464,7 +464,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 定制频道
+  // 定制频道
   {
     name: 'operationChannel',
     path: '/operation',
@@ -482,7 +482,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 多频多台
+  // 多频多台
   {
     name: 'operationChannels',
     path: '/operation',
@@ -501,7 +501,7 @@ export const dynamicRoutes = [
   },
 
 
-    // 标签分类
+  // 标签分类
   {
     name: 'operationTag',
     path: '/operation',
@@ -556,7 +556,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 协议管理
+  // 协议管理
   {
     name: 'operationAgreement',
     path: '/operation',
@@ -582,7 +582,7 @@ export const dynamicRoutes = [
     component: Layout,
     hidden: true,
     permissions: ['operation:activity:list'],
- 
+
     children: [{
       name: 'operationActivityDetail',
       path: 'activity/detail',
@@ -612,7 +612,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 门店管理
+  // 门店管理
   {
     name: 'operationMap',
     path: '/operation',
@@ -630,7 +630,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 说明书管理详情
+  // 说明书管理详情
   {
     name: 'operationExplain',
     path: '/operation',
@@ -648,7 +648,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 微信轮播图
+  // 微信轮播图
   {
     name: 'operationWXBanner',
     path: '/operation',
@@ -667,7 +667,7 @@ export const dynamicRoutes = [
   },
 
 
-    //****************** 签到管理 *******************//
+  //****************** 签到管理 *******************//
 
   // 抽奖配置
   {
@@ -687,7 +687,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 内容配置
+  // 内容配置
   {
     name: 'registrationContent',
     path: '/registration',
@@ -705,7 +705,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 兑换配置
+  // 兑换配置
   {
     name: 'registrationExchange',
     path: '/registration',
@@ -743,7 +743,7 @@ export const dynamicRoutes = [
     }]
   },
 
-    // 推送弹窗
+  // 推送弹窗
   {
     name: 'pushDialog',
     path: '/push',
@@ -802,7 +802,25 @@ export const dynamicRoutes = [
   },
 
 
+  //****************** 系统管理 *******************//
 
+  // 字典管理
+  {
+    name: 'systemDict',
+    path: '/system/dict-data',
+    component: Layout,
+    hidden: true,
+    permissions: ['system:dict:list'],
+    children: [{
+      name: 'systemDictData',
+      path: 'index/:dictId(\\d+)',
+      component: () => import('@/views/system/dict/data'),
+      meta: {
+        title: '字典数据',
+        activeMenu: '/system/dict'
+      }
+    }]
+  },
 
 
 
@@ -866,21 +884,7 @@ export const dynamicRoutes = [
       }
     }]
   },
-  {
-    path: '/system/dict-data',
-    component: Layout,
-    hidden: true,
-    permissions: ['system:dict:list'],
-    children: [{
-      path: 'index/:dictId(\\d+)',
-      component: () => import('@/views/system/dict/data'),
-      name: 'Data',
-      meta: {
-        title: '字典数据',
-        activeMenu: '/system/dict'
-      }
-    }]
-  },
+
   {
     path: '/monitor/job-log',
     component: Layout,

+ 132 - 52
src/views/system/dict/index.vue

@@ -1,6 +1,14 @@
+<!-- 系统管理 字典管理 -->
+
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      :inline="true"
+      v-show="showSearch"
+      label-width="68px"
+    >
       <el-form-item label="字典名称" prop="dictName">
         <el-input
           v-model="queryParams.dictName"
@@ -50,8 +58,16 @@
         ></el-date-picker>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button
+          type="primary"
+          icon="el-icon-search"
+          size="mini"
+          @click="handleQuery"
+          >搜索</el-button
+        >
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
+          >重置</el-button
+        >
       </el-form-item>
     </el-form>
 
@@ -64,7 +80,8 @@
           size="mini"
           @click="handleAdd"
           v-hasPermi="['system:dict:add']"
-        >新增</el-button>
+          >新增</el-button
+        >
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -75,7 +92,8 @@
           :disabled="single"
           @click="handleUpdate"
           v-hasPermi="['system:dict:edit']"
-        >修改</el-button>
+          >修改</el-button
+        >
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -86,7 +104,8 @@
           :disabled="multiple"
           @click="handleDelete"
           v-hasPermi="['system:dict:remove']"
-        >删除</el-button>
+          >删除</el-button
+        >
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -96,7 +115,8 @@
           size="mini"
           @click="handleExport"
           v-hasPermi="['system:dict:export']"
-        >导出</el-button>
+          >导出</el-button
+        >
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -106,34 +126,71 @@
           size="mini"
           @click="handleRefreshCache"
           v-hasPermi="['system:dict:remove']"
-        >刷新缓存</el-button>
+          >刷新缓存</el-button
+        >
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+      <right-toolbar
+        :showSearch.sync="showSearch"
+        @queryTable="getList"
+      ></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
+    <el-table
+      v-loading="loading"
+      :data="typeList"
+      @selection-change="handleSelectionChange"
+    >
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="字典编号" align="center" prop="dictId" />
-      <el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" />
-      <el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
+      <el-table-column
+        label="字典名称"
+        align="center"
+        prop="dictName"
+        :show-overflow-tooltip="true"
+      />
+      <el-table-column
+        label="字典类型"
+        align="center"
+        :show-overflow-tooltip="true"
+      >
         <template slot-scope="scope">
-          <router-link :to="'/system/dict-data/index/' + scope.row.dictId" class="link-type">
+          <router-link
+            :to="'/system/dict-data/index/' + scope.row.dictId"
+            class="link-type"
+          >
             <span>{{ scope.row.dictType }}</span>
           </router-link>
         </template>
       </el-table-column>
       <el-table-column label="状态" align="center" prop="status">
         <template slot-scope="scope">
-          <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
+          <dict-tag
+            :options="dict.type.sys_normal_disable"
+            :value="scope.row.status"
+          />
         </template>
       </el-table-column>
-      <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
-      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
+      <el-table-column
+        label="备注"
+        align="center"
+        prop="remark"
+        :show-overflow-tooltip="true"
+      />
+      <el-table-column
+        label="创建时间"
+        align="center"
+        prop="createTime"
+        width="180"
+      >
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createTime) }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -141,20 +198,22 @@
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['system:dict:edit']"
-          >修改</el-button>
+            >修改</el-button
+          >
           <el-button
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['system:dict:remove']"
-          >删除</el-button>
+            >删除</el-button
+          >
         </template>
       </el-table-column>
     </el-table>
 
     <pagination
-      v-show="total>0"
+      v-show="total > 0"
       :total="total"
       :page.sync="queryParams.pageNum"
       :limit.sync="queryParams.pageSize"
@@ -176,11 +235,16 @@
               v-for="dict in dict.type.sys_normal_disable"
               :key="dict.value"
               :label="dict.value"
-            >{{dict.label}}</el-radio>
+              >{{ dict.label }}</el-radio
+            >
           </el-radio-group>
         </el-form-item>
         <el-form-item label="备注" prop="remark">
-          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
+          <el-input
+            v-model="form.remark"
+            type="textarea"
+            placeholder="请输入内容"
+          ></el-input>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -192,11 +256,18 @@
 </template>
 
 <script>
-import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
+import {
+addType,
+delType,
+getType,
+listType,
+refreshCache,
+updateType,
+} from "@/api/system/dict/type";
 
 export default {
-  name: "Dict",
-  dicts: ['sys_normal_disable'],
+  name: "SystemDict",
+  dicts: ["sys_normal_disable"],
   data() {
     return {
       // 遮罩层
@@ -225,19 +296,19 @@ export default {
         pageSize: 10,
         dictName: undefined,
         dictType: undefined,
-        status: undefined
+        status: undefined,
       },
       // 表单参数
       form: {},
       // 表单校验
       rules: {
         dictName: [
-          { required: true, message: "字典名称不能为空", trigger: "blur" }
+          { required: true, message: "字典名称不能为空", trigger: "blur" },
         ],
         dictType: [
-          { required: true, message: "字典类型不能为空", trigger: "blur" }
-        ]
-      }
+          { required: true, message: "字典类型不能为空", trigger: "blur" },
+        ],
+      },
     };
   },
   created() {
@@ -247,7 +318,8 @@ export default {
     /** 查询字典类型列表 */
     getList() {
       this.loading = true;
-      listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+      listType(this.addDateRange(this.queryParams, this.dateRange)).then(
+        (response) => {
           this.typeList = response.rows;
           this.total = response.total;
           this.loading = false;
@@ -266,7 +338,7 @@ export default {
         dictName: undefined,
         dictType: undefined,
         status: "0",
-        remark: undefined
+        remark: undefined,
       };
       this.resetForm("form");
     },
@@ -289,32 +361,32 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.dictId)
-      this.single = selection.length!=1
-      this.multiple = !selection.length
+      this.ids = selection.map((item) => item.dictId);
+      this.single = selection.length != 1;
+      this.multiple = !selection.length;
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
-      const dictId = row.dictId || this.ids
-      getType(dictId).then(response => {
+      const dictId = row.dictId || this.ids;
+      getType(dictId).then((response) => {
         this.form = response.data;
         this.open = true;
         this.title = "修改字典类型";
       });
     },
     /** 提交按钮 */
-    submitForm: function() {
-      this.$refs["form"].validate(valid => {
+    submitForm: function () {
+      this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.form.dictId != undefined) {
-            updateType(this.form).then(response => {
+            updateType(this.form).then((response) => {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
             });
           } else {
-            addType(this.form).then(response => {
+            addType(this.form).then((response) => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
@@ -326,25 +398,33 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const dictIds = row.dictId || this.ids;
-      this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
-        return delType(dictIds);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
+      this.$modal
+        .confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?')
+        .then(function () {
+          return delType(dictIds);
+        })
+        .then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
     },
     /** 导出按钮操作 */
     handleExport() {
-      this.download('system/dict/type/export', {
-        ...this.queryParams
-      }, `type_${new Date().getTime()}.xlsx`)
+      this.download(
+        "system/dict/type/export",
+        {
+          ...this.queryParams,
+        },
+        `type_${new Date().getTime()}.xlsx`
+      );
     },
     /** 刷新缓存按钮操作 */
     handleRefreshCache() {
       refreshCache().then(() => {
         this.$modal.msgSuccess("刷新成功");
       });
-    }
-  }
+    },
+  },
 };
 </script>