Răsfoiți Sursa

协议管理-协议授权打开一次之后打不开问题解决

祁鹏飞 4 săptămâni în urmă
părinte
comite
99df56bc1a

+ 1 - 2
src/views/externalAgreement/agreement/agreementDetails.vue

@@ -212,12 +212,11 @@ const DrawerSave = (list: any) => {
 const agreementAuth = (deptName: any) => {
   let name = typeof deptName === 'string' ? deptName : '';
   api.agreementApi.agreementdeptTree(id.value, name).then((res: any) => {
-    if (res.code == '200') {
+    if (res.code == 200) {
       agreementAuthDrawer.value = true;
       deptauthList.value = res.data;
       checkedKeys.value = getUncheckedIds(res.data);
       checkedIds.value = getUncheckedIds(res.data);
-    } else {
     }
   });
 }

+ 11 - 13
src/views/quoteConfig/agreement/agreementDetails.vue

@@ -32,7 +32,7 @@
                   getDict('is_enable').find(val => val.value == agreementInfo.isEnable)?.label}}</el-tag>
                 <el-tag type="success">{{getDict('valid_status').find(val => val.value ==
                   agreementInfo.validStatus)?.label
-                  }}</el-tag>
+                }}</el-tag>
               </div>
             </div>
             <el-descriptions :column="3" style="margin-top: 10px;">
@@ -50,9 +50,9 @@
           </div>
           <el-descriptions title="基本信息" class="m-top-20" :column="3">
             <el-descriptions-item label="协议名称:">{{ agreementInfo.agreementTitle
-              }}</el-descriptions-item>
+            }}</el-descriptions-item>
             <el-descriptions-item label="协议简称:">{{ agreementInfo.agreementAbbreviation
-              }}</el-descriptions-item>
+            }}</el-descriptions-item>
             <el-descriptions-item label="协议生效时间:">{{ agreementInfo.startDate }}</el-descriptions-item>
             <el-descriptions-item label="协议失效时间:">{{ agreementInfo.endDate }}</el-descriptions-item>
             <el-descriptions-item label="是否含增值税结算:">
@@ -116,7 +116,7 @@
                   <div class="flex a-c">
                     <img src="../../../assets/images/fee.png" alt="">
                     <span style="margin-right: 30px;font-size: 16px;" class="strong m-left-10">承保规则一{{ index + 1
-                    }}</span>
+                      }}</span>
                   </div>
                   <div class="flex">
                     <el-button link type="primary" :icon="CopyDocument" @click="handleCopy(item, {})">复制费用</el-button>
@@ -256,9 +256,8 @@
       </template>
     </el-drawer>
     <!-- 协议授权弹窗 -->
-    <auth-Drawer :Drawer="agreementAuthDrawer" @cancel="agreementAuthDrawer = false" @save="DrawerSave"
-      @query="Drawerquery" @echoValue="echoValue" :deptlist="deptauthList" :checkedKeys="checkedKeys"
-      :checkedIds="checkedIds"></auth-Drawer>
+    <auth-Drawer ref="authDrawerRef" @save="DrawerSave" @query="Drawerquery" @echoValue="echoValue"
+      :deptlist="deptauthList" :checkedKeys="checkedKeys" :checkedIds="checkedIds"></auth-Drawer>
     <!-- 规则条件弹窗 -->
     <RuleCondition ref="RuleConditionRefs" :ruleConditionVisible="ruleConditionVisible"
       @cancel="ruleConditionVisible = false" @save="ruleConditionSave" :attrIdList="attrIdList" />
@@ -432,7 +431,7 @@ const agreementEdit = () => {
 //协议授权
 //检索事件
 const imageUrl = ref('');//协议文件
-const agreementAuthDrawer = ref(false)//授权弹窗
+const authDrawerRef = ref(null)//授权弹窗
 const deptauthList = ref([]);//授权机构列表
 const checkedKeys = ref<string[]>([])//授权机构回显数据
 const checkedIds = ref<string[]>([])//授权机构回显id
@@ -452,21 +451,20 @@ const DrawerSave = (list: any) => {
         message: res.msg,
         plain: true,
       })
-      agreementAuthDrawer.value = false;
     } else {
     }
   });
 }
 //协议授权机构获取
 const agreementAuth = (deptName: any) => {
+  console.log("🚀 ~ agreementAuth ~ deptName:", deptName)
   let name = typeof deptName === 'string' ? deptName : '';
   api.agreementApi.agreementdeptTree(id.value, name).then((res: any) => {
-    if (res.code == '200') {
-      agreementAuthDrawer.value = true;
+    if (res.code == 200) {
+      authDrawerRef.value.DrawerOpen()
       deptauthList.value = res.data;
       checkedKeys.value = getUncheckedIds(res.data);
       checkedIds.value = getUncheckedIds(res.data);
-    } else {
     }
   });
 }
@@ -1517,7 +1515,7 @@ const submitUpdate1 = () => {
     height: 18px;
     margin-right: 20px;
     content: "";
-    margin-top: 6px;
+    margin-top: 2px;
     background-color: #0083ff;
   }
 }

+ 17 - 13
src/views/quoteConfig/agreement/components/agreementAuth.vue

@@ -1,7 +1,7 @@
 <!-- 模板区域 -->
 <template>
   <div>
-    <el-drawer v-model="props.Drawer" :direction="direction" @open="DrawerOpen" >
+    <el-drawer v-model="drawer" :direction="direction">
       <template #header>
         <h4>参与机构</h4>
       </template>
@@ -31,15 +31,14 @@
 <!-- 行为区域 -->
 <script lang="ts" setup>
 import { defineProps, defineEmits } from "vue";
-import { DrawerProps,ElTree } from 'element-plus';
+import { DrawerProps, ElTree } from 'element-plus';
 import { Search } from '@element-plus/icons-vue'
 const props = defineProps<{
-  Drawer: boolean,
   deptlist: string[]
   checkedKeys: string[]
   checkedIds: string[]
 }>();
-const emits = defineEmits(["cancel", 'save', 'DrawerOpen', 'query','echoValue']);
+const emits = defineEmits(["cancel", 'save', 'query', 'echoValue']);
 const defaultProps = {
   children: 'children',
   label: 'name',
@@ -49,22 +48,22 @@ const deptName = ref('');
 const treeRef = ref<InstanceType<typeof ElTree>>();
 const checkedALL = ref(false)
 const ids = ref()//id集合
-const DrawerOpen = () => {
 
+const drawer = ref(false)
+const DrawerOpen = () => {
+  drawer.value = true
+  ids.value = props.checkedIds;
 }
 watch(props, () => {
-  if (props.Drawer) {
-    ids.value = props.checkedIds;
-  }
-  if(props.checkedKeys){
-    ids.value=props.checkedKeys;
+  if (props.checkedKeys) {
+    ids.value = props.checkedKeys;
   }
 })
 const cancel = () => {
   emits('cancel')
 }
 const save = () => {
-    emits('save', ids.value)
+  emits('save', ids.value)
 }
 const query = () => {
   emits('query', deptName.value)
@@ -86,11 +85,11 @@ const TreeselectAll = (value: string | number | boolean) => {
   ids.value = [];//全选操作是清空历史数据
   const allKeys = getAllKeys(props.deptlist, 'id');//递归id集合
   if (value) {
-    emits('echoValue',allKeys)
+    emits('echoValue', allKeys)
   } else {
     treeRef.value?.setCheckedKeys([]);
     ids.value = [];
-    emits('echoValue',[])
+    emits('echoValue', [])
 
   }
 }
@@ -105,4 +104,9 @@ const getAllKeys = (data: any[], type: string) => {
   });
   return keys;
 }
+
+// 使用 defineExpose 暴露方法
+defineExpose({
+  DrawerOpen,
+});
 </script>