93 lines
3.3 KiB
Vue
93 lines
3.3 KiB
Vue
<template>
|
|
<el-dialog :title="`${form.id ? '编辑' : '添加'}供应商`" :visible.sync="dialogVisible" @close="reset">
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
|
|
<el-form-item label="供应商" prop="purveyorName">
|
|
<el-input v-model="form.purveyorName" placeholder="请输入供应商名称"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="联系电话">
|
|
<el-input v-model="form.purveyorTelephone" placeholder="请输入联系电话"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="地址">
|
|
<el-input type="textarea" v-model="form.address" placeholder="请输入地址"></el-input>
|
|
</el-form-item>
|
|
<!-- <el-form-item label="标签">
|
|
<el-input v-model="form.tip" placeholder="请输入标签"></el-input>
|
|
</el-form-item> -->
|
|
<el-form-item label="备注">
|
|
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
<el-button type="primary" @click="onSubmitHandle">确 定</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script>
|
|
import { tbShopPurveyor } from '@/api/invoicing'
|
|
export default {
|
|
data() {
|
|
return {
|
|
dialogVisible: false,
|
|
form: {
|
|
id: '',
|
|
purveyorName: '',
|
|
purveyorTelephone: '',
|
|
address: '',
|
|
// tip: '',
|
|
remark: '',
|
|
},
|
|
rules: {
|
|
purveyorName: [
|
|
{
|
|
required: true,
|
|
message: '请输入供应商名称',
|
|
trigger: 'blur'
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
onSubmitHandle() {
|
|
this.$refs.form.validate(async valid => {
|
|
if (valid) {
|
|
try {
|
|
let res = await tbShopPurveyor({
|
|
...this.form,
|
|
shopId: localStorage.getItem('shopId')
|
|
}, this.form.id ? 'put' : 'post')
|
|
this.$emit('success', res)
|
|
this.close()
|
|
this.$notify({
|
|
title: '成功',
|
|
message: `${this.form.id ? '编辑' : '添加'}成功`,
|
|
type: 'success'
|
|
});
|
|
} catch (error) {
|
|
console.log(error)
|
|
}
|
|
}
|
|
})
|
|
},
|
|
show(obj) {
|
|
this.dialogVisible = true
|
|
if (obj && obj.id) {
|
|
this.form = JSON.parse(JSON.stringify(obj))
|
|
}
|
|
},
|
|
close() {
|
|
this.dialogVisible = false
|
|
},
|
|
reset() {
|
|
this.form.id = ''
|
|
this.form.purveyorName = ''
|
|
this.form.purveyorTelephone = ''
|
|
this.form.address = ''
|
|
// this.form.tip = ''
|
|
this.form.remark = ''
|
|
}
|
|
}
|
|
}
|
|
</script> |