Przeglądaj źródła

销售政策路由更改

lichao 3 lat temu
rodzic
commit
1f8403fbfd

+ 4 - 4
src/router/views/index.js

@@ -185,18 +185,18 @@ export default [{
     },
     //销售政策详情页
     {
-        path: '/salesPolicy_detailsPageEdit',
+        path: '/maintenance/salesPolicy/index',
         component: Layout,
         hidden: true,
         children: [
             {
-                path: '/salesPolicy_detailsPageEdit',
+                path: '/maintenance/salesPolicy/index',
                 name: '销售政策',
                 meta: {
-                    i18n: 'salesPolicy_detailsPageEdit',
+                    i18n: 'maintenance/salesPolicy/index',
                     keepAlive: true,
                 },
-                component: () => import( /* webpackChunkName: "views" */ '@/views/maintenance/salesPolicy/detailsPageEdit')
+                component: () => import( /* webpackChunkName: "views" */ '@/views/maintenance/salesPolicy/index')
             }
         ]
     },

+ 6 - 5
src/views/maintenance/salesPolicy/detailsPageEdit.vue

@@ -647,11 +647,12 @@ export default {
     },
     //返回列表
     backToList() {
-      this.$router.$avueRouter.closeTag();
-      this.$router.push({
-        path: '/maintenance/salesPolicy/index',
-        query: {}
-      });
+      this.$emit("goBack");
+      // this.$router.$avueRouter.closeTag();
+      // this.$router.push({
+      //   path: '/maintenance/salesPolicy/index',
+      //   query: {}
+      // });
     },
     async saveGoodsColumn() {
       // const inSave = await this.saveColumnData(

+ 90 - 60
src/views/maintenance/salesPolicy/index.vue

@@ -1,69 +1,82 @@
 <template>
-  <basic-container>
-    <avue-crud :option="option"
-               :data="dataList"
-               ref="crud"
-               v-model="form"
-               :page.sync="page"
-               :search.sync="search"
-               @row-del="rowDel"
-               @row-update="rowUpdate"
-               :before-open="beforeOpen"
-               :before-close="beforeClose"
-               @row-save="rowSave"
-               @search-change="searchChange"
-               @search-reset="searchReset"
-               @selection-change="selectionChange"
-               @current-change="currentChange"
-               @size-change="sizeChange"
-               @refresh-change="refreshChange"
-               @on-load="onLoad"
-               @tree-load="treeLoad">
-      <template slot-scope="{}" slot="startTimeSearchLabel">
-        <span>有效日期:</span>
-      </template>
-      <template slot="corpsSearch">
-        <select-component
-          v-model="search.corps"
-          :configuration="configuration"
-        ></select-component>
-      </template>
-      <template slot-scope="scope" slot="corps">
-        {{ scope.row.corps }}
-      </template>
-      <template slot-scope="scope" slot="menu">
-        <el-button
+  <div>
+    <basic-container v-if="isShow">
+      <avue-crud :option="option"
+                 :data="dataList"
+                 ref="crud"
+                 v-model="form"
+                 :page.sync="page"
+                 :search.sync="search"
+                 @row-del="rowDel"
+                 @row-update="rowUpdate"
+                 :before-open="beforeOpen"
+                 :before-close="beforeClose"
+                 @row-save="rowSave"
+                 @search-change="searchChange"
+                 @search-reset="searchReset"
+                 @selection-change="selectionChange"
+                 @current-change="currentChange"
+                 @size-change="sizeChange"
+                 @refresh-change="refreshChange"
+                 @on-load="onLoad"
+                 @tree-load="treeLoad">
+        <template slot-scope="{}" slot="startTimeSearchLabel">
+          <span>有效日期:</span>
+        </template>
+        <template slot="corpsSearch">
+          <select-component
+            v-model="search.corps"
+            :configuration="configuration"
+          ></select-component>
+        </template>
+        <template slot-scope="scope" slot="corps">
+          {{ scope.row.corps }}
+        </template>
+        <template slot-scope="scope" slot="menu">
+          <el-button
             type="text"
             icon="el-icon-view"
             size="small"
             @click.stop="beforeOpenPage(scope.row,scope.index)"
-        >查看
-        </el-button>
-        <el-button
+          >查看
+          </el-button>
+          <el-button
             type="text"
             icon="el-icon-edit"
             size="small"
             @click.stop="editOpen(scope.row,scope.index)"
-        >编辑
-        </el-button>
-        <el-button
+          >编辑
+          </el-button>
+          <el-button
             type="text"
             icon="el-icon-delete"
             size="small"
             @click.stop="rowDel(scope.row,scope.index)"
-        >删除
-        </el-button>
-      </template>
-    </avue-crud>
-  </basic-container>
+          >删除
+          </el-button>
+        </template>
+      </avue-crud>
+    </basic-container>
+
+    <detail-page
+      ref="detail"
+      @goBack="goBack"
+      :detailData="detailData"
+      v-else
+    ></detail-page>
+  </div>
 </template>
 
 <script>
 import option from "./configuration/mainList.json";
-import {customerList, typeSave, deleteDetails} from "@/api/maintenance/salesPolicy"
+import {customerList, typeSave, deleteDetails} from "@/api/maintenance/salesPolicy";
+import detailPage from "./detailsPageEdit";
 
 export default {
   name: "customerInformation",
+  components: {
+    detailPage
+  },
   data() {
     return {
       form: {},
@@ -83,7 +96,9 @@ export default {
         pageSize: 10,
         pagerCount: 5,
         total: 0,
-      }
+      },
+      isShow: true,
+      detailData: {},
     }
   },
   created() {
@@ -154,24 +169,35 @@ export default {
     },
     //查看跳转页面
     beforeOpenPage(row, index) {
-      this.$router.push({
-        path: "/salesPolicy_detailsPageEdit",
-        query: {id: JSON.stringify(row.id)},
-      });
+      this.detailData = {
+        id: row.id,
+      };
+      this.isShow = false;
+      // this.$router.push({
+      //   path: "/salesPolicy_detailsPageEdit",
+      //   query: {id: JSON.stringify(row.id)},
+      // });
     },
     //新增跳转页面
     beforeOpen(row, index) {
-      console.log(row)
-      this.$router.push({
-        path: "/salesPolicy_detailsPageEdit",
-        query: {id: JSON.stringify(row.id)},
-      });
+      this.detailData = {
+        id: row.id,
+      };
+      this.isShow = false;
+      // this.$router.push({
+      //   path: "/salesPolicy_detailsPageEdit",
+      //   query: {id: JSON.stringify(row.id)},
+      // });
     },
     editOpen(row, index) {
-      this.$router.push({
-        path: "/salesPolicy_detailsPageEdit",
-        query: {id: JSON.stringify(row.id)},
-      });
+      this.detailData = {
+        id: row.id,
+      };
+      this.isShow = false;
+      // this.$router.push({
+      //   path: "/salesPolicy_detailsPageEdit",
+      //   query: {id: JSON.stringify(row.id)},
+      // });
     },
     //点击新增时触发
     beforeClose(done) {
@@ -229,6 +255,10 @@ export default {
         resolve(res.data.data.records);
       });
     },
+    goBack() {
+      this.detailData=this.$options.data().detailData
+      this.isShow = true;
+    },
   }
 }
 </script>