|
|
|
|
@ -97,8 +97,8 @@ v-for="dict in getStrDictOptions('mes_goview_type')" :key="dict.value" :label="d
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('ReportDashboard.DashboardList.dialogOrgLabel')" prop="orgId">
|
|
|
|
|
<el-tree-select
|
|
|
|
|
v-model="createForm.orgName" :data="organizationTree" :props="lineTreeProps" filterable clearable
|
|
|
|
|
class="!w-240px" :placeholder="t('ReportDashboard.DashboardList.dialogOrgPlaceholder')" @change="handleOrgChange" />
|
|
|
|
|
v-model="createForm.orgId" :data="organizationTree" :props="lineTreeProps" filterable clearable
|
|
|
|
|
check-strictly class="!w-240px" :placeholder="t('ReportDashboard.DashboardList.dialogOrgPlaceholder')" @change="handleOrgChange" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('ReportDashboard.DashboardList.dialogDeviceLabel')" v-if="createForm.type === '1'">
|
|
|
|
|
<div class="dashboard-device-group-list">
|
|
|
|
|
@ -226,7 +226,8 @@ const organizationTree = ref<any[]>([])
|
|
|
|
|
const lineTreeProps = {
|
|
|
|
|
label: 'name',
|
|
|
|
|
children: 'children',
|
|
|
|
|
value: 'name'
|
|
|
|
|
disabled: 'disabled',
|
|
|
|
|
value: 'id'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const deviceList = ref<any[]>([])
|
|
|
|
|
@ -455,7 +456,17 @@ const handleDelete = async (item: DashboardItem) => {
|
|
|
|
|
|
|
|
|
|
const loadOrganizationTree = async () => {
|
|
|
|
|
const data = await OrganizationApi.getOrganizationList()
|
|
|
|
|
organizationTree.value = handleTree(data, 'id', 'parentId')
|
|
|
|
|
const tree = handleTree(data, 'id', 'parentId')
|
|
|
|
|
const markPipelineSelectable = (nodes: any[], parentInPipeline = false) => {
|
|
|
|
|
nodes.forEach((node) => {
|
|
|
|
|
const inPipeline = parentInPipeline || node?.orgClass === 'pipeline'
|
|
|
|
|
node.disabled = !inPipeline
|
|
|
|
|
const children = Array.isArray(node.children) ? node.children : []
|
|
|
|
|
if (children.length) markPipelineSelectable(children, inPipeline)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
markPipelineSelectable(tree, false)
|
|
|
|
|
organizationTree.value = tree
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const findOrgNode = (nodes: any[], id: any): any | undefined => {
|
|
|
|
|
@ -480,15 +491,15 @@ const findOrgNodeByName = (nodes: any[], name: any): any | undefined => {
|
|
|
|
|
return undefined
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleOrgChange = () => {
|
|
|
|
|
if (!createForm.orgName) {
|
|
|
|
|
const handleOrgChange = (value?: number | string) => {
|
|
|
|
|
if (!value) {
|
|
|
|
|
createForm.orgId = undefined
|
|
|
|
|
createForm.orgName = ''
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const org = findOrgNodeByName(organizationTree.value || [], createForm.orgName)
|
|
|
|
|
createForm.orgId = org?.id ?? undefined
|
|
|
|
|
createForm.orgName = org?.name || createForm.orgName
|
|
|
|
|
const org = findOrgNode(organizationTree.value || [], value)
|
|
|
|
|
createForm.orgId = org?.id ?? value
|
|
|
|
|
createForm.orgName = org?.name || ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const loadDeviceList = async () => {
|
|
|
|
|
|