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.

354 lines
9.5 KiB

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
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 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
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="18"> <div>
  5. <div class="echart-box" :id="this.id"></div>
  6. </div>
  7. </el-col>
  8. <el-col :span="6" 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;" icon="el-icon-more" @click="filterVisible=!filterVisible"></el-button>
  11. <el-row>
  12. <el-button type="danger" icon="el-icon-delete" @click="doDelete">从报告移出该报表</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','xmProduct','xmProject'],
  46. computed: {
  47. ...mapGetters([
  48. 'userInfo','roles'
  49. ]),
  50. datesCpd(){
  51. if(this.xmProjectStateHiss.length==0){
  52. return []
  53. }else{
  54. return this.xmProjectStateHiss.map(i=>i.bizDate)
  55. }
  56. },
  57. taskCloseCntCpd(){
  58. if(this.xmProjectStateHiss.length==0){
  59. return []
  60. }else{
  61. return this.xmProjectStateHiss.map(i=>i.taskCloseCnt)
  62. }
  63. },
  64. taskUnstartCntCpd(){
  65. if(this.xmProjectStateHiss.length==0){
  66. return []
  67. }else{
  68. return this.xmProjectStateHiss.map(i=> i.taskUnstartCnt)
  69. }
  70. },
  71. taskExecCntCpd(){
  72. if(this.xmProjectStateHiss.length==0){
  73. return []
  74. }else{
  75. return this.xmProjectStateHiss.map(i=> i.taskExecCnt)
  76. }
  77. },
  78. taskFinishCntCpd(){
  79. if(this.xmProjectStateHiss.length==0){
  80. return []
  81. }else{
  82. return this.xmProjectStateHiss.map(i=>i.taskFinishCnt)
  83. }
  84. },
  85. taskFinishCntCpd(){
  86. if(this.xmProjectStateHiss.length==0){
  87. return []
  88. }else{
  89. return this.xmProjectStateHiss.map(i=>i.taskFinishCnt)
  90. }
  91. },
  92. taskSetCntCpd(){
  93. if(this.xmProjectStateHiss.length==0){
  94. return []
  95. }else{
  96. return this.xmProjectStateHiss.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. xmProjectStateHiss:[],
  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.xmProjectStateHiss=res.data.tips.isOk?res.data.data:this.xmProjectStateHiss;
  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. this.xmProjectStateHiss=[]
  194. if(this.$refs['xmProjectSelect'])this.$refs['xmProjectSelect'].clearSelect();
  195. this.$nextTick(()=>{
  196. this.listXmProjectStateHis();
  197. })
  198. },
  199. drawCharts() {
  200. this.myChart = this.$echarts.init(document.getElementById(this.id));
  201. this.myChart.setOption(
  202. {
  203. title: {
  204. text: this.titleCpd,
  205. left:"center"
  206. },
  207. tooltip: {
  208. trigger: 'axis',
  209. axisPointer: {
  210. type: 'cross',
  211. label: {
  212. backgroundColor: '#6a7985'
  213. }
  214. }
  215. },
  216. calculable: true,
  217. barMaxWidth: 100,
  218. legend: {
  219. bottom: 'bottom',
  220. data: ['未开始', '执行中', '已验收','已结算', '已关闭']
  221. },
  222. grid: {
  223. containLabel: true
  224. },
  225. toolbox: {
  226. show: true,
  227. top:"5%",
  228. right:"10px",
  229. feature: {
  230. dataView: { show: true, readOnly: false },
  231. magicType: { show: true, type: ['line', 'bar'] },
  232. saveAsImage: { show: true }
  233. }
  234. },
  235. xAxis: {
  236. type: 'category',
  237. boundaryGap: false,
  238. data: this.datesCpd,
  239. },
  240. yAxis: {
  241. type: 'value'
  242. },
  243. series: [
  244. {
  245. name: '未开始',
  246. type: 'line',
  247. stack: 'Total',
  248. areaStyle: {},
  249. emphasis: {
  250. focus: 'series'
  251. },
  252. data: this.taskUnstartCntCpd
  253. },
  254. {
  255. name: '执行中',
  256. type: 'line',
  257. stack: 'Total',
  258. areaStyle: {},
  259. emphasis: {
  260. focus: 'series'
  261. },
  262. data: this.taskExecCntCpd,
  263. },
  264. {
  265. name: '已验收',
  266. type: 'line',
  267. stack: 'Total',
  268. areaStyle: {},
  269. emphasis: {
  270. focus: 'series'
  271. },
  272. data: this.taskFinishCntCpd,
  273. },
  274. {
  275. name: '已结算',
  276. type: 'line',
  277. stack: 'Total',
  278. areaStyle: {},
  279. emphasis: {
  280. focus: 'series'
  281. },
  282. data: this.taskSetCntCpd,
  283. },
  284. {
  285. name: '已关闭',
  286. type: 'line',
  287. stack: 'Total',
  288. areaStyle: {},
  289. emphasis: {
  290. focus: 'series'
  291. },
  292. data: this.taskCloseCntCpd,
  293. }
  294. ]
  295. }
  296. )
  297. },
  298. onProjectSelected(project){
  299. this.filters.project=project
  300. },
  301. onProjectClear(){
  302. this.filters.project=null
  303. },
  304. },//end method
  305. mounted() {
  306. /**
  307. initSimpleDicts('all',['planType','xmTaskSettleSchemel','taskType','priority','taskState'] ).then(res=>{
  308. this.dicts=res.data.data;
  309. })
  310. */
  311. //this.maxTableHeight = util.calcTableMaxHeight(this.$refs.filtersRef.$el)
  312. //this.charts();
  313. this.open();
  314. }//end mounted
  315. }
  316. </script>
  317. <style scoped>
  318. .image {
  319. width: 100%;
  320. display: block;
  321. }
  322. </style>