Browse Source

优化

master
陈裕财 3 years ago
parent
commit
231f8d9839
  1. 1
      src/router/routes_xm.js
  2. 1
      src/views/xm/core/xmGroup/XmGroupMng.vue
  3. 331
      src/views/xm/core/xmTestCasedb/XmTestCasedbInfo.vue
  4. 84
      src/views/xm/core/xmTestCasedb/XmTestCasedbRoute.vue
  5. 2
      src/views/xm/core/xmTestCasedb/top-nav.vue

1
src/router/routes_xm.js

@ -543,7 +543,6 @@ export default {
{ path: 'xmQuestion/XmQuestionMng', component: _import('xm/core/xmQuestion/XmQuestionMngRoute'), name: 'XmQuestionMng', meta: { title: '缺陷管理',roles:["user"] }}, { path: 'xmQuestion/XmQuestionMng', component: _import('xm/core/xmQuestion/XmQuestionMngRoute'), name: 'XmQuestionMng', meta: { title: '缺陷管理',roles:["user"] }},
{ path: 'xmQuestion/XmQuestionMngMy', component: _import('xm/core/xmQuestion/XmQuestionMngMy'), name: 'XmQuestionMngMy', meta: { title: '我的缺陷' ,roles:["user"]}}, { path: 'xmQuestion/XmQuestionMngMy', component: _import('xm/core/xmQuestion/XmQuestionMngMy'), name: 'XmQuestionMngMy', meta: { title: '我的缺陷' ,roles:["user"]}},
{ path: 'xmTestCasedb/XmTestCasedbMng', component: _import('xm/core/xmTestCasedb/XmTestCasedbMng'), name: 'XmTestCasedbMng', meta: { title: '测试管理',roles:["user"] }}, { path: 'xmTestCasedb/XmTestCasedbMng', component: _import('xm/core/xmTestCasedb/XmTestCasedbMng'), name: 'XmTestCasedbMng', meta: { title: '测试管理',roles:["user"] }},
{ path: 'xmQuestion/XmQuestionDetailRoute', component: _import('xm/core/xmQuestion/XmQuestionDetailRoute'), name: 'XmQuestionDetailRoute', meta: { title: '缺陷明细',roles:["user"] },hidden:true},
] ]
}, },

1
src/views/xm/core/xmGroup/XmGroupMng.vue

@ -672,6 +672,7 @@ XmTaskExecuserSelect,
if(groupUsers==null||groupUsers.length==0){ if(groupUsers==null||groupUsers.length==0){
return; return;
} }
debugger;
var params=groupUsers.map(i=>{ var params=groupUsers.map(i=>{
var u={ var u={
userid:i.userid, userid:i.userid,

331
src/views/xm/core/xmTestCasedb/XmTestCasedbInfo.vue

@ -1,331 +0,0 @@
<template>
<section>
<el-row >
<el-menu :default-active="activeIndex" mode="horizontal" @select="handleSelect"
background-color="rgb(48, 65, 86)"
text-color="rgb(191, 203, 217)"
active-text-color="#409eff"
>
<el-menu-item index="testCasedb">
<span
slot="title"
style="font-size: 18px; color: #409eff"
:title="xmTestCasedb.name"
>
测试库:<strong>&nbsp;{{ xmTestCasedb.name }}</strong>
</span>
</el-menu-item>
<el-menu-item index="testCase">用例管理</el-menu-item>
<el-menu-item index="caseFlow">用例评审</el-menu-item>
<el-menu-item index="testPlan">测试计划</el-menu-item>
<el-menu-item index="testRpt">统计报表</el-menu-item>
<el-submenu index="回退">
<template slot="title"><i class="el-icon-back"></i>回退</template>
<el-menu-item index="上一页" @click.native="goBack">
<span slot="title"
><i class="el-icon-back"></i>上一页</span
>
</el-menu-item>
<el-menu-item index="首页" @click.native="goHome">
<span slot="title"
><i class="el-icon-s-home"></i>首页</span
>
</el-menu-item>
</el-submenu>
</el-menu>
</el-row>
<el-row ref="xmTestCasedbTable">
<xm-test-casedb-edit op-type="edit" v-if="activeIndex=='testCasedb'" :xm-test-casedb="xmTestCasedb" key="1"></xm-test-casedb-edit>
<xm-test-case-mng v-if="activeIndex=='testCase'" :xm-test-casedb="xmTestCasedb" key="1"></xm-test-case-mng>
<xm-test-case-mng v-if="activeIndex=='caseFlow'" :xm-test-casedb="xmTestCasedb" scene="caseFlow" key="2"></xm-test-case-mng>
<xm-test-plan-info v-else-if="activeIndex=='testPlan'" :xm-test-casedb="xmTestCasedb" ref="testPlan"> </xm-test-plan-info>
<xm-report
v-if="activeIndex=='testRpt'"
:xm-product="{id:xmTestCasedb.productId,productName:xmTestCasedb.productName}"
></xm-report>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from '@/common/config';//
import { initDicts,listXmTestCasedb, delXmTestCasedb, batchDelXmTestCasedb,editSomeFieldsXmTestCasedb } from '@/api/xm/core/xmTestCasedb';
import XmTestCasedbEdit from './XmTestCasedbEdit';//
import XmTestCaseMng from '../xmTestCase/XmTestCaseMng';//
import XmTestPlanInfo from '../xmTestPlan/XmTestPlanInfo';//
import { mapGetters } from 'vuex'
import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//
import XmReport from "@/views/xm/rpt/reportIndex";
export default {
name:'xmTestCasedbMng',
components: {
XmTestCasedbEdit,XmProductSelect,XmTestCaseMng,XmTestPlanInfo,XmReport,
},
props:['visible','xmTestCasedb'],
computed: {
...mapGetters(['userInfo']),
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmTestCasedbs()
}
}
},
data() {
return {
filters: {
key: ''
},
xmTestCasedbs: [],//
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,//xmTestCasedb
addForm: {
id:'',name:'',cuserid:'',cusername:'',ctime:'',cbranchId:'',productId:'',productName:''
},
editFormVisible: false,//
editForm: {
id:'',name:'',cuserid:'',cusername:'',ctime:'',cbranchId:'',productId:'',productName:''
},
maxTableHeight:300,
activeIndex:'testCase',
}
},//end data
methods: {
...util,
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmTestCasedbs();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmTestCasedbs();
},
// 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.getXmTestCasedbs();
},
searchXmTestCasedbs(){
this.pageInfo.count=true;
this.getXmTestCasedbs();
},
// XmTestCasedb
getXmTestCasedbs() {
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
}
if(this.filters.product && this.filters.product.id){
params.productId=this.filters.product.id
}
this.load.list = true;
listXmTestCasedb(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmTestCasedbs = 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 );
},
// XmTestCasedb
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
// XmTestCasedb
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmTestCasedbs();
},
afterEditSubmit(){
this.editFormVisible=false;
},
//xmTestCasedb
selsChange: function (sels) {
this.sels = sels;
},
//xmTestCasedb
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { id:row.id };
delXmTestCasedb(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.searchXmTestCasedbs();
}
this.$notify({ position:'bottom-left', showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmTestCasedb
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;
batchDelXmTestCasedb(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.searchXmTestCasedbs();
}
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 = editSomeFieldsXmTestCasedb
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
if(this.sels.length>0){
this.searchXmTestCasedbs();
}
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(){
this.filters.product=this.xmProduct
},
clearProduct(){
this.filters.product=null;
this.searchXmTestCasedbs();
},
onProductSelected(product){
this.filters.product=product;
this.searchXmTestCasedbs();
},
goCasedbInfo(row){
localStorage.setItem('xm-test-casedb-info',JSON.stringify(row));
this.$route.push({path:'/xm/core/testCasedbRoute',query:{id:row.id}})
},
handleSelect(index){
this.activeIndex=index
if(index=='testPlan'){
this.$nextTick(()=>{
this.$refs.testPlan.activeIndex='testPlan'
})
}
},
goBack() {
this.$router.back(-1);
},
goHome(){
this.$router.push({path:'/'})
},
},//end methods
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
this.searchXmTestCasedbs();
//this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmTestCasedbTable.$el)
});
}
}
</script>
<style lang="scss" scoped>
.center{
align-items: center; /* 垂直居中 */
justify-content: center; /* 水平居中 */
}
.el-menu{
align-items: center; /* 垂直居中 */
justify-content: center; /* 水平居中 */
}
</style>

