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.

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