Browse Source

Merge branch 'master' of http://120.46.159.163:7400/ezhizao/ezhizao_dms_vue

wangxin 10 months ago
parent
commit
2ea409a822
1 changed files with 28 additions and 5 deletions
  1. 28 5
      src/views/business/outsourceBalanceAccounts/index.vue

+ 28 - 5
src/views/business/outsourceBalanceAccounts/index.vue

@@ -221,7 +221,7 @@
 <script setup>
 import { ref } from 'vue'
 // import region from '@/utils/region.js'
-import { listBalanceAccount, checkout, discheckout, saveBatchBalanceAccount } from '@/api/business/outsourceBalanceAccount'
+import { listBalanceAccount, checkout, discheckout, saveBatchBalanceAccount, updateBalanceAccount } from '@/api/business/outsourceBalanceAccount'
 import { listOutsourceBalanceMonth } from '@/api/business/outsourceBalanceMonth.js'
 const { proxy } = getCurrentInstance();
 const tableData = ref([])
@@ -316,7 +316,7 @@ const changeCellEvent = (params) => {
   if ($table) {
     $table.updateStatus(params)
   }
-  console.log(tableData.value)
+  // console.log(tableData.value)
 }
 
 const handleBalance = () => {
@@ -353,7 +353,7 @@ const handleDisbalance = () => {
     item.year = ''
     item.month = ''
   })
-  console.log(selected.value.length)
+  // console.log(selected.value.length)
   if (selected.value.length > 100) {
     proxy.$modal.msgError('一次只能操作100条数据')
     return
@@ -420,7 +420,7 @@ const disabledDateHandler = (date, type) => {
 
 const handleSave = () => {
   const params = tableRef.value.getUpdateRecords()
-  console.log(params)
+  // console.log(params)
   saveBatchBalanceAccount(params).then(res => {
     proxy.$modal.msgSuccess('保存成功')
     handleQuery()
@@ -466,6 +466,20 @@ const handleBlur = (params) => {
   params.taxAmount = taxAmount
 }
 
+const saveRow = (row) => {
+  updateBalanceAccount(row).then(res => {
+    const $table = tableRef.value
+    if (res.code === 200) {
+      // proxy.$modal.msgSuccess('保存成功')
+      if ($table != null) {
+        $table.reloadRow(row, res.data)
+      }
+    } else {
+      proxy.$modal.msgError(res.msg)
+    }
+  })
+}
+
 const processPriceFilterMethod = ({ option, row, column }) => {
   if (option.data != '') {
     return option.data == '0' ? row[column.field] <= 0 : row[column.field] > 0
@@ -488,7 +502,16 @@ const confirmFilterEvent = (option) => {
   }
 }
 const handleEditClosed = (params) => {
-  console.log(params)
+  // console.log(params)
+  const { row, column } = params
+  const field = column.field
+  // 判断是否真有需要保存的部分
+
+  const updates = tableRef.value.getUpdateRecords()
+  console.log(updates)
+  if (updates.length > 0) {
+    saveRow(row)
+  }
 }
 // const handleScroll = (params) => {
 //   // console.log('scroll')