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.

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