Skip to content

Commit

Permalink
feat: 调整自动化代码富文本模式下的可选查询条件
Browse files Browse the repository at this point in the history
  • Loading branch information
piexlMax(奇淼 committed Feb 13, 2025
1 parent f608bfa commit a8e706a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
22 changes: 12 additions & 10 deletions web/src/view/systemTools/autoCode/component/fieldDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -386,20 +386,22 @@
}
const canSelect = (item) => {
const fieldType = middleDate.value.fieldType
const fieldType = middleDate.value.fieldType;
if (fieldType === 'richtext') {
return item !== 'LIKE';
}
if (fieldType !== 'string' && item === 'LIKE') {
return true
return true;
}
if (
fieldType !== 'int' &&
fieldType !== 'time.Time' &&
fieldType !== 'float64' &&
(item === 'BETWEEN' || item === 'NOT BETWEEN')
) {
return true
const nonNumericTypes = ['int', 'time.Time', 'float64'];
if (!nonNumericTypes.includes(fieldType) && ['BETWEEN', 'NOT BETWEEN'].includes(item)) {
return true;
}
return false
return false;
}
const clearOther = () => {
Expand Down
26 changes: 18 additions & 8 deletions web/src/view/systemTools/autoCode/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -703,14 +703,7 @@
:key="item.value"
:label="item.label"
:value="item.value"
:disabled="
(row.fieldType !== 'string' && item.value === 'LIKE') ||
(row.fieldType !== 'int' &&
row.fieldType !== 'time.Time' &&
row.fieldType !== 'float64' &&
(item.value === 'BETWEEN' ||
item.value === 'NOT BETWEEN'))
"
:disabled="canSelect(row.fieldType,item.value)"
/>
</el-select>
</template>
Expand Down Expand Up @@ -1652,6 +1645,23 @@
}
}
)
const canSelect = (fieldType,item) => {
if (fieldType === 'richtext') {
return item !== 'LIKE';
}
if (fieldType !== 'string' && item === 'LIKE') {
return true;
}
const nonNumericTypes = ['int', 'time.Time', 'float64'];
if (!nonNumericTypes.includes(fieldType) && ['BETWEEN', 'NOT BETWEEN'].includes(item)) {
return true;
}
return false;
}
</script>
<style>
Expand Down

0 comments on commit a8e706a

Please sign in to comment.