ZN
9 天以前 342439b018786854ec0b49a2cf26fe422ca9121d
src/views/procurementManagement/purchaseReturnOrder/index.vue
@@ -36,6 +36,7 @@
      >
        <template #operation="{ row }">
          <el-button link type="primary" size="small" style="color: #67C23A" @click="handleDetail(row)">详情</el-button>
          <el-button link size="small" @click="handleDelete(row)">删除</el-button>
        </template>
      </PIMTable>
    </div>
@@ -113,7 +114,7 @@
import PIMTable from '@/components/PIMTable/PIMTable.vue'
import { ref, reactive, toRefs, onMounted, defineAsyncComponent, getCurrentInstance } from 'vue'
const { proxy } = getCurrentInstance()
import {findPurchaseReturnOrderListPage, getPurchaseReturnOrderDetail} from "@/api/procurementManagement/purchase_return_order.js";
import {findPurchaseReturnOrderListPage, getPurchaseReturnOrderDetail, deletePurchaseReturnOrder} from "@/api/procurementManagement/purchase_return_order.js";
const New = defineAsyncComponent(() => import("@/views/procurementManagement/purchaseReturnOrder/New.vue"));
const tableData = ref([])
const selectedRows = ref([])
@@ -218,13 +219,24 @@
    width: 180,
  },
  {
    fixed: 'right',
    label: '操作',
    dataType: 'slot',
    slot: 'operation',
    width: 100,
    align: 'center',
    dataType: "action",
    width: 120,
      label: "操作",
      align: "center",
      fixed: "right",
    operation: [
      {
            name: "详情",
            type: "text",
            clickFun: row => {handleDetail(row);},
         },
      {
        name: "删除",
        clickFun: row => {handleDelete(row)},
      },
  ],
  },
])
const data = reactive({
  searchForm: {
@@ -240,9 +252,27 @@
  getList()
}
// 删除操作
const handleDelete = (row) => {
  console.log('删除行数据:', row)
  proxy?.$modal?.confirm('确定要删除吗?删除将无法恢复').then(() => {
    // 这里调用删除接口,传入 row.id
    deletePurchaseReturnOrder(row.id).then(() => {
      proxy?.$modal?.msgSuccess?.("删除成功");
      getList()
    }).catch(() => {
      proxy?.$modal?.msgError?.('删除失败')
    })
  }).catch(() => {
    // 取消删除
    proxy?.$modal?.msgInfo?.('已取消删除')
  })
}
// 查看详情
const handleDetail = (row) => {
  if (!row?.id) {
    proxy?.$modal?.msgWarning('未获取到单据ID')
    proxy?.$modal?.msgWarning?.('未获取到单据ID')
    return
  }
  detailVisible.value = true
@@ -257,7 +287,7 @@
      payload.purchaseReturnOrderProductsDetailVoList.map(item => ({ ...item, ...item.salesLedgerProduct })) ||
      []
  }).catch(() => {
    proxy?.$modal?.msgError('获取详情失败')
    proxy?.$modal?.msgError?.('获取详情失败')
  }).finally(() => {
    detailLoading.value = false
  })