Browse Source

报表配置

master
陈裕财 3 years ago
parent
commit
6b94a92f01
  1. 44
      src/api/xm/core/xmRptConfig.js
  2. 171
      src/views/xm/core/xmRptConfig/XmRptConfigEdit.vue
  3. 317
      src/views/xm/core/xmRptConfig/XmRptConfigMng.vue
  4. 1
      src/views/xm/core/xmTestPlan/XmTestPlanInfo.vue
  5. 210
      src/views/xm/core/xmTestPlan/XmTestPlanRpt.vue
  6. 14
      src/views/xm/core/xmTestPlan/rpt/CompsCard.vue
  7. 10
      src/views/xm/core/xmTestPlan/rpt/CompsSet.vue
  8. 159
      src/views/xm/core/xmTestPlan/rpt/biz/questionAgeDist.vue
  9. 79
      src/views/xm/core/xmTestPlan/rpt/index.vue

44
src/api/xm/core/xmRptConfig.js

@ -0,0 +1,44 @@
import axios from '@/utils/request'
import { getDicts,initSimpleDicts,initComplexDicts } from '@/api/mdp/meta/item';//字典表
import config from '@/common/config'
let base = config.getCoreBasePath();
/**-------------------------与后端通讯接口------------------请写在下面-------------------------------------------- */
/**
* 测试报告配置表
*1 默认只开放普通查询所有查询只要上传 分页参数 {pageNum:当前页码从1开始,pageSize:每页记录数,total:总记录数如果是0后台会自动计算总记录数非0不会自动计算}后台都会自动按分页查询 其它 api用到再打开没用到的api请注释掉
*2 查询新增修改的参数格式 params={id:'报告编号 主键',bizId:'业务编号',name:'报告名称',cuserid:'创建人',cusername:'创建人姓名',ctime:'创建时间',cbranchId:'创建机构',cfg:'报告配置项'}
**/
//普通查询 条件之间and关系
export const listXmRptConfig = params => { return axios.get(`${base}/xm/core/xmRptConfig/list`, { params: params }); };
//删除一条测试报告配置表 params={id:'报告编号 主键'}
export const delXmRptConfig = params => { return axios.post(`${base}/xm/core/xmRptConfig/del`,params); };
//批量删除测试报告配置表 params=[{id:'报告编号 主键'}]
export const batchDelXmRptConfig = params => { return axios.post(`${base}/xm/core/xmRptConfig/batchDel`, params); };
//修改一条测试报告配置表记录
export const editXmRptConfig = params => { return axios.post(`${base}/xm/core/xmRptConfig/edit`, params); };
//新增一条测试报告配置表
export const addXmRptConfig = params => { return axios.post(`${base}/xm/core/xmRptConfig/add`, params); };
//批量修改某些字段
export const editSomeFieldsXmRptConfig = params => { return axios.post(`${base}/xm/core/xmRptConfig/editSomeFields`, params); };
/**-------------------------前端mng|add|edit界面公共函数---------------请写在下面----------------------------------------------- */
//初始化页面上的字典
export const initDicts = (that) => {
var itemCodes=[];//在此添加要加载的字典 如['sex','grade','lvl']
if(itemCodes.length>0){
initSimpleDicts('all',itemCodes).then(res=>{
Object.assign(that.dicts,res.data.data)
});
}
};

171
src/views/xm/core/xmRptConfig/XmRptConfigEdit.vue

