Browse Source

优化

master
陈裕财 4 years ago
parent
commit
d258f12ec7
  1. 125
      src/views/xm/core/xmTestCase/TestStepConfig.vue
  2. 21
      src/views/xm/core/xmTestCase/XmTestCaseEdit.vue
  3. 8
      src/views/xm/core/xmTestCase/XmTestCaseMng.vue

125
src/views/xm/core/xmTestCase/TestStepConfig.vue

@ -0,0 +1,125 @@
<template>
<section>
<el-row>
<el-form ref="extInfosRef">
<!-- 扩展字段[{name:'中文名称',id:'编号',value:'值',remark:'备注',type:'支持简单的1-普通文本2-数字,3-日期,8-富文本,9单图文,15-是否'}] -->
<el-row>
<el-col :span="2">
步骤
</el-col>
<el-col :span="9">
操作
</el-col>
<el-col :span="9">
预期结果
</el-col>
<el-col :span="4">
操作
</el-col>
</el-row>
<el-row v-for="(item, index) in extInfosList" :key="index">
<el-col :span="2">
{{index+1}}
</el-col>
<el-col :span="9">
<el-input style="width:95%;" v-model="item.op" clearable placeholder="操作步骤"></el-input>
</el-col>
<el-col :span="9">
<el-input style="width:95%;" v-model="item.eresult" clearable placeholder="预期结果"></el-input>
</el-col>
<el-col :span="4">
<el-button @click.prevent="removeExtInfosItem(item,index)" icon="el-icon-delete">
</el-button><el-button @click="addExtInfosItem(item,index)" icon="el-icon-plus"></el-button>
</el-col>
</el-row>
<el-form-item>
<el-button @click="addExtInfosFirstItem" icon="el-icon-plus"><slot>新增一行</slot></el-button>
<el-button @click="save" icon="el-icon-save"><slot>完成</slot></el-button>
</el-form-item>
</el-form>
</el-row>
</section>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'testStepConfig',
props:['value','unConfig'],
computed: {
...mapGetters([
'userInfo'
])
},
watch:{
value(val){
this.initData();
},
extInfosList:{
deep:true,
handler(val,oldVal){
if(this.value instanceof Array){
this.$emit("input",val)
}else{
this.$emit("input",JSON.stringify(val))
}
}
},
},
data() {
return{
extInfosList:[],//[{name:'',id:'',value:'',link:'',remark:'',type:'1-2-3-8-915-'}]
}
},//end data
methods: {
save(){
if(this.value instanceof Array){
this.$emit("finish",this.extInfosList)
}else{
this.$emit("finish",JSON.stringify(this.extInfosList))
}
},
addExtInfosFirstItem(){
if(!this.extInfosList){
this.extInfosList=[]
}
this.extInfosList.push({id:'',op:'',eresult:'',aresult:'',tcode:'0'})
},
addExtInfosItem(item,index){
this.extInfosList.splice(index+1,0,{id:'',op:'',eresult:'',aresult:'',tcode:'0'})
},
removeExtInfosItem(item,index){
this.extInfosList.splice(index,1)
},
initData(){
if(this.value){
if(this.value instanceof Array){
this.extInfosList=this.value
}else{
this.extInfosList=JSON.parse(this.value)
}
}else{
this.extInfosList=[]
}
}
},//end methods
components: {
},
mounted() {
this.initData();
}
}
</script>
<style scoped>
</style>

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

@ -1,8 +1,8 @@
<template>
<section class="page-container padding">
<el-row class="page-header">
<section>
<el-row>
</el-row>
<el-row class="page-main" :style="{overflowX:'auto',height:maxTableHeight+'px'}" ref="table">
<el-row>
<!--编辑界面 XmTestCase 测试用例-->
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editFormRef" label-position="left">
<el-form-item label="标题" prop="caseName">
@ -13,7 +13,7 @@
<el-input v-model="editForm.verNum" placeholder="版本号" :maxlength="50" @change="editSomeFields(editForm,'verNum',$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>
<test-step-config v-model="editForm.testStep"></test-step-config>
</el-form-item>
<el-form-item label="关联需求" prop="menuName">
{{editForm.menuName?editForm.menuName:'暂无关联需求'}} <el-button type="text" @click="menuVisible=true">选择需求</el-button>
@ -39,15 +39,17 @@
</el-form>
</el-row>
<el-row v-if="opType=='add'" class="page-bottom bottom-fixed">
<el-row v-if="opType=='add'" >
<span style="float:right;">
<el-button @click.native="handleCancel">取消</el-button>
<el-button v-loading="load.edit" type="primary" @click.native="saveSubmit" :disabled="load.edit==true">提交</el-button>
</span>
</el-row>
<el-dialog append-to-body title="需求选择" :visible.sync="menuVisible" width="80%" top="20px" :close-on-click-modal="false">
<xm-menu-select :is-select-menu="true" checkScope="3" @selected="onMenuSelected" :xm-product="{id:editForm.productId}"></xm-menu-select>
</el-dialog>
<el-dialog append-to-body title="模块选择" :visible.sync="funcVisible" width="60%" top="20px" :close-on-click-modal="false">
<xm-func-select @selected="onFuncSelected" :xm-product="{id:editForm.productId}"></xm-func-select>
<xm-func-select @row-click="onFuncSelected" :xm-product="{id:editForm.productId}"></xm-func-select>
</el-dialog>
</section>
</template>
@ -59,10 +61,12 @@
import { mapGetters } from 'vuex'
import XmMenuSelect from '../xmMenu/XmMenuSelect'
import XmFuncSelect from '../xmFunc/XmFuncSelect'
import TestStepConfig from './TestStepConfig.vue';
export default {
name:'xmTestCaseEdit',
components: {
XmMenuSelect,XmFuncSelect,
TestStepConfig,
},
computed: {
...mapGetters([ 'userInfo' ]),
@ -179,17 +183,18 @@
onMenuSelected(row){
this.editForm.menuId=row.menuId
this.editForm.menuName=row.menuName
this.menuVisible=false;
},
onFuncSelected(row){
this.editForm.funcId=row.id
this.editForm.funcName=row.name
this.funcVisible=false;
}
},//end method
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.table.$el)
this.initData()
});
}
}

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

@ -57,14 +57,14 @@
<el-row>
<!--编辑 XmTestCase 测试用例界面-->
<el-drawer title="编辑测试用例" :visible.sync="editFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<el-dialog title="编辑测试用例" :visible.sync="editFormVisible" width="60%" top="20px" append-to-body :close-on-click-modal="false">
<xm-test-case-edit op-type="edit" :xm-test-case="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-test-case-edit>
</el-drawer>
</el-dialog>
<!--新增 XmTestCase 测试用例界面-->
<el-drawer title="新增测试用例" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<el-dialog title="新增测试用例" :visible.sync="addFormVisible" width="60%" top="20px" append-to-body :close-on-click-modal="false">
<xm-test-case-edit op-type="add" :xm-test-casedb="xmTestCasedb" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-test-case-edit>
</el-drawer>
</el-dialog>
</el-row>
</section>
</template>

Loading…
Cancel
Save