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.

259 lines
6.5 KiB

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