|
|
@ -40,7 +40,6 @@ |
|
|
|
<el-form-item v-if="crud.status.add === 1" label="所属门类" prop="categoryId"> |
|
|
|
<treeselect |
|
|
|
v-model="form.categoryId" |
|
|
|
:load-options="loadCategorys" |
|
|
|
:options="categoryDatas" |
|
|
|
placeholder="选择所属门类" |
|
|
|
flat |
|
|
@ -79,8 +78,9 @@ |
|
|
|
> |
|
|
|
<treeselect |
|
|
|
v-model="form.pid" |
|
|
|
:load-options="loadCategory" |
|
|
|
:options="depts" |
|
|
|
:load-options="loadClassifyTree" |
|
|
|
:options="classifyOptions" |
|
|
|
:normalizer="classifyNormalizer" |
|
|
|
placeholder="选择上级类目" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
@ -178,6 +178,7 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
classifyOptions: [], |
|
|
|
categoryDatas: [], |
|
|
|
selections: [], |
|
|
|
isAllSelect: false, |
|
|
@ -242,6 +243,7 @@ export default { |
|
|
|
// 新增与编辑前做的操作 |
|
|
|
[CRUD.HOOK.afterToCU](crud, form) { |
|
|
|
this.getCategoryDataTree() |
|
|
|
this.getClassifyTree() |
|
|
|
if (form.id != null) { |
|
|
|
if (form.pid === null) { |
|
|
|
form.isTop = '1' |
|
|
@ -263,13 +265,33 @@ export default { |
|
|
|
this.categoryDatas = this.filterData(res) |
|
|
|
}) |
|
|
|
}, |
|
|
|
getClassifyTree() { |
|
|
|
crudClassify.FetchArchivesClassTree().then(res => { |
|
|
|
this.classifyOptions = res.map(function(obj) { |
|
|
|
if (obj.childArchivesClass !== null) { |
|
|
|
obj.hasChildren = true |
|
|
|
} else { |
|
|
|
obj.hasChildren = false |
|
|
|
} |
|
|
|
if (obj.hasChildren) { |
|
|
|
obj.children = null |
|
|
|
} |
|
|
|
return obj |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取弹窗内门类数据 |
|
|
|
loadCategorys({ action, parentNode, callback }) { |
|
|
|
loadClassifyTree({ action, parentNode, callback }) { |
|
|
|
if (action === LOAD_CHILDREN_OPTIONS) { |
|
|
|
FetchCategoryMenu().then(res => { |
|
|
|
crudClassify.FetchArchivesClassTree().then(res => { |
|
|
|
parentNode.children = res.map(function(obj) { |
|
|
|
if (obj.children) { |
|
|
|
obj.childMenus = null |
|
|
|
if (obj.childArchivesClass !== 0) { |
|
|
|
obj.hasChildren = true |
|
|
|
} else { |
|
|
|
obj.hasChildren = false |
|
|
|
} |
|
|
|
if (obj.hasChildren) { |
|
|
|
obj.children = null |
|
|
|
} |
|
|
|
return obj |
|
|
|
}) |
|
|
@ -361,6 +383,16 @@ export default { |
|
|
|
children: node.children, |
|
|
|
isDisabled: node.isType !== 2 |
|
|
|
} |
|
|
|
}, |
|
|
|
classifyNormalizer(node) { |
|
|
|
if (node.childArchivesClass && !node.childArchivesClass.length) { |
|
|
|
delete node.childArchivesClass |
|
|
|
} |
|
|
|
return { |
|
|
|
id: node.id, |
|
|
|
label: node.name, |
|
|
|
children: node.childArchivesClass |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|