|
@@ -21,8 +21,9 @@
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
<el-row>
|
|
<el-row>
|
|
- <el-col :span="24">
|
|
|
|
- <el-button type="primary" size="mini" @click="toBack()">返回</el-button>
|
|
|
|
|
|
+ <el-col :span="24" style="margin: 0 0 10px 0">
|
|
|
|
+ <el-col :span="2"><el-button type="primary" size="mini" @click="toBack()">返回</el-button></el-col>
|
|
|
|
+ <el-col :span="2"><el-button type="primary" size="mini" @click="onSubmit(form)">保存</el-button></el-col>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="24">
|
|
<el-col :span="24">
|
|
<data-form :fields="infoFields" :rules="rules" v-model="form" labelWidth="150px" @save="toSave">
|
|
<data-form :fields="infoFields" :rules="rules" v-model="form" labelWidth="150px" @save="toSave">
|
|
@@ -156,9 +157,11 @@ export default {
|
|
const res = await this.fetch(data._id);
|
|
const res = await this.fetch(data._id);
|
|
if (this.$checkRes(res)) {
|
|
if (this.$checkRes(res)) {
|
|
if (data.shop) {
|
|
if (data.shop) {
|
|
|
|
+ let list = [];
|
|
let res = await this.shopFetch(data.shop._id);
|
|
let res = await this.shopFetch(data.shop._id);
|
|
if (this.$checkRes(res)) {
|
|
if (this.$checkRes(res)) {
|
|
- this.shopList.push(res.data);
|
|
|
|
|
|
+ list.push(res.data);
|
|
|
|
+ this.$set(this, 'shopList', list);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.$set(this, `form`, res.data);
|
|
this.$set(this, `form`, res.data);
|
|
@@ -256,10 +259,29 @@ export default {
|
|
return arr.join(';');
|
|
return arr.join(';');
|
|
},
|
|
},
|
|
// 保存
|
|
// 保存
|
|
|
|
+ async onSubmit(data) {
|
|
|
|
+ let res;
|
|
|
|
+ if (data.id) {
|
|
|
|
+ data.shop = this.user.shop.id;
|
|
|
|
+ res = await this.update(data);
|
|
|
|
+ } else {
|
|
|
|
+ res = await this.create(data);
|
|
|
|
+ }
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({ type: `success`, message: `维护信息成功` });
|
|
|
|
+ this.toBack();
|
|
|
|
+ this.search();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 保存
|
|
async toSave({ data }) {
|
|
async toSave({ data }) {
|
|
let res;
|
|
let res;
|
|
- if (data.id) res = await this.update(data);
|
|
|
|
- else res = await this.create(data);
|
|
|
|
|
|
+ if (data.id) {
|
|
|
|
+ data.shop = this.user.shop.id;
|
|
|
|
+ res = await this.update(data);
|
|
|
|
+ } else {
|
|
|
|
+ res = await this.create(data);
|
|
|
|
+ }
|
|
if (this.$checkRes(res)) {
|
|
if (this.$checkRes(res)) {
|
|
this.$message({ type: `success`, message: `维护信息成功` });
|
|
this.$message({ type: `success`, message: `维护信息成功` });
|
|
this.toBack();
|
|
this.toBack();
|