Ver código fonte

部门计划预算批量保存

duy 2 anos atrás
pai
commit
31ef65b477

+ 3 - 10
src/api/modules/program/project.js

@@ -17,18 +17,11 @@ export default {
             params: form
         }, msg);
     },
-    //新增年度经营预算
-    async addAnnualBudget(form, msg = true) {
-        return httpApi({
-            url: '/api/blade-control/annualBudget/addAnnualBudget',
-            method: 'post',
-            data: form
-        }, msg);
-    },
+
     //编辑
-    async updateAnnualBudget(form, msg = true) {
+    async updatePlan(form, msg = true) {
         return httpApi({
-            url: '/api/blade-control/annualBudget/updateAnnualBudget',
+            url: '/api//blade-control/projectCostBudget/updatePlan',
             method: 'post',
             data: form
         }, msg);

+ 34 - 1
src/views/program/project/form.vue

@@ -62,7 +62,7 @@
                 <HcIcon name="arrow-go-back"/>
                 <span>取消并返回</span>
             </el-button>
-            <el-button size="large" type="primary" hc-btn>
+            <el-button size="large" type="primary" hc-btn @click="saveClick" :loading="saveLoaing">
                 <HcIcon name="check-double"/>
                 <span>提交保存</span>
             </el-button>
@@ -177,8 +177,23 @@ const tabTab = ref([
     {key: 'supervision', name: '监理单位成本'},
     {key: 'build', name: '建设单位成本'}
 ]);
+const originTableData=ref([ {}])
+
 const tabChange = ({key}) => {
     tabKey.value = key
+    console.log(tableData.value,'tableData.value');
+    if(key=='supervision'){
+        tableData.value=supervisorUnitData.value.length>0?supervisorUnitData.value:originTableData.value
+        detailData.value.supervisorUnit=tableData.value
+    }else if(key=='construction'){
+        tableData.value=constructionData.value.length>0?constructionData.value:originTableData.value
+        detailData.value.constructUnit=tableData.value
+        console.log( formBaseModel.value.constructUnit,' formBaseModel.value.constructUnit');
+    }else if(key=='bulid'){
+        console.log(buildData.value,'=buildData.value');
+        tableData.value=buildData.value.length>0?buildData.value:originTableData.value
+        detailData.value.buildUnit=tableData.value
+    }
 }
 
 const radioType = ref('')
@@ -331,7 +346,25 @@ const getListByProjectId=async(projectId)=>{
 const relatedCloseClick = () => {
     relatedModal.value = false
 }
+//修改合同
+const updatePlan=async(obj)=>{
+    console.log(obj,'编辑');
+    saveLoaing.value=true;
+    const {error, code, data,msg} = await projectApi.updatePlan( obj)
+    saveLoaing.value=false;
+    if (!error && code === 200) {
+       window.$message.success(msg)
+       getPlanByProjectId()
+    } 
 
+}
+//批量保存
+const saveLoaing=ref(false)
+const saveClick = () => {
+   console.log(tableData.value,'tableData.value');
+   console.log( detailData.value,' detailData.value');
+   updatePlan(detailData.value)
+}
 //取消并返回
 const goBackClick = () => {
     router.back()

+ 10 - 2
src/views/program/section/index.vue

@@ -158,10 +158,18 @@ const rowNameClick = (row) => {
 //新增计划
 const addRowClick = () => {
     monthModal.value = true
+    getDepartmentDict()
 }
 //获取所属部门列表
-const getDepartmentDict=()=>{
-    
+const getDepartmentDict=async()=>{
+    const {error, code, data} = await sectionApi.getDepartmentDict()
+    if (!error && code === 200) {
+        department.value = getArrValue(data)
+
+    } else {
+        department.value = []
+
+    }
 }