cost.vue 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218
  1. <template>
  2. <section>
  3. <el-row style="padding-bottom: 0px;text-align:center;margin-top:20px;z-index: 999;">
  4. <el-col :span="6" >
  5. <div ><span style="color:#999;">{{ $t('chartY') }} </span>
  6. <el-radio-group v-model="yAxisValue" @change="onYAxisChange" size="small">
  7. <el-radio-button label="0" v-if="permissions.countCost">{{ $t('accordingtothecost') }}</el-radio-button>
  8. <el-radio-button label="1" v-if="permissions.countHours">{{ $t('accordingtoworkinghours') }}</el-radio-button>
  9. </el-radio-group></div>
  10. </el-col>
  11. <el-col :span="14" style="display: flex;flex-wrap: wrap;">
  12. <el-date-picker v-show="user.timeType.fixMonthcost==0" size="small"
  13. v-model="dateRange" :editable="false"
  14. format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  15. @change="getEchart"
  16. :clearable="true"
  17. :range-separator="$t('other.to')"
  18. type="daterange"
  19. :start-placeholder="$t('time.startDate')"
  20. :end-placeholder="$t('time.endDate')"
  21. ></el-date-picker>
  22. <el-date-picker v-show="user.timeType.fixMonthcost==1"
  23. v-model="dateRange" :editable="false" size="small"
  24. format="yyyy-MM" value-format="yyyy-MM"
  25. @change="getEchart"
  26. :clearable="false"
  27. type="month"
  28. ></el-date-picker>
  29. <el-radio-group v-model="radio" @change="getEchart" style="margin-left:10px;" size="small">
  30. <el-radio-button :label="$t('other.project')"></el-radio-button>
  31. <el-radio-button :label="$t('zhu-xiang-mu')" v-if="user.timeType.mainProjectState"></el-radio-button>
  32. <el-radio-button :label="$t('projectclassification')"></el-radio-button>
  33. <el-radio-button :label="$t('lable.department')"></el-radio-button>
  34. <el-radio-button :label="$t('ren-yuan')" v-if="permissions.countPersonnel"></el-radio-button>
  35. <el-radio-button :label="namess" v-if="jichu.customDegreeActive == 1"></el-radio-button>
  36. <el-radio-button v-for="item in theCustomList" :key="item.id" :label="item.name"></el-radio-button>
  37. </el-radio-group>
  38. <!--
  39. <el-select v-model="customName" filterable placeholder="请选择" style="margin-top: 10px;width: 350px" v-if="theCustomListFlg" @change="jieliu()">
  40. <el-option v-for="item in customList" :key="item.id" :label="item.name" :value="item.name"></el-option>
  41. </el-select> -->
  42. <el-select v-model="personnelValue" filterable clearable :placeholder="$t('pleaseselectpersonnel')" size="small" style="margin-top: 10px;width: 350px" v-if="radio == $t('ren-yuan')" @change="personnel()">
  43. <el-option v-for="item in hasReportUserList" :key="item.id" :label="item.name" :value="item.name">
  44. <span style="float: left">{{ item.name }}</span>
  45. <span style="float: right; color: #8492a6; font-size: 13px;margin-left: 20px" v-if="item.jobNumber">{{ item.jobNumber }}</span>
  46. </el-option>
  47. </el-select>
  48. </el-col>
  49. <el-col :span="4">
  50. <el-button @click="exportProjectData" v-if="theCustomListFlg" size="small">{{ $t('reporderived') }}</el-button>
  51. <el-button @click="showExportDialog" v-else size="small">{{ $t('reporderived') }}</el-button>
  52. </el-col>
  53. </el-row>
  54. <!-- <div id="clearfix" :style="'width:'+widthHtval+'px;position: relative; height:'+containerHeight+'px;'">
  55. <div id="container" :style="'height:'+containerHeight+'px;width:100%'"></div>
  56. </div> -->
  57. <div id="clearfix" :class="radio == $t('ren-yuan') ? 'ryuans' : ''" :style="'overflow-x: auto;width:100%;padding-bottom: 100px; position: relative; height:'+containerHeight+'px;'">
  58. <div id="container" :style="'height:'+(containerHeight - 20)+'px;width:100%'"></div>
  59. <div class="poss">
  60. <el-pagination
  61. @size-change="echartsSizeChange"
  62. @current-change="echartsCurrentChange"
  63. :current-page="page"
  64. :page-sizes="[50]"
  65. :page-size="50"
  66. layout="total, sizes, prev, pager, next"
  67. :total="total">
  68. </el-pagination>
  69. </div>
  70. </div>
  71. <!-- <div>
  72. <div id="container" :style="'height:'+containerHeight+'px;width:100%'"></div>
  73. </div> -->
  74. <div style="position:fixed;top:170px;left:600px;" v-show="radio==$t('lable.department') && parentDeptId != null">
  75. <el-button @click="backToParentDept">{{ $t('returnsuperior') }}</el-button>
  76. </div>
  77. <!--导出报表条件选择 -->
  78. <el-dialog :title="$t('timeReportExport')" v-if="exportDialog" :visible.sync="exportDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  79. <el-form ref="form3" :model="exportParam" >
  80. <el-form-item prop="projectId" :label="$t('defaultText.selectProject')" v-if="radio != $t('ren-yuan') && radio != $t('projectclassification') && radio != $t('lable.department')">
  81. <el-select v-model="exportParam.projectId" :placeholder="$t('other.allProject')" clearable style="width:350px;" filterable="true" popper-class="projectSelectPopperClass">
  82. <el-option v-for="item in projectList" :key="item.id" :label="item.projectName + item.projectCode" :value="item.id">
  83. <span style="float: left;color: #8492a6;">{{ item.projectCode }}</span>
  84. <span style="float: right;font-size: 13px;">{{ item.projectName }}</span>
  85. </el-option>
  86. </el-select>
  87. </el-form-item>
  88. <el-form-item :label="$t('departmentchoice')" v-if="radio == $t('other.project')">
  89. <el-cascader v-model="exportParam.deptId" :options="departmentList" :placeholder="$t('defaultText.pleaseChoose')"
  90. :props="{ checkStrictly: true, expandTrigger: 'hover' }" clearable filterable style="width:350px;"
  91. ></el-cascader>
  92. </el-form-item>
  93. <el-form-item prop="projectCategoryId" :label="$t('projectclassification')" v-if="radio == $t('projectclassification')">
  94. <el-select v-model="exportParam.projectCategoryId" :placeholder="$t('classificationitems')" clearable style="width:350px;" filterable="true">
  95. <el-option v-for="item in categoryList" :key="item.id" :label="item.name" :value="item.id">
  96. </el-option>
  97. </el-select>
  98. </el-form-item>
  99. <el-form-item prop="userIds" :label="$t('screening.selectPeople')" v-if="radio == $t('ren-yuan')">
  100. <el-select v-model="exportParam.userIds" :placeholder="$t('lable.allStaff')" multiple="true" clearable style="width:350px;" filterable="true">
  101. <el-option v-for="item in hasReportUserList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  102. </el-select>
  103. </el-form-item>
  104. <el-form-item prop="projectId" :label="user.timeType.fixMonthcost==0?$t('time.dateRange'):$t('Selectmonth')">
  105. <el-date-picker v-show="user.timeType.fixMonthcost==0"
  106. v-model="exportParam.dateRange" :editable="false"
  107. format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  108. :clearable="false"
  109. :range-separator="$t('other.to')"
  110. type="daterange"
  111. :start-placeholder="$t('time.startDate')"
  112. :end-placeholder="$t('time.endDate')"
  113. ></el-date-picker>
  114. <el-date-picker v-show="user.timeType.fixMonthcost==1"
  115. v-model="dateRange" :editable="false"
  116. format="yyyy-MM" value-format="yyyy-MM"
  117. @change="getEchart"
  118. :clearable="true"
  119. type="month"
  120. ></el-date-picker>
  121. </el-form-item>
  122. <el-form-item :label="$t('screening.selectPeople')" v-if="radio == $t('other.project') || radio == $t('projectclassification')">
  123. <el-select v-model="exportParam.userId" :placeholder="$t('lable.allStaff')" style="width: 350px" filterable="true" clearable="true">
  124. <span v-for="(item, index) in users" :key="index">
  125. <el-option :label="item.name" :value="item.id"></el-option>
  126. </span>
  127. </el-select>
  128. </el-form-item>
  129. <el-form-item prop="type" :label="$t('choosethestyle')" v-if="radio == $t('other.project') || radio == $t('projectclassification')">
  130. <el-select v-model="exportParam.type" :placeholder="$t('choosethestyle')" style="width:350px;" >
  131. <el-option :label="radio == $t('projectclassification') ? $t('classifiedontheline') : $t('Itemontheline')" value="0"></el-option>
  132. <el-option :label="radio == $t('projectclassification') ? $t('classifiedcolumns') : $t('itemisonthecolumn')" value="1"></el-option>
  133. </el-select>
  134. <div class="prompt">
  135. <el-popover placement="top" width="1200" trigger="hover">
  136. <img src="../../assets/image/hanglie.png" alt="" width="100%" v-if="this.radio != $t('projectclassification')">
  137. <img src="../../assets/image/hanglie_corp.png" alt="" width="100%" v-else>
  138. <i class="el-icon-question" slot="reference" />
  139. </el-popover>
  140. </div>
  141. </el-form-item>
  142. <el-form-item v-if="(radio == $t('other.project') || radio == $t('projectclassification')) && exportParam.type == '0'">
  143. <el-checkbox v-model="exportParam.projectSum" >{{ $t('individualprojectdata') }}</el-checkbox>
  144. </el-form-item>
  145. </el-form>
  146. <div slot="footer" class="dialog-footer">
  147. <el-button type="primary" @click="exportProjectData" style="width:100%;" >{{ $t('export.export') }}</el-button>
  148. </div>
  149. </el-dialog>
  150. </section>
  151. </template>
  152. <script>
  153. import util from "../../common/js/util";
  154. export default {
  155. data() {
  156. return {
  157. allListData: [],
  158. page: 1,
  159. size: 50,
  160. total: 0,
  161. personnelValue: '',
  162. personnelAll: [],
  163. yAxisValue: localStorage.yAxisValue?localStorage.yAxisValue:0,
  164. parentDeptStack:[],
  165. parentDeptId:null,
  166. hasReportUserList:[],
  167. projectList:[],
  168. categoryList: [],
  169. exportParam:{projectId:null,dateRange:[],userId: null,type: '0'},
  170. exportDialog:false,
  171. dateRange:[],
  172. user: JSON.parse(sessionStorage.getItem("user")),
  173. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  174. radio: sessionStorage.radio!=null?sessionStorage.radio:this.$t('other.project'),
  175. containerHeight: 0,
  176. // myChart: null,
  177. params: null,
  178. widthHtval: document.body.clientWidth - 230,
  179. users: [],
  180. jichu: [],
  181. namess: '',
  182. timers: null, // 点击的时间
  183. zhishin: 0,
  184. theCustomList: [], // 自定义数据来源
  185. theCustomListFlg: false, // 判断是否点击的是自定义配置的数据来源
  186. theCustomListId: '',
  187. theCustomListPlantLIst: [],
  188. theCustomListPlant: '',
  189. customId: '',
  190. customName: '',
  191. customList: [],
  192. departmentList: []
  193. };
  194. },
  195. methods: {
  196. echartsCurrentChange(val){
  197. this.page = val
  198. // console.log('CurrentChange');
  199. if(this.radio == this.$t('ren-yuan')){
  200. this.gtff()
  201. }else{
  202. this.jieliu_echarts()
  203. }
  204. },
  205. //Y轴点击改变显示的数据
  206. onYAxisChange() {
  207. localStorage.yAxisValue = this.yAxisValue;
  208. this.jieliu();
  209. },
  210. jutishez() {
  211. this.http.post('/time-type/getCompanyTimeSetting', {
  212. companyId: this.user.companyId,
  213. },
  214. res => {
  215. if (res.code == "ok") {
  216. this.jichu = res.data
  217. if(res.data.customDegreeActive == 1) {
  218. this.namess = res.data.customDegreeName
  219. }
  220. } else {
  221. this.$message({
  222. message: res.msg,
  223. type: "error"
  224. });
  225. }
  226. },
  227. error => {
  228. this.$message({
  229. message: error,
  230. type: "error"
  231. });
  232. });
  233. },
  234. getUsers() {
  235. // console.log(this.port.manage.list)
  236. // this.http.post(this.port.manage.list, {
  237. // departmentId: -1,
  238. // pageIndex: 1,
  239. // // pageSize: 99999
  240. // pageSize: -1
  241. // },
  242. this.http.post('/user/getSimpleActiveUserList', {},
  243. res => {
  244. if (res.code == "ok") {
  245. this.users = res.data;
  246. } else {
  247. this.$message({
  248. message: res.msg,
  249. type: "error"
  250. });
  251. }
  252. },
  253. error => {
  254. this.$message({
  255. message: error,
  256. type: "error"
  257. });
  258. });
  259. },
  260. showExportDialog() {
  261. // console.log(12345)
  262. this.exportDialog = true;
  263. this.exportParam.dateRange = this.dateRange;
  264. // console.log(this.hasReportUserList)
  265. if (this.radio == this.$t('ren-yuan')) {
  266. // this.exportParam.userIds = [];
  267. }
  268. if (this.radio == this.$t('other.project')) {
  269. this.exportParam.deptId = []
  270. }
  271. },
  272. //获取我的项目列表
  273. getMyProjectList() {
  274. this.http.post('/project/getProjectList', {
  275. },
  276. res => {
  277. if (res.code == "ok") {
  278. this.projectList = res.data;
  279. } else {
  280. this.$message({
  281. message: res.msg,
  282. type: "error"
  283. });
  284. }
  285. },
  286. error => {
  287. this.$message({
  288. message: error,
  289. type: "error"
  290. });
  291. });
  292. },
  293. exportProjectData() {
  294. var param = {stateKey: 1};
  295. if (this.exportParam.dateRange != null) {
  296. param = {startDate:this.exportParam.dateRange[0], endDate: this.exportParam.dateRange[1],stateKey: 1};
  297. }
  298. var url = "/project/exportTimeCost";
  299. var fileName = this.$t('projectmanhourcoststatistics')+ '.xls';
  300. if (this.radio == this.$t('ren-yuan') ) {
  301. // console.log(this.exportParam.userIds);
  302. fileName = this.$t('labortimecoststatistics')+ '.xls';
  303. url = '/department/exportUserStatistic';
  304. if (this.exportParam.userIds != null && this.exportParam.userIds.length > 0) {
  305. var ids = '';
  306. this.exportParam.userIds.forEach(u=>{
  307. ids += u+',';
  308. })
  309. param.userIds = ids;
  310. }
  311. }
  312. if(this.radio == this.$t('projectclassification')){
  313. fileName = this.$t('projectclassificationlaborosttatistics')+ '.xls';
  314. url = '/project/exportTimeCostByCategory'
  315. if(this.exportParam.projectCategoryId){
  316. param.projectCategoryId = this.exportParam.projectCategoryId
  317. }
  318. }
  319. if(this.radio == this.$t('lable.department')){
  320. fileName = this.$t('departmenthourscoststatistics')+ '.xls'
  321. url = '/department/exportDeptStatistic'
  322. }
  323. if (this.exportParam.projectId && this.radio != this.$t('ren-yuan') && this.radio != this.$t('projectclassification')) {
  324. param.projectId = this.exportParam.projectId;
  325. }
  326. if (this.exportParam.userId) {
  327. if(this.radio == this.$t('other.project') || this.radio == this.$t('lable.department') || this.radio == this.$t('ren-yuan') || this.radio == this.$t('projectclassification')){
  328. param.userId = this.exportParam.userId;
  329. }
  330. }
  331. if (this.exportParam.type == 1) {
  332. this.exportParam.projectSum = null
  333. }
  334. if (this.exportParam.projectSum != null) {
  335. if(this.radio == this.$t('other.project') || this.radio == this.$t('lable.department') || this.radio == this.$t('projectclassification')){
  336. param.projectSum = this.exportParam.projectSum;
  337. }
  338. }
  339. if(!this.theCustomListFlg) {
  340. param.type = this.exportParam.type*1
  341. }
  342. if(this.theCustomListFlg) {
  343. url = '/project/exportTimeCostByUserCustom'
  344. fileName = this.radio + this.$t('statistical') + '.xls'
  345. // param.subCustomName = this.customName
  346. param.customId = this.theCustomListId
  347. param.fieldName = this.theCustomListPlant
  348. }
  349. if(this.exportParam.deptId) {
  350. if(this.exportParam.deptId.length > 0) {
  351. param.deptId = this.exportParam.deptId[this.exportParam.deptId.length - 1]
  352. }
  353. }
  354. this.http.post(url, param,
  355. res => {
  356. this.listLoading = false;
  357. if (res.code == "ok") {
  358. this.exportDialog = false;
  359. var aTag = document.createElement('a');
  360. aTag.download = fileName;
  361. aTag.href = res.data;
  362. aTag.click();
  363. } else {
  364. this.$message({
  365. message: res.msg,
  366. type: "error"
  367. });
  368. }
  369. },
  370. error => {
  371. this.listLoading = false;
  372. this.$message({
  373. message: error,
  374. type: "error"
  375. });
  376. });
  377. },
  378. // 人员筛选
  379. personnel() {
  380. this.page = 1
  381. if(this.personnelValue) {
  382. var arrlist = JSON.parse(JSON.stringify(this.personnelAll))
  383. var arr = []
  384. for(var i in arrlist.list) {
  385. if(arrlist.list[i].name == this.personnelValue) {
  386. arr.push(arrlist.list[i])
  387. }
  388. }
  389. arrlist.list = arr
  390. this.allListData = arrlist
  391. this.gtff()
  392. } else {
  393. this.allListData = this.personnelAll
  394. this.gtff()
  395. }
  396. },
  397. //获取人员成本统计列表
  398. getUserCostList() {
  399. this.listLoading = true;
  400. // console.log(this.port.project.userCost, '获取人员成本统计列表')
  401. // console.log(this.user.timeType.fixMonthcost)
  402. // console.log(Boolean(this.dateRange))
  403. let startDateNum = ''
  404. let endDateNum = ''
  405. if(this.dateRange) {
  406. startDateNum = this.user.timeType.fixMonthcost==0?this.dateRange[0]:this.dateRange
  407. endDateNum = this.user.timeType.fixMonthcost==0?this.dateRange[1]:this.dateRange
  408. }
  409. // return
  410. this.http.post(this.port.project.userCost, {
  411. // startDate:this.user.timeType.fixMonthcost==0?this.dateRange[0]:this.dateRange,
  412. // endDate: this.user.timeType.fixMonthcost==0?this.dateRange[1]:this.dateRange
  413. startDate: startDateNum,
  414. endDate: endDateNum
  415. },
  416. res => {
  417. this.listLoading = false;
  418. var _this = this;
  419. this.hasReportUserList = [];
  420. if (res.code == "ok") {
  421. //
  422. //
  423. this.personnelAll = res.data
  424. this.allListData = res.data
  425. this.gtff()
  426. } else {
  427. this.$message({
  428. message: res.msg,
  429. type: "error"
  430. });
  431. }
  432. },
  433. error => {
  434. this.listLoading = false;
  435. this.$message({
  436. message: error,
  437. type: "error"
  438. });
  439. });
  440. },
  441. // 共同方法
  442. gtff() {
  443. let data = this.allListData
  444. var _this = this;
  445. this.hasReportUserList = data.userList;
  446. this.total = data.list.length
  447. var xList = [] , yList = [] , list = data.list.slice(0+50*(this.page-1),49+50*(this.page-1)), array = [] , series = [];
  448. var totalMoneyCost = data.totalCostMoney;
  449. var totalHours = 0.0;
  450. for(var i in list) {
  451. if(i>20) {
  452. this.widthHtval = +this.widthHtval + 60
  453. } else {
  454. this.widthHtval = document.body.clientWidth - 230
  455. }
  456. }
  457. if (list.length > 0) {
  458. var num = list.length==0?0:list[0].project.length;
  459. // console.log('for 1');
  460. for(var i in list) {
  461. xList.push(list[i].name);
  462. var pro = list[i].project;
  463. for(var j in pro) {
  464. if(array.indexOf(pro[j].project) == -1) {
  465. array.push(pro[j].project)
  466. }
  467. }
  468. }
  469. // console.log('for 2');
  470. for(var i in array) {
  471. yList.push(array[i]);
  472. var dataList = [];
  473. // console.log('for 2 1');
  474. for(var j in list) {
  475. var project = list[j].project , num = 0;
  476. if(project.length != 0) {
  477. // console.log('for 2 1 1');
  478. for(var k in project) {
  479. if(project[k].project == array[i]) {
  480. let item = {
  481. "value": this.yAxisValue==0?project[k].money:project[k].time,
  482. }
  483. if(this.permissions.countCost){
  484. item.money = project[k].money
  485. }
  486. if(this.permissions.countHours){
  487. item.cost = project[k].time
  488. totalHours += parseFloat(project[k].time);
  489. }
  490. dataList.push(item)
  491. } else {
  492. num++;
  493. }
  494. if(k == project.length-1 && num != project.length-1) {
  495. dataList.push({
  496. "value": 0,
  497. "cost": 0,
  498. "money":0,
  499. })
  500. }
  501. }
  502. } else {
  503. dataList.push({
  504. "value": 0,
  505. "cost": 0,
  506. "money":0,
  507. })
  508. }
  509. }
  510. series.push({
  511. name: array[i],
  512. type: 'bar',
  513. stack:'1',
  514. barMaxWidth: 30,
  515. data: dataList,
  516. })
  517. }
  518. }
  519. var myChart = echarts.init(document.getElementById("container"));
  520. totalHours = totalHours.toFixed(1);
  521. // 设置宽度
  522. myChart.resize({
  523. width: this.widthHtval
  524. })
  525. // console.log('设置宽度');
  526. // 设置宽度
  527. _this.myChart = myChart;
  528. var option = {
  529. //总成本
  530. title: {
  531. // text: '工时成本总计' + totalMoneyCost.toFixed(2) + '元, 时长'+totalHours+'小时',
  532. text: this.$t('otalhourscost')+ ':' +
  533. ((this.permissions.countCost) ? this.$t('costof') + ' ' + totalMoneyCost.toFixed(2) + ' ' + this.$t('yuan') + ',' : '') +
  534. ((this.permissions.countHours) ? this.$t('time.duration') + ' ' +totalHours + ' ' + this.$t('time.hour') : ''),
  535. left:'left',
  536. },
  537. // 工具箱
  538. legend: {
  539. x: 80,
  540. y: 10,
  541. data: yList,
  542. show: true,
  543.       top:"5%",//与上方的距离 可百分比% 可像素px
  544. },
  545. grid : {
  546. top : 80, //距离容器上边界40像素
  547. // bottom: 100, //距离容器下边界30像素
  548. bottom: 35, //距离容器下边界30像素
  549. left: 150,
  550. right: 150
  551. },
  552. toolbox: {
  553. show: true,
  554. feature:{
  555. saveAsImage:{
  556. show:true
  557. },
  558. restore:{
  559. show:true
  560. },
  561. // dataView:{
  562. // show:true
  563. // },
  564. // dataZoom:{
  565. // show:true
  566. // },
  567. magicType:{
  568. type:['line','bar']
  569. }
  570. }
  571. },
  572. tooltip:{
  573. trigger:'axis',
  574. formatter: function (params,ticket,callback) {
  575. var totalTime = 0;
  576. var totalCost = 0;
  577. var res = "";
  578. for(var i in params) {
  579. if (params[i].data.value > 0) {
  580. res += "<div style='margin-top:3px;font-size:12px;'><font color='#ddd'>" + _this.$t('headerTop.projectName') + ":" + params[i].seriesName
  581. + "</font><br/>" +
  582. ((_this.permissions.countCost) ? _this.$t('workcost')+ ":" + params[i].data.money + _this.$t('yuan') + "</br>" : '') +
  583. ((_this.permissions.countHours) ? _this.$t('screening.workTime') + ":" + params[i].data.cost + _this.$t('time.hour') + "</br>" : '') + "</div>";
  584. totalTime += Number(params[i].data.cost);
  585. totalCost += Number(params[i].data.money);
  586. }
  587. }
  588. res = res +'<br/>'+ params[0].name+ '<br/>' + _this.$t('zong-ji') + ':' +
  589. ((_this.permissions.countHours) ? totalTime.toFixed(1) + _this.$t('time.hour') : '') +
  590. ((_this.permissions.countCost) ? totalCost.toFixed(2) + _this.$t('yuan') : '') +
  591. "<br/>";
  592. return res;
  593. }
  594. },
  595. xAxis: {
  596. data: xList,
  597. axisLabel: {
  598. interval:0,rotate:20
  599. }
  600. },
  601. yAxis: [{
  602. type : 'value',
  603. axisLabel: {
  604. formatter:this.yAxisValue==0?'{value} ('+this.$t('yuan')+')':'{value} ('+this.$t('time.hour')+')'
  605. // formatter:this.yAxisValue==0?'{value} (元)':'{value} (小时)'
  606. }
  607. }],
  608. series: series,
  609. };
  610. // console.log('setoption');
  611. myChart.setOption(option,{notMerge:true});
  612. },
  613. yanjiu() {
  614. // console.log('触发')
  615. },
  616. getEchart(e){
  617. var that = this
  618. // 更具选中的名字筛选出对应的自定义id
  619. that.theCustomListFlg = false
  620. let ints = null
  621. for(var i in that.theCustomList) {
  622. if(that.radio == that.theCustomList[i].name) {
  623. that.theCustomListId = that.theCustomList[i].id
  624. that.theCustomListPlant = that.theCustomListPlantLIst[i]
  625. that.theCustomListFlg = true
  626. ints = i
  627. }
  628. }
  629. if(that.theCustomListFlg) {
  630. that.customList = that.theCustomList[ints].subUserCustomList
  631. that.customName = that.theCustomList[ints].subUserCustomList[0].name
  632. // that.getCusTom()
  633. }
  634. that.jieliu()
  635. },
  636. getCusTom() {
  637. this.http.post('/sub-user-custom/list',{
  638. userCustomId: this.theCustomListId
  639. },res => {
  640. if(res.code == 'ok'){
  641. this.customList = res.data
  642. this.customName = res.data[0].name
  643. }else {
  644. this.$message({
  645. message: res.msg,
  646. type: 'error'
  647. })
  648. }
  649. },error => {
  650. this.$message({
  651. message: error,
  652. type: 'error'
  653. })
  654. })
  655. },
  656. getCategoryList(){
  657. this.http.post('/project-category/list',{},
  658. res => {
  659. if(res.code == 'ok'){
  660. this.categoryList = res.data
  661. }else {
  662. this.$message({
  663. message: res.msg,
  664. type: 'error'
  665. })
  666. }
  667. },err => {
  668. this.$message({
  669. message: err,
  670. type: 'error'
  671. })
  672. })
  673. },
  674. backToParentDept() {
  675. if (this.radio == this.$t('lable.department')) {
  676. if (this.parentDeptStack.length > 0) {
  677. this.parentDeptStack.pop();
  678. if (this.parentDeptStack.length > 0) {
  679. this.parentDeptId = this.parentDeptStack[this.parentDeptStack.length -1];
  680. } else {
  681. this.parentDeptId = null;
  682. }
  683. this.jieliu();
  684. }
  685. }
  686. },
  687. // 脱离出来的方法
  688. jieliu() {
  689. sessionStorage.radio = this.radio;
  690. var param = {};
  691. if (this.dateRange != null) {
  692. param = {
  693. startDate:this.user.timeType.fixMonthcost==0?this.dateRange[0]:this.dateRange,
  694. endDate: this.user.timeType.fixMonthcost==0?this.dateRange[1]:this.dateRange
  695. };
  696. // console.log(param);
  697. }
  698. var url = '';
  699. if (this.radio==this.$t('other.project')) {
  700. url = this.port.project.listCost;
  701. }else if(this.radio == this.$t('zhu-xiang-mu')){
  702. url = '/project/getTimeCostByMainProject'
  703. // param.userId = this.user.id
  704. }else if (this.radio==this.$t('projectclassification')) {
  705. url = '/project/getTimeCostByCategory';
  706. // param.parentDeptId = this.parentDeptId;
  707. // param.userId = this.user.id
  708. } else if (this.radio==this.$t('lable.department')) {
  709. url = this.port.project.depCost;
  710. param.parentDeptId = this.parentDeptId;
  711. } else if (this.radio==this.$t('ren-yuan')) {
  712. this.getUserCostList();
  713. return;
  714. } else if (this.radio == this.namess) {
  715. url = '/project/getDegreeCost'
  716. } else if (this.theCustomListFlg) {
  717. url = '/project/getTimeCostByUserCustom'
  718. // param.subCustomName = this.customName
  719. param.customId = this.theCustomListId
  720. param.fieldName = this.theCustomListPlant
  721. // console.log(param, '要传的数据')
  722. }
  723. this.http.post(url, param,
  724. res => {
  725. if (res.code == "ok") {
  726. this.allListData = res.data
  727. this.page = 1
  728. this.jieliu_echarts()
  729. } else {
  730. this.$message({
  731. message: res.msg,
  732. type: "error"
  733. });
  734. }
  735. },
  736. error => {
  737. this.$message({
  738. message: error,
  739. type: "error"
  740. });
  741. });
  742. },
  743. jieliu_echarts(){
  744. var _this = this;
  745. // 更具数据的长度去加每个柱子的间距
  746. var xList = []
  747. var yList = []
  748. var list
  749. var totalMoneyCost;
  750. var totalHours = 0.0;
  751. if(this.radio == this.$t('other.project') || this.radio == this.$t('projectclassification') || this.radio==this.$t('lable.department') || this.radio == this.$t('zhu-xiang-mu')) {
  752. // this.allListData = res.data.costList
  753. this.total = this.allListData.costList.length
  754. list = this.allListData.costList.slice(0+50*(this.page-1),49+50*(this.page-1))
  755. for(var i in list) {
  756. if(i>20) {
  757. this.widthHtval = +this.widthHtval + 60
  758. } else {
  759. this.widthHtval = document.body.clientWidth - 230
  760. }
  761. }
  762. // list = res.data.costList
  763. totalMoneyCost = ((this.radio==this.$t('other.project') || this.radio == this.$t('projectclassification'))?this.allListData.totalMoneyCost:this.allListData.totalCostMoney);
  764. for(var i in list) {
  765. if(this.radio==this.$t('other.project') || this.radio == this.$t('zhu-xiang-mu')) {
  766. if(this.radio == this.$t('other.project')){
  767. xList.push(list[i].project);
  768. }else{
  769. xList.push(list[i].mainProjectName);
  770. }
  771. let item = {
  772. "value": this.yAxisValue==0?(list[i].costMoney ? list[i].costMoney.toFixed(2) : 0) || list[i].costMoney:(list[i].cost ? list[i].cost.toFixed(1) : 0),
  773. "id": list[i].id || i,
  774. }
  775. if(this.permissions.countCost){
  776. // item.money = list[i].costMoney.toFixed(2)
  777. item.money = (list[i].costMoney ? list[i].costMoney.toFixed(2) : 0)
  778. }
  779. if(this.permissions.countHours){
  780. item.cost = list[i].cost
  781. totalHours += parseFloat(list[i].cost);
  782. }
  783. yList.push(item);
  784. } else if(this.radio == this.$t('lable.department')){
  785. xList.push(list[i].departmentName);
  786. let item = {
  787. // "value": this.yAxisValue==0 ? list[i].costMoney.toFixed(2) || list[i].costMoney: list[i].costTime.toFixed(1),
  788. "value": this.yAxisValue==0 ? (list[i].costMoney ? list[i].costMoney.toFixed(2) : 0) || list[i].costMoney: (list[i].costTime ? list[i].costTime.toFixed(1) : 0),
  789. "id": list[i].departmentId,
  790. "hasSubDept": list[i].hasSubDept
  791. }
  792. if(this.permissions.countCost){
  793. // item.money = list[i].costMoney.toFixed(2)
  794. item.money = (list[i].costMoney ? list[i].costMoney.toFixed(2) : 0)
  795. }
  796. if(this.permissions.countHours){
  797. item.cost = list[i].costTime
  798. totalHours += parseFloat(list[i].costTime);
  799. }
  800. yList.push(item);
  801. }else {
  802. xList.push(list[i].categoryName);
  803. let item = {
  804. // "value": this.yAxisValue==0?list[i].costMoney.toFixed(2) || list[i].costMoney:list[i].cost.toFixed(1),
  805. "value": this.yAxisValue==0?(list[i].costMoney ? list[i].costMoney.toFixed(2) : 0) || list[i].costMoney:(list[i].cost ? list[i].cost.toFixed(1) : 0),
  806. "id": list[i].id || i,
  807. }
  808. if(this.permissions.countCost){
  809. // item.money = list[i].costMoney.toFixed(2)
  810. item.money = (list[i].costMoney ? list[i].costMoney.toFixed(2) : 0)
  811. }
  812. if(this.permissions.countHours){
  813. item.cost = list[i].cost
  814. totalHours += parseFloat(list[i].cost);
  815. }
  816. yList.push(item);
  817. }
  818. }
  819. }
  820. else if(this.theCustomListFlg) {
  821. // this.allListData = res.data.list
  822. this.total = this.allListData.list.length
  823. list = this.allListData.list.slice(0+50*(this.page-1),49+50*(this.page-1))
  824. // list = res.data.list
  825. for(var i in list) {
  826. // console.log(list[i].name, list[i].costMoney, list[i].cost)
  827. xList.push(list[i].name);
  828. let item = {
  829. "value": this.yAxisValue==0?list[i].costMoney:list[i].cost,
  830. "id": list[i].id || i,
  831. }
  832. if(this.permissions.countCost){
  833. // item.money = list[i].costMoney.toFixed(2)
  834. item.money = list[i].costMoney ? list[i].costMoney.toFixed(2) : 0
  835. totalMoneyCost += parseFloat(list[i].costMoney);
  836. }
  837. if(this.permissions.countHours){
  838. item.cost = list[i].cost
  839. totalHours += parseFloat(list[i].cost);
  840. }
  841. yList.push(item);
  842. }
  843. }
  844. else {
  845. // list = res.data
  846. // this.allListData = res.data
  847. this.total = this.allListData.length
  848. list = this.allListData.slice(0+50*(this.page-1),49+50*(this.page-1))
  849. for(var i in list) {
  850. // console.log(list[i].name, list[i].costMoney, list[i].cost)
  851. xList.push(list[i].name);
  852. let item = {
  853. "value": this.yAxisValue==0?list[i].costMoney:list[i].cost,
  854. "id": list[i].id || i,
  855. }
  856. if(this.permissions.countCost){
  857. // item.money = list[i].costMoney.toFixed(2)
  858. item.money = list[i].costMoney ? list[i].costMoney.toFixed(2) : 0
  859. totalMoneyCost += parseFloat(list[i].costMoney);
  860. }
  861. if(this.permissions.countHours){
  862. item.cost = list[i].cost
  863. totalHours += parseFloat(list[i].cost);
  864. }
  865. yList.push(item);
  866. }
  867. }
  868. totalHours = totalHours.toFixed(1);
  869. var myChart = echarts.init(document.getElementById("container"));
  870. myChart.resize({
  871. width: this.widthHtval
  872. })
  873. _this.myChart = myChart;
  874. // console.log(totalMoneyCost.toFixed(2), '看看', totalMoneyCost)
  875. // var chengbentongji = totalMoneyCost.toFixed(2) || totalMoneyCost
  876. if(totalMoneyCost) {
  877. this.zhishin = totalMoneyCost.toFixed(2)
  878. }
  879. if(this.radio == this.$t('other.project') || this.radio == this.$t('zhu-xiang-mu') || this.radio == this.$t('ren-yuan') || this.radio == this.$t('projectclassification') || this.radio==this.$t('lable.department')) {
  880. var option = {
  881. title: {
  882. text: this.$t('otalhourscost') + ':' + ((this.permissions.countCost) ? this.$t('costof') + ' ' + this.zhishin + ' ' +this.$t('yuan') + ',' : '') + ((this.permissions.countHours) ? this.$t('time.duration') + ' ' +totalHours+ ' ' +this.$t('time.hour') : ''),
  883. left:'left',
  884. },
  885. // 工具箱
  886. toolbox: {
  887. show: true,
  888. feature:{
  889. saveAsImage:{show:true},restore:{show:true}, magicType:{ type:['line','bar']},
  890. }
  891. },
  892. tooltip:{
  893. trigger:'axis',
  894. formatter: function (params,ticket,callback) {
  895. _this.params = params;
  896. var res = params[0].name + "<br/>" +
  897. ((_this.permissions.countCost) ? _this.$t('workcost')+" : " + params[0].data.money
  898. + _this.$t('yuan')+"<br/>" : '') +
  899. ((_this.permissions.countHours) ? _this.$t('screening.workTime')+" : " + params[0].data.cost + _this.$t('time.hour') : '');
  900. // console.log(res, '将要渲染的数据')
  901. return res;
  902. }
  903. // trigger:'axis',
  904. // formatter: function (params,ticket,callback) {
  905. // _this.params = params;
  906. // var res = params[0].name + "<br/>" +
  907. // ((_this.permissions.countCost) ? "工作成本"+" : " + params[0].data.money
  908. // + "元 <br/>" : '') +
  909. // ((_this.permissions.countHours) ? "工作时长"+" : " + params[0].data.cost + "小时" : '');
  910. // return res;
  911. // }
  912. },
  913. xAxis: {
  914. data: xList,
  915. axisLabel: {
  916. interval:0,rotate:20
  917. }
  918. },
  919. yAxis: [{
  920. type : 'value',
  921. axisLabel: {
  922. formatter:this.yAxisValue==0?'{value} ('+this.$t('yuan')+')':'{value}'+this.$t('time.hour')
  923. }
  924. }],
  925. series: [{
  926. name: this.yAxisValue==0?this.$t('workcost')+'('+this.$t('yuan')+')':this.$t('screening.workTime')+'('+this.$t('time.hour')+')',
  927. type: 'bar',
  928. barMaxWidth: 30,
  929. data: yList,
  930. }],
  931. grid: {
  932. left: '100px',
  933. }
  934. };
  935. } else {
  936. var option = {
  937. title: {
  938. // text: '工时成本总计' + this.zhishin + '元, 时长'+totalHours+'小时',
  939. text: this.$t('otalhourscost')+ ':' + ((this.permissions.countCost) ? this.$t('costof') + ' ' + this.zhishin + ' ' + this.$t('yuan')+ ',' : '') + ((this.permissions.countHours) ? this.$t('time.duration') + ' ' + totalHours + ' ' + this.$t('time.hour') : ''),
  940. left:'left',
  941. },
  942. // 工具箱
  943. toolbox: {
  944. show: true,
  945. feature:{
  946. saveAsImage:{show:true},restore:{show:true}, magicType:{ type:['line','bar']},
  947. }
  948. },
  949. tooltip:{
  950. trigger:'axis',
  951. formatter: function (params,ticket,callback) {
  952. var res = params[0].name + "<br/>" +
  953. ((_this.permissions.countCost) ? _this.$t('workcost')+" : " + params[0].data.money
  954. + _this.$t('yuan')+"<br/>" : '') +
  955. ((_this.permissions.countHours) ? _this.$t('screening.workTime')+" : " + params[0].data.cost + _this.$t('time.hour') : '');
  956. _this.params = params;
  957. return res;
  958. }
  959. },
  960. xAxis: {
  961. data: xList,
  962. axisLabel: {
  963. interval:0,rotate:20
  964. }
  965. },
  966. yAxis: [{
  967. type : 'value',
  968. axisLabel: {
  969. formatter:this.yAxisValue==0?'{value} ('+this.$t('yuan')+')':'{value}'+this.$t('time.hour')
  970. }
  971. }],
  972. series: [{
  973. name: this.yAxisValue==0?this.$t('workcost')+'('+this.$t('yuan')+')':this.$t('screening.workTime')+'('+this.$t('time.hour')+')',
  974. type: 'bar',
  975. barMaxWidth: 30,
  976. data: yList,
  977. }],
  978. grid: {
  979. left: '100px',
  980. }
  981. };
  982. }
  983. myChart.setOption(option,{notMerge: true});
  984. myChart.getZr().on('click', params => {
  985. const pointInPixel = [params.offsetX, params.offsetY];
  986. if (myChart.containPixel('grid', pointInPixel)) {
  987. // console.log(_this.params)
  988. if(_this.radio==this.$t('other.project')) {
  989. if (_this.dateRange != null) {
  990. if (this.user.timeType.fixMonthcost == 0) {
  991. _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name
  992. +"?startDate="+_this.dateRange[0]+"&endDate="+_this.dateRange[1]);
  993. } else {
  994. _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name
  995. +"?startDate="+_this.dateRange+"&endDate="+_this.dateRange);
  996. }
  997. } else {
  998. _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
  999. }
  1000. } else if (_this.radio==this.$t('lable.department')) {
  1001. if (_this.params[0].data.hasSubDept) {
  1002. if (_this.parentDeptId != _this.params[0].data.id) {
  1003. _this.parentDeptId = _this.params[0].data.id;
  1004. _this.parentDeptStack.push(_this.parentDeptId);
  1005. _this.jieliu();
  1006. }
  1007. // _this.jieliu();
  1008. } else {
  1009. if (_this.dateRange != null) {
  1010. _this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name
  1011. +"?startDate="+_this.dateRange[0]+"&endDate="+_this.dateRange[1]);
  1012. } else {
  1013. _this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name);
  1014. }
  1015. }
  1016. }
  1017. }
  1018. });
  1019. },
  1020. // 左右滚动
  1021. scrollFunction () {
  1022. this.domObj = document.getElementById('clearfix') // 通过id获取要设置的div
  1023. if (this.domObj.attachEvent) { // IE
  1024. this.domObj.attachEvent('onmousewheel', this.mouseScroll)
  1025. } else if (this.domObj.addEventListener) {
  1026. this.domObj.addEventListener('DOMMouseScroll', this.mouseScroll, false)
  1027. }
  1028. this.domObj.onmousewheel = this.domObj.onmousewheel = this.mouseScroll
  1029. },
  1030. mouseScroll(event) { // google 浏览器下
  1031. let detail = event.wheelDelta || event.detail
  1032. let moveForwardStep = -1
  1033. let moveBackStep = 1
  1034. let step = 0
  1035. step = detail > 0 ? moveForwardStep * 100 : moveBackStep * 100
  1036. event.preventDefault() // 阻止浏览器默认事件
  1037. this.domObj.scrollLeft = this.domObj.scrollLeft + step
  1038. },
  1039. // 判断后端给的字段
  1040. // 获取自定义
  1041. getZDY() {
  1042. this.http.post('/user-custom/getUserCustomTitle',{},res => {
  1043. if(res.code == 'ok'){
  1044. // console.log(res, '数据来源')
  1045. this.theCustomList = res.data.result
  1046. this.theCustomListPlantLIst = res.data.field
  1047. }else {
  1048. this.$message({
  1049. message: res.msg,
  1050. type: 'error'
  1051. })
  1052. }
  1053. },error => {
  1054. this.$message({
  1055. message: error,
  1056. type: 'error'
  1057. })
  1058. })
  1059. },
  1060. // 获取部门
  1061. getDepartmentList() {
  1062. this.http.post( this.port.manage.depList, {},
  1063. res => {
  1064. if (res.code == "ok") {
  1065. let dptlist = JSON.parse(JSON.stringify(res.data));
  1066. this.departmentList = this.changeArr(dptlist);
  1067. } else {
  1068. this.$message({
  1069. message: res.msg,
  1070. type: "error"
  1071. });
  1072. }
  1073. },error => {
  1074. this.$message({
  1075. message: error,
  1076. type: "error"
  1077. });
  1078. });
  1079. },
  1080. changeArr(arr) {
  1081. for (var i = 0; i < arr.length; i++) {
  1082. if(arr[i].id != -1 && arr[i].id != 0) {
  1083. if (arr[i].children != null && arr[i].children.length>0) {
  1084. arr[i].children = this.changeArr(arr[i].children);
  1085. }
  1086. arr[i].id && (arr[i].value = arr[i].id);
  1087. delete arr[i].id;
  1088. }
  1089. }
  1090. for(var i in arr) {
  1091. if(arr[i].id == -1 || arr[i].id == 0) {
  1092. arr.splice(i,1)
  1093. }
  1094. }
  1095. return arr;
  1096. },
  1097. },
  1098. created() {
  1099. this.myChart = null
  1100. },
  1101. mounted() {
  1102. this.containerHeight = window.innerHeight - 200
  1103. // this.containerHeight = window.innerHeight - 130
  1104. const that = this;
  1105. window.onresize = function temp() {
  1106. this.containerHeight = window.innerHeight - 130
  1107. // this.containerHeight = window.innerHeight - 200
  1108. };
  1109. if(this.permissions.countCost){
  1110. this.yAxisValue = '0'
  1111. }else{
  1112. this.yAxisValue = '1'
  1113. }
  1114. if (this.user.timeType.fixMonthcost == 0) {
  1115. if (this.$route.query.startDate != null) {
  1116. this.dateRange = [this.$route.query.startDate, this.$route.query.endDate];
  1117. } else {
  1118. //默认查看本月
  1119. var now = new Date();
  1120. var t = util.formatDate.format(now, 'yyyy-MM-dd');
  1121. var startStr = util.formatDate.format(new Date(), 'yyyy-MM') + "-01";
  1122. this.dateRange = [startStr,t];
  1123. }
  1124. this.exportParam.dateRange = this.dateRange;
  1125. } else if (this.user.timeType.fixMonthcost == 1) {
  1126. if (this.$route.query.startDate != null) {
  1127. this.dateRange = this.$route.query.startDate;
  1128. } else {
  1129. //默认查看本月
  1130. var startStr = util.formatDate.format(new Date(), 'yyyy-MM');
  1131. this.dateRange = startStr;
  1132. }
  1133. this.exportParam.dateRange = this.dateRange;
  1134. }
  1135. this.radio = this.$t('other.project')
  1136. this.getEchart();
  1137. var _this = this;
  1138. window.addEventListener("resize", function() {
  1139. _this.myChart.resize();
  1140. });
  1141. // this.getDepartment();
  1142. this.getMyProjectList();
  1143. this.getUsers()
  1144. this.jutishez()
  1145. this.scrollFunction()
  1146. // 判断
  1147. if(this.user.timeType.userCustomStatic) {
  1148. this.getZDY()
  1149. }
  1150. this.getDepartmentList()
  1151. },
  1152. beforeDestroy () {
  1153. var myChart = echarts.init(document.getElementById("container"));
  1154. myChart.clear()
  1155. },
  1156. };
  1157. </script>
  1158. <style lang="scss" scoped>
  1159. #container {
  1160. // display: inline-block;
  1161. display: block;
  1162. position: absolute;
  1163. // width: 100% !important;
  1164. margin-top: 60px;
  1165. }
  1166. .ryuans {
  1167. top: -50px;
  1168. }
  1169. .prompt {
  1170. position: absolute;
  1171. right: 10px;
  1172. top: 0;
  1173. }
  1174. .poss {
  1175. position: fixed;
  1176. bottom: -10px;
  1177. right: 1%;
  1178. box-sizing: border-box;
  1179. }
  1180. </style>
  1181. <style lang="scss">
  1182. </style>