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.

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