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.

352 lines
9.4 KiB

4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 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
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 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
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 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="this.id"></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;z-index: 99999;" 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. <xm-project-select v-if="!xmProject || !xmProject.id" ref="xmProjectSelect" style="display:inline;" :auto-select="false" :link-project-id="xmProject?xmProject.id:null" @row-click="onProjectSelected" @clear="onProjectClear"></xm-project-select>
  19. <span v-else>{{xmProject.id}} <span v-if="xmProject.name"><br/>{{ xmProject.name }} </span> </span>
  20. </el-form-item>
  21. <el-form-item label="日期区间">
  22. <br>
  23. <mdp-date-range v-model="params" 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" style="float:right;" icon="el-icon-search" @click="listXmProjectStateHis">查询</el-button>
  27. </el-form-item>
  28. </el-form>
  29. </el-row>
  30. </el-popover>
  31. </el-col>
  32. </el-row>
  33. </section>
  34. </template>
  35. <script>
  36. import util from '@/common/js/util';//全局公共库
  37. import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
  38. import { mapGetters } from 'vuex'
  39. import { listXmProjectStateHis } from '@/api/xm/core/xmProjectStateHis';
  40. import XmProjectSelect from '@/views/xm/core/components/XmProjectSelect';//新增界面
  41. export default {
  42. components: {
  43. XmProjectSelect,
  44. },
  45. props:['id','cfg','category','showToolBar','showParams','isRptCfg','rptDatas','xmProduct','xmProject'],
  46. computed: {
  47. ...mapGetters([
  48. 'userInfo','roles'
  49. ]),
  50. datesCpd(){
  51. if(this.rawDatas.length==0){
  52. return []
  53. }else{
  54. return this.rawDatas.map(i=>i.bizDate)
  55. }
  56. },
  57. taskCloseCntCpd(){
  58. if(this.rawDatas.length==0){
  59. return []
  60. }else{
  61. return this.rawDatas.map(i=>i.taskCloseCnt)
  62. }
  63. },
  64. taskUnstartCntCpd(){
  65. if(this.rawDatas.length==0){
  66. return []
  67. }else{
  68. return this.rawDatas.map(i=> i.taskUnstartCnt)
  69. }
  70. },
  71. taskExecCntCpd(){
  72. if(this.rawDatas.length==0){
  73. return []
  74. }else{
  75. return this.rawDatas.map(i=> i.taskExecCnt)
  76. }
  77. },
  78. taskFinishCntCpd(){
  79. if(this.rawDatas.length==0){
  80. return []
  81. }else{
  82. return this.rawDatas.map(i=>i.taskFinishCnt)
  83. }
  84. },
  85. taskFinishCntCpd(){
  86. if(this.rawDatas.length==0){
  87. return []
  88. }else{
  89. return this.rawDatas.map(i=>i.taskFinishCnt)
  90. }
  91. },
  92. taskSetCntCpd(){
  93. if(this.rawDatas.length==0){
  94. return []
  95. }else{
  96. return this.rawDatas.map(i=>i.taskSetCnt)
  97. }
  98. },
  99. titleCpd(){
  100. var preName=""
  101. if(this.filters.testPlan && this.filters.testPlan.id){
  102. preName=`测试计划【${this.filters.testPlan.name}`
  103. }else if(this.filters.testCasedb && this.filters.testCasedb.id){
  104. preName=`测试库【${this.filters.testCasedb.name}`
  105. }else if(this.filters.iteration && this.filters.iteration.id){
  106. preName=`迭代【${this.filters.iteration.iterationName}`
  107. }else if(this.filters.project && this.filters.project.id){
  108. if(this.filters.project.name){
  109. preName=`项目【${this.filters.project.name}`
  110. }else{
  111. preName=`项目【${this.filters.project.id}`
  112. }
  113. }else if(this.filters.product && this.filters.product.id){
  114. if(this.filters.product.productName){
  115. preName=`产品【${this.filters.product.productName}`
  116. }else{
  117. preName=`产品【${this.filters.product.id}`
  118. }
  119. }
  120. return preName+"任务每日累积图"
  121. }
  122. },
  123. watch: {
  124. datesCpd(){
  125. this.$nextTick(()=>{
  126. this.drawCharts();
  127. })
  128. }
  129. },
  130. data() {
  131. return {
  132. filterVisible:false,
  133. filters:{
  134. product:null,
  135. project:null,
  136. testPlan:null,
  137. iteration:null,
  138. testCasedb:null,
  139. },
  140. params:{
  141. },
  142. title:'',//报表配置项
  143. remark:'', //报表配置项
  144. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  145. load:{ list: false, edit: false, del: false, add: false },//查询中...
  146. dateRanger:[],
  147. maxTableHeight:300,
  148. visible:false,
  149. rawDatas:[],
  150. }//end return
  151. },//end data
  152. methods: {
  153. listXmProjectStateHis(){
  154. if(!this.filters.project){
  155. this.$notify({position:'bottom-left',showClose:true,message:'请先选中项目',type:'warning'})
  156. return;
  157. }
  158. var params={...this.params,orderBy:'biz_date asc'}
  159. listXmProjectStateHis(params).then(res=>{
  160. this.rawDatas=res.data.tips.isOk?res.data.data:this.rawDatas;
  161. })
  162. },
  163. open(){
  164. this.visible=true;
  165. this.filters.testPlan=this.xmTestPlan
  166. this.filters.product=this.xmProduct
  167. this.filters.project=this.xmProject
  168. this.filters.iteration=this.xmIteration
  169. this.filters.testCasedb=this.xmTestCasedb
  170. if( this.filters.testPlan && this.filters.testPlan.id){
  171. this.params.planId= this.filters.testPlan.id
  172. }
  173. if( this.filters.product && this.filters.product.id){
  174. this.params.productId= this.filters.product.id
  175. }
  176. if( this.filters.project && this.filters.project.id){
  177. this.params.projectId= this.filters.project.id
  178. }
  179. if( this.filters.iteration && this.filters.iteration.id){
  180. this.params.iterationId= this.filters.iteration.id
  181. }
  182. if( this.filters.testCasedb && this.filters.testCasedb.id){
  183. this.params.casedbId= this.filters.testCasedb.id
  184. }
  185. if(this.cfg && this.cfg.id){
  186. this.params=this.cfg.params
  187. this.title=this.cfg.title
  188. this.remark=this.cfg.remark
  189. }
  190. if(this.showToolBar && !this.title){
  191. this.title="企业工作项每日趋势图"
  192. }
  193. if(this.$refs['xmProjectSelect'])this.$refs['xmProjectSelect'].clearSelect();
  194. this.$nextTick(()=>{
  195. this.listXmProjectStateHis();
  196. })
  197. },
  198. drawCharts() {
  199. this.myChart = this.$echarts.init(document.getElementById(this.id));
  200. this.myChart.setOption(
  201. {
  202. title: {
  203. text: this.titleCpd,
  204. left:"center"
  205. },
  206. tooltip: {
  207. trigger: 'axis',
  208. axisPointer: {
  209. type: 'cross',
  210. label: {
  211. backgroundColor: '#6a7985'
  212. }
  213. }
  214. },
  215. calculable: true,
  216. barMaxWidth: 100,
  217. legend: {
  218. bottom: 'bottom',
  219. data: ['未开始', '执行中', '已验收','已结算', '已关闭']
  220. },
  221. grid: {
  222. containLabel: true
  223. },
  224. toolbox: {
  225. show: true,
  226. top:"5%",
  227. right:"10px",
  228. feature: {
  229. dataView: { show: true, readOnly: false },
  230. magicType: { show: true, type: ['line', 'bar'] },
  231. saveAsImage: { show: true }
  232. }
  233. },
  234. xAxis: {
  235. type: 'category',
  236. boundaryGap: false,
  237. data: this.datesCpd,
  238. },
  239. yAxis: {
  240. type: 'value'
  241. },
  242. series: [
  243. {
  244. name: '未开始',
  245. type: 'line',
  246. stack: 'Total',
  247. areaStyle: {},
  248. emphasis: {
  249. focus: 'series'
  250. },
  251. data: this.taskUnstartCntCpd
  252. },
  253. {
  254. name: '执行中',
  255. type: 'line',
  256. stack: 'Total',
  257. areaStyle: {},
  258. emphasis: {
  259. focus: 'series'
  260. },
  261. data: this.taskExecCntCpd,
  262. },
  263. {
  264. name: '已验收',
  265. type: 'line',
  266. stack: 'Total',
  267. areaStyle: {},
  268. emphasis: {
  269. focus: 'series'
  270. },
  271. data: this.taskFinishCntCpd,
  272. },
  273. {
  274. name: '已结算',
  275. type: 'line',
  276. stack: 'Total',
  277. areaStyle: {},
  278. emphasis: {
  279. focus: 'series'
  280. },
  281. data: this.taskSetCntCpd,
  282. },
  283. {
  284. name: '已关闭',
  285. type: 'line',
  286. stack: 'Total',
  287. areaStyle: {},
  288. emphasis: {
  289. focus: 'series'
  290. },
  291. data: this.taskCloseCntCpd,
  292. }
  293. ]
  294. }
  295. )
  296. },
  297. onProjectSelected(project){
  298. this.filters.project=project
  299. },
  300. onProjectClear(){
  301. this.filters.project=null
  302. },
  303. },//end method
  304. mounted() {
  305. /**
  306. initSimpleDicts('all',['planType','xmTaskSettleSchemel','taskType','priority','taskState'] ).then(res=>{
  307. this.dicts=res.data.data;
  308. })
  309. */
  310. //this.maxTableHeight = util.calcTableMaxHeight(this.$refs.filtersRef.$el)
  311. //this.charts();
  312. this.open();
  313. }//end mounted
  314. }
  315. </script>
  316. <style scoped>
  317. .image {
  318. width: 100%;
  319. display: block;
  320. }
  321. </style>