<template>
|
<el-dialog
|
v-diadrag
|
title="批量修改定额"
|
:close-on-click-modal="false"
|
:visible.sync="visible"
|
>
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
label-width="120px"
|
class="l-mes"
|
>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item label="定额" prop="quota">
|
<el-input v-model="dataForm.quota" placeholder="定额"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="visible = false">关闭</el-button>
|
<el-button
|
type="primary"
|
:disabled="isSubmit"
|
v-thinclick="`dataFormSubmit`"
|
>确定</el-button
|
>
|
</span>
|
</el-dialog>
|
</template>
|
<script>
|
import { updateQuota } from '@/api/accounting/unitwork'
|
import { validateSixDecimalPositive } from '../../../util/validate'
|
|
export default {
|
data() {
|
return {
|
visible: false,
|
dataForm: {
|
idList: [],
|
quota: null
|
},
|
dataRule: {
|
quota: [
|
{ required: true, message: '定额不能为空', trigger: 'blur' },
|
{ validator: validateSixDecimalPositive, trigger: 'blur' }
|
]
|
},
|
isSubmit: false
|
}
|
},
|
methods: {
|
init(ids) {
|
this.visible = true
|
this.dataForm.idList = ids
|
},
|
// 表单提交
|
dataFormSubmit() {
|
this.isSubmit = true
|
this.$refs.dataForm.validate((valid) => {
|
if (valid) {
|
updateQuota(this.dataForm)
|
.then((data) => {
|
this.$message.success('修改成功')
|
this.dataForm.quota = null
|
this.visible = false
|
this.isSubmit = false
|
this.$emit('refreshDataList')
|
})
|
.catch((error) => {
|
this.isSubmit = false
|
console.log(error)
|
})
|
} else {
|
this.isSubmit = false
|
}
|
})
|
}
|
},
|
mounted() {}
|
}
|
</script>
|