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.

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