Переглянути джерело

复制本表不刷新页面

duy 1 рік тому
батько
коміт
86c6dd2d94

+ 29 - 5
src/views/data-fill/collapse-form/index.vue

@@ -466,11 +466,15 @@ const props = defineProps({
         type: [Object],
         default: () => ({}),
     },
+    newlistdata:{
+        type: [Array],
+        default: () => ([]),
+    },
 
 })
 
 //事件
-const emit = defineEmits(['renew', 'offsetTop'])
+const emit = defineEmits(['renew', 'offsetTop', 'getList'])
 
 //初始变量
 const useAppState = useAppStore()
@@ -488,6 +492,7 @@ const listDatas = ref([])
 const draw_type = ref(props.drawType)
 const tree_AutoExpandKeys = ref(props.treeAutoExpandKeys)
 const treenodeDataInfo = ref(props.treenodeDataInfo)
+const newlistdata = ref(props.newlistdata)
 
 
 //表单变量
@@ -549,7 +554,8 @@ watch(() => [
     props.status,
     props.classify,
     props.primaryKeyId,
-], ([pid, cid, temp_id, tid, type, status, class_id, tree_id]) => {
+    props.newlistdata,
+], ([pid, cid, temp_id, tid, type, status, class_id, tree_id, Newlistdata]) => {
     projectId.value = pid
     contract_id.value = cid
     wbsTemp_id.value = temp_id
@@ -558,6 +564,7 @@ watch(() => [
     isStatus.value = parseInt(status)
     classifys.value = class_id
     treeId.value = tree_id
+    newlistdata.value = Newlistdata
 })
 
 //渲染完成
@@ -1163,13 +1170,25 @@ const copeBussTab = async (pkeyId) => {
     copyClickLoading.value = false
     if (!error && code === 200) {
         window?.$message?.success('操作成功')
-        renewData()
+        console.log(1111212)
+        // renewData()
+        getNewList()
     }
 }
 
+//获取表单列表
+const getNewList = ()=>{
+    emit('getList')
+   setTimeout(() => {
+    let newObj = newlistdata.value
+    let oldObj = listDatas.value
+    const addedObject = newObj.find(obj => !oldObj.some(oldObj => oldObj.pkeyId === obj.pkeyId))
+     listDatas.value.push(addedObject)
+   }, 1000)
+}
 //隐藏本表
 const tableFormHideLoading = ref(false)
-const hideClick = async ({ pkeyId, isBussShow }) => {
+const hideClick = async ({ pkeyId, isBussShow }, index) => {
     if (pkeyId) {
         if (isStatus.value !== 3) {
             tableFormHideLoading.value = true
@@ -1183,11 +1202,16 @@ const hideClick = async ({ pkeyId, isBussShow }) => {
             tableFormHideLoading.value = false
             if (!error && code === 200) {
                 window?.$message?.success('操作成功')
+                if (isBussShow === 2) {
+                    listDatas.value[index]. isBussShow = 1
+                } else {
+                    listDatas.value[index]. isBussShow = 2
+                }
                 if (bussShow === 2) {
                     //判断是否存在窗口,如果存在,就删除窗口
                     delWindowRefs(pkeyId)
                 }
-                renewData()
+                // renewData()
             }
         } else {
             window?.$message?.warning('已上报的资料,不允许隐藏')

+ 19 - 1
src/views/data-fill/wbs.vue

@@ -120,8 +120,10 @@
                             :wbs-temp-id="projectInfo?.referenceWbsTemplateIdTrial"
                             :wbs-type="2"
                             :treenode-data-info="nodeDataInfo"
+                            :newlistdata="newlistdata"
                             @offsetTop="ListItemOffsetTop"
                             @renew="getTableDataAll"
+                            @getList="searchNodeAllTable1"
                         />
                     </el-scrollbar>
 
@@ -1697,7 +1699,23 @@ const searchNodeAllTable = async () => {
         ListItemDatas.value = []
     }
 }
-
+const newlistdata = ref([])
+const searchNodeAllTable1 = async () => {
+  console.log('重新获取表单列表')
+    const info = nodeDataInfo.value
+    const { error, code, data } = await wbsApi.searchNodeAllTable({
+        projectId: projectId.value,
+        contractId: contractId.value,
+        primaryKeyId: info['primaryKeyId'],
+        type: authBtnTabKey.value,
+    })
+    //处理数据
+    if (!error && code === 200) {
+        newlistdata.value = getArrValue(data)
+    } else {
+        newlistdata.value = []
+    }
+}
 //查询状态
 const NodeStatus = ref('1')
 const queryNodeStatus = async () => {