吉安感知网项目-前端
shuishen
2026-01-27 55fce4e7b7e85e3553d3e82dd80f883cda84a08d
feat:部门管理编辑回显异常处理
1 files modified
31 ■■■■■ changed files
applications/drone-command/src/views/permissionManage/permissionDept/FormDiaLog.vue 31 ●●●●● patch | view | raw | blame | history
applications/drone-command/src/views/permissionManage/permissionDept/FormDiaLog.vue
@@ -71,14 +71,14 @@
                <el-col :span="12">
                    <el-form-item label="部门类型" prop="deptCategory">
                        <el-select class="command-select" popper-class="command-select-popper" v-model="formData.deptCategory" placeholder="请选择" clearable>
                            <el-option v-for="item in dictObj.org_category" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
                            <el-option v-for="item in dictObj.org_category" :key="item.dictKey" :label="item.dictValue" :value="Number(item.dictKey)" />
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="部门性质" prop="deptNature">
                        <el-select class="command-select" popper-class="command-select-popper" v-model="formData.deptNature" placeholder="请选择" clearable>
                            <el-option v-for="item in dictObj.org_nature" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
                            <el-option v-for="item in dictObj.org_nature" :key="item.dictKey" :label="item.dictValue" :value="Number(item.dictKey)" />
                        </el-select>
                    </el-form-item>
                </el-col>
@@ -137,9 +137,9 @@
    fullName: '',
    parentId: '',
    parentName: '',
    deptCategory: '',
    deptNature: '',
    areaCode: '',
    deptCategory: null,
    deptNature: null,
    areaCode: [],
    areaName: '',
    deploymentMode: 0,
    sort: 0,
@@ -154,7 +154,7 @@
const areaProps = {
    label: 'title',
    value: 'value',
    emitPath: false,
    emitPath: true,
    checkStrictly: true,
    lazy: true,
    lazyLoad(node, resolve) {
@@ -230,19 +230,26 @@
}
function getFullAreaCode(areaCode) {
    if (!areaCode) return ''
    if (!areaCode) return []
    if (Array.isArray(areaCode)) return areaCode
    const code = areaCode.toString()
    if (code.includes(',')) return code
    if (code.includes(',')) return code.split(',')
    if (code.endsWith('0000000000')) {
        return code
        return [code]
    } else if (code.endsWith('00000000') && !code.endsWith('0000000000')) {
        const provinceCode = code.substring(0, 2) + '0000000000'
        return `${provinceCode},${code}`
        return [provinceCode, code]
    } else {
        const provinceCode = code.substring(0, 2) + '0000000000'
        const cityCode = code.substring(0, 4) + '00000000'
        return `${provinceCode},${cityCode},${code}`
        return [provinceCode, cityCode, code]
    }
}
function normalizeNumber(value) {
    if (value === '' || value === null || value === undefined) return null
    const num = Number(value)
    return Number.isNaN(num) ? null : num
}
function handleCancel() {
@@ -283,6 +290,8 @@
    const data = res?.data?.data ?? {}
    formData.value = {
        ...data,
        deptCategory: normalizeNumber(data.deptCategory),
        deptNature: normalizeNumber(data.deptNature),
        areaCode: getFullAreaCode(data.areaCode),
    }
}