浏览代码

增加成本测算审批

duy 2 年之前
父节点
当前提交
b2dd066775

+ 8 - 0
src/api/modules/project/cost.js

@@ -89,5 +89,13 @@ export default {
             params: form
         }, msg);
     },
+    //成本测算审批提交
+    async submitApprove(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-control/approve/cost/budget/submit',
+            method: 'get',
+            params: form
+        }, msg);
+    },
 }
 

+ 274 - 0
src/views/home/task/components/cost-budget.vue

@@ -0,0 +1,274 @@
+<!--  -->
+<template>
+    <div>
+        <HcTable :column="basetableColumn" :datas="basetableData" :isIndex="false" />
+        <HcCard actionUi="text-center">
+            <template #extra>
+                <HcNewSwitch :datas="tabTab" :keys="tabKey" @change="tabChange" :round="false" />
+            </template>
+            <HcTable :isIndex="false" :column="tableColumn" :datas="tableData">
+                <template #deptId="{ row, index }">
+                    <el-select v-model="row.deptId" block placeholder="请选择">
+                        <el-option v-for="item in departMent" :label="item.deptName" :value="item.id" />
+                    </el-select>
+                </template>
+                <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 #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 #budgetType="{ row, index }">
+                    <el-select v-model="row.budgetType">
+                        <el-option v-for="item in budgetTypeList" :label="item.dictName" :value="item.dictValue" />
+                    </el-select>
+                </template>
+                <template #taskDetail="{ row, index }">
+                    <el-select v-model="row.taskDetail" :getdata="budgetTypeChange(row?.budgetType, index)">
+                        <el-option v-for="item in taskDetailList[index]" :label="item.dictName" :value="item.dictValue" />
+                    </el-select>
+                </template>
+                <template #budgetDays="{ row, index }">
+                    <el-input v-model="row.budgetDays" />
+                </template>
+                <template #postType="{ row, index }">
+                    <el-select v-model="row.postType">
+                        <el-option v-for="item in postTypeList" :label="item.dictName" :value="item.code" />
+                    </el-select>
+                </template>
+
+                <template #staffCount="{ row, index }">
+                    <el-input v-model="row.staffCount" />
+                </template>
+                <template #budgetStaffCost="{ row, index }">
+                    <el-input v-model="row.budgetStaffCost" disabled />
+                </template>
+                <template #budgetTravelExpense="{ row, index }">
+                    <el-input v-model="row.budgetTravelExpense" />
+                </template>
+                <template #outsourceUnitPrice="{ row, index }">
+                    <el-input v-model="row.outsourceUnitPrice" />
+                </template>
+                <template #outsourcePeopleCount="{ row, index }">
+                    <el-input v-model="row.outsourcePeopleCount" />
+                </template>
+                <template #outsourceCountMoney="{ row, index }">
+                    <el-input v-model="row.outsourceCountMoney" disabled />
+                </template>
+                <template #otherBudgetMoney="{ row, index }">
+                    <el-input v-model="row.otherBudgetMoney" />
+                </template>
+                <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>
+       
+            </HcTable>
+        </HcCard>
+    </div>
+</template>
+
+<script setup>
+import { ref, watch, onActivated } from 'vue'
+import { getProjectList,getdepartmentList } from "~api/other";
+import { getArrValue } from "js-fast-way";
+import costApi from '~api/project/cost.js';
+
+onActivated(() => {
+    getProjectData()
+    getdepartmentListData()
+    getCostTypeDict()
+    getProcessList(otherInfo.value.projectId)
+    getBudgetTypeList()
+    getPostDict()
+})
+//参数
+const props = defineProps({
+    otherInfo: {
+        type: Object,
+        default: {}
+    }
+})
+const otherInfo = ref(props.otherInfo)
+//监听
+watch(() => [
+    props.otherInfo,
+], ([otherInfo]) => {
+    console.log(otherInfo, 'otherInfo');
+    constructUnitData.value=otherInfo?.constructUnit||[]
+    bulidUnitData.value=otherInfo?.buildUnit||[]
+    supervisorUnitData.value=otherInfo?.supervisorUnit||[]
+    tabKey.value='construction'
+    tableData.value=constructUnitData.value
+
+})
+const basetableColumn = [
+    { key: 'projectName', name: '项目名称' },
+    { key: 'projectCostTotal', name: '成本测算总额' },
+    { key: 'devCostTotal', name: '研发部成本总额' },
+    { key: 'businessCostTotal', name: '业务部成本总金额:' },
+    { key: 'marketCostTotal', name: '市场部成本总金额:' },
+    { key: 'maintainCostTotal', name: '维护部成本总金额:' },
+    { key: 'outsourceCostTotal', name: '外包劳务成本总金额:' },
+    { key: 'manageCostTotal', name: '管理费成本总金额:' },
+
+]
+const basetableData = ref([
+    {
+        projectName: otherInfo.value?.projectName,
+        projectName: otherInfo.value?.projectCostTotal,
+        devCostTotal: otherInfo.value?.devCostTotal,
+        businessCostTotal: otherInfo.value?.businessCostTotal,
+        marketCostTotal: otherInfo.value?.marketCostTotal,
+        maintainCostTotal: otherInfo.value?.maintainCostTotal,
+        outsourceCostTotal: otherInfo.value?.outsourceCostTotal,
+        manageCostTotal: otherInfo.value?.manageCostTotal,
+    }
+])
+//项目类型
+const projectType = ref([])
+const getProjectData = async () => {
+    const { error, code, data } = await getProjectList()
+    //判断状态
+    if (!error && code === 200) {
+        projectType.value = getArrValue(data)
+    } else {
+        projectType.value = []
+    }
+}
+//类型tab数据和相关处理
+const tabKey = ref('construction')
+const tabTab = ref([
+    { key: 'bulid', name: '施工单位成本' },
+    { key: 'supervision', name: '监理单位成本' },
+    { key: 'construction', name: '建设单位成本' }
+]);
+//测算表格数据
+const constructUnitData=ref([])
+const bulidUnitData=ref([])
+const supervisorUnitData=ref([])
+
+const tabChange = ({ key }) => {
+    tabKey.value = key
+    if(key=='supervision'){
+        tableData.value=supervisorUnitData.value
+    }else if(key=='construction'){
+        tableData.value=constructUnitData.value
+    }else if(key=='bulid'){
+        tableData.value=bulidUnitData.value
+
+    }
+
+}
+//成本测算表格
+const tableColumn = [
+    {key: 'deptId', name: '费用分摊部门', width: '160', align: 'center'},
+    {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'},
+  
+]
+const tableData = ref([])//成本测算表格
+//费用分摊部门
+const departMent = ref([])
+const getdepartmentListData = async () => {
+    const {error, code, data} = await getdepartmentList({deptType:2})
+    //判断状态
+    if (!error && code === 200) {
+        departMent.value = getArrValue(data)
+    } else {
+        departMent.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,index)=>{
+    let id=''
+    budgetTypeList.value.forEach((ele)=>{
+        if(ele.dictValue===val){
+            id=ele.id
+        }
+    })
+    if(id.length>0){
+        const {error, code, data} = await costApi.getChlidList({parentId:id,type:1})
+        if (!error && code === 200) {
+            taskDetailList.value[index]=getArrValue(data)
+
+        } else {
+            taskDetailList.value[index]={}
+        }
+    }
+   
+}
+//获取岗位分类postTypeList
+const postTypeList=ref([])
+const getPostDict=async(type)=>{
+    const {error, code, data} = await costApi.getPostDict()
+    if (!error && code === 200) {
+        postTypeList.value=getArrValue(data)
+        postTypeList.value.forEach((ele)=>{
+            ele.code=parseInt(ele.code)
+        })
+
+
+    } else {
+        postTypeList.value={}
+    }
+}
+</script>
+<style lang='scss' scoped></style>

+ 9 - 2
src/views/home/task/task-details.vue

@@ -89,10 +89,15 @@
             <div class="hc-info-list" v-if="dataType==='发票审批'">
                 <invoiceRequest :other-info="otherInfo"/>
             </div>
-              <!-- 开票申请 -->
-              <div class="hc-info-list" v-if="dataType==='外包支付'">
+              <!-- 外包支付 -->
+            <div class="hc-info-list" v-if="dataType==='外包支付'">
                 <outsourcing :other-info="otherInfo"/>
             </div>
+            <!-- 成本测算 -->
+            <div class="hc-info-list" v-if="dataType==='成本测算'">
+                <costBudget :other-info="otherInfo"/>
+            </div>
+           
         </HcCardItem>
   
         <HcCardItem title="操作任务" class="mt-4" v-if="dataType !== '1' && authType">
@@ -131,6 +136,7 @@
                     <el-option label="支付申请" value="支付审批"/>
                     <el-option label="用车审批" value="用车审批"/>
                     <el-option label="发票审批" value="发票审批"/>
+                    <el-option label="成本测算" value="成本测算"/>
                 </el-select>
             </div> -->
             <!-- <el-button hc-btn @click="authTypeClick">模拟财务审核</el-button> -->
@@ -159,6 +165,7 @@ import purchaseRequest from './components/purch-request.vue'//采购
 import vehicleRequest from './components/vehicle-request.vue' 
 import invoiceRequest from './components/invoice-request.vue' 
 import outsourcing from './components/outsourcing.vue'
+import costBudget from './components/cost-budget.vue'
 import {useAppStore} from "~src/store";
 import { getdepartmentList} from "~api/other";
 const useAppState = useAppStore();

+ 9 - 3
src/views/project/cost/index.vue

@@ -29,7 +29,7 @@
                 <span class="text-blue" @click="rowNameTap(row)">{{row.projectName}}</span>
             </template>
             <template #action="{row,index}">
-                <el-button plain size="small" type="success" @click="approvalRowClick(row)" v-if="row?.approveStatus==='1'">提交审批</el-button>
+                <el-button plain size="small" type="success" @click="approvalRowClick(row)" :disabled="row?.approveStatus!=='1'">提交审批</el-button>
                 <el-button plain size="small" type="primary" @click="editRowClick(row)">编辑</el-button>
                 <el-button plain size="small" type="danger" @click="delRowClick(row)">删除</el-button>
             </template>
@@ -159,8 +159,14 @@ const rowNameTap = (row) => {
 }
 
 //提交审批
-const approvalRowClick = (row) => {
-
+const approvalRowClick = async(row) => {
+    const {error, code, data,msg} = await costApi.submitApprove({id:row.id})  
+    if (!error && code === 200) {
+        window.$message.success(msg)
+        getTableData()
+    } else {
+        getTableData()
+    }
 }
 </script>