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.

371 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="filters" class="padding" :style="{width:'100%',maxHeight:maxTableHeight+'px',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. closedBugsCpd(){
  60. if(this.xmProductStateHiss.length==0){
  61. return []
  62. }else{
  63. return this.xmProductStateHiss.map(i=>i.closedBugs)
  64. }
  65. },
  66. activeBugsCpd(){
  67. if(this.xmProductStateHiss.length==0){
  68. return []
  69. }else{
  70. return this.xmProductStateHiss.map(i=> i.activeBugs)
  71. }
  72. },
  73. confirmedBugsCpd(){
  74. if(this.xmProductStateHiss.length==0){
  75. return []
  76. }else{
  77. return this.xmProductStateHiss.map(i=> i.confirmedBugs)
  78. }
  79. },
  80. resolvedBugsCpd(){
  81. if(this.xmProductStateHiss.length==0){
  82. return []
  83. }else{
  84. return this.xmProductStateHiss.map(i=>i.resolvedBugs)
  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. filters:{
  130. category:'',
  131. product:null,
  132. project:null,
  133. testPlan:null,
  134. iteration:null,
  135. testCasedb:null,
  136. },
  137. params:{
  138. },
  139. title:'',//报表配置项
  140. remark:'', //报表配置项
  141. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  142. load:{ list: false, edit: false, del: false, add: false },//查询中...
  143. dateRanger:[],
  144. maxTableHeight:300,
  145. visible:false,
  146. xmProductStateHiss:[],
  147. }//end return
  148. },//end data
  149. methods: {
  150. listXmIterationStateHis(){
  151. if(!this.filters.product){
  152. this.$notify({position:'bottom-left',showClose:true,message:'请先选中产品',type:'warning'})
  153. return;
  154. }
  155. if(!this.filters.iteration){
  156. this.$notify({position:'bottom-left',showClose:true,message:'请先选中迭代',type:'warning'})
  157. return;
  158. }
  159. var params={...this.params,orderBy:'biz_date asc'}
  160. listXmIterationStateHis(params).then(res=>{
  161. this.xmProductStateHiss=res.data.tips.isOk?res.data.data:this.xmProductStateHiss;
  162. })
  163. },
  164. open(){
  165. this.visible=true;
  166. this.filters.testPlan=this.xmTestPlan
  167. this.filters.product=this.xmProduct
  168. this.filters.project=this.xmProject
  169. this.filters.iteration=this.xmIteration
  170. this.filters.testCasedb=this.xmTestCasedb
  171. if( this.filters.testPlan && this.filters.testPlan.id){
  172. this.params.planId= this.filters.testPlan.id
  173. }
  174. if( this.filters.product && this.filters.product.id){
  175. this.params.productId= this.filters.product.id
  176. }
  177. if( this.filters.project && this.filters.project.id){
  178. this.params.projectId= this.filters.project.id
  179. }
  180. if( this.filters.iteration && this.filters.iteration.id){
  181. this.params.iterationId= this.filters.iteration.id
  182. }
  183. if( this.filters.testCasedb && this.filters.testCasedb.id){
  184. this.params.casedbId= this.filters.testCasedb.id
  185. }
  186. if(this.cfg && this.cfg.id){
  187. this.params=this.cfg.params
  188. this.title=this.cfg.title
  189. this.remark=this.cfg.remark
  190. }
  191. if(this.showToolBar && !this.title){
  192. this.title="企业工作项每日趋势图"
  193. }
  194. if(this.$refs['xmProductSelect'])this.$refs['xmProductSelect'].clearSelect();
  195. if(this.$refs['xmIterationSelect'])this.$refs['xmIterationSelect'].clearSelect();
  196. this.$nextTick(()=>{
  197. this.listXmIterationStateHis();
  198. })
  199. },
  200. drawCharts() {
  201. this.myChart = this.$echarts.init(document.getElementById(this.id));
  202. this.myChart.setOption(
  203. {
  204. title: {
  205. text: this.titleCpd,
  206. left: 'center'
  207. },
  208. tooltip: {
  209. trigger: 'axis'
  210. },
  211. barMaxWidth: 100,
  212. toolbox: {
  213. show: true,
  214. top:"5%",
  215. right:"10px",
  216. feature: {
  217. dataView: { show: true, readOnly: false },
  218. magicType: { show: true, type: ['line', 'bar'] },
  219. saveAsImage: { show: true }
  220. }
  221. },
  222. calculable: true,
  223. legend: {
  224. bottom: 'bottom',
  225. data: ['新提出','执行中','已解决','已关闭']
  226. },
  227. xAxis: {
  228. type: 'category',
  229. data: this.datesCpd
  230. },
  231. yAxis: {
  232. type: 'value'
  233. },
  234. series: [
  235. {
  236. name:'新提出',
  237. data: this.activeBugsCpd,
  238. type: 'line',
  239. smooth: true,
  240. itemStyle: {
  241. normal: {
  242. // 折点颜色样式
  243. color: 'orange',
  244. lineStyle: {
  245. // 折线颜色样式
  246. color: 'orange'
  247. }
  248. }
  249. },
  250. },
  251. {
  252. name:'执行中',
  253. data: this.confirmedBugsCpd,
  254. type: 'line',
  255. smooth: true,
  256. itemStyle: {
  257. normal: {
  258. // 折点颜色样式
  259. color: 'blue',
  260. lineStyle: {
  261. // 折线颜色样式
  262. color: 'blue'
  263. }
  264. }
  265. },
  266. },
  267. {
  268. name:'已解决',
  269. data: this.resolvedBugsCpd,
  270. type: 'line',
  271. smooth: true,
  272. itemStyle: {
  273. normal: {
  274. // 折点颜色样式
  275. color: 'green',
  276. lineStyle: {
  277. // 折线颜色样式
  278. color: 'green'
  279. }
  280. }
  281. },
  282. },
  283. {
  284. name:'已关闭',
  285. data: this.closedBugsCpd,
  286. type: 'line',
  287. smooth: true,
  288. itemStyle: {
  289. normal: {
  290. // 折点颜色样式
  291. color: 'red',
  292. lineStyle: {
  293. // 折线颜色样式
  294. color: 'red'
  295. }
  296. }
  297. },
  298. }
  299. ]
  300. }
  301. )
  302. },
  303. onProductSelected(product){
  304. this.filters.product=product
  305. this.xmProductStateHiss=[];
  306. },
  307. onProductClear(){
  308. this.filters.product=null
  309. this.xmProductStateHiss=[];
  310. },
  311. onIterationSelected(iteration){
  312. this.filters.iteration=iteration
  313. this.xmProductStateHiss=[];
  314. },
  315. onIterationClear(){
  316. this.filters.iteration=null
  317. this.xmProductStateHiss=[];
  318. }
  319. },//end method
  320. mounted() {
  321. /**
  322. initSimpleDicts('all',['demandSource','demandLvl','demandType','priority','menuStatus'] ).then(res=>{
  323. this.dicts=res.data.data;
  324. })
  325. */
  326. this.maxTableHeight = util.calcTableMaxHeight(this.$refs.filtersRef.$el)
  327. //this.charts();
  328. this.open();
  329. }//end mounted
  330. }
  331. </script>
  332. <style scoped>
  333. .image {
  334. width: 100%;
  335. display: block;
  336. }
  337. </style>