<template>
|
<div class="app-container">
|
<!--汇总数据-->
|
<el-row :gutter="20" class="module-row data-row">
|
<el-col :span="12">
|
<div class="grid-content">
|
<el-card v-loading="quantity.loading">
|
<div slot="header" class="card-header-box">
|
<span>合同数</span>
|
<div class="form-box">
|
<el-date-picker v-model="quantity.queryForm.signDate" type="daterange" value-format="yyyy-MM-dd 00:00:00" unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 360px;" class="filter-item" @keyup.enter.native="queryStatisticsQuantity" />
|
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="queryStatisticsQuantity">搜索</el-button>
|
</div>
|
</div>
|
|
<div class="card-content-box">
|
<el-table :data="quantity.preprocessData" size="small" style="width: 100%;">
|
<el-table-column :show-overflow-tooltip="true" prop="companyName" label="公司" />
|
<el-table-column :show-overflow-tooltip="true" prop="signedQuantity" label="已签订合同数" width="200" />
|
<el-table-column :show-overflow-tooltip="true" prop="unsignedQuantity" label="未签订合同数" width="200" />
|
</el-table>
|
</div>
|
</el-card>
|
</div>
|
</el-col>
|
|
<el-col :span="12">
|
<div class="grid-content">
|
<el-card v-loading="recovery.loading">
|
<div slot="header" class="card-header-box">
|
<span>合同收入损失</span>
|
<div class="form-box">
|
<el-date-picker v-model="recovery.queryForm.signDate" type="daterange" value-format="yyyy-MM-dd 00:00:00" unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 360px;" class="filter-item" @keyup.enter.native="queryStatisticsRecovery" />
|
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="queryStatisticsRecovery">搜索</el-button>
|
</div>
|
</div>
|
|
<div class="card-content-box">
|
<el-table :data="recovery.preprocessData" size="small" style="width: 100%;">
|
<el-table-column :show-overflow-tooltip="true" prop="companyName" label="公司" />
|
<el-table-column :show-overflow-tooltip="true" prop="unRecoveryFund" label="收入损失" width="200">
|
<template slot-scope="scope">
|
<span style="color: red;">{{ scope.row.unRecoveryFund }}</span>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</el-card>
|
</div>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20" class="module-row data-row">
|
<el-col :span="24">
|
<div class="grid-content">
|
<el-card v-loading="amount.loading">
|
<div slot="header" class="card-header-box">
|
<span>合同金额</span>
|
<div class="form-box">
|
<el-date-picker v-model="amount.queryForm.signDate" type="daterange" value-format="yyyy-MM-dd 00:00:00" unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 360px;" class="filter-item" @keyup.enter.native="queryStatisticsAmount" />
|
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="queryStatisticsAmount">搜索</el-button>
|
</div>
|
</div>
|
|
<div class="card-content-box">
|
<el-table :data="amount.preprocessData" size="small" style="width: 100%;">
|
<el-table-column prop="companyName" label="公司" min-width="120" />
|
<el-table-column :show-overflow-tooltip="true" prop="annualData" label="合同金额" min-width="600">
|
<template slot-scope="scope">
|
<div style="display: flex; flex-direction: column; gap: 10px;">
|
<div v-for="(key, index) in Object.keys(scope.row.annualData)" :key="'annualData' + index">
|
<el-row>
|
<el-col :span="4">{{ key + '年' }}</el-col>
|
<el-col :span="4" :offset="1">一季度</el-col>
|
<el-col :span="4" :offset="1">二季度</el-col>
|
<el-col :span="4" :offset="1">三季度</el-col>
|
<el-col :span="4" :offset="1">四季度</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="4">未支付:{{ scope.row.annualData[key].full.unpaid }}</el-col>
|
<el-col :span="4" :offset="1">未支付:{{ scope.row.annualData[key].first.unpaid }}</el-col>
|
<el-col :span="4" :offset="1">未支付:{{ scope.row.annualData[key].second.unpaid }}</el-col>
|
<el-col :span="4" :offset="1">未支付:{{ scope.row.annualData[key].third.unpaid }}</el-col>
|
<el-col :span="4" :offset="1">未支付:{{ scope.row.annualData[key].fourth.unpaid }}</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="4">已支付:{{ scope.row.annualData[key].full.paid }}</el-col>
|
<el-col :span="4" :offset="1">已支付:{{ scope.row.annualData[key].first.paid }}</el-col>
|
<el-col :span="4" :offset="1">已支付:{{ scope.row.annualData[key].second.paid }}</el-col>
|
<el-col :span="4" :offset="1">已支付:{{ scope.row.annualData[key].third.paid }}</el-col>
|
<el-col :span="4" :offset="1">已支付:{{ scope.row.annualData[key].fourth.paid }}</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="4">未开票:{{ scope.row.annualData[key].full.uninvoice }}</el-col>
|
<el-col :span="4" :offset="1">未开票:{{ scope.row.annualData[key].first.uninvoice }}</el-col>
|
<el-col :span="4" :offset="1">未开票:{{ scope.row.annualData[key].second.uninvoice }}</el-col>
|
<el-col :span="4" :offset="1">未开票:{{ scope.row.annualData[key].third.uninvoice }}</el-col>
|
<el-col :span="4" :offset="1">未开票:{{ scope.row.annualData[key].fourth.uninvoice }}</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="4">已开票:{{ scope.row.annualData[key].full.invoiced }}</el-col>
|
<el-col :span="4" :offset="1">已开票:{{ scope.row.annualData[key].first.invoiced }}</el-col>
|
<el-col :span="4" :offset="1">已开票:{{ scope.row.annualData[key].second.invoiced }}</el-col>
|
<el-col :span="4" :offset="1">已开票:{{ scope.row.annualData[key].third.invoiced }}</el-col>
|
<el-col :span="4" :offset="1">已开票:{{ scope.row.annualData[key].fourth.invoiced }}</el-col>
|
</el-row>
|
</div>
|
</div>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</el-card>
|
</div>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20" class="module-row data-row">
|
<el-col :span="24">
|
<div class="grid-content">
|
<el-card v-loading="delay.loading">
|
<div slot="header" class="card-header-box">
|
<span>款项延期</span>
|
<div class="form-box">
|
<el-date-picker v-model="delay.queryForm.signDate" type="daterange" value-format="yyyy-MM-dd 00:00:00" unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 360px;" class="filter-item" @keyup.enter.native="queryStatisticsDelay" />
|
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="queryStatisticsDelay">搜索</el-button>
|
</div>
|
</div>
|
|
<div class="card-content-box">
|
<el-table :data="delay.preprocessData" size="small" style="width: 100%;">
|
<el-table-column :show-overflow-tooltip="true" prop="contractNumber" label="合同编号" width="160" />
|
<el-table-column :show-overflow-tooltip="true" prop="contractName" label="合同名称" />
|
<el-table-column :show-overflow-tooltip="true" prop="contractPostponement" label="合同费延期" />
|
<el-table-column :show-overflow-tooltip="true" prop="servicePostponement" label="服务费延期" />
|
<el-table-column :show-overflow-tooltip="true" prop="secondName" label="所属公司" />
|
<el-table-column prop="firstContactInfo" label="联系人" />
|
</el-table>
|
</div>
|
</el-card>
|
</div>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20" class="module-row data-row">
|
<el-col :span="24">
|
<div class="grid-content">
|
<el-card v-loading="goal.loading">
|
<div slot="header" class="card-header-box">
|
<span>年度目标</span>
|
<div class="form-box">
|
<el-date-picker v-model="goal.queryForm.signDateEqual" type="year" value-format="yyyy-MM-dd 00:00:00" clearable placeholder="目标年度" style="width: 185px;" class="filter-item" @keyup.enter.native="queryStatisticsGoal" />
|
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="queryStatisticsGoal">搜索</el-button>
|
</div>
|
</div>
|
|
<div class="card-content-box">
|
<div class="margin-bottom-10" style="display: flex; flex-direction: column; gap: 10px; color: #606266;">
|
<el-row>
|
<el-col :span="3">科技</el-col>
|
<el-col :span="6">年度目标:{{ goal.preprocessData.goal ? goal.preprocessData.goal.technology : 0 }}</el-col>
|
<el-col :span="6">营业额:{{ goal.preprocessData.goal ? goal.preprocessData.turnover.technology : 0 }}</el-col>
|
<el-col :span="6">差额:{{ goal.preprocessData.goal ? (goal.preprocessData.goal.technology - goal.preprocessData.turnover.technology) : 0 }}</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="3">咨询</el-col>
|
<el-col :span="6">年度目标:{{ goal.preprocessData.goal ? goal.preprocessData.goal.consultation : 0 }}</el-col>
|
<el-col :span="6">营业额:{{ goal.preprocessData.goal ? goal.preprocessData.turnover.consultation : 0 }}</el-col>
|
<el-col :span="6">差额:{{ goal.preprocessData.goal ? (goal.preprocessData.goal.consultation - goal.preprocessData.turnover.consultation) : 0 }}</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="3">弱电</el-col>
|
<el-col :span="6">年度目标:{{ goal.preprocessData.goal ? goal.preprocessData.goal.weakCurrent : 0 }}</el-col>
|
<el-col :span="6">营业额:{{ goal.preprocessData.goal ? goal.preprocessData.turnover.weakCurrent : 0 }}</el-col>
|
<el-col :span="6">差额:{{ goal.preprocessData.goal ? (goal.preprocessData.goal.weakCurrent - goal.preprocessData.turnover.weakCurrent) : 0 }}</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="3">知识产权</el-col>
|
<el-col :span="6">年度目标:{{ goal.preprocessData.goal ? goal.preprocessData.goal.ip : 0 }}</el-col>
|
<el-col :span="6">营业额:{{ goal.preprocessData.goal ? goal.preprocessData.turnover.ip : 0 }}</el-col>
|
<el-col :span="6">差额:{{ goal.preprocessData.goal ? (goal.preprocessData.goal.ip - goal.preprocessData.turnover.ip) : 0 }}</el-col>
|
</el-row>
|
</div>
|
<line-chart :chart-data="goal.preprocessData" />
|
</div>
|
</el-card>
|
</div>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20" class="module-row data-row">
|
<el-col :span="24">
|
<div class="grid-content">
|
<el-card v-loading="incomeExpense.loading">
|
<div slot="header" class="card-header-box">
|
<span>公司收支</span>
|
<div class="form-box">
|
<el-date-picker v-model="incomeExpense.queryForm.signDateEqual" type="year" value-format="yyyy-MM-dd 00:00:00" placeholder="目标年度" style="width: 185px;" class="filter-item" @keyup.enter.native="queryStatisticsIncomeExpense" />
|
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="queryStatisticsIncomeExpense">搜索</el-button>
|
</div>
|
</div>
|
|
<div class="card-content-box">
|
<bar-stack :chart-data="incomeExpense.preprocessData" height="480px" />
|
</div>
|
</el-card>
|
</div>
|
</el-col>
|
</el-row>
|
</div>
|
</template>
|
|
<script>
|
import { statisticsQuantity, statisticsAmount, statisticsDelay, statisticsGoal, statisticsIncomeExpense, statisticsRecovery } from '@/api/contract/contract'
|
import { parseTime } from '@/utils/index'
|
import LineChart from './LineChart'
|
import BarStack from './BarStack'
|
|
export default {
|
name: 'ContractStatistics',
|
components: { LineChart, BarStack },
|
data() {
|
return {
|
quantity: {
|
queryForm: {
|
signDate: []
|
},
|
loading: false,
|
sourceData: null,
|
preprocessData: null
|
},
|
amount: {
|
queryForm: {
|
signDate: []
|
},
|
loading: false,
|
sourceData: null,
|
preprocessData: null
|
},
|
delay: {
|
queryForm: {
|
signDate: []
|
},
|
loading: false,
|
sourceData: null,
|
preprocessData: null
|
},
|
goal: {
|
queryForm: {
|
signDateEqual: null
|
},
|
loading: false,
|
sourceData: null,
|
preprocessData: {}
|
},
|
incomeExpense: {
|
queryForm: {
|
signDateEqual: null
|
},
|
loading: false,
|
sourceData: null,
|
preprocessData: {}
|
},
|
recovery: {
|
queryForm: {
|
signDate: []
|
},
|
loading: false,
|
sourceData: null,
|
preprocessData: null
|
}
|
}
|
},
|
|
created() {
|
const that = this
|
const currentYear = new Date().getFullYear()
|
const firstDayOfYear = new Date(currentYear, 0, 1)
|
const lastDayOfYear = new Date(currentYear, 11, 31)
|
that.quantity.queryForm.signDate = [parseTime(firstDayOfYear), parseTime(lastDayOfYear)]
|
that.recovery.queryForm.signDate = [parseTime(firstDayOfYear), parseTime(lastDayOfYear)]
|
that.amount.queryForm.signDate = [parseTime(firstDayOfYear), parseTime(lastDayOfYear)]
|
that.delay.queryForm.signDate = [parseTime(firstDayOfYear), parseTime(lastDayOfYear)]
|
that.goal.queryForm.signDateEqual = parseTime(firstDayOfYear)
|
that.incomeExpense.queryForm.signDateEqual = parseTime(firstDayOfYear)
|
that.queryStatisticsQuantity()
|
that.queryStatisticsAmount()
|
that.queryStatisticsDelay()
|
that.queryStatisticsGoal()
|
that.queryStatisticsIncomeExpense()
|
that.queryStatisticsRecovery()
|
},
|
methods: {
|
queryStatisticsQuantity() {
|
const that = this
|
that.quantity.loading = true
|
statisticsQuantity(that.quantity.queryForm).then(res => {
|
that.quantity.sourceData = res
|
that.quantity.preprocessData = res.income
|
that.quantity.loading = false
|
}).catch(() => {
|
that.quantity.loading = false
|
})
|
},
|
queryStatisticsAmount() {
|
const that = this
|
that.amount.loading = true
|
statisticsAmount(that.amount.queryForm).then(res => {
|
that.amount.sourceData = res
|
that.amount.preprocessData = res.income
|
that.amount.loading = false
|
}).catch(() => {
|
that.amount.loading = false
|
})
|
},
|
queryStatisticsDelay() {
|
const that = this
|
that.delay.loading = true
|
statisticsDelay(that.delay.queryForm).then(res => {
|
that.delay.sourceData = res
|
that.delay.preprocessData = res.overdueContract
|
that.delay.loading = false
|
}).catch(() => {
|
that.delay.loading = false
|
})
|
},
|
queryStatisticsGoal() {
|
const that = this
|
that.goal.loading = true
|
statisticsGoal(that.goal.queryForm).then(res => {
|
that.goal.sourceData = res
|
// 处理数据
|
const technologyData = []
|
const consultationData = []
|
const weakCurrentData = []
|
const ipData = []
|
const turnoverData = {}
|
Object.keys(res.income).forEach(key => {
|
const monthData = []
|
const current = res.income[key]
|
for (let i = 1; i <= 12; i++) {
|
monthData.push(current[i] || 0)
|
}
|
|
turnoverData[key] = monthData.reduce((acc, val) => acc + val, 0)
|
|
for (let i = 0; i < monthData.length; i++) {
|
let sum = 0
|
for (let j = 0; j <= i; j++) {
|
sum += monthData[j]
|
}
|
if (key === 'contract_technology') {
|
technologyData.push(sum)
|
} else if (key === 'contract_consultation') {
|
consultationData.push(sum)
|
} else if (key === 'contract_weak_current') {
|
weakCurrentData.push(sum)
|
} else if (key === 'contract_ip') {
|
ipData.push(sum)
|
}
|
}
|
})
|
that.goal.preprocessData = {
|
goal: {
|
technology: res.goal.contract_technology || 0,
|
consultation: res.goal.contract_consultation || 0,
|
weakCurrent: res.goal.contract_weak_current || 0,
|
ip: res.goal.contract_ip || 0
|
},
|
turnover: {
|
technology: turnoverData.contract_technology,
|
consultation: turnoverData.contract_consultation,
|
weakCurrent: turnoverData.contract_weak_current,
|
ip: turnoverData.contract_ip
|
},
|
technology: technologyData,
|
consultation: consultationData,
|
weakCurrent: weakCurrentData,
|
ip: ipData
|
}
|
that.goal.loading = false
|
}).catch(() => {
|
that.goal.loading = false
|
})
|
},
|
queryStatisticsIncomeExpense() {
|
const that = this
|
that.incomeExpense.loading = true
|
statisticsIncomeExpense(that.incomeExpense.queryForm).then(res => {
|
that.incomeExpense.sourceData = res
|
// 处理数据
|
const technologyProfit = []
|
const technologyIncome = []
|
const technologyExpend = []
|
const consultationProfit = []
|
const consultationIncome = []
|
const consultationExpend = []
|
const weakCurrentProfit = []
|
const weakCurrentIncome = []
|
const weakCurrentExpend = []
|
const ipProfit = []
|
const ipIncome = []
|
const ipExpend = []
|
Object.keys(res.typeData).forEach(key => {
|
const current = res.typeData[key]
|
if (key === 'contract_technology') {
|
// 一季度
|
technologyProfit.push((current.first.income - current.first.expend) >= 0 ? (current.first.income - current.first.expend) : 0)
|
technologyIncome.push(current.first.income)
|
technologyExpend.push(-(current.first.expend))
|
// 二季度
|
technologyProfit.push((current.second.income - current.second.expend) >= 0 ? (current.second.income - current.second.expend) : 0)
|
technologyIncome.push(current.second.income)
|
technologyExpend.push(-(current.second.expend))
|
// 三季度
|
technologyProfit.push((current.third.income - current.third.expend) >= 0 ? (current.third.income - current.third.expend) : 0)
|
technologyIncome.push(current.third.income)
|
technologyExpend.push(-(current.third.expend))
|
// 四季度
|
technologyProfit.push((current.fourth.income - current.fourth.expend) >= 0 ? (current.fourth.income - current.fourth.expend) : 0)
|
technologyIncome.push(current.fourth.income)
|
technologyExpend.push(-(current.fourth.expend))
|
} else if (key === 'contract_consultation') {
|
// 一季度
|
consultationProfit.push((current.first.income - current.first.expend) >= 0 ? (current.first.income - current.first.expend) : 0)
|
consultationIncome.push(current.first.income)
|
consultationExpend.push(-(current.first.expend))
|
// 二季度
|
consultationProfit.push((current.second.income - current.second.expend) >= 0 ? (current.second.income - current.second.expend) : 0)
|
consultationIncome.push(current.second.income)
|
consultationExpend.push(-(current.second.expend))
|
// 三季度
|
consultationProfit.push((current.third.income - current.third.expend) >= 0 ? (current.third.income - current.third.expend) : 0)
|
consultationIncome.push(current.third.income)
|
consultationExpend.push(-(current.third.expend))
|
// 四季度
|
consultationProfit.push((current.fourth.income - current.fourth.expend) >= 0 ? (current.fourth.income - current.fourth.expend) : 0)
|
consultationIncome.push(current.fourth.income)
|
consultationExpend.push(-(current.fourth.expend))
|
} else if (key === 'contract_weak_current') {
|
// 一季度
|
weakCurrentProfit.push((current.first.income - current.first.expend) >= 0 ? (current.first.income - current.first.expend) : 0)
|
weakCurrentIncome.push(current.first.income)
|
weakCurrentExpend.push(-(current.first.expend))
|
// 二季度
|
weakCurrentProfit.push((current.second.income - current.second.expend) >= 0 ? (current.second.income - current.second.expend) : 0)
|
weakCurrentIncome.push(current.second.income)
|
weakCurrentExpend.push(-(current.second.expend))
|
// 三季度
|
weakCurrentProfit.push((current.third.income - current.third.expend) >= 0 ? (current.third.income - current.third.expend) : 0)
|
weakCurrentIncome.push(current.third.income)
|
weakCurrentExpend.push(-(current.third.expend))
|
// 四季度
|
weakCurrentProfit.push((current.fourth.income - current.fourth.expend) >= 0 ? (current.fourth.income - current.fourth.expend) : 0)
|
weakCurrentIncome.push(current.fourth.income)
|
weakCurrentExpend.push(-(current.fourth.expend))
|
} else if (key === 'contract_ip') {
|
// 一季度
|
ipProfit.push((current.first.income - current.first.expend) >= 0 ? (current.first.income - current.first.expend) : 0)
|
ipIncome.push(current.first.income)
|
ipExpend.push(-(current.first.expend))
|
// 二季度
|
ipProfit.push((current.second.income - current.second.expend) >= 0 ? (current.second.income - current.second.expend) : 0)
|
ipIncome.push(current.second.income)
|
ipExpend.push(-(current.second.expend))
|
// 三季度
|
ipProfit.push((current.third.income - current.third.expend) >= 0 ? (current.third.income - current.third.expend) : 0)
|
ipIncome.push(current.third.income)
|
ipExpend.push(-(current.third.expend))
|
// 四季度
|
ipProfit.push((current.fourth.income - current.fourth.expend) >= 0 ? (current.fourth.income - current.fourth.expend) : 0)
|
ipIncome.push(current.fourth.income)
|
ipExpend.push(-(current.fourth.expend))
|
}
|
})
|
that.incomeExpense.preprocessData = {
|
technologyProfit,
|
technologyIncome,
|
technologyExpend,
|
consultationProfit,
|
consultationIncome,
|
consultationExpend,
|
weakCurrentProfit,
|
weakCurrentIncome,
|
weakCurrentExpend,
|
ipProfit,
|
ipIncome,
|
ipExpend
|
}
|
that.incomeExpense.loading = false
|
}).catch(() => {
|
that.incomeExpense.loading = false
|
})
|
},
|
queryStatisticsRecovery() {
|
const that = this
|
that.recovery.loading = true
|
statisticsRecovery(that.recovery.queryForm).then(res => {
|
that.recovery.sourceData = res
|
that.recovery.preprocessData = res.income
|
that.recovery.loading = false
|
}).catch(() => {
|
that.recovery.loading = false
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.module-row {
|
margin-bottom: 20px;
|
|
&:last-child {
|
margin-bottom: 0;
|
}
|
}
|
|
.data-row {
|
min-width: 1200px;
|
}
|
|
.card-header-box {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
}
|
|
.card-content-box {
|
min-height: 200px;
|
max-height: 500px;
|
overflow: scroll;
|
}
|
|
.grid-content {
|
border-radius: 4px;
|
}
|
|
.form-box {
|
padding: 0px 10px;
|
}
|
|
.margin-bottom-10 {
|
margin-bottom: 10px;
|
}
|
</style>
|