Browse Source

社区权限切换刷新问题

chenlei 2 months ago
parent
commit
72f661d7e1

+ 10 - 4
src/views/business_manage/addBusiness.vue

@@ -169,7 +169,7 @@
   </div>
 </template>
 <script setup>
-import { ref, reactive, onMounted, useTemplateRef } from 'vue';
+import { ref, reactive, onMounted, useTemplateRef, nextTick } from 'vue';
 import Steps from "./components/Steps.vue";
 import SetPermission from "./components/SetPermission.vue";
 import EditBox from "./components/EditBox.vue";
@@ -198,6 +198,7 @@ const PermissionList = ref([]);
 const allCheckedList = ref([]);
 const handleEtaBusinessId = ref(0);
 const isPermissionSearch = ref(false);
+const permissionCheckeds = ref([])
 
 // 编辑商家
 const renewalDiaTitle = ref('添加续约');
@@ -529,16 +530,21 @@ const getSale = async () => {
 };
 
 const changeActiveStep = (index) => {
+  if (index !== 2 && permissionRef.value) {
+    permissionCheckeds.value = permissionRef.value && permissionRef.value.actuallyAllChecked
+  }
   currentStep.value = index + 1
+  nextTick(() => {
+    if (index === 2 && permissionRef.value && permissionCheckeds.value.length !== 0 ) {
+      permissionRef.value.actuallyAllChecked = permissionCheckeds.value || []
+    }
+  })
 }
 
 // 编辑
 const editEtaBusiness = async () => {
   const {fundsize, province, city, decisionMaker,industry,nation,teamSize} = firstFormData;
   const {signDate,expirationDate} = secondFormData;
-  console.log('editEtaBusiness', firstFormData);
-  console.log('editEtaBusiness', tradeArr.value);
-  console.log('editEtaBusiness', industry);
   
   const IndustryName = tradeArr.value.find(item => item.IndustryId === industry)?.IndustryName || '';
   const query = {

+ 1 - 1
src/views/business_manage/components/SetPermission.vue

@@ -121,7 +121,7 @@ watch(
     console.log('newValue', newValue);
     treeList.value = newValue.length !== 0 ? filterNodes(newValue) : [];
     
-    if (!props.isSearch) {                           // 如果不是搜索,则直接把后端返回的赋值为选中项
+    if (!props.isSearch && newValue.length > 0) {                           // 如果不是搜索,则直接把后端返回的赋值为选中项
       allChecked.value = props.allCheckedList;
       actuallyAllChecked.value = props.allCheckedList;
     } else {                                         // 如果是搜索,则把本地选中项赋值为实际上选中的值