|
@@ -1,17 +1,28 @@
|
|
|
<template>
|
|
|
- <hc-new-dialog v-model="isShow" is-table widths="95%" title="合同计量单元新增" :loading="addNodeLoading" @save="modalSave" @close="closeAddModal">
|
|
|
+ <hc-new-dialog v-model="isShow" is-table widths="95%" :title="title" :loading="addNodeLoading" @save="modalSave" @close="closeAddModal">
|
|
|
<div class="relative h-full flex">
|
|
|
<div :id="`hc_tree_card_${uuid}`">
|
|
|
<hc-new-card scrollbar>
|
|
|
<template #header>
|
|
|
<div class="text-sm text-orange">↓ 选择部位【点击新增】</div>
|
|
|
</template>
|
|
|
- <div class="tree-list">
|
|
|
+ <div v-if="title === '合同计量单元新增'" class="tree-list">
|
|
|
<div v-for="(item, index) in treeDataList" :key="index" class="item" @click="treeListClick(item)">
|
|
|
<HcIcon name="box-3" fill />
|
|
|
<span class="ml-1">{{ item.nodeName }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div v-else>
|
|
|
+ <HcDataTree
|
|
|
+ ref="leftTree"
|
|
|
+ tree-key="id"
|
|
|
+ show-checkbox check-strictly
|
|
|
+ :datas="leftTreeData"
|
|
|
+ :h-props="lefttreeProps"
|
|
|
+ @node-tap="nodeElTreeClick"
|
|
|
+ @check="treeNodeCheck"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</hc-new-card>
|
|
|
</div>
|
|
|
<div :id="`hc_table_card_${uuid}`" class="flex-1">
|
|
@@ -31,8 +42,8 @@
|
|
|
</template>
|
|
|
<template #isAddChildNode="{ row }">
|
|
|
<el-radio-group v-model="row.isAddChildNode">
|
|
|
- <el-radio :label="1">是</el-radio>
|
|
|
- <el-radio :label="0" class="ml-2">否</el-radio>
|
|
|
+ <el-radio :value="1">是</el-radio>
|
|
|
+ <el-radio :value="0" class="ml-2">否</el-radio>
|
|
|
</el-radio-group>
|
|
|
</template>
|
|
|
<template #action="{ index }">
|
|
@@ -64,6 +75,10 @@ const props = defineProps({
|
|
|
type: [String, Number],
|
|
|
default: '',
|
|
|
},
|
|
|
+ title:{
|
|
|
+ type: [String],
|
|
|
+ default: '合同计量单元新增',
|
|
|
+ },
|
|
|
})
|
|
|
//事件
|
|
|
const emit = defineEmits(['finish', 'close'])
|
|
@@ -73,6 +88,7 @@ const contractId = ref(useAppState.getContractId || '')
|
|
|
const menuType = ref(props.menuType)
|
|
|
const ids = ref(props.ids)
|
|
|
const templateId = ref(props.templateId)
|
|
|
+const title = ref(props.title)
|
|
|
const uuid = getRandom(4)
|
|
|
|
|
|
//双向绑定
|
|
@@ -91,23 +107,72 @@ const getTreeDataList = async ()=>{
|
|
|
treeDataList.value = []
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+//表格数据
|
|
|
+const tableColumn = ref([
|
|
|
+ { key: 'nodeName', name: '名称' },
|
|
|
+ { key: 'startStake', name: '开始桩号' },
|
|
|
+ { key: 'endStake', name: '结束桩号' },
|
|
|
+ { key: 'contractPicture', name: '合同图号' },
|
|
|
+ { key: 'isAddChildNode', name: '是否划分子节点', width: 120, align: 'center' },
|
|
|
+ { key: 'action', name: '操作', width: 80, align: 'center' },
|
|
|
+])
|
|
|
+const leftTreeData = ref([])
|
|
|
+const treeLoading = ref(false)
|
|
|
+const getLeftTreeData = async (id) => {
|
|
|
+ treeLoading.value = true
|
|
|
+ const { error, code, data } = await unitApi.getCurrentNodeTree({
|
|
|
+ id,
|
|
|
+ contractId:contractId.value,
|
|
|
+
|
|
|
+ })
|
|
|
+ treeLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ leftTreeData.value = getArrValue(data)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ leftTreeData.value = []
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
//监听
|
|
|
watch(() => [
|
|
|
props.ids,
|
|
|
props.menuType,
|
|
|
props.templateId,
|
|
|
-], ([Ids, Type, Tem]) => {
|
|
|
- console.log(Type, 'Type')
|
|
|
+ props.title,
|
|
|
+], ([Ids, Type, Tem, til]) => {
|
|
|
ids.value = Ids
|
|
|
menuType.value = Type
|
|
|
templateId.value = Tem
|
|
|
+ title.value = til
|
|
|
+ if (title.value === '合同计量单元复制') {
|
|
|
+ tableColumn.value = [
|
|
|
+ { key: 'nodeName', name: '名称' },
|
|
|
+ { key: 'startStake', name: '开始桩号' },
|
|
|
+ { key: 'endStake', name: '结束桩号' },
|
|
|
+ { key: 'contractPicture', name: '合同图号' },
|
|
|
+ ]
|
|
|
+ } else {
|
|
|
+ tableColumn.value = [
|
|
|
+ { key: 'nodeName', name: '名称' },
|
|
|
+ { key: 'startStake', name: '开始桩号' },
|
|
|
+ { key: 'endStake', name: '结束桩号' },
|
|
|
+ { key: 'contractPicture', name: '合同图号' },
|
|
|
+ { key: 'isAddChildNode', name: '是否划分子节点', width: 120, align: 'center' },
|
|
|
+ { key: 'action', name: '操作', width: 80, align: 'center' },
|
|
|
+ ]
|
|
|
+ }
|
|
|
getTreeDataList()
|
|
|
+
|
|
|
}, { immediate: true })
|
|
|
|
|
|
//监听
|
|
|
watch(isShow, (val) => {
|
|
|
if (val) {
|
|
|
setSplitRef()
|
|
|
+ getLeftTreeData(ids.value)
|
|
|
+
|
|
|
|
|
|
}
|
|
|
})
|
|
@@ -136,15 +201,6 @@ const treeListClick = (item) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-//表格数据
|
|
|
-const tableColumn = ref([
|
|
|
- { key: 'nodeName', name: '名称' },
|
|
|
- { key: 'startStake', name: '开始桩号' },
|
|
|
- { key: 'endStake', name: '结束桩号' },
|
|
|
- { key: 'contractPicture', name: '合同图号' },
|
|
|
- { key: 'isAddChildNode', name: '是否划分子节点', width: 120, align: 'center' },
|
|
|
- { key: 'action', name: '操作', width: 80, align: 'center' },
|
|
|
-])
|
|
|
const tableData = ref([])
|
|
|
|
|
|
//删除
|
|
@@ -157,7 +213,8 @@ const modalSave = async () => {
|
|
|
window.$message.warning('请选择部位点击新增')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ if (title.value === '合同计量单元新增') {
|
|
|
+
|
|
|
const { error, code, msg } = await unitApi.addNode({
|
|
|
contractId:contractId.value,
|
|
|
projectId:projectId.value,
|
|
@@ -177,11 +234,47 @@ const modalSave = async () => {
|
|
|
window.$message.error(msg)
|
|
|
}
|
|
|
emit('finish')
|
|
|
+ } else {
|
|
|
+
|
|
|
+ const { error, code, msg } = await unitApi.copyNode({
|
|
|
+ contractId:contractId.value,
|
|
|
+ id:ids.value,
|
|
|
+ vo2s:tableData.value,
|
|
|
+
|
|
|
+ })
|
|
|
+ //判断状态
|
|
|
+ addNodeLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window?.$message?.success(msg)
|
|
|
+ tableData.value = []
|
|
|
+
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg)
|
|
|
+ }
|
|
|
+ emit('finish')
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
const closeAddModal = ()=>{
|
|
|
tableData.value = []
|
|
|
}
|
|
|
+
|
|
|
+const lefttreeProps = {
|
|
|
+ label: 'nodeName',
|
|
|
+ children: 'children',
|
|
|
+ isLeaf: 'notExsitChild',
|
|
|
+}
|
|
|
+const nodeElTreeClick = (data)=>{
|
|
|
+
|
|
|
+}
|
|
|
+const treeNodeCheck = (_, { checkedNodes }) => {
|
|
|
+ console.log(checkedNodes, 'checkedNodes')
|
|
|
+ tableData.value = checkedNodes
|
|
|
+
|
|
|
+}
|
|
|
+const leftTree = ref(null)
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|