@ -0,0 +1,171 @@
<template>
<section class="page-container padding">
<el-row class="page-header">
</el-row>
<el-row class="page-main" :style="{overflowX:'auto',height:maxTableHeight+'px'}" ref="table">
<!--编辑界面 XmRptConfig 测试报告配置表-->
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editFormRef">
<el-form-item label="业务编号" prop="bizId">
<el-input v-model="editForm.bizId" placeholder="业务编号" :maxlength="50" @change="editSomeFields(editForm,'bizId',$event)"></el-input>
</el-form-item>
<el-form-item label="报告编号" prop="id">
<el-input v-model="editForm.id" placeholder="报告编号" :maxlength="50" @change="editSomeFields(editForm,'id',$event)"></el-input>
</el-form-item>
<el-form-item label="报告名称" prop="name">
<el-input v-model="editForm.name" placeholder="报告名称" :maxlength="255" @change="editSomeFields(editForm,'name',$event)"></el-input>
</el-form-item>
<el-form-item label="创建人" prop="cuserid">
<el-input v-model="editForm.cuserid" placeholder="创建人" :maxlength="50" @change="editSomeFields(editForm,'cuserid',$event)"></el-input>
</el-form-item>
<el-form-item label="创建人姓名" prop="cusername">
<el-input v-model="editForm.cusername" placeholder="创建人姓名" :maxlength="255" @change="editSomeFields(editForm,'cusername',$event)"></el-input>
</el-form-item>
<el-form-item label="创建时间" prop="ctime">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.ctime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item label="创建机构" prop="cbranchId">
<el-input v-model="editForm.cbranchId" placeholder="创建机构" :maxlength="50" @change="editSomeFields(editForm,'cbranchId',$event)"></el-input>
</el-form-item>
<el-form-item label="报告配置项" prop="cfg">
<el-input v-model="editForm.cfg" placeholder="报告配置项" :maxlength="2147483647" @change="editSomeFields(editForm,'cfg',$event)"></el-input>
</el-form-item>
</el-form>
</el-row>
<el-row v-if="opType=='add'" class="page-bottom bottom-fixed">
<el-button @click.native="handleCancel">取消</el-button>
<el-button v-loading="load.edit" type="primary" @click.native="saveSubmit" :disabled="load.edit==true">提交</el-button>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from "@/common/config"; //import
import { initDicts, addXmRptConfig,editXmRptConfig,editSomeFieldsXmRptConfig } from '@/api/xm/core/xmRptConfig';
import { mapGetters } from 'vuex'
export default {
name:'xmRptConfigEdit',
components: {
},
computed: {
...mapGetters([ 'userInfo' ]),
},
props:['xmRptConfig','visible','opType'],
watch: {
'xmRptConfig':function( xmRptConfig ) {
if(xmRptConfig){
this.editForm = {...xmRptConfig};
}
},
'visible':function(visible) {
if(visible==true){
this.initData()
}
}
},
data() {
return {
currOpType:'add',//add/edit
load:{ list: false, edit: false, del: false, add: false },//...
dicts:{},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
editFormRules: {
id: [
//{ required: true, message: '', trigger: 'blur' }
]
},
editForm: {
bizId:'',id:'',name:'',cuserid:'',cusername:'',ctime:'',cbranchId:'',cfg:''
},
maxTableHeight:300,
}//end return
},//end data
methods: {
...util,
// @cancel="editFormVisible=false"
handleCancel:function(){
this.$refs['editFormRef'].resetFields();
this.$emit('cancel');
},
//XmRptConfig @submit="afterEditSubmit"
saveSubmit: function () {
this.$refs.editFormRef.validate((valid) => {
if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => {
this.load.edit=true
let params = Object.assign({}, this.editForm);
var func=addXmRptConfig
if(this.currOpType=='edit'){
func=editXmRptConfig
}
func(params).then((res) => {
this.load.edit=false
var tips=res.data.tips;
if(tips.isOk){
this.editForm=res.data.data
this.initData()
this.currOpType="edit";
this.$emit('submit');// @submit="afterAddSubmit"
}
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err =>this.load.edit=false);
});
}else{
this.$notify({ showClose:true, message: "表单验证不通过,请修改表单数据再提交", type: 'error' });
}
});
},
initData: function(){
this.currOpType=this.opType
if(this.xmRptConfig){
this.editForm = Object.assign({},this.xmRptConfig);
}
if(this.opType=='edit'){
}else{
}
this.editFormBak={...this.editForm}
},
editSomeFields(row,fieldName,$event){
if(this.opType=='add'){
return;
}
let params={};
params['ids']=[row].map(i=>i.id)
params[fieldName]=$event
var func = editSomeFieldsXmRptConfig
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
this.editFormBak=[...this.editForm]
}else{
Object.assign(this.editForm,this.editFormBak)
this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'})
}
}).catch((e)=>Object.assign(this.editForm,this.editFormBak))
},
},//end method
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.table.$el)
});
}
}
</script>
<style scoped>
</style>

317
src/views/xm/core/xmRptConfig/XmRptConfigMng.vue

