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.

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