- clickDropMenu('newMenu', treeNode)"
- @treeEdit="(treeId, treeNode) => clickDropMenu('editMenu', treeNode)"
- @treeClick="(treeId, treeNode) => treeClick(treeNode)"
- @treeRightClick="(treeId, treeNode) => treeRightClick(treeNode)"
- @treeRemove="(treeId, treeNode) => clickDropMenu('deleteMenu', treeNode)"
- @drag="drag"
- >
+
+
@@ -934,6 +924,11 @@ export default {
},
data () {
return {
+ treeList: [],
+ props: {
+ label: 'menuName',
+ children: 'children'
+ },
menuTreeLoading: true,
orderBy:'',
nowOrder:'',
@@ -1644,101 +1639,11 @@ export default {
})
})
},
- // 二级菜单新建,编辑,删除
- clickDropMenu (name, treeNode) {
- this.selectSarMenu = JSON.parse(JSON.stringify(treeNode))
- if (undefined !== this.selectSarMenu.id) { // 当前有选中节点
- if (name === 'newMenu') {
- this.menuModalTitle = '新增目录'
- this.menuModalFlag = true
- this.menuAddOrUpdateFlag = 1
- this.sarMenu = {
- id: '',
- parentId: '',
- menuName: '',
- sorDivide: 'FOREIGN_STAND',
- displaySeq: '',
- parentIds: '',
- remarks: ''
- }
- } else if (name === 'editMenu') {
- this.menuModalTitle = '编辑目录'
- this.menuModalFlag = true
- this.menuAddOrUpdateFlag = 2
- this.sarMenu.id = treeNode.id
- this.sarMenu.parentId = treeNode.pId
- this.sarMenu.menuName = treeNode.oldname || treeNode.name
- this.sarMenu.displaySeq = treeNode.displaySeq
- if (treeNode.remarks == null || treeNode.remarks === '' || treeNode.remarks === 'null') {
- this.sarMenu.remarks = ''
- } else {
- this.sarMenu.remarks = treeNode.remarks
- }
- } else {
- if (this.selectSarMenu.parentId == null) { // 如果父id为null 说明是根目录
- this.$message({
- title: '提示',
- content: '根目录不可删除!'
- })
- } else {
- // deleteMenu 删除二级菜单,先判断是否选中,选中项目,然后调用删除方法
- // 先判断目录下是否有菜单
- this.$http.post('lawss/sarMenu/judgequeryMenuByPid', this.selectSarMenu, {
- _this: this, loading: 'loading'
- }, res => {
- if (res.data) {
- // this.deleteMenuModal = true
- this.$confirm('该节点下有记录,确定删除?', '提示', {
- confirmButtonText: '确定',
- confirmButtonClass: 'common-button-primary',
- cancelButtonText: '取消',
- type: 'warning',
- roundButton: false
- }).then(() => {
- this.$http.post('lawss/sarMenu/deleteMenuAndChildren', this.selectSarMenu, {
- _this: this, loading: 'loading'
- }, res => {
- this.selectMenu() // 删除成功后,更新二级菜单
- // 获取下一个节点
- let currentNode = this.$refs.domesticTree.getNextNode()
- let nodeId = ''
- // 如果这个节点为null, 本次删除了最后一个节点
- if (currentNode === null) {
- // 选中根节点
- this.$refs.domesticTree.selectRootNode()
- } else {
- nodeId = currentNode.id
- }
- this.getDomesticStandardTable()
- }, e => {
- })
- }).catch(() => {
- // 取消删除,清空选择
- // this.$refs.selections.clearSelection()
- })
- } else {
- this.sureDeleteSarMenu()
- }
- }, e => {
- })
- }
- }
- } else {
- this.$Modal.info({
- title: '提示',
- content: '请选择节点!'
- })
- }
- },
treeClick (treeNode) {
- this.selectSarMenu = treeNode // 记录当前选中的二级菜单
+ this.selectSarMenu = treeNode
this.standCommonlySearch.menuId = treeNode.id
this.standCommonlySearch.page = 1
- this.getDomesticStandardTable() // 根据选中的二级菜单查询对应的标准列表
- },
- treeRightClick (treeNode) {
- this.selectSarMenu = treeNode // 记录当前选中的二级菜单
- this.standCommonlySearch.menuId = treeNode.id
+ this.getDomesticStandardTable()
},
// 点击搜索按钮
searchBtnClick () {
@@ -1828,40 +1733,12 @@ export default {
},
// 查询二级菜单
selectMenu () {
- return new Promise((resolve, reject) => {
- this.$http.get('lawss/sarMenu/selectMenuByRole', {sorDivide: 'FOREIGN_STAND'}, {
- _this: this
- }, res => {
- let treeNode = []
- this.parentNode = {}
- res.data.forEach((item, index) => {
- let treeItem = {}
- for (let key in item) {
- if (key === 'parentId') {
- treeItem.pId = item[key]
- treeItem.parentId = item[key]
- } else if (key === 'menuName') {
- treeItem.name = item[key]
- } else {
- treeItem[key] = item[key]
- }
- if (this.initZNode === '' && item.id === '64df1d5522bb49c09af2') { this.initZNode = treeItem }
- }
- treeNode[index] = treeItem
- // 记录最外层父节点
- if (treeItem.parentId === '' || treeItem.parentId == null) {
- this.parentNode = treeItem
- }
- })
- this.zNodes = treeNode
- // 查完左侧目录后,如果没有选中的,设置最外层选中
- if (JSON.stringify(this.selectSarMenu) === '{}' || !this.selectSarMenu) {
- this.selectSarMenu = JSON.parse(JSON.stringify(this.parentNode))
- }
- resolve(res)
- }, e => {
- reject(e)
- })
+ this.$http.get('sarResource/ts-resource', {
+ sorDivide: 'FOREIGN_STAND'
+ }, {}, res => {
+ if (res.ok) {
+ this.treeList = res.data
+ }
})
},
// 树-删除
@@ -2416,7 +2293,11 @@ export default {
data.sarStandardsSearch = ''
}
const formData = {...data}
- formData.menuId = this.selectSarMenu.id
+ if (!item) {
+ formData.menuId = this.selectSarMenu.id
+ } else {
+ formData.menuId = this.standCommonlySearch.menuId
+ }
formData.nowOrderBy = this.nowOrder ? this.orderBy : ''
formData.nowOrder = this.nowOrder
// 处理我的收藏和个性化标签传参
@@ -2437,7 +2318,6 @@ export default {
this.$http.get('sarStandardsInfo/sar-standards-info/getSarStandardsInfoPage', formData, {
_this: this, loading: 'loading'
}, res => {
- console.log('2441',formData);
this.isAdvancedSearch = false
if (res.ok) {
for (let i = 0; i < res.data.list.length; i++) {