瀏覽代碼

Merge remote-tracking branch 'origin/master'

ZaiZai 2 年之前
父節點
當前提交
9369abf640
共有 4 個文件被更改,包括 313 次插入90 次删除
  1. 64 1
      src/api/modules/project/cost.js
  2. 6 6
      src/views/project/cost/data.vue
  3. 228 81
      src/views/project/cost/form.vue
  4. 15 2
      src/views/project/cost/index.vue

+ 64 - 1
src/api/modules/project/cost.js

@@ -25,6 +25,69 @@ export default {
             params: form
         }, msg);
     },
- 
+    //获取未做预算的项目列表
+    async getProjectList(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-control/projectCostBudgetStats/getProjectList',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //获取费用分类
+    async getCostTypeDict(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-control/projectCostBudgetStats/getCostTypeDict',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //获取岗位字典
+    async getPostDict(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-control/projectCostBudgetStats/getPostDict',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //获取项目环节
+    async getProcessList(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-control/projectCostBudgetStats/getProcessList',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //获取预算分类
+    async getSecondSubject(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-control/annualBudget/getSecondSubject',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //获取任务明细
+    async getChlidList(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-control/dictinfo/child-list',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    ///新增或修改成本测算
+    async AddOrUpdate(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-control/projectCostBudgetStats/AddOrUpdate',
+            method: 'post',
+            data: form
+        }, msg);
+    },
+    //删除成本预算
+    async deleteByStatsId(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-control/projectCostBudgetStats/deleteByStatsId',
+            method: 'get',
+            params: form
+        }, msg);
+    },
 }
 

+ 6 - 6
src/views/project/cost/data.vue

@@ -28,14 +28,14 @@
                       style="width: 100%; height: 100%"
                       :loading="tableLoading"
             >
-                <el-table-column prop="costType" label="费用分类" align="center"/>
-                <el-table-column prop="projectProcess" label="项目环节" align="center"/>
-                <el-table-column prop="budgetType" label="预算类型" align="center"/>
-                <el-table-column prop="planTaskDesc" label="任务明细" align="center"/>
+                <el-table-column prop="costTypeVaule" label="费用分类" align="center"/>
+                <el-table-column prop="projectProcessValue" label="项目环节" align="center"/>
+                <el-table-column prop="budgetTypeValue" label="预算类型" align="center"/>
+                <el-table-column prop="taskDetailValue" label="任务明细" align="center"/>
                 <el-table-column prop="budgetDays" label="预计工作量(小数/整数)" align="center"/>
-                <el-table-column prop="postType" label="投入岗位类型(日单价)" align="center">
+                <el-table-column prop="postTypeValue" label="投入岗位类型(日单价)" align="center">
                     <template #default="{ row }">
-                        <div style="background: #00CCFF">{{ row.postType }}</div>
+                        <div style="background: #00CCFF">{{ row.postTypeValue }}</div>
                     </template>
                 </el-table-column>
                 <el-table-column prop="key7" label="投入人员数量" align="center"/>

+ 228 - 81
src/views/project/cost/form.vue

@@ -4,9 +4,9 @@
             <HcCard scrollbar actionUi="text-center">
                 <div class="hc-card-form-center">
                     <el-form ref="formBaseRef" :model="formBaseModel" :rules="formBaseRules" label-width="auto" size="large">
-                        <el-form-item label="项目名称:" prop="keprojectNamey">
-                            <el-select v-model="formBaseModel.projectName" block placeholder="项目名称">
-                                <el-option v-for="item in projectName" :label="item.name" :value="item.key"/>
+                        <el-form-item label="项目名称:" prop="projectId">
+                            <el-select v-model="formBaseModel.projectId" block placeholder="项目名称">
+                                <el-option v-for="item in projectList" :label="item.name" :value="item.id"/>
                             </el-select>
                         </el-form-item>
                         <el-form-item label="成本测算总金额:">
@@ -37,7 +37,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="submitForm" :loading="submitLoaing">
                         <HcIcon name="check-double"/>
                         <span>提交保存</span>
                     </el-button>
@@ -45,77 +45,80 @@
             </HcCard>
         </template>
         <template #tab-table>
-            <HcCard actionUi="text-center" :title="formBaseModel.key">
+            <HcCard actionUi="text-center" :title="formBaseModel.projectName">
                 <template #extra>
                     <HcNewSwitch :datas="tabTab" :keys="tabKey" @change="tabChange" :round="false"/>
+                
+          
                 </template>
+              
                 <HcTable :isIndex="false" :column="tableColumn" :datas="tableData">
-                    <template #key1="{row,index}">
-                        <el-select v-model="row.key1">
-                            <el-option label="选项1" value="选项1"/>
-                            <el-option label="选项2" value="选项2"/>
-                        </el-select>
+
+                    <template #costType="{row,index}">  
+                            <el-select  v-model="row.costType" block placeholder="请选择">
+                                <el-option v-for="item in costTypeList" :label="item.dictName" :value="item.dictValue"/>
+                             </el-select>
                     </template>
-                    <template #key2="{row,index}">
-                        <el-select v-model="row.key2">
-                            <el-option label="选项1" value="选项1"/>
-                            <el-option label="选项2" value="选项2"/>
-                        </el-select>
+                    <template #projectProcess="{row,index}">
+                        <el-select  v-model="row.projectProcess" block placeholder="请选择">
+                                <el-option v-for="item in processList" :label="item.name" :value="item.id"/>
+                         </el-select>
                     </template>
-                    <template #key3="{row,index}">
-                        <el-select v-model="row.key3">
-                            <el-option label="选项1" value="选项1"/>
-                            <el-option label="选项2" value="选项2"/>
+                    <template #budgetType="{row,index}">
+                        <el-select v-model="row.budgetType" @change="budgetTypeChange">
+                            <el-option v-for="item in budgetTypeList" :label="item.dictName" :value="item.dictValue"/>
                         </el-select>
                     </template>
-                    <template #key4="{row,index}">
-                        <el-select v-model="row.key4">
-                            <el-option label="选项1" value="选项1"/>
-                            <el-option label="选项2" value="选项2"/>
+                    <template #taskDetail="{row,index}">
+                        <el-select v-model="row.taskDetail">
+                            <el-option v-for="item in taskDetailList" :label="item.dictName" :value="item.dictValue"/>
                         </el-select>
                     </template>
-                    <template #key5="{row,index}">
-                        <el-input v-model="row.key5"/>
+                    <template #budgetDays="{row,index}">
+                        <el-input v-model="row.budgetDays"/>
                     </template>
-                    <template #key6="{row,index}">
-                        <el-select v-model="row.key6">
-                            <el-option label="选项1" value="选项1"/>
-                            <el-option label="选项2" value="选项2"/>
+                    <template #postType="{row,index}">
+                        <el-select v-model="row.postType">
+                            <el-option v-for="item in postTypeList" :label="item.dictName" :value="item.dictValue"/>
                         </el-select>
                     </template>
-                    <template #key7="{row,index}">
-                        <el-input v-model="row.key7"/>
+                    
+                    <template #staffCount="{row,index}">
+                        <el-input v-model="row.staffCount"/>
                     </template>
-                    <template #key8="{row,index}">
-                        <el-input v-model="row.key8" disabled/>
+                    <template #budgetStaffCost="{row,index}">
+                        <el-input v-model="row.budgetStaffCost" disabled/>
                     </template>
-                    <template #key9="{row,index}">
-                        <el-input v-model="row.key9"/>
+                    <template #budgetTravelExpense="{row,index}">
+                        <el-input v-model="row.budgetTravelExpense" />
                     </template>
-                    <template #key10="{row,index}">
-                        <el-input v-model="row.key10"/>
+                    <template #outsourceUnitPrice="{row,index}">
+                        <el-input v-model="row.outsourceUnitPrice"/>
                     </template>
-                    <template #key11="{row,index}">
-                        <el-input v-model="row.key11" disabled/>
+                    <template #outsourcePeopleCount="{row,index}">
+                        <el-input v-model="row.outsourcePeopleCount"/>
                     </template>
-                    <template #key12="{row,index}">
-                        <el-input v-model="row.key12"/>
+                    <template #outsourceCountMoney="{row,index}">
+                        <el-input v-model="row.outsourceCountMoney" disabled />
                     </template>
-                    <template #key13="{row,index}">
-                        <el-input v-model="row.key13"/>
+                    <template #otherBudgetMoney="{row,index}">
+                        <el-input v-model="row.otherBudgetMoney" />
                     </template>
-                    <template #key14="{row,index}">
-                        <el-input v-model="row.key14" disabled/>
+                <template #budgetCountMoney="{row,index}">
+                        <el-input v-model="row.budgetCountMoney"/>
+                    </template> 
+                   <template #budgetRemark="{row,index}">
+                        <el-input v-model="row.budgetRemark" />
                     </template>
                     <template #key15="{row,index}">
                         <el-input v-model="row.key15"/>
-                    </template>
+                    </template> 
                     <template #action="{row,index}">
-                        <el-button size="small" type="primary">
+                        <el-button size="small" type="primary" @click="addRow">
                             <HcIcon name="add"/>
                             <span>新增</span>
                         </el-button>
-                        <el-button size="small" type="danger">
+                        <el-button size="small" type="danger" @click="delRow(index)">
                             <HcIcon name="delete-bin"/>
                             <span>删除</span>
                         </el-button>
@@ -126,7 +129,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="submitForm" :loading="submitLoaing"> 
                         <HcIcon name="check-double"/>
                         <span>提交保存</span>
                     </el-button>
@@ -149,46 +152,150 @@ const dataId = ref(useRoutes?.query?.id ?? '')
 //缓存页面被激活时
 onActivated(() => {
     dataId.value = useRoutes?.query?.id ?? ''
-    console.log(useRoutes.query)
+  //清除数据
+    tableData.value=[{}]
+    constructUnitData.value=[]
+    supervisorUnitData.value=[]
+    bulidUnitData.value=[]
+    tabsKey.value = 'base'
+    tabKey.value='construction'
     if(dataId.value.length>0){
         getBudgetStatsById()
+        getProjectList(2)
     }else{
+        getProjectList(1)
         formBaseModel.value={}
     }
+
+    getCostTypeDict()
+    getBudgetTypeList()
+    getPostDict()
+
+
+  
    
     
 })
+const projectList=ref([])
+//获取项目下拉框
+const getProjectList=async(type)=>{
+    const {error, code, data} = await costApi.getProjectList({type})
+    if (!error && code === 200) {
+        projectList.value=getArrValue(data)
+
+    } else {
+        projectList.value={}
+    }
+}
+//获取费用分类
+const costTypeList=ref([])
+const getCostTypeDict=async(type)=>{
+    const {error, code, data} = await costApi.getCostTypeDict()
+    if (!error && code === 200) {
+        costTypeList.value=getArrValue(data)
+
+    } else {
+        costTypeList.value={}
+    }
+}
+//获取项目环节
+const processList=ref([])
+const getProcessList=async(projectId)=>{
+    const {error, code, data} = await costApi.getProcessList({projectId:projectId})
+    if (!error && code === 200) {
+        processList.value=getArrValue(data)
+
+    } else {
+        processList.value={}
+    }
+}
+
+//获取预算分类getSecondSubject
+const budgetTypeList=ref([])
+const getBudgetTypeList=async()=>{
+    const {error, code, data} = await costApi.getSecondSubject()
+    if (!error && code === 200) {
+        budgetTypeList.value=getArrValue(data)
+
+    } else {
+        budgetTypeList.value={}
+    }
+}
+//任务明细
+const taskDetailList=ref([])
+const budgetTypeChange=async(val)=>{
+    console.log(val,'val');
+    let id=''
+    budgetTypeList.value.forEach((ele)=>{
+        if(ele.dictValue===val){
+            id=ele.id
+        }
+    })
+    const {error, code, data} = await costApi.getChlidList({parentId:id,type:1})
+    if (!error && code === 200) {
+        taskDetailList.value=getArrValue(data)
+
+    } else {
+        taskDetailList.value={}
+    }
+}
+//获取岗位分类postTypeList
+const postTypeList=ref([])
+const getPostDict=async(type)=>{
+    const {error, code, data} = await costApi.getPostDict()
+    if (!error && code === 200) {
+        postTypeList.value=getArrValue(data)
+
+    } else {
+        postTypeList.value={}
+    }
+}
+//测算表格数据
+const constructUnitData=ref([])
+const bulidUnitData=ref([])
+const supervisorUnitData=ref([])
 //获取详情
 const getBudgetStatsById=async()=>{
     const {error, code, data} = await costApi.getBudgetStatsById({id: dataId.value})
     if (!error && code === 200) {
         formBaseModel.value=getObjValue(data)
+        tableData.value= formBaseModel.value.constructUnit.length>0?formBaseModel.value.constructUnit:originTableData.value
+        constructUnitData.value=formBaseModel.value.constructUnit
+        bulidUnitData.value=formBaseModel.value.buildUnit
+        supervisorUnitData.value=formBaseModel.value.supervisorUnit
 
     } else {
         formBaseModel.value={}
     }
 }
 //选项卡
-const tabsKey = ref('table')
+const tabsKey = ref('base')
 const tabsData = ref([
     {icon: 'file-list-3', label: '基础信息', key: 'base'},
     {icon: 'file-list-2', label: '成本测算', key: 'table'},
 ])
 const tabsClick = (key) => {
-    tabsKey.value = key
+   
+    if(!formBaseModel.value.projectId){
+        window.$message.warning('请先在基础信息栏选择项目')
+    }else{
+        if(key==='table'){
+            tabsKey.value = key
+            getProcessList(formBaseModel.value.projectId)
+
+        }
+    }
+ 
+
 }
 
-//项目名称
-const projectName = ref([
-    {name: '陈油路', key: '陈油路'},
-    {name: '奉建路', key: '奉建路'}
-])
+
 
 //任务操作数据
 const formBaseRef = ref(null)
 const formBaseModel = ref({})
 const formBaseRules = {
-    key: {
+    projectId: {
         required: true,
         trigger: 'blur',
         message: "请选择项目名称"
@@ -197,44 +304,84 @@ const formBaseRules = {
 
 //类型tab数据和相关处理
 const tabKey = ref('construction')
+
 const tabTab = ref([
-    {key: 'construction', name: '施工单位成本'},
+    {key: 'bulid', name: '施工单位成本'},
     {key: 'supervision', name: '监理单位成本'},
-    {key: 'build', name: '建设单位成本'}
+    {key: 'construction', name: '建设单位成本'}
 ]);
 const tabChange = ({key}) => {
     tabKey.value = key
+    console.log(key,'key');
+    console.log(tableData.value,'tableData.value');
+    if(key=='supervision'){
+        tableData.value=supervisorUnitData.value.length>0?supervisorUnitData.value:originTableData.value
+        formBaseModel.value.supervisorUnit=tableData.value
+    }else if(key=='construction'){
+        tableData.value=constructUnitData.value.length>0?constructUnitData.value:originTableData.value
+        formBaseModel.value.constructUnit=tableData.value
+        console.log( formBaseModel.value.constructUnit,' formBaseModel.value.constructUnit');
+    }else if(key=='bulid'){
+        console.log(bulidUnitData.value,'=bulidUnitData.value');
+        tableData.value=bulidUnitData.value.length>0?bulidUnitData.value:originTableData.value
+        formBaseModel.value.buildUnit=tableData.value
+    }
+ 
 }
 
 
 //成本测算表格
 const tableColumn = [
-    {key: 'key1', name: '费用分类', width: '160', align: 'center'},
-    {key: 'key2', name: '项目环节', width: '160', align: 'center'},
-    {key: 'key3', name: '预算类型', width: '160', align: 'center'},
-    {key: 'key4', name: '任务明细', width: '160',  align: 'center'},
-    {key: 'key5', name: '预计工作量(小数/整数)', width: '160',  align: 'center'},
-    {key: 'key6', name: '投入岗位类型(日单价)', width: '160', align: 'center'},
-    {key: 'key7', name: '投入人员数量', width: '160', align: 'center'},
-    {key: 'key8', name: '预计人工成本(元)', width: '160', align: 'center'},
-    {key: 'key9', name: '预计差旅费(元)', width: '160', align: 'center'},
-    {key: 'key10', name: '外包单价', width: '160', align: 'center'},
-    {key: 'key11', name: '外包数量', width: '160', align: 'center'},
-    {key: 'key12', name: '外包金额', width: '160', align: 'center'},
-    {key: 'key13', name: '其他预算金额', width: '160', align: 'center'},
-    {key: 'key14', name: '总预算金额', width: '160', align: 'center'},
-    {key: 'key15', name: '测算备注', width: '160', align: 'center'},
-    {key: 'action', name: '操作', width: '160', align: 'center', fixed: 'right'},
+    {key: 'costType', name: '费用分类', width: '160', align: 'center'},
+    {key: 'projectProcess', name: '项目环节', width: '160', align: 'center'},
+    {key: 'budgetType', name: '预算类型', width: '160', align: 'center'},
+    {key: 'taskDetail', name: '任务明细', width: '160',  align: 'center'},
+    {key: 'budgetDays', name: '预计工作量(小数/整数)', width: '160',  align: 'center'},
+    {key: 'postType', name: '投入岗位类型(日单价)', width: '160', align: 'center'},
+    {key: 'staffCount', name: '投入人员数量', width: '160', align: 'center'},
+    {key: 'budgetStaffCost', name: '预计人工成本(元)', width: '160', align: 'center'},
+    {key: 'budgetTravelExpense', name: '预计差旅费(元)', width: '160', align: 'center'},
+    {key: 'outsourceUnitPrice', name: '外包单价', width: '160', align: 'center'},
+    {key: 'outsourcePeopleCount', name: '外包数量', width: '160', align: 'center'},
+    {key: 'outsourceCountMoney', name: '外包金额', width: '160', align: 'center'},
+    {key: 'otherBudgetMoney', name: '其他预算金额', width: '160', align: 'center'},
+    {key: 'budgetCountMoney', name: '总预算金额', width: '160', align: 'center'},
+    {key: 'budgetRemark', name: '测算备注', width: '160', align: 'center'},
+    {key: 'action', name: '操作', width: '200', align: 'center', fixed: 'right'},
 ]
-const tableData = ref([
-    {id: 1}, {id: 2}, {id: 3}, {id: 4},
-])
-
-
+const tableData = ref([{}])
+const originTableData=ref([ {}])
+const addRow=()=>{
+    tableData.value.push({})
+}
+const delRow=(index)=>{
+    tableData.value.splice(index, 1)
+ 
+}
 //取消并返回
 const goBackClick = () => {
     router.back()
 }
+//保存submitForm
+const submitLoaing=ref(false)
+const submitForm=async()=>{
+    console.log(formBaseModel.value,'formBaseModel.value');
+   if(tabKey.value='construction'){
+        formBaseModel.value.constructUnit=tableData.value
+   }
+    const res = await formValidate(formBaseRef.value)
+    if(res){
+        submitLoaing.value=true
+        const {error, code, data,msg} = await costApi.AddOrUpdate( formBaseModel.value)
+        submitLoaing.value=false
+        if (!error && code === 200) {
+        window.$message.success(msg)
+        } 
+    }
+
+}
+
+
 </script>
 
 <style lang="scss" scoped>

+ 15 - 2
src/views/project/cost/index.vue

@@ -31,7 +31,7 @@
             <template #action="{row,index}">
                 <el-button plain size="small" type="success" @click="approvalRowClick(row)">提交审批</el-button>
                 <el-button plain size="small" type="primary" @click="editRowClick(row)">编辑</el-button>
-                <el-button plain size="small" type="danger">删除</el-button>
+                <el-button plain size="small" type="danger" @click="delRowClick(row)">删除</el-button>
             </template>
         </HcTable>
 
@@ -46,6 +46,7 @@ import {ref,onMounted} from "vue";
 import {useRouter} from 'vue-router'
 import costApi from '~api/project/cost.js';
 import {getArrValue} from "js-fast-way"
+import {delMessage} from "~uti/tools";
 
 const router = useRouter()
 onMounted(()=>{
@@ -135,7 +136,19 @@ const editRowClick = (row) => {
         query: {id: row.id}
     })
 }
-
+//删除成本预算deleteByStatsId
+
+const delRowClick = async(row) => {
+    delMessage(async() => {
+        const {error, code, data,msg} = await costApi.deleteByStatsId({id:row.id})  
+            if (!error && code === 200) {
+                window.$message.success(msg)
+                getTableData()
+            } else {
+                getTableData()
+            }
+    })
+}
 //名称被点击
 const rowNameTap = (row) => {
     router.push({