| | |
| | | :underline="false" plain :size="size" @click="handleViewHistory(row)" |
| | | v-hasPermi="['cwgl:payableBillManagement:list']"> 结算明细 |
| | | </el-link> |
| | | <el-link class="link-btn" v-if="row.auditStatus == 0 || row.auditStatus == 2" type="primary" :underline="false" plain :size="size" |
| | | @click="handleAuditClick(row)" |
| | | v-hasPermi="['cwgl:receivableBillManagement:audit']"> |
| | | 审核 |
| | | </el-link> |
| | | <el-link class="link-btn" type="primary" :underline="false" plain :size="size" @click="handleViewFeeDetail(row)" |
| | | v-hasPermi="['cwgl:payableBillManagement:view']"> 详情 |
| | | </el-link> |
| | |
| | | <!-- 开票 --> |
| | | <makeOutInvoice ref="makeOutInvoiceRef" :type="makeType" :InvoiceDetails="InvoiceDetails" @success="makeOutInvoiceFresh" /> |
| | | |
| | | |
| | | <el-dialog title="账单审核" v-model="auditDialogVisible" width="500px" append-to-body> |
| | | <el-form :model="auditForm" :rules="auditRules" ref="auditFormRef" label-width="100px"> |
| | | <!-- <el-form-item label="账单ID" prop="billId"> |
| | | <el-input v-model="auditForm.billId" disabled /> |
| | | </el-form-item> --> |
| | | <!-- <el-form-item label="账单类型" prop="billType"> |
| | | <el-select v-model="auditForm.billType" placeholder="请选择" style="width: 100%" disabled> |
| | | <el-option label="应收" :value="0" /> |
| | | <el-option label="应付" :value="1" /> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | <el-form-item label="审核结果" prop="auditResult"> |
| | | <el-radio-group v-model="auditForm.auditResult" @change="handleAuditResultChange" > |
| | | <el-radio :label="1">通过</el-radio> |
| | | <el-radio :label="2">驳回</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="审核意见" prop="auditComment"> |
| | | <el-input v-model="auditForm.auditComment" type="textarea" :rows="3" placeholder="请输入审核意见" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="auditDialogVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="submitAudit">确 定1</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup name="payableBillManagement" lang="ts"> |
| | | import { payableBillManagementInvoice,invoiceAmount,PayableBillManagementI,payableBillManagementVoid, addPayableBillManagement, delPayableBillManagement, exportPayableBillManagement, getPayableBillManagement, listPayableBillManagement, updatePayableBillManagement } from "@/api/cwgl/payableBillManagement"; |
| | | import { payableBillManagementInvoice,invoiceAmount,PayableBillManagementI,payableBillManagementVoid, addPayableBillManagement, delPayableBillManagement, exportPayableBillManagement, getPayableBillManagement, listPayableBillManagement, updatePayableBillManagement,receivableBillManagementAudit } from "@/api/cwgl/payableBillManagement"; |
| | | import useCurrentInstance from "@/utils/useCurrentInstance"; |
| | | import { listPayableInvoiceBusiness,} from "@/api/cwgl/payableInvoiceBusiness"; |
| | | |
| | | import { computed, reactive, ref, toRefs } from "vue"; |
| | | import { computed, reactive, ref, toRefs,nextTick } from "vue"; |
| | | import { PagesInterface, PageQueryInterface } from "@/utils/globalInterface"; |
| | | import { usePagePlus } from "@/hooks/usePagePlus"; |
| | | import { hasPermission } from "@/utils/permissionUtils"; |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const auditDialogVisible = ref(false); |
| | | const auditFormRef = ref(); |
| | | |
| | | // 审核表单数据 |
| | | const auditForm = reactive({ |
| | | billId: null as number | null, |
| | | billType: null as number | null, // 0:应收, 1:应付 |
| | | auditResult: null as number | null, // 1:通过, 2:驳回 |
| | | auditComment: '' |
| | | }); |
| | | const getAuditRules = () => { |
| | | return { |
| | | billId: [{ required: true, message: '账单ID不能为空', trigger: 'blur' }], |
| | | billType: [{ required: true, message: '账单类型不能为空', trigger: 'change' }], |
| | | auditResult: [{ required: true, message: '审核结果不能为空', trigger: 'change' }], |
| | | // 动态规则:如果 auditResult 为 2 (驳回),则必填 |
| | | auditComment: [ |
| | | { |
| | | required: auditForm.auditResult === 2, |
| | | message: '驳回时必须填写审核意见', |
| | | trigger: 'blur' |
| | | } |
| | | ] |
| | | }; |
| | | }; |
| | | const validateAuditComment = (rule: any, value: any, callback: any) => { |
| | | if (auditForm.auditResult === 2 && !value) { |
| | | callback(new Error('驳回时必须填写审核意见')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | // 表单校验规则 |
| | | const auditRules = { |
| | | billId: [{ required: true, message: '账单ID不能为空', trigger: 'blur' }], |
| | | billType: [{ required: true, message: '账单类型不能为空', trigger: 'change' }], |
| | | auditResult: [{ required: true, message: '审核结果不能为空', trigger: 'change' }], |
| | | auditComment: [{ validator: validateAuditComment, trigger: 'blur' }] |
| | | }; |
| | | const handleAuditResultChange = (val: number) => { |
| | | // 当切换审核结果时,立即触发表单校验,以更新审核意见字段的错误提示状态 |
| | | if (auditFormRef.value) { |
| | | auditFormRef.value.validateField('auditComment'); |
| | | } |
| | | |
| | | // 可选:如果选择通过,可以清空之前填写的驳回意见,或者保留看业务需求 |
| | | // if (val === 1) { |
| | | // auditForm.auditComment = ''; |
| | | // } |
| | | }; |
| | | /** |
| | | * 点击审核按钮 |
| | | */ |
| | | const handleAuditClick = (row: any) => { |
| | | // 重置表单 |
| | | auditForm.billId = row.id; |
| | | auditForm.billType = 1; |
| | | auditForm.auditResult = null; |
| | | auditForm.auditComment = ''; |
| | | |
| | | // 重置校验状态 |
| | | nextTick(() => { |
| | | if (auditFormRef.value) { |
| | | auditFormRef.value.clearValidate(); |
| | | } |
| | | }); |
| | | |
| | | auditDialogVisible.value = true; |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 提交审核 |
| | | */ |
| | | const submitAudit = () => { |
| | | auditFormRef.value.validate((valid: boolean) => { |
| | | if (valid) { |
| | | receivableBillManagementAudit(auditForm).then(res => { |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess(res.msg); |
| | | auditDialogVisible.value = false; |
| | | onLoad(page.value); // 刷新列表 |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | </script> |