feat: 编辑模板-自定义字段设置
This commit is contained in:
parent
c77631de58
commit
d4e1ffb578
|
@ -24,8 +24,8 @@ public class CustomFieldController {
|
|||
private CustomFieldService customFieldService;
|
||||
|
||||
@PostMapping("/add")
|
||||
public void add(@RequestBody CustomField customField) {
|
||||
customFieldService.add(customField);
|
||||
public String add(@RequestBody CustomField customField) {
|
||||
return customFieldService.add(customField);
|
||||
}
|
||||
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
|
|
|
@ -48,13 +48,14 @@ public class CustomFieldService {
|
|||
@Resource
|
||||
CustomFieldTemplateService customFieldTemplateService;
|
||||
|
||||
public void add(CustomField customField) {
|
||||
public String add(CustomField customField) {
|
||||
checkExist(customField);
|
||||
customField.setId(UUID.randomUUID().toString());
|
||||
customField.setCreateTime(System.currentTimeMillis());
|
||||
customField.setUpdateTime(System.currentTimeMillis());
|
||||
customField.setGlobal(false);
|
||||
customFieldMapper.insert(customField);
|
||||
return customField.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -110,7 +110,7 @@ public class IssuesService {
|
|||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(platforms)) {
|
||||
platforms.add("LOCAL");
|
||||
platforms.add(IssuesManagePlatform.Local.toString());
|
||||
}
|
||||
IssuesRequest issuesRequest = new IssuesRequest();
|
||||
issuesRequest.setTestCaseId(updateRequest.getTestCaseId());
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
:visible.sync="visible"
|
||||
@confirm="save"
|
||||
:title="'创建字段'"
|
||||
append-to-body
|
||||
ref="msEditDialog">
|
||||
|
||||
<el-form :model="form" :rules="rules" label-position="right" label-width="140px" size="small" ref="form">
|
||||
|
@ -17,7 +18,7 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item :label="'使用场景'" prop="type">
|
||||
<el-select :disabled="isSystem" filterable v-model="form.scene" placeholder="使用场景">
|
||||
<el-select :disabled="isSystem || isTemplateEdit" filterable v-model="form.scene" placeholder="使用场景">
|
||||
<el-option
|
||||
v-for="item in sceneOptions"
|
||||
:key="item.value"
|
||||
|
@ -59,6 +60,7 @@ import {CUSTOM_FIELD_SCENE_OPTION, CUSTOM_FIELD_TYPE_OPTION, SYSTEM_FIELD_NAME_M
|
|||
export default {
|
||||
name: "CustomFieldEdit",
|
||||
components: {MsSingleHandleDrag, MsEditDialog},
|
||||
props: ['scene'],
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
|
@ -99,6 +101,9 @@ export default {
|
|||
},
|
||||
systemNameMap() {
|
||||
return SYSTEM_FIELD_NAME_MAP;
|
||||
},
|
||||
isTemplateEdit() {
|
||||
return this.scene ? true : false;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -124,6 +129,9 @@ export default {
|
|||
system: false,
|
||||
options: []
|
||||
};
|
||||
if (this.isTemplateEdit) {
|
||||
this.form.scene = this.scene;
|
||||
}
|
||||
this.url = 'custom/field/add';
|
||||
}
|
||||
},
|
||||
|
@ -134,10 +142,12 @@ export default {
|
|||
Object.assign(param, this.form);
|
||||
param.workspaceId = getCurrentWorkspaceId();
|
||||
param.options = JSON.stringify(this.form.options);
|
||||
this.result = this.$post(this.url, param, () => {
|
||||
this.result = this.$post(this.url, param, (response) => {
|
||||
this.visible = false;
|
||||
param.id = response.data;
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.$emit('refresh');
|
||||
this.$emit('save', param);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
<el-form-item :label="'已选字段'" class="filed-list">
|
||||
<el-button type="primary" @click="relateField">添加字段</el-button>
|
||||
<el-button type="primary" plain>设置自定义字段</el-button>
|
||||
<el-button type="primary" @click="addField" plain>设置自定义字段</el-button>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
|
@ -56,6 +56,8 @@
|
|||
:scene="scene"
|
||||
ref="customFieldRelateList"/>
|
||||
|
||||
<custom-field-edit :scene="scene" @save="handleCustomFieldAdd" ref="customFieldEdit"/>
|
||||
|
||||
</el-scrollbar>
|
||||
</el-main>
|
||||
</template>
|
||||
|
@ -71,10 +73,12 @@ import MsFormDivider from "@/business/components/common/components/MsFormDivider
|
|||
import CustomFieldFormList from "@/business/components/settings/workspace/template/CustomFieldFormList";
|
||||
import CustomFieldRelateList from "@/business/components/settings/workspace/template/CustomFieldRelateList";
|
||||
import {getCurrentWorkspaceId} from "@/common/js/utils";
|
||||
import CustomFieldEdit from "@/business/components/settings/workspace/template/CustomFieldEdit";
|
||||
|
||||
export default {
|
||||
name: "FieldTemplateEdit",
|
||||
components: {
|
||||
CustomFieldEdit,
|
||||
CustomFieldRelateList,
|
||||
CustomFieldFormList,
|
||||
MsFormDivider,
|
||||
|
@ -151,9 +155,18 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
handleCustomFieldAdd(data) {
|
||||
this.templateContainIds.add(data.id);
|
||||
data.fieldId = data.id;
|
||||
data.id = null;
|
||||
this.relateFields.push(data);
|
||||
},
|
||||
relateField() {
|
||||
this.$refs.customFieldRelateList.open();
|
||||
},
|
||||
addField() {
|
||||
this.$refs.customFieldEdit.open();
|
||||
},
|
||||
getRelateFields() {
|
||||
let condition = {};
|
||||
condition.templateId = this.form.id;
|
||||
|
|
|
@ -103,6 +103,7 @@ export default {
|
|||
issuePlatformMap:{
|
||||
metersphere: 'Metersphere',
|
||||
jira: 'JIRA',
|
||||
Tapd: 'Tapd',
|
||||
zentao: '禅道',
|
||||
},
|
||||
operators: [
|
||||
|
|
Loading…
Reference in New Issue