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.

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