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.

382 lines
11 KiB

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
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
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
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
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
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
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
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
  1. <template>
  2. <section>
  3. <el-row :gutter="5" >
  4. <el-col :span="showParams?23:24">
  5. <div>
  6. <div class="echart-box" :id="this.id"></div>
  7. <div class="progress"></div>
  8. </div>
  9. </el-col>
  10. <el-col :span="showParams?1:0" v-if="showParams">
  11. <el-popover trigger="manual" v-model="filterVisible" style="float:right;" width="500">
  12. <el-button slot="reference" style="margin-top:10px;margin-right:10px;z-index: 99999;" icon="el-icon-more" @click="filterVisible=!filterVisible"></el-button>
  13. <el-row>
  14. <el-button type="danger" icon="el-icon-delete" @click="$emit('delete',cfg)">从报告移出该报表</el-button>
  15. <el-button icon="el-icon-close" style="float:right;" @click="filterVisible=false">关闭</el-button>
  16. </el-row>
  17. <el-row>
  18. <el-form :model="params" class="padding" :style="{width:'100%',overflow: 'auto'}" ref="filtersRef">
  19. <el-form-item label="归属产品">
  20. <xm-product-select v-if="!xmProductCpd || !xmProductCpd.id" ref="xmProductSelect" style="display:inline;" :auto-select="false" :link-project-id="xmProject?xmProject.id:null" @row-click="onProductSelected" :iterationId="xmIteration?xmIteration.id:null" @clear="onProductClear"></xm-product-select>
  21. <span v-else>{{xmProductCpd.id}} <span v-if="xmProductCpd.productName"><br/>{{ xmProductCpd.productName }} </span> </span>
  22. </el-form-item>
  23. <el-form-item label="归属迭代" v-if="xmIteration && xmIteration.id">
  24. <span> {{xmIteration.id}}
  25. <span v-if="xmIteration.iterationName"><br/>{{ xmIteration.iterationName }} </span>
  26. </span>
  27. </el-form-item>
  28. <el-form-item label="归属迭代" v-else-if="filters.product && filters.product.id">
  29. <xm-iteration-select ref="xmIterationSelect" :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>
  30. </el-form-item>
  31. <el-form-item label="日期区间">
  32. <br>
  33. <mdp-date-range v-model="params" value-format="yyyy-MM-dd" start-key="startBizDate" end-key="endBizDate"></mdp-date-range>
  34. </el-form-item>
  35. <el-form-item>
  36. <el-button type="primary" style="float:right;" icon="el-icon-search" @click="listXmIterationStateHis">查询</el-button>
  37. </el-form-item>
  38. </el-form>
  39. </el-row>
  40. </el-popover>
  41. </el-col>
  42. </el-row>
  43. </section>
  44. </template>
  45. <script>
  46. import util from '@/common/js/util';//全局公共库
  47. import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
  48. import { mapGetters } from 'vuex'
  49. import { listXmIterationStateHis } from '@/api/xm/core/xmIterationStateHis';
  50. import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//产品选择界面
  51. import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect';//迭代选择界面
  52. export default {
  53. components: {
  54. XmIterationSelect,XmProductSelect,
  55. },
  56. props:['id','cfg','category','showToolBar','showParams','isRptCfg','rptDatas','xmProduct','xmProject','xmIteration'],
  57. computed: {
  58. ...mapGetters([
  59. 'userInfo','roles'
  60. ]),
  61. datesCpd(){
  62. if(this.rawDatas.length==0){
  63. return []
  64. }else{
  65. return this.rawDatas.map(i=>i.bizDate)
  66. }
  67. },
  68. menuCloseCntCpd(){
  69. if(this.rawDatas.length==0){
  70. return []
  71. }else{
  72. return this.rawDatas.map(i=>i.menuCloseCnt)
  73. }
  74. },
  75. menuUnstartCntCpd(){
  76. if(this.rawDatas.length==0){
  77. return []
  78. }else{
  79. return this.rawDatas.map(i=> i.menuUnstartCnt)
  80. }
  81. },
  82. menuExecCntCpd(){
  83. if(this.rawDatas.length==0){
  84. return []
  85. }else{
  86. return this.rawDatas.map(i=> i.menuExecCnt)
  87. }
  88. },
  89. menuFinishCntCpd(){
  90. if(this.rawDatas.length==0){
  91. return []
  92. }else{
  93. return this.rawDatas.map(i=>i.menuFinishCnt)
  94. }
  95. },
  96. titleCpd(){
  97. var preName=""
  98. if(this.filters.testPlan && this.filters.testPlan.id){
  99. preName=`测试计划【${this.filters.testPlan.name}`
  100. }else if(this.filters.testCasedb && this.filters.testCasedb.id){
  101. preName=`测试库【${this.filters.testCasedb.name}`
  102. }else if(this.filters.iteration && this.filters.iteration.id){
  103. preName=`迭代【${this.filters.iteration.iterationName}`
  104. }else if(this.filters.product && this.filters.product.id){
  105. if(this.filters.product.productName){
  106. preName=`产品【${this.filters.product.productName}`
  107. }else{
  108. preName=`产品【${this.filters.product.id}`
  109. }
  110. }else if(this.filters.project && this.filters.project.id){
  111. if(this.filters.project.name){
  112. preName=`项目【${this.filters.project.name}`
  113. }else{
  114. preName=`项目【${this.filters.project.id}`
  115. }
  116. }
  117. return preName+'需求每日趋势图'
  118. },
  119. xmProductCpd(){
  120. if(this.xmIteration && this.xmIteration.id){
  121. return {id:this.xmIteration.productId,productName:this.xmIteration.productName}
  122. }
  123. if(this.xmProduct && this.xmProduct.id){
  124. return this.xmProduct
  125. }
  126. return null;
  127. }
  128. },
  129. watch: {
  130. datesCpd(){
  131. this.$nextTick(()=>{
  132. this.drawCharts();
  133. })
  134. }
  135. },
  136. data() {
  137. return {
  138. filterVisible:false,
  139. filters:{
  140. category:'',
  141. product:null,
  142. project:null,
  143. testPlan:null,
  144. iteration:null,
  145. testCasedb:null,
  146. },
  147. params:{
  148. },
  149. title:'',//报表配置项
  150. remark:'', //报表配置项
  151. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  152. load:{ list: false, edit: false, del: false, add: false },//查询中...
  153. dateRanger:[],
  154. maxTableHeight:300,
  155. visible:false,
  156. rawDatas:[],
  157. }//end return
  158. },//end data
  159. methods: {
  160. listXmIterationStateHis(){
  161. if(!this.filters.product){
  162. this.$notify({position:'bottom-left',showClose:true,message:'请先选中产品',type:'warning'})
  163. return;
  164. }
  165. if(!this.filters.iteration){
  166. this.$notify({position:'bottom-left',showClose:true,message:'请先选中迭代',type:'warning'})
  167. return;
  168. }
  169. var params={...this.params,orderBy:'biz_date asc'}
  170. listXmIterationStateHis(params).then(res=>{
  171. this.rawDatas=res.data.tips.isOk?res.data.data:this.rawDatas;
  172. })
  173. },
  174. open(){
  175. this.visible=true;
  176. this.filters.testPlan=this.xmTestPlan
  177. this.filters.product=this.xmProduct
  178. this.filters.project=this.xmProject
  179. this.filters.iteration=this.xmIteration
  180. this.filters.testCasedb=this.xmTestCasedb
  181. if( this.filters.testPlan && this.filters.testPlan.id){
  182. this.params.planId= this.filters.testPlan.id
  183. }
  184. if( this.filters.product && this.filters.product.id){
  185. this.params.productId= this.filters.product.id
  186. }
  187. if( this.filters.project && this.filters.project.id){
  188. this.params.projectId= this.filters.project.id
  189. }
  190. if( this.filters.iteration && this.filters.iteration.id){
  191. this.params.iterationId= this.filters.iteration.id
  192. }
  193. if( this.filters.testCasedb && this.filters.testCasedb.id){
  194. this.params.casedbId= this.filters.testCasedb.id
  195. }
  196. if(this.cfg && this.cfg.id){
  197. this.params=this.cfg.params
  198. this.title=this.cfg.title
  199. this.remark=this.cfg.remark
  200. }
  201. if(this.showToolBar && !this.title){
  202. this.title="企业工作项每日趋势图"
  203. }
  204. if(this.$refs['xmProductSelect'])this.$refs['xmProductSelect'].clearSelect();
  205. if(this.$refs['xmIterationSelect'])this.$refs['xmIterationSelect'].clearSelect();
  206. this.listXmIterationStateHis();
  207. },
  208. drawCharts() {
  209. this.myChart = this.$echarts.init(document.getElementById(this.id));
  210. this.myChart.setOption(
  211. {
  212. title: {
  213. text: this.titleCpd,
  214. left: 'center'
  215. },
  216. tooltip: {
  217. trigger: 'axis'
  218. },
  219. barMaxWidth: 100,
  220. toolbox: {
  221. show: true,
  222. top:"5%",
  223. right:"10px",
  224. feature: {
  225. dataView: { show: true, readOnly: false },
  226. magicType: { show: true, type: ['line', 'bar'] },
  227. saveAsImage: { show: true }
  228. }
  229. },
  230. calculable: true,
  231. legend: {
  232. bottom: 'bottom',
  233. data: ['未开始故事数','执行中故事数','已完成故事数','已关闭故事数']
  234. },
  235. xAxis: {
  236. type: 'category',
  237. data: this.datesCpd
  238. },
  239. yAxis: {
  240. type: 'value'
  241. },
  242. series: [
  243. {
  244. name:'未开始故事数',
  245. data: this.menuUnstartCntCpd,
  246. type: 'line',
  247. smooth: true,
  248. itemStyle: {
  249. normal: {
  250. // 折点颜色样式
  251. color: 'orange',
  252. lineStyle: {
  253. // 折线颜色样式
  254. color: 'orange'
  255. }
  256. }
  257. },
  258. },
  259. {
  260. name:'执行中故事数',
  261. data: this.menuExecCntCpd,
  262. type: 'line',
  263. smooth: true,
  264. itemStyle: {
  265. normal: {
  266. // 折点颜色样式
  267. color: 'blue',
  268. lineStyle: {
  269. // 折线颜色样式
  270. color: 'blue'
  271. }
  272. }
  273. },
  274. },
  275. {
  276. name:'已完成故事数',
  277. data: this.menuFinishCntCpd,
  278. type: 'line',
  279. smooth: true,
  280. itemStyle: {
  281. normal: {
  282. // 折点颜色样式
  283. color: 'green',
  284. lineStyle: {
  285. // 折线颜色样式
  286. color: 'green'
  287. }
  288. }
  289. },
  290. },
  291. {
  292. name:'已关闭故事数',
  293. data: this.menuCloseCntCpd,
  294. type: 'line',
  295. smooth: true,
  296. itemStyle: {
  297. normal: {
  298. // 折点颜色样式
  299. color: 'red',
  300. lineStyle: {
  301. // 折线颜色样式
  302. color: 'red'
  303. }
  304. }
  305. },
  306. }
  307. ]
  308. }
  309. )
  310. },
  311. onProductSelected(product){
  312. this.filters.product=product
  313. },
  314. onProductClear(){
  315. this.filters.product=null
  316. },
  317. onIterationSelected(iteration){
  318. this.filters.iteration=iteration
  319. },
  320. onIterationClear(){
  321. this.filters.iteration=null
  322. }
  323. },//end method
  324. mounted() {
  325. /**
  326. initSimpleDicts('all',['demandSource','demandLvl','demandType','priority','menuStatus'] ).then(res=>{
  327. this.dicts=res.data.data;
  328. })
  329. */
  330. //this.maxTableHeight = util.calcTableMaxHeight(this.$refs.filtersRef.$el)
  331. //this.charts();
  332. this.open();
  333. }//end mounted
  334. }
  335. </script>
  336. <style scoped>
  337. .image {
  338. width: 100%;
  339. display: block;
  340. }
  341. </style>