|
@@ -1,9 +1,9 @@
|
|
|
<template>
|
|
|
<hc-new-dialog v-model="moveModal" is-table title="跨节点移动" widths="72rem" @close="closeModal">
|
|
|
- <hc-page-split class="m-4">
|
|
|
+ <hc-page-split class="m-4" :options="{ sizes: [50, 50] }">
|
|
|
<template #left>
|
|
|
<hc-card scrollbar>
|
|
|
- <div class="checkbox-container">
|
|
|
+ <div v-loading="cityLoading" class="checkbox-container">
|
|
|
<el-checkbox
|
|
|
v-model="checkAll"
|
|
|
:indeterminate="isIndeterminate"
|
|
@@ -18,12 +18,12 @@
|
|
|
>
|
|
|
<el-checkbox
|
|
|
v-for="city in cities"
|
|
|
- :key="city"
|
|
|
- :label="city"
|
|
|
- :value="city"
|
|
|
+ :key="city.pkeyId"
|
|
|
+ :label="city.fullName "
|
|
|
+ :value="city.pkeyId "
|
|
|
class="checkbox-item"
|
|
|
>
|
|
|
- {{ city }}
|
|
|
+ {{ city.fullName }}
|
|
|
</el-checkbox>
|
|
|
</el-checkbox-group>
|
|
|
</div>
|
|
@@ -93,6 +93,10 @@
|
|
|
</el-scrollbar>
|
|
|
</hc-card>
|
|
|
</hc-page-split>
|
|
|
+ <template #footer>
|
|
|
+ <el-button :loading="moveLoading" @click="submitMove(1)">保存并退出</el-button>
|
|
|
+ <el-button type="primary" :loading="moveLoading" @click="submitMove(2)">保存并继续</el-button>
|
|
|
+ </template>
|
|
|
</hc-new-dialog>
|
|
|
</template>
|
|
|
|
|
@@ -114,22 +118,30 @@ const props = defineProps({
|
|
|
type: String,
|
|
|
default: '',
|
|
|
},
|
|
|
+ primaryKeyId: {
|
|
|
+ type: String,
|
|
|
+ default: '',
|
|
|
+ },
|
|
|
})
|
|
|
//事件
|
|
|
const emit = defineEmits(['close', 'save'])
|
|
|
const contractId = ref(props.contractId)
|
|
|
const classType = ref(props.classType)
|
|
|
const authBtnTabKey = ref(props.authBtnTabKey)
|
|
|
+const primaryKeyId = ref(props.primaryKeyId)
|
|
|
//监听
|
|
|
watch(() => [
|
|
|
|
|
|
props.contractId,
|
|
|
props.classType,
|
|
|
props.authBtnTabKey,
|
|
|
-], ([cid, clas, tab]) => {
|
|
|
+ props.primaryKeyId,
|
|
|
+], ([cid, clas, tab, pkid]) => {
|
|
|
contractId.value = cid
|
|
|
classType.value = clas
|
|
|
authBtnTabKey.value = tab
|
|
|
+ primaryKeyId.value = pkid
|
|
|
+ getSameLevelsTreeData()
|
|
|
})
|
|
|
const moveModal = defineModel('modelValue', {
|
|
|
default: false,
|
|
@@ -143,16 +155,16 @@ const closeModal = ()=>{
|
|
|
const checkAll = ref(false)
|
|
|
const isIndeterminate = ref(true)
|
|
|
const checkedCities = ref([])
|
|
|
-const cities = ['Shanghai', 'Beijing']
|
|
|
+const cities = ref([])
|
|
|
|
|
|
const handleCheckAllChange = (val) => {
|
|
|
- checkedCities.value = val ? cities : []
|
|
|
+ checkedCities.value = val ? cities.value.map(city => city.pkeyId) : []
|
|
|
isIndeterminate.value = false
|
|
|
}
|
|
|
const handleCheckedCitiesChange = (value) => {
|
|
|
const checkedCount = value.length
|
|
|
- checkAll.value = checkedCount === cities.length
|
|
|
- isIndeterminate.value = checkedCount > 0 && checkedCount < cities.length
|
|
|
+ checkAll.value = checkedCount === cities.value.length
|
|
|
+ isIndeterminate.value = checkedCount > 0 && checkedCount < cities.value.length
|
|
|
}
|
|
|
const searchInput = ref('')
|
|
|
|
|
@@ -248,6 +260,49 @@ const getSearchTreeData = async () => {
|
|
|
treeData.value = []
|
|
|
}
|
|
|
}
|
|
|
+const cityLoading = ref(false)
|
|
|
+const getSameLevelsTreeData = async () => {
|
|
|
+ cityLoading.value = true
|
|
|
+ const { error, code, data }
|
|
|
+ = await queryApi.getSiblingWbsContract({
|
|
|
+ pKeyId: primaryKeyId.value,
|
|
|
+
|
|
|
+ })
|
|
|
+ //判断状态
|
|
|
+ if (!error && code === 200) {
|
|
|
+
|
|
|
+ cities.value = getArrValue(data)
|
|
|
+ cityLoading.value = false
|
|
|
+ } else {
|
|
|
+ cityLoading.value = false
|
|
|
+
|
|
|
+ cities.value = []
|
|
|
+ }
|
|
|
+}
|
|
|
+const moveLoading = ref(false)
|
|
|
+const submitMove = async (type)=>{
|
|
|
+ moveLoading.value = true
|
|
|
+ const { error, code, data, msg } = await queryApi.moveNode({
|
|
|
+ leftPkeyIds: checkedCities.value,
|
|
|
+ rightPkeyId:currentNode.value.pKeyId,
|
|
|
+ })
|
|
|
+ moveLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success(msg ?? '操作成功')
|
|
|
+ }
|
|
|
+ if (type === 1) {
|
|
|
+ emit('save')
|
|
|
+ } else {
|
|
|
+ checkAll.value = false
|
|
|
+
|
|
|
+ checkedCities.value = []
|
|
|
+ cities.value = []
|
|
|
+ treeRef.value.setCheckedKeys([])
|
|
|
+ getSameLevelsTreeData()
|
|
|
+ searchClick()
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|