duy 1 éve
szülő
commit
9ef7ee785c

+ 20 - 4
src/api/modules/agree/land.js

@@ -67,16 +67,32 @@ export default {
     async remove(form, msg = true) {
         return httpApi({
             url: '/api/blade-land/compensationInfo/remove',
-            method: 'post',
-            data: form,
+            method: 'get',
+            params: form,
         }, msg)
     },
     //表单复制blade-land/compensationInfo/cope-tab
     async copeTab(form, msg = true) {
         return httpApi({
             url: '/api/blade-land/compensationInfo/cope-tab',
-            method: 'post',
-            data: form,
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //获取附件列表
+    async getBussFileList(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-land/agreementFile/getFileList',
+            method: 'get',
+            params: form,
+        }, msg)
+    },
+    //删除附件
+    async deleteFile(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-land/agreementFile/delete',
+            method: 'get',
+            params: form,
         }, msg)
     },
 }

+ 170 - 0
src/views/agree/land/components/HcUpload.vue

@@ -0,0 +1,170 @@
+<template>
+    <el-upload
+        :accept="accept" :action="action" :before-remove="delUploadData" :before-upload="beforeUpload"
+        :data="uploadData"
+        :disabled="isCanuploadVal" :file-list="fileListData" :headers="getTokenHeader()" :on-error="uploadError"
+        :on-exceed="uploadExceed" :on-preview="uploadPreview" :on-progress="uploadprogress"
+        :on-remove="uploadRemove" :on-success="uploadSuccess" class="hc-upload-border"
+        drag multiple
+    >
+        <div v-loading="uploadDisabled" :element-loading-text="loadingText" class="hc-upload-loading">
+            <HcIcon name="backup" ui="text-5xl mt-4" />
+            <div class="el-upload__text">
+                拖动文件到这里 或 <em>点击这里选择文件</em> 并上传
+            </div>
+        </div>
+        <template #tip>
+            <div class="el-upload__tip" style="font-size: 14px;">
+                {{ acceptTip }}
+            </div>
+        </template>
+    </el-upload>
+</template>
+
+<script setup>
+import { onMounted, ref, watch } from 'vue'
+import { getTokenHeader } from '~src/api/request/header'
+import landApi from '~api/agree/land.js'
+import { isFileSize } from 'js-fast-way'
+
+
+const props = defineProps({
+    fileList: {
+        type: Array,
+        default: () => ([]),
+    },
+    datas: {
+        type: Object,
+        default: () => ({}),
+    },
+    isCanupload:{
+        type:Boolean,
+        default:false,
+    },
+    action:{
+        type:String,
+        default:'/api/blade-manager/exceltab/add-buss-file',
+    },   
+    accept:{
+        type:String,
+        default:'image/png,image/jpg,image/jpeg,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/pdf,.doc,.docx,application/msword',
+    },
+    acceptTip:{
+        type:String,
+        default:'允许格式:jpg/png/pdf/excel/word, 文件大小 小于 60MB',
+    },
+    
+})
+
+//事件
+const emit = defineEmits(['change'])
+//变量
+const uploadData = ref(props.datas)
+const fileListData = ref(props.fileList)
+const action = ref(props.action)
+const accept = ref(props.accept)
+const acceptTip = ref(props.acceptTip)
+const uploadDisabled = ref(false)
+const isCanuploadVal = ref(props.isCanupload)
+
+//监听
+watch(() => [
+    props.fileList,
+    props.datas,
+    props.isCanupload,
+    props.action,
+    props.accept,
+    props.acceptTip,
+], ([fileList, datas, isCanupload, Action, Accept, Tip]) => {
+    uploadData.value = datas
+    fileListData.value = fileList
+    isCanuploadVal.value = isCanupload
+    action.value = Action
+    accept.value = Accept
+    acceptTip.value = Tip
+})
+
+//渲染完成
+onMounted(() => {
+    beforeFileNum.value = 0
+    finishFileNum.value = 0
+    errorFileNum.value = 0
+})
+
+//上传前
+const beforeFileNum = ref(0)
+const beforeUpload = async (file) => {
+    if (isFileSize(file?.size, 60)) {
+        beforeFileNum.value++
+        return true
+    } else {
+        window?.$message?.warning('文件大小, 不能过60M!')
+        return false
+    }
+}
+
+//超出限制时
+const uploadExceed = () => {
+    window?.$message?.warning('请上传 jpg/png/pdf/excel/word 的文件,文件大小 不超过60M')
+}
+
+//上传中
+const loadingText = ref('上传中...')
+const uploadprogress = () => {
+    loadingText.value = '上传中...'
+    uploadDisabled.value = true
+}
+
+//上传完成
+const finishFileNum = ref(0)
+const uploadSuccess = () => {
+    finishFileNum.value++
+    if (beforeFileNum.value === finishFileNum.value) {
+        uploadDisabled.value = false
+        emit('change', { type: 'success' })
+    }
+}
+
+//上传失败
+const errorFileNum = ref(0)
+const uploadError = () => {
+    errorFileNum.value++
+    window?.$message?.error('上传失败')
+    const num = finishFileNum.value + errorFileNum.value
+    if (beforeFileNum.value === num) {
+        uploadDisabled.value = false
+        emit('change', { type: 'success' })
+    }
+}
+
+//预览
+const uploadPreview = ({ url }) => {
+    if (url) {
+        window.open(url, '_blank')
+    }
+}
+
+//删除文件
+const delUploadData = async ({ id }) => {
+     
+        loadingText.value = '删除中...'
+        uploadDisabled.value = true
+        const { error, code } = await landApi.deleteFile({
+            ids: id,
+        })
+        uploadDisabled.value = false
+        if (!error && code === 200) {
+            window?.$message?.success('删除成功')
+            return true
+        } else {
+            return false
+        }
+    
+}
+
+const uploadRemove = () => {
+    if (fileListData.value.length <= 0) {
+        emit('change', { type: 'del' })
+    }
+}
+</script>

+ 42 - 2
src/views/agree/land/form.vue

@@ -12,8 +12,9 @@
                 :status="0"
                 :area-id="areaId"
                 :agreement-id="agreementId"
+                @renew="updateGetTablesData(agreementId)"
             />
-            <HcStatus text="暂无表单" />
+            <HcStatus v-else text="暂无表单" />
         </el-scrollbar>
         <template #action>
             <el-button size="large" type="primary" hc-btn :loading="tableFormSaveLoading" @click="tableFormSaveClick">
@@ -28,7 +29,7 @@
                 <HcIcon name="eye" />
                 <span>预览</span>
             </el-button>
-            <el-button size="large" type="success" hc-btn>
+            <el-button size="large" type="success" hc-btn @click="addFile">
                 <HcIcon name="upload" />
                 <span>上传附件协议</span>
             </el-button>
@@ -37,6 +38,9 @@
                 <span>取消并返回</span>
             </el-button>
         </template>
+        <HcDialog is-to-body :show="addModal" title="上传附件协议" :footer="false" @close="testModalClose">
+            <HcUpload :datas="uploadData" :file-list="fileListData" :is-canupload="false" action="/api/blade-land/agreementFile/add-buss-file" accept="application/pdf" accept-tip="允许格式:pdf" @change="uploadChange" />
+        </HcDialog>
     </HcCard>
 </template>
 
@@ -47,6 +51,7 @@ import CollapseForm from './collapse-form/index.vue'
 import landApi from '~api/agree/land.js'
 import { useAppStore } from '~src/store'
 import { getArrValue, getObjVal } from 'js-fast-way'
+import HcUpload from './components/HcUpload.vue'
 
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
@@ -161,6 +166,41 @@ const bussPdfsClick = async () => {
         window.$message?.warning('获取PDF失败')
     }
 }
+//上传附件
+const addModal = ref(false)
+const testModalClose = ()=>{
+    addModal.value = false
+}
+const addFile = ()=>{
+    addModal.value = true
+    getBussFileList(agreementId.value)
+         //上传的配置
+         uploadData.value = {
+                agreementId:agreementId.value,
+                projectId: projectId.value,
+            }
+}
+const uploadData = ref({})
+const fileListData = ref([])
+//上传文件
+const uploadChange = async ({ type }) => {
+    if (type === 'success') {
+        getBussFileList(agreementId.value)
+    } else if (type === 'del') {
+        getBussFileList(agreementId.value)
+    }
+}
+//获取文件列表
+const getBussFileList = async (pkeyId) => {
+    const { error, code, data } = await landApi.getBussFileList({
+        agreementId: pkeyId,
+    })
+    if (!error && code === 200) {
+        fileListData.value = getArrValue(data)
+    } else {
+        fileListData.value = []
+    }
+}
 </script>
 
 <style lang="scss" scoped>

+ 30 - 5
src/views/agree/land/land.vue

@@ -28,7 +28,7 @@
                     <HcIcon name="add" />
                     <span>打印</span>
                 </el-button>
-                <el-button size="large" type="danger" hc-btn>
+                <el-button size="large" type="danger" hc-btn :disabled="tableCheckedKeys.length < 1" @click="batchDel">
                     <HcIcon name="delete-bin" />
                     <span>删除</span>
                 </el-button>
@@ -54,11 +54,11 @@
 </template>
 
 <script setup>
-import { ref } from 'vue'
+import { onActivated, ref } from 'vue'
 import { useRouter } from 'vue-router'
 import landApi from '~api/agree/land.js'
 import { useAppStore } from '~src/store'
-import { getArrValue } from 'js-fast-way'
+import { arrToId, getArrValue } from 'js-fast-way'
 import { delMessageV2 } from '~com/message/index.js'
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
@@ -70,7 +70,9 @@ const treeNodeTap = ({ node, data }) => {
     searchForm.value.areaId = data.id
     getTableData()
 }
-
+onActivated(()=>{
+    getTableData()
+})
 //搜索表单
 const searchForm = ref({
     projectType: null, name: null, startTime: null, endTime: null,
@@ -121,8 +123,9 @@ const getTableData = async () => {
 }
 
 //多选事件
+const tableCheckedKeys = ref([])
 const tableSelectionChange = (rows) => {
-    console.log(rows)
+    tableCheckedKeys.value = rows
 }
 
 //新增
@@ -175,6 +178,28 @@ const delAgree = (row)=>{
             }
      })
 }
+const batchDel = ()=>{
+    const rows = tableCheckedKeys.value
+    const ids = arrToId(rows)
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await landApi.remove({
+                            ids,
+                        })
+                        if (!error && code === 200) {
+                            window?.$message?.success('删除成功')
+                            getTableData()
+                        } else {
+                            window?.$message?.warning(msg)
+                        }
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+     })
+}
 </script>
 
 <style lang="scss" scoped>

+ 87 - 65
src/views/agree/special/collapse-form/form-item.vue

@@ -1,76 +1,88 @@
 <template>
-    <HcTableForm ref="tableFormRef"
-                 :cols="colsKeys"
-                 :form="tableFormInfo"
-                 :height="heights"
-                 :html="excelHtml"
-                 :loading="loading"
-                 :pid="activeKey"
-                 :pkey="keyId"
-                 :scroll="scroll"
-                 :width="widths"
-                 @excelBodyTap="excelTableFormClick"
-                 @render="tableFormRender"
-                 @rightTap="tableFormRightTap"
+    <HcTableForm
+        ref="tableFormRef"
+        :cols="colsKeys"
+        :form="tableFormInfo"
+        :height="heights"
+        :html="excelHtml"
+        :loading="loading"
+        :pid="activeKey"
+        :pkey="keyId"
+        :scroll="scroll"
+        :width="widths"
+        @excelBodyTap="excelTableFormClick"
+        @render="tableFormRender"
+        @rightTap="tableFormRightTap"
     />
 </template>
 
 <script setup>
-import {ref, watch, onMounted} from "vue"
-import {useAppStore} from "~src/store";
-import wbsApi from "~api/data-fill/wbs";
-import {deepClone, getArrValue, getObjVal, isString} from "js-fast-way"
+import { onMounted, ref, watch } from 'vue'
+import { useAppStore } from '~src/store'
+import landApi from '~api/agree/land.js'
+import { deepClone, getArrValue, getObjVal, isString } from 'js-fast-way'
 
 //初始
 const props = defineProps({
-    tid: { // 树节点
+    areaId: { // 树节点
         type: [String, Number],
-        default: ''
+        default: '',
     },
     kid: { // pkeyId
         type: [String, Number],
-        default: ''
+        default: '',
     },
-    classify: { // 类型
+    classify: { // 类型1新增,2是编辑
         type: [String, Number],
-        default: ''
+        default: '',
     },
     scroll: {
         type: Boolean,
-        default: true
+        default: true,
     },
     height: {
         type: String,
-        default: '100%'
+        default: '100%',
     },
     width: {
         type: String,
-        default: 'auto'
+        default: 'auto',
     },
     datas: {
         type: Object,
-        default: () => ({})
-    },
-    nodeName: { // 表单名称
-        type: String,
-        default: ''
+        default: () => ({}),
     },
+   
     pid: { // 折叠ID
         type: String,
-        default: ''
+        default: '',
+    },
+ 
+    tableId:{
+        type: [String, Number],
+        default: '', //表单initTableId
+    },
+    agreementId:{
+        type: [String, Number],
+        default: '', //协议ID
     },
+
+   
 })
 
+//事件
+const emit = defineEmits(['rightTap', 'render', 'excelBodyTap'])
 //初始变量
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
 const contractId = ref(useAppState.getContractId)
 const keyId = ref(props.kid ? props.kid + '' : '')
-const treeId = ref(props.tid)
+const areaId = ref(props.areaId)
+const agreementId = ref(props.agreementId)
 const classify = ref(props.classify)
 const loading = ref(false)
 const changeData = ref(props.datas)
-const nodeNames = ref(props.nodeName)
+
 
 const heights = ref(props.height)
 const widths = ref(props.width)
@@ -78,38 +90,46 @@ const activeKey = ref(props.pid)
 
 const tableFormRef = ref(null)
 
+const tableId = ref(props.tableId)
+
 //监听
 watch(() => [
     useAppState.getProjectId,
     useAppState.getContractId,
-    props.tid,
+    props.areaId,
     props.kid,
     props.classify,
     props.nodeName,
     props.height,
     props.width,
     props.pid,
+
+    props.tableId,
+    props.agreementId,
 ], (
-    [project_id, contract_id, tree_id, key_id, cid, nodeName, height, width, pid]
+    [project_id, contract_id, area_id, key_id, cid, height, width, pid, , table_id, aeement_id],
 ) => {
     projectId.value = project_id
     contractId.value = contract_id
-    treeId.value = tree_id
+    areaId.value = area_id
     keyId.value = key_id ? key_id + '' : ''
     classify.value = cid
-    nodeNames.value = nodeName
+  
     heights.value = height
     widths.value = width
     activeKey.value = pid
+
+    tableId.value = table_id
+    agreementId.value = aeement_id
 })
 
 //深度监听变动的对象数据
 watch(() => [
-    props.datas
+    props.datas,
 ], ([data]) => {
     changeData.value = data
     setFormChangeData(data)
-}, {deep: true})
+}, { deep: true })
 
 
 //渲染完成
@@ -124,9 +144,6 @@ onMounted(async () => {
     loading.value = false
 })
 