84
src/views/xm/core/xmTestCasedb/XmTestCasedbRoute.vue

@ -1,84 +0,0 @@
<template>
<section>
<xm-test-casedb-info v-if="xmTestCasedb" :xm-test-casedb="xmTestCasedb" :visible="showInfo" @edit-fields="onEditFields"></xm-test-casedb-info>
</section>
</template>
<script>
import util from '@/common/js/util';//
import { listXmTestCasedb } from '@/api/xm/core/xmTestCasedb';
import { mapGetters } from 'vuex';
import XmTestCasedbInfo from './XmTestCasedbInfo'
export default {
computed: {
...mapGetters([
'userInfo','roles'
]),
},
watch:{
},
data() {
return {
xmTestCasedb:null,
showInfo:false,
}
},//end data
methods: {
initByQueryId(){
if(this.$route.query && this.$route.query.id){
var localStorageXmTestCasedb=localStorage.getItem("xm-test-casedb-info")
var xmTestCasedb=null;
if(localStorageXmTestCasedb && localStorageXmTestCasedb!='undefined'){
xmTestCasedb=JSON.parse(localStorageXmTestCasedb)
if(xmTestCasedb && xmTestCasedb.id==this.$route.query.id){
this.xmTestCasedb=xmTestCasedb
this.showInfo=true;
}else{
this.getXmTestCasedb(this.$route.query.id);
}
}else{
this.getXmTestCasedb(this.$route.query.id);
}
}
},
getXmTestCasedb(id){
listXmTestCasedb({id:id}).then(res=>{
var tips = res.data.tips;
if(tips.isOk){
this.xmTestCasedb=res.data.data[0]
localStorage.setItem("xm-test-casedb-info",JSON.stringify(this.xmTestCasedb))
this.showInfo=true;
}else{
}
})
},
onEditFields(row) {
Object.assign(this.xmTestCasedb, row);
localStorage.setItem("xm-test-casedb-info",JSON.stringify(this.xmTestCasedb))
this.$emit("edit-fields", row);
},
},//end methods
components: {
XmTestCasedbInfo,
//
},
activated(){
this.initByQueryId();
},
mounted() {
this.initByQueryId();
}
}
</script>
<style scoped>
</style>

2
src/views/xm/core/xmTestCasedb/top-nav.vue

@ -74,7 +74,7 @@
<el-menu-item index="/helpCenter"> <el-menu-item index="/helpCenter">
<span slot="title"><i class="el-icon-date"></i>客服</span> <span slot="title"><i class="el-icon-date"></i>客服</span>
</el-menu-item> </el-menu-item>
<el-menu-item index="/xm/core/testCasedb/XmTestCasedbMng" >
<el-menu-item index="/xm/core/xmTestCasedb/XmTestCasedbMng" >
<span slot="title" <span slot="title"
><i class="el-icon-back"></i>回到测试库列表页</span ><i class="el-icon-back"></i>回到测试库列表页</span
> >

Loading…
Cancel
Save