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.

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