cost.vue 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. <template>
  2. <section>
  3. <el-col :span="24" style="padding-bottom: 0px;text-align:center;margin-top:10px;position: fixed;top: 60px;left: 160px;z-index: 999;">
  4. <el-date-picker v-show="user.timeType.fixMonthcost==0"
  5. v-model="dateRange" :editable="false"
  6. format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  7. @change="getEchart"
  8. :clearable="true"
  9. range-separator="至"
  10. type="daterange"
  11. start-placeholder="开始日期"
  12. end-placeholder="结束日期"
  13. ></el-date-picker>
  14. <el-date-picker v-show="user.timeType.fixMonthcost==1"
  15. v-model="dateRange" :editable="false"
  16. format="yyyy-MM" value-format="yyyy-MM"
  17. @change="getEchart"
  18. :clearable="false"
  19. type="month"
  20. ></el-date-picker>
  21. <el-radio-group v-model="radio" @change="getEchart" style="margin-left:10px;">
  22. <el-radio-button label="项目"></el-radio-button>
  23. <el-radio-button label="部门"></el-radio-button>
  24. <el-radio-button label="人员"></el-radio-button>
  25. <el-radio-button :label="namess" v-if="jichu.customDegreeActive == 1"></el-radio-button>
  26. </el-radio-group>
  27. </el-col>
  28. <!-- <div :style="'width:'+widthHtval+'rem;position: relative;'"> -->
  29. <div :style="'width:'+widthHtval+'px;position: relative; height:'+containerHeight+'px;'">
  30. <div id="container" :style="'height:'+containerHeight+'px;width:100%'"></div>
  31. </div>
  32. <div style="position:fixed;top:120px;right:150px;"><el-button @click="showExportDialog">报表导出</el-button></div>
  33. <!--导出报表条件选择 -->
  34. <el-dialog title="工时报表导出" v-if="exportDialog" :visible.sync="exportDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  35. <el-form ref="form3" :model="exportParam" >
  36. <el-form-item prop="projectId" label="选择项目" v-if="radio != '人员'">
  37. <el-select v-model="exportParam.projectId" placeholder="全部项目" clearable style="width:350px;" filterable="true">
  38. <el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id"></el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item prop="userIds" label="选择人员" v-if="radio == '人员'">
  42. <el-select v-model="exportParam.userIds" placeholder="全部人员" multiple="true" clearable style="width:350px;" filterable="true">
  43. <el-option v-for="item in hasReportUserList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item prop="projectId" :label="user.timeType.fixMonthcost==0?'日期范围':'选择月份'">
  47. <el-date-picker v-show="user.timeType.fixMonthcost==0"
  48. v-model="exportParam.dateRange" :editable="false"
  49. format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  50. :clearable="false"
  51. range-separator="至"
  52. type="daterange"
  53. start-placeholder="开始日期"
  54. end-placeholder="结束日期"
  55. ></el-date-picker>
  56. <el-date-picker v-show="user.timeType.fixMonthcost==1"
  57. v-model="dateRange" :editable="false"
  58. format="yyyy-MM" value-format="yyyy-MM"
  59. @change="getEchart"
  60. :clearable="true"
  61. type="month"
  62. ></el-date-picker>
  63. </el-form-item>
  64. <el-form-item label="选择人员">
  65. <el-select v-model="exportParam.userId" placeholder="请选择人员" style="width: 350px" filterable="true">
  66. <span v-for="(item, index) in users" :key="index">
  67. <el-option :label="item.name" :value="item.id"></el-option>
  68. </span>
  69. </el-select>
  70. </el-form-item>
  71. </el-form>
  72. <div slot="footer" class="dialog-footer">
  73. <el-button type="primary" @click="exportProjectData" style="width:100%;" >导出</el-button>
  74. </div>
  75. </el-dialog>
  76. </section>
  77. </template>
  78. <script>
  79. import util from "../../common/js/util";
  80. export default {
  81. data() {
  82. return {
  83. hasReportUserList:[],
  84. projectList:[],
  85. exportParam:{projectId:null,dateRange:[],userId: ''},
  86. exportDialog:false,
  87. dateRange:[],
  88. user: JSON.parse(sessionStorage.getItem("user")),
  89. radio: sessionStorage.radio!=null?sessionStorage.radio:'项目',
  90. containerHeight: 0,
  91. myChart: null,
  92. params: null,
  93. widthHtval: 1800,
  94. users: [],
  95. jichu: [],
  96. namess: ''
  97. };
  98. },
  99. methods: {
  100. jutishez() {
  101. this.http.post('/time-type/getCompanyTimeSetting', {
  102. companyId: this.user.companyId,
  103. },
  104. res => {
  105. if (res.code == "ok") {
  106. this.jichu = res.data
  107. if(res.data.customDegreeActive == 1) {
  108. this.namess = res.data.customDegreeName
  109. }
  110. } else {
  111. this.$message({
  112. message: res.msg,
  113. type: "error"
  114. });
  115. }
  116. },
  117. error => {
  118. this.$message({
  119. message: error,
  120. type: "error"
  121. });
  122. });
  123. },
  124. getUsers() {
  125. console.log(this.port.manage.list)
  126. this.http.post(this.port.manage.list, {
  127. departmentId: -1,
  128. pageIndex: 1,
  129. pageSize: 99999
  130. },
  131. res => {
  132. if (res.code == "ok") {
  133. this.users = res.data.records;
  134. } else {
  135. this.$message({
  136. message: res.msg,
  137. type: "error"
  138. });
  139. }
  140. },
  141. error => {
  142. this.$message({
  143. message: error,
  144. type: "error"
  145. });
  146. });
  147. },
  148. showExportDialog() {
  149. this.exportDialog = true;
  150. this.exportParam.dateRange = this.dateRange;
  151. if (this.radio == '人员') {
  152. // this.exportParam.userIds = [];
  153. }
  154. },
  155. //获取我的项目列表
  156. getMyProjectList() {
  157. this.http.post('/project/getProjectList', {
  158. },
  159. res => {
  160. if (res.code == "ok") {
  161. this.projectList = res.data;
  162. } else {
  163. this.$message({
  164. message: res.msg,
  165. type: "error"
  166. });
  167. }
  168. },
  169. error => {
  170. this.$message({
  171. message: error,
  172. type: "error"
  173. });
  174. });
  175. },
  176. exportProjectData() {
  177. var param = {};
  178. if (this.exportParam.dateRange != null) {
  179. param = {startDate:this.exportParam.dateRange[0], endDate: this.exportParam.dateRange[1]};
  180. }
  181. var url = "/project/exportTimeCost";
  182. var fileName = '项目工时成本统计.xls';
  183. if (this.radio == '人员' ) {
  184. console.log(this.exportParam.userIds);
  185. fileName = '人员工时成本统计.xls';
  186. url = '/department/exportUserStatistic';
  187. if (this.exportParam.userIds != null && this.exportParam.userIds.length > 0) {
  188. var ids = '';
  189. this.exportParam.userIds.forEach(u=>{
  190. ids += u+',';
  191. })
  192. param.userIds = ids;
  193. }
  194. }
  195. if (this.exportParam.projectId != null) {
  196. param.projectId = this.exportParam.projectId;
  197. }
  198. if (this.exportParam.userId != null) {
  199. param.userId = this.exportParam.userId;
  200. }
  201. this.http.post(url, param,
  202. res => {
  203. this.listLoading = false;
  204. if (res.code == "ok") {
  205. this.exportDialog = false;
  206. var aTag = document.createElement('a');
  207. aTag.download = fileName;
  208. aTag.href = res.data;
  209. aTag.click();
  210. } else {
  211. this.$message({
  212. message: res.msg,
  213. type: "error"
  214. });
  215. }
  216. },
  217. error => {
  218. this.listLoading = false;
  219. this.$message({
  220. message: error,
  221. type: "error"
  222. });
  223. });
  224. },
  225. //获取人员成本统计列表
  226. getUserCostList() {
  227. this.listLoading = true;
  228. this.http.post(this.port.project.userCost, {
  229. startDate:this.user.timeType.fixMonthcost==0?this.dateRange[0]:this.dateRange,
  230. endDate: this.user.timeType.fixMonthcost==0?this.dateRange[1]:this.dateRange
  231. },
  232. res => {
  233. this.listLoading = false;
  234. var _this = this;
  235. this.hasReportUserList = [];
  236. if (res.code == "ok") {
  237. //工时总成本
  238. this.hasReportUserList = res.data.userList;
  239. var xList = [] , yList = [] , list = res.data.list, array = [] , series = [];
  240. var totalMoneyCost = res.data.totalCostMoney;
  241. if (list.length > 0) {
  242. var num = list.length==0?0:list[0].project.length;
  243. for(var i in list) {
  244. xList.push(list[i].name);
  245. var pro = list[i].project;
  246. for(var j in pro) {
  247. if(array.indexOf(pro[j].project) == -1) {
  248. array.push(pro[j].project)
  249. }
  250. }
  251. }
  252. for(var i in array) {
  253. yList.push(array[i]);
  254. var dataList = [];
  255. for(var j in list) {
  256. var project = list[j].project , num = 0;
  257. if(project.length != 0) {
  258. for(var k in project) {
  259. if(project[k].project == array[i]) {
  260. dataList.push({
  261. "value": project[k].money,
  262. "cost": project[k].time,
  263. })
  264. } else {
  265. num++;
  266. }
  267. if(k == project.length-1 && num != project.length-1) {
  268. dataList.push({
  269. "value": 0,
  270. "cost": 0,
  271. })
  272. }
  273. }
  274. } else {
  275. dataList.push({
  276. "value": 0,
  277. "cost": 0,
  278. })
  279. }
  280. }
  281. series.push({
  282. name: array[i],
  283. type: 'bar',
  284. stack:'1',
  285. barMaxWidth: 30,
  286. data: dataList,
  287. })
  288. }
  289. }
  290. var myChart = echarts.init(document.getElementById("container"));
  291. _this.myChart = myChart;
  292. var option = {
  293. //总成本
  294. title: {
  295. text: '工时成本总计' + totalMoneyCost.toFixed(2) + '元',
  296. left:'left',
  297. },
  298. // 工具箱
  299. legend: {
  300. x: 80,
  301. y: 10,
  302. data: yList,
  303. show: true,
  304.        top:"5%",//与上方的距离 可百分比% 可像素px
  305. },
  306. grid : {
  307. top : 80, //距离容器上边界40像素
  308. bottom: 35 //距离容器下边界30像素
  309. },
  310. toolbox: {
  311. show: true,
  312. feature:{
  313. saveAsImage:{
  314. show:true
  315. },
  316. restore:{
  317. show:true
  318. },
  319. // dataView:{
  320. // show:true
  321. // },
  322. // dataZoom:{
  323. // show:true
  324. // },
  325. magicType:{
  326. type:['line','bar']
  327. }
  328. }
  329. },
  330. tooltip:{
  331. trigger:'axis',
  332. formatter: function (params,ticket,callback) {
  333. var totalTime = 0;
  334. var totalCost = 0;
  335. var res = "";
  336. for(var i in params) {
  337. if (params[i].data.value > 0) {
  338. res += "<div style='margin-top:3px;font-size:12px;'><font color='#ddd'>项目名称:" + params[i].seriesName
  339. + "</font><br/>工作成本 : " + params[i].data.value
  340. + "元 <br/>工作时长"+" : " + params[i].data.cost + "小时</br></div>";
  341. totalTime += Number(params[i].data.cost);
  342. totalCost += Number(params[i].data.value);
  343. }
  344. }
  345. res = res +'<br/>'+ params[0].name+ '<br/>总计: ' + totalTime.toFixed(1)+'小时 '+totalCost.toFixed(2) + "元<br/>";
  346. return res;
  347. }
  348. },
  349. xAxis: {
  350. data: xList,
  351. axisLabel: {
  352. interval:0,rotate:20
  353. }
  354. },
  355. yAxis: [{
  356. type : 'value',
  357. axisLabel: {
  358. formatter:'{value} (元)'
  359. }
  360. }],
  361. series: series,
  362. };
  363. myChart.setOption(option,{notMerge:true});
  364. } else {
  365. this.$message({
  366. message: res.msg,
  367. type: "error"
  368. });
  369. }
  370. },
  371. error => {
  372. this.listLoading = false;
  373. this.$message({
  374. message: error,
  375. type: "error"
  376. });
  377. });
  378. },
  379. yanjiu() {
  380. console.log('触发')
  381. },
  382. getEchart(){
  383. console.log(this.radio, this.namess)
  384. sessionStorage.radio = this.radio;
  385. var _this = this;
  386. var param = {};
  387. if (this.dateRange != null) {
  388. param = {startDate:this.user.timeType.fixMonthcost==0?this.dateRange[0]:this.dateRange,
  389. endDate: this.user.timeType.fixMonthcost==0?this.dateRange[1]:this.dateRange};
  390. console.log(param);
  391. }
  392. var url = '';
  393. if (this.radio=='项目') {
  394. url = this.port.project.listCost;
  395. } else if (this.radio=='部门') {
  396. url = this.port.project.depCost;
  397. } else if (this.radio=='人员') {
  398. this.getUserCostList();
  399. return;
  400. } else if (this.radio == this.namess) {
  401. url = '/project/getDegreeCost'
  402. }
  403. this.http.post(url, param,
  404. res => {
  405. if (res.code == "ok") {
  406. // 测试写的
  407. // var shujuy = res.data.costList
  408. // var arrsa = []
  409. // for(var i=0; i<30; i++) {
  410. // arrsa.push(shujuy[0])
  411. // }
  412. // console.log(arrsa)
  413. // res.data.costList = arrsa
  414. for(var i in res.data.costList) {
  415. if(i>20) {
  416. // this.widthHtval = +this.widthHtval + 2
  417. this.widthHtval = +this.widthHtval + 40
  418. } else {
  419. this.widthHtval = 1800
  420. }
  421. }
  422. // 测试写的
  423. var xList = []
  424. var yList = []
  425. var list
  426. if(this.radio == '项目' || this.radio == '人员' || this.radio=='部门') {
  427. list = res.data.costList
  428. var totalMoneyCost = ((this.radio=='项目' || this.radio=='人员')?res.data.totalMoneyCost:res.data.totalCostMoney);
  429. for(var i in list) {
  430. if(this.radio=='项目' || this.radio == '人员') {
  431. xList.push(this.radio=='项目'?list[i].project:list[i].name);
  432. yList.push({
  433. "value": list[i].costMoney.toFixed(2),
  434. "id": list[i].id || i,
  435. "cost": list[i].cost
  436. });
  437. } else {
  438. xList.push(list[i].departmentName);
  439. yList.push({
  440. "value": list[i].costMoney.toFixed(2),
  441. "id": list[i].departmentId,
  442. "cost": list[i].costTime
  443. });
  444. }
  445. }
  446. } else {
  447. list = res.data
  448. var totalMoneyCost = 1
  449. for(var i in list) {
  450. console.log(list[i].name, list[i].costMoney, list[i].cost)
  451. xList.push(list[i].name);
  452. yList.push({
  453. "value": list[i].costMoney.toFixed(2),
  454. "id": list[i].id || i,
  455. "cost": list[i].cost
  456. });
  457. }
  458. }
  459. // var xList = [], yList = [], list = res.data.costList,
  460. // totalMoneyCost = ((this.radio=='项目' || this.radio=='人员')?res.data.totalMoneyCost:res.data.totalCostMoney);
  461. // for(var i in list) {
  462. // if(this.radio=='项目' || this.radio == '人员') {
  463. // xList.push(this.radio=='项目'?list[i].project:list[i].name);
  464. // yList.push({
  465. // "value": list[i].costMoney.toFixed(2),
  466. // "id": list[i].id || i,
  467. // "cost": list[i].cost
  468. // });
  469. // }
  470. // // else if(this.radio=='研究'){
  471. // // xList.push(list[i].name)
  472. // // yList.push({
  473. // // "value": list[i].costMoney.toFixed(2),
  474. // // // "id": list[i].id,
  475. // // "id": i,
  476. // // "cost": list[i].cost
  477. // // })
  478. // // }
  479. // else {
  480. // xList.push(list[i].departmentName);
  481. // yList.push({
  482. // "value": list[i].costMoney.toFixed(2),
  483. // "id": list[i].departmentId,
  484. // "cost": list[i].costTime
  485. // });
  486. // }
  487. // }
  488. var myChart = echarts.init(document.getElementById("container"));
  489. myChart.resize({
  490. width: this.widthHtval
  491. })
  492. _this.myChart = myChart;
  493. if(this.radio == '项目' || this.radio == '人员' || this.radio=='部门') {
  494. var option = {
  495. title: {
  496. text: '工时成本总计' + totalMoneyCost.toFixed(2) + '元',
  497. left:'left',
  498. },
  499. // 工具箱
  500. toolbox: {
  501. show: true,
  502. feature:{
  503. saveAsImage:{
  504. show:true
  505. },
  506. restore:{
  507. show:true
  508. },
  509. // dataView:{
  510. // show:true
  511. // },
  512. // dataZoom:{
  513. // show:true
  514. // },
  515. magicType:{
  516. type:['line','bar']
  517. },
  518. }
  519. },
  520. tooltip:{
  521. trigger:'axis',
  522. formatter: function (params,ticket,callback) {
  523. var res = params[0].name + "<br/>工作成本"+" : " + params[0].data.value
  524. + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
  525. _this.params = params;
  526. return res;
  527. }
  528. },
  529. xAxis: {
  530. data: xList,
  531. axisLabel: {
  532. interval:0,rotate:20
  533. }
  534. },
  535. yAxis: [{
  536. type : 'value',
  537. axisLabel: {
  538. formatter:'{value} (元)'
  539. }
  540. }],
  541. series: [{
  542. name: '工作成本(元)',
  543. type: 'bar',
  544. barMaxWidth: 30,
  545. data: yList,
  546. }]
  547. };
  548. } else {
  549. var option = {
  550. title: {
  551. text: '',
  552. left:'left',
  553. },
  554. // 工具箱
  555. toolbox: {
  556. show: true,
  557. feature:{
  558. saveAsImage:{
  559. show:true
  560. },
  561. restore:{
  562. show:true
  563. },
  564. // dataView:{
  565. // show:true
  566. // },
  567. // dataZoom:{
  568. // show:true
  569. // },
  570. magicType:{
  571. type:['line','bar']
  572. },
  573. }
  574. },
  575. tooltip:{
  576. trigger:'axis',
  577. formatter: function (params,ticket,callback) {
  578. var res = params[0].name + "<br/>工作成本"+" : " + params[0].data.value
  579. + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
  580. _this.params = params;
  581. return res;
  582. }
  583. },
  584. xAxis: {
  585. data: xList,
  586. axisLabel: {
  587. interval:0,rotate:20
  588. }
  589. },
  590. yAxis: [{
  591. type : 'value',
  592. axisLabel: {
  593. formatter:'{value} (元)'
  594. }
  595. }],
  596. series: [{
  597. name: '工作成本(元)',
  598. type: 'bar',
  599. barMaxWidth: 30,
  600. data: yList,
  601. }]
  602. };
  603. }
  604. // var option = {
  605. // title: {
  606. // text: '工时成本总计' + totalMoneyCost.toFixed(2) + '元',
  607. // left:'left',
  608. // },
  609. // // 工具箱
  610. // toolbox: {
  611. // show: true,
  612. // feature:{
  613. // saveAsImage:{
  614. // show:true
  615. // },
  616. // restore:{
  617. // show:true
  618. // },
  619. // // dataView:{
  620. // // show:true
  621. // // },
  622. // // dataZoom:{
  623. // // show:true
  624. // // },
  625. // magicType:{
  626. // type:['line','bar']
  627. // },
  628. // }
  629. // },
  630. // tooltip:{
  631. // trigger:'axis',
  632. // formatter: function (params,ticket,callback) {
  633. // var res = params[0].name + "<br/>工作成本"+" : " + params[0].data.value
  634. // + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
  635. // _this.params = params;
  636. // return res;
  637. // }
  638. // },
  639. // xAxis: {
  640. // data: xList,
  641. // axisLabel: {
  642. // interval:0,rotate:20
  643. // }
  644. // },
  645. // yAxis: [{
  646. // type : 'value',
  647. // axisLabel: {
  648. // formatter:'{value} (元)'
  649. // }
  650. // }],
  651. // series: [{
  652. // name: '工作成本(元)',
  653. // type: 'bar',
  654. // barMaxWidth: 30,
  655. // data: yList,
  656. // }]
  657. // };
  658. myChart.setOption(option,{notMerge: true});
  659. myChart.getZr().on('click', params => {
  660. const pointInPixel = [params.offsetX, params.offsetY];
  661. if (myChart.containPixel('grid', pointInPixel)) {
  662. console.log(_this.params)
  663. if(_this.radio=='项目') {
  664. if (_this.dateRange != null) {
  665. if (this.user.timeType.fixMonthcost == 0) {
  666. _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name
  667. +"?startDate="+_this.dateRange[0]+"&endDate="+_this.dateRange[1]);
  668. } else {
  669. _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name
  670. +"?startDate="+_this.dateRange+"&endDate="+_this.dateRange);
  671. }
  672. } else {
  673. _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
  674. }
  675. } else if (_this.radio=='部门') {
  676. if (_this.dateRange != null) {
  677. _this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name
  678. +"?startDate="+_this.dateRange[0]+"&endDate="+_this.dateRange[1]);
  679. } else {
  680. _this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name);
  681. }
  682. }
  683. }
  684. });
  685. } else {
  686. this.$message({
  687. message: res.msg,
  688. type: "error"
  689. });
  690. }
  691. },
  692. error => {
  693. this.$message({
  694. message: error,
  695. type: "error"
  696. });
  697. });
  698. },
  699. },
  700. created() {
  701. },
  702. mounted() {
  703. this.containerHeight = window.innerHeight - 140
  704. const that = this;
  705. window.onresize = function temp() {
  706. this.containerHeight = window.innerHeight - 100
  707. };
  708. if (this.user.timeType.fixMonthcost == 0) {
  709. if (this.$route.query.startDate != null) {
  710. this.dateRange = [this.$route.query.startDate, this.$route.query.endDate];
  711. } else {
  712. //默认查看本月
  713. var now = new Date();
  714. var t = util.formatDate.format(now, 'yyyy-MM-dd');
  715. var startStr = util.formatDate.format(new Date(), 'yyyy-MM') + "-01";
  716. this.dateRange = [startStr,t];
  717. }
  718. this.exportParam.dateRange = this.dateRange;
  719. } else if (this.user.timeType.fixMonthcost == 1) {
  720. if (this.$route.query.startDate != null) {
  721. this.dateRange = this.$route.query.startDate;
  722. } else {
  723. //默认查看本月
  724. var startStr = util.formatDate.format(new Date(), 'yyyy-MM');
  725. this.dateRange = startStr;
  726. }
  727. this.exportParam.dateRange = this.dateRange;
  728. }
  729. this.radio = '项目'
  730. this.getEchart();
  731. var _this = this;
  732. window.addEventListener("resize", function() {
  733. _this.myChart.resize();
  734. });
  735. this.getMyProjectList();
  736. this.getUsers()
  737. this.jutishez()
  738. },
  739. };
  740. </script>
  741. <style lang="scss" scoped>
  742. #container {
  743. // display: inline-block;
  744. display: block;
  745. position: absolute;
  746. // width: 100% !important;
  747. margin-top: 60px;
  748. }
  749. </style>
  750. <style lang="scss">
  751. </style>