-//事件
-const emit = defineEmits(['rightTap', 'render', 'excelBodyTap'])
-
 //表单被点击
 const excelTableFormClick = (item) => {
     emit('excelBodyTap', item)
@@ -135,12 +152,20 @@ const excelTableFormClick = (item) => {
 //获取表单初始数据
 const getFormDataInit = () => {
     return {
+        // projectId: projectId.value,
+        // contractId: contractId.value,
+        // classify: classify.value,
+        // pkeyId: keyId.value,
+        // nodeId: treeId.value,
+        // isRenderForm: false,
+    
+        agreementId: agreementId.value, //	协议的id,新增协议为null
+        areaId:areaId.value, //当前树节点id
         projectId: projectId.value,
-        contractId: contractId.value,
-        classify: classify.value,
-        pkeyId: keyId.value,
-        nodeId: treeId.value,
+        tableId:tableId.value, //表单的tableId
         isRenderForm: false,
+        linkId: keyId.value,
+    
     }
 }
 
@@ -148,20 +173,20 @@ const getFormDataInit = () => {
 const tableFormInfo = ref({})
 const getTableFormInfo = async (pkeyId) => {
     if (pkeyId) {
-        const {error, code, data} = await wbsApi.getBussDataInfo({
-            pkeyId: pkeyId
+        const { error, code, data } = await landApi.getBussInfo({
+            id: pkeyId,
         }, false)
         const resData = getObjVal(data)
         if (!error && code === 200 && resData) {
             tableFormInfo.value = {
                 ...resData,
                 ...getFormDataInit(),
-                ...changeData.value
+                ...changeData.value,
             }
         } else {
             tableFormInfo.value = {
                 ...getFormDataInit(),
-                ...changeData.value
+                ...changeData.value,
             }
         }
     } else {
@@ -174,19 +199,20 @@ const getTableFormInfo = async (pkeyId) => {
 const colsKeys = ref([])
 const getHtmlBussColsApi = async (pkeyId) => {
     if (pkeyId) {
-        const {error, code, data} = await wbsApi.getHtmlBussCols({
-            pkeyId: pkeyId
+        const { error, code, data } = await landApi.getBussCols({
+            id: pkeyId,
+       
         }, false)
         if (!error && code === 200) {
-            let keys = getArrValue(data);
+            let keys = getArrValue(data)
             for (let i = 0; i < keys.length; i++) {
                 if (keys[i].length <= 0) {
                     keys.splice(i, 1)
                 }
             }
-            colsKeys.value = keys;
+            colsKeys.value = keys
         } else {
-            colsKeys.value = [];
+            colsKeys.value = []
         }
     } else {
         colsKeys.value = []
@@ -197,8 +223,8 @@ const getHtmlBussColsApi = async (pkeyId) => {
 const excelHtml = ref('')
 const getExcelHtml = async (pkeyId) => {
     if (pkeyId) {
-        const {error, code, data} = await wbsApi.getExcelHtml({
-            pkeyId: pkeyId
+        const { error, code, data } = await landApi.getExcelHtml({
+            id: pkeyId,
         }, false)
         const resData = isString(data) ? data || '' : ''
         if (!error && code === 200 && resData) {
@@ -229,8 +255,7 @@ const tableFormRightTap = (item) => {
 //设置数据
 const setFormChangeData = (data) => {
     const form = deepClone(tableFormInfo.value)
-    tableFormInfo.value = {...form, ...data}
-    //console.log('设置数据', {...form, ...data})
+    tableFormInfo.value = { ...form, ...data }
 }
 
 const getFormData = () => {
@@ -251,10 +276,7 @@ const isFormRegExp = async () => {
     return await tableFormRef.value?.isFormRegExp()
 }
 
-//获取表单名称
-const getNodeName = () => {
-    return nodeNames.value
-}
+
 
 //按下ctrl键
 const setIsCtrlKey = (data) => {
@@ -277,9 +299,9 @@ defineExpose({
     setFormData,
     getRegExpJson,
     isFormRegExp,
-    getNodeName,
+
     setIsCtrlKey,
     setCopyKeyList,
-    setPasteKeyList
+    setPasteKeyList,
 })
 </script>

+ 174 - 176
src/views/agree/special/collapse-form/index.vue

@@ -1,28 +1,37 @@
 <template>
     <div class="data-fill-list-box">
         <el-collapse v-model="ActiveKey" accordion @change="CollapseChange">
-            <template v-for="(item,index) in listDatas" :key="item?.pkeyId">
-                <el-collapse-item :id="`item-${index}-${item?.pkeyId}`" :name="`item-${index}-${item?.pkeyId}`">
+            <template v-for="(item, index) in listDatas" :key="item?.id">
+                <el-collapse-item :id="`item-${index}-${item?.id}`" :name="`item-${index}-${item?.id}`">
                     <template #title>
                         <div class="hc-collapse-item-header">
-                            <div class="text-lg truncate item-title"> {{ item.nodeName }}</div>
+                            <div class="text-lg truncate item-title">
+                                {{ item.tableName }}
+                            </div>
                             <div class="hc-extra-text-box">
-                                <el-button :loading="copyClickLoading" plain type="primary" @click.stop="copyClick(item,index)">复制本表</el-button>
+                                <el-button :loading="copyClickLoading" plain type="primary" @click.stop="copyClick(item, index)">
+                                    复制本表
+                                </el-button>
                             </div>
                         </div>
                     </template>
                     <div class="data-fill-list-item-content">
-                        <TableFormItem v-if="item.isTableRender"
-                                       :ref="(el) => setItemRefs(el, item)"
-                                       :classify="classifys"
-                                       :datas="changeFormDatas(item?.pkeyId, 'collapse')"
-                                       :kid="item?.pkeyId"
-                                       :nodeName="item.nodeName"
-                                       :pid="`table-form-${item?.pkeyId}`"
-                                       :tid="treeId"
-                                       @excelBodyTap="excelTableFormClick($event)"
-                                       @render="tableFormRender($event, item, index)"
-                                       @rightTap="tableFormRightTap($event, index)"
+                        <TableFormItem
+                            v-if="item.isTableRender"
+                            :ref="(el) => setItemRefs(el, item)"
+                            :classify="classifys"
+                            :datas="changeFormDatas(item?.id, 'collapse')"
+                            :kid="item?.id"
+                            :node-name="item.nodeName"
+                            :node-type="item.nodeType"
+                            :pid="`table-form-${item?.id}`"
+                            :area-id="areaId"
+                            :table-id="item.tableId"
+                            :agreement-id="agreementId"
+                            style="width: 100%;"
+                            @excelBodyTap="excelTableFormClick($event)"
+                            @render="tableFormRender($event, item, index)"
+                            @rightTap="tableFormRightTap($event, index)"
                         />
                     </div>
                 </el-collapse-item>
@@ -32,70 +41,83 @@
 </template>
 
 <script setup>
-import {ref, watch, nextTick, onActivated, onDeactivated, onMounted, onUnmounted} from "vue";
-import HTableForm from "~src/plugins/HTableForm"
-import {useAppStore} from "~src/store";
-import wbsApi from "~api/data-fill/wbs"
-import TableFormItem from "./form-item.vue"
+import { nextTick, onActivated, onDeactivated, onMounted, onUnmounted, ref, watch } from 'vue'
+import HTableForm from '~src/plugins/HTableForm'
+import { useAppStore } from '~src/store'
+import landApi from '~api/agree/land.js'
+import TableFormItem from './form-item.vue'
 import {
-    getArrValue, getObjValue, getObjVal,
-    isNullES, deepClone, arrIndex, setPosRange
-} from "js-fast-way"
-
-//初始变量
-const useAppState = useAppStore()
+    arrIndex, deepClone, getArrValue,
+    getObjVal, getObjValue, isNullES, setPosRange,
+} from 'js-fast-way'
 
 //参数
 const props = defineProps({
     datas: {
         type: Array,
-        default: () => ([])
+        default: () => ([]),
     },
     classify: {
         type: [String, Number],
-        default: ''
+        default: '',
     },
     status: {
         type: [String, Number],
-        default: ''
+        default: '',
     },
     primaryKeyId: {
         type: [String, Number],
-        default: ''
+        default: '',
     },
     contractId: {
         type: [String, Number],
-        default: ''
+        default: '',
     },
     drawType: {
         type: Boolean,
-        default: false
+        default: false,
     },
     wbsTempId: {
         type: [String, Number],
-        default: ''
+        default: '',
     },
     tenantId: {
         type: [String, Number],
-        default: ''
+        default: '',
     },
     wbsType: {
         type: [String, Number],
-        default: ''
+        default: '',
+    },
+    areaId:{
+        type: String,
+        default: '',
+    }, //当前树节点
+    agreementId:{
+        type: [String, Number],
+        default: '',
     },
 })
 
+//事件
+const emit = defineEmits(['renew', 'offsetTop'])
+
+//初始变量
+const useAppState = useAppStore()
+
 //全局变量
-const projectId = ref(useAppState.projectId);
+const projectId = ref(useAppState.projectId)
 const contract_id = ref(props.contractId)
 const treeId = ref(props.primaryKeyId)
 const classifys = ref(props.classify)
-const wbsTemp_id = ref(props.wbsTempId);
-const tenant_id = ref(props.tenantId);
-const wbs_type = ref(props.wbsType);
+const wbsTemp_id = ref(props.wbsTempId)
+const tenant_id = ref(props.tenantId)
+const wbs_type = ref(props.wbsType)
 const isStatus = ref(parseInt(props.status))
 const listDatas = ref([])
 const draw_type = ref(props.drawType)
+const areaId = ref(props.areaId)
+const agreementId = ref(props.agreementId)
 
 
 //表单变量
@@ -105,24 +127,24 @@ const formparentId = ref('')
 
 //处理ref
 const itemRefs = ref([])
-const setItemRefs = (el, {pkeyId}) => {
+const setItemRefs = (el, { id }) => {
     if (el) {
-        let index = arrIndex(itemRefs.value, 'pkeyId', pkeyId)
+        let index = arrIndex(itemRefs.value, 'pKeyId', id)
         if (index !== -1) {
             itemRefs.value[index].ref = el
         } else {
             itemRefs.value.push({
-                pkeyId: pkeyId,
-                ref: el
-            });
+                pKeyId: id,
+                ref: el,
+            })
         }
     }
 }
 
 //处理表单的ref
-const setSpliceItemRefs = async ({pkeyId}) => {
+const setSpliceItemRefs = async ({ pKeyId }) => {
     const refs = itemRefs.value
-    let index = arrIndex(refs, 'pkeyId', pkeyId)
+    let index = arrIndex(refs, 'pKeyId', pKeyId)
     if (index !== -1) {
         refs.splice(index, 1)
         itemRefs.value = refs
@@ -130,25 +152,22 @@ const setSpliceItemRefs = async ({pkeyId}) => {
 }
 
 const closeIconArr = [
-    {key: 'reduction', icon: 'picture-in-picture-2', name: '还原到面板内,并自动展开面板'}
+    { key: 'reduction', icon: 'picture-in-picture-2', name: '还原到面板内,并自动展开面板' },
 ]
 
-//事件
-const emit = defineEmits(['renew', 'offsetTop'])
-
 //组件参数变量
-const apis = ref({
-    dataInfo: wbsApi.getBussDataInfo,
-    bussCols: wbsApi.getHtmlBussCols,
-    excelHtml: wbsApi.getExcelHtml
-})
+// const apis = ref({
+//     dataInfo: wbsApi.getBussDataInfo,
+//     bussCols: wbsApi.getHtmlBussCols,
+//     excelHtml: wbsApi.getExcelHtml,
+// })
 
 //深度监听数据
 watch(() => [
     props.datas,
 ], ([datas]) => {
     setFormDataNum(datas)
-}, {deep: true})
+}, { deep: true })
 
 //监听变量值
 watch(() => [
@@ -160,7 +179,9 @@ watch(() => [
     props.status,
     props.classify,
     props.primaryKeyId,
-], ([pid, cid, temp_id, tid, type, status, class_id, tree_id]) => {
+    props.areaId,
+    props.agreementId,
+], ([pid, cid, temp_id, tid, type, status, class_id, tree_id, area_id, agreement_id]) => {
     projectId.value = pid
     contract_id.value = cid
     wbsTemp_id.value = temp_id
@@ -169,25 +190,27 @@ watch(() => [
     isStatus.value = parseInt(status)
     classifys.value = class_id
     treeId.value = tree_id
+    areaId.value = area_id
+    agreementId.value = agreement_id
 })
 
 //渲染完成
 onMounted(() => {
     setFormDataNum(props.datas)
     setTableFormMenu(useAppState.projectInfo)
-    const {offsetHeight} = document.body
+    const { offsetHeight } = document.body
     DragModalHeight.value = offsetHeight - 200
     setMountOnEventKey()
 })
 
 //处理变动的数据
 const changeFormData = ref({
-    'window': [],
-    'collapse': [],
+    window: [],
+    collapse: [],
 })
-const changeFormDatas = (pkeyId, type) => {
+const changeFormDatas = (pKeyId, type) => {
     const changeData = changeFormData.value[type]
-    const index = arrIndex(changeData, 'pkeyId', pkeyId)
+    const index = arrIndex(changeData, 'pKeyId', pKeyId)
     if (index !== -1) {
         return changeData[index]
     } else {
@@ -196,11 +219,11 @@ const changeFormDatas = (pkeyId, type) => {
 }
 
 //设置变动的数据
-const setChangeFormDatas = async (pkeyId, type) => {
-    const refs = await getFormRef(pkeyId)
+const setChangeFormDatas = async (pKeyId, type) => {
+    const refs = await getFormRef(pKeyId)
     const formData = refs?.getFormData()
     const changeData = changeFormData.value[type]
-    const index = arrIndex(changeData, 'pkeyId', pkeyId)
+    const index = arrIndex(changeData, 'pKeyId', pKeyId)
     if (index !== -1) {
         changeData[index] = formData
     } else {
@@ -210,15 +233,17 @@ const setChangeFormDatas = async (pkeyId, type) => {
 }
 
 //展开事件
+
 const ActiveKey = ref('')
 const CollapseChange = (name) => {
     ActiveKey.value = name
     let index = getCollapseItemIndex(name)
     if (index > -1) {
-        getOffsetTop(name);
+        getOffsetTop(name)
         const item = listDatas.value[index]
-        formKeyIds.value = setToString(item.pkeyId)
+        formKeyIds.value = setToString(item.id)
         formparentId.value = setToString(item.parentId)
+    
         nextTick(() => {
             if (!item.isTableRender) {
                 item.isTableRender = true
@@ -235,9 +260,9 @@ const CollapseChange = (name) => {
 const setFormDataNum = (datas) => {
     itemRefs.value = []
     ActiveKey.value = ''
-    let newArr = [];
+    let newArr = []
     for (let i = 0; i < datas.length; i++) {
-        newArr.push({isCollapseLoad: false})
+        newArr.push({ isCollapseLoad: false })
     }
     formDataList.value = newArr
     listDatas.value = deepClone(datas)
@@ -262,24 +287,24 @@ const setTableFormMenu = (info) => {
     let newArr = [], infos = getObjValue(info)
     const isOpen = infos['isOpenRandomNumber'] ?? 0
     if (isOpen === 1 && isStatus.value !== 3) {
-        newArr.push({label: '插入设计值/频率', key: "design"})
+        newArr.push({ label: '插入设计值/频率', key: 'design' })
     }
-    newArr.push({label: '插入特殊字符', key: "special"})
-    newArr.push({label: '关联试验数据', key: "test"})
-    newArr.push({label: '关联试验文件', key: "file"})
-    newArr.push({label: '公式参数', key: "formula"})
+    newArr.push({ label: '插入特殊字符', key: 'special' })
+    newArr.push({ label: '关联试验数据', key: 'test' })
+    newArr.push({ label: '关联试验文件', key: 'file' })
+    newArr.push({ label: '公式参数', key: 'formula' })
     tableFormMenu.value = newArr
 }
 
 //鼠标右键事件
-const tableFormRightTap = ({event, KeyName, startPos, endPos, pkeyId}, index) => {
+const tableFormRightTap = ({ event, KeyName, startPos, endPos, pkeyId }, index) => {
     //存储临时信息
-    tableFormItemNode.value = {KeyName, index, startPos, endPos, pkeyId}
+    tableFormItemNode.value = { KeyName, index, startPos, endPos, pkeyId }
     contextMenuRef.value?.showMenu(event, false) //展开菜单
 }
 
 //鼠标右键菜单被点击
-const handleMenuSelect = ({key}) => {
+const handleMenuSelect = ({ key }) => {
     if (key === 'design') {
         setInitDesignForm()
         designModalLoading.value = false
@@ -291,7 +316,7 @@ const handleMenuSelect = ({key}) => {
         testModal.value = true
     } else if (key === 'file') {
         fileModalLoading.value = false
-        fileModal.value = true;
+        fileModal.value = true
     } else if (key === 'formula') {
         formulaModalLoading.value = false
         formulaModal.value = true
@@ -308,18 +333,18 @@ const setInitDesignForm = () => {
     formDesignModel.value = {
         type: 1, design: '', size: '',
         dev: '', key: '', capacity: '',
-        pass: '', pkId: ''
+        pass: '', pkId: '',
     }
 }
 
 //设计值频率计算
 const designModalLoading = ref(false)
 const designModalSave = async () => {
-    const {pkeyId, KeyName} = tableFormItemNode.value
+    const { pkeyId, KeyName } = tableFormItemNode.value
     if (pkeyId) {
         designModalLoading.value = true
         //const {design, size} = formDesignModel.value
-        const {error, code, data} = await wbsApi.queryFormulaRange({
+        const { error, code, data } = await wbsApi.queryFormulaRange({
             ...formDesignModel.value,
             // dev: (!design && !size) ? '±5': '',
             key: KeyName,
@@ -373,11 +398,11 @@ const specialRef = ref(null)
 const specialNodeClick = async () => {
     specialModalLoading.value = true
     const itemNode = tableFormItemNode.value
-    const {KeyName, pkeyId} = itemNode
+    const { KeyName, pkeyId } = itemNode
     try {
         const refs = await getFormRef(pkeyId)
         const itemFormData = refs?.getFormData()
-        const {code, val, posVal} = await specialRef.value?.getSpecialNode(itemNode, itemFormData[KeyName])
+        const { code, val, posVal } = await specialRef.value?.getSpecialNode(itemNode, itemFormData[KeyName])
         if (code === 200 && val) {
             itemFormData[KeyName] = val
             refs?.setFormData(itemFormData)
@@ -407,7 +432,7 @@ const testModalLoading = ref(false)
 //关联试验数据被点击
 const itinsertTableId = ref('')
 const itinsertTreeId = ref('')
-const testTableRowName = ({row, treeId}) => {
+const testTableRowName = ({ row, treeId }) => {
     itinsertTableId.value = row.id
     itinsertTreeId.value = treeId
     insertDataLoading.value = false
@@ -421,19 +446,19 @@ const testModalClose = () => {
 }
 
 //选择要插入的实验数据
-const insertDataShow = ref(false);
-const insertDataLoading = ref(false);
+const insertDataShow = ref(false)
+const insertDataLoading = ref(false)
 
 //确定关联试验数据数据
 const insertDataRef = ref(null)
 const submitinsertData = async () => {
     insertDataLoading.value = true
     const itemNode = tableFormItemNode.value
-    const {KeyName, pkeyId} = itemNode
+    const { KeyName, pkeyId } = itemNode
     try {
         const refs = await getFormRef(pkeyId)
         const itemFormData = refs?.getFormData()
-        const {code, val, posVal} = await insertDataRef.value?.submitinsertData(itemNode, itemFormData[KeyName])
+        const { code, val, posVal } = await insertDataRef.value?.submitinsertData(itemNode, itemFormData[KeyName])
         if (code === 200 && val) {
             itemFormData[KeyName] = val
             refs?.setFormData(itemFormData)
@@ -505,7 +530,7 @@ const windowClick = async (item, indexs) => {
         const formSize = getTableFormSize(item?.pkeyId)
         const newTableForm = {
             ...setInitDragModalTableForm(item, indexs),
-            ...formSize
+            ...formSize,
         }
         await setChangeFormDatas(item?.pkeyId, 'window')
         item.isWindow = true
@@ -549,12 +574,12 @@ const setInitDragModalTableForm = (item, index) => {
         title: item.nodeName,
         isShow: true,
         index: index,
-        item: item
+        item: item,
     }
 }
 
 //关闭窗口
-const TableFormClose = async ({pkeyId, index}, indexs) => {
+const TableFormClose = async ({ pkeyId, index }, indexs) => {
     const list = deepClone(DragModalTableForm.value)
     //取表单的数据
     await setChangeFormDatas(pkeyId, 'collapse')
@@ -565,21 +590,21 @@ const TableFormClose = async ({pkeyId, index}, indexs) => {
 }
 
 const dragNodeMoreMenu = [
-    {key: 'save', icon: 'save-2', name: '保存'},
-    {key: 'preview', icon: 'eye', name: '预览'},
+    { key: 'save', icon: 'save-2', name: '保存' },
+    { key: 'preview', icon: 'eye', name: '预览' },
 ]
 
 //还原窗口
 const closeIconTap = async (event, item, indexs) => {
-    const {index, pkeyId} = item
+    const { index, pkeyId } = item
     let KeyId = `item-${index}-${pkeyId}`
     await TableFormClose(item, indexs)
     ActiveKey.value = KeyId
 }
 
 //菜单被点击
-const dragNodeMoreMenuTap = ({key}, items) => {
-    const {item} = items
+const dragNodeMoreMenuTap = ({ key }, items) => {
+    const { item } = items
     if (key === 'save') {
         if (item?.isTableForm) {
             tableFormSaveClick(item, items)
@@ -597,11 +622,11 @@ const dragNodeMoreMenuTap = ({key}, items) => {
 
 //删除本表
 const tableFormDelLoading = ref(false)
-const delClick = async ({pkeyId}) => {
+const delClick = async ({ pkeyId }) => {
     if (pkeyId) {
         if (isStatus.value !== 3) {
             tableFormDelLoading.value = true
-            const {error, code} = await wbsApi.removeBussTabInfo({
+            const { error, code } = await wbsApi.removeBussTabInfo({
                 pkeyid: pkeyId,
                 classify: classifys.value,
             })
@@ -620,17 +645,17 @@ const delClick = async ({pkeyId}) => {
     }
 }
 //复制本表相关
-const showcopyModal=ref(false)
-const copyRefs=ref(null)
-const copyModalClose=()=>{
+const showcopyModal = ref(false)
+const copyRefs = ref(null)
+const copyModalClose = ()=>{
     // copyModal.value=false
 }
-const CopyModalType=ref('1')
+const CopyModalType = ref('1')
 
-const copySaveClick=async()=>{
+const copySaveClick = async ()=>{
     //本节点复制
-   if(CopyModalType.value==='2'){
-        const {pkeyId, isTableRender, isTableForm} =  copyItems.value
+   if (CopyModalType.value === '2') {
+        const { pkeyId, isTableRender, isTableForm } = copyItems.value
         if (pkeyId) {
             if (isStatus.value !== 3) {
                 if (!isTableRender) {
@@ -655,7 +680,7 @@ const copySaveClick=async()=>{
         } else {
             window?.$message?.warning('pkeyId为空')
     }
-   }else{
+   } else {
     window?.$message?.warning('暂无相关接口')
    }
 }
@@ -663,24 +688,24 @@ const copySaveClick=async()=>{
 const copyClickModalLoading = ref(false)
 const copyClickLoading = ref(false)
 const copyClick = async (items) => {
-    const {pkeyId, isTableRender, isTableForm} = items
-    if (pkeyId) {
+    const { id, isTableRender, isTableForm } = items
+    if (id) {
         if (isStatus.value !== 3) {
             if (!isTableRender) {
-                await copeBussTab(pkeyId)
+                await copeBussTab(id)
             } else if (!isTableForm) {
                 window?.$message?.warning('暂无表单数据')
             } else if (isTableRender) {
                 copyClickLoading.value = true
                 const isSave = await saveExcelBussData(items, null, false)
                 if (isSave) {
-                    await copeBussTab(pkeyId)
+                    await copeBussTab(id)
                 } else {
                     copyClickLoading.value = false
                     window?.$message?.warning('复制本表操作失败')
                 }
             } else {
-                window?.$message?.warning(`数据异常了, isRenderTableForm: ${isTableRender}, isTableForm: ${isTableForm}, pkeyIds:${pkeyId}`)
+                window?.$message?.warning(`数据异常了, isRenderTableForm: ${isTableRender}, isTableForm: ${isTableForm}, pkeyIds:${id}`)
             }
         } else {
             window?.$message?.warning('已上报的资料,不允许复制')
@@ -689,7 +714,7 @@ const copyClick = async (items) => {
         window?.$message?.warning('pkeyId为空')
     }
  }
-const copyItems=ref([])
+const copyItems = ref([])
 //跨节点复制弹窗
 // const copyClick =  (items) => {
 //     showcopyModal.value=true
@@ -700,8 +725,8 @@ const copyItems=ref([])
 //复制表的请求
 const copeBussTab = async (pkeyId) => {
     copyClickLoading.value = true
-    const {error, code} = await wbsApi.copeBussTab({
-        pkeyId: pkeyId
+    const { error, code } = await landApi.copeTab({
+        id: pkeyId,
     })
     copyClickLoading.value = false
     if (!error && code === 200) {
@@ -710,33 +735,6 @@ const copeBussTab = async (pkeyId) => {
     }
 }
 
-//隐藏本表
-const tableFormHideLoading = ref(false)
-const hideClick = async ({pkeyId, isBussShow}) => {
-    if (pkeyId) {
-        if (isStatus.value !== 3) {
-            tableFormHideLoading.value = true
-            const bussShow = isBussShow === 2 ? 1 : 2 //状态(1显示 2隐藏)
-            const {error, code} = await wbsApi.showBussTab({
-                pkeyId: pkeyId,
-                status: bussShow
-            })
-            tableFormHideLoading.value = false
-            if (!error && code === 200) {
-                window?.$message?.success('操作成功')
-                if (bussShow === 2) {
-                    //判断是否存在窗口,如果存在,就删除窗口
-                    delWindowRefs(pkeyId)
-                }
-                renewData()
-            }
-        } else {
-            window?.$message?.warning('已上报的资料,不允许隐藏')
-        }
-    } else {
-        window?.$message?.warning('pkeyId为空')
-    }
-}
 
 //预览本表
 const tableFormPreviewLoading = ref(false)
@@ -748,11 +746,11 @@ const previewClick = async (item, dragItem = null) => {
 
 //上传变量
 const uploadModal = ref(false)
-const fileListData = ref([]);
+const fileListData = ref([])
 const uploadData = ref({})
 //上传附件
 const uploadClick = (items, index) => {
-    const {pkeyId, isTableForm, isTableRender} = items
+    const { pkeyId, isTableForm, isTableRender } = items
     const keyName = `item-${index}-${pkeyId}`
     if (pkeyId) {
         if (isStatus.value !== 3 && isTableForm) {
@@ -762,7 +760,7 @@ const uploadClick = (items, index) => {
                 contractId: contract_id.value,
                 classify: classifys.value,
                 pkeyId: pkeyId,
-                nodeId: treeId.value
+                nodeId: treeId.value,
             }
             //获取文件列表
             getBussFileList(pkeyId)
@@ -781,8 +779,8 @@ const uploadClick = (items, index) => {
 
 //获取文件列表
 const getBussFileList = async (pkeyId) => {
-    const {error, code, data} = await wbsApi.getBussFileList({
-        pkeyid: pkeyId
+    const { error, code, data } = await wbsApi.getBussFileList({
+        pkeyid: pkeyId,
     })
     if (!error && code === 200) {
         fileListData.value = getArrValue(data)
@@ -792,7 +790,7 @@ const getBussFileList = async (pkeyId) => {
 }
 
 //上传文件
-const uploadChange = async ({type}) => {
+const uploadChange = async ({ type }) => {
     if (type === 'success') {
         uploadModal.value = false
         renewData()
@@ -825,13 +823,13 @@ const tableFormSaveClick = async (item, dragItem = null) => {
 }
 
 //保存表单数据
-const saveExcelBussData = async ({pkeyId}, dragItem = null, showTip = true) => {
+const saveExcelBussData = async ({ id }, dragItem = null, showTip = true) => {
     setDragModalLoading(dragItem, '保存中...', true)
-    const refs = await getFormRef(pkeyId)
+    const refs = await getFormRef(id)
     const isRegExp = await refs?.isFormRegExp()
     if (isRegExp) {
         const formData = refs?.getFormData()
-        const {error, code} = await wbsApi.saveExcelBussData(formData)
+        const { error, code } = await landApi.saveBussData(formData)
         setDragModalLoading(dragItem)
         if (!error && code === 200) {
             if (showTip) {
@@ -848,10 +846,10 @@ const saveExcelBussData = async ({pkeyId}, dragItem = null, showTip = true) => {
 }
 
 //预览PDF
-const getBussPdfInfo = async ({pkeyId}, dragItem = null, showTip = true) => {
+const getBussPdfInfo = async ({ id }, dragItem = null, showTip = true) => {
     setDragModalLoading(dragItem, '获取pdf中...', true)
-    const {error, code, data} = await wbsApi.getBussPdfInfo({
-        pkeyId: pkeyId
+    const { error, code, data } = await landApi.getBussPdfInfo({
+        id: id,
     }, false)
     setDragModalLoading(dragItem)
     if (!error && code === 200) {
@@ -888,7 +886,7 @@ const setDragModalLoading = (dragItem, text = '保存中...', show = false) => {
 //获取表单的ref
 const getFormRef = async (pkeyId) => {
     const itemRef = itemRefs.value
-    const index = arrIndex(itemRef, 'pkeyId', pkeyId)
+    const index = arrIndex(itemRef, 'pKeyId', pkeyId)
     return itemRef[index].ref
 }
 
@@ -940,15 +938,15 @@ const getCollapseItemIndex = (name) => {
 const getTableFormSize = (pkeyId) => {
     let formId = `table-form-${pkeyId}`
     try {
-        const {clientWidth, clientHeight} = document.getElementById(formId).children[0]
+        const { clientWidth, clientHeight } = document.getElementById(formId).children[0]
         return {
             width: (clientWidth + 40) + 'px',
-            height: (clientHeight + 80) + 'px'
+            height: (clientHeight + 80) + 'px',
         }
     } catch {
         return {
             width: '100%',
-            height: '100%'
+            height: '100%',
         }
     }
 }
@@ -1014,51 +1012,51 @@ const setOnFuncFormRef = async () => {
     if (!isNullES(pkeyId)) {
         return await getFormRef(pkeyId)
     } else {
-        return;
+        return
     }
 }
 
 
 //获取已渲染的表单
 const getFilterFormData = async () => {
-    const formArr = formDataList.value;
+    const formArr = formDataList.value
     return formArr.filter((item) => {
-        return (item.pkeyId ?? '') !== '' && item.isCollapseLoad;
+        return (item.linkId ?? '') !== '' && item.isCollapseLoad
     })
 }
 
 //获取表单数据
 const getFormData = async () => {
-    const formArr = await getFilterFormData();
+    const formArr = await getFilterFormData()
     //获取表单数据
-    let newArr = [];
+    let newArr = []
     for (let i = 0; i < formArr.length; i++) {
-        const pkeyId = formArr[i].pkeyId
+        const pkeyId = formArr[i].linkId
         const refs = await getFormRef(pkeyId)
         const form = refs?.getFormData()
-        newArr.push({...form})
+        newArr.push({ ...form })
     }
-    console.log('表单数据', newArr)
+    console.log('表单数据1111', newArr)
     return newArr
 }
 
 //获取表单效验数据
 const getFormRegExpJson = async () => {
-    const formArr = await getFilterFormData();
+    const formArr = await getFilterFormData()
     const list = listDatas.value
     //获取表单数据
-    let formRegExpJson = {};
+    let formRegExpJson = {}
     for (let i = 0; i < formArr.length; i++) {
-        const pkeyId = formArr[i].pkeyId
-        const refs = await getFormRef(pkeyId)
+        const pKeyId = formArr[i].linkId
+        const refs = await getFormRef(pKeyId)
         const regExp = refs?.getRegExpJson()
         const nodeName = refs?.getNodeName()
         if (getObjVal(regExp)) {
-            const index = arrIndex(list, 'pkeyId', pkeyId)
-            formRegExpJson[pkeyId] = {
+            const index = arrIndex(list, 'pKeyId', pKeyId)
+            formRegExpJson[pKeyId] = {
                 ...regExp,
-                itemId: `item-${index}-${pkeyId}`,
-                nodeName: nodeName
+                itemId: `item-${index}-${pKeyId}`,
+                nodeName: nodeName,
             }
         }
     }
@@ -1067,12 +1065,12 @@ const getFormRegExpJson = async () => {
 
 //获取当前展开项
 const getActiveKey = () => {
-    return ActiveKey.value;
+    return ActiveKey.value
 }
 
 //设置当前展开项
 const setActiveKey = (key) => {
-    return ActiveKey.value = key;
+    return ActiveKey.value = key
 }
 
 // 暴露出去
@@ -1080,7 +1078,7 @@ defineExpose({
     getFormData,
     getFormRegExpJson,
     getActiveKey,
-    setActiveKey
+    setActiveKey,
 })
 </script>
 

+ 170 - 0
src/views/agree/special/components/HcUpload.vue

@@ -0,0 +1,170 @@
+<template>
+    <el-upload
+        :accept="accept" :action="action" :before-remove="delUploadData" :before-upload="beforeUpload"
+        :data="uploadData"
+        :disabled="isCanuploadVal" :file-list="fileListData" :headers="getTokenHeader()" :on-error="uploadError"
+        :on-exceed="uploadExceed" :on-preview="uploadPreview" :on-progress="uploadprogress"
+        :on-remove="uploadRemove" :on-success="uploadSuccess" class="hc-upload-border"
+        drag multiple
+    >
+        <div v-loading="uploadDisabled" :element-loading-text="loadingText" class="hc-upload-loading">
+            <HcIcon name="backup" ui="text-5xl mt-4" />
+            <div class="el-upload__text">
+                拖动文件到这里 或 <em>点击这里选择文件</em> 并上传
+            </div>
+        </div>
+        <template #tip>
+            <div class="el-upload__tip" style="font-size: 14px;">
+                {{ acceptTip }}
+            </div>
+        </template>
+    </el-upload>
+</template>
+
+<script setup>
+import { onMounted, ref, watch } from 'vue'
+import { getTokenHeader } from '~src/api/request/header'
+import landApi from '~api/agree/land.js'
+import { isFileSize } from 'js-fast-way'
+
+
+const props = defineProps({
+    fileList: {
+        type: Array,
+        default: () => ([]),
+    },
+    datas: {
+        type: Object,
+        default: () => ({}),
+    },
+    isCanupload:{
+        type:Boolean,
+        default:false,
+    },
+    action:{
+        type:String,
+        default:'/api/blade-manager/exceltab/add-buss-file',
+    },   
+    accept:{
+        type:String,
+        default:'image/png,image/jpg,image/jpeg,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/pdf,.doc,.docx,application/msword',
+    },
+    acceptTip:{
+        type:String,
+        default:'允许格式:jpg/png/pdf/excel/word, 文件大小 小于 60MB',
+    },
+    
+})
+
+//事件
+const emit = defineEmits(['change'])
+//变量
+const uploadData = ref(props.datas)
+const fileListData = ref(props.fileList)
+const action = ref(props.action)
+const accept = ref(props.accept)
+const acceptTip = ref(props.acceptTip)
+const uploadDisabled = ref(false)
+const isCanuploadVal = ref(props.isCanupload)
+
+//监听
+watch(() => [
+    props.fileList,
+    props.datas,
+    props.isCanupload,
+    props.action,
+    props.accept,
+    props.acceptTip,
+], ([fileList, datas, isCanupload, Action, Accept, Tip]) => {
+    uploadData.value = datas
+    fileListData.value = fileList
+    isCanuploadVal.value = isCanupload
+    action.value = Action
+    accept.value = Accept
+    acceptTip.value = Tip
+})
+
+//渲染完成
+onMounted(() => {
+    beforeFileNum.value = 0
+    finishFileNum.value = 0
+    errorFileNum.value = 0
+})
+
+//上传前
+const beforeFileNum = ref(0)
+const beforeUpload = async (file) => {
+    if (isFileSize(file?.size, 60)) {
+        beforeFileNum.value++
+        return true
+    } else {
+        window?.$message?.warning('文件大小, 不能过60M!')
+        return false
+    }
+}
+
+//超出限制时
+const uploadExceed = () => {
+    window?.$message?.warning('请上传 jpg/png/pdf/excel/word 的文件,文件大小 不超过60M')
+}
+
+//上传中
+const loadingText = ref('上传中...')
+const uploadprogress = () => {
+    loadingText.value = '上传中...'
+    uploadDisabled.value = true
+}
+
+//上传完成
+const finishFileNum = ref(0)
+const uploadSuccess = () => {
+    finishFileNum.value++
+    if (beforeFileNum.value === finishFileNum.value) {
+        uploadDisabled.value = false
+        emit('change', { type: 'success' })
+    }
+}
+
+//上传失败
+const errorFileNum = ref(0)
+const uploadError = () => {
+    errorFileNum.value++
+    window?.$message?.error('上传失败')
+    const num = finishFileNum.value + errorFileNum.value
+    if (beforeFileNum.value === num) {
+        uploadDisabled.value = false
+        emit('change', { type: 'success' })
+    }
+}
+
+//预览
+const uploadPreview = ({ url }) => {
+    if (url) {
+        window.open(url, '_blank')
+    }
+}
+
+//删除文件
+const delUploadData = async ({ id }) => {
+     
+        loadingText.value = '删除中...'
+        uploadDisabled.value = true
+        const { error, code } = await landApi.deleteFile({
+            ids: id,
+        })
+        uploadDisabled.value = false
+        if (!error && code === 200) {
+            window?.$message?.success('删除成功')
+            return true
+        } else {
+            return false
+        }
+    
+}
+
+const uploadRemove = () => {
+    if (fileListData.value.length <= 0) {
+        emit('change', { type: 'del' })
+    }
+}
+</script>

+ 151 - 27
src/views/agree/special/form.vue

@@ -1,57 +1,80 @@
 <template>
-    <HcCard actionUi="text-center">
+    <HcCard action-ui="text-center">
         <el-scrollbar ref="listItemScrollRef">
-            <CollapseForm ref="ListItemsRef"
-                          :classify="0"
-                          :contractId="0"
-                          :datas="[]"
-                          :primaryKeyId="0"
-                          :status="0"
-                          v-if="false"
+            <CollapseForm
+                v-if="ListItemDatas.length > 0"
+                ref="ListItemRef"
+                v-loading="ListItemLoading"
+                :classify="dataType"
+                :contract-id="0"
+                :datas="ListItemDatas"
+                :primary-key-id="0"
+                :status="0"
+                :area-id="areaId"
+                :agreement-id="agreementId"
+                @renew="updateGetTablesData(agreementId)"
             />
-            <HcStatus text="暂无表单"/>
+            <HcStatus v-else text="暂无表单" />
         </el-scrollbar>
         <template #action>
-            <!--el-button size="large" type="info" hc-btn @click="goBackClick">
-                <HcIcon name="arrow-go-back"/>
-                <span>取消并返回</span>
-            </el-button-->
-            <el-button size="large" type="primary" hc-btn>
-                <HcIcon name="check-double"/>
+            <el-button size="large" type="primary" hc-btn :loading="tableFormSaveLoading" @click="tableFormSaveClick">
+                <HcIcon name="check-double" />
                 <span>提交保存</span>
             </el-button>
             <el-button size="large" type="primary" hc-btn>
-                <HcIcon name="draft"/>
+                <HcIcon name="draft" />
                 <span>一键生成协议</span>
             </el-button>
-            <el-button size="large" type="warning" hc-btn>
-                <HcIcon name="eye"/>
+            <el-button size="large" type="warning" hc-btn :loading="bussPdfsLoading" @click="bussPdfsClick">
+                <HcIcon name="eye" />
                 <span>预览</span>
             </el-button>
-            <el-button size="large" type="success" hc-btn>
-                <HcIcon name="upload"/>
+            <el-button size="large" type="success" hc-btn @click="addFile">
+                <HcIcon name="upload" />
                 <span>上传附件协议</span>
             </el-button>
+            <el-button size="large" type="info" hc-btn @click="goBackClick">
+                <HcIcon name="arrow-go-back" />
+                <span>取消并返回</span>
+            </el-button>
         </template>
+        <HcDialog is-to-body :show="addModal" title="上传附件协议" @close="testModalClose">
+            <HcUpload :datas="uploadData" :file-list="fileListData" :is-canupload="false" action="/api/blade-manager/exceltab/add-bussfile-node" accept="application/pdf" accept-tip="允许格式:pdf" @change="uploadChange" />
+        </HcDialog>
     </HcCard>
 </template>
 
 <script setup>
-import {onActivated, ref} from "vue";
-import {useRoute, useRouter} from 'vue-router'
-import CollapseForm from "./collapse-form/index.vue"
+import { onActivated, ref } from 'vue'
+import { useRoute, useRouter } from 'vue-router'
+import CollapseForm from './collapse-form/index.vue'
+import landApi from '~api/agree/land.js'
+import { useAppStore } from '~src/store'
+import { getArrValue, getObjVal } from 'js-fast-way'
+import HcUpload from './components/HcUpload.vue'
 
+const useAppState = useAppStore()
+const projectId = ref(useAppState.getProjectId)
 const router = useRouter()
 const useRoutes = useRoute()
 
 //初始变量
-//const dataType = ref(useRoutes?.query?.type ?? 'view')
-//const dataId = ref(useRoutes?.query?.id ?? '')
+const dataType = ref(useRoutes?.query?.type ?? 'view')
+const agreementId = ref(useRoutes?.query?.id ?? '')
+const areaId = ref(useRoutes?.query?.areaId ?? '')
 
 //缓存页面被激活时
 onActivated(() => {
-    //dataType.value = useRoutes?.query?.type ?? 'view'
-    //dataId.value = useRoutes?.query?.id ?? ''
+    dataType.value = useRoutes?.query?.type ?? 'view'
+    agreementId.value = useRoutes?.query?.id ?? ''
+    areaId.value = useRoutes?.query?.areaId ?? ''
+    if (agreementId.value.length > 0) {
+        updateGetTablesData( agreementId.value)
+    } else {
+        searchNodeAllTable()
+    }
+    
+    
 })
 
 const listItemScrollRef = ref(null)
@@ -60,6 +83,107 @@ const listItemScrollRef = ref(null)
 const goBackClick = () => {
     router.back()
 }
+
+//获取数据列表
+const ListItemsRef = ref(null)
+const ListItemDatas = ref([])
+const ListItemLoading = ref(false)
+
+//新增获取表单列表id
+const searchNodeAllTable = async () => {
+    const { error, code, data } = await landApi.addGetTables({
+        projectId: projectId.value,
+        type: 1,
+        areaId:areaId.value,
+    
+    })
+    //处理数据
+
+    if (!error && code === 200) {
+        agreementId.value = data
+        updateGetTablesData(data)
+    } else {
+        agreementId.value = ''
+    }
+}
+//编辑获取表单列表
+const updateGetTablesData = async (id) => {
+    ListItemDatas.value = []
+    ListItemLoading.value = true
+    const { error, code, data } = await landApi.updateGetTables({
+        agreementId:id,
+    
+    })
+    //处理数据
+    ListItemLoading.value = false
+    if (!error && code === 200) {
+        ListItemDatas.value = getArrValue(data)
+    } else {
+        ListItemDatas.value = []
+    }
+}
+
+//保存
+const ListItemRef = ref(null)
+const tableFormSaveLoading = ref(false)
+const tableFormSaveClick = async () => {
+    //获取数据
+    let FormData = []
+        FormData = await ListItemRef.value?.getFormData()
+    //效验数据
+    if (FormData.length > 0) {
+        tableFormSaveLoading.value = true
+        FormData.forEach(ele => {
+            delete ele['pkeyId']
+        })
+        const { error, code, data } = await landApi.saveBussData({
+            dataInfo: { orderList: FormData },
+        })
+        tableFormSaveLoading.value = false
+        if (!error && code === 200) {
+            window?.$message?.success('保存成功')
+            dataType.value = 2
+             await bussPdfsClick()
+             updateGetTablesData(agreementId.value)
+        }
+    } else {
+        console.log('预览')
+        // await bussPdfsClick()
+    }
+}
+//多表预览
+const bussPdfsLoading = ref(false)
+const bussPdfsClick = async () => {
+    bussPdfsLoading.value = true
+    const { error, code, data } = await landApi.getBussPdfs({
+        agreementId:agreementId.value,
+    })
+    tableFormSaveLoading.value = false
+    bussPdfsLoading.value = false
+    if (!error && code === 200) {
+        window.open(data, '_blank')
+    } else {
+        window.$message?.warning('获取PDF失败')
+    }
+}
+//上传附件
+const addModal = ref(false)
+const testModalClose = ()=>{
+    addModal.value = false
+}
+const addFile = ()=>{
+    addModal.value = true
+}
+const uploadData = ref({})
+const fileListData = ref([])
+//上传文件
+const uploadChange = async ({ type }) => {
+    if (type === 'success') {
+        // getBussFileList(primaryKeyId.value)
+    } else if (type === 'del') {
+        // getBussFileList(primaryKeyId.value)
+    }
+}
 </script>
 
 <style lang="scss" scoped>

+ 133 - 115
src/views/agree/special/special.vue

@@ -3,88 +3,90 @@
         <template #left>
             <div class="hc-layout-tree-box">
                 <el-scrollbar>
-                    <HcTreeData @nodeTap="treeNodeTap"/>
+                    <HcTreeData @nodeTap="treeNodeTap" />
                 </el-scrollbar>
             </div>
         </template>
         <HcCard>
             <template #header>
                 <div class="w-52">
-                    <el-input v-model="searchForm.queryValue" clearable placeholder="请输入名称进行查询" size="large"/>
+                    <el-input v-model="searchForm.name" clearable placeholder="请输入名称进行查询" size="large" />
                 </div>
                 <div class="ml-4">
-                    <el-button type="primary" @click="searchClick" size="large">
-                        <HcIcon name="search-2"/>
+                    <el-button type="primary" size="large" @click="searchClick">
+                        <HcIcon name="search-2" />
                         <span>搜索</span>
                     </el-button>
                 </div>
             </template>
             <template #extra>
                 <el-button size="large" type="primary" hc-btn @click="addRowClick">
-                    <HcIcon name="add"/>
+                    <HcIcon name="add" />
                     <span>新增</span>
                 </el-button>
                 <el-button size="large" type="warning" hc-btn>
-                    <HcIcon name="add"/>
+                    <HcIcon name="add" />
                     <span>打印</span>
                 </el-button>
-                <el-button size="large" type="danger" hc-btn>
-                    <HcIcon name="delete-bin"/>
+                <el-button size="large" type="danger" hc-btn :disabled="tableCheckedKeys.length < 1" @click="batchDel">
+                    <HcIcon name="delete-bin" />
                     <span>删除</span>
                 </el-button>
             </template>
-            <div class="agree-special-card" :class="isTableRow?'info':''">
-                <div class="special-table-box">
-                    <div class="special-table">
-                        <HcTable :column="tableColumn" :datas="tableData" :loading="tableLoading" isCheck
-                                 @selection-change="tableSelectionChange" @row-click="tableRowClick"
-                        >
-                            <template #action="{row,index}">
-                                <el-button size="small" type="primary" @click="editRowClick(row)">修改</el-button>
-                                <el-button size="small" type="warning">查看</el-button>
-                                <el-button size="small" type="danger">删除</el-button>
-                            </template>
-                        </HcTable>
-                    </div>
-                    <div class="special-page">
-                        <HcPages :pages="searchForm" @change="pageChange"/>
-                    </div>
-                </div>
-                <div class="special-table-info">
-                    <HcCardItem title="已填写的专项设施信息详情" scrollbar>
-                        <HcTable :column="tableColumn1" :datas="tableData1"/>
-                    </HcCardItem>
-                </div>
-            </div>
+            <HcTable :column="tableColumn" :datas="tableData" :loading="tableLoading" is-check @selection-change="tableSelectionChange">
+                <template #action="{ row, index }">
+                    <el-button size="small" type="primary" @click="editRowClick(row)">
+                        修改
+                    </el-button>
+                    <el-button size="small" type="warning" @click="viewPdf(row)">
+                        查看
+                    </el-button>
+                    <el-button size="small" type="danger" @click="delAgree(row)">
+                        删除
+                    </el-button>
+                </template>
+            </HcTable>
+            <template #action>
+                <HcPages :pages="searchForm" @change="pageChange" />
+            </template>
         </HcCard>
     </HcPageLayout>
 </template>
 
 <script setup>
-import {ref} from "vue";
-import {useRouter} from 'vue-router'
-
+import { onActivated, ref } from 'vue'
+import { useRouter } from 'vue-router'
+import landApi from '~api/agree/land.js'
+import { useAppStore } from '~src/store'
+import { arrToId, getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
+const useAppState = useAppStore()
+const projectId = ref(useAppState.getProjectId)
 const router = useRouter()
-
+const areaId = ref('')
 //树节点被点击
-const treeNodeTap = ({node, data}) => {
-
+const treeNodeTap = ({ node, data }) => {
+    areaId.value = data.id
+    searchForm.value.areaId = data.id
+    getTableData()
 }
-
+onActivated(()=>{
+    getTableData()
+})
 //搜索表单
 const searchForm = ref({
-    projectType: null, queryValue: null, startTime: null, endTime: null,
-    current: 1, size: 20, total: 0
+    projectType: null, name: null, startTime: null, endTime: null,
+    current: 1, size: 20, total: 0,
 })
 
 //搜索
 const searchClick = () => {
-    searchForm.value.current = 1;
+    searchForm.value.current = 1
     getTableData()
 }
 
 //分页被点击
-const pageChange = ({current, size}) => {
+const pageChange = ({ current, size }) => {
     searchForm.value.current = current
     searchForm.value.size = size
     getTableData()
@@ -93,67 +95,115 @@ const pageChange = ({current, size}) => {
 //获取数据
 const tableLoading = ref(false)
 const tableColumn = [
-    {key: 'key1', name: '协议编号', width: 200},
-    {key: 'key2', name: '协议书名称', minWidth: 200},
-    {key: 'key3', name: '补偿总金额(万元)', width: 200},
-    {key: 'key4', name: '拆迁单位', width: 200},
-    {key: 'key5', name: '拆迁日期', width: 200},
-    {key: 'key6', name: '施工单位', minWidth: 200},
-    {key: 'key7', name: '甲方', minWidth: 200},
-    {key: 'key8', name: '乙方', minWidth: 200},
-    {key: 'key9', name: '丙方', minWidth: 200},
-    {key: 'action', name: '操作', width: '190', align: 'center', fixed: 'right'},
+    { key: 'number', name: '协议编号' },
+    { key: 'name', name: '协议书名称' },
+    { key: 'allMoney', name: '补偿总金额' },
+    { key: 'removeUnit', name: '被拆迁单位' },
+    { key: 'removeUnit', name: '拆迁日期' },
+    { key: 'removeUnit', name: '施工单位' },
+    { key: 'removeUnit', name: '甲方' },
+    { key: 'removeUnit', name: '乙方' },
+    { key: 'removeUnit', name: '丙方' },
+    { key: 'action', name: '操作', width: '190', align: 'center' },
 ]
 const tableData = ref([
-    {id: 1, key1: 'xxxx', key2: 'xxxx', key3: '65632'},
-    {id: 2, key1: 'xxxx', key2: 'xxxx', key3: '65632'},
-    {id: 3, key1: 'xxxx', key2: 'xxxx', key3: '65632'},
-    {id: 4, key1: 'xxxx', key2: 'xxxx', key3: '65632'},
-])
-const getTableData = () => {
 
+])
+const getTableData = async () => {
+    tableLoading.value = true
+    const { error, code, data } = await landApi.getPage({
+        ...searchForm.value,
+        projectId: projectId.value,
+        type:3,
+    })
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data['records'])
+        searchForm.value.total = data['total'] || 0
+    } else {
+        tableData.value = []
+        searchForm.value.total = 0
+    }
 }
 
 //多选事件
+const tableCheckedKeys = ref([])
 const tableSelectionChange = (rows) => {
-    console.log(rows)
+    tableCheckedKeys.value = rows
 }
 
-//详情
-const tableColumn1 = [
-    {key: 'key1', name: '拆迁桩号'},
-    {key: 'key2', name: '拆迁长度(公里)'},
-    {key: 'key3', name: '拆迁类型'},
-    {key: 'key4', name: '补偿标准(万元/公里)'},
-    {key: 'key5', name: '补偿金额(万元)'},
-    {key: 'key6', name: '备注'},
-]
-const tableData1 = ref([
-    {id: 1, key1: 'xxxx', key2: 'xxxx', key3: '65632'},
-    {id: 2, key1: 'xxxx', key2: 'xxxx', key3: '65632'},
-    {id: 3, key1: 'xxxx', key2: 'xxxx', key3: '65632'},
-    {id: 4, key1: 'xxxx', key2: 'xxxx', key3: '65632'},
-])
-
-const isTableRow = ref(false)
-const tableRowClick = () => {
-    isTableRow.value = true
-}
-
-
 //新增
 const addRowClick = () => {
     router.push({
-        name: 'lar-agree-special-form'
+        name: 'lar-agree-land-form',
+        query:{
+            type:1,
+            areaId:areaId.value,
+        },
     })
 }
 
 //编辑
 const editRowClick = (row) => {
     router.push({
-        name: 'lar-agree-special-form'
+        name: 'lar-agree-land-form',
+        query:{
+            type:2,
+            id:row.id,
+            areaId:areaId.value,
+        },
     })
 }
+//查看pdf
+const viewPdf = ({ mergePdfUrl }) => {
+    if (mergePdfUrl) {
+        window.open(mergePdfUrl, '_blank')
+    } else {
+        window.$message.error('暂无文件')
+    }
+}
+const delAgree = (row)=>{
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await landApi.remove({
+                            ids: row?.id,
+                        })
+                        if (!error && code === 200) {
+                            window?.$message?.success('删除成功')
+                            getTableData()
+                        } else {
+                            window?.$message?.warning(msg)
+                        }
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+     })
+}
+const batchDel = ()=>{
+    const rows = tableCheckedKeys.value
+    const ids = arrToId(rows)
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await landApi.remove({
+                            ids,
+                        })
+                        if (!error && code === 200) {
+                            window?.$message?.success('删除成功')
+                            getTableData()
+                        } else {
+                            window?.$message?.warning(msg)
+                        }
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+     })
+}
 </script>
 
 <style lang="scss" scoped>
@@ -162,36 +212,4 @@ const editRowClick = (row) => {
     height: 100%;
     padding: 18px;
 }
-.agree-special-card {
-    position: relative;
-    height: 100%;
-    .special-table-box {
-        position: relative;
-        height: 100%;
-        .special-table {
-            position: relative;
-            height: calc(100% - 52px);
-        }
-        .special-page {
-            position: relative;
-            margin-top: 20px;
-        }
-    }
-    .special-table-info {
-        position: relative;
-        margin-top: 0;
-        height: 0;
-        display: none;
-    }
-    &.info {
-        .special-table-box {
-            height: calc(100% - 335px);
-        }
-        .special-table-info {
-            margin-top: 34px;
-            height: 300px;
-            display: block;
-        }
-    }
-}
 </style>

+ 87 - 65
src/views/agree/tomb/collapse-form/form-item.vue

@@ -1,76 +1,88 @@
 <template>
-    <HcTableForm ref="tableFormRef"
-                 :cols="colsKeys"
-                 :form="tableFormInfo"
-                 :height="heights"
-                 :html="excelHtml"
-                 :loading="loading"
-                 :pid="activeKey"
-                 :pkey="keyId"
-                 :scroll="scroll"
-                 :width="widths"
-                 @excelBodyTap="excelTableFormClick"
-                 @render="tableFormRender"
-                 @rightTap="tableFormRightTap"
+    <HcTableForm
+        ref="tableFormRef"
+        :cols="colsKeys"
+        :form="tableFormInfo"
+        :height="heights"
+        :html="excelHtml"
+        :loading="loading"
+        :pid="activeKey"
+        :pkey="keyId"
+        :scroll="scroll"
+        :width="widths"
+        @excelBodyTap="excelTableFormClick"
+        @render="tableFormRender"
+        @rightTap="tableFormRightTap"
     />
 </template>
 
 <script setup>
-import {ref, watch, onMounted} from "vue"
-import {useAppStore} from "~src/store";
-import wbsApi from "~api/data-fill/wbs";
-import {deepClone, getArrValue, getObjVal, isString} from "js-fast-way"
+import { onMounted, ref, watch } from 'vue'
+import { useAppStore } from '~src/store'
+import landApi from '~api/agree/land.js'
+import { deepClone, getArrValue, getObjVal, isString } from 'js-fast-way'
 
 //初始
 const props = defineProps({
-    tid: { // 树节点
+    areaId: { // 树节点
         type: [String, Number],
-        default: ''
+        default: '',
     },
     kid: { // pkeyId
         type: [String, Number],
-        default: ''
+        default: '',
     },
-    classify: { // 类型
+    classify: { // 类型1新增,2是编辑
         type: [String, Number],
-        default: ''
+        default: '',
     },
     scroll: {
         type: Boolean,
-        default: true
+        default: true,
     },
     height: {
         type: String,
-        default: '100%'
+        default: '100%',
     },
     width: {
         type: String,
-        default: 'auto'
+        default: 'auto',
     },
     datas: {
         type: Object,
-        default: () => ({})
-    },
-    nodeName: { // 表单名称
-        type: String,
-        default: ''
+        default: () => ({}),
     },
+   
     pid: { // 折叠ID
         type: String,
-        default: ''
+        default: '',
+    },
+ 
+    tableId:{
+        type: [String, Number],
+        default: '', //表单initTableId
+    },
+    agreementId:{
+        type: [String, Number],
+        default: '', //协议ID
     },
+
+   
 })
 
+//事件
+const emit = defineEmits(['rightTap', 'render', 'excelBodyTap'])
 //初始变量
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
 const contractId = ref(useAppState.getContractId)
 const keyId = ref(props.kid ? props.kid + '' : '')
-const treeId = ref(props.tid)
+const areaId = ref(props.areaId)
+const agreementId = ref(props.agreementId)
 const classify = ref(props.classify)
 const loading = ref(false)
 const changeData = ref(props.datas)
-const nodeNames = ref(props.nodeName)
+
 
 const heights = ref(props.height)
 const widths = ref(props.width)
@@ -78,38 +90,46 @@ const activeKey = ref(props.pid)
 
 const tableFormRef = ref(null)
 
+const tableId = ref(props.tableId)
+
 //监听
 watch(() => [
     useAppState.getProjectId,
     useAppState.getContractId,
-    props.tid,
+    props.areaId,
     props.kid,
     props.classify,
     props.nodeName,
     props.height,
     props.width,
     props.pid,
+
+    props.tableId,
+    props.agreementId,
 ], (
-    [project_id, contract_id, tree_id, key_id, cid, nodeName, height, width, pid]
+    [project_id, contract_id, area_id, key_id, cid, height, width, pid, , table_id, aeement_id],
 ) => {
     projectId.value = project_id
     contractId.value = contract_id
-    treeId.value = tree_id
+    areaId.value = area_id
     keyId.value = key_id ? key_id + '' : ''
     classify.value = cid
-    nodeNames.value = nodeName
+  
     heights.value = height
     widths.value = width
     activeKey.value = pid
+
+    tableId.value = table_id
+    agreementId.value = aeement_id
 })
 
 //深度监听变动的对象数据
 watch(() => [
-    props.datas
+    props.datas,
 ], ([data]) => {
     changeData.value = data
     setFormChangeData(data)
-}, {deep: true})
+}, { deep: true })
 
 
 //渲染完成
@@ -124,9 +144,6 @@ onMounted(async () => {
     loading.value = false
 })
 
-//事件
-const emit = defineEmits(['rightTap', 'render', 'excelBodyTap'])
-
 //表单被点击
 const excelTableFormClick = (item) => {
     emit('excelBodyTap', item)
@@ -135,12 +152,20 @@ const excelTableFormClick = (item) => {
 //获取表单初始数据
 const getFormDataInit = () => {
     return {
+        // projectId: projectId.value,
+        // contractId: contractId.value,
+        // classify: classify.value,
+        // pkeyId: keyId.value,
+        // nodeId: treeId.value,
+        // isRenderForm: false,
+    
+        agreementId: agreementId.value, //	协议的id,新增协议为null
+        areaId:areaId.value, //当前树节点id
         projectId: projectId.value,
-        contractId: contractId.value,
-        classify: classify.value,
-        pkeyId: keyId.value,
-        nodeId: treeId.value,
+        tableId:tableId.value, //表单的tableId
         isRenderForm: false,
+        linkId: keyId.value,
+    
     }
 }
 
@@ -148,20 +173,20 @@ const getFormDataInit = () => {
 const tableFormInfo = ref({})
 const getTableFormInfo = async (pkeyId) => {
     if (pkeyId) {
-        const {error, code, data} = await wbsApi.getBussDataInfo({
-            pkeyId: pkeyId
+        const { error, code, data } = await landApi.getBussInfo({
+            id: pkeyId,
         }, false)
         const resData = getObjVal(data)
         if (!error && code === 200 && resData) {
             tableFormInfo.value = {
                 ...resData,
                 ...getFormDataInit(),
-                ...changeData.value
+                ...changeData.value,
             }
         } else {
             tableFormInfo.value = {
                 ...getFormDataInit(),
-                ...changeData.value
+                ...changeData.value,
             }
         }
     } else {
@@ -174,19 +199,20 @@ const getTableFormInfo = async (pkeyId) => {
 const colsKeys = ref([])
 const getHtmlBussColsApi = async (pkeyId) => {
     if (pkeyId) {
-        const {error, code, data} = await wbsApi.getHtmlBussCols({
-            pkeyId: pkeyId
+        const { error, code, data } = await landApi.getBussCols({
+            id: pkeyId,
+       
         }, false)
         if (!error && code === 200) {
-            let keys = getArrValue(data);
+            let keys = getArrValue(data)
             for (let i = 0; i < keys.length; i++) {
                 if (keys[i].length <= 0) {
                     keys.splice(i, 1)
                 }
             }
-            colsKeys.value = keys;
+            colsKeys.value = keys
         } else {
-            colsKeys.value = [];
+            colsKeys.value = []
         }
     } else {
         colsKeys.value = []
@@ -197,8 +223,8 @@ const getHtmlBussColsApi = async (pkeyId) => {
 const excelHtml = ref('')
 const getExcelHtml = async (pkeyId) => {
     if (pkeyId) {
-        const {error, code, data} = await wbsApi.getExcelHtml({
-            pkeyId: pkeyId
+        const { error, code, data } = await landApi.getExcelHtml({
+            id: pkeyId,
         }, false)
         const resData = isString(data) ? data || '' : ''
         if (!error && code === 200 && resData) {
@@ -229,8 +255,7 @@ const tableFormRightTap = (item) => {
 //设置数据
 const setFormChangeData = (data) => {
     const form = deepClone(tableFormInfo.value)
-    tableFormInfo.value = {...form, ...data}
-    //console.log('设置数据', {...form, ...data})
+    tableFormInfo.value = { ...form, ...data }
 }
 
 const getFormData = () => {
@@ -251,10 +276,7 @@ const isFormRegExp = async () => {
     return await tableFormRef.value?.isFormRegExp()
 }
 
-//获取表单名称
-const getNodeName = () => {
-    return nodeNames.value
-}
+
 
 //按下ctrl键
 const setIsCtrlKey = (data) => {
@@ -277,9 +299,9 @@ defineExpose({
     setFormData,
     getRegExpJson,
     isFormRegExp,
-    getNodeName,
+
     setIsCtrlKey,
     setCopyKeyList,
-    setPasteKeyList
+    setPasteKeyList,
 })
 </script>

+ 174 - 176
src/views/agree/tomb/collapse-form/index.vue

@@ -1,28 +1,37 @@
 <template>
     <div class="data-fill-list-box">
         <el-collapse v-model="ActiveKey" accordion @change="CollapseChange">
-            <template v-for="(item,index) in listDatas" :key="item?.pkeyId">
-                <el-collapse-item :id="`item-${index}-${item?.pkeyId}`" :name="`item-${index}-${item?.pkeyId}`">
+            <template v-for="(item, index) in listDatas" :key="item?.id">
+                <el-collapse-item :id="`item-${index}-${item?.id}`" :name="`item-${index}-${item?.id}`">
                     <template #title>
                         <div class="hc-collapse-item-header">
-                            <div class="text-lg truncate item-title"> {{ item.nodeName }}</div>
+                            <div class="text-lg truncate item-title">
+                                {{ item.tableName }}
+                            </div>
                             <div class="hc-extra-text-box">
-                                <el-button :loading="copyClickLoading" plain type="primary" @click.stop="copyClick(item,index)">复制本表</el-button>
+                                <el-button :loading="copyClickLoading" plain type="primary" @click.stop="copyClick(item, index)">
+                                    复制本表
+                                </el-button>
                             </div>
                         </div>
                     </template>
                     <div class="data-fill-list-item-content">
-                        <TableFormItem v-if="item.isTableRender"
-                                       :ref="(el) => setItemRefs(el, item)"
-                                       :classify="classifys"
-                                       :datas="changeFormDatas(item?.pkeyId, 'collapse')"
-                                       :kid="item?.pkeyId"
-                                       :nodeName="item.nodeName"
-                                       :pid="`table-form-${item?.pkeyId}`"
-                                       :tid="treeId"
-                                       @excelBodyTap="excelTableFormClick($event)"
-                                       @render="tableFormRender($event, item, index)"
-                                       @rightTap="tableFormRightTap($event, index)"
+                        <TableFormItem
+                            v-if="item.isTableRender"
+                            :ref="(el) => setItemRefs(el, item)"
+                            :classify="classifys"
+                            :datas="changeFormDatas(item?.id, 'collapse')"
+                            :kid="item?.id"
+                            :node-name="item.nodeName"
+                            :node-type="item.nodeType"
+                            :pid="`table-form-${item?.id}`"
+                            :area-id="areaId"
+                            :table-id="item.tableId"
+                            :agreement-id="agreementId"
+                            style="width: 100%;"
+                            @excelBodyTap="excelTableFormClick($event)"
+                            @render="tableFormRender($event, item, index)"
+                            @rightTap="tableFormRightTap($event, index)"
                         />
                     </div>
                 </el-collapse-item>
@@ -32,70 +41,83 @@
 </template>
 
 <script setup>
-import {ref, watch, nextTick, onActivated, onDeactivated, onMounted, onUnmounted} from "vue";
-import HTableForm from "~src/plugins/HTableForm"
-import {useAppStore} from "~src/store";
-import wbsApi from "~api/data-fill/wbs"
-import TableFormItem from "./form-item.vue"
+import { nextTick, onActivated, onDeactivated, onMounted, onUnmounted, ref, watch } from 'vue'
+import HTableForm from '~src/plugins/HTableForm'
+import { useAppStore } from '~src/store'
+import landApi from '~api/agree/land.js'
+import TableFormItem from './form-item.vue'
 import {
-    getArrValue, getObjValue, getObjVal,
-    isNullES, deepClone, arrIndex, setPosRange
-} from "js-fast-way"
-
-//初始变量
-const useAppState = useAppStore()
+    arrIndex, deepClone, getArrValue,
+    getObjVal, getObjValue, isNullES, setPosRange,
+} from 'js-fast-way'
 
 //参数
 const props = defineProps({
     datas: {
         type: Array,
-        default: () => ([])
+        default: () => ([]),
     },
     classify: {
         type: [String, Number],
-        default: ''
+        default: '',
     },
     status: {
         type: [String, Number],
-        default: ''
+        default: '',
     },
     primaryKeyId: {
         type: [String, Number],
-        default: ''
+        default: '',
     },
     contractId: {
         type: [String, Number],
-        default: ''
+        default: '',
     },
     drawType: {
         type: Boolean,
-        default: false
+        default: false,
     },
     wbsTempId: {
         type: [String, Number],
-        default: ''
+        default: '',
     },
     tenantId: {
         type: [String, Number],
-        default: ''
+        default: '',
     },
     wbsType: {
         type: [String, Number],
-        default: ''
+        default: '',
+    },
+    areaId:{
+        type: String,
+        default: '',
+    }, //当前树节点
+    agreementId:{
+        type: [String, Number],
+        default: '',
     },
 })
 
+//事件
+const emit = defineEmits(['renew', 'offsetTop'])
+
+//初始变量
+const useAppState = useAppStore()
+
 //全局变量
-const projectId = ref(useAppState.projectId);
+const projectId = ref(useAppState.projectId)
 const contract_id = ref(props.contractId)
 const treeId = ref(props.primaryKeyId)
 const classifys = ref(props.classify)
-const wbsTemp_id = ref(props.wbsTempId);
-const tenant_id = ref(props.tenantId);
-const wbs_type = ref(props.wbsType);
+const wbsTemp_id = ref(props.wbsTempId)
+const tenant_id = ref(props.tenantId)
+const wbs_type = ref(props.wbsType)
 const isStatus = ref(parseInt(props.status))
 const listDatas = ref([])
 const draw_type = ref(props.drawType)
+const areaId = ref(props.areaId)
+const agreementId = ref(props.agreementId)
 
 
 //表单变量
@@ -105,24 +127,24 @@ const formparentId = ref('')
 
 //处理ref
 const itemRefs = ref([])
-const setItemRefs = (el, {pkeyId}) => {
+const setItemRefs = (el, { id }) => {
     if (el) {
-        let index = arrIndex(itemRefs.value, 'pkeyId', pkeyId)
+        let index = arrIndex(itemRefs.value, 'pKeyId', id)
         if (index !== -1) {
             itemRefs.value[index].ref = el
         } else {
             itemRefs.value.push({
-                pkeyId: pkeyId,
-                ref: el
-            });
+                pKeyId: id,
+                ref: el,
+            })
         }
     }
 }
 
 //处理表单的ref
-const setSpliceItemRefs = async ({pkeyId}) => {
+const setSpliceItemRefs = async ({ pKeyId }) => {
     const refs = itemRefs.value
-    let index = arrIndex(refs, 'pkeyId', pkeyId)
+    let index = arrIndex(refs, 'pKeyId', pKeyId)
     if (index !== -1) {
         refs.splice(index, 1)
         itemRefs.value = refs
@@ -130,25 +152,22 @@ const setSpliceItemRefs = async ({pkeyId}) => {
 }
 
 const closeIconArr = [
-    {key: 'reduction', icon: 'picture-in-picture-2', name: '还原到面板内,并自动展开面板'}
+    { key: 'reduction', icon: 'picture-in-picture-2', name: '还原到面板内,并自动展开面板' },
 ]
 
-//事件
-const emit = defineEmits(['renew', 'offsetTop'])
-
 //组件参数变量
-const apis = ref({
-    dataInfo: wbsApi.getBussDataInfo,
-    bussCols: wbsApi.getHtmlBussCols,
-    excelHtml: wbsApi.getExcelHtml
-})
+// const apis = ref({
+//     dataInfo: wbsApi.getBussDataInfo,
+//     bussCols: wbsApi.getHtmlBussCols,
+//     excelHtml: wbsApi.getExcelHtml,
+// })
 
 //深度监听数据
 watch(() => [
     props.datas,
 ], ([datas]) => {
     setFormDataNum(datas)
-}, {deep: true})
+}, { deep: true })
 
 //监听变量值
 watch(() => [
@@ -160,7 +179,9 @@ watch(() => [
     props.status,
     props.classify,
     props.primaryKeyId,
-], ([pid, cid, temp_id, tid, type, status, class_id, tree_id]) => {
+    props.areaId,
+    props.agreementId,
+], ([pid, cid, temp_id, tid, type, status, class_id, tree_id, area_id, agreement_id]) => {
     projectId.value = pid
     contract_id.value = cid
     wbsTemp_id.value = temp_id
@@ -169,25 +190,27 @@ watch(() => [
     isStatus.value = parseInt(status)
     classifys.value = class_id
     treeId.value = tree_id
+    areaId.value = area_id
+    agreementId.value = agreement_id
 })
 
 //渲染完成
 onMounted(() => {
     setFormDataNum(props.datas)
     setTableFormMenu(useAppState.projectInfo)
-    const {offsetHeight} = document.body
+    const { offsetHeight } = document.body
     DragModalHeight.value = offsetHeight - 200
     setMountOnEventKey()
 })
 
 //处理变动的数据
 const changeFormData = ref({
-    'window': [],
-    'collapse': [],
+    window: [],
+    collapse: [],
 })
-const changeFormDatas = (pkeyId, type) => {
+const changeFormDatas = (pKeyId, type) => {
     const changeData = changeFormData.value[type]
-    const index = arrIndex(changeData, 'pkeyId', pkeyId)
+    const index = arrIndex(changeData, 'pKeyId', pKeyId)
     if (index !== -1) {
         return changeData[index]
     } else {
@@ -196,11 +219,11 @@ const changeFormDatas = (pkeyId, type) => {
 }
 
 //设置变动的数据
-const setChangeFormDatas = async (pkeyId, type) => {
-    const refs = await getFormRef(pkeyId)
+const setChangeFormDatas = async (pKeyId, type) => {
+    const refs = await getFormRef(pKeyId)
     const formData = refs?.getFormData()
     const changeData = changeFormData.value[type]
-    const index = arrIndex(changeData, 'pkeyId', pkeyId)
+    const index = arrIndex(changeData, 'pKeyId', pKeyId)
     if (index !== -1) {
         changeData[index] = formData
     } else {
@@ -210,15 +233,17 @@ const setChangeFormDatas = async (pkeyId, type) => {
 }
 
 //展开事件
+
 const ActiveKey = ref('')
 const CollapseChange = (name) => {
     ActiveKey.value = name
     let index = getCollapseItemIndex(name)
     if (index > -1) {
-        getOffsetTop(name);
+        getOffsetTop(name)
         const item = listDatas.value[index]
-        formKeyIds.value = setToString(item.pkeyId)
+        formKeyIds.value = setToString(item.id)
         formparentId.value = setToString(item.parentId)
+    
         nextTick(() => {
             if (!item.isTableRender) {
                 item.isTableRender = true
@@ -235,9 +260,9 @@ const CollapseChange = (name) => {
 const setFormDataNum = (datas) => {
     itemRefs.value = []
     ActiveKey.value = ''
-    let newArr = [];
+    let newArr = []
     for (let i = 0; i < datas.length; i++) {
-        newArr.push({isCollapseLoad: false})
+        newArr.push({ isCollapseLoad: false })
     }
     formDataList.value = newArr
     listDatas.value = deepClone(datas)
@@ -262,24 +287,24 @@ const setTableFormMenu = (info) => {
     let newArr = [], infos = getObjValue(info)
     const isOpen = infos['isOpenRandomNumber'] ?? 0
     if (isOpen === 1 && isStatus.value !== 3) {
-        newArr.push({label: '插入设计值/频率', key: "design"})
+        newArr.push({ label: '插入设计值/频率', key: 'design' })
     }
-    newArr.push({label: '插入特殊字符', key: "special"})
-    newArr.push({label: '关联试验数据', key: "test"})
-    newArr.push({label: '关联试验文件', key: "file"})
-    newArr.push({label: '公式参数', key: "formula"})
+    newArr.push({ label: '插入特殊字符', key: 'special' })
+    newArr.push({ label: '关联试验数据', key: 'test' })
+    newArr.push({ label: '关联试验文件', key: 'file' })
+    newArr.push({ label: '公式参数', key: 'formula' })
     tableFormMenu.value = newArr
 }
 
 //鼠标右键事件
-const tableFormRightTap = ({event, KeyName, startPos, endPos, pkeyId}, index) => {
+const tableFormRightTap = ({ event, KeyName, startPos, endPos, pkeyId }, index) => {
     //存储临时信息
-    tableFormItemNode.value = {KeyName, index, startPos, endPos, pkeyId}
+    tableFormItemNode.value = { KeyName, index, startPos, endPos, pkeyId }
     contextMenuRef.value?.showMenu(event, false) //展开菜单
 }
 
 //鼠标右键菜单被点击
-const handleMenuSelect = ({key}) => {
+const handleMenuSelect = ({ key }) => {
     if (key === 'design') {
         setInitDesignForm()
         designModalLoading.value = false
@@ -291,7 +316,7 @@ const handleMenuSelect = ({key}) => {
         testModal.value = true
     } else if (key === 'file') {
         fileModalLoading.value = false
-        fileModal.value = true;
+        fileModal.value = true
     } else if (key === 'formula') {
         formulaModalLoading.value = false
         formulaModal.value = true
@@ -308,18 +333,18 @@ const setInitDesignForm = () => {
     formDesignModel.value = {
         type: 1, design: '', size: '',
         dev: '', key: '', capacity: '',
-        pass: '', pkId: ''
+        pass: '', pkId: '',
     }
 }
 
 //设计值频率计算
 const designModalLoading = ref(false)
 const designModalSave = async () => {
-    const {pkeyId, KeyName} = tableFormItemNode.value
+    const { pkeyId, KeyName } = tableFormItemNode.value
     if (pkeyId) {
         designModalLoading.value = true
         //const {design, size} = formDesignModel.value
-        const {error, code, data} = await wbsApi.queryFormulaRange({
+        const { error, code, data } = await wbsApi.queryFormulaRange({
             ...formDesignModel.value,
             // dev: (!design && !size) ? '±5': '',
             key: KeyName,
@@ -373,11 +398,11 @@ const specialRef = ref(null)
 const specialNodeClick = async () => {
     specialModalLoading.value = true
     const itemNode = tableFormItemNode.value
-    const {KeyName, pkeyId} = itemNode
+    const { KeyName, pkeyId } = itemNode
     try {
         const refs = await getFormRef(pkeyId)
         const itemFormData = refs?.getFormData()
-        const {code, val, posVal} = await specialRef.value?.getSpecialNode(itemNode, itemFormData[KeyName])
+        const { code, val, posVal } = await specialRef.value?.getSpecialNode(itemNode, itemFormData[KeyName])
         if (code === 200 && val) {
             itemFormData[KeyName] = val
             refs?.setFormData(itemFormData)
@@ -407,7 +432,7 @@ const testModalLoading = ref(false)
 //关联试验数据被点击
 const itinsertTableId = ref('')
 const itinsertTreeId = ref('')
-const testTableRowName = ({row, treeId}) => {
+const testTableRowName = ({ row, treeId }) => {
     itinsertTableId.value = row.id
     itinsertTreeId.value = treeId
     insertDataLoading.value = false
@@ -421,19 +446,19 @@ const testModalClose = () => {
 }
 
 //选择要插入的实验数据
-const insertDataShow = ref(false);
-const insertDataLoading = ref(false);
+const insertDataShow = ref(false)
+const insertDataLoading = ref(false)
 
 //确定关联试验数据数据
 const insertDataRef = ref(null)
 const submitinsertData = async () => {
     insertDataLoading.value = true
     const itemNode = tableFormItemNode.value
-    const {KeyName, pkeyId} = itemNode
+    const { KeyName, pkeyId } = itemNode
     try {
         const refs = await getFormRef(pkeyId)
         const itemFormData = refs?.getFormData()
-        const {code, val, posVal} = await insertDataRef.value?.submitinsertData(itemNode, itemFormData[KeyName])
+        const { code, val, posVal } = await insertDataRef.value?.submitinsertData(itemNode, itemFormData[KeyName])
         if (code === 200 && val) {
             itemFormData[KeyName] = val
             refs?.setFormData(itemFormData)
@@ -505,7 +530,7 @@ const windowClick = async (item, indexs) => {
         const formSize = getTableFormSize(item?.pkeyId)
         const newTableForm = {
             ...setInitDragModalTableForm(item, indexs),
-            ...formSize
+            ...formSize,
         }
         await setChangeFormDatas(item?.pkeyId, 'window')
         item.isWindow = true
@@ -549,12 +574,12 @@ const setInitDragModalTableForm = (item, index) => {
         title: item.nodeName,
         isShow: true,
         index: index,
-        item: item
+        item: item,
     }
 }
 
 //关闭窗口
-const TableFormClose = async ({pkeyId, index}, indexs) => {
+const TableFormClose = async ({ pkeyId, index }, indexs) => {
     const list = deepClone(DragModalTableForm.value)
     //取表单的数据
     await setChangeFormDatas(pkeyId, 'collapse')
@@ -565,21 +590,21 @@ const TableFormClose = async ({pkeyId, index}, indexs) => {
 }
 
 const dragNodeMoreMenu = [
-    {key: 'save', icon: 'save-2', name: '保存'},
-    {key: 'preview', icon: 'eye', name: '预览'},
+    { key: 'save', icon: 'save-2', name: '保存' },
+    { key: 'preview', icon: 'eye', name: '预览' },
 ]
 
 //还原窗口
 const closeIconTap = async (event, item, indexs) => {
-    const {index, pkeyId} = item
+    const { index, pkeyId } = item
     let KeyId = `item-${index}-${pkeyId}`
     await TableFormClose(item, indexs)
     ActiveKey.value = KeyId
 }
 
 //菜单被点击
-const dragNodeMoreMenuTap = ({key}, items) => {
-    const {item} = items
+const dragNodeMoreMenuTap = ({ key }, items) => {
+    const { item } = items
     if (key === 'save') {
         if (item?.isTableForm) {
             tableFormSaveClick(item, items)
@@ -597,11 +622,11 @@ const dragNodeMoreMenuTap = ({key}, items) => {
 
 //删除本表
 const tableFormDelLoading = ref(false)
-const delClick = async ({pkeyId}) => {
+const delClick = async ({ pkeyId }) => {
     if (pkeyId) {
         if (isStatus.value !== 3) {
             tableFormDelLoading.value = true
-            const {error, code} = await wbsApi.removeBussTabInfo({
+            const { error, code } = await wbsApi.removeBussTabInfo({
                 pkeyid: pkeyId,
                 classify: classifys.value,
             })
@@ -620,17 +645,17 @@ const delClick = async ({pkeyId}) => {
     }
 }
 //复制本表相关
-const showcopyModal=ref(false)
-const copyRefs=ref(null)
-const copyModalClose=()=>{
+const showcopyModal = ref(false)
+const copyRefs = ref(null)
+const copyModalClose = ()=>{
     // copyModal.value=false
 }
-const CopyModalType=ref('1')
+const CopyModalType = ref('1')
 
-const copySaveClick=async()=>{
+const copySaveClick = async ()=>{
     //本节点复制
-   if(CopyModalType.value==='2'){
-        const {pkeyId, isTableRender, isTableForm} =  copyItems.value
+   if (CopyModalType.value === '2') {
+        const { pkeyId, isTableRender, isTableForm } = copyItems.value
         if (pkeyId) {
             if (isStatus.value !== 3) {
                 if (!isTableRender) {
@@ -655,7 +680,7 @@ const copySaveClick=async()=>{
         } else {
             window?.$message?.warning('pkeyId为空')
     }
-   }else{
+   } else {
     window?.$message?.warning('暂无相关接口')
    }
 }
@@ -663,24 +688,24 @@ const copySaveClick=async()=>{
 const copyClickModalLoading = ref(false)
 const copyClickLoading = ref(false)
 const copyClick = async (items) => {
-    const {pkeyId, isTableRender, isTableForm} = items
-    if (pkeyId) {
+    const { id, isTableRender, isTableForm } = items
+    if (id) {
         if (isStatus.value !== 3) {
             if (!isTableRender) {
-                await copeBussTab(pkeyId)
+                await copeBussTab(id)
             } else if (!isTableForm) {
                 window?.$message?.warning('暂无表单数据')
             } else if (isTableRender) {
                 copyClickLoading.value = true
                 const isSave = await saveExcelBussData(items, null, false)
                 if (isSave) {
-                    await copeBussTab(pkeyId)
+                    await copeBussTab(id)
                 } else {
                     copyClickLoading.value = false
                     window?.$message?.warning('复制本表操作失败')
                 }
             } else {
-                window?.$message?.warning(`数据异常了, isRenderTableForm: ${isTableRender}, isTableForm: ${isTableForm}, pkeyIds:${pkeyId}`)
+                window?.$message?.warning(`数据异常了, isRenderTableForm: ${isTableRender}, isTableForm: ${isTableForm}, pkeyIds:${id}`)
             }
         } else {
             window?.$message?.warning('已上报的资料,不允许复制')
@@ -689,7 +714,7 @@ const copyClick = async (items) => {
         window?.$message?.warning('pkeyId为空')
     }
  }
-const copyItems=ref([])
+const copyItems = ref([])
 //跨节点复制弹窗
 // const copyClick =  (items) => {
 //     showcopyModal.value=true
@@ -700,8 +725,8 @@ const copyItems=ref([])
 //复制表的请求
 const copeBussTab = async (pkeyId) => {
     copyClickLoading.value = true
-    const {error, code} = await wbsApi.copeBussTab({
-        pkeyId: pkeyId
+    const { error, code } = await landApi.copeTab({
+        id: pkeyId,
     })
     copyClickLoading.value = false
     if (!error && code === 200) {
@@ -710,33 +735,6 @@ const copeBussTab = async (pkeyId) => {
     }
 }
 
-//隐藏本表
-const tableFormHideLoading = ref(false)
-const hideClick = async ({pkeyId, isBussShow}) => {
-    if (pkeyId) {
-        if (isStatus.value !== 3) {
-            tableFormHideLoading.value = true
-            const bussShow = isBussShow === 2 ? 1 : 2 //状态(1显示 2隐藏)
-            const {error, code} = await wbsApi.showBussTab({
-                pkeyId: pkeyId,
-                status: bussShow
-            })
-            tableFormHideLoading.value = false
-            if (!error && code === 200) {
-                window?.$message?.success('操作成功')
-                if (bussShow === 2) {
-                    //判断是否存在窗口,如果存在,就删除窗口
-                    delWindowRefs(pkeyId)
-                }
-                renewData()
-            }
-        } else {
-            window?.$message?.warning('已上报的资料,不允许隐藏')
-        }
-    } else {
-        window?.$message?.warning('pkeyId为空')
-    }
-}
 
 //预览本表
 const tableFormPreviewLoading = ref(false)
@@ -748,11 +746,11 @@ const previewClick = async (item, dragItem = null) => {
 
 //上传变量
 const uploadModal = ref(false)
-const fileListData = ref([]);
+const fileListData = ref([])
 const uploadData = ref({})
 //上传附件
 const uploadClick = (items, index) => {
-    const {pkeyId, isTableForm, isTableRender} = items
+    const { pkeyId, isTableForm, isTableRender } = items
     const keyName = `item-${index}-${pkeyId}`
     if (pkeyId) {
         if (isStatus.value !== 3 && isTableForm) {
@@ -762,7 +760,7 @@ const uploadClick = (items, index) => {
                 contractId: contract_id.value,
                 classify: classifys.value,
                 pkeyId: pkeyId,
-                nodeId: treeId.value
+                nodeId: treeId.value,
             }
             //获取文件列表
             getBussFileList(pkeyId)
@@ -781,8 +779,8 @@ const uploadClick = (items, index) => {
 
 //获取文件列表
 const getBussFileList = async (pkeyId) => {
-    const {error, code, data} = await wbsApi.getBussFileList({
-        pkeyid: pkeyId
+    const { error, code, data } = await wbsApi.getBussFileList({
+        pkeyid: pkeyId,
     })
     if (!error && code === 200) {
         fileListData.value = getArrValue(data)
@@ -792,7 +790,7 @@ const getBussFileList = async (pkeyId) => {
 }
 
 //上传文件
-const uploadChange = async ({type}) => {
+const uploadChange = async ({ type }) => {
     if (type === 'success') {
         uploadModal.value = false
         renewData()
@@ -825,13 +823,13 @@ const tableFormSaveClick = async (item, dragItem = null) => {
 }
 
 //保存表单数据
-const saveExcelBussData = async ({pkeyId}, dragItem = null, showTip = true) => {
+const saveExcelBussData = async ({ id }, dragItem = null, showTip = true) => {
     setDragModalLoading(dragItem, '保存中...', true)
-    const refs = await getFormRef(pkeyId)
+    const refs = await getFormRef(id)
     const isRegExp = await refs?.isFormRegExp()
     if (isRegExp) {
         const formData = refs?.getFormData()
-        const {error, code} = await wbsApi.saveExcelBussData(formData)
+        const { error, code } = await landApi.saveBussData(formData)
         setDragModalLoading(dragItem)
         if (!error && code === 200) {
             if (showTip) {
@@ -848,10 +846,10 @@ const saveExcelBussData = async ({pkeyId}, dragItem = null, showTip = true) => {
 }
 
 //预览PDF
-const getBussPdfInfo = async ({pkeyId}, dragItem = null, showTip = true) => {
+const getBussPdfInfo = async ({ id }, dragItem = null, showTip = true) => {
     setDragModalLoading(dragItem, '获取pdf中...', true)
-    const {error, code, data} = await wbsApi.getBussPdfInfo({
-        pkeyId: pkeyId
+    const { error, code, data } = await landApi.getBussPdfInfo({
+        id: id,
     }, false)
     setDragModalLoading(dragItem)
     if (!error && code === 200) {
@@ -888,7 +886,7 @@ const setDragModalLoading = (dragItem, text = '保存中...', show = false) => {
 //获取表单的ref
 const getFormRef = async (pkeyId) => {
     const itemRef = itemRefs.value
-    const index = arrIndex(itemRef, 'pkeyId', pkeyId)
+    const index = arrIndex(itemRef, 'pKeyId', pkeyId)
     return itemRef[index].ref
 }
 
@@ -940,15 +938,15 @@ const getCollapseItemIndex = (name) => {
 const getTableFormSize = (pkeyId) => {
     let formId = `table-form-${pkeyId}`
     try {
-        const {clientWidth, clientHeight} = document.getElementById(formId).children[0]
+        const { clientWidth, clientHeight } = document.getElementById(formId).children[0]
         return {
             width: (clientWidth + 40) + 'px',
-            height: (clientHeight + 80) + 'px'
+            height: (clientHeight + 80) + 'px',
         }
     } catch {
         return {
             width: '100%',
-            height: '100%'
+            height: '100%',
         }
     }
 }
@@ -1014,51 +1012,51 @@ const setOnFuncFormRef = async () => {
     if (!isNullES(pkeyId)) {
         return await getFormRef(pkeyId)
     } else {
-        return;
+        return
     }
 }
 
 
 //获取已渲染的表单
 const getFilterFormData = async () => {
-    const formArr = formDataList.value;
+    const formArr = formDataList.value
     return formArr.filter((item) => {
-        return (item.pkeyId ?? '') !== '' && item.isCollapseLoad;
+        return (item.linkId ?? '') !== '' && item.isCollapseLoad
     })
 }
 
 //获取表单数据
 const getFormData = async () => {
-    const formArr = await getFilterFormData();
+    const formArr = await getFilterFormData()
     //获取表单数据
-    let newArr = [];
+    let newArr = []
     for (let i = 0; i < formArr.length; i++) {
-        const pkeyId = formArr[i].pkeyId
+        const pkeyId = formArr[i].linkId
         const refs = await getFormRef(pkeyId)
         const form = refs?.getFormData()
-        newArr.push({...form})
+        newArr.push({ ...form })
     }
-    console.log('表单数据', newArr)
+    console.log('表单数据1111', newArr)
     return newArr
 }
 
 //获取表单效验数据
 const getFormRegExpJson = async () => {
-    const formArr = await getFilterFormData();
+    const formArr = await getFilterFormData()
     const list = listDatas.value
     //获取表单数据
-    let formRegExpJson = {};
+    let formRegExpJson = {}
     for (let i = 0; i < formArr.length; i++) {
-        const pkeyId = formArr[i].pkeyId
-        const refs = await getFormRef(pkeyId)
+        const pKeyId = formArr[i].linkId
+        const refs = await getFormRef(pKeyId)
         const regExp = refs?.getRegExpJson()
         const nodeName = refs?.getNodeName()
         if (getObjVal(regExp)) {
-            const index = arrIndex(list, 'pkeyId', pkeyId)
-            formRegExpJson[pkeyId] = {
+            const index = arrIndex(list, 'pKeyId', pKeyId)
+            formRegExpJson[pKeyId] = {
                 ...regExp,
-                itemId: `item-${index}-${pkeyId}`,
-                nodeName: nodeName
+                itemId: `item-${index}-${pKeyId}`,
+                nodeName: nodeName,
             }
         }
     }
@@ -1067,12 +1065,12 @@ const getFormRegExpJson = async () => {
 
 //获取当前展开项
 const getActiveKey = () => {
-    return ActiveKey.value;
+    return ActiveKey.value
 }
 
 //设置当前展开项
 const setActiveKey = (key) => {
-    return ActiveKey.value = key;
+    return ActiveKey.value = key
 }
 
 // 暴露出去
@@ -1080,7 +1078,7 @@ defineExpose({
     getFormData,
     getFormRegExpJson,
     getActiveKey,
-    setActiveKey
+    setActiveKey,
 })
 </script>
 

+ 170 - 0
src/views/agree/tomb/components/HcUpload.vue

@@ -0,0 +1,170 @@
+<template>
+    <el-upload
+        :accept="accept" :action="action" :before-remove="delUploadData" :before-upload="beforeUpload"
+        :data="uploadData"
+        :disabled="isCanuploadVal" :file-list="fileListData" :headers="getTokenHeader()" :on-error="uploadError"
+        :on-exceed="uploadExceed" :on-preview="uploadPreview" :on-progress="uploadprogress"
+        :on-remove="uploadRemove" :on-success="uploadSuccess" class="hc-upload-border"
+        drag multiple
+    >
+        <div v-loading="uploadDisabled" :element-loading-text="loadingText" class="hc-upload-loading">
+            <HcIcon name="backup" ui="text-5xl mt-4" />
+            <div class="el-upload__text">
+                拖动文件到这里 或 <em>点击这里选择文件</em> 并上传
+            </div>
+        </div>
+        <template #tip>
+            <div class="el-upload__tip" style="font-size: 14px;">
+                {{ acceptTip }}
+            </div>
+        </template>
+    </el-upload>
+</template>
+
+<script setup>
+import { onMounted, ref, watch } from 'vue'
+import { getTokenHeader } from '~src/api/request/header'
+import landApi from '~api/agree/land.js'
+import { isFileSize } from 'js-fast-way'
+
+
+const props = defineProps({
+    fileList: {
+        type: Array,
+        default: () => ([]),
+    },
+    datas: {
+        type: Object,
+        default: () => ({}),
+    },
+    isCanupload:{
+        type:Boolean,
+        default:false,
+    },
+    action:{
+        type:String,
+        default:'/api/blade-manager/exceltab/add-buss-file',
+    },   
+    accept:{
+        type:String,
+        default:'image/png,image/jpg,image/jpeg,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/pdf,.doc,.docx,application/msword',
+    },
+    acceptTip:{
+        type:String,
+        default:'允许格式:jpg/png/pdf/excel/word, 文件大小 小于 60MB',
+    },
+    
+})
+
+//事件
+const emit = defineEmits(['change'])
+//变量
+const uploadData = ref(props.datas)
+const fileListData = ref(props.fileList)
+const action = ref(props.action)
+const accept = ref(props.accept)
+const acceptTip = ref(props.acceptTip)
+const uploadDisabled = ref(false)
+const isCanuploadVal = ref(props.isCanupload)
+
+//监听
+watch(() => [
+    props.fileList,
+    props.datas,
+    props.isCanupload,
+    props.action,
+    props.accept,
+    props.acceptTip,
+], ([fileList, datas, isCanupload, Action, Accept, Tip]) => {
+    uploadData.value = datas
+    fileListData.value = fileList
+    isCanuploadVal.value = isCanupload
+    action.value = Action
+    accept.value = Accept
+    acceptTip.value = Tip
+})
+
+//渲染完成
+onMounted(() => {
+    beforeFileNum.value = 0
+    finishFileNum.value = 0
+    errorFileNum.value = 0
+})
+
+//上传前
+const beforeFileNum = ref(0)
+const beforeUpload = async (file) => {
+    if (isFileSize(file?.size, 60)) {
+        beforeFileNum.value++
+        return true
+    } else {
+        window?.$message?.warning('文件大小, 不能过60M!')
+        return false
+    }
+}
+
+//超出限制时
+const uploadExceed = () => {
+    window?.$message?.warning('请上传 jpg/png/pdf/excel/word 的文件,文件大小 不超过60M')
+}
+
+//上传中
+const loadingText = ref('上传中...')
+const uploadprogress = () => {
+    loadingText.value = '上传中...'
+    uploadDisabled.value = true
+}
+
+//上传完成
+const finishFileNum = ref(0)
+const uploadSuccess = () => {
+    finishFileNum.value++
+    if (beforeFileNum.value === finishFileNum.value) {
+        uploadDisabled.value = false
+        emit('change', { type: 'success' })
+    }
+}
+
+//上传失败
+const errorFileNum = ref(0)
+const uploadError = () => {
+    errorFileNum.value++
+    window?.$message?.error('上传失败')
+    const num = finishFileNum.value + errorFileNum.value
+    if (beforeFileNum.value === num) {
+        uploadDisabled.value = false
+        emit('change', { type: 'success' })
+    }
+}
+
+//预览
+const uploadPreview = ({ url }) => {
+    if (url) {
+        window.open(url, '_blank')
+    }
+}
+
+//删除文件
+const delUploadData = async ({ id }) => {
+     
+        loadingText.value = '删除中...'
+        uploadDisabled.value = true
+        const { error, code } = await landApi.deleteFile({
+            ids: id,
+        })
+        uploadDisabled.value = false
+        if (!error && code === 200) {
+            window?.$message?.success('删除成功')
+            return true
+        } else {
+            return false
+        }
+    
+}
+
+const uploadRemove = () => {
+    if (fileListData.value.length <= 0) {
+        emit('change', { type: 'del' })
+    }
+}
+</script>

+ 151 - 27
src/views/agree/tomb/form.vue

@@ -1,57 +1,80 @@
 <template>
-    <HcCard actionUi="text-center">
+    <HcCard action-ui="text-center">
         <el-scrollbar ref="listItemScrollRef">
-            <CollapseForm ref="ListItemsRef"
-                          :classify="0"
-                          :contractId="0"
-                          :datas="[]"
-                          :primaryKeyId="0"
-                          :status="0"
-                          v-if="false"
+            <CollapseForm
+                v-if="ListItemDatas.length > 0"
+                ref="ListItemRef"
+                v-loading="ListItemLoading"
+                :classify="dataType"
+                :contract-id="0"
+                :datas="ListItemDatas"
+                :primary-key-id="0"
+                :status="0"
+                :area-id="areaId"
+                :agreement-id="agreementId"
+                @renew="updateGetTablesData(agreementId)"
             />
-            <HcStatus text="暂无表单"/>
+            <HcStatus v-else text="暂无表单" />
         </el-scrollbar>
         <template #action>
-            <!--el-button size="large" type="info" hc-btn @click="goBackClick">
-                <HcIcon name="arrow-go-back"/>
-                <span>取消并返回</span>
-            </el-button-->
-            <el-button size="large" type="primary" hc-btn>
-                <HcIcon name="check-double"/>
+            <el-button size="large" type="primary" hc-btn :loading="tableFormSaveLoading" @click="tableFormSaveClick">
+                <HcIcon name="check-double" />
                 <span>提交保存</span>
             </el-button>
             <el-button size="large" type="primary" hc-btn>
-                <HcIcon name="draft"/>
+                <HcIcon name="draft" />
                 <span>一键生成协议</span>
             </el-button>
-            <el-button size="large" type="warning" hc-btn>
-                <HcIcon name="eye"/>
+            <el-button size="large" type="warning" hc-btn :loading="bussPdfsLoading" @click="bussPdfsClick">
+                <HcIcon name="eye" />
                 <span>预览</span>
             </el-button>
-            <el-button size="large" type="success" hc-btn>
-                <HcIcon name="upload"/>
+            <el-button size="large" type="success" hc-btn @click="addFile">
+                <HcIcon name="upload" />
                 <span>上传附件协议</span>
             </el-button>
+            <el-button size="large" type="info" hc-btn @click="goBackClick">
+                <HcIcon name="arrow-go-back" />
+                <span>取消并返回</span>
+            </el-button>
         </template>
+        <HcDialog is-to-body :show="addModal" title="上传附件协议" @close="testModalClose">
+            <HcUpload :datas="uploadData" :file-list="fileListData" :is-canupload="false" action="/api/blade-manager/exceltab/add-bussfile-node" accept="application/pdf" accept-tip="允许格式:pdf" @change="uploadChange" />
+        </HcDialog>
     </HcCard>
 </template>
 
 <script setup>
-import {onActivated, ref} from "vue";
-import {useRoute, useRouter} from 'vue-router'
-import CollapseForm from "./collapse-form/index.vue"
+import { onActivated, ref } from 'vue'
+import { useRoute, useRouter } from 'vue-router'
+import CollapseForm from './collapse-form/index.vue'
+import landApi from '~api/agree/land.js'
+import { useAppStore } from '~src/store'
+import { getArrValue, getObjVal } from 'js-fast-way'
+import HcUpload from './components/HcUpload.vue'
 
+const useAppState = useAppStore()
+const projectId = ref(useAppState.getProjectId)
 const router = useRouter()
 const useRoutes = useRoute()
 
 //初始变量
-//const dataType = ref(useRoutes?.query?.type ?? 'view')
-//const dataId = ref(useRoutes?.query?.id ?? '')
+const dataType = ref(useRoutes?.query?.type ?? 'view')
+const agreementId = ref(useRoutes?.query?.id ?? '')
+const areaId = ref(useRoutes?.query?.areaId ?? '')
 
 //缓存页面被激活时
 onActivated(() => {
-    //dataType.value = useRoutes?.query?.type ?? 'view'
-    //dataId.value = useRoutes?.query?.id ?? ''
+    dataType.value = useRoutes?.query?.type ?? 'view'
+    agreementId.value = useRoutes?.query?.id ?? ''
+    areaId.value = useRoutes?.query?.areaId ?? ''
+    if (agreementId.value.length > 0) {
+        updateGetTablesData( agreementId.value)
+    } else {
+        searchNodeAllTable()
+    }
+    
+    
 })
 
 const listItemScrollRef = ref(null)
@@ -60,6 +83,107 @@ const listItemScrollRef = ref(null)
 const goBackClick = () => {
     router.back()
 }
+
+//获取数据列表
+const ListItemsRef = ref(null)
+const ListItemDatas = ref([])
+const ListItemLoading = ref(false)
+
+//新增获取表单列表id
+const searchNodeAllTable = async () => {
+    const { error, code, data } = await landApi.addGetTables({
+        projectId: projectId.value,
+        type: 1,
+        areaId:areaId.value,
+    
+    })
+    //处理数据
+
+    if (!error && code === 200) {
+        agreementId.value = data
+        updateGetTablesData(data)
+    } else {
+        agreementId.value = ''
+    }
+}
+//编辑获取表单列表
+const updateGetTablesData = async (id) => {
+    ListItemDatas.value = []
+    ListItemLoading.value = true
+    const { error, code, data } = await landApi.updateGetTables({
+        agreementId:id,
+    
+    })
+    //处理数据
+    ListItemLoading.value = false
+    if (!error && code === 200) {
+        ListItemDatas.value = getArrValue(data)
+    } else {
+        ListItemDatas.value = []
+    }
+}
+
+//保存
+const ListItemRef = ref(null)
+const tableFormSaveLoading = ref(false)
+const tableFormSaveClick = async () => {
+    //获取数据
+    let FormData = []
+        FormData = await ListItemRef.value?.getFormData()
+    //效验数据
+    if (FormData.length > 0) {
+        tableFormSaveLoading.value = true
+        FormData.forEach(ele => {
+            delete ele['pkeyId']
+        })
+        const { error, code, data } = await landApi.saveBussData({
+            dataInfo: { orderList: FormData },
+        })
+        tableFormSaveLoading.value = false
+        if (!error && code === 200) {
+            window?.$message?.success('保存成功')
+            dataType.value = 2
+             await bussPdfsClick()
+             updateGetTablesData(agreementId.value)
+        }
+    } else {
+        console.log('预览')
+        // await bussPdfsClick()
+    }
+}
+//多表预览
+const bussPdfsLoading = ref(false)
+const bussPdfsClick = async () => {
+    bussPdfsLoading.value = true
+    const { error, code, data } = await landApi.getBussPdfs({
+        agreementId:agreementId.value,
+    })
+    tableFormSaveLoading.value = false
+    bussPdfsLoading.value = false
+    if (!error && code === 200) {
+        window.open(data, '_blank')
+    } else {
+        window.$message?.warning('获取PDF失败')
+    }
+}
+//上传附件
+const addModal = ref(false)
+const testModalClose = ()=>{
+    addModal.value = false
+}
+const addFile = ()=>{
+    addModal.value = true
+}
+const uploadData = ref({})
+const fileListData = ref([])
+//上传文件
+const uploadChange = async ({ type }) => {
+    if (type === 'success') {
+        // getBussFileList(primaryKeyId.value)
+    } else if (type === 'del') {
+        // getBussFileList(primaryKeyId.value)
+    }
+}
 </script>
 
 <style lang="scss" scoped>

+ 123 - 39
src/views/agree/tomb/tomb.vue

@@ -3,75 +3,90 @@
         <template #left>
             <div class="hc-layout-tree-box">
                 <el-scrollbar>
-                    <HcTreeData @nodeTap="treeNodeTap"/>
+                    <HcTreeData @nodeTap="treeNodeTap" />
                 </el-scrollbar>
             </div>
         </template>
         <HcCard>
             <template #header>
                 <div class="w-52">
-                    <el-input v-model="searchForm.queryValue" clearable placeholder="请输入名称进行查询" size="large"/>
+                    <el-input v-model="searchForm.name" clearable placeholder="请输入名称进行查询" size="large" />
                 </div>
                 <div class="ml-4">
-                    <el-button type="primary" @click="searchClick" size="large">
-                        <HcIcon name="search-2"/>
+                    <el-button type="primary" size="large" @click="searchClick">
+                        <HcIcon name="search-2" />
                         <span>搜索</span>
                     </el-button>
                 </div>
             </template>
             <template #extra>
                 <el-button size="large" type="primary" hc-btn @click="addRowClick">
-                    <HcIcon name="add"/>
+                    <HcIcon name="add" />
                     <span>新增</span>
                 </el-button>
                 <el-button size="large" type="warning" hc-btn>
-                    <HcIcon name="add"/>
+                    <HcIcon name="add" />
                     <span>打印</span>
                 </el-button>
-                <el-button size="large" type="danger" hc-btn>
-                    <HcIcon name="delete-bin"/>
+                <el-button size="large" type="danger" hc-btn :disabled="tableCheckedKeys.length < 1" @click="batchDel">
+                    <HcIcon name="delete-bin" />
                     <span>删除</span>
                 </el-button>
             </template>
-            <HcTable :column="tableColumn" :datas="tableData" :loading="tableLoading" isCheck @selection-change="tableSelectionChange">
-                <template #action="{row,index}">
-                    <el-button size="small" type="primary" @click="editRowClick(row)">修改</el-button>
-                    <el-button size="small" type="warning">查看</el-button>
-                    <el-button size="small" type="danger">删除</el-button>
+            <HcTable :column="tableColumn" :datas="tableData" :loading="tableLoading" is-check @selection-change="tableSelectionChange">
+                <template #action="{ row, index }">
+                    <el-button size="small" type="primary" @click="editRowClick(row)">
+                        修改
+                    </el-button>
+                    <el-button size="small" type="warning" @click="viewPdf(row)">
+                        查看
+                    </el-button>
+                    <el-button size="small" type="danger" @click="delAgree(row)">
+                        删除
+                    </el-button>
                 </template>
             </HcTable>
             <template #action>
-                <HcPages :pages="searchForm" @change="pageChange"/>
+                <HcPages :pages="searchForm" @change="pageChange" />
             </template>
         </HcCard>
     </HcPageLayout>
 </template>
 
 <script setup>
-import {ref} from "vue";
-import {useRouter} from 'vue-router'
-
+import { onActivated, ref } from 'vue'
+import { useRouter } from 'vue-router'
+import landApi from '~api/agree/land.js'
+import { useAppStore } from '~src/store'
+import { arrToId, getArrValue } from 'js-fast-way'
+import { delMessageV2 } from '~com/message/index.js'
+const useAppState = useAppStore()
+const projectId = ref(useAppState.getProjectId)
 const router = useRouter()
-
+const areaId = ref('')
 //树节点被点击
-const treeNodeTap = ({node, data}) => {
-
+const treeNodeTap = ({ node, data }) => {
+    areaId.value = data.id
+    searchForm.value.areaId = data.id
+    getTableData()
 }
-
+onActivated(()=>{
+    getTableData()
+})
 //搜索表单
 const searchForm = ref({
-    projectType: null, queryValue: null, startTime: null, endTime: null,
-    current: 1, size: 20, total: 0
+    projectType: null, name: null, startTime: null, endTime: null,
+    current: 1, size: 20, total: 0,
 })
 
 //搜索
 const searchClick = () => {
-    searchForm.value.current = 1;
+    searchForm.value.current = 1
     getTableData()
 }
 
 //分页被点击
-const pageChange = ({current, size}) => {
+const pageChange = ({ current, size }) => {
     searchForm.value.current = current
     searchForm.value.size = size
     getTableData()
@@ -80,40 +95,109 @@ const pageChange = ({current, size}) => {
 //获取数据
 const tableLoading = ref(false)
 const tableColumn = [
-    {key: 'key1', name: '协议编号'},
-    {key: 'key2', name: '协议书名称'},
-    {key: 'key3', name: '补偿总金额'},
-    {key: 'key4', name: '备注'},
-    {key: 'action', name: '操作', width: '190', align: 'center'},
+    { key: 'number', name: '协议编号' },
+    { key: 'name', name: '协议书名称' },
+    { key: 'allMoney', name: '补偿总金额' },
+    { key: 'action', name: '操作', width: '190', align: 'center' },
 ]
 const tableData = ref([
-    {id: 1, key1: 'xxxx', key2: 'xxxx', key3: '65632'},
-    {id: 2, key1: 'xxxx', key2: 'xxxx', key3: '65632'},
-    {id: 3, key1: 'xxxx', key2: 'xxxx', key3: '65632'},
-    {id: 4, key1: 'xxxx', key2: 'xxxx', key3: '65632'},
-])
-const getTableData = () => {
 
+])
+const getTableData = async () => {
+    tableLoading.value = true
+    const { error, code, data } = await landApi.getPage({
+        ...searchForm.value,
+        projectId: projectId.value,
+        type:2,
+    })
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data['records'])
+        searchForm.value.total = data['total'] || 0
+    } else {
+        tableData.value = []
+        searchForm.value.total = 0
+    }
 }
 
 //多选事件
+const tableCheckedKeys = ref([])
 const tableSelectionChange = (rows) => {
-    console.log(rows)
+    tableCheckedKeys.value = rows
 }
 
 //新增
 const addRowClick = () => {
     router.push({
-        name: 'lar-agree-tomb-form'
+        name: 'lar-agree-land-form',
+        query:{
+            type:1,
+            areaId:areaId.value,
+        },
     })
 }
 
 //编辑
 const editRowClick = (row) => {
     router.push({
-        name: 'lar-agree-tomb-form'
+        name: 'lar-agree-land-form',
+        query:{
+            type:2,
+            id:row.id,
+            areaId:areaId.value,
+        },
     })
 }
+//查看pdf
+const viewPdf = ({ mergePdfUrl }) => {
+    if (mergePdfUrl) {
+        window.open(mergePdfUrl, '_blank')
+    } else {
+        window.$message.error('暂无文件')
+    }
+}
+const delAgree = (row)=>{
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await landApi.remove({
+                            ids: row?.id,
+                        })
+                        if (!error && code === 200) {
+                            window?.$message?.success('删除成功')
+                            getTableData()
+                        } else {
+                            window?.$message?.warning(msg)
+                        }
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+     })
+}
+const batchDel = ()=>{
+    const rows = tableCheckedKeys.value
+    const ids = arrToId(rows)
+    delMessageV2(async (action, instance, done) => {
+            if (action === 'confirm') {
+                instance.confirmButtonLoading = true
+                const { error, code, msg } = await landApi.remove({
+                            ids,
+                        })
+                        if (!error && code === 200) {
+                            window?.$message?.success('删除成功')
+                            getTableData()
+                        } else {
+                            window?.$message?.warning(msg)
+                        }
+                instance.confirmButtonLoading = false
+                done()
+            } else {
+                done()
+            }
+     })
+}
 </script>
 
 <style lang="scss" scoped>