update 混料详情
This commit is contained in:
parent
55b1918419
commit
fb69da69ae
@ -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" ? "添加成功" : "更新成功"
|
||||
|
@ -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]
|
||||
|
@ -18,7 +18,7 @@ export default function () {
|
||||
fixed: 'right',
|
||||
width: 120,
|
||||
subcomponent: TableOperaionComponent,
|
||||
options: ['edit', 'delete']
|
||||
options: ['edit', { name: 'delete', permission: 'pms:blenderStep:delete' }]
|
||||
}
|
||||
]
|
||||
|
||||
@ -73,8 +73,8 @@ export default function () {
|
||||
[{ textarea: true, label: '备注', prop: 'remark', elparams: { placeholder: '备注' } }],
|
||||
],
|
||||
operations: [
|
||||
{ name: 'add', label: '保存', type: 'primary', showOnEdit: false },
|
||||
{ name: 'update', label: '更新', type: 'primary', showOnEdit: true },
|
||||
{ name: 'add', label: '保存', type: 'primary', permission: 'pms:blenderStep:save', showOnEdit: false },
|
||||
{ name: 'update', label: '更新', type: 'primary', permission: 'pms:blenderStep:update', showOnEdit: true },
|
||||
{ name: 'reset', label: '重置', type: 'warning', showAlways: true },
|
||||
// { name: 'cancel', label: '取消', showAlways: true },
|
||||
],
|
||||
@ -96,8 +96,8 @@ export default function () {
|
||||
width: 120,
|
||||
subcomponent: TableOperaionComponent,
|
||||
options: [
|
||||
{ name: 'edit', permission: 'pms:blender:edit' },
|
||||
{ name: 'delete', permission: 'pms:blender:delete' },
|
||||
{ name: 'edit', permission: 'pms:blenderStepParam:update' },
|
||||
{ name: 'delete', permission: 'pms:blenderStepParam:delete' },
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -124,8 +124,8 @@ export default function () {
|
||||
]
|
||||
],
|
||||
operations: [
|
||||
{ name: 'add', label: '保存', type: 'primary', showOnEdit: false },
|
||||
{ name: 'update', label: '更新', type: 'primary', showOnEdit: true },
|
||||
{ name: 'add', label: '保存', type: 'primary', permission: 'pms:blenderStepParam:save', showOnEdit: false },
|
||||
{ name: 'update', label: '更新', type: 'primary', permission: 'pms:blenderStepParam:update', showOnEdit: true },
|
||||
// { name: 'reset', label: '重置', type: 'warning', showAlways: true },
|
||||
// { name: 'cancel', label: '取消', showAlways: true },
|
||||
],
|
||||
|
Caricamento…
Fai riferimento in un nuovo problema
Block a user