@ -0,0 +1,317 @@
<template>
<section class="page-container border padding">
<el-row>
<el-input v-model="filters.key" style="width: 20%;" placeholder="模糊查询"></el-input>
<el-button v-loading="load.list" :disabled="load.list==true" @click="searchXmRptConfigs" icon="el-icon-search">查询</el-button>
<span style="float:right;">
<el-button type="primary" @click="showAdd" icon="el-icon-plus" plain> </el-button>
<el-button type="danger" v-loading="load.del" @click="batchDel" :disabled="this.sels.length===0 || load.del==true" icon="el-icon-delete" plain></el-button>
</span>
</el-row>
<el-row class="padding-top">
<!--列表 XmRptConfig 测试报告配置表-->
<el-table ref="xmRptConfigTable" :data="xmRptConfigs" :height="maxTableHeight" @sort-change="sortChange" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;">
<el-table-column type="selection" width="55" show-overflow-tooltip fixed="left"></el-table-column>
<el-table-column sortable type="index" width="55" show-overflow-tooltip fixed="left"></el-table-column>
<!--
<el-table-column sortable prop="username" width="55" show-overflow-tooltip fixed="left">
<span class="cell-text"> {{scope.row.username}}} </span>
<span class="cell-bar"><el-input style="display:inline;" v-model="scope.row.username" placeholder="" @change="editSomeFields(scope.row,'username',$event)" :maxlength="22"></el-input></span>
</el-table-column>
-->
<el-table-column prop="id" label="报告编号" min-width="120" show-overflow-tooltip fixed="left"></el-table-column>
<el-table-column prop="bizId" label="业务编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.bizId}} </span>
</template>
</el-table-column>
<el-table-column prop="name" label="报告名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.name}} </span>
</template>
</el-table-column>
<el-table-column prop="cuserid" label="创建人" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.cuserid}} </span>
</template>
</el-table-column>
<el-table-column prop="cusername" label="创建人姓名" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.cusername}} </span>
</template>
</el-table-column>
<el-table-column prop="ctime" label="创建时间" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.ctime}} </span>
</template>
</el-table-column>
<el-table-column prop="cbranchId" label="创建机构" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.cbranchId}} </span>
</template>
</el-table-column>
<el-table-column prop="cfg" label="报告配置项" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.cfg}} </span>
</template>
</el-table-column>
<el-table-column label="操作" width="180" fixed="right">
<template scope="scope">
<el-button type="primary" @click="showEdit( scope.row,scope.$index)" icon="el-icon-edit" plain></el-button>
<el-button type="danger" @click="handleDel(scope.row,scope.$index)" icon="el-icon-delete" plain></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="total, sizes, prev, pager, next" @current-change="handleCurrentChange" @size-change="handleSizeChange" :page-sizes="[10,20, 50, 100, 500]" :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :total="pageInfo.total" style="float:right;"></el-pagination>
</el-row>
<el-row>
<!--编辑 XmRptConfig 测试报告配置表界面-->
<el-drawer title="编辑测试报告配置表" :visible.sync="editFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-rpt-config-edit op-type="edit" :xm-rpt-config="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-rpt-config-edit>
</el-drawer>
<!--新增 XmRptConfig 测试报告配置表界面-->
<el-drawer title="新增测试报告配置表" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-rpt-config-edit op-type="add" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-rpt-config-edit>
</el-drawer>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from '@/common/config';//
import { initDicts,listXmRptConfig, delXmRptConfig, batchDelXmRptConfig,editSomeFieldsXmRptConfig } from '@/api/xm/core/xmRptConfig';
import XmRptConfigEdit from './XmRptConfigEdit';//
import { mapGetters } from 'vuex'
export default {
name:'xmRptConfigMng',
components: {
XmRptConfigEdit,
},
props:['visible'],
computed: {
...mapGetters(['userInfo']),
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmRptConfigs()
}
}
},
data() {
return {
filters: {
key: ''
},
xmRptConfigs: [],//
pageInfo:{//
total:0,//0>0
pageSize:10,//
count:false,//
pageNum:1,//1
orderFields:[],// ['sex','student_id']
orderDirs:[]// asc,desc ['asc','desc']
},
load:{ list: false, edit: false, del: false, add: false },//...
sels: [],//
dicts:{
//sex: [{id:'1',name:''},{id:'2',name:''}]
},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
addFormVisible: false,//xmRptConfig
addForm: {
bizId:'',id:'',name:'',cuserid:'',cusername:'',ctime:'',cbranchId:'',cfg:''
},
editFormVisible: false,//
editForm: {
bizId:'',id:'',name:'',cuserid:'',cusername:'',ctime:'',cbranchId:'',cfg:''
},
maxTableHeight:300,
}
},//end data
methods: {
...util,
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmRptConfigs();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmRptConfigs();
},
// obj.order=ascending/descending, asc/desc ; obj.prop=,
sortChange( obj ){
if(obj.order==null){
this.pageInfo.orderFields=[];
this.pageInfo.orderDirs=[];
}else{
var dir='asc';
if(obj.order=='ascending'){
dir='asc'
}else{
dir='desc';
}
this.pageInfo.orderFields=[util.toLine(obj.prop)];
this.pageInfo.orderDirs=[dir];
}
this.getXmRptConfigs();
},
searchXmRptConfigs(){
this.pageInfo.count=true;
this.getXmRptConfigs();
},
// XmRptConfig
getXmRptConfigs() {
let params = {
pageSize: this.pageInfo.pageSize,
pageNum: this.pageInfo.pageNum,
total: this.pageInfo.total,
count:this.pageInfo.count
};
if(this.pageInfo.orderFields!=null && this.pageInfo.orderFields.length>0){
let orderBys=[];
for(var i=0;i<this.pageInfo.orderFields.length;i++){
orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i])
}
params.orderBy= orderBys.join(",")
}
if(this.filters.key){
params.key=this.filters.key
}
this.load.list = true;
listXmRptConfig(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmRptConfigs = res.data.data;
}else{
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: 'error' });
}
this.load.list = false;
}).catch( err => this.load.list = false );
},
// XmRptConfig
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
// XmRptConfig
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmRptConfigs();
},
afterEditSubmit(){
this.editFormVisible=false;
},
//xmRptConfig
selsChange: function (sels) {
this.sels = sels;
},
//xmRptConfig
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { id:row.id };
delXmRptConfig(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.searchXmRptConfigs();
}
this.$notify({ position:'bottom-left', showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmRptConfig
batchDel: function () {
if(this.sels.length<=0){
return;
}
var params=this.sels.map(i=>{
return { id:i.id}
})
this.$confirm('确认删除选中记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
batchDelXmRptConfig(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.searchXmRptConfigs();
}
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error'});
}).catch( err => this.load.del=false );
});
},
editSomeFields(row,fieldName,$event){
let params={};
if(this.sels.length>0){
if(!this.sels.some(k=> k.id==row.id)){
this.$notify({position:'bottom-left',showClose:true,message:'请编辑选中的行',type:'warning'})
Object.assign(this.editForm,this.editFormBak)
return;
}
params['ids']=this.sels.map(i=>i.id)
}else{
params['ids']=[row].map(i=>i.id)
}
params[fieldName]=$event
var func = editSomeFieldsXmRptConfig
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
if(this.sels.length>0){
this.searchXmRptConfigs();
}
this.editFormBak=[...this.editForm]
}else{
Object.assign(this.editForm,this.editFormBak)
this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'})
}
}).catch((e)=>Object.assign(this.editForm,this.editFormBak))
},
rowClick: function(row, event, column){
this.editForm=row
this.editFormBak={...row};
this.$emit('row-click',row, event, column);// @row-click="rowClick"
},
initData: function(){
},
},//end methods
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
this.searchXmRptConfigs();
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmRptConfigTable.$el)
});
}
}
</script>
<style scoped>
</style>

