You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

290 lines
8.4 KiB

4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <section>
  3. <el-dialog fullscreen :title="( filters.iteration?'【'+filters.iteration.iterationName+'】':'')+'迭代燃尽图'" append-to-body modal-append-to-body width="80%" top="20px" :visible.sync="visible">
  4. <el-row :gutter="5" v-if="visible">
  5. <el-col :span="18">
  6. <div>
  7. <div class="main" id="burnout"
  8. style="width:100%;height:600px;margin:0 auto;"></div>
  9. <div class="progress"></div>
  10. </div>
  11. </el-col>
  12. <el-col :span="6" class="border">
  13. <el-form :model="filters" label-position="top" class="padding">
  14. <el-form-item label="归属产品" v-if="!xmProduct&&!xmIteration">
  15. <xm-product-select ref="xmProductSelect" style="display:inline;" :auto-select="false" :link-project-id="xmProject?xmProject.id:null" @row-click="onProductSelected" @clear="onProductClear"></xm-product-select>
  16. </el-form-item>
  17. <el-form-item label="归属产品" v-if="xmProduct && xmProduct.id">
  18. <span v-if="xmProduct.id">编号{{ xmProduct.id }}</span><br>
  19. <span v-if="xmProduct.productName">名称{{ xmProduct.productName }}</span>
  20. </el-form-item>
  21. <el-form-item label="归属迭代" v-if="!xmIteration || !xmIteration.id">
  22. <xm-iteration-select style="display:inline;" :auto-select="false" :product-id="filters.product?filters.product.id:null" :link-project-id="xmProject?xmProject.id:null" placeholder="迭代" @row-click="onIterationSelected" @clear="onIterationClear"></xm-iteration-select>
  23. </el-form-item>
  24. <el-form-item label="归属迭代" v-if="xmIteration &&xmIteration.id">
  25. 编号<span v-if="xmIteration.id">{{ xmIteration.id }}</span><br>
  26. 名称<span v-if="xmIteration.iterationName">{{ xmIteration.iterationName }}</span>
  27. </el-form-item>
  28. <el-form-item>
  29. <div class="padding"> <el-button type="primary" icon="el-icon-search" @click="listXmIterationStateHis">查询</el-button></div>
  30. </el-form-item>
  31. </el-form>
  32. </el-col>
  33. </el-row>
  34. </el-dialog>
  35. </section>
  36. </template>
  37. <script>
  38. import util from '@/common/js/util';//全局公共库
  39. import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
  40. import { mapGetters } from 'vuex'
  41. import { listXmIterationStateHis } from '@/api/xm/core/xmIterationStateHis';
  42. import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//产品选择界面
  43. import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect';//迭代选择界面
  44. export default {
  45. components: {
  46. XmIterationSelect,XmProductSelect,
  47. },
  48. props:['xmProduct','xmIteration','xmProject'],
  49. computed: {
  50. ...mapGetters([
  51. 'userInfo','roles',
  52. ]),
  53. datesCpd(){
  54. if(this.xmIterationStateHiss.length==0){
  55. return []
  56. }else{
  57. return this.xmIterationStateHiss.map(i=>i.bizDate)
  58. }
  59. },
  60. remainStandWorkloadsCpd(){
  61. if(this.xmIterationStateHiss.length==0){
  62. return []
  63. }else{
  64. var max=this.findMax(this.xmIterationStateHiss);
  65. var length=this.findLength();
  66. if(length==0){
  67. return [];
  68. }
  69. var startDate=this.filters.iteration.startTime.substring(0,10)
  70. var endDate=this.filters.iteration.endTime.substring(0,10)
  71. var uniDayWorkload=max.budgetWorkload/(length+1)
  72. return this.xmIterationStateHiss.map((i,index)=>{
  73. if(i.bizDate<startDate || i.bizDate>endDate){
  74. return 0;
  75. }
  76. var days= util.timeDifference(i.bizDate+" 00:00:00",endDate+" 00:00:00")/60/24
  77. return parseInt(uniDayWorkload*days)
  78. })
  79. }
  80. },
  81. remainWorkloadsCpd(){
  82. if(this.xmIterationStateHiss.length==0){
  83. return []
  84. }else{
  85. return this.xmIterationStateHiss.map(i=>i.budgetWorkload-i.actWorkload)
  86. }
  87. },
  88. remainEstimateWorkloadsCpd(){
  89. if(this.xmIterationStateHiss.length==0){
  90. return []
  91. }else{
  92. return this.xmIterationStateHiss.map(i=>i.budgetWorkload-i.estimateWorkload)
  93. }
  94. },
  95. },
  96. watch: {
  97. datesCpd(){
  98. this.$nextTick(()=>{
  99. this.drawCharts();
  100. })
  101. }
  102. },
  103. data() {
  104. return {
  105. filters:{
  106. category:'',
  107. product:null,
  108. iteration:null,
  109. project:null,
  110. },
  111. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  112. load:{ list: false, edit: false, del: false, add: false },//查询中...
  113. dateRanger:[],
  114. maxTableHeight:300,
  115. visible:false,
  116. xmIterationStateHiss:[],
  117. }//end return
  118. },//end data
  119. methods: {
  120. findMax( list ) {
  121. var i, max = list[0];
  122. if(list.length < 2) return max;
  123. for (i = 0; i < list.length; i++) {
  124. if (list[i].budgetWorkload > max.budgetWorkload) {
  125. max = list[i];
  126. }
  127. }
  128. return max;
  129. },
  130. findLength(){
  131. if(this.filters.iteration && this.filters.iteration.id){
  132. return parseInt(util.timeDifference(this.filters.iteration.startTime.substring(0,10)+" 00:00:00",this.filters.iteration.endTime.substring(0,10)+" 00:00:00")/60/24)
  133. }else if(this.xmIterationStateHiss){
  134. return this.xmIterationStateHiss.length;
  135. }else{
  136. return 0;
  137. }
  138. },
  139. listXmIterationStateHis(){
  140. if(!this.filters.iteration|| !this.filters.iteration.id){
  141. this.$notify({position:'bottom-left',showClose:true,message:'请先选中迭代',type:'warning'})
  142. return;
  143. }
  144. var params={iterationId:this.filters.iteration.id,orderBy:'biz_date asc'}
  145. listXmIterationStateHis(params).then(res=>{
  146. this.xmIterationStateHiss=res.data.tips.isOk?res.data.data:this.xmIterationStateHiss;
  147. })
  148. },
  149. open(params){
  150. this.visible=true;
  151. this.filters.product=params.xmProduct
  152. this.filters.project=params.xmProject
  153. this.filters.iteration=params.xmIteration
  154. this.$nextTick(()=>{
  155. this.listXmIterationStateHis();
  156. })
  157. },
  158. drawCharts() {
  159. this.myChart = this.$echarts.init(document.getElementById("burnout"));
  160. this.myChart.setOption({
  161. title: {
  162. text: '燃尽图:',
  163. },
  164. tooltip: {
  165. trigger: 'axis'
  166. },
  167. legend: {
  168. right: 40,
  169. data: ['理想线','预估剩余工时', '剩余工时']
  170. },
  171. xAxis: {
  172. type: 'category',
  173. boundaryGap: false,
  174. splitLine: {
  175. show: false
  176. },
  177. data: this.datesCpd,
  178. },
  179. yAxis: {},
  180. series: [
  181. {
  182. name: '理想线',
  183. type: 'line',
  184. // stack: '剩余工作量',
  185. data: this.remainStandWorkloadsCpd,
  186. itemStyle: {
  187. normal: {
  188. // 折点颜色样式
  189. color: 'green',
  190. lineStyle: {
  191. // 折线颜色样式
  192. color: 'green'
  193. }
  194. }
  195. },
  196. // data: this.opinionData,
  197. },
  198. {
  199. name: '预估剩余工时',
  200. type: 'line',
  201. // stack: '剩余工作量',
  202. data: this.remainEstimateWorkloadsCpd,
  203. itemStyle: {
  204. normal: {
  205. // 折点颜色样式
  206. color: 'blue',
  207. lineStyle: {
  208. // 折线颜色样式
  209. color: 'blue'
  210. }
  211. }
  212. },
  213. // data: this.opinionData,
  214. },
  215. {
  216. name: '剩余工时',
  217. type: 'line',
  218. // stack: '剩余工作量',
  219. data: this.remainWorkloadsCpd,
  220. itemStyle: {
  221. normal: {
  222. // 折点颜色样式
  223. color: 'orange',
  224. lineStyle: {
  225. // 折线颜色样式
  226. color: 'orange'
  227. }
  228. }
  229. },
  230. // data: this.opinionData,
  231. },
  232. ]
  233. })
  234. },
  235. onProductSelected(product){
  236. this.filters.product=product
  237. this.xmProductStateHiss=[];
  238. },
  239. onProductClear(){
  240. this.filters.product=null
  241. this.xmProductStateHiss=[];
  242. },
  243. onIterationSelected(iteration){
  244. this.filters.iteration=iteration
  245. this.xmProductStateHiss=[];
  246. this.listXmIterationStateHis();
  247. },
  248. onIterationClear(){
  249. this.filters.iteration=null
  250. this.xmProductStateHiss=[];
  251. },
  252. },//end method
  253. mounted() {
  254. /**
  255. initSimpleDicts('all',['demandSource','demandLvl','demandType','priority','menuStatus'] ).then(res=>{
  256. this.dicts=res.data.data;
  257. })
  258. */
  259. //this.charts();
  260. //this.drawCharts();
  261. }//end mounted
  262. }
  263. </script>
  264. <style scoped>
  265. .image {
  266. width: 100%;
  267. display: block;
  268. }
  269. </style>