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.

325 lines
8.9 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
  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:['id','cfg','category','showToolBar','showParams','isRptCfg','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. params:{
  116. },
  117. title:'',//报表配置项
  118. remark:'', //报表配置项
  119. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  120. load:{ list: false, edit: false, del: false, add: false },//查询中...
  121. dateRanger:[],
  122. maxTableHeight:300,
  123. visible:false,
  124. xmProductStateHiss:[],
  125. }//end return
  126. },//end data
  127. methods: {
  128. listXmBranchStateHis(){
  129. var params={...this.params,orderBy:'biz_date asc'}
  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. if( this.filters.testPlan && this.filters.testPlan.id){
  142. this.params.planId= this.filters.testPlan.id
  143. }
  144. if( this.filters.product && this.filters.product.id){
  145. this.params.productId= this.filters.product.id
  146. }
  147. if( this.filters.project && this.filters.project.id){
  148. this.params.projectId= this.filters.project.id
  149. }
  150. if( this.filters.iteration && this.filters.iteration.id){
  151. this.params.iterationId= this.filters.iteration.id
  152. }
  153. if( this.filters.testCasedb && this.filters.testCasedb.id){
  154. this.params.casedbId= this.filters.testCasedb.id
  155. }
  156. if(this.cfg && this.cfg.id){
  157. this.params=this.cfg.params
  158. this.title=this.cfg.title
  159. this.remark=this.cfg.remark
  160. }
  161. if(this.showToolBar && !this.title){
  162. this.title="企业工作项每日趋势图"
  163. }
  164. this.xmProductStateHiss=[]
  165. if(this.$refs['xmProductSelect'])this.$refs['xmProductSelect'].clearSelect();
  166. if(this.$refs['xmIterationSelect'])this.$refs['xmIterationSelect'].clearSelect();
  167. this.$nextTick(()=>{
  168. this.listXmBranchStateHis();
  169. })
  170. },
  171. drawCharts() {
  172. this.myChart = this.$echarts.init(document.getElementById(this.id));
  173. this.myChart.setOption(
  174. {
  175. title: {
  176. text: this.titleCpd,
  177. left: 'center'
  178. },
  179. tooltip: {
  180. trigger: 'axis',
  181. axisPointer: {
  182. type: 'cross',
  183. label: {
  184. backgroundColor: '#6a7985'
  185. }
  186. }
  187. },
  188. legend: {
  189. bottom: 'bottom',
  190. data: ['未开始', '执行中', '已完成', '已关闭']
  191. },
  192. grid: {
  193. containLabel: true
  194. },
  195. toolbox: {
  196. show: true,
  197. top:"5%",
  198. right:"10px",
  199. feature: {
  200. dataView: { show: true, readOnly: false },
  201. magicType: { show: true, type: ['line', 'bar'] },
  202. saveAsImage: { show: true }
  203. }
  204. },
  205. xAxis: {
  206. type: 'category',
  207. boundaryGap: false,
  208. data: this.datesCpd,
  209. },
  210. yAxis: {
  211. type: 'value'
  212. },
  213. series: [
  214. {
  215. name: '未开始',
  216. type: 'line',
  217. stack: 'Total',
  218. areaStyle: {},
  219. emphasis: {
  220. focus: 'series'
  221. },
  222. data: this.menuUnstartCntCpd
  223. },
  224. {
  225. name: '执行中',
  226. type: 'line',
  227. stack: 'Total',
  228. areaStyle: {},
  229. emphasis: {
  230. focus: 'series'
  231. },
  232. data: this.menuExecCntCpd,
  233. },
  234. {
  235. name: '已完成',
  236. type: 'line',
  237. stack: 'Total',
  238. areaStyle: {},
  239. emphasis: {
  240. focus: 'series'
  241. },
  242. data: this.menuFinishCntCpd,
  243. },
  244. {
  245. name: '已关闭',
  246. type: 'line',
  247. stack: 'Total',
  248. areaStyle: {},
  249. emphasis: {
  250. focus: 'series'
  251. },
  252. label: {
  253. show: true,
  254. position: 'top'
  255. },
  256. data: this.menuCloseCntCpd,
  257. }
  258. ]
  259. }
  260. )
  261. },
  262. onProductSelected(product){
  263. this.filters.product=product
  264. this.xmProductStateHiss=[];
  265. },
  266. onProductClear(){
  267. this.filters.product=null
  268. this.xmProductStateHiss=[];
  269. },
  270. onIterationSelected(iteration){
  271. this.filters.iteration=iteration
  272. this.xmProductStateHiss=[];
  273. },
  274. onIterationClear(){
  275. this.filters.iteration=null
  276. this.xmProductStateHiss=[];
  277. }
  278. },//end method
  279. mounted() {
  280. /**
  281. initSimpleDicts('all',['demandSource','demandLvl','demandType','priority','menuStatus'] ).then(res=>{
  282. this.dicts=res.data.data;
  283. })
  284. */
  285. this.maxTableHeight = util.calcTableMaxHeight(this.$refs.filtersRef.$el)
  286. //this.charts();
  287. this.open();
  288. }//end mounted
  289. }
  290. </script>
  291. <style scoped>
  292. .image {
  293. width: 100%;
  294. display: block;
  295. }
  296. </style>