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.

260 lines
6.6 KiB

4 years ago
3 years ago
4 years ago
3 years ago
4 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
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
  1. <template>
  2. <section>
  3. <el-dialog fullscreen :title="(filters.project?'【'+filters.project.name+'】':'')+'任务累积图'" 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"> <div>
  6. <div class="main" id="taskDayAccumulate"
  7. style="width:100%;height:600px;margin:0 auto;"></div>
  8. </div>
  9. </el-col>
  10. <el-col :span="6" class="border">
  11. <el-form :model="filters" class="padding">
  12. <el-form-item label="归属项目" >
  13. <xm-project-select v-if="!xmProject || !xmProject.id" ref="xmProjectSelect" style="display:inline;" :auto-select="false" :link-project-id="xmProject?xmProject.id:null" @row-click="onProjectSelected" @clear="onProjectClear"></xm-project-select>
  14. <span v-else>{{xmProject.id}} <span v-if="xmProject.name"><br/>{{ xmProject.name }} </span> </span>
  15. </el-form-item>
  16. <el-form-item label="日期区间">
  17. <br>
  18. <mdp-date-range v-model="filters" value-format="yyyy-MM-dd" start-key="startBizDate" end-key="endBizDate"></mdp-date-range>
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button type="primary" icon="el-icon-search" @click="listXmProjectStateHis">查询</el-button>
  22. </el-form-item>
  23. </el-form>
  24. </el-col>
  25. </el-row>
  26. </el-dialog>
  27. </section>
  28. </template>
  29. <script>
  30. import util from '@/common/js/util';//全局公共库
  31. import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
  32. import { mapGetters } from 'vuex'
  33. import { listXmProjectStateHis } from '@/api/xm/core/xmProjectStateHis';
  34. import XmProjectSelect from '@/views/xm/core/components/XmProjectSelect';//新增界面
  35. export default {
  36. components: {
  37. XmProjectSelect,
  38. },
  39. props:['xmProduct','xmProject'],
  40. computed: {
  41. ...mapGetters([
  42. 'userInfo','roles'
  43. ]),
  44. datesCpd(){
  45. if(this.xmProjectStateHiss.length==0){
  46. return []
  47. }else{
  48. return this.xmProjectStateHiss.map(i=>i.bizDate)
  49. }
  50. },
  51. taskCloseCntCpd(){
  52. if(this.xmProjectStateHiss.length==0){
  53. return []
  54. }else{
  55. return this.xmProjectStateHiss.map(i=>i.taskCloseCnt)
  56. }
  57. },
  58. taskUnstartCntCpd(){
  59. if(this.xmProjectStateHiss.length==0){
  60. return []
  61. }else{
  62. return this.xmProjectStateHiss.map(i=> i.taskUnstartCnt)
  63. }
  64. },
  65. taskExecCntCpd(){
  66. if(this.xmProjectStateHiss.length==0){
  67. return []
  68. }else{
  69. return this.xmProjectStateHiss.map(i=> i.taskExecCnt)
  70. }
  71. },
  72. taskFinishCntCpd(){
  73. if(this.xmProjectStateHiss.length==0){
  74. return []
  75. }else{
  76. return this.xmProjectStateHiss.map(i=>i.taskFinishCnt)
  77. }
  78. },
  79. },
  80. watch: {
  81. datesCpd(){
  82. this.$nextTick(()=>{
  83. this.drawCharts();
  84. })
  85. }
  86. },
  87. data() {
  88. return {
  89. filters:{
  90. category:'',
  91. product:null,
  92. project:null,
  93. },
  94. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  95. load:{ list: false, edit: false, del: false, add: false },//查询中...
  96. dateRanger:[],
  97. maxTableHeight:300,
  98. visible:false,
  99. xmProjectStateHiss:[],
  100. }//end return
  101. },//end data
  102. methods: {
  103. listXmProjectStateHis(){
  104. if(!this.filters.project){
  105. this.$notify({position:'bottom-left',showClose:true,message:'请先选中项目',type:'warning'})
  106. return;
  107. }
  108. var params={projectId: this.filters.project.id,orderBy:'biz_date asc'}
  109. if(this.filters.startBizDate && this.filters.endBizDate){
  110. params.startBizDate=this.filters.startBizDate;
  111. params.endBizDate=this.filters.endBizDate;
  112. }
  113. listXmProjectStateHis(params).then(res=>{
  114. this.xmProjectStateHiss=res.data.tips.isOk?res.data.data:this.xmProjectStateHiss;
  115. })
  116. },
  117. open(params){
  118. this.visible=true;
  119. this.filters.product=this.xmProduct
  120. this.filters.project=this.xmProject
  121. this.filters.iteration=this.xmIteration
  122. this.xmProjectStateHiss=[]
  123. if(this.$refs['xmProjectSelect'])this.$refs['xmProjectSelect'].clearSelect();
  124. this.$nextTick(()=>{
  125. this.listXmProjectStateHis();
  126. })
  127. },
  128. drawCharts() {
  129. this.myChart = this.$echarts.init(document.getElementById("taskDayAccumulate"));
  130. this.myChart.setOption(
  131. {
  132. title: {
  133. text: '任务累积图'
  134. },
  135. tooltip: {
  136. trigger: 'axis',
  137. axisPointer: {
  138. type: 'cross',
  139. label: {
  140. backgroundColor: '#6a7985'
  141. }
  142. }
  143. },
  144. legend: {
  145. data: ['未开始', '执行中', '已完成', '已关闭']
  146. },
  147. grid: {
  148. left: '3%',
  149. right: '4%',
  150. bottom: '3%',
  151. containLabel: true
  152. },
  153. toolbox: {
  154. feature: {
  155. saveAsImage: {}
  156. }
  157. },
  158. xAxis: {
  159. type: 'category',
  160. boundaryGap: false,
  161. data: this.datesCpd,
  162. },
  163. yAxis: {
  164. type: 'value'
  165. },
  166. series: [
  167. {
  168. name: '未开始',
  169. type: 'line',
  170. stack: 'Total',
  171. areaStyle: {},
  172. emphasis: {
  173. focus: 'series'
  174. },
  175. data: this.taskUnstartCntCpd
  176. },
  177. {
  178. name: '执行中',
  179. type: 'line',
  180. stack: 'Total',
  181. areaStyle: {},
  182. emphasis: {
  183. focus: 'series'
  184. },
  185. data: this.taskExecCntCpd,
  186. },
  187. {
  188. name: '已完成',
  189. type: 'line',
  190. stack: 'Total',
  191. areaStyle: {},
  192. emphasis: {
  193. focus: 'series'
  194. },
  195. data: this.taskFinishCntCpd,
  196. },
  197. {
  198. name: '已关闭',
  199. type: 'line',
  200. stack: 'Total',
  201. areaStyle: {},
  202. emphasis: {
  203. focus: 'series'
  204. },
  205. label: {
  206. show: true,
  207. position: 'top'
  208. },
  209. data: this.taskCloseCntCpd,
  210. }
  211. ]
  212. }
  213. )
  214. },
  215. onProjectSelected(project){
  216. this.filters.project=project
  217. this.xmProjectStateHiss=[];
  218. },
  219. onProjectClear(){
  220. this.filters.project=null
  221. this.xmProjectStateHiss=[];
  222. },
  223. },//end method
  224. mounted() {
  225. /**
  226. initSimpleDicts('all',['planType','xmTaskSettleSchemel','taskType','priority','taskState'] ).then(res=>{
  227. this.dicts=res.data.data;
  228. })
  229. */
  230. //this.charts();
  231. //this.drawCharts()
  232. }//end mounted
  233. }
  234. </script>
  235. <style scoped>
  236. .image {
  237. width: 100%;
  238. display: block;
  239. }
  240. </style>