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.

303 lines
9.0 KiB

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
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
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
4 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
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
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="任务状态" prop="taskState">
  17. <el-select style="width:100px;" size="small" v-model="params.taskState" @change="onXmTaskSomeFieldsChange('taskState',$event)" clearable>
  18. <el-option v-for="i in this.dicts.taskState" :label="i.name" :key="i.id" :value="i.id"></el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="任务类型" prop="taskType" >
  22. <el-select style="width:100px;" size="small" v-model="params.taskType" @change="onXmTaskSomeFieldsChange('taskType',$event)" clearable>
  23. <el-option v-for="i in this.dicts.taskType" :label="i.name" :key="i.id" :value="i.id"></el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="任务来源" prop="planType">
  27. <el-select style="width:100px;" size="small" v-model="params.planType" @change="onXmTaskSomeFieldsChange('planType',$event)" clearable>
  28. <el-option v-for="i in this.dicts.planType" :label="i.name" :key="i.id" :value="i.id"></el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item label="任务层次" prop="settleSchemel" >
  32. <el-select style="width:100px;" size="small" v-model="params.settleSchemel" @change="onXmTaskSomeFieldsChange('settleSchemel',$event)" clearable>
  33. <el-option v-for="i in this.dicts.xmTaskSettleSchemel" :label="i.name" :key="i.id" :value="i.id"></el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="优先级别" prop="priority" >
  37. <el-select style="width:100px;" size="small" v-model="params.priority" @change="onXmTaskSomeFieldsChange('priority',$event)" clearable>
  38. <el-option v-for="i in dicts.priority" :label="i.name" :key="i.id" :value="i.id"></el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-button type="primary" icon="el-icon-search" @click="searchXmTaskAgeDist">查询</el-button>
  43. </el-form-item>
  44. </el-form>
  45. </el-col>
  46. </el-row>
  47. </section>
  48. </template>
  49. <script>
  50. import util from '@/common/js/util';//全局公共库
  51. import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询
  52. import { mapGetters } from 'vuex'
  53. import { getXmTaskAgeDist } from '@/api/xm/core/xmTask';
  54. import XmProjectSelect from '@/views/xm/core/components/XmProjectSelect';//新增界面
  55. export default {
  56. components: {
  57. XmProjectSelect,
  58. },
  59. props:['id','cfg','category','showToolBar','showParams','isRptCfg','xmProduct','xmIteration','xmProject'],
  60. computed: {
  61. ...mapGetters([
  62. 'userInfo','roles'
  63. ]),
  64. xmTaskAgeDistsCpd(){
  65. if(this.xmTaskAgeDists.length==0){
  66. return []
  67. }else{
  68. var datas=[]
  69. this.xmTaskAgeDists.forEach(i=>{
  70. var data={...i}
  71. data.name=this.legendCpd[i.name]
  72. datas.push(data)
  73. })
  74. return datas;
  75. }
  76. },
  77. total(){
  78. if(!this.xmTaskAgeDists || this.xmTaskAgeDists.length==0){
  79. return 0
  80. }else{
  81. return this.xmTaskAgeDists.reduce((n, i) => {
  82. return (n += i.value);
  83. }, 0)
  84. }
  85. },
  86. titleCpd(){
  87. var preName=""
  88. if(this.filters.testPlan && this.filters.testPlan.id){
  89. preName=`测试计划【${this.filters.testPlan.name}`
  90. }else if(this.filters.testCasedb && this.filters.testCasedb.id){
  91. preName=`测试库【${this.filters.testCasedb.name}`
  92. }else if(this.filters.iteration && this.filters.iteration.id){
  93. preName=`迭代【${this.filters.iteration.iterationName}`
  94. }else if(this.filters.project && this.filters.project.id){
  95. if(this.filters.project.name){
  96. preName=`项目【${this.filters.project.name}`
  97. }else{
  98. preName=`项目【${this.filters.project.id}`
  99. }
  100. }else if(this.filters.product && this.filters.product.id){
  101. if(this.filters.product.productName){
  102. preName=`产品【${this.filters.product.productName}`
  103. }else{
  104. preName=`产品【${this.filters.product.id}`
  105. }
  106. }
  107. return preName+'任务年龄数量分布'
  108. },
  109. legendCpd(){
  110. return ['0-2天','3-5天','6-7天','8-15天','16-30天','30天以上']
  111. }
  112. },
  113. watch: {
  114. xmTaskAgeDistsCpd(){
  115. this.drawCharts();
  116. }
  117. },
  118. data() {
  119. return {
  120. filterVisible:false,
  121. filters:{
  122. product:null,
  123. project:null,
  124. testPlan:null,
  125. iteration:null,
  126. testCasedb:null,
  127. },
  128. params:{
  129. },
  130. title:'',//报表配置项
  131. remark:'', //报表配置项
  132. dicts:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]}
  133. load:{ list: false, edit: false, del: false, add: false },//查询中...
  134. dateRanger:[],
  135. maxTableHeight:300,
  136. visible:false,
  137. xmTaskAgeDists:[],
  138. }//end return
  139. },//end data
  140. methods: {
  141. open(){
  142. this.visible=true;
  143. this.filters.testPlan=this.xmTestPlan
  144. this.filters.product=this.xmProduct
  145. this.filters.project=this.xmProject
  146. this.filters.iteration=this.xmIteration
  147. this.filters.testCasedb=this.xmTestCasedb
  148. if( this.filters.testPlan && this.filters.testPlan.id){
  149. this.params.planId= this.filters.testPlan.id
  150. }
  151. if( this.filters.product && this.filters.product.id){
  152. this.params.productId= this.filters.product.id
  153. }
  154. if( this.filters.project && this.filters.project.id){
  155. this.params.projectId= this.filters.project.id
  156. }
  157. if( this.filters.iteration && this.filters.iteration.id){
  158. this.params.iterationId= this.filters.iteration.id
  159. }
  160. if( this.filters.testCasedb && this.filters.testCasedb.id){
  161. this.params.casedbId= this.filters.testCasedb.id
  162. }
  163. if(this.cfg && this.cfg.id){
  164. this.params=this.cfg.params
  165. this.title=this.cfg.title
  166. this.remark=this.cfg.remark
  167. }
  168. if(this.showToolBar && !this.title){
  169. this.title="企业工作项每日趋势图"
  170. }
  171. this.searchXmTaskAgeDist();
  172. },
  173. drawCharts() {
  174. this.myChart = this.$echarts.init(document.getElementById(this.id));
  175. this.myChart.setOption(
  176. {
  177. title: {
  178. text: this.titleCpd,
  179. left: 'center'
  180. },
  181. tooltip: {
  182. trigger: 'item',
  183. },
  184. toolbox: {
  185. show: true,
  186. top:"5%",
  187. right:"10px",
  188. feature: {
  189. dataView: { show: true, readOnly: false },
  190. saveAsImage: { show: true },
  191. }
  192. },
  193. calculable: true,
  194. legend:{
  195. bottom: 'bottom',
  196. data:this.legendCpd,
  197. },
  198. graphic: {
  199. type: 'text',
  200. left: 'center',
  201. top: 'center',
  202. style: {
  203. // text: '总数',
  204. text:
  205. '任务数'+this.total ,
  206. textAlign: 'center',
  207. fill: '#333',
  208. width: 30,
  209. height: 30,
  210. fontSize: 14
  211. }
  212. },
  213. series: [
  214. {
  215. type: 'pie',
  216. radius: ['50%','70%'],
  217. data: this.xmTaskAgeDistsCpd,
  218. emphasis: {
  219. itemStyle: {
  220. shadowBlur: 10,
  221. shadowOffsetX: 0,
  222. shadowColor: 'rgba(0, 0, 0, 0.5)'
  223. }
  224. },
  225. label: {
  226. show: true,
  227. formatter:'{b}: {c}  ({d}%)'
  228. },
  229. }
  230. ]
  231. }
  232. )
  233. },
  234. onXmTaskSomeFieldsChange(fieldName,$event){
  235. this.xmTaskAgeDists=[]
  236. },
  237. searchXmTaskAgeDist(){
  238. var params={...this.params}
  239. params.ntype='0'
  240. getXmTaskAgeDist(params).then(res=>{
  241. this.xmTaskAgeDists=res.data.data
  242. })
  243. },
  244. onProjectSelected(project){
  245. this.filters.project=project
  246. },
  247. onProjectClear(){
  248. this.filters.project=null
  249. },
  250. onIterationSelected(iteration){
  251. this.filters.iteration=iteration
  252. },
  253. onIterationClear(){
  254. this.filters.iteration=null
  255. }
  256. },//end method
  257. mounted() {
  258. initSimpleDicts('all',['planType','xmTaskSettleSchemel','taskType','priority','taskState'] ).then(res=>{
  259. this.dicts=res.data.data;
  260. })
  261. //this.maxTableHeight = util.calcTableMaxHeight(this.$refs.filtersRef.$el)
  262. //this.charts();
  263. this.open();
  264. }//end mounted
  265. }
  266. </script>
  267. <style scoped>
  268. .image {
  269. width: 100%;
  270. display: block;
  271. }
  272. </style>