|
@@ -44,7 +44,7 @@
|
|
|
<script setup>
|
|
|
import { onMounted, ref, watch } from 'vue'
|
|
|
import { formValidate, getArrValue, getObjValue, isNullES } from 'js-fast-way'
|
|
|
-import { addOrUpdateTree, getDictInfo, getLazyTree } from '~api/other'
|
|
|
+import { addOrUpdateTree, deleteTree, getDictInfo, getLazyTree } from '~api/other'
|
|
|
import { useAppStore } from '~src/store'
|
|
|
import { getStoreValue, setStoreValue } from '~src/utils/storage'
|
|
|
import { delMessageV2 } from '~com/message/index.js'
|
|
@@ -206,10 +206,17 @@ const handleMenuSelect = async ({ key }) => {
|
|
|
formModel.value = node?.data
|
|
|
rowModal.value = true
|
|
|
} else if (key === 'del') {
|
|
|
-
|
|
|
+ delModalClick(node?.data.id)
|
|
|
}
|
|
|
console.log(key)
|
|
|
}
|
|
|
+//重新加载树
|
|
|
+const rerfeshTree = ()=>{
|
|
|
+ isShowTree.value = false
|
|
|
+ setTimeout(() => {
|
|
|
+ isShowTree.value = true
|
|
|
+ }, 100)
|
|
|
+}
|
|
|
const submitLoading = ref(false)
|
|
|
//保存
|
|
|
const rowModalSave = async () => {
|
|
@@ -225,22 +232,18 @@ const rowModalSave = async () => {
|
|
|
if (!error && code === 200) {
|
|
|
window.$message?.success(msg)
|
|
|
rowModal.value = false
|
|
|
- isShowTree.value = false
|
|
|
- setTimeout(() => {
|
|
|
- isShowTree.value = true
|
|
|
- }, 100)
|
|
|
+ rerfeshTree()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
//删除节点
|
|
|
-const delModalClick = () => {
|
|
|
-
|
|
|
-delMessageV2(async (action, instance, done) => {
|
|
|
+const delModalClick = (id) => {
|
|
|
+ delMessageV2(async (action, instance, done) => {
|
|
|
if (action === 'confirm') {
|
|
|
instance.confirmButtonLoading = true
|
|
|
- // removeContractTreeNode()
|
|
|
+ removeTreeNode(id)
|
|
|
instance.confirmButtonLoading = false
|
|
|
done()
|
|
|
} else {
|
|
@@ -248,6 +251,18 @@ delMessageV2(async (action, instance, done) => {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+const removeTreeNode = async (id)=>{
|
|
|
+ const { error, code } = await deleteTree({
|
|
|
+ id: id,
|
|
|
+ }, false)
|
|
|
+ //判断状态
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success('删除成功')
|
|
|
+ rerfeshTree()
|
|
|
+ } else {
|
|
|
+ window.$message?.error('删除失败')
|
|
|
+ }
|
|
|
+}
|
|
|
//关闭弹窗
|
|
|
const rowModalClose = () => {
|
|
|
rowModal.value = false
|