This commit is contained in:
Flow 2025-05-26 15:23:39 +08:00
parent e43a0e6984
commit a9770b153d
4 changed files with 40 additions and 5 deletions

View File

@ -87,7 +87,7 @@
"source.fixAll.stylelint": "explicit"
},
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
"editor.defaultFormatter": "Vue.volar"
},
"i18n-ally.localesPaths": ["src/locales"],
"i18n-ally.keystyle": "nested",

View File

@ -47,6 +47,7 @@
"driver.js": "^1.3.1",
"echarts": "^5.5.0",
"echarts-wordcloud": "^2.1.0",
"element-china-area-data": "^6.1.0",
"element-plus": "2.9.1",
"fast-xml-parser": "^4.3.2",
"highlight.js": "^11.9.0",

View File

@ -2,6 +2,8 @@ import request from '@/config/axios'
export interface DeptVO {
id?: number
orgid?: number
orgaddress: string
name: string
parentId: number
status: number
@ -41,3 +43,8 @@ export const updateDept = async (params: DeptVO) => {
export const deleteDept = async (id: number) => {
return await request.delete({ url: '/system/dept/delete?id=' + id })
}
// 查询部门是否存在
export const getDeptByOrgId = async (orgid: number) => {
return await request.get({ url: '/system/dept/verifyOrgid?orgid=' + orgid })
}

View File

@ -28,7 +28,14 @@
<el-input v-model="formData.name" placeholder="请输入机构名称" />
</el-form-item>
<el-form-item label="机构地址" prop="orgaddress">
<el-input v-model="formData.orgaddress" placeholder="请输入机构地址" />
<el-cascader
v-model="selectedOptions"
:options="options"
size="large"
@change="handleAddressChange"
placeholder="请选择省/市/区"
clearable
/>
</el-form-item>
<el-form-item label="显示排序" prop="sort">
<el-input-number v-model="formData.sort" :min="0" controls-position="right" />
@ -73,6 +80,12 @@ import * as DeptApi from '@/api/system/dept'
import * as UserApi from '@/api/system/user'
import { CommonStatusEnum } from '@/utils/constants'
import { FormRules } from 'element-plus'
import {provinceAndCityData,
pcTextArr,
regionData,
pcaTextArr,
codeToText,
} from "element-china-area-data"
defineOptions({ name: 'SystemDeptForm' })
@ -110,6 +123,8 @@ const formRules = reactive<FormRules>({
const formRef = ref() // Ref
const deptTree = ref() //
const userList = ref<UserApi.UserVO[]>([]) //
const selectedOptions = ref([]) //
const options = ref<CascaderOption[]>(regionData as unknown as CascaderOption[])
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
@ -187,8 +202,20 @@ const getTree = async () => {
}
/** 检查机构ID */
const checkOrgId = () => {
// TODO: ID
console.log('检查机构ID:', formData.value.orgid)
const checkorgid = async () => {
const result = await DeptApi.getDeptByOrgId(Number(formData.value.orgid))
if (result) {
message.warning('机构ID已存在')
} else {
message.success('机构ID不存在')
}
}
/** 处理地址变化 */
const handleAddressChange = (value: any) => {
if (value && value.length === 3) {
const address = codeToText[value[0]] + '/' + codeToText[value[1]] + '/' + codeToText[value[2]]
formData.value.orgaddress = address
}
}
</script>