earning.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <div :style="'padding:10px;background:#f7f7f7;min-height:'+tableHeight+'px;'">
  3. <div style="margin: 0 auto;width:1120px;">
  4. <el-row :gutter="10">
  5. <el-col :span="24">
  6. <div class="box" style="height:350px;">
  7. <div >
  8. <div class="lableTxt">项目利润快照</div>
  9. <el-divider></el-divider>
  10. <!--利润率列表-->
  11. <el-table :data="list" highlight-current-row v-loading="listLoading" max-height="300" style="width: 100%;">
  12. <el-table-column prop="indate" label="校准日期" ></el-table-column>
  13. <el-table-column prop="profitA" >
  14. <template slot="header">
  15. <span>利润率A</span>
  16. <el-popover placement="top" width="250" trigger="hover" content="利润率A = (项目金额 - 总成本)/项目金额">
  17. <i class="el-icon-question" slot="reference" />
  18. </el-popover>
  19. </template>
  20. <template slot-scope="scope">
  21. {{scope.row.profitA}}%
  22. </template>
  23. </el-table-column>
  24. <el-table-column prop="profitB" label="利润率B" >
  25. <template slot="header">
  26. <span>利润率B</span>
  27. <el-popover placement="top" width="350" trigger="hover" content="利润率B = (项目金额 - 总成本 - 预留金额1)/项目金额">
  28. <i class="el-icon-question" slot="reference" />
  29. </el-popover>
  30. </template>
  31. <template slot-scope="scope">
  32. {{scope.row.profitB}}%
  33. </template>
  34. </el-table-column>
  35. <el-table-column prop="profitC" label="利润率C" >
  36. <template slot="header">
  37. <span>利润率C</span>
  38. <el-popover placement="top" width="430" trigger="hover" content="利润率C = (项目金额 - 总成本 - 预留金额1 - 预留金额2)/项目金额">
  39. <i class="el-icon-question" slot="reference" />
  40. </el-popover>
  41. </template>
  42. <template slot-scope="scope">
  43. {{scope.row.profitC}}%
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="contractAmount" label="项目金额" ></el-table-column>
  47. <el-table-column label="基线成本" >
  48. <el-table-column prop="baseMan" label="人员成本">
  49. <template slot-scope="scope">
  50. ¥{{scope.row.baseMan}}
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="baseFee" label="费用">
  54. <template slot-scope="scope">
  55. ¥{{scope.row.baseFee}}
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="baseOutsourcing" label="外包费用">
  59. <template slot-scope="scope">
  60. ¥{{scope.row.baseOutsourcing}}
  61. </template>
  62. </el-table-column>
  63. <el-table-column prop="baseRisk1" label="风险预留金额1" width="150">
  64. <template slot-scope="scope">
  65. ¥{{scope.row.baseRisk1}}
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="baseRisk2" label="风险预留金额2" width="150">
  69. <template slot-scope="scope">
  70. ¥{{scope.row.baseRisk2}}
  71. </template>
  72. </el-table-column>
  73. </el-table-column>
  74. </el-table>
  75. </div>
  76. </div>
  77. </el-col>
  78. </el-row>
  79. <el-row :gutter="10">
  80. <el-col :span="12">
  81. <div class="box">
  82. <div class="lableTxt">耗时最多任务</div>
  83. <el-divider></el-divider>
  84. <div id="costPanel" style="height:300px;"></div>
  85. </div>
  86. </el-col>
  87. <el-col :span="12">
  88. <div class="box">
  89. <div class="lableTxt">按任务列表统计</div>
  90. <el-divider></el-divider>
  91. <div id="stagesPanel" style="height:300px;"></div>
  92. </div>
  93. </el-col>
  94. </el-row>
  95. </div>
  96. </div>
  97. </template>
  98. <style scoped>
  99. #executorPanel {
  100. display: inline-block;
  101. width: 100%;
  102. }
  103. .el-divider--horizontal {
  104. margin: 10px 0;
  105. height: 0.5px;
  106. }
  107. .box {
  108. background:#fff;border: 1px solid #eeeeee;border-radius:5px;padding:10px;
  109. height:303.7px;margin-top:10px;
  110. }
  111. .info span {
  112. color:#303133;
  113. }
  114. .gray_label {
  115. color:#999 !important;
  116. }
  117. .el-row {
  118. margin-top:10px;
  119. }
  120. .lableTxt {
  121. color:#666;
  122. }
  123. </style>
  124. <script>
  125. import util from "../../common/js/util";
  126. export default {
  127. data() {
  128. return {
  129. list:[],
  130. costChart:null,
  131. stagesChart: null,
  132. executorChart: null,
  133. pVisible:false,
  134. taskSum:{},
  135. users:[],
  136. importanceList:[{id:1,label:'一般'},{id:2,label:'紧急'},{id:3,label:'重要'},{id:4,label:'重要且紧急'}],
  137. //1-一般,2-紧急,3-重要,4-重要且紧急
  138. levelTxt:["全部","一般","紧急","重要","重要且紧急"],
  139. //1-进行中,2-已完成,3-已撤销
  140. statusTxt: ["全部","进行中","已完成","已撤销"],
  141. addFolderDialog: false,
  142. upLoading:false,
  143. user: JSON.parse(sessionStorage.getItem("user")),
  144. addLoading: false,
  145. curProjectId:null,
  146. title: "",
  147. };
  148. },
  149. methods: {
  150. getProfitSnapshot() {
  151. let _this = this;
  152. this.http.post('/earning-snapshot/list', {projectId: this.curProjectId},
  153. res => {
  154. if (res.code == "ok") {
  155. _this.list = res.data;
  156. } else {
  157. this.$message({
  158. message: res.msg,
  159. type: "error"
  160. });
  161. }
  162. },
  163. error => {
  164. this.$message({
  165. message: error,
  166. type: "error"
  167. });
  168. });
  169. },
  170. getStagesPanel(){
  171. let _this = this;
  172. this.http.post('/task/getStagesPanel', {projectId: this.curProjectId},
  173. res => {
  174. if (res.code == "ok") {
  175. var list = res.data;
  176. var myChart = echarts.init(document.getElementById("stagesPanel"));
  177. _this.stagesChart = myChart;
  178. myChart.setOption({
  179. title: {
  180. show:list.length == 0,
  181. textStyle: {
  182. color: "#666666",
  183.   fontSize: 18,
  184. fontWeight: 'normal',
  185.  },
  186.   text: list.length == 0?"暂无数据":"任务列表统计",
  187.   left: "center",
  188.   top: "center"
  189. },
  190. toolbox: {
  191. show: true,
  192. feature:{
  193. saveAsImage:{
  194. show:true
  195. },
  196. }
  197. },
  198. tooltip:{
  199. trigger:'item',
  200. formatter: "{b}<br/>任务数:{c} ({d}%)",
  201. },
  202. series : [
  203. {
  204. name: '任务列表',
  205. type: 'pie',
  206. radius: '55%',
  207. data:list
  208. }
  209. ]
  210. })
  211. } else {
  212. this.$message({
  213. message: res.msg,
  214. type: "error"
  215. });
  216. }
  217. },
  218. error => {
  219. this.$message({
  220. message: error,
  221. type: "error"
  222. });
  223. });
  224. },
  225. getExecutorPanel(){
  226. let _this = this;
  227. this.http.post('/task/getExecutorPanel', {projectId: this.curProjectId},
  228. res => {
  229. if (res.code == "ok") {
  230. var xList = [], yList = [], list = res.data;
  231. for(var i in list) {
  232. xList.push(list[i].executorName);
  233. yList.push({
  234. "value": list[i].taskCount,
  235. "id": list[i].executorId
  236. });
  237. }
  238. var myChart = echarts.init(document.getElementById("executorPanel"));
  239. _this.executorChart = myChart;
  240. var option = {
  241. title: {
  242. show:list.length == 0,
  243. textStyle: {
  244. color: "#666666",
  245.   fontSize: 18,
  246. fontWeight: 'normal',
  247.  },
  248.   text: list.length == 0?"暂无数据":"执行人分配图",
  249.   left: "center",
  250.   top: "center"
  251. },
  252. toolbox: {
  253. show: true,
  254. feature:{
  255. saveAsImage:{
  256. show:true
  257. },
  258. restore:{
  259. show:true
  260. },
  261. magicType:{
  262. type:['line','bar']
  263. },
  264. }
  265. },
  266. tooltip:{
  267. trigger:'axis',
  268. formatter: function (params,ticket,callback) {
  269. var res = params[0].name + ""+" : " + params[0].data.value
  270. + "个";
  271. _this.params = params;
  272. return res;
  273. }
  274. },
  275. xAxis: {
  276. data: xList,
  277. axisLabel: {
  278. interval:0,rotate:20
  279. }
  280. },
  281. yAxis: [{
  282. type : 'value',
  283. axisLabel: {
  284. formatter:'{value} '
  285. }
  286. }],
  287. series: [{
  288. name: '任务数量(个)',
  289. type: 'bar',
  290. barMaxWidth: 30,
  291. data: yList,
  292. }]
  293. };
  294. myChart.setOption(option);
  295. console.log('===这是完成');
  296. } else {
  297. this.$message({
  298. message: res.msg,
  299. type: "error"
  300. });
  301. }
  302. },
  303. error => {
  304. this.$message({
  305. message: error,
  306. type: "error"
  307. });
  308. });
  309. },
  310. getProjectTaskSum() {
  311. this.http.post('/project/taskSum', {
  312. id: this.curProjectId
  313. },
  314. res => {
  315. if (res.code == "ok") {
  316. this.taskSum = res.data;
  317. } else {
  318. this.$message({
  319. message: res.msg,
  320. type: "error"
  321. });
  322. }
  323. },
  324. error => {
  325. this.$message({
  326. message: error,
  327. type: "error"
  328. });
  329. });
  330. },
  331. refreshPage() {
  332. this.curProjectId = parseInt(this.$route.params.id);
  333. this.getProfitSnapshot();
  334. }
  335. },
  336. created() {
  337. console.log('created===');
  338. let height = window.innerHeight;
  339. this.tableHeight = height - 160;
  340. const that = this;
  341. window.onresize = function temp() {
  342. that.tableHeight = window.innerHeight - 160;
  343. };
  344. },
  345. mounted() {
  346. console.log('=========图表mounted===');
  347. this.curProjectId = parseInt(this.$route.params.id);
  348. var _this = this;
  349. window.addEventListener("resize", function() {
  350. _this.executorChart.resize();
  351. _this.stagesChart.resize();
  352. _this.costChart.resize();
  353. });
  354. this.getProfitSnapshot();
  355. }
  356. };
  357. </script>