!862 fix: 完成 review c153ff93 的所有 TODO 修复

Merge pull request !862 from puhui999/master-dev
This commit is contained in:
芋道源码
2026-03-07 03:56:34 +00:00
committed by Gitee
5 changed files with 23 additions and 27 deletions

View File

@@ -18,8 +18,7 @@
<script lang="ts" setup>
import { onMounted, ref, watch } from 'vue'
import { getAreaTree } from '@/api/system/area'
// TODO @puhui999这里 handleTree 貌似没用到
import { handleTree } from '@/utils/tree'
import { AreaLevelEnum } from '@/utils/constants'
defineOptions({ name: 'AreaSelect' })
@@ -35,7 +34,7 @@ interface AreaVO {
interface Props {
modelValue?: number[] | string[]
level?: 1 | 2 | 3 // 1-省 2-市 3-区 TODO @puhui999这里是不是放到枚举类里
level?: typeof AreaLevelEnum[keyof typeof AreaLevelEnum]
disabled?: boolean
placeholder?: string
clearable?: boolean
@@ -46,7 +45,7 @@ interface Props {
const props = withDefaults(defineProps<Props>(), {
modelValue: undefined,
level: 3, // TODO @puhui999枚举类
level: AreaLevelEnum.DISTRICT,
disabled: false,
placeholder: '请选择省市区',
clearable: true,

View File

@@ -23,8 +23,8 @@
</template>
<script lang="ts" setup>
// TODO @AI多余的变量需要删除
import { computed, ref, watch } from 'vue'
import { computed } from 'vue'
import { isUrl } from '@/utils/is'
defineOptions({ name: 'IframeComponent' })
@@ -51,27 +51,11 @@ const props = withDefaults(defineProps<Props>(), {
sandbox: ''
})
// TODO @puhui999这里貌似暂时没用到
const emit = defineEmits<{
(e: 'update:modelValue', value: string): void
}>()
const displayUrl = computed(() => props.url || props.modelValue || '') // 显示的 URL优先使用 url prop其次使用 modelValue
const showPreview = computed(() => {
return displayUrl.value && isValidUrl(displayUrl.value)
return displayUrl.value && isUrl(displayUrl.value)
}) // 是否显示预览
// TODO @puhui999看看全局是不是有可复用的方法
/** URL 验证 */
function isValidUrl(url: string): boolean {
if (!url || url.trim() === '') return false
try {
const urlObj = new URL(url)
return urlObj.protocol === 'http:' || urlObj.protocol === 'https:'
} catch {
return false
}
}
</script>
<style scoped>

View File

@@ -1,5 +1,6 @@
import { generateUUID } from '@/utils'
import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils'
import { AreaLevelEnum } from '@/utils/constants'
/**
* 省市区选择器规则
@@ -7,6 +8,7 @@ import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils
export const useAreaSelectRule = () => {
const label = '省市区选择器'
const name = 'AreaSelect'
return {
icon: 'icon-location',
label,
@@ -27,11 +29,11 @@ export const useAreaSelectRule = () => {
type: 'select',
field: 'level',
title: '选择层级',
value: 3,
value: AreaLevelEnum.DISTRICT,
options: [
{ label: '省', value: 1 },
{ label: '省/市', value: 2 },
{ label: '省/市/区', value: 3 }
{ label: '省', value: AreaLevelEnum.PROVINCE },
{ label: '省/市', value: AreaLevelEnum.CITY },
{ label: '省/市/区', value: AreaLevelEnum.DISTRICT }
],
info: '限制可选择的地区层级'
},

View File

@@ -7,6 +7,7 @@ import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils
export const useIframeRule = () => {
const label = '网页 iframe'
const name = 'IframeComponent'
return {
icon: 'icon-link',
label,

View File

@@ -463,3 +463,13 @@ export const BpmAutoApproveType = {
APPROVE_ALL: 1, // 仅审批一次,后续重复的审批节点均自动通过
APPROVE_SEQUENT: 2 // 仅针对连续审批的节点自动通过
}
// ========== SYSTEM - 地区模块 ==========
/**
* 地区选择器层级枚举
*/
export const AreaLevelEnum = {
PROVINCE: 1, // 省
CITY: 2, // 市
DISTRICT: 3 // 区
}