This commit is contained in:
zhouhuang 2024-10-15 14:11:34 +08:00
commit e21ef7fe3e
5 changed files with 70 additions and 24 deletions

View File

@ -53,15 +53,16 @@
"@types/node": "20.14.0",
"@types/nprogress": "0.2.3",
"@types/sortablejs": "1.15.8",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@typescript-eslint/eslint-plugin": "^8.9.0",
"@typescript-eslint/parser": "^8.9.0",
"@vitejs/plugin-vue": "5.0.5",
"async-validator": "4.2.5",
"crypto-js": "^4.2.0",
"eslint": "^8.57.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-vue": "9.26.0",
"glob": "^11.0.0",
"globals": "^15.6.0",
"prettier": "^3.3.2",
"sass": "1.77.4",

View File

@ -322,7 +322,7 @@ const addInstitutional = (rightClick = false) => {
const submitAddForm = () => {
console.log(formModel.value)
if (!formRef.value) return
formRef.value.validate((valid:boolean) => {
formRef.value.validate((valid: boolean) => {
if (valid) {
if (dialogTitle.value === '新增机构') {
formModel.value.parentOrgId = formModel.value.parentOrgId ?? '0'
@ -330,7 +330,7 @@ const submitAddForm = () => {
.then((res) => {
if (res.success) {
ElMessage.success('新增成功')
getInstitutionList()
getInstitutionList({parentOrgId:rightClickMenuData.value?.parentOrgId})
dialogVible.value = false
refreshTreeData(formModel.value.parentOrgId)
} else {
@ -345,7 +345,7 @@ const submitAddForm = () => {
.then((res) => {
if (res.success) {
ElMessage.success('编辑成功')
getInstitutionList()
getInstitutionList({parentOrgId:rightClickMenuData.value?.parentOrgId})
dialogVible.value = false
refreshTreeData(rightClickMenuData.value!.parentOrgId).then(() => {
refreshTreeData(formModel.value.parentOrgId)
@ -368,7 +368,14 @@ const closeAddForm = () => {
const getInstitutionList = (data: getDataType = { name: null }) => {
getInstitutionalListReq(data).then((res) => {
pageTotal.value = res.total
originData.value = res.rows
console.log(res.rows);
originData.value = res.rows.map(item=>{
return {
...item,
parentOrgName:item.parentOrgName ? item.parentOrgName : '无'
}
})
})
}
@ -450,7 +457,7 @@ const delForm = (column: getTreeDataReturnType) => {
.then((res) => {
if (res.success) {
ElMessage.success('删除成功')
getInstitutionList()
getInstitutionList({parentOrgId:rightClickMenuData.value?.parentOrgId})
refreshTreeData(column.parentOrgId)
} else {
ElMessage.error(res?.msg ?? '删除失败')
@ -470,6 +477,7 @@ const treeReplaceProps = {
const treeSelectReplaceProps = {
label: 'name',
children: 'children',
isLeaf: 'isLeaf',
}
const loadTreeData = (node: Node, resolve: any) => {
if (node.level === 0) {
@ -489,7 +497,6 @@ const loadTreeData = (node: Node, resolve: any) => {
})
}
const loadSelectTreeData = (node: Node, resolve: any) => {
console.log(node)
if (node.level === 0) {
return getTreeData(null)
@ -497,7 +504,8 @@ const loadSelectTreeData = (node: Node, resolve: any) => {
if (!res.length) {
node.data.isLeaf = true
}
resolve(res)
resolve([{ id: '0', name: '无', isLeaf: true }, ...res])
})
.catch((err) => {
console.log(err)
@ -552,8 +560,6 @@ const refreshTreeData = (parentOrgId: string | number | null) => {
return new Promise((resolve) => {
const data = parentOrgId === 0 || parentOrgId === '0' ? null : parentOrgId
getTreeData(data).then((res) => {
console.log('res,', res)
console.log(data)
if (data) {
treeRef.value?.updateKeyChildren(parentOrgId!, res)
} else {

View File

@ -5,7 +5,7 @@
<template v-for="item in formColumnList" :key="item.prop">
<el-form-item :label="item.label" :rules="item.rule" :label-width="80" :prop="item.prop">
<template v-if="item.type === 'input'">
<el-input v-model="formModel[item.prop]" :placeholder="'请输入' + item.label"></el-input>
<el-input v-model="formModel[item.prop] as string" :placeholder="'请输入' + item.label"></el-input>
</template>
<template v-if="item.type === 'custom'">
<template v-if="item.prop === 'authList'">
@ -241,13 +241,15 @@ const getRoleList = (roleName = '') => {
getRoleListReq({
roleName,
}).then((res) => {
console.log(res)
pageTotal.value = res.total
originData.value = res.rows.map((item) => {
return {
roleCode: item.roleCode,
roleName: item.roleName,
listName: item.list.map((item) => item.authorityName).join(','),
authList: item.list.map((item) => item.id),
authList: item.list.map((item) => parseInt(item.id)),
id: item.id,
revision: item.revision,
}

View File

@ -12,6 +12,8 @@ export type formDataType = {
roleCode: string
}
export type formDataEnumKeyJointType = keyof typeof formDataEnum
export type formColumnListType<T extends formDataEnumKeyJointType> = {
@ -49,7 +51,7 @@ export type tableDataType<T extends authorityDataListType> = {
roleCode: number
roleName: string
listName: T['authorityName']
authList: T['id'][]
authList: number[]
}
export type tableColumnType<T extends tableDataColumnTypeJointType> = {

View File

@ -132,10 +132,10 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属设备:">
<el-form-item label="所属风电场:">
<el-tree-select
:disabled="editDeviceData.objectType === '风电场'"
:placeholder="editAddDeviceData.objectType === '风电场' ? '该所属设备不可选择' : '请选择所属设备'"
:placeholder="editDeviceData.objectType === '风电场' ? '无' : '请选择所属风电场'"
v-model="editDeviceData.parentEquipmentId"
:data="belongingEquipment"
:props="defaultEquipmentProps"
@ -145,6 +145,16 @@
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属线路:">
<el-input placeholder="请输入所属线路" v-model="editDeviceData.belongingLine" style="width: 200px" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="标杆机组:">
<el-switch v-model="editDeviceData.isbenchMarkUnit" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
@ -277,10 +287,10 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属设备:">
<el-form-item label="所属风电场:">
<el-tree-select
:disabled="editAddDeviceData.objectType === '风电场'"
:placeholder="editAddDeviceData.objectType === '风电场' ? '该所属设备不可选择' : '请选择所属设备'"
:placeholder="editAddDeviceData.objectType === '风电场' ? '无' : '请选择所属风电场'"
v-model="editAddDeviceData.parentEquipmentId"
:data="belongingEquipment"
:props="defaultEquipmentProps"
@ -290,6 +300,16 @@
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属线路:">
<el-input placeholder="请输入所属线路" v-model="editAddDeviceData.belongingLine" style="width: 200px" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="标杆机组:">
<el-switch v-model="editAddDeviceData.isbenchMarkUnit" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
@ -416,7 +436,6 @@ const equipTypeList = () => {
formQuery.pageNum = currentPage.value
formQuery.objectType = res.data[0].equipmentTypeId
equipQuery(formQuery).then((res) => {
deviceList.value = res.rows
pageTotal.value = res.total
})
@ -424,7 +443,7 @@ const equipTypeList = () => {
equipModeList({
objectType: res.data[0].equipmentTypeId,
})
queryParameter.value.equipmentTypeId = res.data[0].equipmentTypeId
queryParameter.value.equipmentTypeId = res.data[0].equipmentTypeId
})
})
}
@ -451,9 +470,17 @@ const equipOrgList = () => {
const belongingEquipment = ref()
const equipOrgBelonging = () => {
equipTree().then((res) => {
belongingEquipment.value = res.data
belongingEquipment.value = filterEquipments(res.data)
})
}
const filterEquipments = (data: any) => {
return data
.filter((item: any) => item.objectType == 10001)
?.map((item: any) => ({
...item,
equipChildren: filterEquipments(item.equipChildren),
}))
}
const treeSelectLoad = (node: any, resolve: any) => {
if (node.level === 0) {
@ -474,8 +501,7 @@ const treeSelectLoad = (node: any, resolve: any) => {
}
return resolve(res.data)
})
.catch((err) => {
})
.catch((err) => {})
}
}
@ -600,6 +626,8 @@ const addDeviceList = () => {
editAddDeviceData.orgId = ''
editAddDeviceData.parentEquipmentId = ''
editAddDeviceData.iotModelId = ''
editAddDeviceData.belongingLine = ''
editAddDeviceData.isbenchMarkUnit = false
}
//
@ -620,6 +648,8 @@ const editDeviceData = reactive({
parentEquipmentId: '',
iotModelId: '',
id: '',
belongingLine: '',
isbenchMarkUnit: false,
})
const size = ref<'default' | 'large' | 'small'>('default')
@ -647,6 +677,8 @@ const viewDeviceDetails = (data: any) => {
editDeviceData.orgId = data.row.orgId
editDeviceData.parentEquipmentId = data.row.parentEquipmentId
editDeviceData.iotModelId = data.row.iotModelId
editDeviceData.belongingLine = data.row.belongingLine
editDeviceData.isbenchMarkUnit = data.row.isbenchMarkUnit
}
//
@ -766,6 +798,8 @@ const editAddDeviceData = reactive({
orgId: '',
parentEquipmentId: '',
iotModelId: '',
belongingLine: '',
isbenchMarkUnit: false,
})
//
@ -798,6 +832,7 @@ const saveAddData = () => {
editAddDeviceData.objectType = ele.equipmentTypeId
}
})
equipAdd(editAddDeviceData).then((res) => {
if (res.code == 200) {
ElMessage({