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.

341 lines
9.6 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
  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','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. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  138. load:{ list: false, edit: false, del: false, add: false },//查询中...
  139. dateRanger:[],
  140. maxTableHeight:300,
  141. visible:false,
  142. xmProductStateHiss:[],
  143. }//end return
  144. },//end data
  145. methods: {
  146. listXmIterationStateHis(){
  147. if(!this.filters.product){
  148. this.$notify({position:'bottom-left',showClose:true,message:'请先选中产品',type:'warning'})
  149. return;
  150. }
  151. if(!this.filters.iteration){
  152. this.$notify({position:'bottom-left',showClose:true,message:'请先选中迭代',type:'warning'})
  153. return;
  154. }
  155. var params={productId:this.filters.product.id,iterationId:this.filters.iteration.id,orderBy:'biz_date asc'}
  156. if(this.filters.startBizDate && this.filters.endBizDate){
  157. params.startBizDate=this.filters.startBizDate;
  158. params.endBizDate=this.filters.endBizDate;
  159. }
  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.$refs['xmProductSelect'])this.$refs['xmProductSelect'].clearSelect();
  172. if(this.$refs['xmIterationSelect'])this.$refs['xmIterationSelect'].clearSelect();
  173. this.$nextTick(()=>{
  174. this.listXmIterationStateHis();
  175. })
  176. },
  177. drawCharts() {
  178. this.myChart = this.$echarts.init(document.getElementById(this.id));
  179. this.myChart.setOption(
  180. {
  181. title: {
  182. text: this.titleCpd,
  183. left: 'center'
  184. },
  185. tooltip: {
  186. trigger: 'axis'
  187. },
  188. barMaxWidth: 100,
  189. toolbox: {
  190. show: true,
  191. top:"5%",
  192. right:"10px",
  193. feature: {
  194. dataView: { show: true, readOnly: false },
  195. magicType: { show: true, type: ['line', 'bar'] },
  196. saveAsImage: { show: true }
  197. }
  198. },
  199. calculable: true,
  200. legend: {
  201. bottom: 'bottom',
  202. data: ['新提出','执行中','已解决','已关闭']
  203. },
  204. xAxis: {
  205. type: 'category',
  206. data: this.datesCpd
  207. },
  208. yAxis: {
  209. type: 'value'
  210. },
  211. series: [
  212. {
  213. name:'新提出',
  214. data: this.activeBugsCpd,
  215. type: 'line',
  216. smooth: true,
  217. itemStyle: {
  218. normal: {
  219. // 折点颜色样式
  220. color: 'orange',
  221. lineStyle: {
  222. // 折线颜色样式
  223. color: 'orange'
  224. }
  225. }
  226. },
  227. },
  228. {
  229. name:'执行中',
  230. data: this.confirmedBugsCpd,
  231. type: 'line',
  232. smooth: true,
  233. itemStyle: {
  234. normal: {
  235. // 折点颜色样式
  236. color: 'blue',
  237. lineStyle: {
  238. // 折线颜色样式
  239. color: 'blue'
  240. }
  241. }
  242. },
  243. },
  244. {
  245. name:'已解决',
  246. data: this.resolvedBugsCpd,
  247. type: 'line',
  248. smooth: true,
  249. itemStyle: {
  250. normal: {
  251. // 折点颜色样式
  252. color: 'green',
  253. lineStyle: {
  254. // 折线颜色样式
  255. color: 'green'
  256. }
  257. }
  258. },
  259. },
  260. {
  261. name:'已关闭',
  262. data: this.closedBugsCpd,
  263. type: 'line',
  264. smooth: true,
  265. itemStyle: {
  266. normal: {
  267. // 折点颜色样式
  268. color: 'red',
  269. lineStyle: {
  270. // 折线颜色样式
  271. color: 'red'
  272. }
  273. }
  274. },
  275. }
  276. ]
  277. }
  278. )
  279. },
  280. onProductSelected(product){
  281. this.filters.product=product
  282. this.xmProductStateHiss=[];
  283. },
  284. onProductClear(){
  285. this.filters.product=null
  286. this.xmProductStateHiss=[];
  287. },
  288. onIterationSelected(iteration){
  289. this.filters.iteration=iteration
  290. this.xmProductStateHiss=[];
  291. },
  292. onIterationClear(){
  293. this.filters.iteration=null
  294. this.xmProductStateHiss=[];
  295. }
  296. },//end method
  297. mounted() {
  298. /**
  299. initSimpleDicts('all',['demandSource','demandLvl','demandType','priority','menuStatus'] ).then(res=>{
  300. this.dicts=res.data.data;
  301. })
  302. */
  303. this.maxTableHeight = util.calcTableMaxHeight(this.$refs.filtersRef.$el)
  304. //this.charts();
  305. this.open();
  306. }//end mounted
  307. }
  308. </script>
  309. <style scoped>
  310. .image {
  311. width: 100%;
  312. display: block;
  313. }
  314. </style>