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.

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