parent
e89100d98b
commit
33b19724a3
|
@ -196,6 +196,15 @@
|
|||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="key.startsWith('custom')">
|
||||
and issues.id in (
|
||||
select resource_id from custom_field_issues where concat('custom',field_id) = #{key}
|
||||
and trim(both '"' from value) in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
)
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</foreach>
|
||||
|
|
|
@ -505,6 +505,15 @@
|
|||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="key.startsWith('custom')">
|
||||
and test_case.id in (
|
||||
select resource_id from custom_field_test_case where concat('custom',field_id) = #{key}
|
||||
and trim(both '"' from value) in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
)
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="key=='status' and (values == null || values.size() == 0)">
|
||||
|
|
|
@ -72,7 +72,7 @@ public class CustomFieldResourceService {
|
|||
if (CollectionUtils.isNotEmpty(addFields)) {
|
||||
this.checkInit();
|
||||
addFields.forEach(field -> {
|
||||
if (StringUtils.isNotBlank(field.getValue()) && StringUtils.isNotBlank(field.getTextValue())) {
|
||||
if (StringUtils.isNotBlank(field.getValue()) || StringUtils.isNotBlank(field.getTextValue())) {
|
||||
createOrUpdateFields(tableName, resourceId, field);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -42,7 +42,12 @@
|
|||
if (this.component.options.showLabel) {
|
||||
return this.component.options.showLabel(op);
|
||||
}
|
||||
return op.label.indexOf(".") !== -1 ? this.$t(op.label) : op.label;
|
||||
if (op.label) {
|
||||
return op.label.indexOf(".") !== -1 ? this.$t(op.label) : op.label;
|
||||
} else {
|
||||
// 自定义字段
|
||||
return op.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,32 +28,7 @@ export function getAdvSearchCustomField(componentArr, fields) {
|
|||
}
|
||||
|
||||
function getComponentOptions(field) {
|
||||
const fieldOptions = field.options ? field.options : [];
|
||||
let type = field.type;
|
||||
let options = [];
|
||||
if (fieldOptions.length === 0 && field.type !== 'member' && field.type !== 'multipleMember') {
|
||||
return options;
|
||||
}
|
||||
|
||||
if (type === 'member' || type === 'multipleMember') {
|
||||
options = { // 异步获取候选项
|
||||
url: "/user/list",
|
||||
labelKey: "name",
|
||||
valueKey: "id",
|
||||
showLabel: option => {
|
||||
return option.label + "(" + option.value + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let option of fieldOptions) {
|
||||
let temp = {
|
||||
value: option.value,
|
||||
label: option.text
|
||||
}
|
||||
options.push(temp);
|
||||
}
|
||||
return options;
|
||||
return Array.isArray(field.options) ? (field.options.length > 0 ? field.options : []) : [];
|
||||
}
|
||||
|
||||
function getComponentName(type) {
|
||||
|
|
|
@ -189,6 +189,7 @@
|
|||
:fields-width="fieldsWidth"
|
||||
:label="field.system ? $t(systemFiledMap[field.name]) :field.name"
|
||||
:min-width="120"
|
||||
:column-key="'custom' + field.id"
|
||||
:prop="field.name">
|
||||
<template v-slot="scope">
|
||||
<span v-if="field.name === '用例等级'">
|
||||
|
@ -630,7 +631,7 @@ export default {
|
|||
Promise.all([p1, p2]).then((data) => {
|
||||
let template = data[1];
|
||||
this.testCaseTemplate = template;
|
||||
this.fields = getTableHeaderWithCustomFields('TRACK_TEST_CASE', this.testCaseTemplate.customFields);
|
||||
this.fields = getTableHeaderWithCustomFields('TRACK_TEST_CASE', this.testCaseTemplate.customFields, this.members);
|
||||
// todo 处理高级搜索自定义字段部分
|
||||
let comp = getAdvSearchCustomField(this.condition.components, this.testCaseTemplate.customFields);
|
||||
this.condition.components.push(...comp);
|
||||
|
@ -671,12 +672,8 @@ export default {
|
|||
return value ? value : '';
|
||||
},
|
||||
getCustomFieldFilter(field) {
|
||||
if (field.name === '用例等级') {
|
||||
return this.priorityFilters;
|
||||
} else if (field.name === '用例状态') {
|
||||
return this.statusFilters;
|
||||
}
|
||||
return null;
|
||||
return !Array.isArray(field.options) ?
|
||||
(field.options.length > 0 ? field.options : null) : null;
|
||||
},
|
||||
checkRedirectEditPage(redirectParam) {
|
||||
if (redirectParam != null) {
|
||||
|
|
|
@ -128,9 +128,11 @@
|
|||
</ms-table-column>
|
||||
|
||||
<ms-table-column v-for="field in issueTemplate.customFields" :key="field.id"
|
||||
:filters="Array.isArray(field.options) ? (field.options.length > 0 ? field.options : null) : null"
|
||||
:field="item"
|
||||
:fields-width="fieldsWidth"
|
||||
:label="field.system ? $t(systemNameMap[field.name]) :field.name"
|
||||
:column-key="'custom' + field.id"
|
||||
:prop="field.name">
|
||||
<template v-slot="scope">
|
||||
<span v-if="field.name === '状态'">
|
||||
|
|
|
@ -283,11 +283,18 @@ function getCustomTableHeaderByFiledSetting(key, fieldSetting) {
|
|||
* @param customFields
|
||||
* @returns {[]|*}
|
||||
*/
|
||||
export function getTableHeaderWithCustomFields(key, customFields) {
|
||||
export function getTableHeaderWithCustomFields(key, customFields, projectMembers=[]) {
|
||||
let fieldSetting = [...CUSTOM_TABLE_HEADER[key]];
|
||||
fieldSetting = JSON.parse(JSON.stringify(fieldSetting)); // 复制,国际化
|
||||
translateLabel(fieldSetting);
|
||||
let keys = getCustomFieldsKeys(customFields);
|
||||
projectMembers.forEach(member => {
|
||||
member['text'] = member.name;
|
||||
// 高级搜索使用
|
||||
member['label'] = member.name;
|
||||
member['value'] = member.id;
|
||||
member['showLabel'] = member.name + "(" + member.id + ")";
|
||||
})
|
||||
customFields.forEach(item => {
|
||||
if (!item.key) {
|
||||
// 兼容旧版,更新key
|
||||
|
@ -301,6 +308,9 @@ export function getTableHeaderWithCustomFields(key, customFields) {
|
|||
isCustom: true
|
||||
}
|
||||
fieldSetting.push(field);
|
||||
if (item.type === 'member' && projectMembers && projectMembers.length > 0) {
|
||||
item.options = projectMembers;
|
||||
}
|
||||
});
|
||||
return getCustomTableHeaderByFiledSetting(key, fieldSetting);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue