123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <template>
- <HcCard>
- <template #header>
- <div class=" ml-2">
- <el-input v-model="searchForm.queryValue" clearable placeholder="请输入项目名称进行查询" size="large"/>
- </div>
- <div class="ml-4">
- <el-button type="primary" @click="searchClick" size="large">
- <HcIcon name="search-2"/>
- <span>搜索</span>
- </el-button>
- </div>
- <div class="ml-2">
- <el-button size="large" @click="resetClick">
- <HcIcon name="close-circle"/>
- <span>重置</span>
- </el-button>
- </div>
- </template>
- <template #extra>
- <el-button size="large" type="primary" hc-btn @click="addRowClick">
- <HcIcon name="add"/>
- <span>新增项目成本测算</span>
- </el-button>
- </template>
- <HcTable :column="tableColumn" :datas="tableData" :loading="tableLoading">
- <template #projectName="{row}">
- <span class="text-blue text-hover" @click="rowNameTap(row)">{{row.projectName}}</span>
- </template>
- <template #action="{row,index}">
- <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>
- </HcTable>
- <template #action>
- <HcPages :pages="searchForm" @change="pageChange"/>
- </template>
- </HcCard>
- </template>
- <script setup>
- import {ref,onMounted,onActivated} 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()
- onActivated(()=>{
- getTableData()
-
- })
- //项目类型
- const projectType = ref([])
- const serverType=ref([])
- //年度数据
- const annuals = ref([
- {name: '2023年5月', key: '2023-05'},
- {name: '2022年4月', key: '2022-04'},
- {name: '2021年3月', key: '2021-03'}
- ])
- //搜索表单
- const searchForm = ref({
- projectType: null, user: null, project: null,
- current: 1, size: 20, total: 0
- })
- //搜索
- const searchClick = () => {
- searchForm.value.current = 1;
- getTableData()
- }
- //重置搜索表单
- const resetClick = () => {
- searchForm.value = {current: 1, size: 20, total: 0}
- }
- //分页被点击
- const pageChange = ({current, size}) => {
- searchForm.value.current = current
- searchForm.value.size = size
- getTableData()
- }
- //获取数据
- const tableLoading = ref(false)
- const tableColumn = [
- {key: 'projectName', name: '项目名称'},
- {key: 'projectCostTotal', name: '项目测算总金额', width: '120', align: 'center'},
- {key: 'devCostTotal', name: '研发部成本总金额', width: '120', align: 'center'},
- {key: 'businessCostTotal', name: '实施部成本总金额', width: '120', align: 'center'},
- {key: 'maintainCostTotal', name: '维护部成本总金额', width: '120', align: 'center'},
- {key: 'marketCostTotal', name: '市场部成本总金额', width: '120', align: 'center'},
- {key: 'manageCostTotal', name: '管理费成本总金额', width: '120', align: 'center'},
- {key: 'outsourceCostTotal', name: '外包劳务成本总金额', width: '120', align: 'center'},
- {key: 'action', name: '操作', width: '250', align: 'center', fixed: 'right'},
- ]
- const tableData = ref([
- {id: 1, key: '焦作至唐河高速公路方城至唐河段', key1: '810232', key2: '203200', key3: '192000', key4: '120350', key5: '63540', key6: '320000', key7: '12000'},
- {id: 2, key: '焦作至唐河高速公路方城至唐河段', key1: '810232', key2: '203200', key3: '192000', key4: '120350', key5: '63540', key6: '320000', key7: '12000'},
- {id: 3, key: '焦作至唐河高速公路方城至唐河段', key1: '810232', key2: '203200', key3: '192000', key4: '120350', key5: '63540', key6: '320000', key7: '12000'},
- ])
- const getTableData = async() => {
- tableLoading.value = true
- const {error, code, data} = await costApi.getprojectCostBudgetStats(searchForm.value)
- tableLoading.value = false
- if (!error && code === 200) {
- tableData.value = getArrValue(data)
- searchForm.value.total = data['total'] || 0
- } else {
- tableData.value = []
- searchForm.value.total = 0
- }
- }
- //新增报销记录
- const addRowClick = () => {
- router.push({name: 'project-cost-form'})
- }
- //编辑报销记录
- const editRowClick = (row) => {
- router.push({
- name: 'project-cost-form',
- 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({
- name: 'project-cost-data',
- query: {id: row.projectId}
- })
- }
- //提交审批
- 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>
- <style lang="scss" scoped>
- </style>
|