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

View File

@@ -23,8 +23,8 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// TODO @AI多余的变量需要删除 import { computed } from 'vue'
import { computed, ref, watch } from 'vue' import { isUrl } from '@/utils/is'
defineOptions({ name: 'IframeComponent' }) defineOptions({ name: 'IframeComponent' })
@@ -51,27 +51,11 @@ const props = withDefaults(defineProps<Props>(), {
sandbox: '' sandbox: ''
}) })
// TODO @puhui999这里貌似暂时没用到
const emit = defineEmits<{
(e: 'update:modelValue', value: string): void
}>()
const displayUrl = computed(() => props.url || props.modelValue || '') // 显示的 URL优先使用 url prop其次使用 modelValue const displayUrl = computed(() => props.url || props.modelValue || '') // 显示的 URL优先使用 url prop其次使用 modelValue
const showPreview = computed(() => { 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> </script>
<style scoped> <style scoped>

View File

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

View File

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

View File

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