parent
2730922faa
commit
aabb8f426c
|
@ -248,11 +248,28 @@
|
|||
<if test="${condition}.customs != null and ${condition}.customs.size() > 0">
|
||||
<foreach collection="${condition}.customs" item="custom" separator="" open="" close="">
|
||||
and issues.id in (
|
||||
select resource_id from custom_field_issues where field_id = #{custom.id}
|
||||
and trim(both '"' from value)
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>)
|
||||
select resource_id from custom_field_issues where field_id = #{custom.id}
|
||||
<choose>
|
||||
<when test="custom.type == 'multipleMember'">
|
||||
<foreach item="item" collection='custom.value.split(",")' open="" separator="" close="">
|
||||
and left(`value`, 1) = '['
|
||||
and find_in_set(#{item}, replace(replace(`value`, ']', ''), '[', ''))
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="custom.type == 'date' or custom.type == 'datetime'">
|
||||
and left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13)
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</when>
|
||||
<otherwise>
|
||||
and trim(both '"' from value)
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</otherwise>
|
||||
</choose>
|
||||
)
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
|
|
@ -82,16 +82,27 @@
|
|||
<foreach collection="${condition}.customs" item="custom" separator="" open="" close="">
|
||||
and test_case.id in (
|
||||
select resource_id from custom_field_test_case where field_id = #{custom.id}
|
||||
<if test="custom.type == 'multipleMember'">
|
||||
and `value` = #{custom.value}
|
||||
</if>
|
||||
<if test="custom.type != 'multipleMember'">
|
||||
and trim(both '"' from value)
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</if>
|
||||
)
|
||||
<choose>
|
||||
<when test="custom.type == 'multipleMember'">
|
||||
<foreach item="item" collection='custom.value.split(",")' open="" separator="" close="">
|
||||
and left(`value`, 1) = '['
|
||||
and find_in_set(#{item}, replace(replace(`value`, ']', ''), '[', ''))
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="custom.type == 'date' or custom.type == 'datetime'">
|
||||
and left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13)
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</when>
|
||||
<otherwise>
|
||||
and trim(both '"' from value)
|
||||
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.condition">
|
||||
<property name="object" value="custom"/>
|
||||
</include>
|
||||
</otherwise>
|
||||
</choose>
|
||||
)
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
|
|
@ -117,10 +117,19 @@ export default {
|
|||
if (!condition.customs) {
|
||||
condition['customs'] = [];
|
||||
}
|
||||
let value = component.value;
|
||||
if (component.type === "multipleMember") {
|
||||
try {
|
||||
let str = JSON.stringify(component.value);
|
||||
value = str.substring(1, str.length - 1);
|
||||
} catch (e) {
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
condition['customs'].push({
|
||||
id: component.key,
|
||||
operator: component.operator.value,
|
||||
value: component.type === "multipleMember" ? JSON.stringify(component.value) : component.value,
|
||||
value: value,
|
||||
type: component.type
|
||||
});
|
||||
}
|
||||
|
|
|
@ -633,6 +633,7 @@ export default {
|
|||
this.testCaseTemplate = template;
|
||||
this.fields = getTableHeaderWithCustomFields('TRACK_TEST_CASE', this.testCaseTemplate.customFields, this.members);
|
||||
// todo 处理高级搜索自定义字段部分
|
||||
this.condition.components = this.condition.components.filter(item => item.custom !== true);
|
||||
let comp = getAdvSearchCustomField(this.condition, this.testCaseTemplate.customFields);
|
||||
this.condition.components.push(...comp);
|
||||
this.setTestCaseDefaultValue(template);
|
||||
|
@ -672,6 +673,9 @@ export default {
|
|||
return value ? value : '';
|
||||
},
|
||||
getCustomFieldFilter(field) {
|
||||
if (field.type === 'multipleMember') {
|
||||
return null;
|
||||
}
|
||||
return Array.isArray(field.options) ?
|
||||
(field.options.length > 0 ? field.options : null) : null;
|
||||
},
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
</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"
|
||||
:filters="getCustomFieldFilter(field)"
|
||||
:field="item"
|
||||
:fields-width="fieldsWidth"
|
||||
:label="field.system ? $t(systemNameMap[field.name]) :field.name"
|
||||
|
@ -272,6 +272,13 @@ export default {
|
|||
getCustomFieldValue(row, field) {
|
||||
return getCustomFieldValue(row, field, this.members);
|
||||
},
|
||||
getCustomFieldFilter(field) {
|
||||
if (field.type === 'multipleMember') {
|
||||
return null;
|
||||
}
|
||||
return Array.isArray(field.options) ?
|
||||
(field.options.length > 0 ? field.options : null) : null;
|
||||
},
|
||||
initFields(template) {
|
||||
this.issueTemplate = template;
|
||||
if (this.issueTemplate.platform === LOCAL) {
|
||||
|
@ -279,7 +286,7 @@ export default {
|
|||
} else {
|
||||
this.isThirdPart = true;
|
||||
}
|
||||
this.fields = getTableHeaderWithCustomFields('ISSUE_LIST', this.issueTemplate.customFields);
|
||||
this.fields = getTableHeaderWithCustomFields('ISSUE_LIST', this.issueTemplate.customFields, this.members);
|
||||
if (!this.isThirdPart) {
|
||||
for (let i = 0; i < this.fields.length; i++) {
|
||||
if (this.fields[i].id === 'platformStatus') {
|
||||
|
|
|
@ -525,7 +525,7 @@ export function getCustomFieldValue(row, field, members) {
|
|||
val += i + ' ';
|
||||
});
|
||||
return val;
|
||||
} else if (field.type === 'datetime') {
|
||||
} else if (field.type === 'datetime' || field.type === 'date') {
|
||||
return timestampFormatDate(item.value);
|
||||
} else if (['richText', 'textarea'].indexOf(field.type) > -1) {
|
||||
return item.textValue;
|
||||
|
|
Loading…
Reference in New Issue