Browse Source

切换wbs修改

duy 5 months ago
parent
commit
a5d1c66562
2 changed files with 14 additions and 4 deletions
  1. 8 4
      src/views/project/info/detail.vue
  2. 6 0
      src/views/project/info/template.vue

+ 8 - 4
src/views/project/info/detail.vue

@@ -3,13 +3,13 @@
         <div class="hc-project-info-drawer relative h-full">
             <hc-tab-card :scrollbar="tabsKey === '1'" :tabs="tabsData" :tab-key="tabsKey" is-action-btn :disabled="isDisabled" @change="tabsChange">
                 <HcInfo v-if="tabsKey === '1'" ref="infoRef" v-model="basicForm" />
-                <HcTemplate v-if="tabsKey === '2'" ref="tempRef" v-model="basicForm" />
+                <HcTemplate v-if="tabsKey === '2'" ref="tempRef" v-model="basicForm" @update:loading="handleLoadingUpdate" />
                 <HcLogTemp v-if="tabsKey === '3'" ref="logRef" v-model="basicForm" />
                 <HcUserTemp v-if="tabsKey === '4'" ref="userRef" v-model="basicForm" />
                 <template #action>
-                    <el-button hc-btn class="mr-4" :type="`${tabsKey === '4' ? 'success' : ''}`" :loading="submitLoading" @click="saveAndExit">保存并退出</el-button>
-                    <el-button v-if="tabsKey > '1'" hc-btn :type="`${tabsKey === '4' ? '' : 'success'}`" :loading="submitLoading" @click="saveAndBackStep">保存并返回上一步</el-button>
-                    <el-button v-if="tabsKey < '4'" hc-btn type="primary" :loading="submitLoading" @click="saveAndNextStep">保存并进入下一步</el-button>
+                    <el-button hc-btn class="mr-4" :type="`${tabsKey === '4' ? 'success' : ''}`" :loading="submitLoading" :disabled="submitAble" @click="saveAndExit">保存并退出</el-button>
+                    <el-button v-if="tabsKey > '1'" hc-btn :type="`${tabsKey === '4' ? '' : 'success'}`" :loading="submitLoading" :disabled="submitAble" @click="saveAndBackStep">保存并返回上一步</el-button>
+                    <el-button v-if="tabsKey < '4'" hc-btn type="primary" :loading="submitLoading" :disabled="submitAble" @click="saveAndNextStep">保存并进入下一步</el-button>
                 </template>
             </hc-tab-card>
         </div>
@@ -146,6 +146,10 @@ const userRef = ref(null)
 
 //保存数据
 const submitLoading = ref(false)
+const submitAble = ref(false)
+const handleLoadingUpdate = ({ leftLoading: newLeftLoading, rightLoading: newRightLoading }) => {
+    submitAble.value = newLeftLoading || newRightLoading
+}
 const saveDataApi = async () => {
     //项目基本信息
     if (tabsKey.value === '1') {

+ 6 - 0
src/views/project/info/template.vue

@@ -107,6 +107,8 @@ import { deepClone, getArrValue, getObjValue, isNullES } from 'js-fast-way'
 import mainApi from '~api/project/project'
 import treeApi from '~api/wbs/tree'
 
+
+const emit = defineEmits(['update:loading'])
 //缓存
 const store = useAppStore()
 
@@ -313,6 +315,10 @@ const wbsChange = async (val) => {
 //获取右边数据
 const rightLoading = ref(false)
 const rightTreeData = ref([])
+
+watch([leftLoading, rightLoading], ([newLeftLoading, newRightLoading]) => {
+  emit('update:loading', { leftLoading: newLeftLoading, rightLoading: newRightLoading })
+})
 const getRightTreeApi = async () => {
     rightLoading.value = true
     isDisabled.value = true