| | |
| | | <text class="detail-value">{{ item.entryDate }}</text> |
| | | </view> |
| | | </view> |
| | | <!-- 仅非“审批通过”的台账展示删除按钮 --> |
| | | <view |
| | | class="detail-row" |
| | | v-if="item.approvalStatus !== 3" |
| | | style="justify-content: flex-end; margin-top: 8px;" |
| | | > |
| | | <up-button |
| | | type="error" |
| | | size="small" |
| | | plain |
| | | @click.stop="handleDelete(item)" |
| | | > |
| | | 删除 |
| | | </up-button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | import { onShow } from "@dcloudio/uni-app"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import { purchaseListPage } from "@/api/procurementManagement/procurementLedger"; |
| | | import { purchaseListPage, delPurchase } from "@/api/procurementManagement/procurementLedger"; |
| | | const userStore = useUserStore(); |
| | | const approvalStatusText = { |
| | | 1: "待审核", |
| | |
| | | } |
| | | }; |
| | | |
| | | // 删除单条采购台账 |
| | | const handleDelete = row => { |
| | | if (!row || !row.id) { |
| | | uni.showToast({ |
| | | title: "数据有误,无法删除", |
| | | icon: "none", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | uni.showModal({ |
| | | title: "提示", |
| | | content: "选中的内容将被删除,是否确认删除?", |
| | | confirmText: "确认", |
| | | cancelText: "取消", |
| | | success: res => { |
| | | if (res.confirm) { |
| | | delPurchase([row.id]) |
| | | .then(result => { |
| | | // 成功:code === 200 |
| | | if (result && result.code === 200) { |
| | | uni.showToast({ |
| | | title: "删除成功", |
| | | icon: "success", |
| | | }); |
| | | getList(); |
| | | return; |
| | | } |
| | | // 业务失败:优先展示后端返回的 msg(如 CG2026... 不允许删除) |
| | | uni.showToast({ |
| | | title: (result && result.msg) || "删除失败", |
| | | icon: "none", |
| | | }); |
| | | }) |
| | | .catch(error => { |
| | | // 对于 request 封装返回的 '500' 或其他 code,错误提示已经在 request 里 toast 过了,这里不再重复覆盖 |
| | | if (error === "500" || typeof error === "number") { |
| | | return; |
| | | } |
| | | // 只有在真正异常时,才在这里兜底提示 |
| | | const msg = |
| | | (error && error.msg) || |
| | | (error && error.response && error.response.data && error.response.data.msg) || |
| | | (error && error.message) || |
| | | "删除失败"; |
| | | uni.showToast({ |
| | | title: msg, |
| | | icon: "none", |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | onShow(() => { |
| | | // 页面显示时刷新列表 |
| | | getList(); |