Browse Source

分解子计划保存

duy 2 năm trước cách đây
mục cha
commit
4140f26713
1 tập tin đã thay đổi với 59 bổ sung23 xóa
  1. 59 23
      src/views/program/project/form.vue

+ 59 - 23
src/views/program/project/form.vue

@@ -236,7 +236,7 @@
             </template>
             
             <template #action="{row,index}">
-                <el-button size="small" type="success" v-if="row.isEdit" @click="getWorkDays(row)">保存</el-button>
+                <el-button size="small" type="success" v-if="row.isEdit" @click="updateMainPlanClick(row)">保存</el-button>
                 <el-button size="small" type="primary" v-else @click="row.isEdit = true" :disabled="row?.isShowEdit===0">编辑</el-button>
                 <el-button size="small" type="warning" @click="relatedModalShow(row)">关联回款</el-button>
                 <el-button size="small" type="danger" @click="subplanModalShow(row)" :disabled="row?.isShowChildren==0">分解子计划</el-button>
@@ -259,37 +259,37 @@
                   saveText="保存"
                   :show="subplanModal"
                   @close="subplanCloseClick"
-                  @save="subplanSaveClick"
+                  @save="updateChildPlanClick"
+            
         >
         <template #extra>
             <el-button size="large" type="primary"  @click="addplan">新增</el-button>
         </template>
             <HcTable :isIndex="false" :column="tableSubplanColumn" :datas="tableSubplanData">
                 <template #planTaskType="{row,index}">
-                    <el-select v-model="row.planTaskType" :disabled="!row.isEdit" clearable>
+                    <el-select v-model="row.planTaskType"  clearable>
                         <el-option v-for="item in taskTypeList" :label="item.dictName" :value="item.id"/>
                     </el-select>
                 </template>
                 <template #planTaskDesc="{row,index}">
-                    <el-input v-model="row.planTaskDesc" :disabled="!row.isEdit" clearable/>
+                    <el-input v-model="row.planTaskDesc" clearable/>
                 </template>
                 <template #planTarget="{row,index}">
-                    <el-input v-model="row.planTarget" :disabled="!row.isEdit" clearable/>
+                    <el-input v-model="row.planTarget"  clearable/>
                 </template>
                 <template #key7="{row,index}">
-                    <HcDatePicker :dates="[row.planStartTime,row.planEndTime]" @change="subbetweenTimeUpdate($event,row)"  :disabled="!row.isEdit" clearable/>
+                    <HcDatePicker :dates="[row.planStartTime,row.planEndTime]" @change="subbetweenTimeUpdate($event,row)"   clearable/>
               
                 </template>
                 <template #planDays="{row,index}" >
-                    <!-- <el-input v-model="row.planDays" disabled/> -->
-                    <el-input v-model="row.planDays" disabled  clearable/>
+                    
+                    <el-input v-model="row.planDays" disabled  clearable  />
+                  
                 </template>
                 <template #key9="{row,index}">
                     <el-input v-model="row.key9" clearable/>
                 </template>
                 <template #action="{row,index}">
-                <el-button size="small" type="success" v-if="row.isEdit" @click="getWorkDays(row)">保存</el-button>
-                <el-button size="small" type="primary" v-else @click="row.isEdit = true" :disabled="row?.isShowEdit===0">编辑</el-button>
                 <el-button size="small" type="primary" @click="delSubplan(row,index)">删除</el-button>
             </template>
             </HcTable>
@@ -558,28 +558,64 @@ const relatedModalShow = (row) => {
 }
 //保存获取工作时长
 const getWorkDays=async(row)=>{
+ 
+        if(row?.planStartTime&&row?.planEndTime){
+            const {error, code, data,msg} = await projectApi.getWorkDays( {
+                startDate:row.planStartTime,
+                endDate:row.planEndTime,
+            
+            })
+            if (!error && code === 200) {
+                if(data){
+                    row.planDays=data
+                }
+            
+            }
+        }
+    
+  
+ 
+}
+//编辑主计划
+const updateMainPlanClick=async(row)=>{
     row.isEdit = false
-    //获取任务类型
     const {planTaskType}=row
     taskTypeList.value.forEach((ele)=>{
         if(ele.id===planTaskType){
             row.planTaskTypeValue=ele.dictName
         }
     })
-    if(row?.planStartTime&&row?.planEndTime){
-        const {error, code, data,msg} = await projectApi.getWorkDays( {
-            startDate:row.planStartTime,
-            endDate:row.planEndTime,
-        
-        })
-        if (!error && code === 200) {
-            if(data){
-                row.planDays=data
-            }
-        
+    console.log(tableData.value,'tableData');
+    const {error, code, data,msg} = await projectApi.updateMainPlan( 
+        row
+    )
+    if (!error && code === 200) {
+        if(data){
+            row=getObjValue(data)
+            console.log(data,'data');
         }
+    
     }
- 
+
+}
+//编辑子计划传入父级
+const updateChildPlanClick=async()=>{
+    subPlanItem.value.childrenList=tableSubplanData.value
+
+    const {error, code, data,msg} = await projectApi.updateMainPlan( 
+        subPlanItem.value,
+    )
+    if (!error && code === 200) {
+
+        window.$message.success(msg)
+        tableData.value.forEach((ele)=>{
+            if(ele.id==subPlanItem.value.id){
+                ele.childrenList=tableSubplanData.value
+            }
+        })
+    }
+    subplanModal.value = false
+
 }
 //关联回款
 const relation=async(row,type)=>{