| | |
| | | <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> |
| | |
| | | fullName: '', |
| | | parentId: '', |
| | | parentName: '', |
| | | deptCategory: '', |
| | | deptNature: '', |
| | | areaCode: '', |
| | | deptCategory: null, |
| | | deptNature: null, |
| | | areaCode: [], |
| | | areaName: '', |
| | | deploymentMode: 0, |
| | | sort: 0, |
| | |
| | | const areaProps = { |
| | | label: 'title', |
| | | value: 'value', |
| | | emitPath: false, |
| | | emitPath: true, |
| | | checkStrictly: true, |
| | | lazy: true, |
| | | lazyLoad(node, resolve) { |
| | |
| | | } |
| | | |
| | | 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() { |
| | |
| | | const data = res?.data?.data ?? {} |
| | | formData.value = { |
| | | ...data, |
| | | deptCategory: normalizeNumber(data.deptCategory), |
| | | deptNature: normalizeNumber(data.deptNature), |
| | | areaCode: getFullAreaCode(data.areaCode), |
| | | } |
| | | } |