1
src/views/xm/core/xmTestPlan/XmTestPlanInfo.vue

@ -61,6 +61,7 @@ export default {
name:'xmTestCasedbMng',
components: {
XmProductSelect, XmTestPlanMng,XmTestPlanCaseMng,XmQuestionMng,
"xm-test-plan-rpt":()=>import("./rpt/index.vue")
},
props:['visible','xmTestCasedb'],
computed: {

210
src/views/xm/core/xmTestPlan/XmTestPlanRpt.vue

@ -1,210 +0,0 @@
<template>
<section class="padding">
<el-row ref="table">
<!--编辑界面 XmTestPlan 测试计划-->
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editFormRef" label-position="left">
<el-form-item label="归属项目" prop="projectId">
<span v-if="opType=='add'">
<xm-project-select v-if="!selProject || !selProject.id" ref="xmProjectSelect" :link-product-id="xmTestCasedb? xmTestCasedb.productId:null" @row-click="onPorjectConfirm" :auto-select="false">
<span slot="title">选择项目</span>
</xm-project-select>
<div v-else>{{editForm.projectName}}</div>
</span>
<div v-else>{{editForm.projectName}}</div>
</el-form-item>
<el-form-item prop="name" label-width="0px">
<el-row class="padding-bottom">
<my-input v-model="editForm.name" placeholder="计划名称" :maxlength="255" @change="editSomeFields(editForm,'name',$event)"></my-input>
</el-row>
</el-form-item>
<el-row class="padding">
<el-col :span="8">
<mdp-select-user-xm label="负责人" userid-key="cuserid" username-key="cusername" v-model="editForm" @change="editSomeFields(editForm,'cuserid',$event)"></mdp-select-user-xm>
</el-col>
<el-col :span="8">
<mdp-select-dict-x label="状态" :dict="dicts['testPlanStatus']" v-model="editForm.status" @change="editSomeFields(editForm,'status',$event)"></mdp-select-dict-x>
</el-col>
<el-col :span="8">
<mdp-select-dict-x label="测试结果" :dict="dicts['testPlanTcode']" v-model="editForm.tcode" @change="editSomeFields(editForm,'tcode',$event)"></mdp-select-dict-x>
</el-col>
</el-row>
<el-form-item label="归属测试库" prop="casedbName">
{{editForm.casedbName}}
</el-form-item>
<el-form-item label="归属产品" prop="productName">
{{editForm.productName}}
</el-form-item>
<el-form-item label="起止时间" prop="stime">
<mdp-date-range :auto-default="false" placeholder="选择日期" v-model="editForm" start-key="stime" end-key="etime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" @change="editSomeFields(editForm,'stime',editForm)"></mdp-date-range>
</el-form-item>
</el-form>
</el-row>
<el-row v-if="opType=='add'" >
<span style="float:right;">
<el-button @click.native="handleCancel">取消</el-button>
<el-button v-loading="load.edit" type="primary" @click.native="saveSubmit" :disabled="load.edit==true">提交</el-button>
</span>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from "@/common/config"; //import
import { initDicts, addXmTestPlan,editXmTestPlan,editSomeFieldsXmTestPlan } from '@/api/xm/core/xmTestPlan';
import { mapGetters } from 'vuex'
import XmProjectSelect from '@/views/xm/core/components/XmProjectSelect';
import MdpSelectUserXm from '@/views/xm/core/components/MdpSelectUserXm';//
export default {
name:'xmTestPlanEdit',
components: {
XmProjectSelect,MdpSelectUserXm,
},
computed: {
...mapGetters([ 'userInfo' ]),
},
props:['xmTestPlan','visible','opType','selProject','xmTestCasedb'],
watch: {
'xmTestPlan':function( xmTestPlan ) {
if(xmTestPlan){
this.editForm = {...xmTestPlan};
}
},
'visible':function(visible) {
if(visible==true){
this.initData()
}
}
},
data() {
return {
currOpType:'add',//add/edit
load:{ list: false, edit: false, del: false, add: false },//...
dicts:{
testPlanStatus:[],
testPlanTcode:[],
},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
editFormRules: {
name: [
{ required: true, message: '测试计划名称不能为空', trigger: 'change' },
{ min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'change' },//
],
projectId: [
{ required: true, message: '项目不能为空', trigger: 'change' },
],
},
editForm: {
id:'',name:'',casedbId:'',casedbName:'',projectId:'',projectName:'',cuserid:'',cusername:'',ctime:'',stime:'',etime:'',status:'',tcode:'',totalCases:'',okCases:'',errCases:'',igCases:'',blCases:'',productId:'',productName:'',flowState:''
},
maxTableHeight:300,
}//end return
},//end data
methods: {
...util,
// @cancel="editFormVisible=false"
handleCancel:function(){
this.$refs['editFormRef'].resetFields();
this.$emit('cancel');
},
//XmTestPlan @submit="afterEditSubmit"
saveSubmit: function () {
this.$refs.editFormRef.validate((valid) => {
if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => {
this.load.edit=true
let params = Object.assign({}, this.editForm);
var func=addXmTestPlan
if(this.currOpType=='edit'){
func=editXmTestPlan
}
func(params).then((res) => {
this.load.edit=false
var tips=res.data.tips;
if(tips.isOk){
this.editForm=res.data.data
this.initData()
this.currOpType="edit";
this.$emit('submit');// @submit="afterAddSubmit"
}
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err =>this.load.edit=false);
});
}else{
this.$notify({ showClose:true, message: "表单验证不通过,请修改表单数据再提交", type: 'error' });
}
});
},
initData: function(){
this.currOpType=this.opType
if(this.xmTestPlan){
this.editForm = Object.assign({},this.xmTestPlan);
}
if(this.opType=='edit'){
}else{
}
this.editFormBak={...this.editForm}
},
editSomeFields(row,fieldName,$event){
if(this.opType=='add'){
return;
}
let params={};
params['ids']=[row].map(i=>i.id)
if(fieldName=='stime'){
params[fieldName]=$event.stime
params.etime=$event.etime
}else if(fieldName=='cuserid'){
params[fieldName]=$event[0].userid
params.cusername=$event[0].username
}else{
params[fieldName]=$event
}
var func = editSomeFieldsXmTestPlan
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
this.editFormBak=[...this.editForm]
this.$emit('edit-fields',params)
}else{
Object.assign(this.editForm,this.editFormBak)
this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'})
}
}).catch((e)=>Object.assign(this.editForm,this.editFormBak))
},
onPorjectConfirm(row){
this.editForm.projectId=row.id
this.editForm.projectName=row.name
this.editForm.name=this.editForm.projectName+'-测试计划-V1.0'
}
},//end method
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.table.$el)
});
}
}
</script>
<style scoped>
</style>

