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.

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