From a4ad4789a091367fc2d63e0a6250a816335ea501 Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期三, 20 十二月 2023 16:07:43 +0800
Subject: [PATCH] 销售明细单日期选择添加限制,菜单栏数据存储vuex

---
 src/store/index.js                                      |   10 ++++
 src/views/sales/salesDetails/AddSalesDetailsDialog.vue  |   14 ++++++
 src/components/layout/components/appsidebar/index.vue   |   39 ++++++++-----------
 src/views/sales/contractManage/DetailContractManage.vue |    2 
 src/router/index.js                                     |    2 +
 src/views/sales/contractManage/index.vue                |   12 ++----
 6 files changed, 45 insertions(+), 34 deletions(-)

diff --git a/src/components/layout/components/appsidebar/index.vue b/src/components/layout/components/appsidebar/index.vue
index 7be1f15..d3903a9 100644
--- a/src/components/layout/components/appsidebar/index.vue
+++ b/src/components/layout/components/appsidebar/index.vue
@@ -41,7 +41,6 @@
 </template>
 
 <script>
-import {getMenuTreeByRole} from "@/api/menus/index"
 export default {
   name: "AppSidebar",
   props: {},
@@ -62,28 +61,22 @@
   },
   methods: {
     getMenuTreeByRole(){
-      getMenuTreeByRole().then((res)=>{
-        console.log(res.data.list,"crm鑿滃崟")
-        res.data.list.map((item)=>{
-          if(item.systemType===2){
-            let newList= JSON.parse(JSON.stringify([...item.menus]))
-            // 闅愯棌浜� 鐢熸垚璁″垝 鍜� 鏈嶅姟鏀惰垂绠$悊妯″潡
-            if(newList[1]){
-              const found = newList[1].children.find(obj => obj.title === "鐢熸垚璁″垝")
-              if(found){
-                newList[1].children=[...newList[1].children.slice(0, -1)];  
-              }
-            }
-            if(newList[2]){
-              const found1 = newList[2].children.find(obj => obj.title === "鏈嶅姟鏀惰垂绠$悊")
-              if(found1){
-                newList[2].children=[...newList[2].children.slice(0, -1)];  
-              }
-            }
-            this.menus=newList
-          }
-        }) 
-      })
+      let newList=this.$store.state.menus
+      console.log(newList,"newList")
+      // 闅愯棌浜� 鐢熸垚璁″垝 鍜� 鏈嶅姟鏀惰垂绠$悊妯″潡
+      if(newList[1]){
+        const found = newList[1].children.find(obj => obj.title === "鐢熸垚璁″垝")
+        if(found){
+          newList[1].children=[...newList[1].children.slice(0, -1)];  
+        }
+      }
+      if(newList[2]){
+        const found1 = newList[2].children.find(obj => obj.title === "鏈嶅姟鏀惰垂绠$悊")
+        if(found1){
+          newList[2].children=[...newList[2].children.slice(0, -1)];  
+        }
+      }
+      this.menus=newList
     },
     // 鐩戝惉璺敱
     initNavMenu() {
diff --git a/src/router/index.js b/src/router/index.js
index 3115976..61b22ca 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -6,6 +6,7 @@
 import salesRouter from "./sales/index.js"
 import serviceRouter from "./service/index.js"
 import {getMenuTreeByRole} from "@/api/menus/index"
+import store from '@/store/index.js'; 
 // import backgroundConfigRouter from "./backgroundConfig/index.js"
 
 Vue.use(Router)
@@ -120,6 +121,7 @@
     };
     const foundObject = res.data.list.find(obj => obj.systemType === 2);
     if (foundObject) {
+      store.commit('setMenus', foundObject.menus); 
       foundObject.menus.forEach(item => {
         const nextPath = item.children.find(obj => obj.path === routePath);
         if (nextPath) {
diff --git a/src/store/index.js b/src/store/index.js
index 1d8741c..68e35eb 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -4,7 +4,15 @@
 
 Vue.use(Vuex)
 export default new Vuex.Store({
+  state:{
+    menus:[]
+  },
+  mutations: {
+    setMenus(state, payload) {  
+      state.menus = payload;  
+    },
+  },
   modules: {
     getClientName
-  }
+  },
 })
diff --git a/src/views/sales/contractManage/DetailContractManage.vue b/src/views/sales/contractManage/DetailContractManage.vue
index 8f8c860..c9f97a4 100644
--- a/src/views/sales/contractManage/DetailContractManage.vue
+++ b/src/views/sales/contractManage/DetailContractManage.vue
@@ -10,7 +10,7 @@
       <template slot="title">
         <div class="header">
           <span class="header-label">鍚堝悓绠$悊</span>
-          <span class="header-title">{{ detailConfig.infomation.number }}</span>
+          <span class="header-title">{{ detailConfig.infomation.contractName }}</span>
         </div>
       </template>
       <div class="content">
diff --git a/src/views/sales/contractManage/index.vue b/src/views/sales/contractManage/index.vue
index 1866304..75bafd9 100644
--- a/src/views/sales/contractManage/index.vue
+++ b/src/views/sales/contractManage/index.vue
@@ -7,7 +7,7 @@
           :show-download="false"
           :amount-view="false"
           :show-action-btn="false"
-          placeholder="璇疯緭鍏ュ崟鎹紪鍙�"
+          placeholder="璇疯緭鍏ュ悎鍚屽悕绉版垨鍗曟嵁缂栧彿"
           @searchClick="onFilterSearch"
         >
           <template slot="leftButton">
@@ -102,18 +102,14 @@
       },
       selValueList: [],
       search_map: {},
-      searchSel: {
-        value: "number",
-        label: "鍗曟嵁缂栧彿"
-      },
       tableColumn: [
-        { label: "鍗曟嵁缂栧彿", prop: "number", min: 120, isCommonClick: true, default: true },
+        { label: "鍚堝悓鍚嶇О", prop: "contractName", min: 120, isCommonClick: true, default: true },
         { label: "璐熻矗浜�", prop: "member_name", min: 90 },
         { label: "瀹㈡埛鍚嶇О", prop: "client_name" },
         { label: "鍚堝悓鐘舵��", prop: "serviceContractStatus_name", min: 100 },
         { label: "鍒涘缓鏃堕棿", prop: "created_at" }
       ],
-      showCol: ["鍗曟嵁缂栧彿", "璐熻矗浜�", "瀹㈡埛鍚嶇О", "鍚堝悓鐘舵��", "鍒涘缓鏃堕棿"],
+      showCol: ["鍚堝悓鍚嶇О", "璐熻矗浜�", "瀹㈡埛鍚嶇О", "鍚堝悓鐘舵��", "鍒涘缓鏃堕棿"],
       keyword:''
     }
   },
@@ -246,7 +242,7 @@
     },
     // 鍚堝悓绠$悊璇︽儏
     selCommonClick(row) {
-      console.log(row)
+      console.log(row,"鍚堝悓璇︽儏")
       this.contractDetail.visible = true
       this.contractDetail.infomation = { ...row }
     }
diff --git a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
index fe511e5..5499e2f 100644
--- a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
+++ b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
@@ -207,6 +207,7 @@
                     placeholder="閫夋嫨鏃ユ湡"
                     style="width: 100%"
                     :disabled="isView"
+                    :picker-options="pickerOptionsBefore"
                   >
                   </el-date-picker>
                 </el-form-item>
@@ -234,6 +235,7 @@
                     placeholder="閫夋嫨鏃ユ湡"
                     style="width: 100%"
                     :disabled="isView"
+                    :picker-options="pickerOptions"
                   >
                   </el-date-picker>
                 </el-form-item>
@@ -594,7 +596,17 @@
       selProductData: [],
       isView: this.editCommonConfig.title === "鏌ョ湅",
       selectBox: this.editCommonConfig.title !== "鏌ョ湅",
-      thatMember: {}
+      thatMember: {},
+      pickerOptions: {
+        disabledDate(time) {
+          return time.getTime() <  Date.now() - 8.64e7;
+        },
+      },
+      pickerOptionsBefore:{
+        disabledDate(time) {
+          return time.getTime() >  Date.now();
+        },
+      }
     }
   },
   created() {

--
Gitblit v1.8.0