duy 2 сар өмнө
parent
commit
83339c502b

+ 33 - 1
src/views/ledger/components/table-form.vue

@@ -262,9 +262,13 @@ const dateCalendarChoice = ({ date, choices, dates }) => {
 
 //获取数据
 const loading = ref(false)
+const choicesVal = ref(null)
+
 const getExcelBusinessData = async (date, choices) => {
     const { primaryKeyId } = menuItem.value
     loading.value = true
+    choicesVal.value = choices
+
     await getTheLogBusinessData(excelIdVal.value, choices)
     await getExcelHtml(excelIdVal.value)
     loading.value = false
@@ -329,6 +333,30 @@ const getTheLogBusinessData = async (excelId, recordDate) => {
     getBussDataInfo()
 }
 
+const getAddLogBusinessData = async (excelId, recordDate) => {
+    const { primaryKeyId } = menuItem.value
+    const { data } = await queryApi.getAddTheLogBusinessData({
+        contractId: contractId.value || '',
+        pkeyId: excelId,
+        nodePrimaryKeyId: primaryKeyId,
+        recordTime: recordDate,
+        theLogId: '',
+    }, false)
+    //设置默认数据
+    let formArrData = getArrValue(data)
+    if (formArrData.length > 0) {
+        logId.value = formArrData[0].logId
+        for (let i = 0; i < formArrData.length; i++) {
+            formArrData[i] = setFormDefaultData(formArrData[i])
+        }
+    } else {
+        formArrData = [setFormDefaultData()]
+    }
+    formLogDataList.value = formArrData
+
+    // getBussDataInfo()
+}
+
 //获取表单初始数据
 const formLogIndex = ref(0)
 const tableFormData = ref({})
@@ -631,7 +659,11 @@ const addTableFormClick = () => {
     const defaultData = setFormDefaultData({})
     formLogDataList.value.push(defaultData)
     const index = formLogDataList.value.length - 1
-    getBussDataInfo(index)
+    // getBussDataInfo(index)
+    getAddLogBusinessData(excelIdVal.value, choicesVal.value)
+      
+     getBussDataInfo(index)
+
 }
 
 //复制表格内容