diff --git a/src/api/standardRegulationLibraryApi.js b/src/api/standardRegulationLibraryApi.js
index 661c05b0..53046298 100644
--- a/src/api/standardRegulationLibraryApi.js
+++ b/src/api/standardRegulationLibraryApi.js
@@ -93,6 +93,8 @@ const addProfileCenterTree = (params) => postAction('/laws/dataCenter/lawsDataCe
const addChildrenFolder = (params) => postAction('/laws/dataCenter/lawsDataCenterFolder/addChild', params)
// 资料中心-编辑树节点
const editProfileCenterTree = (params) => postAction('/laws/dataCenter/lawsDataCenterFolder/edit', params)
+// 资料中心-编辑树节点排序
+const editSortProfileCenterTree = (params) => postAction('/laws/dataCenter/lawsDataCenterFolder/editLevel', params)
// 资料中心-删除树节点
const deleteProfileCenterTree = (params) => postAction('/laws/dataCenter/lawsDataCenterFolder/delete', params)
// 资料中心-获取树节点树
@@ -157,6 +159,7 @@ export {
editProfileCenterTree,
deleteProfileCenterTree,
getProfileCenterTree,
+ editSortProfileCenterTree,
getStandardInfoByStandardNumber
}
diff --git a/src/views/standardRegulationLibrary/profileCenter/ProfileCenterList.vue b/src/views/standardRegulationLibrary/profileCenter/ProfileCenterList.vue
index bafebc63..450d0c7b 100644
--- a/src/views/standardRegulationLibrary/profileCenter/ProfileCenterList.vue
+++ b/src/views/standardRegulationLibrary/profileCenter/ProfileCenterList.vue
@@ -7,7 +7,12 @@
@search="handleTreeSearch" />
-
+
import JTable from '../../../components/jero/JTable.vue'
import { JeroListMixin } from '../../../mixins/JeroListMixin.js'
-import { deleteProfileCenterTree, getProfileCenterTree } from '../../../api/standardRegulationLibraryApi.js'
+import {
+ deleteProfileCenterTree,
+ editSortProfileCenterTree,
+ getProfileCenterTree
+} from '../../../api/standardRegulationLibraryApi.js'
import ProfileCenterModal from './modules/ProfileCenterModal.vue'
import ProfileCenterTreeModal from './modules/ProfileCenterTreeModal.vue'
import { filterObj } from '../../../utils/util'
@@ -236,6 +245,55 @@ export default {
this.initTreeData()
},
methods: {
+ onDropCataSort (info) {
+ console.log('------info', info)
+ const dropPos = info.node.pos.split('-')
+ // 拖动的位置,info.dropPosition拖到了目标节点的上面则当前元素 -1,下面则是 1
+ const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1])
+
+ const node = info.node // 目标节点
+ const dragNode = info.dragNode // 拖动节点
+ const dragNodeData = dragNode.dataRef
+ const nodeData = node.dataRef
+ console.log('---------dragNodeData', dragNodeData)
+ console.log('---------nodeData', nodeData)
+
+ const paramObj = {}
+ // 判断只能在同级排序
+ if (!info.dropToGap) {
+ // 不在缝隙中,在内容区
+ this.$message.warning('请拖动到缝隙中')
+ return false
+ } else if (
+ (info.node.children || []).length > 0 && // Has children
+ info.node.expanded && // Is expanded
+ dropPosition === 1 // On the bottom gap
+ ) {
+ this.$message.warning('请重新拖拽')
+ } else if (dropPos.length === 2 && info.dropToGap) {
+ this.$message.warning('不能移动到最顶级')
+ return false
+ } else {
+ if (dragNodeData.parentId !== nodeData.parentId) {
+ this.$message.warning('只能同级排序')
+ return false
+ }
+ paramObj.id = dragNodeData.id // 拖拽节点的id
+ // paramObj.parentId = nodeData.parentId // 目标节点的父级id
+ paramObj.sort = dropPos[dropPos.length - 1] < info.dropPosition ? info.dropPosition : dropPos[dropPos.length - 1] // 要设置的排序值
+ }
+ // console.log("拖拽后对象是:", paramObj)
+ console.log('此处调用后端接口保存数据' + paramObj.id + paramObj.sort)
+ editSortProfileCenterTree(paramObj).then(res => {
+ if (res.success) {
+ this.$message.success(res.message)
+ // 重新获取树节点不改变展开节点
+ this.initTreeData()
+ } else {
+ this.$message.warning(res.message)
+ }
+ })
+ },
/**
* 获取树数据
*/