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.

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