YY 2 éve
szülő
commit
b268299357

+ 3 - 10
src/views/platSettings/banner/detail.vue

@@ -32,7 +32,7 @@ const { mapActions: dictData } = createNamespacedHelpers('dictData');
 
 export default {
   name: 'form-1',
-  props: {},
+  props: { id: { type: String } },
   components: {
     editor: () => import('@/components/editor.vue'),
   },
@@ -110,17 +110,10 @@ export default {
     },
     // 返回
     toBack() {
-      window.history.go('-1');
-    },
-  },
-  computed: {
-    id() {
-      return this.$route.query.id;
-    },
-    status() {
-      return this.$route.query.status;
+      this.$emit('toBack');
     },
   },
+  computed: {},
   metaInfo() {
     return { title: this.$route.meta.title };
   },

+ 35 - 25
src/views/platSettings/banner/index.vue

@@ -2,28 +2,31 @@
   <div id="index">
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight">
-        <el-col :span="24" class="one"> <span>广告图</span> </el-col>
-        <el-col :span="24" class="two">
-          <search-1 :form="searchForm" :typeList="typeList" @onSubmit="search" @toReset="toClose"></search-1>
-        </el-col>
-        <el-col :span="24" class="thr">
-          <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
-        </el-col>
-        <el-col :span="24" class="four">
-          <data-table
-            :select="true"
-            :selected="selected"
-            @handleSelect="handleSelect"
-            :fields="fields"
-            :opera="opera"
-            @query="search"
-            :data="list"
-            :total="total"
-            @edit="toEdit"
-            @del="toDel"
-          >
-          </data-table>
-        </el-col>
+        <span v-show="view === 'list'">
+          <el-col :span="24" class="one"> <span>广告图</span> </el-col>
+          <el-col :span="24" class="two">
+            <search-1 :form="searchForm" :typeList="typeList" @onSubmit="search" @toReset="toClose"></search-1>
+          </el-col>
+          <el-col :span="24" class="thr">
+            <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
+          </el-col>
+          <el-col :span="24" class="four">
+            <data-table
+              :select="true"
+              :selected="selected"
+              @handleSelect="handleSelect"
+              :fields="fields"
+              :opera="opera"
+              @query="search"
+              :data="list"
+              :total="total"
+              @edit="toEdit"
+              @del="toDel"
+            >
+            </data-table>
+          </el-col>
+        </span>
+        <detail v-if="view === 'info'" :id="id" @toBack="toBack"></detail>
       </el-col>
     </el-row>
   </div>
