cmvr-wms/ruoyi-ui-vue3/src/components/Production/WithdrawAction.vue
lixiaolong 5bdeceafd7 feat(auth): 添加认证cookie名称配置并优化表单布局
- 在 .env.production 中新增 VITE_AUTH_COOKIE_NAME 配置项用于设置认证cookie名称
- 将 AcceptanceException.vue 中的表单标签宽度从固定90px改为自动适配
- 在 ActionDialog.vue 中将多个表单项标记为必填项并调整标签宽度为自动适配
- 重构 ActionHistory.vue 中的按钮布局结构并添加表格列样式类名
- 更新 api-contract-audit.cjs 添加生产任务和BOM相关接口的契约测试
- 修改 auth.js 使用动态认证cookie键名替换硬编码的Admin-Token
- 调整系统角色授权用户页面的表单布局和表格样式类名
- 优化 ReceiptDialog Batch 组件的对话框尺寸、表单验证和分页功能
2026-10-15 11:30:55 +08:00

29 lines
2.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template><el-dialog title="按原记录撤销" v-model="visible" width="min(500px,96vw)" append-to-body :close-on-click-modal="!saving" :show-close="!saving" :close-on-press-escape="!saving"><p>原记录保留追溯,未撤销的剩余数量保留为关联记录。存在后续业务时仍需逐步退回。</p><el-form label-width="auto"><el-form-item label="撤销数量"><el-input-number v-model="form.quantity" :min="0.0001" :max="maximum" :precision="4" :disabled="saving"/></el-form-item><el-form-item label="撤销原因"><el-input v-model="form.reason" type="textarea" maxlength="300" :disabled="saving"/></el-form-item></el-form><template #footer><span ><el-button :disabled="saving" @click="visible=false">取消</el-button><el-button type="primary" :loading="saving" @click="save">确认撤销</el-button></span></template></el-dialog></template>
<script>
import request from '@/utils/request'
export default {
data: () => ({ visible: false, saving: false, maximum: 0, form: {} }),
methods: {
open(row, type = 'PRODUCTION') {
if (this.saving) return
this.maximum = Number(type === 'OUT' ? row.outNum : row.quantity)
this.form = { type, id: row.id, quantity: this.maximum, reason: '', key: `withdraw-${Date.now()}-${row.id}-${Math.random().toString(36).slice(2)}` }
this.visible = true
},
async save() {
if (this.saving) return
const quantity = Number(this.form.quantity), reason = String(this.form.reason || '').trim()
if (!Number.isFinite(quantity) || quantity <= 0 || quantity > this.maximum) return this.$modal.msgWarning(`撤销数量须大于 0 且不超过 ${this.maximum}`)
if (!reason || reason.length > 300) return this.$modal.msgWarning('请填写撤销原因,最多300字')
const data = { ...this.form, quantity, reason }
this.saving = true
try {
await request({ url: '/warehouse/withdrawals', method: 'post', data })
this.visible = false; this.$modal.msgSuccess('已撤销所选数量'); this.$emit('changed')
} catch { /* Shared request handler displays the error; retain the form/key for an explicit retry. */ }
finally { this.saving = false }
}
}
}
</script>