|
|
|
|
@ -6,7 +6,7 @@ |
|
|
|
|
width="30%" |
|
|
|
|
@close="closeDialog" |
|
|
|
|
> |
|
|
|
|
<avue-form ref="form" :option="option"></avue-form> |
|
|
|
|
<avue-form ref="form" :option="option" v-model="formData"></avue-form> |
|
|
|
|
|
|
|
|
|
<template #footer> |
|
|
|
|
<span class="dialog-footer"> |
|
|
|
|
@ -17,17 +17,26 @@ |
|
|
|
|
</el-dialog> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
|
|
|
|
|
import {returnMaterial} from '@/api/materials/expend' |
|
|
|
|
export default { |
|
|
|
|
props: { |
|
|
|
|
showDialog: { |
|
|
|
|
type: Boolean, |
|
|
|
|
default: false, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
durableFormId: { |
|
|
|
|
type: Number, |
|
|
|
|
default: 0, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
const today = new Date(); |
|
|
|
|
const defaultDate = `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, '0')}-${today.getDate().toString().padStart(2, '0')}`; |
|
|
|
|
return { |
|
|
|
|
formData: { |
|
|
|
|
returnReason: '', |
|
|
|
|
returnTime: defaultDate, |
|
|
|
|
}, |
|
|
|
|
purchaseTitle:'报废', |
|
|
|
|
openShow: false, |
|
|
|
|
option: { |
|
|
|
|
@ -36,20 +45,14 @@ export default { |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: "报废数量", |
|
|
|
|
prop: "name", |
|
|
|
|
prop: "num", |
|
|
|
|
span: 24, |
|
|
|
|
type: "number", |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: "请输入", |
|
|
|
|
trigger: "blur", |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
value: 1, |
|
|
|
|
disabled: true, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "报废理由", |
|
|
|
|
prop: "sex", |
|
|
|
|
prop: "returnReason", |
|
|
|
|
span: 24, |
|
|
|
|
type:'textarea', |
|
|
|
|
rows:5, |
|
|
|
|
@ -63,9 +66,9 @@ export default { |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "报废时间", |
|
|
|
|
prop: "sex", |
|
|
|
|
prop: "returnTime", |
|
|
|
|
span: 24, |
|
|
|
|
type:'textarea', |
|
|
|
|
type:'date', |
|
|
|
|
rows:5, |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
@ -87,10 +90,25 @@ export default { |
|
|
|
|
this.openShow = false; |
|
|
|
|
this.$emit("closeDialog"); |
|
|
|
|
}, |
|
|
|
|
submit() { |
|
|
|
|
this.$refs.form.validate((valid) => { |
|
|
|
|
async submit() { |
|
|
|
|
this.$refs.form.validate(async (valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
this.$emit("submit", this.formData); |
|
|
|
|
try { |
|
|
|
|
const params = { |
|
|
|
|
durableFormId: this.durableFormId, |
|
|
|
|
num: 1, |
|
|
|
|
returnTime: this.formData.returnTime, |
|
|
|
|
returnReason: this.formData.returnReason, |
|
|
|
|
type: 2 |
|
|
|
|
} |
|
|
|
|
await returnMaterial(params) |
|
|
|
|
this.$message.success('报废成功') |
|
|
|
|
this.closeDialog() |
|
|
|
|
this.$emit('submitSuccess') |
|
|
|
|
this.$refs.form.resetFields() |
|
|
|
|
} catch (error) { |
|
|
|
|
this.$message.error(error.message || '报废失败,请重试') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|