14
src/views/xm/core/xmTestPlan/rpt/CompsCard.vue

@ -35,12 +35,14 @@
import VueGridLayout from 'vue-grid-layout';
import { mapGetters } from 'vuex'
import XmTestPlanMng from '@/views/xm/core/xmTestPlan/XmTestPlanMng'
import XmQuestionAgeDist from '@/views/xm/core/xmTestPlan/rpt/biz/questionAgeDist'
export default {
components: {
GridLayout: VueGridLayout.GridLayout,
GridItem: VueGridLayout.GridItem,
XmTestPlanMng,
XmQuestionAgeDist,
},
computed: {
@ -62,8 +64,18 @@ export default {
y: 12,
w: 12,
h: 4,
i: index,
i: 0,
compName:'xm-test-plan-mng',
},
{
// x: (this.layout.length * 6) % (this.layoutColNum || 12),
x: 0,
// y: this.layout.length + (this.layoutColNum || 12),
y: 12,
w: 12,
h: 4,
i: 1,
compName:'xm-question-age-dist',
}
],
//

10
src/views/xm/core/xmTestPlan/rpt/CompsSet.vue

@ -58,7 +58,7 @@ export default {
get: function () {
if(this.value) {
//
this.getUserModules();
}
return this.value;
},
@ -139,13 +139,7 @@ export default {
selectItem(item, index) {
this.$set(item, 'isChecked', !item.isChecked)
},
getUserModules() {
userMenuFavoriteList({}).then(res=>{
localStorage.setItem('fMenus',JSON.stringify(res.data.data));
this.fMenus=res.data.data;
})
},
save() {
let saveModules = [];

159
src/views/xm/core/xmTestPlan/rpt/biz/questionAgeDist.vue

@ -0,0 +1,159 @@
<template>
<section>
<div>
<div class="main" id="xmQuestionAgeDist"
style="width:100%;height:600px;margin:0 auto;"></div>
<div class="progress"></div>
</div>
</section>
</template>
<script>
import util from '@/common/js/util';//
import { initSimpleDicts } from '@/api/mdp/meta/item';//
import { mapGetters } from 'vuex'
import { getXmQuestionAgeDist } from '@/api/xm/core/xmQuestion';
import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect.vue';//
import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//
export default {
components: {
XmIterationSelect,XmProductSelect,
},
props:['xmTestPlan'],
computed: {
...mapGetters([
'userInfo','roles'
]),
xmQuestionAgeDistsCpd(){
if(this.xmQuestionAgeDists.length==0){
return []
}else{
var datas=[]
this.xmQuestionAgeDists.forEach(i=>{
var data={...i}
data.name=this.legendCpd[i.name]
datas.push(data)
})
return datas;
}
},
title(){
return '缺陷年龄数量分布'
},
legendCpd(){
return ['0-2天','3-5天','6-7天','8-15天','16-30天','30天以上']
}
},
watch: {
xmQuestionAgeDistsCpd(){
this.drawCharts();
}
},
data() {
return {
filters:{
product:null,
iteration:null,
},
dicts:{},// params=[{categoryId:'0001',itemCode:'sex'}] {'sex':[{optionValue:'1',optionName:'',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'',seqOrder:'2',fp:'',isDefault:'0'}]}
load:{ list: false, edit: false, del: false, add: false },//...
dateRanger:[],
maxTableHeight:300,
visible:false,
xmQuestionAgeDists:[],
}//end return
},//end data
methods: {
drawCharts() {
this.myChart = this.$echarts.init(document.getElementById("xmQuestionAgeDist"));
this.myChart.setOption(
{
title: {
text: this.title,
left: 'center'
},
tooltip: {
trigger: 'item'
},
legend: {
top:'5%',
left: 'center',
data:this.legendCpd,
},
series: [
{
type: 'pie',
radius: '50%',
data: this.xmQuestionAgeDistsCpd,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
label: {
show: true,
position: 'center'
},
}
]
}
)
},
onXmQuestionSomeFieldsChange(fieldName,$event){
this.xmQuestionAgeDists=[]
},
searchXmQuestionAgeDist(){
var params={}
if(this.xmTestPlan && this.xmTestPlan.id){
params.planId=this.xmTestPlan.id
}
getXmQuestionAgeDist(params).then(res=>{
this.xmQuestionAgeDists=res.data.data
})
},
onProductSelected(product){
this.filters.product=product
},
onProductClear(){
this.filters.product=null
},
onIterationSelected(iteration){
this.filters.iteration=iteration
},
onIterationClear(){
this.filters.iteration=null
}
},//end method
mounted() {
initSimpleDicts('all',['bugSeverity','bugSolution','bugStatus','bugType','priority','bugRepRate','bugReason'] ).then(res=>{
this.dicts=res.data.data;
})
this.searchXmQuestionAgeDist();
//this.charts();
//this.drawCharts();
}//end mounted
}
</script>
<style scoped>
.image {
width: 100%;
display: block;
}
</style>

79
src/views/xm/core/xmTestPlan/rpt/index.vue

@ -0,0 +1,79 @@
<template>
<div class="m_container">
<div class="m_content">
<div class="m_top">
<el-button class="m_btn" type="primary" @click="compsSetVisible = true">模块编辑</el-button>
</div>
<comps-card ref="compsCard" />
</div>
<comps-set v-model="compsSetVisible" @submit="onCompsSet"/>
</div>
</template>
<script>
import NProgress from 'nprogress' // progress bar
import compsCard from './CompsCard'
import compsSet from './CompsSet'
import { mapGetters } from 'vuex'
import dayjs from 'dayjs'
export default {
components: {compsSet, compsCard},
computed: {
...mapGetters([
'userInfo'
]),
getDate() {
return dayjs().format('YYYY/M/D');
},
getTimeStatus() {
let hour = dayjs().hour();
let msg = '早上好';
if(hour >= 13 || hour <= 18) {
msg = '下午好';
}else if (hour >= 19 || hour <= 24){
msg = '晚上好';
}
return msg;
}
},
watch: {
},
data() {
return {
compsSetVisible: false
}
},
methods: {
gotolink(context,path) {
if(context==process.env.CONTEXT){
this.$router.push({path:path});
}else{
var prefixUrl=window.location.protocol+"//"+window.location.host+"/"+context+"/"+process.env.VERSION+"/#"; // https://mp.csdn.net
window.open(prefixUrl+path)
NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
}
},
onCompsSet(){
this.$refs.compsCard.getFMenus();
}
},
mounted() {
}
}
</script>
<style lang="scss" scoped>
@import './common.scss';
@import './index.scss';
</style>
Loading…
Cancel
Save