123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609 |
- <template>
- <div :style="'padding:10px;background:#f7f7f7;min-height:'+tableHeight+'px;'">
- <div style="margin: 0 auto;width:1120px;">
- <!-- <label>项目统计</label> -->
- <el-row :gutter="10">
- <!-- 任务数量总计 -->
- <el-col :span="12">
- <div class="box">
- <div >
- <div class="lableTxt">{{ $t('projectoverviewtable') }}</div>
- <el-divider></el-divider>
- <el-row :gutter="10">
- <el-col :span="6" style="text-align:center;">
- <p style="color:#666;font-size:12px;">{{ $t('all') }}</p>
- <p style="font-size:28px;font-weight:bold;color:black;">{{taskSum.total}}</p>
- </el-col>
- <el-col :span="6" style="text-align:center;">
- <p style="color:#666;font-size:12px;">{{ $t('state.completed') }}</p>
- <p style="font-size:28px;font-weight:bold;color:green;">{{taskSum.finishCount}}</p>
- </el-col>
- <el-col :span="6" style="text-align:center;">
- <p style="color:#666;font-size:12px;">{{ $t('wei-wan-cheng') }}</p>
- <p style="font-size:28px;color:blue;font-weight:bold;">{{taskSum.unfinishCount}}</p>
- </el-col>
- <el-col :span="6" style="text-align:center;">
- <p style="color:#666;font-size:12px;">{{ $t('yi-yu-qi') }}</p>
- <p style="font-size:28px;color:red;font-weight:bold;">{{taskSum.timeupCount}}</p>
- </el-col>
- </el-row>
- <el-row :gutter="10">
- <el-col :span="6" style="text-align:center;">
- <p style="color:#666;font-size:12px;">{{ $t('dai-ren-ling') }}</p>
- <p style="font-size:28px;color:#orange;font-weight:bold;">{{taskSum.unassignCount}}</p>
- </el-col>
- <el-col :span="6" style="text-align:center;">
- <p style="color:#666;font-size:12px;">{{ $t('duetoday') }}</p>
- <p style="font-size:28px;font-weight:bold;color:pink;">{{taskSum.todayTimeupCount}}</p>
- </el-col>
- <el-col :span="6" style="text-align:center;">
- <p style="color:#666;font-size:12px;">{{ $t('limittocomplete') }}</p>
- <p style="font-size:28px;font-weight:bold;color:gray;">{{taskSum.timeupFinishCount}}</p>
- </el-col>
- <el-col :span="6" style="text-align:center;">
- <p style="color:#666;font-size:12px;">{{ $t('shi-jian-dai-ding') }}</p>
- <p style="font-size:28px;font-weight:bold;color:black;">{{taskSum.timeunsetCount}}</p>
- </el-col>
- </el-row>
- </div>
- </div>
- </el-col>
- <el-col :span="12">
- <div class="box">
- <div class="lableTxt" style="display:flex;justify-content:space-between;align-items:center;">{{ $t('distributionexecutors') }}
- <el-radio-group v-model="sumListRadio" size="mini" @change="sumRadioChange">
- <el-radio-button :label="$t('taskNum')"></el-radio-button>
- <el-radio-button :label="$t('plantime')"></el-radio-button>
- </el-radio-group>
- </div>
- <el-divider></el-divider>
- <div id="executorPanel" style="height:300px;width:500px;"></div>
- </div>
- </el-col>
- </el-row>
- <el-row :gutter="10">
- <el-col :span="12">
- <div class="box">
- <div class="lableTxt">{{ $t('consumingtask') }}</div>
- <el-divider></el-divider>
- <div id="costPanel" style="height:300px;width:500px;"></div>
- </div>
- </el-col>
- <el-col :span="12">
- <div class="box">
- <div class="lableTxt">{{ $t('statisticsbytasklist') }}</div>
- <el-divider></el-divider>
- <div id="stagesPanel" style="height:300px;width:500px;"></div>
- </div>
- </el-col>
- </el-row>
- <el-row :gutter="10">
- <el-col :span="24">
- <div class="box" style="height:550px;">
- <div class="lableTxt">{{ $t('actualworkinghours') }} <el-link @click="exportTaskCompare" style="float:right;"><i class="iconfont firerock-iconexport"></i>{{ $t('export.export') }}</el-link></div>
- <el-divider></el-divider>
- <div id="taskTimeComparePanel" style="height:500px;width:1100px;"></div>
- </div>
- </el-col>
- </el-row>
- </div>
-
- </div>
- </template>
- <style scoped>
- #executorPanel {
- display: inline-block;
- width: 100%;
- }
- .el-divider--horizontal {
- margin: 10px 0;
- height: 0.5px;
- }
- .box {
- background:#fff;border: 1px solid #eeeeee;border-radius:5px;padding:10px;
- height:303.7px;margin-top:10px;
- }
- .info span {
- color:#303133;
- }
- .gray_label {
- color:#999 !important;
- }
- .el-row {
- margin-top:10px;
- }
- .lableTxt {
- color:#666;
- }
- </style>
- <script>
- import util from "../../common/js/util";
- export default {
- data() {
- return {
- compareChart:null,
- costChart:null,
- stagesChart: null,
- executorChart: null,
- pVisible:false,
- taskSum:{},
- users:[],
- 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')}],
- //1-一般,2-紧急,3-重要,4-重要且紧急
- levelTxt:[this.$t('all'),this.$t('yi-ban'),this.$t('jin-ji'),this.$t('zhong-yao'),this.$t('zhong-yao-qie-jin-ji')],
- //1-进行中,2-已完成,3-已撤销
- statusTxt: [this.$t('all'),this.$t('ongoing'),this.$t('state.completed'),this.$t('state.undone')],
- addFolderDialog: false,
- upLoading:false,
- user: JSON.parse(sessionStorage.getItem("user")),
- addLoading: false,
- curProjectId:null,
- title: "",
- sumListRadio: this.$t('taskNum')
- };
- },
- methods: {
- sumRadioChange(){
- this.getExecutorPanel()
- },
- exportTaskCompare() {
- let _this = this;
- this.http.post('/task/exportTaskTimeCompare', {projectId: this.curProjectId},
- res => {
- if (res.code == "ok") {
- location.href = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- }
- );
- },
- getTaskTimeCompare() {
- let _this = this;
- this.http.post('/task/getTaskTimeCompare', {projectId: this.curProjectId},
- res => {
- if (res.code == "ok") {
- var xList1 = [], xList2 = [], list = res.data.reverse();
- var taskNames = [];
- for(var i in list) {
- xList1.push({
- "value": list[i].workHours,
- "id": list[i].id,
- "fullName":list[i].name,
- });
- xList2.push({
- "value": list[i].planHours,
- "id": list[i].id,
- "fullName":list[i].name,
- });
- taskNames.push(list[i].name.length>12?list[i].name.substring(0,12)+'..':list[i].name);
- }
- var myChart = echarts.init(document.getElementById("taskTimeComparePanel"));
- _this.compareChart = myChart;
- var option = {
- // 全局调色盘。
- color: ["#409EFF","#71C671"],
- title: {
- show:list.length == 0,
- textStyle: {
- color: "#666666",
- fontSize: 18,
- fontWeight: 'normal',
- },
- text: list.length == 0?this.$t('nodata'):this.$t('gong-shi-dui-bi'),
- left: "center",
- top: "center"
- },
- toolbox: {
- show: true,
- feature:{
- saveAsImage:{
- show:true
- },
- restore:{
- show:true
- },
- magicType:{
- type:['line','bar']
- },
- }
- },
- legend: {
- data: [this.$t('shi-ji-gong-shi'), this.$t('plantime')]
- },
- grid: {
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- },
- },
- xAxis: {
- type: 'value',
- boundaryGap: [0, 1],
- axisLabel: {
- formatter:'{value} '+this.$t('time.hour')
- }
- },
- yAxis: [{
- type: 'category',
- data: taskNames
- }],
- series: [{
- name: this.$t('shi-ji-gong-shi'),
- type: 'bar',
- data: xList1
- },
- {
- name: this.$t('plantime'),
- type: 'bar',
- data: xList2
- }]
- };
- myChart.setOption(option,{notMerge: true});
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- getTopCostTask() {
- let _this = this;
- this.http.post('/task/getTopCostTask', {projectId: this.curProjectId},
- res => {
- if (res.code == "ok") {
- var xList = [], yList = [], list = res.data;
- for(var i in list) {
- xList.push(list[i].name.length>6?list[i].name.substring(0,6)+'..':list[i].name);
- yList.push({
- "value": list[i].value,
- "id": list[i].id,
- "fullName":list[i].name,
- });
- }
- var myChart = echarts.init(document.getElementById("costPanel"));
- _this.costChart = myChart;
- var option = {
- title: {
- show:list.length == 0,
- textStyle: {
- color: "#666666",
- fontSize: 18,
- fontWeight: 'normal',
- },
- text: list.length == 0?_this.$t('nodata'):_this.$t('themosttime'),
- left: "center",
- top: "center"
- },
- toolbox: {
- show: true,
- feature:{
- saveAsImage:{
- show:true
- },
- restore:{
- show:true
- },
- magicType:{
- type:['line','bar']
- },
- }
- },
- tooltip:{
- trigger:'axis',
- formatter: function (params,ticket,callback) {
- var res = params[0].data.fullName + ""+" : " + params[0].data.value
- + _this.$t('time.hour');
- _this.params = params;
- return res;
- }
- },
- xAxis: {
- data: xList,
- axisLabel: {
- interval:0,rotate:20
- }
- },
- yAxis: [{
- type : 'value',
- axisLabel: {
- formatter:'{value}'+_this.$t('time.hour')
- }
- }],
- series: [{
- name: _this.$t('hao-shi-xiao-shi'),
- type: 'bar',
- barMaxWidth: 30,
- data: yList,
- }]
- };
- myChart.setOption(option,{notMerge: true});
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- getStagesPanel(){
- let _this = this;
- this.http.post('/task/getStagesPanel', {projectId: this.curProjectId},
- res => {
- if (res.code == "ok") {
- var list = res.data;
- var myChart = echarts.init(document.getElementById("stagesPanel"));
- _this.stagesChart = myChart;
- myChart.setOption({
- title: {
- show:list.length == 0,
- textStyle: {
- color: "#666666",
- fontSize: 18,
- fontWeight: 'normal',
- },
- text: list.length == 0?_this.$t('nodata'):_this.$t('taskListStatistics'),
- left: "center",
- top: "center"
- },
- toolbox: {
- show: true,
- feature:{
- saveAsImage:{
- show:true
- },
- }
- },
- tooltip:{
- trigger:'item',
- formatter: "{b}<br/>"+_this.$t('ren-wu-shu')+":{c} ({d}%)",
- },
- series : [
- {
- name: _this.$t('tasklist'),
- type: 'pie',
- radius: '55%',
- data:list
- }
- ]
- },{notMerge: true})
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- getExecutorPanel(){
- let _this = this;
- let url
- if(this.sumListRadio == this.$t('plantime')){
- url = '/task/getExecutorPlanHour'
- }else{
- url = '/task/getExecutorPanel'
- }
- this.http.post(url, {projectId: this.curProjectId},
- res => {
- if (res.code == "ok") {
- if(this.user.userNameNeedTranslate != 1) {
- this.pulledOut(res.data)
- } else {
- let arrList = []
- let textList = [] // 是否有待认领的文字
- for(var i in res.data) {
- let obj = {}
- obj.type = res.data[i].type
- obj.id = res.data[i].executorName
- arrList.push(obj)
- }
- this.dealWithTranslation(arrList, res.data)
- }
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- dealWithTranslation(items, dataArr) {
- console.log('过来的值')
- console.log(items, dataArr)
- if (WWOpenData.initCanvas) {
- WWOpenData.initCanvas()
- }
- const myFunOne = async () => {
- const result = await new Promise((resolve, reject) => {
- if(WWOpenData.prefetch) {
- WWOpenData.prefetch({ items }, (err, data) => {
- if (err) { return reject(err) }
- resolve(data)
- })
- }
-
- })
- console.log(result, '出来的值')
- for(let i in dataArr) {
- dataArr[i].executorName = result.items[i].data
- }
- console.log('将要传过去的值', dataArr)
- this.pulledOut(dataArr)
- }
-
- myFunOne()
- },
- // 单独抽离出来
- pulledOut(dataList) {
- console.log(dataList, '过来的值')
- // var xList = [], yList = [], list = res.data;
- var _this = this;
- var xList = [], yList = [], list = dataList;
- for(var i in list) {
- xList.push(list[i].executorName);
- yList.push({
- "value": _this.sumListRadio == _this.$t('plantime') ? list[i].taskHours : list[i].taskCount,
- "id": list[i].executorId
- });
- }
- var myChart = echarts.init(document.getElementById("executorPanel"));
- _this.executorChart = myChart;
- var option = {
- color: ["#409EFF","#71C671"],
- title: {
- show:list.length == 0,
- textStyle: {
- color: "#666666",
- fontSize: 18,
- fontWeight: 'normal',
- },
- text: list.length == 0?_this.$t('nodata'):_this.$t('zhi-hang-ren-fen-pei-tu'),
- left: "center",
- top: "center"
- },
- toolbox: {
- show: true,
- feature:{
- saveAsImage:{
- show:true
- },
- restore:{
- show:true
- },
- magicType:{
- type:['line','bar']
- },
- }
- },
- tooltip:{
- trigger:'axis',
- formatter: function (params,ticket,callback) {
- var res = params[0].name + ""+" : " + params[0].data.value
- + (_this.sumListRadio == _this.$t('plantime') ? _this.$t('time.hour') : _this.$t('ge'));
- _this.params = params;
- return res;
- }
- },
- xAxis: {
- data: xList,
- axisLabel: {
- interval:0,rotate:20
- }
- },
- yAxis: [{
- type : 'value',
- axisLabel: {
- formatter:'{value} '
- }
- }],
- series: [{
- name: _this.sumListRadio == _this.$t('plantime') ? _this.$t('xiaoshijihua') : _this.$t('rwushuliang'),
- type: 'bar',
- barMaxWidth: 30,
- data: yList,
- }]
- };
- myChart.setOption(option,{notMerge: true});
- },
- getProjectTaskSum() {
- this.http.post('/project/taskSum', {
- id: this.curProjectId
- },
- res => {
- if (res.code == "ok") {
- this.taskSum = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- refreshPage() {
- this.curProjectId = parseInt(this.$route.params.id);
- this.getProjectTaskSum();
- this.getExecutorPanel();
- this.getTopCostTask();
- this.getStagesPanel();
- this.getTaskTimeCompare();
- }
- },
- created() {
- let height = window.innerHeight;
- this.tableHeight = height - 160;
- const that = this;
- window.onresize = function temp() {
- that.tableHeight = window.innerHeight - 160;
- };
- },
- mounted() {
- this.curProjectId = parseInt(this.$route.params.id);
- var _this = this;
- window.addEventListener("resize", function() {
- if (_this.executorChart != null) {
- _this.executorChart.resize();
- }
- if (_this.stagesChart != null) {
- _this.stagesChart.resize();
- }
- if (_this.costChart != null) {
- _this.costChart.resize();
- }
- if (_this.compareChart != null) {
- _this.compareChart.resize();
- }
- });
- this.getProjectTaskSum();
- this.getExecutorPanel();
- this.getStagesPanel();
- this.getTopCostTask();
- this.getTaskTimeCompare();
- }
- };
- </script>
|