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.

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