ZaiZai 2 yıl önce
ebeveyn
işleme
ea882778da
1 değiştirilmiş dosya ile 36 ekleme ve 45 silme
  1. 36 45
      src/views/program/project/form.vue

+ 36 - 45
src/views/program/project/form.vue

@@ -103,7 +103,7 @@
                 </template>
                 <span v-else>
                     <hc-table-input v-if="row.isEdit" v-model="row.planTarget" clearable />
-                    <span v-else>{{ row.planTarget }}</span>  
+                    <span v-else>{{ row.planTarget }}</span>
                 </span>
             </template>
             <template #key7="{ row }">
@@ -125,7 +125,7 @@
                         <span>{{ row.planStartTime ? row.planStartTime : '' }}</span>
                         <span v-if="row.planEndTime">~</span>
                         <span>{{ row.planEndTime ? row.planEndTime : '' }}</span>
-                    </span>  
+                    </span>
                 </span>
             </template>
             <!-- <template #planDays="{row,index}">
@@ -143,7 +143,7 @@
                 </template>
                 <span v-else>
                     <hc-table-input v-if="row.isEdit" v-model="row.planDays" disabled clearable />
-                    <span v-else>{{ row.planDays }}</span>   
+                    <span v-else>{{ row.planDays }}</span>
                 </span>
             </template>
             <template #postTypeValue="{ row }">
@@ -246,7 +246,7 @@
                 </template>
                 <span v-else>{{ row.budgetRemark }}</span>
             </template>
-            
+
             <template #action="{ row }">
                 <el-button v-if="row.isEdit" size="small" type="success" @click="updateMainPlanClick(row)">
                     保存
@@ -364,10 +364,10 @@ onActivated(() => {
     gettaskTypeList()
     if (dataType.value !== 'add') {
         getPlanByProjectId()
-    
+
     }
 
- 
+
 })
 
 const detailData = ref({})
@@ -379,16 +379,14 @@ const getPlanByProjectId = async ()=>{
     const { error, code, data } = await projectApi.getPlanByProjectId({ id: dataId.value })
     if (!error && code === 200) {
         console.log(getObjValue(data), '详情')
+        const { constructUnit, buildUnit, supervisorUnit } = getObjValue(data)
         detailData.value = getObjValue(data)
-        constructionData.value = detailData.value?.constructUnit || []
-        buildData.value = detailData.value?.buildUnit || []
-        supervisorUnitData.value = detailData.value?.supervisorUnit || []
+        constructionData.value = getArrValue(constructUnit)
+        buildData.value = getArrValue(buildUnit)
+        supervisorUnitData.value = getArrValue(supervisorUnit)
         tabKey.value = 'construction'
         radioType.value = 1
-     
         // milestoneData.value=getArrValue(data)
-       
-
     } else {
         // milestoneData.value=[]
     }
@@ -436,30 +434,30 @@ const tabChange = ({ key }) => {
     } else if (key === 'construction') {
         tableData.value = constructionData.value[radioType.value]?.length > 0 ? constructionData.value : originTableData.value
         detailData.value.constructUnit = tableData.value
-      
-      
+
+
     } else if (key === 'bulid') {
         tableData.value = buildData.value[radioType.value]?.length > 0 ? buildData.value : originTableData.value
         detailData.value.buildUnit = tableData.value
-       
+
     }
 }
 
 const radioType = ref('')
 //深度监听
 watch(() => [
-radioType.value,
-tabKey.value,
+    radioType.value,
+    tabKey.value,
 ], ([radioType]) => {
     if (tabKey.value === 'construction') {
         console.log(constructionData.value[radioType], 'constructionData.value')
-        tableData.value = constructionData.value[radioType]
+        tableData.value = getArrValue(constructionData.value[radioType])
     } else if (tabKey.value === 'build') {
         console.log(buildData.value[radioType], 'buildData.value')
-        tableData.value = buildData.value[radioType]
+        tableData.value = getArrValue(buildData.value[radioType])
     } else if (tabKey.value === 'supervision') {
         console.log(supervisorUnitData.value[radioType], 'supervisorUnitData.value')
-        tableData.value = supervisorUnitData.value[radioType]
+        tableData.value = getArrValue(supervisorUnitData.value[radioType])
     }
 }, { deep: true })
 //表格
