4 changed files with 59 additions and 336 deletions
-
2src/api/xm/core/xmTestCase.js
-
185src/views/xm/core/xmTestCase/XmTestCaseAdd.vue
-
91src/views/xm/core/xmTestCase/XmTestCaseEdit.vue
-
117src/views/xm/core/xmTestCase/XmTestCaseMng.vue
@ -1,185 +0,0 @@ |
|||
<template> |
|||
<section class="page-container padding border"> |
|||
<el-row> |
|||
<!--新增界面 XmTestCase 测试用例--> |
|||
<el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm"> |
|||
<el-form-item label="标题" prop="caseName"> |
|||
<el-input v-model="addForm.caseName" placeholder="标题" ></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="模块名称" prop="moduleName"> |
|||
<el-input v-model="addForm.moduleName" placeholder="模块名称" ></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="关联的需求" prop="menuId"> |
|||
<el-tag v-if="addForm.menuName && addForm.menuName!=''" closable @close="clearFiltersMneu">{{addForm.menuName}}</el-tag> |
|||
<el-tag v-else>还没关联任何需求</el-tag> |
|||
<el-button @click="showMenu">关联需求</el-button> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="测试步骤" prop="testStep"> |
|||
<vue-editor v-if="visible" :id="'testStep3'" :branch-id="userInfo.branchId" v-model="addForm.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="addForm.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.add" type="primary" @click.native="addSubmit" :disabled="load.add==true">提交</el-button> |
|||
<el-button v-loading="load.add" type="warning" @click.native="addSubmit(true)" :disabled="load.add==true">提交后继续新建</el-button> |
|||
|
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<el-drawer append-to-body title="需求选择" :visible.sync="menuVisible" size="60%" :close-on-click-modal="false"> |
|||
<xm-menu-select :xm-product="xmProduct" :visible="menuVisible" checkScope="3" :is-select-menu="true" :multi="true" @menus-selected="onSelectedMenus" ></xm-menu-select> |
|||
</el-drawer> |
|||
</el-row> |
|||
</section> |
|||
</template> |
|||
|
|||
<script> |
|||
import util from '@/common/js/util';//全局公共库 |
|||
import {sn} from '@/common/js/sequence';//全局公共库 |
|||
|
|||
import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询 |
|||
import { addXmTestCase } from '@/api/xm/core/xmTestCase'; |
|||
import { mapGetters } from 'vuex' |
|||
import xmMenuSelect from '../xmMenu/XmMenuSelect'; |
|||
import VueEditor from '@/components/Tinymce/index'; |
|||
|
|||
export default { |
|||
computed: { |
|||
...mapGetters([ |
|||
'userInfo','roles' |
|||
]) |
|||
}, |
|||
props:['xmTestCase','visible','xmProduct','xmMenu'], |
|||
watch: { |
|||
'xmTestCase':function( xmTestCase ) { |
|||
//this.addForm = xmTestCase; |
|||
}, |
|||
'visible':function(visible) { |
|||
if(visible==true){ |
|||
//从新打开页面时某些数据需要重新加载,可以在这里添加 |
|||
if(this.xmProduct && this.xmProduct.id){ |
|||
this.addForm.productId=this.xmProduct.id |
|||
}else{ |
|||
this.addForm.productId='' |
|||
} |
|||
if(this.xmMenu && this.xmMenu.menuId){ |
|||
this.addForm.menuId=this.xmMenu.menuId |
|||
this.addForm.menuName=this.xmMenu.menuName |
|||
}else{ |
|||
this.addForm.menuId='' |
|||
this.addForm.menuName='' |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
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, edit: false, del: false, add: false },//查询中... |
|||
addFormRules: { |
|||
menuId: [ |
|||
{ required: true, message: '需求不能为空', trigger: 'blur' } |
|||
], |
|||
caseName: [ |
|||
{ required: true, message: '标题不能为空', trigger: 'blur' } |
|||
] |
|||
}, |
|||
//新增界面数据 测试用例 |
|||
addForm: { |
|||
id:'',caseName:'',caseRemark:'',testStep:'',expectResult:'',menuId:'',menuName:'',ctime:'',ltime:'',luserid:'',lusername:'',cbranchId:'',moduleId:'',moduleName:'',caseStatus:'1' |
|||
}, |
|||
/**begin 在下面加自定义属性,记得补上面的一个逗号**/ |
|||
menuVisible:false, |
|||
|
|||
/**end 在上面加自定义属性**/ |
|||
}//end return |
|||
},//end data |
|||
methods: { |
|||
// 取消按钮点击 父组件监听@cancel="addFormVisible=false" 监听 |
|||
handleCancel:function(){ |
|||
this.$refs['addForm'].resetFields(); |
|||
this.$emit('cancel'); |
|||
}, |
|||
//新增提交XmTestCase 测试用例 父组件监听@submit="afterAddSubmit" |
|||
addSubmit: function (next) { |
|||
|
|||
this.$refs.addForm.validate((valid) => { |
|||
if (valid) { |
|||
|
|||
this.$confirm('确认提交吗?', '提示', {}).then(() => { |
|||
this.load.add=true |
|||
let params = Object.assign({}, this.addForm); |
|||
params.cbranchId=this.userInfo.branchId |
|||
params.luserid=this.userInfo.userid |
|||
params.lusername=this.userInfo.username |
|||
params.id=sn('case_') |
|||
addXmTestCase(params).then((res) => { |
|||
this.load.add=false |
|||
var tips=res.data.tips; |
|||
if(tips.isOk && next!=true){ |
|||
this.$emit('submit');// @submit="afterAddSubmit" |
|||
} |
|||
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' }); |
|||
}).catch( err => this.load.add=false); |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
/**begin 在下面加自定义方法,记得补上面的一个逗号**/ |
|||
showMenu(){ |
|||
this.menuVisible=true; |
|||
}, |
|||
onSelectedMenus(menus){ |
|||
if(!menus || menus.length==0){ |
|||
this.menuVisible=false |
|||
return; |
|||
} |
|||
this.menuVisible=false |
|||
this.addForm.menuId= menus[0].menuId |
|||
this.addForm.menuName= menus[0].menuName |
|||
this.$refs.addForm.validateField('menuId',valid=>{}) |
|||
|
|||
}, |
|||
clearFiltersMneu(menu){ |
|||
this.addForm.menuId="" |
|||
this.addForm.menuName="" |
|||
this.$refs.addForm.validateField('menuId',valid=>{}) |
|||
} |
|||
/**end 在上面加自定义方法**/ |
|||
|
|||
},//end method |
|||
components: { |
|||
//在下面添加其它组件 'xm-test-case-edit':XmTestCaseEdit |
|||
xmMenuSelect,VueEditor |
|||
}, |
|||
mounted() { |
|||
if(this.xmProduct && this.xmProduct.id){ |
|||
this.addForm.productId=this.xmProduct.id |
|||
}else{ |
|||
this.addForm.productId='' |
|||
} |
|||
if(this.xmMenu && this.xmMenu.menuId){ |
|||
this.addForm.menuId=this.xmMenu.menuId |
|||
this.addForm.menuName=this.xmMenu.menuName |
|||
}else{ |
|||
this.addForm.menuId='' |
|||
this.addForm.menuName='' |
|||
} |
|||
//this.addForm=Object.assign(this.addForm, this.xmTestCase); |
|||
/**在下面写其它函数***/ |
|||
|
|||
}//end mounted |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue