refactor(项目管理): 用例模板责任人的默认值增加“创建人”选项
--bug=1014455 --user=李玉号 【项目管理】用例模板,责任人的默认值增加“创建人”选项 https://www.tapd.cn/55049933/s/1193112
This commit is contained in:
parent
d58264983b
commit
93d75e039a
|
@ -27,7 +27,7 @@
|
|||
prop="type">
|
||||
<template v-slot="scope">
|
||||
<el-scrollbar>
|
||||
<custom-filed-component class="default-value-item" :data="scope.row" prop="defaultValue"/>
|
||||
<custom-filed-component class="default-value-item" :data="scope.row" prop="defaultValue" :is-template-edit="true"/>
|
||||
</el-scrollbar>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
<el-option
|
||||
v-for="(item) in memberOptions"
|
||||
:key="item.id"
|
||||
:label="item.name + ' (' + item.email + ')'"
|
||||
:label="item.name + (item.email ? ' (' + item.email + ')' : '')"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
@ -113,7 +113,6 @@
|
|||
|
||||
<script>
|
||||
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
|
||||
import MsMarkDownText from "@/business/components/track/case/components/MsMarkDownText";
|
||||
import {getProjectMemberOption} from "@/network/user";
|
||||
|
@ -126,7 +125,8 @@ export default {
|
|||
'prop',
|
||||
'form',
|
||||
'disabled',
|
||||
'defaultOpen'
|
||||
'defaultOpen',
|
||||
'isTemplateEdit'
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
|
@ -136,6 +136,9 @@ export default {
|
|||
mounted() {
|
||||
getProjectMemberOption((data) => {
|
||||
this.memberOptions = data;
|
||||
if (this.data.name === '责任人' && this.data.system && this.isTemplateEdit) {
|
||||
this.memberOptions.unshift({id: 'CURRENT_USER', name: '创建人', email: ''});
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-button v-else type="primary" class="ms-api-buttion" @click="handleCommand"
|
||||
<el-button v-else type="primary" class="ms-api-buttion" @click="handleCommand"
|
||||
:disabled="readOnly"
|
||||
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
|
||||
{{ $t('commons.save') }}
|
||||
|
@ -79,21 +79,21 @@
|
|||
prop="prerequisite"/>
|
||||
|
||||
<step-change-item :label-width="formLabelWidth" :form="form"/>
|
||||
<form-rich-text-item v-if="form.stepModel === 'TEXT'"
|
||||
prop="stepDescription"
|
||||
:disabled="readOnly"
|
||||
:label-width="formLabelWidth"
|
||||
:title="$t('test_track.case.step_desc')"
|
||||
:data="form"
|
||||
:default-open="richTextDefaultOpen"/>
|
||||
<form-rich-text-item v-if="form.stepModel === 'TEXT'"
|
||||
prop="stepDescription"
|
||||
:disabled="readOnly"
|
||||
:label-width="formLabelWidth"
|
||||
:title="$t('test_track.case.step_desc')"
|
||||
:data="form"
|
||||
:default-open="richTextDefaultOpen"/>
|
||||
|
||||
<form-rich-text-item v-if="form.stepModel === 'TEXT'"
|
||||
prop="expectedResult"
|
||||
:disabled="readOnly"
|
||||
:label-width="formLabelWidth"
|
||||
:title="$t('test_track.case.expected_results')"
|
||||
:data="form"
|
||||
:default-open="richTextDefaultOpen"/>
|
||||
<form-rich-text-item v-if="form.stepModel === 'TEXT'"
|
||||
prop="expectedResult"
|
||||
:disabled="readOnly"
|
||||
:label-width="formLabelWidth"
|
||||
:title="$t('test_track.case.expected_results')"
|
||||
:data="form"
|
||||
:default-open="richTextDefaultOpen"/>
|
||||
|
||||
<test-case-step-item v-if="form.stepModel === 'STEP' || !form.stepModel"
|
||||
:label-width="formLabelWidth"
|
||||
|
@ -223,7 +223,7 @@ export default {
|
|||
showFollow: false,
|
||||
isValidate: false,
|
||||
currentValidateName: "",
|
||||
type:"",
|
||||
type: "",
|
||||
form: {
|
||||
name: '',
|
||||
module: 'default-module',
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import i18n from '../../i18n/i18n'
|
||||
import {SYSTEM_FIELD_NAME_MAP} from "@/common/js/table-constants";
|
||||
import {getCurrentUserId} from "@/common/js/utils";
|
||||
|
||||
function setDefaultValue(item, value) {
|
||||
item.defaultValue = value;
|
||||
|
@ -10,7 +11,6 @@ function setDefaultValue(item, value) {
|
|||
* 设置默认值,添加自定义校验
|
||||
* @param data 原表单值
|
||||
* @param template 模板
|
||||
* @param customFieldForm 用于自定义表单的校验
|
||||
* @param rules 自定义表单的校验规则
|
||||
* @param oldFields 用于兼容旧版本数据
|
||||
*/
|
||||
|
@ -34,6 +34,9 @@ export function parseCustomField(data, template, rules, oldFields) {
|
|||
} catch (e) {
|
||||
//
|
||||
}
|
||||
if (item.name === '责任人' && item.system && val && val === 'CURRENT_USER') {
|
||||
val = getCurrentUserId();
|
||||
}
|
||||
setDefaultValue(item, val);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue