Browse Source

优化bug

master
陈裕财 4 years ago
parent
commit
be0f674901
  1. 26
      src/api/xm/core/xmTestCase.js
  2. 44
      src/api/xm/core/xmTestCasedb.js
  3. 44
      src/api/xm/core/xmTestPlan.js
  4. 44
      src/api/xm/core/xmTestPlanCase.js
  5. 250
      src/views/xm/core/xmTestCase/XmTestCaseEdit.vue
  6. 851
      src/views/xm/core/xmTestCase/XmTestCaseMng.vue
  7. 171
      src/views/xm/core/xmTestCasedb/XmTestCasedbEdit.vue
  8. 317
      src/views/xm/core/xmTestCasedb/XmTestCasedbMng.vue
  9. 210
      src/views/xm/core/xmTestPlan/XmTestPlanEdit.vue
  10. 382
      src/views/xm/core/xmTestPlan/XmTestPlanMng.vue
  11. 183
      src/views/xm/core/xmTestPlanCase/XmTestPlanCaseEdit.vue
  12. 332
      src/views/xm/core/xmTestPlanCase/XmTestPlanCaseMng.vue

26
src/api/xm/core/xmTestCase.js

@ -1,22 +1,20 @@
import axios from '@/utils/request'
import { getDicts,initSimpleDicts,initComplexDicts } from '@/api/mdp/meta/item';//字典表
import config from '@/common/config'
let base = config.getCoreBasePath();
/**-------------------------与后端通讯接口------------------请写在下面-------------------------------------------- */
/**
* 测试用例
*1 默认只开放普通查询所有查询只要上传 分页参数 {currentPage:当前页码从1开始,pageSize:每页记录数,total:总记录数如果是0后台会自动计算总记录数非0不会自动计算}后台都会自动按分页查询 其它 api用到再打开没用到的api请注释掉
*2 查询新增修改的参数格式 params={id:'主键 主键',caseName:'标题',caseRemark:'备注',testStep:'测试步骤',expectResult:'期望结果',menuId:'关联的需求',menuName:'关联需求名',ctime:'创建时间',ltime:'更新时间',luserid:'更新人编号',lusername:'更新人姓名',cbranchId:'创建机构',moduleId:'模块编号',moduleName:'模块名称',caseStatus:'用例状态1正常0废弃'}
*1 默认只开放普通查询所有查询只要上传 分页参数 {pageNum:当前页码从1开始,pageSize:每页记录数,total:总记录数如果是0后台会自动计算总记录数非0不会自动计算}后台都会自动按分页查询 其它 api用到再打开没用到的api请注释掉
*2 查询新增修改的参数格式 params={id:'主键 主键',caseName:'标题',caseRemark:'备注',testStep:'测试步骤',expectResult:'期望结果',menuId:'关联的故事',menuName:'关联故事名',ctime:'创建时间',ltime:'更新时间',luserid:'更新人编号',lusername:'更新人姓名',cbranchId:'创建机构',moduleId:'模块编号',moduleName:'模块名称',caseStatus:'用例状态1正常0废弃',cuserid:'创建人编号',cusername:'创建人姓名',productId:'产品编号',verNum:'版本号',casedbId:'用例库编号',casedbName:'用例库名称'}
**/
//普通查询 条件之间and关系
export const listXmTestCase = params => { return axios.get(`${base}/xm/core/xmTestCase/list`, { params: params }); };
//模糊查询测试用例 条件之间or关系
//export const listXmTestCaseKey = params => { return axios.get(`${base}/xm/core/xmTestCase/listKey`, { params: params }); };
//删除一条测试用例 params={id:'主键 主键'}
export const delXmTestCase = params => { return axios.post(`${base}/xm/core/xmTestCase/del`,params); };
@ -28,3 +26,19 @@ export const editXmTestCase = params => { return axios.post(`${base}/xm/core/xmT
//新增一条测试用例
export const addXmTestCase = params => { return axios.post(`${base}/xm/core/xmTestCase/add`, params); };
//批量修改某些字段
export const editSomeFieldsXmTestCase = params => { return axios.post(`${base}/xm/core/xmTestCase/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)
});
}
};

44
src/api/xm/core/xmTestCasedb.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:'主键 主键',name:'用例库名称',cuserid:'创建人',cusername:'创建人姓名',ctime:'创建日期',cbranchId:'归属机构编号',productId:'产品编号',productName:'产品名称'}
**/
//普通查询 条件之间and关系
export const listXmTestCasedb = params => { return axios.get(`${base}/xm/core/xmTestCasedb/list`, { params: params }); };
//删除一条测试用例库 params={id:'主键 主键'}
export const delXmTestCasedb = params => { return axios.post(`${base}/xm/core/xmTestCasedb/del`,params); };
//批量删除测试用例库 params=[{id:'主键 主键'}]
export const batchDelXmTestCasedb = params => { return axios.post(`${base}/xm/core/xmTestCasedb/batchDel`, params); };
//修改一条测试用例库记录
export const editXmTestCasedb = params => { return axios.post(`${base}/xm/core/xmTestCasedb/edit`, params); };
//新增一条测试用例库
export const addXmTestCasedb = params => { return axios.post(`${base}/xm/core/xmTestCasedb/add`, params); };
//批量修改某些字段
export const editSomeFieldsXmTestCasedb = params => { return axios.post(`${base}/xm/core/xmTestCasedb/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)
});
}
};

44
src/api/xm/core/xmTestPlan.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:'测试计划编号 主键',name:'计划名称',casedbId:'用例库编号',casedbName:'用例库名称',projectId:'项目编号',projectName:'项目名称',cuserid:'创建人编号',cusername:'创建人名称',ctime:'创建时间',stime:'开始时间',etime:'结束时间',status:'状态0-未开始,1-进行中,2已结束',tcode:'测试结果0未通过,1已通过',totalCases:'总用例数',okCases:'通过用例数',errCases:'失败用例数',igCases:'忽略用例数',blCases:'阻塞用例数',productId:'产品编号',productName:'产品名称',flowState:'评审结果0-待评审,1-已评审通过,2-已拒绝'}
**/
//普通查询 条件之间and关系
export const listXmTestPlan = params => { return axios.get(`${base}/xm/core/xmTestPlan/list`, { params: params }); };
//删除一条测试计划 params={id:'测试计划编号 主键'}
export const delXmTestPlan = params => { return axios.post(`${base}/xm/core/xmTestPlan/del`,params); };
//批量删除测试计划 params=[{id:'测试计划编号 主键'}]
export const batchDelXmTestPlan = params => { return axios.post(`${base}/xm/core/xmTestPlan/batchDel`, params); };
//修改一条测试计划记录
export const editXmTestPlan = params => { return axios.post(`${base}/xm/core/xmTestPlan/edit`, params); };
//新增一条测试计划
export const addXmTestPlan = params => { return axios.post(`${base}/xm/core/xmTestPlan/add`, params); };
//批量修改某些字段
export const editSomeFieldsXmTestPlan = params => { return axios.post(`${base}/xm/core/xmTestPlan/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)
});
}
};

