summary.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802
  1. <template>
  2. <div :style="'padding:10px;background:#f7f7f7;min-height:' + tableHeight + 'px;'">
  3. <div style="margin: 0 auto;width:1120px;">
  4. <!-- <label>项目统计</label> -->
  5. <el-row :gutter="10">
  6. <!-- 任务数量总计 -->
  7. <el-col :span="12">
  8. <div class="box">
  9. <div>
  10. <div class="lableTxt">{{ $t('projectoverviewtable') }}</div>
  11. <el-divider></el-divider>
  12. <el-row :gutter="10">
  13. <el-col :span="6" style="text-align:center;">
  14. <p style="color:#666;font-size:12px;">{{ $t('all') }}</p>
  15. <p style="font-size:28px;font-weight:bold;color:black;">{{ taskSum.total }}</p>
  16. </el-col>
  17. <el-col :span="6" style="text-align:center;">
  18. <p style="color:#666;font-size:12px;">{{ $t('state.completed') }}</p>
  19. <p style="font-size:28px;font-weight:bold;color:green;">{{ taskSum.finishCount }}</p>
  20. </el-col>
  21. <el-col :span="6" style="text-align:center;">
  22. <p style="color:#666;font-size:12px;">{{ $t('wei-wan-cheng') }}</p>
  23. <p style="font-size:28px;color:blue;font-weight:bold;">{{ taskSum.unfinishCount }}</p>
  24. </el-col>
  25. <el-col :span="6" style="text-align:center;">
  26. <p style="color:#666;font-size:12px;">{{ $t('yi-yu-qi') }}</p>
  27. <p style="font-size:28px;color:red;font-weight:bold;">{{ taskSum.timeupCount }}</p>
  28. </el-col>
  29. </el-row>
  30. <el-row :gutter="10">
  31. <el-col :span="6" style="text-align:center;">
  32. <p style="color:#666;font-size:12px;">{{ $t('dai-ren-ling') }}</p>
  33. <p style="font-size:28px;color:#orange;font-weight:bold;">{{ taskSum.unassignCount }}</p>
  34. </el-col>
  35. <el-col :span="6" style="text-align:center;">
  36. <p style="color:#666;font-size:12px;">{{ $t('duetoday') }}</p>
  37. <p style="font-size:28px;font-weight:bold;color:pink;">{{ taskSum.todayTimeupCount }}</p>
  38. </el-col>
  39. <el-col :span="6" style="text-align:center;">
  40. <p style="color:#666;font-size:12px;">{{ $t('limittocomplete') }}</p>
  41. <p style="font-size:28px;font-weight:bold;color:gray;">{{ taskSum.timeupFinishCount }}</p>
  42. </el-col>
  43. <el-col :span="6" style="text-align:center;">
  44. <p style="color:#666;font-size:12px;">{{ $t('shi-jian-dai-ding') }}</p>
  45. <p style="font-size:28px;font-weight:bold;color:black;">{{ taskSum.timeunsetCount }}</p>
  46. </el-col>
  47. </el-row>
  48. </div>
  49. </div>
  50. </el-col>
  51. <el-col :span="12">
  52. <div class="box">
  53. <div class="lableTxt" style="display:flex;justify-content:space-between;align-items:center;">{{
  54. $t('distributionexecutors') }}
  55. <el-radio-group v-model="sumListRadio" size="mini" @change="sumRadioChange">
  56. <el-radio-button :label="$t('taskNum')"></el-radio-button>
  57. <el-radio-button :label="$t('plantime')"></el-radio-button>
  58. </el-radio-group>
  59. </div>
  60. <el-divider></el-divider>
  61. <div id="executorPanel" style="height:300px;width:500px;"></div>
  62. </div>
  63. </el-col>
  64. </el-row>
  65. <el-row :gutter="10">
  66. <el-col :span="12">
  67. <div class="box">
  68. <div class="lableTxt">{{ $t('consumingtask') }}</div>
  69. <el-divider></el-divider>
  70. <div id="costPanel" style="height:300px;width:500px;"></div>
  71. </div>
  72. </el-col>
  73. <el-col :span="12">
  74. <div class="box">
  75. <div class="lableTxt">{{ $t('statisticsbytasklist') }}</div>
  76. <el-divider></el-divider>
  77. <div id="stagesPanel" style="height:300px;width:500px;"></div>
  78. </div>
  79. </el-col>
  80. </el-row>
  81. <el-row :gutter="10">
  82. <el-col :span="24">
  83. <div class="boxEcharts" v-loading="departmentOptionLoading">
  84. <div class="lableTxt">
  85. {{ $t('actualworkinghours') }}
  86. <div class="lableTxtElm">
  87. <el-cascader v-if="user.userNameNeedTranslate != 1" v-model="departmentOptionValue"
  88. :placeholder="$t('defaultText.pleaseChoose')" style="width: 200px" :options="departmentOption"
  89. :props="{ checkStrictly: true, expandTrigger: 'hover' }" :show-all-levels="false"
  90. clearable @change="getTaskTimeCompare()" size="mini"></el-cascader>
  91. <vueCascader :size="'mini'" :widthStr="'200'" :clearable="true" :subject="departmentOption" :radios="false" :distinction="'1'" @vueCasader="vueCasader" v-if="user.userNameNeedTranslate == 1"></vueCascader>
  92. <el-link @click="exportTaskCompare" style="float:right;"><i
  93. class="iconfont firerock-iconexport"></i>{{ $t('export.export') }}</el-link>
  94. </div>
  95. </div>
  96. <el-divider></el-divider>
  97. <div id="taskTimeComparePanel" :style="`height: ${echartsHeight}px;width:1100px`"></div>
  98. <div class="dataPaging">
  99. <el-pagination
  100. @size-change="handleSizeChange"
  101. @current-change="handleCurrentChange"
  102. :current-page="dataPagingPage"
  103. :page-sizes="[5, 10, 15, 20, 30, 40]"
  104. :page-size="dataPagingSize"
  105. layout="total, sizes, prev, pager, next"
  106. :total="dataPagingTotal">
  107. </el-pagination>
  108. </div>
  109. </div>
  110. </el-col>
  111. </el-row>
  112. </div>
  113. </div>
  114. </template>
  115. <style scoped>
  116. #executorPanel {
  117. display: inline-block;
  118. width: 100%;
  119. }
  120. .el-divider--horizontal {
  121. margin: 10px 0;
  122. height: 0.5px;
  123. }
  124. .box {
  125. background: #fff;
  126. border: 1px solid #eeeeee;
  127. border-radius: 5px;
  128. padding: 10px;
  129. height: 303.7px;
  130. margin-top: 10px;
  131. }
  132. .boxEcharts {
  133. background: #fff;
  134. border: 1px solid #eeeeee;
  135. border-radius: 5px;
  136. padding: 10px;
  137. margin-top: 10px;
  138. }
  139. .info span {
  140. color: #303133;
  141. }
  142. .gray_label {
  143. color: #999 !important;
  144. }
  145. .el-row {
  146. margin-top: 10px;
  147. }
  148. .lableTxt {
  149. color: #666;
  150. display: flex;
  151. justify-content: space-between;
  152. align-items: center;
  153. }
  154. .lableTxtElm{
  155. display: flex;
  156. justify-content: space-between;
  157. align-items: center;
  158. min-width: 400px;
  159. }
  160. .dataPaging {
  161. width: 100%;
  162. display: flex;
  163. justify-content: flex-end;
  164. }
  165. </style>
  166. <script>
  167. import vueCascader from "@/components/cascader.vue"
  168. import cascaderOption from "@/components/cascaderOption.vue"
  169. import util from "../../common/js/util";
  170. export default {
  171. components: {
  172. vueCascader,
  173. cascaderOption
  174. },
  175. data() {
  176. return {
  177. compareChart: null,
  178. costChart: null,
  179. stagesChart: null,
  180. executorChart: null,
  181. pVisible: false,
  182. taskSum: {},
  183. users: [],
  184. importanceList: [{ id: 1, label: this.$t('yi-ban') }, { id: 2, label: this.$t('jin-ji') }, { id: 3, label: this.$t('zhong-yao') }, { id: 4, label: this.$t('zhong-yao-qie-jin-ji') }],
  185. //1-一般,2-紧急,3-重要,4-重要且紧急
  186. levelTxt: [this.$t('all'), this.$t('yi-ban'), this.$t('jin-ji'), this.$t('zhong-yao'), this.$t('zhong-yao-qie-jin-ji')],
  187. //1-进行中,2-已完成,3-已撤销
  188. statusTxt: [this.$t('all'), this.$t('ongoing'), this.$t('state.completed'), this.$t('state.undone')],
  189. addFolderDialog: false,
  190. upLoading: false,
  191. user: JSON.parse(sessionStorage.getItem("user")),
  192. addLoading: false,
  193. curProjectId: null,
  194. title: "",
  195. sumListRadio: this.$t('taskNum'),
  196. departmentOption: [], // 部门
  197. departmentOptionValue: '',
  198. echartsHeight: 500,
  199. departmentOptionLoading: false,
  200. dataPagingPage: 1,
  201. dataPagingSize: 10,
  202. dataPagingTotal: 0,
  203. dataPagingData: [],
  204. };
  205. },
  206. methods: {
  207. handleSizeChange(val) {
  208. this.dataPagingPage = 1
  209. this.dataPagingSize = val
  210. this.setTaskTimeCompare()
  211. },
  212. handleCurrentChange(val) {
  213. this.dataPagingPage = val
  214. this.setTaskTimeCompare()
  215. },
  216. setTaskTimeCompare() {
  217. this.departmentOptionLoading = true
  218. let newList = this.dataPagingData
  219. let list = newList.slice((this.dataPagingPage - 1) * this.dataPagingSize, this.dataPagingPage * this.dataPagingSize)
  220. this.taskTimeComparePublic(list)
  221. },
  222. taskTimeComparePublic(list) {
  223. var _this = this;
  224. var xList1 = [], xList2 = []
  225. if(list.length > 10) {
  226. this.echartsHeight = list.length * 60
  227. } else {
  228. this.echartsHeight = 500
  229. }
  230. var xList1 = [], xList2 = []
  231. if(list.length > 10) {
  232. this.echartsHeight = list.length * 60
  233. } else {
  234. this.echartsHeight = 500
  235. }
  236. setTimeout(() => {
  237. var taskNames = [];
  238. for (var i in list) {
  239. xList1.push({
  240. "value": list[i].workHours,
  241. "id": list[i].id,
  242. "fullName": list[i].name,
  243. });
  244. xList2.push({
  245. "value": list[i].planHours,
  246. "id": list[i].id,
  247. "fullName": list[i].name,
  248. });
  249. console.log(list[i], list[i].name)
  250. taskNames.push(list[i].name.length > 12 ? list[i].name.substring(0, 12) + '..' : list[i].name);
  251. }
  252. var myChart = echarts.init(document.getElementById("taskTimeComparePanel"));
  253. _this.compareChart = myChart;
  254. var option = {
  255. // 全局调色盘。
  256. color: ["#409EFF", "#71C671"],
  257. title: {
  258. show: list.length == 0,
  259. textStyle: {
  260. color: "#666666",
  261. fontSize: 18,
  262. fontWeight: 'normal',
  263. },
  264. text: list.length == 0 ? this.$t('nodata') : this.$t('gong-shi-dui-bi'),
  265. left: "center",
  266. top: "center"
  267. },
  268. toolbox: {
  269. right: 25,
  270. show: true,
  271. feature: {
  272. saveAsImage: {
  273. show: true
  274. },
  275. restore: {
  276. show: true
  277. },
  278. magicType: {
  279. type: ['line', 'bar']
  280. },
  281. }
  282. },
  283. legend: {
  284. data: [this.$t('shi-ji-gong-shi'), this.$t('plantime')]
  285. },
  286. grid: {
  287. left: '3%',
  288. right: '4%',
  289. bottom: '3%',
  290. containLabel: true
  291. },
  292. tooltip: {
  293. trigger: 'axis',
  294. axisPointer: {
  295. type: 'shadow'
  296. },
  297. },
  298. xAxis: {
  299. type: 'value',
  300. boundaryGap: [0, 1],
  301. axisLabel: {
  302. formatter: '{value} ' + this.$t('time.hour')
  303. }
  304. },
  305. yAxis: [{
  306. type: 'category',
  307. data: taskNames
  308. }],
  309. series: [{
  310. name: this.$t('shi-ji-gong-shi'),
  311. type: 'bar',
  312. data: xList1
  313. },
  314. {
  315. name: this.$t('plantime'),
  316. type: 'bar',
  317. data: xList2
  318. }]
  319. };
  320. myChart.setOption(option, { notMerge: true });
  321. this.$nextTick(() => {
  322. myChart.resize(); // 在DOM更新后,调用resize方法更新图表大小
  323. });
  324. this.departmentOptionLoading = false
  325. }, 1000);
  326. },
  327. vueCasader(obj) {
  328. if(obj.distinction == '1') {
  329. if(obj.id != '') {
  330. let arr = []
  331. arr.push(obj.id)
  332. this.departmentOptionValue = arr
  333. this.getTaskTimeCompare()
  334. } else {
  335. this.departmentOptionValue = []
  336. this.getTaskTimeCompare()
  337. }
  338. }
  339. },
  340. getDepartment() {
  341. this.http.post( this.port.manage.depList, {},
  342. res => {
  343. if (res.code == "ok") {
  344. var list1 = JSON.parse(JSON.stringify(res.data));
  345. this.departmentOption = this.changeArr(list1);
  346. console.log(this.departmentOption, '部门')
  347. } else {
  348. this.$message({
  349. message: res.msg,
  350. type: "error"
  351. });
  352. }
  353. },
  354. error => {
  355. this.$message({
  356. message: error,
  357. type: "error"
  358. });
  359. });
  360. },
  361. // 修改数组
  362. changeArr(arr) {
  363. for (var i = 0; i < arr.length; i++) {
  364. if(arr[i].id != -1 && arr[i].id != 0) {
  365. if (arr[i].children != null && arr[i].children.length>0) {
  366. arr[i].children = this.changeArr(arr[i].children);
  367. }
  368. arr[i].id && (arr[i].value = arr[i].id);
  369. delete arr[i].id;
  370. }
  371. }
  372. for(var i in arr) {
  373. if(arr[i].id == -1 || arr[i].id == 0) {
  374. arr.splice(i,1)
  375. }
  376. }
  377. return arr;
  378. },
  379. sumRadioChange() {
  380. this.getExecutorPanel()
  381. },
  382. exportTaskCompare() {
  383. let _this = this;
  384. this.http.post('/task/exportTaskTimeCompare', { projectId: this.curProjectId },
  385. res => {
  386. if (res.code == "ok") {
  387. location.href = res.data;
  388. } else {
  389. this.$message({
  390. message: res.msg,
  391. type: "error"
  392. });
  393. }
  394. }
  395. );
  396. },
  397. getTaskTimeCompare() {
  398. let _this = this;
  399. let obj = { projectId: this.curProjectId }
  400. if (this.departmentOptionValue) {
  401. obj.deptId = this.departmentOptionValue[this.departmentOptionValue.length - 1]
  402. }
  403. this.departmentOptionLoading = true
  404. this.http.post('/task/getTaskTimeCompare', { ...obj },
  405. res => {
  406. if (res.code == "ok") {
  407. let newList = res.data.reverse()
  408. this.dataPagingData = newList
  409. this.dataPagingTotal = newList.length
  410. let list = newList.slice((this.dataPagingPage - 1) * this.dataPagingSize, this.dataPagingPage * this.dataPagingSize)
  411. this.taskTimeComparePublic(list)
  412. } else {
  413. this.departmentOptionLoading = false
  414. this.$message({
  415. message: res.msg,
  416. type: "error"
  417. });
  418. }
  419. },
  420. error => {
  421. this.departmentOptionLoading = false
  422. this.$message({
  423. message: error,
  424. type: "error"
  425. });
  426. });
  427. },
  428. getTopCostTask() {
  429. let _this = this;
  430. this.http.post('/task/getTopCostTask', { projectId: this.curProjectId },
  431. res => {
  432. if (res.code == "ok") {
  433. var xList = [], yList = [], list = res.data;
  434. for (var i in list) {
  435. xList.push(list[i].name.length > 6 ? list[i].name.substring(0, 6) + '..' : list[i].name);
  436. yList.push({
  437. "value": list[i].value,
  438. "id": list[i].id,
  439. "fullName": list[i].name,
  440. });
  441. }
  442. var myChart = echarts.init(document.getElementById("costPanel"));
  443. _this.costChart = myChart;
  444. var option = {
  445. title: {
  446. show: list.length == 0,
  447. textStyle: {
  448. color: "#666666",
  449. fontSize: 18,
  450. fontWeight: 'normal',
  451. },
  452. text: list.length == 0 ? _this.$t('nodata') : _this.$t('themosttime'),
  453. left: "center",
  454. top: "center"
  455. },
  456. toolbox: {
  457. right: 25,
  458. show: true,
  459. feature: {
  460. saveAsImage: {
  461. show: true
  462. },
  463. restore: {
  464. show: true
  465. },
  466. magicType: {
  467. type: ['line', 'bar']
  468. },
  469. }
  470. },
  471. tooltip: {
  472. trigger: 'axis',
  473. formatter: function (params, ticket, callback) {
  474. var res = params[0].data.fullName + "" + " : " + params[0].data.value
  475. + _this.$t('time.hour');
  476. _this.params = params;
  477. return res;
  478. }
  479. },
  480. xAxis: {
  481. data: xList,
  482. axisLabel: {
  483. interval: 0, rotate: 20
  484. }
  485. },
  486. yAxis: [{
  487. type: 'value',
  488. axisLabel: {
  489. formatter: '{value}' + _this.$t('time.hour')
  490. }
  491. }],
  492. series: [{
  493. name: _this.$t('hao-shi-xiao-shi'),
  494. type: 'bar',
  495. barMaxWidth: 30,
  496. data: yList,
  497. }]
  498. };
  499. myChart.setOption(option, { notMerge: true });
  500. } else {
  501. this.$message({
  502. message: res.msg,
  503. type: "error"
  504. });
  505. }
  506. },
  507. error => {
  508. this.$message({
  509. message: error,
  510. type: "error"
  511. });
  512. });
  513. },
  514. getStagesPanel() {
  515. let _this = this;
  516. this.http.post('/task/getStagesPanel', { projectId: this.curProjectId },
  517. res => {
  518. if (res.code == "ok") {
  519. var list = res.data;
  520. var myChart = echarts.init(document.getElementById("stagesPanel"));
  521. _this.stagesChart = myChart;
  522. myChart.setOption({
  523. title: {
  524. show: list.length == 0,
  525. textStyle: {
  526. color: "#666666",
  527. fontSize: 18,
  528. fontWeight: 'normal',
  529. },
  530. text: list.length == 0 ? _this.$t('nodata') : _this.$t('taskListStatistics'),
  531. left: "center",
  532. top: "center"
  533. },
  534. toolbox: {
  535. right: 25,
  536. show: true,
  537. feature: {
  538. saveAsImage: {
  539. show: true
  540. },
  541. }
  542. },
  543. tooltip: {
  544. trigger: 'item',
  545. formatter: "{b}<br/>" + _this.$t('ren-wu-shu') + ":{c} ({d}%)",
  546. },
  547. series: [
  548. {
  549. name: _this.$t('tasklist'),
  550. type: 'pie',
  551. radius: '55%',
  552. data: list
  553. }
  554. ]
  555. }, { notMerge: true })
  556. } else {
  557. this.$message({
  558. message: res.msg,
  559. type: "error"
  560. });
  561. }
  562. },
  563. error => {
  564. this.$message({
  565. message: error,
  566. type: "error"
  567. });
  568. });
  569. },
  570. getExecutorPanel() {
  571. let _this = this;
  572. let url
  573. if (this.sumListRadio == this.$t('plantime')) {
  574. url = '/task/getExecutorPlanHour'
  575. } else {
  576. url = '/task/getExecutorPanel'
  577. }
  578. this.http.post(url, { projectId: this.curProjectId },
  579. res => {
  580. if (res.code == "ok") {
  581. if (this.user.userNameNeedTranslate != 1) {
  582. this.pulledOut(res.data)
  583. } else {
  584. let arrList = []
  585. let textList = [] // 是否有待认领的文字
  586. for (var i in res.data) {
  587. let obj = {}
  588. obj.type = res.data[i].type
  589. obj.id = res.data[i].executorName
  590. arrList.push(obj)
  591. }
  592. this.dealWithTranslation(arrList, res.data)
  593. }
  594. } else {
  595. this.$message({
  596. message: res.msg,
  597. type: "error"
  598. });
  599. }
  600. },
  601. error => {
  602. this.$message({
  603. message: error,
  604. type: "error"
  605. });
  606. });
  607. },
  608. dealWithTranslation(items, dataArr) {
  609. console.log('过来的值')
  610. console.log(items, dataArr)
  611. if (WWOpenData.initCanvas) {
  612. WWOpenData.initCanvas()
  613. }
  614. const myFunOne = async () => {
  615. const result = await new Promise((resolve, reject) => {
  616. if (WWOpenData.prefetch) {
  617. WWOpenData.prefetch({ items }, (err, data) => {
  618. if (err) { return reject(err) }
  619. resolve(data)
  620. })
  621. }
  622. })
  623. console.log(result, '出来的值')
  624. for (let i in dataArr) {
  625. dataArr[i].executorName = result.items[i].data
  626. }
  627. console.log('将要传过去的值', dataArr)
  628. this.pulledOut(dataArr)
  629. }
  630. myFunOne()
  631. },
  632. // 单独抽离出来
  633. pulledOut(dataList) {
  634. console.log(dataList, '过来的值')
  635. // var xList = [], yList = [], list = res.data;
  636. var _this = this;
  637. var xList = [], yList = [], list = dataList;
  638. for (var i in list) {
  639. xList.push(list[i].executorName);
  640. yList.push({
  641. "value": _this.sumListRadio == _this.$t('plantime') ? list[i].taskHours : list[i].taskCount,
  642. "id": list[i].executorId
  643. });
  644. }
  645. var myChart = echarts.init(document.getElementById("executorPanel"));
  646. _this.executorChart = myChart;
  647. var option = {
  648. color: ["#409EFF", "#71C671"],
  649. title: {
  650. show: list.length == 0,
  651. textStyle: {
  652. color: "#666666",
  653. fontSize: 18,
  654. fontWeight: 'normal',
  655. },
  656. text: list.length == 0 ? _this.$t('nodata') : _this.$t('zhi-hang-ren-fen-pei-tu'),
  657. left: "center",
  658. top: "center"
  659. },
  660. toolbox: {
  661. right: 25,
  662. show: true,
  663. feature: {
  664. saveAsImage: {
  665. // show: false
  666. show: this.user.userNameNeedTranslate == 1 ? false : true
  667. },
  668. restore: {
  669. show: true
  670. },
  671. magicType: {
  672. type: ['line', 'bar']
  673. },
  674. }
  675. },
  676. tooltip: {
  677. trigger: 'axis',
  678. formatter: function (params, ticket, callback) {
  679. let res = ''
  680. if(_this.user.userNameNeedTranslate == 1) {
  681. res = params[0].data.value
  682. + (_this.sumListRadio == _this.$t('plantime') ? _this.$t('time.hour') : _this.$t('ge'));
  683. _this.params = params;
  684. } else {
  685. res = params[0].name + "" + " : " + params[0].data.value
  686. + (_this.sumListRadio == _this.$t('plantime') ? _this.$t('time.hour') : _this.$t('ge'));
  687. _this.params = params;
  688. }
  689. return res
  690. // var res = params[0].name + "" + " : " + params[0].data.value
  691. // + (_this.sumListRadio == _this.$t('plantime') ? _this.$t('time.hour') : _this.$t('ge'));
  692. // _this.params = params;
  693. // return res;
  694. }
  695. },
  696. xAxis: {
  697. data: xList,
  698. axisLabel: {
  699. interval: 0, rotate: 20
  700. }
  701. },
  702. yAxis: [{
  703. type: 'value',
  704. axisLabel: {
  705. formatter: '{value} '
  706. }
  707. }],
  708. series: [{
  709. name: _this.sumListRadio == _this.$t('plantime') ? _this.$t('xiaoshijihua') : _this.$t('rwushuliang'),
  710. type: 'bar',
  711. barMaxWidth: 30,
  712. data: yList,
  713. }]
  714. };
  715. myChart.setOption(option, { notMerge: true });
  716. },
  717. getProjectTaskSum() {
  718. this.http.post('/project/taskSum', {
  719. id: this.curProjectId
  720. },
  721. res => {
  722. if (res.code == "ok") {
  723. this.taskSum = res.data;
  724. } else {
  725. this.$message({
  726. message: res.msg,
  727. type: "error"
  728. });
  729. }
  730. },
  731. error => {
  732. this.$message({
  733. message: error,
  734. type: "error"
  735. });
  736. });
  737. },
  738. refreshPage() {
  739. this.curProjectId = parseInt(this.$route.params.id);
  740. this.getProjectTaskSum();
  741. this.getExecutorPanel();
  742. this.getTopCostTask();
  743. this.getStagesPanel();
  744. this.getTaskTimeCompare();
  745. }
  746. },
  747. created() {
  748. let height = window.innerHeight;
  749. this.tableHeight = height - 160;
  750. const that = this;
  751. window.onresize = function temp() {
  752. that.tableHeight = window.innerHeight - 160;
  753. };
  754. },
  755. mounted() {
  756. this.curProjectId = parseInt(this.$route.params.id);
  757. var _this = this;
  758. window.addEventListener("resize", function () {
  759. if (_this.executorChart != null) {
  760. _this.executorChart.resize();
  761. }
  762. if (_this.stagesChart != null) {
  763. _this.stagesChart.resize();
  764. }
  765. if (_this.costChart != null) {
  766. _this.costChart.resize();
  767. }
  768. if (_this.compareChart != null) {
  769. _this.compareChart.resize();
  770. }
  771. });
  772. this.getProjectTaskSum();
  773. this.getExecutorPanel();
  774. this.getStagesPanel();
  775. this.getTopCostTask();
  776. this.getTaskTimeCompare();
  777. this.getDepartment()
  778. }
  779. };
  780. </script>