|
@@ -5,7 +5,7 @@
|
|
<el-button type="primary" size="small" @click="toAdd()">添加</el-button>
|
|
<el-button type="primary" size="small" @click="toAdd()">添加</el-button>
|
|
</template>
|
|
</template>
|
|
</data-table>
|
|
</data-table>
|
|
- <el-dialog :title="dialog.title" :visible.sync="dialog.show" width="50%" :before-close="toClose">
|
|
|
|
|
|
+ <el-dialog :title="dialog.title" :visible.sync="dialog.show" width="50%" :before-close="toClose" :close-on-click-modal="false">
|
|
<form-1 :form="form" @onSubmit="onSubmit"></form-1>
|
|
<form-1 :form="form" @onSubmit="onSubmit"></form-1>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
@@ -37,7 +37,7 @@ export default {
|
|
label: '用户类别',
|
|
label: '用户类别',
|
|
prop: 'type',
|
|
prop: 'type',
|
|
format: (i) => {
|
|
format: (i) => {
|
|
- return i === '1' ? '超级管理员' : '未识别';
|
|
|
|
|
|
+ return i === '1' ? '超级管理员' : i === '2' ? '审核管理员' : i === '3' ? '库存管理员' : i === '4' ? '财务管理员' : i === '5' ? '商户' : '用户';
|
|
},
|
|
},
|
|
},
|
|
},
|
|
],
|
|
],
|
|
@@ -52,7 +52,7 @@ export default {
|
|
this.search();
|
|
this.search();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- ...mapUser(['query']),
|
|
|
|
|
|
+ ...mapUser(['query', 'fetch', 'create', 'update']),
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
let res = await this.query({ skip, limit, ...info });
|
|
let res = await this.query({ skip, limit, ...info });
|
|
if (this.$checkRes(res)) {
|
|
if (this.$checkRes(res)) {
|
|
@@ -61,19 +61,36 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 修改
|
|
// 修改
|
|
- toEdit({ data }) {
|
|
|
|
- console.log(data);
|
|
|
|
|
|
+ async toEdit({ data }) {
|
|
|
|
+ this.$set(this, `form`, data);
|
|
|
|
+ this.dialog = { title: '信息维护', show: true, type: '1' };
|
|
},
|
|
},
|
|
// 添加
|
|
// 添加
|
|
toAdd() {
|
|
toAdd() {
|
|
this.dialog = { title: '添加信息', show: true, type: '1' };
|
|
this.dialog = { title: '添加信息', show: true, type: '1' };
|
|
},
|
|
},
|
|
// 提交保存
|
|
// 提交保存
|
|
- onSubmit({ data }) {
|
|
|
|
- console.log(data);
|
|
|
|
|
|
+ async onSubmit({ data }) {
|
|
|
|
+ if (data.id) {
|
|
|
|
+ let res = await this.update(data);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({ type: `success`, message: `操作完成` });
|
|
|
|
+ this.toClose();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ let res = await this.create(data);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({ type: `success`, message: `操作完成` });
|
|
|
|
+ this.toClose();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 关闭
|
|
// 关闭
|
|
- toClose() {},
|
|
|
|
|
|
+ toClose() {
|
|
|
|
+ this.search();
|
|
|
|
+ this.form = {};
|
|
|
|
+ this.dialog = { title: '添加信息', show: false, type: '1' };
|
|
|
|
+ },
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
...mapState(['user']),
|
|
...mapState(['user']),
|