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.

278 lines
7.1 KiB

3 years ago
  1. <template>
  2. <section>
  3. <el-dialog fullscreen :title="dialogTitle" append-to-body modal-append-to-body width="80%" top="20px" :visible.sync="visible">
  4. <el-row :gutter="5" v-if="visible">
  5. <el-col :span="18">
  6. <div>
  7. <div class="main" id="iterationMenuDayTrend"
  8. style="width:100%;height:600px;margin:0 auto;"></div>
  9. <div class="progress"></div>
  10. </div>
  11. </el-col>
  12. <el-col :span="6" class="border">
  13. <el-form :model="filters" class="padding">
  14. <el-form-item label="日期区间">
  15. <br>
  16. <mdp-date-range v-model="filters" value-format="yyyy-MM-dd" start-key="startBizDate" end-key="endBizDate"></mdp-date-range>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button type="primary" icon="el-icon-search" @click="listXmBranchStateHis">查询</el-button>
  20. </el-form-item>
  21. </el-form>
  22. </el-col>
  23. </el-row>
  24. </el-dialog>
  25. </section>
  26. </template>
  27. <script>
  28. import util from '@/common/js/util';//全局公共库
  29. import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
  30. import { mapGetters } from 'vuex'
  31. import { listXmBranchStateHis } from '@/api/xm/core/xmBranchStateHis';
  32. import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//产品选择界面
  33. import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect';//迭代选择界面
  34. export default {
  35. components: {
  36. XmIterationSelect,XmProductSelect,
  37. },
  38. props:['xmProduct','xmProject','xmIteration'],
  39. computed: {
  40. ...mapGetters([
  41. 'userInfo','roles'
  42. ]),
  43. datesCpd(){
  44. if(this.xmProductStateHiss.length==0){
  45. return []
  46. }else{
  47. return this.xmProductStateHiss.map(i=>i.bizDate)
  48. }
  49. },
  50. menuCloseCntCpd(){
  51. if(this.xmProductStateHiss.length==0){
  52. return []
  53. }else{
  54. return this.xmProductStateHiss.map(i=>i.menuCloseCnt)
  55. }
  56. },
  57. menuUnstartCntCpd(){
  58. if(this.xmProductStateHiss.length==0){
  59. return []
  60. }else{
  61. return this.xmProductStateHiss.map(i=> i.menuUnstartCnt)
  62. }
  63. },
  64. menuExecCntCpd(){
  65. if(this.xmProductStateHiss.length==0){
  66. return []
  67. }else{
  68. return this.xmProductStateHiss.map(i=> i.menuExecCnt)
  69. }
  70. },
  71. menuFinishCntCpd(){
  72. if(this.xmProductStateHiss.length==0){
  73. return []
  74. }else{
  75. return this.xmProductStateHiss.map(i=>i.menuFinishCnt)
  76. }
  77. },
  78. dialogTitle(){
  79. if(this.xmIteration && this.xmIteration.id){
  80. return (this.xmIteration?'迭代【'+this.xmIteration.iterationName+'】':'')+'需求每日趋势图'
  81. }else {
  82. return (this.filters.product?'产品【'+this.filters.product.productName+'】':'')+'需求每日趋势图'
  83. }
  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. filters:{
  105. category:'',
  106. product:null,
  107. project:null,
  108. iteration:null,
  109. },
  110. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  111. load:{ list: false, edit: false, del: false, add: false },//查询中...
  112. dateRanger:[],
  113. maxTableHeight:300,
  114. visible:false,
  115. xmProductStateHiss:[],
  116. }//end return
  117. },//end data
  118. methods: {
  119. listXmBranchStateHis(){
  120. var params={orderBy:'biz_date asc'}
  121. if(this.filters.startBizDate && this.filters.endBizDate){
  122. params.startBizDate=this.filters.startBizDate;
  123. params.endBizDate=this.filters.endBizDate;
  124. }
  125. listXmBranchStateHis(params).then(res=>{
  126. this.xmProductStateHiss=res.data.tips.isOk?res.data.data:this.xmProductStateHiss;
  127. })
  128. },
  129. open(params){
  130. this.visible=true;
  131. this.filters.product=params.xmProduct
  132. this.filters.project=params.xmProject
  133. this.filters.iteration=params.xmIteration
  134. if(this.$refs['xmProductSelect'])this.$refs['xmProductSelect'].clearSelect();
  135. if(this.$refs['xmIterationSelect'])this.$refs['xmIterationSelect'].clearSelect();
  136. this.listXmBranchStateHis();
  137. },
  138. drawCharts() {
  139. this.myChart = this.$echarts.init(document.getElementById("iterationMenuDayTrend"));
  140. this.myChart.setOption(
  141. {
  142. legend: {
  143. right: 40,
  144. data: ['未开始故事数','执行中故事数','已完成故事数','已关闭故事数']
  145. },
  146. xAxis: {
  147. type: 'category',
  148. data: this.datesCpd
  149. },
  150. yAxis: {
  151. type: 'value'
  152. },
  153. series: [
  154. {
  155. name:'未开始故事数',
  156. data: this.menuUnstartCntCpd,
  157. type: 'line',
  158. smooth: true,
  159. itemStyle: {
  160. normal: {
  161. // 折点颜色样式
  162. color: 'orange',
  163. lineStyle: {
  164. // 折线颜色样式
  165. color: 'orange'
  166. }
  167. }
  168. },
  169. },
  170. {
  171. name:'执行中故事数',
  172. data: this.menuExecCntCpd,
  173. type: 'line',
  174. smooth: true,
  175. itemStyle: {
  176. normal: {
  177. // 折点颜色样式
  178. color: 'blue',
  179. lineStyle: {
  180. // 折线颜色样式
  181. color: 'blue'
  182. }
  183. }
  184. },
  185. },
  186. {
  187. name:'已完成故事数',
  188. data: this.menuFinishCntCpd,
  189. type: 'line',
  190. smooth: true,
  191. itemStyle: {
  192. normal: {
  193. // 折点颜色样式
  194. color: 'green',
  195. lineStyle: {
  196. // 折线颜色样式
  197. color: 'green'
  198. }
  199. }
  200. },
  201. },
  202. {
  203. name:'已关闭故事数',
  204. data: this.menuCloseCntCpd,
  205. type: 'line',
  206. smooth: true,
  207. itemStyle: {
  208. normal: {
  209. // 折点颜色样式
  210. color: 'red',
  211. lineStyle: {
  212. // 折线颜色样式
  213. color: 'red'
  214. }
  215. }
  216. },
  217. }
  218. ]
  219. }
  220. )
  221. },
  222. onProductSelected(product){
  223. this.filters.product=product
  224. this.xmProductStateHiss=[];
  225. },
  226. onProductClear(){
  227. this.filters.product=null
  228. this.xmProductStateHiss=[];
  229. },
  230. onIterationSelected(iteration){
  231. this.filters.iteration=iteration
  232. this.xmProductStateHiss=[];
  233. },
  234. onIterationClear(){
  235. this.filters.iteration=null
  236. this.xmProductStateHiss=[];
  237. }
  238. },//end method
  239. mounted() {
  240. /**
  241. initSimpleDicts('all',['demandSource','demandLvl','demandType','priority','menuStatus'] ).then(res=>{
  242. this.dicts=res.data.data;
  243. })
  244. */
  245. //this.charts();
  246. //this.drawCharts();
  247. }//end mounted
  248. }
  249. </script>
  250. <style scoped>
  251. .image {
  252. width: 100%;
  253. display: block;
  254. }
  255. </style>