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.

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