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.

332 lines
9.2 KiB

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