|
@@ -3,7 +3,7 @@
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="170px">
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item :disabled="!idAdd?true:false" label="id" prop="id"><el-input class="inputs" v-model.trim="form.id" autocomplete="off"></el-input></el-form-item>
|
|
|
+ <el-form-item label="id" prop="id"><el-input :disabled="idAdd" class="inputs" v-model.trim="form.id" autocomplete="off"></el-input></el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="公司编号" prop="companyid"><el-input class="inputs" v-model.trim="form.companyid" autocomplete="off"></el-input></el-form-item>
|
|
@@ -127,10 +127,10 @@ export default {
|
|
|
showEdit(row) {
|
|
|
if (!row) {
|
|
|
this.title = '添加'
|
|
|
- this.idAdd = true
|
|
|
+ this.idAdd = false
|
|
|
} else {
|
|
|
this.title = '编辑'
|
|
|
- this.idAdd = false
|
|
|
+ this.idAdd = true
|
|
|
this.form = Object.assign({}, row)
|
|
|
}
|
|
|
this.dialogFormVisible = true
|
|
@@ -144,16 +144,29 @@ export default {
|
|
|
save() {
|
|
|
this.$refs['form'].validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
- api.addRegion(this.form).then(res => {
|
|
|
- if (res.data) {
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '添加成功!'
|
|
|
- });
|
|
|
- this.$emit('save-success');
|
|
|
- this.dialogFormVisible = false
|
|
|
- }
|
|
|
- })
|
|
|
+ if(this.title === "添加"){
|
|
|
+ api.addSave(this.form).then(res => {
|
|
|
+ if (res.data) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '操作成功!'
|
|
|
+ });
|
|
|
+ this.$emit('save-success');
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ api.editSave(this.form).then(res => {
|
|
|
+ if (res.data) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '操作成功!'
|
|
|
+ });
|
|
|
+ this.$emit('save-success');
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
return false
|
|
|
}
|