@@ -39,10 +42,12 @@ export default {
   props: {},
   components: {
     search1: () => import('./parts/search-1.vue'),
+    detail: () => import('./detail.vue'),
   },
   data: function () {
     const that = this;
     return {
+      view: 'list',
       // 列表
       opera: [
         { label: '修改', method: 'edit' },
@@ -80,6 +85,7 @@ export default {
       typeList: [],
       // 是否使用
       statusList: [],
+      id: '',
     };
   },
   async created() {
@@ -90,7 +96,7 @@ export default {
     ...dictData({ dictQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
-    async search({ skip = 0,limit = this.$limit, ...info } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       const condition = _.cloneDeep(this.searchForm);
       let res = await this.query({ skip, limit, ...condition, ...info });
       if (this.$checkRes(res)) {
@@ -100,11 +106,15 @@ export default {
     },
     // 新增
     toAdd() {
-      this.$router.push({ path: '/platSettings/banner/detail' });
+      this.$set(this, `view`, 'info');
     },
     // 修改
     async toEdit({ data }) {
-      this.$router.push({ path: '/platSettings/banner/detail', query: { id: data.id } });
+      this.$set(this, `id`, data.id);
+      this.$set(this, `view`, 'info');
+    },
+    toBack() {
+      this.view = 'list';
     },
     // 删除
     async toDel({ data }) {

+ 3 - 10
src/views/platSettings/indexModule/detail.vue

@@ -28,7 +28,7 @@ const { mapActions } = createNamespacedHelpers('indexModule');
 const { mapActions: dictData } = createNamespacedHelpers('dictData');
 export default {
   name: 'form-1',
-  props: {},
+  props: { id: { type: String } },
   components: {},
   data: function () {
     return {
@@ -96,17 +96,10 @@ export default {
     },
     // 返回
     toBack() {
-      window.history.go('-1');
-    },
-  },
-  computed: {
-    id() {
-      return this.$route.query.id;
-    },
-    status() {
-      return this.$route.query.status;
+      this.$emit('toBack');
     },
   },
+  computed: {},
   metaInfo() {
     return { title: this.$route.meta.title };
   },

+ 35 - 25
src/views/platSettings/indexModule/index.vue

@@ -2,28 +2,31 @@
   <div id="index">
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight">
-        <el-col :span="24" class="one"> <span>首页广告图标设置</span> </el-col>
-        <el-col :span="24" class="two">
-          <search-1 :form="searchForm" :typeList="typeList" @onSubmit="search" @toReset="toClose"></search-1>
-        </el-col>
-        <el-col :span="24" class="thr">
-          <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
-        </el-col>
-        <el-col :span="24" class="four">
-          <data-table
-            :select="true"
-            :selected="selected"
-            @handleSelect="handleSelect"
-            :fields="fields"
-            :opera="opera"
-            @query="search"
-            :data="list"
-            :total="total"
-            @edit="toEdit"
-            @del="toDel"
-          >
-          </data-table>
-        </el-col>
+        <span v-show="view === 'list'">
+          <el-col :span="24" class="one"> <span>首页广告图标设置</span> </el-col>
+          <el-col :span="24" class="two">
+            <search-1 :form="searchForm" :typeList="typeList" @onSubmit="search" @toReset="toClose"></search-1>
+          </el-col>
+          <el-col :span="24" class="thr">
+            <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
+          </el-col>
+          <el-col :span="24" class="four">
+            <data-table
+              :select="true"
+              :selected="selected"
+              @handleSelect="handleSelect"
+              :fields="fields"
+              :opera="opera"
+              @query="search"
+              :data="list"
+              :total="total"
+              @edit="toEdit"
+              @del="toDel"
+            >
+            </data-table>
+          </el-col>
+        </span>
+        <detail v-if="view === 'info'" :id="id" @toBack="toBack"></detail>
       </el-col>
     </el-row>
   </div>
@@ -39,10 +42,12 @@ export default {
   props: {},
   components: {
     search1: () => import('./parts/search-1.vue'),
+    detail: () => import('./detail.vue'),
   },
   data: function () {
     const that = this;
     return {
+      view: 'list',
       // 列表
       opera: [
         { label: '修改', method: 'edit' },
@@ -80,6 +85,7 @@ export default {
       typeList: [],
       // 是否使用
       statusList: [],
+      id: '',
     };
   },
   async created() {
@@ -90,7 +96,7 @@ export default {
     ...dictData({ dictQuery: 'query' }),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
-    async search({ skip = 0,limit = this.$limit, ...info } = {}) {
+    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       const condition = _.cloneDeep(this.searchForm);
       let res = await this.query({ skip, limit, ...condition, ...info });
       if (this.$checkRes(res)) {
@@ -100,11 +106,15 @@ export default {
     },
     // 新增
     toAdd() {
-      this.$router.push({ path: '/platSettings/indexModule/detail' });
+      this.$set(this, `view`, 'info');
     },
     // 修改
     async toEdit({ data }) {
-      this.$router.push({ path: '/platSettings/indexModule/detail', query: { id: data.id } });
+      this.$set(this, `id`, data.id);
+      this.$set(this, `view`, 'info');
+    },
+    toBack() {
+      this.view = 'list';
     },
     // 删除
     async toDel({ data }) {