diff --git a/ruoyi-ui/src/views/ehs/ehsMaterial/index.vue b/ruoyi-ui/src/views/ehs/ehsMaterial/index.vue index 66359f6..ae70b19 100644 --- a/ruoyi-ui/src/views/ehs/ehsMaterial/index.vue +++ b/ruoyi-ui/src/views/ehs/ehsMaterial/index.vue @@ -429,6 +429,17 @@ 取 消 + + +

物资名称: {{ materialName }}

+

物资数量: {{ materialQuantity }}

+

验证码: {{ captcha }}

+ + + 取消 + 确定 + +
@@ -535,6 +546,13 @@ outOpen:false, outMaterialId:null, outForm:{}, + // 删除与验证码相关 + captcha: null, + captchaInput: null, + materialName: '', + materialQuantity: '', + deleteDialogVisible: false, + materialToDelete: null, // 表单校验 rules: { materialQuantity: [ @@ -680,6 +698,12 @@ this.open = false; this.reset(); }, + generateCaptcha() { + this.captcha = Math.floor(1000 + Math.random() * 9000); + }, + validateCaptcha() { + return this.captchaInput == this.captcha; + }, outCancel() { this.outOpen = false; this.outReset(); @@ -800,6 +824,25 @@ }, /** 删除按钮操作 */ handleDelete(row) { + this.materialToDelete = row; + this.materialName = row.materialName; + this.materialQuantity = row.materialQuantity; + this.generateCaptcha(); + this.deleteDialogVisible = true; + }, + confirmDelete() { + if (this.validateCaptcha()) { + delEhsMaterial(this.materialToDelete.materialId).then(() => { + this.getList(); + this.$message.success("删除成功"); + this.captchaInput = null; + this.deleteDialogVisible = false; + }); + } else { + this.$message.error('验证码错误'); + } + }, + /* handleDelete(row) { const materialIds = row.materialId || this.ids; const materialName = row.materialName; const materialQuantity = row.materialQuantity; @@ -809,7 +852,7 @@ this.getList(); this.$modal.msgSuccess("删除成功"); }).catch(() => {}); - }, + }, */ /** 导出按钮操作 */ handleExport() { this.download('ehsMaterial/ehsMaterial/export', {