update 混料详情

This commit is contained in:
lb
2023-01-16 11:31:20 +08:00
parent 55b1918419
commit fb69da69ae
3 changed files with 22 additions and 19 deletions

View File

@@ -158,15 +158,17 @@ export default {
if (this.dataForm.id) {
// 如果是编辑
$http.get(this.urls.subase + `/${this.dataForm.id}`).then((res) => {
// dev env:
if (LOCAL) res.data.id = res.data._id;
// end dev env
if (res && res.code === 0) {
const dataFormKeys = Object.keys(this.dataForm);
this.dataForm = __pick(res.data, dataFormKeys);
}
});
this.$http
.get(this.urls.subase + `/${this.dataForm.id}`)
.then(({ data: res }) => {
// dev env:
// if (LOCAL) res.data.id = res.data._id;
// end dev env
if (res && res.code === 0) {
const dataFormKeys = Object.keys(this.dataForm);
this.dataForm = __pick(res.data, dataFormKeys);
}
});
} else {
// 如果不是编辑
}
@@ -189,14 +191,14 @@ export default {
case "add":
case "update": {
const method = payload.name === "add" ? "POST" : "PUT";
$http({
this.$http({
url: this.urls.subase,
method,
data: {
...this.dataForm,
[this.configs.extraParams]: this.relatedId,
},
}).then((res) => {
}).then(({ data: res }) => {
console.log("[add&update] res is: ", res);
this.$message.success(
payload.name === "add" ? "添加成功" : "更新成功"

View File

@@ -67,11 +67,12 @@ export default {
// 可能需要验证权限,如 opt.permission 选项
// 注意为空字符串或null/undefined都会不验证权限
if (!opt.permission || (opt.permission && this.$hasPermission(opt.permission))) {
console.log('[operation component]: ', opt.permission, this.$hasPermission(opt.permission))
btns.push(
h('el-button',
{
props: { type: 'text' },
style: { color: this.colors[optionStr.name] || '#409EFF' },
style: { color: this.colors[opt.name] || '#409EFF' },
on: { click: this.emit.bind(null, opt) }
},
this.text[opt.name]