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.

298 lines
8.2 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
  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">
  5. <el-col :span="18"> <div>
  6. <div class="main" id="menuDayAccumulate"
  7. style="width:100%;height:600px;margin:0 auto;"></div>
  8. </div>
  9. </el-col>
  10. <el-col :span="6" class="border padding">
  11. <el-form :model="filters">
  12. <el-form-item label="归属产品" >
  13. <xm-product-select v-if="!xmProductCpd || !xmProductCpd.id" ref="xmProductSelect" style="display:inline;" :auto-select="false" :link-project-id="xmProject?xmProject.id:null" @row-click="onProductSelected" :iterationId="xmIteration?xmIteration.id:null" @clear="onProductClear"></xm-product-select>
  14. <span v-else>{{xmProductCpd.id}} <span v-if="xmProductCpd.productName"><br/>{{ xmProductCpd.productName }} </span> </span>
  15. </el-form-item>
  16. <el-form-item label="归属迭代">
  17. <xm-iteration-select v-if="!xmIteration || !xmIteration.id" ref="xmIterationSelect" :auto-select="false" :product-id="filters.product?filters.product.id:null" :link-project-id="xmProject?xmProject.id:null" placeholder="迭代" @row-click="onIterationSelected" @clear="onIterationClear"></xm-iteration-select>
  18. <span v-else> {{xmIteration.id}}
  19. <span v-if="xmIteration.iterationName"><br/>{{ xmIteration.iterationName }} </span></span>
  20. </el-form-item>
  21. <el-form-item label="日期区间">
  22. <br>
  23. <mdp-date-range v-model="filters" value-format="yyyy-MM-dd" start-key="startBizDate" end-key="endBizDate"></mdp-date-range>
  24. </el-form-item>
  25. <el-form-item>
  26. <el-button type="primary" icon="el-icon-search" @click="listXmIterationStateHis">查询</el-button>
  27. </el-form-item>
  28. </el-form>
  29. </el-col>
  30. </el-row>
  31. </el-dialog>
  32. </section>
  33. </template>
  34. <script>
  35. import util from '@/common/js/util';//全局公共库
  36. import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
  37. import { mapGetters } from 'vuex'
  38. import { listXmIterationStateHis } from '@/api/xm/core/xmIterationStateHis';
  39. import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//新增界面
  40. export default {
  41. components: {
  42. XmProductSelect,
  43. },
  44. props:['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. dialogTitle(){
  85. if(this.xmIteration && this.xmIteration.id){
  86. return (this.xmIteration?'迭代【'+this.xmIteration.iterationName+'】':'')+'需求每日累积图'
  87. }else {
  88. return (this.filters.product?'产品【'+this.filters.product.productName+'】':'')+'需求每日累积图'
  89. }
  90. },
  91. xmProductCpd(){
  92. if(this.xmIteration && this.xmIteration.id){
  93. return {id:this.xmIteration.productId,productName:this.xmIteration.productName}
  94. }
  95. if(this.xmProduct && this.xmProduct.id){
  96. return this.xmProduct
  97. }
  98. return null;
  99. }
  100. },
  101. watch: {
  102. datesCpd(){
  103. this.$nextTick(()=>{
  104. this.drawCharts();
  105. })
  106. }
  107. },
  108. data() {
  109. return {
  110. filters:{
  111. category:'',
  112. product:null,
  113. project:null,
  114. iteration:null,
  115. },
  116. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  117. load:{ list: false, edit: false, del: false, add: false },//查询中...
  118. dateRanger:[],
  119. maxTableHeight:300,
  120. visible:false,
  121. xmProductStateHiss:[],
  122. }//end return
  123. },//end data
  124. methods: {
  125. listXmIterationStateHis(){
  126. if(!this.filters.product){
  127. this.$notify({position:'bottom-left',showClose:true,message:'请先选中产品',type:'warning'})
  128. return;
  129. }
  130. if(!this.filters.iteration){
  131. this.$notify({position:'bottom-left',showClose:true,message:'请先选中迭代',type:'warning'})
  132. return;
  133. }
  134. var params={productId:this.filters.product.id,iterationId:this.filters.iteration.id,orderBy:'biz_date asc'}
  135. if(this.filters.startBizDate && this.filters.endBizDate){
  136. params.startBizDate=this.filters.startBizDate;
  137. params.endBizDate=this.filters.endBizDate;
  138. }
  139. listXmIterationStateHis(params).then(res=>{
  140. this.xmProductStateHiss=res.data.tips.isOk?res.data.data:this.xmProductStateHiss;
  141. })
  142. },
  143. open(params){
  144. this.visible=true;
  145. this.filters.product=params.xmProduct
  146. this.filters.project=params.xmProject
  147. this.filters.iteration=params.xmIteration
  148. this.xmProductStateHiss=[]
  149. if(this.$refs['xmProductSelect'])this.$refs['xmProductSelect'].clearSelect();
  150. if(this.$refs['xmIterationSelect'])this.$refs['xmIterationSelect'].clearSelect();
  151. this.$nextTick(()=>{
  152. this.listXmIterationStateHis();
  153. })
  154. },
  155. drawCharts() {
  156. this.myChart = this.$echarts.init(document.getElementById("menuDayAccumulate"));
  157. this.myChart.setOption(
  158. {
  159. title: {
  160. text: '需求累积图'
  161. },
  162. tooltip: {
  163. trigger: 'axis',
  164. axisPointer: {
  165. type: 'cross',
  166. label: {
  167. backgroundColor: '#6a7985'
  168. }
  169. }
  170. },
  171. legend: {
  172. data: ['未开始', '执行中', '已完成', '已关闭']
  173. },
  174. grid: {
  175. left: '3%',
  176. right: '4%',
  177. bottom: '3%',
  178. containLabel: true
  179. },
  180. toolbox: {
  181. feature: {
  182. saveAsImage: {}
  183. }
  184. },
  185. xAxis: {
  186. type: 'category',
  187. boundaryGap: false,
  188. data: this.datesCpd,
  189. },
  190. yAxis: {
  191. type: 'value'
  192. },
  193. series: [
  194. {
  195. name: '未开始',
  196. type: 'line',
  197. stack: 'Total',
  198. areaStyle: {},
  199. emphasis: {
  200. focus: 'series'
  201. },
  202. data: this.menuUnstartCntCpd
  203. },
  204. {
  205. name: '执行中',
  206. type: 'line',
  207. stack: 'Total',
  208. areaStyle: {},
  209. emphasis: {
  210. focus: 'series'
  211. },
  212. data: this.menuExecCntCpd,
  213. },
  214. {
  215. name: '已完成',
  216. type: 'line',
  217. stack: 'Total',
  218. areaStyle: {},
  219. emphasis: {
  220. focus: 'series'
  221. },
  222. data: this.menuFinishCntCpd,
  223. },
  224. {
  225. name: '已关闭',
  226. type: 'line',
  227. stack: 'Total',
  228. areaStyle: {},
  229. emphasis: {
  230. focus: 'series'
  231. },
  232. label: {
  233. show: true,
  234. position: 'top'
  235. },
  236. data: this.menuCloseCntCpd,
  237. }
  238. ]
  239. }
  240. )
  241. },
  242. onProductSelected(product){
  243. this.filters.product=product
  244. this.xmProductStateHiss=[];
  245. },
  246. onProductClear(){
  247. this.filters.product=null
  248. this.xmProductStateHiss=[];
  249. },
  250. onIterationSelected(iteration){
  251. this.filters.iteration=iteration
  252. this.xmProductStateHiss=[];
  253. this.listXmIterationStateHis();
  254. },
  255. onIterationClear(){
  256. this.filters.iteration=null
  257. this.xmProductStateHiss=[];
  258. }
  259. },//end method
  260. mounted() {
  261. /**
  262. initSimpleDicts('all',['demandSource','demandLvl','demandType','priority','menuStatus'] ).then(res=>{
  263. this.dicts=res.data.data;
  264. })
  265. */
  266. //this.charts();
  267. //this.drawCharts()
  268. }//end mounted
  269. }
  270. </script>
  271. <style scoped>
  272. .image {
  273. width: 100%;
  274. display: block;
  275. }
  276. </style>