|
@@ -1,8 +1,16 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<el-button size="mini" @click="dialog=true" type="primary">作 废</el-button>
|
|
|
- <el-dialog append-to-body width="30%" title="作废" :visible.sync="dialog">
|
|
|
- <el-input type="textarea" v-model="deletereason" size="small" placeholder="作废原因"></el-input>
|
|
|
+ <el-dialog append-to-body width="600px" title="作废" :visible.sync="dialog">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-form label-position="right" ref="form" :rules="rules" inline label-width="100px" :model="form" size="small">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="作废原因" prop="deletereason">
|
|
|
+ <el-input v-model="form.deletereason" style="width: 400px" placeholder="请输入作废原因名称"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-form>
|
|
|
+ </el-row>
|
|
|
<div class="dialog-footer">
|
|
|
<el-button size="small" @click="dialog = false" class="normal-btn-width">取 消</el-button>
|
|
|
<el-button size="small" type="warning" @click="onSubmit" class="normal-btn-width btn-warning">确 定</el-button>
|
|
@@ -17,7 +25,15 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
dialog:false,
|
|
|
- deletereason:''
|
|
|
+ deletereason:'',
|
|
|
+ form: {
|
|
|
+ "deletereason": ""
|
|
|
+ },
|
|
|
+ rules:{
|
|
|
+ deletereason: [
|
|
|
+ { required: true, message: '请填写作废原因', trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
props:['idName','idKey','id'],
|
|
@@ -26,19 +42,23 @@ export default {
|
|
|
watch:{
|
|
|
},
|
|
|
methods: {
|
|
|
- async onSubmit () {
|
|
|
- let res = await this.$api.requested({
|
|
|
- "id": this.idName,
|
|
|
- "content": {
|
|
|
+ onSubmit () {
|
|
|
+ this.$refs.form.validate(async(valid)=>{
|
|
|
+ if (!valid) return false
|
|
|
+ let res = await this.$api.requested({
|
|
|
+ "id": this.idName,
|
|
|
+ "content": {
|
|
|
[this.idKey]: [this.id],
|
|
|
- "deletereason":this.deletereason
|
|
|
- },
|
|
|
- })
|
|
|
- this.tool.showMessage(res,() => {
|
|
|
- this.dialog = false
|
|
|
- this.$store.dispatch('changeDetailDrawer',false)
|
|
|
- this.$emit('onSuccess')
|
|
|
+ "deletereason":this.form.deletereason
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,() => {
|
|
|
+ this.dialog = false
|
|
|
+ this.$store.dispatch('changeDetailDrawer',false)
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ })
|
|
|
})
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
};
|