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.

277 lines
7.4 KiB

4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 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
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
3 years ago
3 years ago
3 years ago
4 years ago
3 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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 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
3 years ago
4 years ago
4 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
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
  1. <template>
  2. <section>
  3. <el-row :gutter="5" >
  4. <el-col :span="18">
  5. <div>
  6. <div class="echart-box" id="taskDayTrend"></div>
  7. <div class="progress"></div>
  8. </div>
  9. </el-col>
  10. <el-col :span="6" class="border">
  11. <el-form :model="filters" class="padding" :style="{width:'100%',maxHeight:maxTableHeight+'px',overflow: 'auto'}" ref="filtersRef">
  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. </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. taskSetCntCpd(){
  79. if(this.xmProjectStateHiss.length==0){
  80. return []
  81. }else{
  82. return this.xmProjectStateHiss.map(i=>i.taskSetCnt)
  83. }
  84. },
  85. titleCpd(){
  86. var preName=""
  87. if(this.filters.testPlan && this.filters.testPlan.id){
  88. preName=`测试计划【${this.filters.testPlan.name}`
  89. }else if(this.filters.testCasedb && this.filters.testCasedb.id){
  90. preName=`测试库【${this.filters.testCasedb.name}`
  91. }else if(this.filters.iteration && this.filters.iteration.id){
  92. preName=`迭代【${this.filters.iteration.iterationName}`
  93. }else if(this.filters.project && this.filters.project.id){
  94. if(this.filters.project.name){
  95. preName=`项目【${this.filters.project.name}`
  96. }else{
  97. preName=`项目【${this.filters.project.id}`
  98. }
  99. }else if(this.filters.product && this.filters.product.id){
  100. if(this.filters.product.productName){
  101. preName=`产品【${this.filters.product.productName}`
  102. }else{
  103. preName=`产品【${this.filters.product.id}`
  104. }
  105. }
  106. return preName+"任务每日分布"
  107. }
  108. },
  109. watch: {
  110. datesCpd(){
  111. this.$nextTick(()=>{
  112. this.drawCharts();
  113. })
  114. }
  115. },
  116. data() {
  117. return {
  118. filters:{
  119. product:null,
  120. project:null,
  121. testPlan:null,
  122. iteration:null,
  123. testCasedb:null,
  124. },
  125. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  126. load:{ list: false, edit: false, del: false, add: false },//查询中...
  127. dateRanger:[],
  128. maxTableHeight:300,
  129. visible:false,
  130. xmProjectStateHiss:[],
  131. }//end return
  132. },//end data
  133. methods: {
  134. listXmProjectStateHis(){
  135. if(!this.filters.project){
  136. this.$notify({position:'bottom-left',showClose:true,message:'请先选中项目',type:'warning'})
  137. return;
  138. }
  139. var params={projectId: this.filters.project.id,orderBy:'biz_date asc'}
  140. if(this.filters.startBizDate && this.filters.endBizDate){
  141. params.startBizDate=this.filters.startBizDate;
  142. params.endBizDate=this.filters.endBizDate;
  143. }
  144. listXmProjectStateHis(params).then(res=>{
  145. this.xmProjectStateHiss=res.data.tips.isOk?res.data.data:this.xmProjectStateHiss;
  146. })
  147. },
  148. open(){
  149. this.visible=true;
  150. this.filters.product=this.xmProduct
  151. this.filters.project=this.xmProject
  152. this.filters.iteration=this.xmIteration
  153. if(this.$refs['xmProjectSelect'])this.$refs['xmProjectSelect'].clearSelect();
  154. this.$nextTick(()=>{
  155. this.listXmProjectStateHis();
  156. })
  157. },
  158. drawCharts() {
  159. this.myChart = this.$echarts.init(document.getElementById("taskDayTrend"));
  160. this.myChart.setOption(
  161. {
  162. title: {
  163. text: this.titleCpd,
  164. left: 'center'
  165. },
  166. tooltip: {
  167. trigger: 'axis',
  168. },
  169. barMaxWidth: 100,
  170. toolbox: {
  171. show: true,
  172. top:"5%",
  173. right:"10px",
  174. feature: {
  175. dataView: { show: true, readOnly: false },
  176. magicType: { show: true, type: ['line', 'bar'] },
  177. saveAsImage: { show: true }
  178. }
  179. },
  180. calculable: true,
  181. legend: {
  182. bottom: 'bottom',
  183. data: ['待领取','执行中','已验收','已结算','已关闭']
  184. },
  185. xAxis: {
  186. type: 'category',
  187. data: this.datesCpd
  188. },
  189. yAxis: {
  190. type: 'value'
  191. },
  192. series: [
  193. {
  194. name:'待领取',
  195. data: this.taskUnstartCntCpd,
  196. type: 'line',
  197. },
  198. {
  199. name:'执行中',
  200. data: this.taskExecCntCpd,
  201. type: 'line',
  202. },
  203. {
  204. name:'已验收',
  205. data: this.taskFinishCntCpd,
  206. type: 'line',
  207. smooth: true,
  208. },
  209. {
  210. name:'已结算',
  211. data: this.taskSetCntCpd,
  212. type: 'line',
  213. smooth: true,
  214. },
  215. {
  216. name:'已关闭',
  217. data: this.taskCloseCntCpd,
  218. type: 'line',
  219. smooth: true,
  220. }
  221. ]
  222. }
  223. )
  224. },
  225. onProjectSelected(project){
  226. this.filters.project=project
  227. this.xmProjectStateHiss=[];
  228. },
  229. onProjectClear(){
  230. this.filters.project=null
  231. this.xmProjectStateHiss=[];
  232. },
  233. },//end method
  234. mounted() {
  235. /**
  236. initSimpleDicts('all',['planType','xmTaskSettleSchemel','taskType','priority','taskState'] ).then(res=>{
  237. this.dicts=res.data.data;
  238. })
  239. */
  240. this.maxTableHeight = util.calcTableMaxHeight(this.$refs.filtersRef.$el)
  241. //this.charts();
  242. this.open();
  243. }//end mounted
  244. }
  245. </script>
  246. <style scoped>
  247. .image {
  248. width: 100%;
  249. display: block;
  250. }
  251. </style>