123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- <template>
- <div :style="'padding:10px;background:#f7f7f7;min-height:'+tableHeight+'px;'">
- <div style="margin: 0 auto;width:1120px;">
- <el-row :gutter="10">
- <el-col :span="24">
- <div class="box" style="height:650px;">
- <div >
- <div class="lableTxt">项目利润快照</div>
- <el-divider></el-divider>
- <!--利润率列表-->
- <el-table :data="list" highlight-current-row v-loading="listLoading" max-height="300" style="width: 100%;">
- <el-table-column prop="indate" label="校准日期" ></el-table-column>
- <el-table-column prop="profitA" >
- <template slot="header">
- <span>利润率A</span>
- <el-popover placement="top" width="250" trigger="hover" content="利润率A = (项目金额 - 总成本)/项目金额">
- <i class="el-icon-question" slot="reference" />
- </el-popover>
- </template>
- <template slot-scope="scope">
- {{scope.row.profitA}}%
- </template>
- </el-table-column>
- <el-table-column prop="profitB" label="利润率B" >
- <template slot="header">
- <span>利润率B</span>
- <el-popover placement="top" width="350" trigger="hover" content="利润率B = (项目金额 - 总成本 - 预留金额1)/项目金额">
- <i class="el-icon-question" slot="reference" />
- </el-popover>
- </template>
- <template slot-scope="scope">
- {{scope.row.profitB}}%
- </template>
- </el-table-column>
- <el-table-column prop="profitC" label="利润率C" >
- <template slot="header">
- <span>利润率C</span>
- <el-popover placement="top" width="430" trigger="hover" content="利润率C = (项目金额 - 总成本 - 预留金额1 - 预留金额2)/项目金额">
- <i class="el-icon-question" slot="reference" />
- </el-popover>
- </template>
- <template slot-scope="scope">
- {{scope.row.profitC}}%
- </template>
- </el-table-column>
- <el-table-column prop="contractAmount" label="项目金额" ></el-table-column>
- <el-table-column label="基线成本" >
- <el-table-column prop="baseMan" label="人员成本">
- <template slot-scope="scope">
- ¥{{scope.row.baseMan | numberToCurrency}}
- </template>
- </el-table-column>
- <el-table-column prop="baseFee" label="费用">
- <template slot-scope="scope">
- ¥{{scope.row.baseFee | numberToCurrency}}
- </template>
- </el-table-column>
- <el-table-column prop="baseOutsourcing" label="外包费用">
- <template slot-scope="scope">
- ¥{{scope.row.baseOutsourcing | numberToCurrency}}
- </template>
- </el-table-column>
- <el-table-column prop="baseRisk1" label="风险预留金额1" width="150">
- <template slot-scope="scope">
- ¥{{scope.row.baseRisk1 | numberToCurrency}}
- </template>
- </el-table-column>
- <el-table-column prop="baseRisk2" label="风险预留金额2" width="150">
- <template slot-scope="scope">
- ¥{{scope.row.baseRisk2 | numberToCurrency}}
- </template>
- </el-table-column>
- </el-table-column>
- </el-table>
- <el-divider ></el-divider>
- <!--图形显示 -->
- <div id="chartPanel" style="height: 300px;width: 1100px;"></div>
- </div>
- </div>
- </el-col>
- </el-row>
- </div>
-
- </div>
- </template>
- <style scoped>
- #executorPanel {
- display: inline-block;
- width: 100%;
- }
- .el-divider--horizontal {
- margin: 10px 0;
- height: 0.5px;
- }
- .box {
- background:#fff;border: 1px solid #eeeeee;border-radius:5px;padding:10px;
- height:303.7px;margin-top:10px;
- }
- .info span {
- color:#303133;
- }
- .gray_label {
- color:#999 !important;
- }
- .el-row {
- margin-top:10px;
- }
- .lableTxt {
- color:#666;
- }
- </style>
- <script>
- import util from "../../common/js/util";
- export default {
- data() {
- return {
- yList3:[],
- yList2:[],
- yList1:[],
- xList:[],
- list:[],
- costChart:null,
- stagesChart: null,
- executorChart: null,
- pVisible:false,
- taskSum:{},
- users:[],
- importanceList:[{id:1,label:'一般'},{id:2,label:'紧急'},{id:3,label:'重要'},{id:4,label:'重要且紧急'}],
- //1-一般,2-紧急,3-重要,4-重要且紧急
- levelTxt:["全部","一般","紧急","重要","重要且紧急"],
- //1-进行中,2-已完成,3-已撤销
- statusTxt: ["全部","进行中","已完成","已撤销"],
- addFolderDialog: false,
- upLoading:false,
- user: JSON.parse(sessionStorage.getItem("user")),
- addLoading: false,
- curProjectId:null,
- title: "",
-
- };
- },
- filters: {
- numberToCurrency(value) {
- if (!value) return '0.00'
- value = value.toFixed(2)
- const intPart = Math.trunc(value)
- const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
- let floatPart = '.00'
- const valueArray = value.toString().split('.')
- if (valueArray.length === 2) { // 有小数部分
- floatPart = valueArray[1].toString() // 取得小数部分
- return intPartFormat + '.' + floatPart
- }
- return intPartFormat + floatPart
- }
- },
- methods: {
- getProfitSnapshot() {
- let _this = this;
- this.http.post('/earning-snapshot/list', {projectId: this.curProjectId},
- res => {
- if (res.code == "ok") {
- var list = JSON.parse(JSON.stringify(res.data)).reverse();
- _this.list = res.data;
- for (var m=0;m<list.length; m++) {
- this.xList.push(list[m].indate);
- this.yList1.push(list[m].profitA);
- this.yList2.push(list[m].profitB);
- this.yList3.push(list[m].profitC);
- }
- //图表展示
- var myChart = echarts.init(document.getElementById("chartPanel"));
- myChart.setOption({
- title: {
- textStyle: {
- color: "#666666",
- fontSize: 18,
- fontWeight: 'normal',
- },
- text: list.length == 0?"暂无数据":"利润率趋势图",
- left: list.length == 0?"center":"left",
- top: list.length == 0?"center":"left"
- },
- toolbox: {
- show: true,
- feature:{
- saveAsImage:{
- show:true
- },
- }
- },
- tooltip:{
- trigger: 'axis'
- },
- legend: {
- data: ['利润率A', '利润率B', '利润率C']
- },
- grid: {
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- xAxis: {
- type: 'category',
- boundaryGap: false,
- data: this.xList
- },
- yAxis: {
- type: 'value'
- },
- series : [
- {
- name: '利润率A',
- type: 'line',
- stack: '百分比',
- data: this.yList1
- },
- {
- name: '利润率B',
- type: 'line',
- stack: '百分比',
- data: this.yList2
- },
- {
- name: '利润率C',
- type: 'line',
- stack: '百分比',
- data: this.yList3
- },
- ]
- })
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- getStagesPanel(){
- let _this = this;
- this.http.post('/task/getStagesPanel', {projectId: this.curProjectId},
- res => {
- if (res.code == "ok") {
- var list = res.data;
- var myChart = echarts.init(document.getElementById("stagesPanel"));
- _this.stagesChart = myChart;
- myChart.setOption({
- title: {
- show:list.length == 0,
- textStyle: {
- color: "#666666",
- fontSize: 18,
- fontWeight: 'normal',
- },
- text: list.length == 0?"暂无数据":"任务列表统计",
- left: "center",
- top: "center"
- },
- toolbox: {
- show: true,
- feature:{
- saveAsImage:{
- show:true
- },
- }
- },
- tooltip:{
- trigger:'item',
- formatter: "{b}<br/>任务数:{c} ({d}%)",
- },
- series : [
- {
- name: '任务列表',
- type: 'pie',
- radius: '55%',
- data:list
- }
- ]
- })
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- getExecutorPanel(){
- let _this = this;
- this.http.post('/task/getExecutorPanel', {projectId: this.curProjectId},
- res => {
- if (res.code == "ok") {
- var xList = [], yList = [], list = res.data;
- for(var i in list) {
- xList.push(list[i].executorName);
- yList.push({
- "value": list[i].taskCount,
- "id": list[i].executorId
- });
- }
- var myChart = echarts.init(document.getElementById("executorPanel"));
- _this.executorChart = myChart;
- var option = {
- title: {
- show:list.length == 0,
- textStyle: {
- color: "#666666",
- fontSize: 18,
- fontWeight: 'normal',
- },
- text: list.length == 0?"暂无数据":"执行人分配图",
- left: "center",
- top: "center"
- },
- toolbox: {
- show: true,
- feature:{
- saveAsImage:{
- show:true
- },
- restore:{
- show:true
- },
- magicType:{
- type:['line','bar']
- },
- }
- },
- tooltip:{
- trigger:'axis',
- formatter: function (params,ticket,callback) {
- var res = params[0].name + ""+" : " + params[0].data.value
- + "个";
- _this.params = params;
- return res;
- }
- },
- xAxis: {
- data: xList,
- axisLabel: {
- interval:0,rotate:20
- }
- },
- yAxis: [{
- type : 'value',
- axisLabel: {
- formatter:'{value} '
- }
- }],
- series: [{
- name: '任务数量(个)',
- type: 'bar',
- barMaxWidth: 30,
- data: yList,
- }]
- };
- myChart.setOption(option);
- console.log('===这是完成');
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- getProjectTaskSum() {
- this.http.post('/project/taskSum', {
- id: this.curProjectId
- },
- res => {
- if (res.code == "ok") {
- this.taskSum = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- refreshPage() {
- this.curProjectId = parseInt(this.$route.params.id);
- this.getProfitSnapshot();
- }
- },
- created() {
- console.log('created===');
- let height = window.innerHeight;
- this.tableHeight = height - 160;
- const that = this;
- window.onresize = function temp() {
- that.tableHeight = window.innerHeight - 160;
- };
- },
- mounted() {
- console.log('=========图表mounted===');
- this.curProjectId = parseInt(this.$route.params.id);
- var _this = this;
- window.addEventListener("resize", function() {
- _this.executorChart.resize();
- _this.stagesChart.resize();
- _this.costChart.resize();
- });
- this.getProfitSnapshot(); // 调用图表方法
- }
- };
- </script>
- <style scoped>
- </style>
|