@@ -570,8 +568,6 @@ const addplan = ()=>{
         taskDetailValue:subPlanItem.value?.taskDetailValue,
         planTaskTypeValue:subPlanItem.value?.planTaskTypeValue,
         isEdit:false,
-
-
     })
 }
 const changePlanTaskType = (val)=>{
@@ -590,7 +586,7 @@ const relatedModalShow = (row) => {
     relatedModal.value = true
     rePlanid.value = row.id
     getListByProjectId(row.projectId)
-   
+
 }
 //保存获取工作时长
 const getWorkDays = async (row)=>{
@@ -600,7 +596,6 @@ const getWorkDays = async (row)=>{
                 startDate:row.planStartTime,
                 endDate:row.planEndTime,
                 planTaskType:row.planTaskType,
-            
             })
             if (!error && code === 200) {
                     row.planDays = data
@@ -609,9 +604,6 @@ const getWorkDays = async (row)=>{
                 row.planEndTime = ''
             }
         }
-    
-  
- 
 }
 
 //编辑主计划
@@ -622,11 +614,10 @@ const updateMainPlanClick = async (row)=>{
             row.planTaskTypeValue = ele.dictName
         }
     })
-    const { error, code, data, msg } = await projectApi.updateMainPlan( 
+    const { error, code, data } = await projectApi.updateMainPlan(
         row,
     )
     if (!error && code === 200) {
-        
        if (data) {
             row.taskFinishedStatus = data.taskFinishedStatus
             row.outMoneyTips = data.outMoneyTips
@@ -640,7 +631,6 @@ const updateMainPlanClick = async (row)=>{
             row.planEndTime = data.planEndTime
             row.isEdit = false
        }
-       
     }
 
 }
@@ -648,7 +638,7 @@ const updateChildPlanLoading = ref(false)
 //编辑子计划传入父级
 const updateChildPlanClick = async ()=>{
     updateChildPlanLoading.value = true
-    const { error, code, data, msg } = await projectApi.updateChildrenPlan( 
+    const { error, code, data, msg } = await projectApi.updateChildrenPlan(
         subPlanItem.value,
     )
     updateChildPlanLoading.value = false
@@ -672,17 +662,15 @@ const updateChildPlanClick = async ()=>{
                 ele.childrenList.forEach((item)=>{
                     item.isEdit = false
                 })
-                
+
             }
         })
         subplanModal.value = false
-    } 
-   
-
+    }
 }
 //关联回款
 const relation = async (row, type)=>{
-    const { error, code, data, msg } = await projectApi.relationPlanAndReturned( {
+    const { error, code, msg } = await projectApi.relationPlanAndReturned( {
         planId:rePlanid.value,
         returnedId:row.id,
         type,
@@ -691,7 +679,7 @@ const relation = async (row, type)=>{
     if (!error && code === 200) {
        window.$message.success(msg)
        getListByProjectId(row.projectId).then()
-    } 
+    }
 }
 //表格
 const tableRelatedColumn = [
@@ -712,10 +700,13 @@ const tableRelatedData = ref([
 //合同里程碑
 
 const getListByProjectId = async (projectId, planId)=>{
-    const { error, code, data } = await contractApi.getListByProjectId({ projectId, planId:rePlanid.value })
+    const { error, code, data } = await contractApi.getListByProjectId({
+        projectId,
+        planId:rePlanid.value,
+    })
     if (!error && code === 200) {
         tableRelatedData.value = getArrValue(data)
-       
+
 
     } else {
         tableRelatedData.value = []
@@ -734,14 +725,14 @@ const updatePlan = async (obj)=>{
     if (!error && code === 200) {
        window.$message.success(msg)
     //    getPlanByProjectId()
-    } 
+    }
 
 }
 const isEmptyObj = (obj)=> {
     let arr = Object.keys(obj)
     return (arr.length == 0)
 
-}    
+}
 //批量保存
 const saveLoaing = ref(false)
 const saveClick = () => {
@@ -749,19 +740,19 @@ const saveClick = () => {
    console.log( detailData.value, ' detailData.value')
        //取消空对象提交
        if (detailData.value?.supervisorUnit?.length > 0) {
-        let suisnullObj = isEmptyObj(detailData.value?.supervisorUnit[0]) 
+        let suisnullObj = isEmptyObj(detailData.value?.supervisorUnit[0])
         if (suisnullObj === true) {
             detailData.value.supervisorUnit = null
         }
-    } 
+    }
     if (detailData.value?.constructUnit?.length > 0) {
-        let coisnullObj = isEmptyObj(detailData.value?.constructUnit[0]) 
+        let coisnullObj = isEmptyObj(detailData.value?.constructUnit[0])
         if (coisnullObj) {
             detailData.value.constructUnit = null
         }
     }
     if (detailData.value?.buildUnit?.length > 0) {
-        let buisnullObj = isEmptyObj(detailData.value?.buildUnit[0]) 
+        let buisnullObj = isEmptyObj(detailData.value?.buildUnit[0])
         if (buisnullObj) {
             detailData.value.buildUnit = null
         }