44
src/api/xm/core/xmTestPlanCase.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={caseId:'测试用例编号 主键',planId:'计划编号 主键',bugs:'bug数目',execUserid:'执行人',ltime:'更新时间',ctime:'创建时间',execStatus:'0-未测,1-通过,2-受阻,3-忽略,4-失败',execUsername:'执行人姓名',caseName:'用例名称',priority:'优先级',remark:'执行备注',testStep:'测试步骤'}
**/
//普通查询 条件之间and关系
export const listXmTestPlanCase = params => { return axios.get(`${base}/xm/core/xmTestPlanCase/list`, { params: params }); };
//删除一条测试计划与用例关系表 params={caseId:'测试用例编号 主键',planId:'计划编号 主键'}
export const delXmTestPlanCase = params => { return axios.post(`${base}/xm/core/xmTestPlanCase/del`,params); };
//批量删除测试计划与用例关系表 params=[{caseId:'测试用例编号 主键',planId:'计划编号 主键'}]
export const batchDelXmTestPlanCase = params => { return axios.post(`${base}/xm/core/xmTestPlanCase/batchDel`, params); };
//修改一条测试计划与用例关系表记录
export const editXmTestPlanCase = params => { return axios.post(`${base}/xm/core/xmTestPlanCase/edit`, params); };
//新增一条测试计划与用例关系表
export const addXmTestPlanCase = params => { return axios.post(`${base}/xm/core/xmTestPlanCase/add`, params); };
//批量修改某些字段
export const editSomeFieldsXmTestPlanCase = params => { return axios.post(`${base}/xm/core/xmTestPlanCase/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)
});
}
};

250
src/views/xm/core/xmTestCase/XmTestCaseEdit.vue

@ -1,154 +1,206 @@
<template>
<section class="padding">
<el-row>
<!--新增界面 XmTestCase 测试用例-->
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editForm">
<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">
<!--编辑界面 XmTestCase 测试用例-->
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editFormRef">
<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="caseName">
<el-input v-model="editForm.caseName" placeholder="标题" ></el-input>
<el-input v-model="editForm.caseName" placeholder="标题" :maxlength="255" @change="editSomeFields(editForm,'caseName',$event)"></el-input>
</el-form-item>
<el-form-item label="备注" prop="caseRemark">
<el-input v-model="editForm.caseRemark" placeholder="备注" :maxlength="2147483647" @change="editSomeFields(editForm,'caseRemark',$event)"></el-input>
</el-form-item>
<el-form-item label="测试步骤" prop="testStep">
<el-input v-model="editForm.testStep" placeholder="测试步骤" :maxlength="2147483647" @change="editSomeFields(editForm,'testStep',$event)"></el-input>
</el-form-item>
<el-form-item label="期望结果" prop="expectResult">
<el-input v-model="editForm.expectResult" placeholder="期望结果" :maxlength="2147483647" @change="editSomeFields(editForm,'expectResult',$event)"></el-input>
</el-form-item>
<el-form-item label="关联的故事" prop="menuId">
<el-input v-model="editForm.menuId" placeholder="关联的故事" :maxlength="50" @change="editSomeFields(editForm,'menuId',$event)"></el-input>
</el-form-item>
<el-form-item label="关联故事名" prop="menuName">
<el-input v-model="editForm.menuName" placeholder="关联故事名" :maxlength="255" @change="editSomeFields(editForm,'menuName',$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="ltime">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.ltime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item label="更新人编号" prop="luserid">
<el-input v-model="editForm.luserid" placeholder="更新人编号" :maxlength="50" @change="editSomeFields(editForm,'luserid',$event)"></el-input>
</el-form-item>
<el-form-item label="更新人姓名" prop="lusername">
<el-input v-model="editForm.lusername" placeholder="更新人姓名" :maxlength="255" @change="editSomeFields(editForm,'lusername',$event)"></el-input>
</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="moduleId">
<el-input v-model="editForm.moduleId" placeholder="模块编号" :maxlength="50" @change="editSomeFields(editForm,'moduleId',$event)"></el-input>
</el-form-item>
<el-form-item label="模块名称" prop="moduleName">
<el-input v-model="editForm.moduleName" placeholder="模块名称" ></el-input>
<el-input v-model="editForm.moduleName" placeholder="模块名称" :maxlength="255" @change="editSomeFields(editForm,'moduleName',$event)"></el-input>
</el-form-item>
<el-form-item label="关联的需求" prop="menuId">
<el-tag v-if="editForm.menuId && editForm.menuId!=''" @close="clearFiltersMneu">{{editForm.menuName?editForm.menuName:editForm.menuId}}</el-tag>
<el-tag v-else>还没关联任何需求</el-tag>
<el-button v-if="!editForm.menuId" @click="showMenu">关联需求</el-button>
<el-form-item label="用例状态1正常0废弃" prop="caseStatus">
<el-input v-model="editForm.caseStatus" placeholder="用例状态1正常0废弃" :maxlength="1" @change="editSomeFields(editForm,'caseStatus',$event)"></el-input>
</el-form-item>
<el-form-item label="状态" prop="moduleName">
<el-radio v-model="editForm.caseStatus" label="1" placeholder="状态" >正常</el-radio>
<el-radio v-model="editForm.caseStatus" label="0" placeholder="状态" >作废</el-radio>
<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="productId">
<el-input v-model="editForm.productId" placeholder="产品编号" :maxlength="50" @change="editSomeFields(editForm,'productId',$event)"></el-input>
</el-form-item>
<el-form-item label="版本号" prop="verNum">
<el-input v-model="editForm.verNum" placeholder="版本号" :maxlength="50" @change="editSomeFields(editForm,'verNum',$event)"></el-input>
</el-form-item>
<el-form-item label="用例库编号" prop="casedbId">
<el-input v-model="editForm.casedbId" placeholder="用例库编号" :maxlength="50" @change="editSomeFields(editForm,'casedbId',$event)"></el-input>
</el-form-item>
<el-form-item label="用例库名称" prop="casedbName">
<el-input v-model="editForm.casedbName" placeholder="用例库名称" :maxlength="255" @change="editSomeFields(editForm,'casedbName',$event)"></el-input>
</el-form-item>
<el-form-item label="测试步骤" prop="testStep">
<vue-editor v-if="visible" :id="'testStep3'" :branch-id="userInfo.branchId" v-model="editForm.testStep" ref="testStep" key="1"></vue-editor>
</el-form-item>
<el-form-item label="预期结果" prop="expectResult">
<vue-editor v-if="visible" :id="'expectResult3'" :branch-id="userInfo.branchId" v-model="editForm.expectResult" ref="expectResult" key="2"></vue-editor>
</el-form-item>
<el-form-item>
<el-button @click.native="handleCancel">取消</el-button>
<el-button v-loading="load.edit" type="primary" @click.native="editSubmit" :disabled="load.edit==true">提交</el-button>
</el-form-item>
</el-form>
</el-row>
<el-drawer append-to-body title="需求选择" :visible.sync="menuVisible" size="60%" :close-on-click-modal="false">
<xm-menu-select checkScope="3" :visible="menuVisible" :is-select-menu="true" :multi="true" @menus-selected="onSelectedMenus" ></xm-menu-select>
</el-drawer>
<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 { initSimpleDicts } from '@/api/mdp/meta/item';//
import { editXmTestCase } from '@/api/xm/core/xmTestCase';
import config from "@/common/config"; //import
import { initDicts, addXmTestCase,editXmTestCase,editSomeFieldsXmTestCase } from '@/api/xm/core/xmTestCase';
import { mapGetters } from 'vuex'
import xmMenuSelect from '../xmMenu/XmMenuSelect';
import VueEditor from '@/components/Tinymce/index';
export default {
name:'xmTestCaseEdit',
components: {
},
computed: {
...mapGetters([
'userInfo','roles'
])
...mapGetters([ 'userInfo' ]),
},
props:['xmTestCase','visible'],
props:['xmTestCase','visible','opType'],
watch: {
'xmTestCase':function( xmTestCase ) {
this.editForm = xmTestCase;
if(xmTestCase){
this.editForm = {...xmTestCase};
}
},
'visible':function(visible) {
if(visible==true){
//
this.initData()
}
}
},
data() {
return {
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, add: false, del: false, edit: false },//...
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: {
menuId: [
{ required: true, message: '需求不能为空', trigger: 'blur' }
],
caseName: [
{ required: true, message: '标题不能为空', trigger: 'blur' }
id: [
//{ required: true, message: '', trigger: 'blur' }
]
},
//
editForm: {
id:'',caseName:'',caseRemark:'',testStep:'',expectResult:'',menuId:'',menuName:'',ctime:'',ltime:'',luserid:'',lusername:'',cbranchId:'',moduleId:'',moduleName:'',caseStatus:''
id:'',caseName:'',caseRemark:'',testStep:'',expectResult:'',menuId:'',menuName:'',ctime:'',ltime:'',luserid:'',lusername:'',cbranchId:'',moduleId:'',moduleName:'',caseStatus:'',cuserid:'',cusername:'',productId:'',verNum:'',casedbId:'',casedbName:''
},
/**begin 在下面加自定义属性,记得补上面的一个逗号**/
menuVisible:false,
/**end 在上面加自定义属性**/
maxTableHeight:300,
}//end return
},//end data
methods: {
...util,
// @cancel="editFormVisible=false"
handleCancel:function(){
this.$refs['editForm'].resetFields();
this.$refs['editFormRef'].resetFields();
this.$emit('cancel');
},
//XmTestCase @submit="afterAddSubmit"
editSubmit: function () {
this.$refs.editForm.validate((valid) => {
//XmTestCase @submit="afterEditSubmit"
saveSubmit: function () {
this.$refs.editFormRef.validate((valid) => {
if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => {
this.load.edit=true
let params = Object.assign({}, this.editForm);
params.luserid=this.userInfo.userid
params.lusername=this.userInfo.username
editXmTestCase(params).then((res) => {
this.load.edit=false
var tips=res.data.tips;
if(tips.isOk){
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);
var func=addXmTestCase
if(this.currOpType=='edit'){
func=editXmTestCase
}
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' });
}
});
},
/**begin 在下面加自定义方法,记得补上面的一个逗号**/
showMenu(){
this.menuVisible=true;
},
onSelectedMenus(menus){
if(!menus || menus.length==0){
this.menuVisible=false
return;
}
this.menuVisible=false
this.editForm.menuId= menus[0].menuId
this.editForm.menuName= menus[0].menuName
this.$refs.editForm.validateField('menuId',valid=>{})
},
clearFiltersMneu(menu){
this.editForm.menuId=""
this.editForm.menuName=""
this.$refs.editForm.validateField('menuId',valid=>{})
}
/**end 在上面加自定义方法**/
initData: function(){
this.currOpType=this.opType
if(this.xmTestCase){
this.editForm = Object.assign({},this.xmTestCase);
}
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 = editSomeFieldsXmTestCase
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
components: {
// 'xm-test-case-edit':XmTestCaseEdit
xmMenuSelect,VueEditor
},
mounted() {
this.editForm=Object.assign(this.editForm, this.xmTestCase);
/**在下面写其它函数***/
}//end mounted
this.$nextTick(() => {
initDicts(this);
this.initData()
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.table.$el)
});
}
}
</script>

851
src/views/xm/core/xmTestCase/XmTestCaseMng.vue

@ -1,521 +1,382 @@
<template>
<section class="page-container padding border">
<section class="page-container border padding">
<el-row>
<div>
<xm-product-select v-if="!xmProduct || !xmProduct.id" style="display:inline;" :auto-select="false" :link-project-id="filters.selProject?filters.selProject.id:null" @row-click="onProductSelected" @clear="filters.product=null"></xm-product-select>
<xm-iteration-select style="display:inline;" :auto-select="false" :product-id="filters.product?filters.product.id:null" :link-project-id="filters.selProject?filters.selProject.id:null" placeholder="迭代" @row-click="onIterationSelected" @clear="onIterationClear"></xm-iteration-select>
<span v-if="!xmMenu||!xmMenu.menuId">
<el-button v-if=" !filters.menus || filters.menus.length==0" @click="showMenu"> 选择需求</el-button>
<el-tag v-else closable @close=" clearFiltersMenu(filters.menus[0])">{{filters.menus[0].menuName.substr(0,5)}}({{filters.menus.length}})</el-tag>
</span>
<el-input v-model="filters.key" style="width: 20%;" placeholder="模糊查询">
<template slot="append">
<el-button type="primary" v-loading="load.list" :disabled="load.list==true" v-on:click="searchXmTestCases" icon="el-icon-search"></el-button>
</template>
</el-input>
<el-popover
placement="top-start"
title="更多查询条件或操作"
width="400"
trigger="click" >
<el-row>
<el-col :span="24" style="padding-top:5px;" v-if="!xmProduct || !xmProduct.id">
<xm-product-select :auto-select="false" :link-project-id="filters.selProject?filters.selProject.id:null" @row-click="onProductSelected" @clear="filters.product=null"></xm-product-select>
</el-col>
<el-col :span="24" style="padding-top:5px;" v-if="!selProject" >
<xm-project-select :auto-select="false" :link-product-id="filters.product?filters.product.id:null" @row-click="onPorjectConfirm" @clear="filters.selProject=null"></xm-project-select>
</el-col>
<el-col :span="24" style="padding-top:5px;">
<font class="more-label-font">需求:</font>
<font v-if=" filters.menus && filters.menus.length>0">
<el-tag v-for="(item,index) in filters.menus" :key="index" closable @close="clearFiltersMenu(item)">{{item.menuName.substr(0,10)}}</el-tag>
</font>
<el-button v-else @click="showMenu" type="plian">选需求</el-button>
</el-col>
<el-col :span="24" style="padding-top:5px;">
<font class="more-label-font">更新人:</font>
<el-tag v-if=" filters.luser " closable @close="clearFiltersExecUser">{{this.filters.luser.username}}</el-tag>
<el-button v-else @click="showExecUsersForFilters" type="plian">选更新人</el-button>
<el-button v-if=" !filters.luser || filters.luser.userid!=userInfo.userid" @click="setFiltersHandlerAsMySelf">我的</el-button>
</el-col>
<el-col :span="24" style="padding-top:5px;">
<font class="more-label-font">创建时间:</font>
<el-date-picker
v-model="dateRanger"
class="hidden-sm-and-down"
type="daterange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="完成日期"
value-format="yyyy-MM-dd HH:mm:ss"
:default-time="['00:00:00','23:59:59']"
:picker-options="pickerOptions"
></el-date-picker>
</el-col>
<el-col :span="24" style="padding-top:5px;">
<el-button type="primary" icon="el-icon-search" @click="searchXmTestCases">查询</el-button>
</el-col>
</el-row>
<el-button slot="reference" icon="el-icon-more"></el-button>
</el-popover>
<span style="float:right;">
<el-button type="primary" v-if="!multiSelect" icon="el-icon-plus" @click="showAdd"></el-button>
<el-button type="primary" v-if="multiSelect" @click="selected">确认选中</el-button>
<el-button v-if="!multiSelect " type="danger" icon="el-icon-delete" v-loading="load.del" @click="batchDel" :disabled="this.sels.length===0 || load.del==true"></el-button>
</span>
</div>
<el-input v-model="filters.key" style="width: 20%;" placeholder="模糊查询"></el-input>
<el-button v-loading="load.list" :disabled="load.list==true" @click="searchXmTestCases" 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="page-main ">
<el-row class="padding-top">
<!--列表 XmTestCase 测试用例-->
<el-table ref="table" :height="maxTableHeight" :data="xmTestCases" @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="45"></el-table-column>
<el-table-column sortable type="index" width="45"></el-table-column>
<el-table-column prop="caseName" label="标题" min-width="100" show-overflow-tooltip>
<template scope="scope">
<el-link type="primary" @click="showEdit(scope.row)"> {{scope.row.caseName}}</el-link>
</template>
<el-table ref="xmTestCaseTable" :data="xmTestCases" :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="caseName" label="标题" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.caseName}} </span>
</template>
</el-table-column>
<el-table-column prop="caseRemark" label="备注" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.caseRemark}} </span>
</template>
</el-table-column>
<el-table-column prop="testStep" label="测试步骤" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.testStep}} </span>
</template>
</el-table-column>
<el-table-column prop="expectResult" label="期望结果" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.expectResult}} </span>
</template>
</el-table-column>
<el-table-column prop="menuId" label="关联的故事" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.menuId}} </span>
</template>
</el-table-column>
<el-table-column prop="menuName" label="关联故事名" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.menuName}} </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="ltime" label="更新时间" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.ltime}} </span>
</template>
</el-table-column>
<el-table-column prop="luserid" label="更新人编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.luserid}} </span>
</template>
</el-table-column>
<el-table-column prop="lusername" label="更新人姓名" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.lusername}} </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="caseRemark" label="备注" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column prop="menuName" label="需求名" min-width="80" show-overflow-tooltip>
<template slot="header">
需求<el-button type="text" @click="showMenu" icon="el-icon-search" ></el-button>
</template>
</el-table-column>
<el-table-column v-if="!multiSelect" prop="ctime" label="创建时间" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column v-if="!multiSelect" prop="lusername" label="更新人姓名" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column v-if="!multiSelect" prop="moduleName" label="模块名称" min-width="80" show-overflow-tooltip></el-table-column>
<el-table-column v-if="!multiSelect" prop="caseStatus" label="用例状态" min-width="80" >
<template scope="scope">
<el-tag :type="scope.row.caseStatus=='1'?'success':'warning'">{{scope.row.caseStatus=="1"?"正常":"作废"}}</el-tag>
</template>
<el-table-column prop="moduleId" label="模块编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.moduleId}} </span>
</template>
</el-table-column>
<el-table-column v-if="!multiSelect" label="操作" width="160" fixed="right">
<template scope="scope">
<el-button type="text" @click="showAddBug(scope.row,scope.$index)" icon="el-icon-plus">bug</el-button>
<el-button type="text" @click="showBugs(scope.row,scope.$index)" icon="el-icon-s-data">查bug</el-button>
</template>
<el-table-column prop="moduleName" label="模块名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.moduleName}} </span>
</template>
</el-table-column>
<el-table-column prop="caseStatus" label="用例状态1正常0废弃" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.caseStatus}} </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="productId" label="产品编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.productId}} </span>
</template>
</el-table-column>
<el-table-column prop="verNum" label="版本号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.verNum}} </span>
</template>
</el-table-column>
<el-table-column prop="casedbId" label="用例库编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.casedbId}} </span>
</template>
</el-table-column>
<el-table-column prop="casedbName" label="用例库名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.casedbName}} </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>
<!--编辑 XmTestCase 测试用例界面-->
<el-drawer title="编辑测试用例" :visible.sync="editFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-test-case-edit :xm-test-case="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-test-case-edit>
<xm-test-case-edit op-type="edit" :xm-test-case="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-test-case-edit>
</el-drawer>
<!--新增 XmTestCase 测试用例界面-->
<el-drawer title="新增测试用例" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-test-case-add :xm-product="filters.product" :xm-menu="xmMenu" :xm-test-case="addForm" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-test-case-add>
</el-drawer>
<el-drawer title="选中用户" :visible.sync="selectUserForFiltersVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-group-mng v-if="filters.selProject" :sel-project=" filters.selProject " :is-select-single-user="1" @user-confirm="onFiltersUserConfirm"></xm-group-mng>
<xm-test-case-edit op-type="add" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-test-case-edit>
</el-drawer>
</el-row>
<el-drawer append-to-body title="需求选择" :visible.sync="menuVisible" size="60%" :close-on-click-modal="false">
<xm-menu-select :xm-product="filters.product" :visible="menuVisible" :is-select-menu="true" :multi="true" @menus-selected="onSelectedMenus" ></xm-menu-select>
</el-drawer>
<el-dialog title="缺陷列表" :visible.sync="bugsVisible" width="90%" top="20px" append-to-body :close-on-click-modal="false">
<xm-question-mng v-if="bugsVisible" :xm-test-case="editForm" :sel-project="filters.selProject" :visible="bugsVisible" @cancel="bugsVisible=false" ></xm-question-mng>
</el-dialog>
<!--新增 XmQuestion xm_question界面-->
<el-dialog title="新增缺陷" :visible.sync="addBugVisible" width="80%" top="20px" append-to-body :close-on-click-modal="false">
<xm-question-add v-if="addBugVisible" :xm-test-case="editForm" :sel-project=" filters.selProject " :visible="addBugVisible" @cancel="addBugVisible=false"></xm-question-add>
</el-dialog>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from '@/common/config';//
import { initSimpleDicts } from '@/api/mdp/meta/item';//
import { listXmTestCase, delXmTestCase, batchDelXmTestCase } from '@/api/xm/core/xmTestCase';
import XmTestCaseAdd from './XmTestCaseAdd';//
import XmTestCaseEdit from './XmTestCaseEdit';//
import { mapGetters } from 'vuex'
import xmMenuSelect from '../xmMenu/XmMenuSelect';
import XmProductSelect from '@/views/xm/core/components/XmProductSelect';//
import XmProjectSelect from '@/views/xm/core/components/XmProjectSelect';
import XmGroupMng from '../xmGroup/XmGroupMng';
import XmQuestionMng from '../xmQuestion/XmQuestionMng';
import XmQuestionAdd from '../xmQuestion/XmQuestionAdd';
import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect.vue';//
export default {
computed: {
...mapGetters([
'userInfo','roles'
])
},
props:['multiSelect','selProject','xmProduct','xmMenu'],
watch:{
'xmProduct.id':function(val){
if(this.xmProduct && this.xmProduct.id){
this.filters.product=this.xmProduct
}else{
this.filters.product=null
}
this.searchXmTestCases();
},
'xmMenu.menuId':function(val){
if(this.xmMenu && this.xmMenu.menuId){
this.filters.menus=[this.xmMenu]
}else{
this.filters.menus=[]
}
}
},
data() {
const beginDate = new Date();
const endDate = new Date();
beginDate.setTime(beginDate.getTime() - 3600 * 1000 * 24 * 7 * 4 * 12 ); return {
filters: {
key: '',
menus:[],
product:null,
selProject:null,
luser:null,
iteration:null,
},
xmTestCases: [],//
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:[],
},// params=[{categoryId:'0001',itemCode:'sex'}] {'sex':[{optionValue:'1',optionName:'',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'',seqOrder:'2',fp:'',isDefault:'0'}]}
addFormVisible: false,//xmTestCase
//xmTestCase
addForm: {
id:'',caseName:'',caseRemark:'',testStep:'',expectResult:'',menuId:'',menuName:'',ctime:'',ltime:'',luserid:'',lusername:'',cbranchId:'',moduleId:'',moduleName:'',caseStatus:''
},
editFormVisible: false,//
productSelectVisible:false,
//xmTestCase
editForm: {
id:'',caseName:'',caseRemark:'',testStep:'',expectResult:'',menuId:'',menuName:'',ctime:'',ltime:'',luserid:'',lusername:'',cbranchId:'',moduleId:'',moduleName:'',caseStatus:''
},
/**begin 自定义属性请在下面加 请加备注**/
menuVisible:false,
maxTableHeight:300,
selectProjectVisible:false,
selectUserForFiltersVisible:false,
productSelectVisible:false,
nextAction:'',
dateRanger: [ ],
pickerOptions: util.getPickerOptions('datarange'),
addBugVisible:false,
bugsVisible:false,
/**end 自定义属性请在上面加 请加备注**/
}
},//end data
methods: {
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmTestCases();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmTestCases();
},
// obj.order=ascending/descending, asc/desc ; obj.prop=,
sortChange( obj ){
var dir='asc';
if(obj.order=='ascending'){
dir='asc'
}else{
dir='desc';
}
if(obj.prop=='xxx'){
this.pageInfo.orderFields=['xxx'];
this.pageInfo.orderDirs=[dir];
}
this.getXmTestCases();
},
searchXmTestCases(){
this.pageInfo.count=true;
this.getXmTestCases();
},
// XmTestCase
getXmTestCases() {
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.menus && this.filters.menus.length==1){
params.menuId=this.filters.menus[0].menuId
}else if(this.filters.menus && this.filters.menus.length>1){
params.menuIds=this.filters.menus.map(i=>i.menuId)
}else{
//params.xxx=xxxxx
}
if(this.dateRanger&&this.dateRanger.length==2){
params.ctimeStart=this.dateRanger[0]
params.ctimeEnd=this.dateRanger[1]
}
if(this.filters.product){
params.productId=this.filters.product.id
}
if(this.filters.luser){
params.myUserid=this.filters.luser.userid
}
if(this.filters.selProject){
params.projectId=this.filters.selProject.id
}
if(this.filters.iteration){
params.iterationId=this.filters.iteration.id
}
if(this.filters.key){
params.key='%'+this.filters.key+'%'
}
this.load.list = true;
listXmTestCase(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmTestCases = 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 );
},
// XmTestCase
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
// XmTestCase
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmTestCases();
},
afterEditSubmit(){
this.editFormVisible=false;
},
//xmTestCase
selsChange: function (sels) {
this.sels = sels;
},
//xmTestCase
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { id: row.id };
delXmTestCase(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.count=true;
this.getXmTestCases();
}
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmTestCase
batchDel: function () {
this.$confirm('确认删除选中记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
batchDelXmTestCase(this.sels).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.pageInfo.count=true;
this.getXmTestCases();
}
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
}).catch( err => this.load.del=false );
});
},
rowClick: function(row, event, column){
this.$emit('row-click',row, event, column);// @row-click="rowClick"
},
/**begin 自定义函数请在下面加**/
clearProduct(){
this.filters.product=null;
this.searchXmTestCases();
},
showProductVisible(){
this.productSelectVisible=true;
},
onProductSelected(product){
this.filters.product=product;
this.searchXmTestCases();
},
showMenu(){
this.menuVisible=true;
},
onSelectedMenus(menus){
if(!menus || menus.length==0){
this.menuVisible=false
return;
}
this.menuVisible=false
this.filters.menus=menus;
this.getXmTestCases();
},
clearFiltersMenu(menu){
var index=this.filters.menus.findIndex(i=>i.menuId==menu.menuId)
this.filters.menus.splice(index,1);
this.getXmTestCases();
},
selected(){
this.$emit("selected",this.sels)
},
clearProject(){
this.filters.selProject=null
this.searchXmTestCases()
},
showProjectList:function(){
this.selectProjectVisible=true;
},
onPorjectConfirm:function(project){
this.filters.selProject=project
this.selectProjectVisible=false;
this.searchXmTestCases();
if(this.nextAction=="showExecUsersForFilters"){
this.showExecUsersForFilters();
this.nextAction=""
}
},
clearFiltersExecUser(){
this.filters.luser=null;
this.searchXmTestCases();
},
showExecUsersForFilters:function(){
if(!this.filters.selProject){
this.nextAction="showExecUsersForFilters"
this.showProjectList();
}else{
this.selectUserForFiltersVisible=true;
}
},
onFiltersUserConfirm:function(groupUsers){
if(groupUsers==null || groupUsers.length==0){
this.filters.luser=null
}else{
this.filters.luser=groupUsers[0]
}
if(this.nextAction=="showExecUsersForFilters"){
this.nextAction=""
}
this.selectUserForFiltersVisible=false
this.searchXmTestCases();
},
setFiltersHandlerAsMySelf(){
this.filters.luser=this.userInfo;
this.searchXmTestCases();
},
showBugs(row){
this.editForm=row
this.bugsVisible=true;
},
showAddBug(row){
this.editForm=row
this.addBugVisible=true;
},
onIterationSelected(iteration){
this.filters.iteration=iteration
this.searchXmTestCases()
},
onIterationClear(){
this.filters.iteration=null
this.searchXmTestCases()
},
/**end 自定义函数请在上面加**/
},//end methods
components: {
'xm-test-case-add':XmTestCaseAdd,
'xm-test-case-edit':XmTestCaseEdit,
xmMenuSelect,XmProductSelect,XmProjectSelect,XmGroupMng,XmQuestionAdd,
XmQuestionMng,XmIterationSelect,
//
},
mounted() {
this.$nextTick(() => {
if(this.xmProduct && this.xmProduct.id){
this.filters.product=this.xmProduct
}else{
this.filters.product=null
}
if(this.xmMenu && this.xmMenu.menuId){
this.filters.menus=[this.xmMenu]
}else{
this.filters.menus=[]
}
this.getXmTestCases();
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.table.$el);
});
/**
initSimpleDicts( "all",["sex","grade"] ).then(res=>{
if(res.data.tips.isOk){
this.dicts=res.data.data
}
});
**/
}
}
import util from '@/common/js/util';//
import config from '@/common/config';//
import { initDicts,listXmTestCase, delXmTestCase, batchDelXmTestCase,editSomeFieldsXmTestCase } from '@/api/xm/core/xmTestCase';
import XmTestCaseEdit from './XmTestCaseEdit';//
import { mapGetters } from 'vuex'
export default {
name:'xmTestCaseMng',
components: {
XmTestCaseEdit,
},
props:['visible'],
computed: {
...mapGetters(['userInfo']),
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmTestCases()
}
}
},
data() {
return {
filters: {
key: ''
},
xmTestCases: [],//
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,//xmTestCase
addForm: {
id:'',caseName:'',caseRemark:'',testStep:'',expectResult:'',menuId:'',menuName:'',ctime:'',ltime:'',luserid:'',lusername:'',cbranchId:'',moduleId:'',moduleName:'',caseStatus:'',cuserid:'',cusername:'',productId:'',verNum:'',casedbId:'',casedbName:''
},
editFormVisible: false,//
editForm: {
id:'',caseName:'',caseRemark:'',testStep:'',expectResult:'',menuId:'',menuName:'',ctime:'',ltime:'',luserid:'',lusername:'',cbranchId:'',moduleId:'',moduleName:'',caseStatus:'',cuserid:'',cusername:'',productId:'',verNum:'',casedbId:'',casedbName:''
},
maxTableHeight:300,
}
},//end data
methods: {
...util,
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmTestCases();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmTestCases();
},
// 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.getXmTestCases();
},
searchXmTestCases(){
this.pageInfo.count=true;
this.getXmTestCases();
},
// XmTestCase
getXmTestCases() {
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;
listXmTestCase(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmTestCases = 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 );
},
// XmTestCase
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
// XmTestCase
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmTestCases();
},
afterEditSubmit(){
this.editFormVisible=false;
},
//xmTestCase
selsChange: function (sels) {
this.sels = sels;
},
//xmTestCase
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { id:row.id };
delXmTestCase(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.searchXmTestCases();
}
this.$notify({ position:'bottom-left', showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmTestCase
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;
batchDelXmTestCase(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.searchXmTestCases();
}
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 = editSomeFieldsXmTestCase
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
if(this.sels.length>0){
this.searchXmTestCases();
}
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.searchXmTestCases();
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmTestCaseTable.$el)
});
}
}
</script>
<style scoped>
.more-label-font{
text-align:center;
float:left;
padding-top:5px;
}
</style>

171
src/views/xm/core/xmTestCasedb/XmTestCasedbEdit.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">
<!--编辑界面 XmTestCasedb 测试用例库-->
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editFormRef">
<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="productId">
<el-input v-model="editForm.productId" placeholder="产品编号" :maxlength="50" @change="editSomeFields(editForm,'productId',$event)"></el-input>
</el-form-item>
<el-form-item label="产品名称" prop="productName">
<el-input v-model="editForm.productName" placeholder="产品名称" :maxlength="255" @change="editSomeFields(editForm,'productName',$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, addXmTestCasedb,editXmTestCasedb,editSomeFieldsXmTestCasedb } from '@/api/xm/core/xmTestCasedb';
import { mapGetters } from 'vuex'
export default {
name:'xmTestCasedbEdit',
components: {
},
computed: {
...mapGetters([ 'userInfo' ]),
},
props:['xmTestCasedb','visible','opType'],
watch: {
'xmTestCasedb':function( xmTestCasedb ) {
if(xmTestCasedb){
this.editForm = {...xmTestCasedb};
}
},
'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: {
id:'',name:'',cuserid:'',cusername:'',ctime:'',cbranchId:'',productId:'',productName:''
},
maxTableHeight:300,
}//end return
},//end data
methods: {
...util,
// @cancel="editFormVisible=false"
handleCancel:function(){
this.$refs['editFormRef'].resetFields();
this.$emit('cancel');
},
//XmTestCasedb @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=addXmTestCasedb
if(this.currOpType=='edit'){
func=editXmTestCasedb
}
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.xmTestCasedb){
this.editForm = Object.assign({},this.xmTestCasedb);
}
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 = editSomeFieldsXmTestCasedb
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/xmTestCasedb/XmTestCasedbMng.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="searchXmTestCasedbs" 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">
<!--列表 XmTestCasedb 测试用例库-->
<el-table ref="xmTestCasedbTable" :data="xmTestCasedbs" :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="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="productId" label="产品编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.productId}} </span>
</template>
</el-table-column>
<el-table-column prop="productName" label="产品名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.productName}} </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>
<!--编辑 XmTestCasedb 测试用例库界面-->
<el-drawer title="编辑测试用例库" :visible.sync="editFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-test-casedb-edit op-type="edit" :xm-test-casedb="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-test-casedb-edit>
</el-drawer>
<!--新增 XmTestCasedb 测试用例库界面-->
<el-drawer title="新增测试用例库" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-test-casedb-edit op-type="add" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-test-casedb-edit>
</el-drawer>
</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 { mapGetters } from 'vuex'
export default {
name:'xmTestCasedbMng',
components: {
XmTestCasedbEdit,
},
props:['visible'],
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,
}
},//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
}
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(){
},
},//end methods
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
this.searchXmTestCasedbs();
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmTestCasedbTable.$el)
});
}
}
</script>
<style scoped>
</style>

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

@ -0,0 +1,210 @@
<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">
<!--编辑界面 XmTestPlan 测试计划-->
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editFormRef">
<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="casedbId">
<el-input v-model="editForm.casedbId" placeholder="用例库编号" :maxlength="50" @change="editSomeFields(editForm,'casedbId',$event)"></el-input>
</el-form-item>
<el-form-item label="用例库名称" prop="casedbName">
<el-input v-model="editForm.casedbName" placeholder="用例库名称" :maxlength="255" @change="editSomeFields(editForm,'casedbName',$event)"></el-input>
</el-form-item>
<el-form-item label="项目编号" prop="projectId">
<el-input v-model="editForm.projectId" placeholder="项目编号" :maxlength="50" @change="editSomeFields(editForm,'projectId',$event)"></el-input>
</el-form-item>
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="editForm.projectName" placeholder="项目名称" :maxlength="255" @change="editSomeFields(editForm,'projectName',$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="stime">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.stime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="etime">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.etime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item label="状态0-未开始,1-进行中,2已结束" prop="status">
<el-input v-model="editForm.status" placeholder="状态0-未开始,1-进行中,2已结束" :maxlength="1" @change="editSomeFields(editForm,'status',$event)"></el-input>
</el-form-item>
<el-form-item label="测试结果0未通过,1已通过" prop="tcode">
<el-input v-model="editForm.tcode" placeholder="测试结果0未通过,1已通过" :maxlength="1" @change="editSomeFields(editForm,'tcode',$event)"></el-input>
</el-form-item>
<el-form-item label="总用例数" prop="totalCases">
<el-input-number v-model="editForm.totalCases" :min="0" :max="200"></el-input-number>
</el-form-item>
<el-form-item label="通过用例数" prop="okCases">
<el-input-number v-model="editForm.okCases" :min="0" :max="200"></el-input-number>
</el-form-item>
<el-form-item label="失败用例数" prop="errCases">
<el-input-number v-model="editForm.errCases" :min="0" :max="200"></el-input-number>
</el-form-item>
<el-form-item label="忽略用例数" prop="igCases">
<el-input-number v-model="editForm.igCases" :min="0" :max="200"></el-input-number>
</el-form-item>
<el-form-item label="阻塞用例数" prop="blCases">
<el-input-number v-model="editForm.blCases" :min="0" :max="200"></el-input-number>
</el-form-item>
<el-form-item label="产品编号" prop="productId">
<el-input v-model="editForm.productId" placeholder="产品编号" :maxlength="50" @change="editSomeFields(editForm,'productId',$event)"></el-input>
</el-form-item>
<el-form-item label="产品名称" prop="productName">
<el-input v-model="editForm.productName" placeholder="产品名称" :maxlength="255" @change="editSomeFields(editForm,'productName',$event)"></el-input>
</el-form-item>
<el-form-item label="评审结果0-待评审,1-已评审通过,2-已拒绝" prop="flowState">
<el-input v-model="editForm.flowState" placeholder="评审结果0-待评审,1-已评审通过,2-已拒绝" :maxlength="1" @change="editSomeFields(editForm,'flowState',$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, addXmTestPlan,editXmTestPlan,editSomeFieldsXmTestPlan } from '@/api/xm/core/xmTestPlan';
import { mapGetters } from 'vuex'
export default {
name:'xmTestPlanEdit',
components: {
},
computed: {
...mapGetters([ 'userInfo' ]),
},
props:['xmTestPlan','visible','opType'],
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:{},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
editFormRules: {
id: [
//{ required: true, message: '', trigger: 'blur' }
]
},
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)
params[fieldName]=$event
var func = editSomeFieldsXmTestPlan
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>

382
src/views/xm/core/xmTestPlan/XmTestPlanMng.vue

@ -0,0 +1,382 @@
<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="searchXmTestPlans" 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">
<!--列表 XmTestPlan 测试计划-->
<el-table ref="xmTestPlanTable" :data="xmTestPlans" :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="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="casedbId" label="用例库编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.casedbId}} </span>
</template>
</el-table-column>
<el-table-column prop="casedbName" label="用例库名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.casedbName}} </span>
</template>
</el-table-column>
<el-table-column prop="projectId" label="项目编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.projectId}} </span>
</template>
</el-table-column>
<el-table-column prop="projectName" label="项目名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.projectName}} </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="stime" label="开始时间" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.stime}} </span>
</template>
</el-table-column>
<el-table-column prop="etime" label="结束时间" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.etime}} </span>
</template>
</el-table-column>
<el-table-column prop="status" label="状态0-未开始,1-进行中,2已结束" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.status}} </span>
</template>
</el-table-column>
<el-table-column prop="tcode" label="测试结果0未通过,1已通过" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.tcode}} </span>
</template>
</el-table-column>
<el-table-column prop="totalCases" label="总用例数" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.totalCases}} </span>
</template>
</el-table-column>
<el-table-column prop="okCases" label="通过用例数" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.okCases}} </span>
</template>
</el-table-column>
<el-table-column prop="errCases" label="失败用例数" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.errCases}} </span>
</template>
</el-table-column>
<el-table-column prop="igCases" label="忽略用例数" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.igCases}} </span>
</template>
</el-table-column>
<el-table-column prop="blCases" label="阻塞用例数" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.blCases}} </span>
</template>
</el-table-column>
<el-table-column prop="productId" label="产品编号" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.productId}} </span>
</template>
</el-table-column>
<el-table-column prop="productName" label="产品名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.productName}} </span>
</template>
</el-table-column>
<el-table-column prop="flowState" label="评审结果0-待评审,1-已评审通过,2-已拒绝" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.flowState}} </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>
<!--编辑 XmTestPlan 测试计划界面-->
<el-drawer title="编辑测试计划" :visible.sync="editFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-test-plan-edit op-type="edit" :xm-test-plan="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-test-plan-edit>
</el-drawer>
<!--新增 XmTestPlan 测试计划界面-->
<el-drawer title="新增测试计划" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-test-plan-edit op-type="add" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-test-plan-edit>
</el-drawer>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from '@/common/config';//
import { initDicts,listXmTestPlan, delXmTestPlan, batchDelXmTestPlan,editSomeFieldsXmTestPlan } from '@/api/xm/core/xmTestPlan';
import XmTestPlanEdit from './XmTestPlanEdit';//
import { mapGetters } from 'vuex'
export default {
name:'xmTestPlanMng',
components: {
XmTestPlanEdit,
},
props:['visible'],
computed: {
...mapGetters(['userInfo']),
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmTestPlans()
}
}
},
data() {
return {
filters: {
key: ''
},
xmTestPlans: [],//
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,//xmTestPlan
addForm: {
id:'',name:'',casedbId:'',casedbName:'',projectId:'',projectName:'',cuserid:'',cusername:'',ctime:'',stime:'',etime:'',status:'',tcode:'',totalCases:'',okCases:'',errCases:'',igCases:'',blCases:'',productId:'',productName:'',flowState:''
},
editFormVisible: false,//
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 data
methods: {
...util,
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmTestPlans();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmTestPlans();
},
// 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.getXmTestPlans();
},
searchXmTestPlans(){
this.pageInfo.count=true;
this.getXmTestPlans();
},
// XmTestPlan
getXmTestPlans() {
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;
listXmTestPlan(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmTestPlans = 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 );
},
// XmTestPlan
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
// XmTestPlan
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmTestPlans();
},
afterEditSubmit(){
this.editFormVisible=false;
},
//xmTestPlan
selsChange: function (sels) {
this.sels = sels;
},
//xmTestPlan
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { id:row.id };
delXmTestPlan(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.searchXmTestPlans();
}
this.$notify({ position:'bottom-left', showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmTestPlan
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;
batchDelXmTestPlan(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.searchXmTestPlans();
}
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 = editSomeFieldsXmTestPlan
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
if(this.sels.length>0){
this.searchXmTestPlans();
}
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.searchXmTestPlans();
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmTestPlanTable.$el)
});
}
}
</script>
<style scoped>
</style>

183
src/views/xm/core/xmTestPlanCase/XmTestPlanCaseEdit.vue

@ -0,0 +1,183 @@
<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">
<!--编辑界面 XmTestPlanCase 测试计划与用例关系表-->
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editFormRef">
<el-form-item label="bug数目" prop="bugs">
<el-input-number v-model="editForm.bugs" :min="0" :max="200"></el-input-number>
</el-form-item>
<el-form-item label="执行人" prop="execUserid">
<el-input v-model="editForm.execUserid" placeholder="执行人" :maxlength="50" @change="editSomeFields(editForm,'execUserid',$event)"></el-input>
</el-form-item>
<el-form-item label="测试用例编号" prop="caseId">
<el-input v-model="editForm.caseId" placeholder="测试用例编号" :maxlength="50" @change="editSomeFields(editForm,'caseId',$event)"></el-input>
</el-form-item>
<el-form-item label="更新时间" prop="ltime">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.ltime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</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="0-未测,1-通过,2-受阻,3-忽略,4-失败" prop="execStatus">
<el-input v-model="editForm.execStatus" placeholder="0-未测,1-通过,2-受阻,3-忽略,4-失败" :maxlength="1" @change="editSomeFields(editForm,'execStatus',$event)"></el-input>
</el-form-item>
<el-form-item label="执行人姓名" prop="execUsername">
<el-input v-model="editForm.execUsername" placeholder="执行人姓名" :maxlength="255" @change="editSomeFields(editForm,'execUsername',$event)"></el-input>
</el-form-item>
<el-form-item label="计划编号" prop="planId">
<el-input v-model="editForm.planId" placeholder="计划编号" :maxlength="50" @change="editSomeFields(editForm,'planId',$event)"></el-input>
</el-form-item>
<el-form-item label="用例名称" prop="caseName">
<el-input v-model="editForm.caseName" placeholder="用例名称" :maxlength="255" @change="editSomeFields(editForm,'caseName',$event)"></el-input>
</el-form-item>
<el-form-item label="优先级" prop="priority">
<el-input v-model="editForm.priority" placeholder="优先级" :maxlength="1" @change="editSomeFields(editForm,'priority',$event)"></el-input>
</el-form-item>
<el-form-item label="执行备注" prop="remark">
<el-input v-model="editForm.remark" placeholder="执行备注" :maxlength="2147483647" @change="editSomeFields(editForm,'remark',$event)"></el-input>
</el-form-item>
<el-form-item label="测试步骤" prop="testStep">
<el-input v-model="editForm.testStep" placeholder="测试步骤" :maxlength="2147483647" @change="editSomeFields(editForm,'testStep',$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, addXmTestPlanCase,editXmTestPlanCase,editSomeFieldsXmTestPlanCase } from '@/api/xm/core/xmTestPlanCase';
import { mapGetters } from 'vuex'
export default {
name:'xmTestPlanCaseEdit',
components: {
},
computed: {
...mapGetters([ 'userInfo' ]),
},
props:['xmTestPlanCase','visible','opType'],
watch: {
'xmTestPlanCase':function( xmTestPlanCase ) {
if(xmTestPlanCase){
this.editForm = {...xmTestPlanCase};
}
},
'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: {
caseId: [
//{ required: true, message: '', trigger: 'blur' }
]
},
editForm: {
bugs:'',execUserid:'',caseId:'',ltime:'',ctime:'',execStatus:'',execUsername:'',planId:'',caseName:'',priority:'',remark:'',testStep:''
},
maxTableHeight:300,
}//end return
},//end data
methods: {
...util,
// @cancel="editFormVisible=false"
handleCancel:function(){
this.$refs['editFormRef'].resetFields();
this.$emit('cancel');
},
//XmTestPlanCase @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=addXmTestPlanCase
if(this.currOpType=='edit'){
func=editXmTestPlanCase
}
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.xmTestPlanCase){
this.editForm = Object.assign({},this.xmTestPlanCase);
}
if(this.opType=='edit'){
}else{
}
this.editFormBak={...this.editForm}
},
editSomeFields(row,fieldName,$event){
if(this.opType=='add'){
return;
}
let params={};
params['pkList']=[row].map(i=>{ return { caseId:i.caseId, planId:i.planId}})
params[fieldName]=$event
var func = editSomeFieldsXmTestPlanCase
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>

332
src/views/xm/core/xmTestPlanCase/XmTestPlanCaseMng.vue

@ -0,0 +1,332 @@
<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="searchXmTestPlanCases" 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">
<!--列表 XmTestPlanCase 测试计划与用例关系表-->
<el-table ref="xmTestPlanCaseTable" :data="xmTestPlanCases" :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="caseId" label="测试用例编号" min-width="120" show-overflow-tooltip fixed="left"></el-table-column> <el-table-column prop="planId" label="" min-width="120" show-overflow-tooltip fixed="left"></el-table-column>
<el-table-column prop="bugs" label="bug数目" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.bugs}} </span>
</template>
</el-table-column>
<el-table-column prop="execUserid" label="执行人" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.execUserid}} </span>
</template>
</el-table-column>
<el-table-column prop="ltime" label="更新时间" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.ltime}} </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="execStatus" label="0-未测,1-通过,2-受阻,3-忽略,4-失败" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.execStatus}} </span>
</template>
</el-table-column>
<el-table-column prop="execUsername" label="执行人姓名" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.execUsername}} </span>
</template>
</el-table-column>
<el-table-column prop="caseName" label="用例名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.caseName}} </span>
</template>
</el-table-column>
<el-table-column prop="priority" label="优先级" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.priority}} </span>
</template>
</el-table-column>
<el-table-column prop="remark" label="执行备注" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.remark}} </span>
</template>
</el-table-column>
<el-table-column prop="testStep" label="测试步骤" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.testStep}} </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>
<!--编辑 XmTestPlanCase 测试计划与用例关系表界面-->
<el-drawer title="编辑测试计划与用例关系表" :visible.sync="editFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-test-plan-case-edit op-type="edit" :xm-test-plan-case="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-test-plan-case-edit>
</el-drawer>
<!--新增 XmTestPlanCase 测试计划与用例关系表界面-->
<el-drawer title="新增测试计划与用例关系表" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-test-plan-case-edit op-type="add" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-test-plan-case-edit>
</el-drawer>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from '@/common/config';//
import { initDicts,listXmTestPlanCase, delXmTestPlanCase, batchDelXmTestPlanCase,editSomeFieldsXmTestPlanCase } from '@/api/xm/core/xmTestPlanCase';
import XmTestPlanCaseEdit from './XmTestPlanCaseEdit';//
import { mapGetters } from 'vuex'
export default {
name:'xmTestPlanCaseMng',
components: {
XmTestPlanCaseEdit,
},
props:['visible'],
computed: {
...mapGetters(['userInfo']),
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmTestPlanCases()
}
}
},
data() {
return {
filters: {
key: ''
},
xmTestPlanCases: [],//
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,//xmTestPlanCase
addForm: {
bugs:'',execUserid:'',caseId:'',ltime:'',ctime:'',execStatus:'',execUsername:'',planId:'',caseName:'',priority:'',remark:'',testStep:''
},
editFormVisible: false,//
editForm: {
bugs:'',execUserid:'',caseId:'',ltime:'',ctime:'',execStatus:'',execUsername:'',planId:'',caseName:'',priority:'',remark:'',testStep:''
},
maxTableHeight:300,
}
},//end data
methods: {
...util,
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmTestPlanCases();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmTestPlanCases();
},
// 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.getXmTestPlanCases();
},
searchXmTestPlanCases(){
this.pageInfo.count=true;
this.getXmTestPlanCases();
},
// XmTestPlanCase
getXmTestPlanCases() {
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;
listXmTestPlanCase(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmTestPlanCases = 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 );
},
// XmTestPlanCase
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
// XmTestPlanCase
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmTestPlanCases();
},
afterEditSubmit(){
this.editFormVisible=false;
},
//xmTestPlanCase
selsChange: function (sels) {
this.sels = sels;
},
//xmTestPlanCase
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { caseId:row.caseId, planId:row.planId };
delXmTestPlanCase(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.searchXmTestPlanCases();
}
this.$notify({ position:'bottom-left', showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmTestPlanCase
batchDel: function () {
if(this.sels.length<=0){
return;
}
var params=this.sels.map(i=>{
return { caseId:i.caseId, planId:i.planId}
})
this.$confirm('确认删除选中记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
batchDelXmTestPlanCase(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.searchXmTestPlanCases();
}
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.caseId==row.caseId && k.planId==row.planId)){
this.$notify({position:'bottom-left',showClose:true,message:'请编辑选中的行',type:'warning'})
Object.assign(this.editForm,this.editFormBak)
return;
}
params['pkList']=this.sels.map(i=>{ return { caseId:i.caseId, planId:i.planId}})
}else{
params['pkList']=[row].map(i=>{ return { caseId:i.caseId, planId:i.planId}})
}
params[fieldName]=$event
var func = editSomeFieldsXmTestPlanCase
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
if(this.sels.length>0){
this.searchXmTestPlanCases();
}
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.searchXmTestPlanCases();
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmTestPlanCaseTable.$el)
});
}
}
</script>
<style scoped>
</style>
Loading…
Cancel
Save