update 混料详情
This commit is contained in:
parent
55b1918419
commit
fb69da69ae
@ -158,9 +158,11 @@ export default {
|
|||||||
|
|
||||||
if (this.dataForm.id) {
|
if (this.dataForm.id) {
|
||||||
// 如果是编辑
|
// 如果是编辑
|
||||||
$http.get(this.urls.subase + `/${this.dataForm.id}`).then((res) => {
|
this.$http
|
||||||
|
.get(this.urls.subase + `/${this.dataForm.id}`)
|
||||||
|
.then(({ data: res }) => {
|
||||||
// dev env:
|
// dev env:
|
||||||
if (LOCAL) res.data.id = res.data._id;
|
// if (LOCAL) res.data.id = res.data._id;
|
||||||
// end dev env
|
// end dev env
|
||||||
if (res && res.code === 0) {
|
if (res && res.code === 0) {
|
||||||
const dataFormKeys = Object.keys(this.dataForm);
|
const dataFormKeys = Object.keys(this.dataForm);
|
||||||
@ -189,14 +191,14 @@ export default {
|
|||||||
case "add":
|
case "add":
|
||||||
case "update": {
|
case "update": {
|
||||||
const method = payload.name === "add" ? "POST" : "PUT";
|
const method = payload.name === "add" ? "POST" : "PUT";
|
||||||
$http({
|
this.$http({
|
||||||
url: this.urls.subase,
|
url: this.urls.subase,
|
||||||
method,
|
method,
|
||||||
data: {
|
data: {
|
||||||
...this.dataForm,
|
...this.dataForm,
|
||||||
[this.configs.extraParams]: this.relatedId,
|
[this.configs.extraParams]: this.relatedId,
|
||||||
},
|
},
|
||||||
}).then((res) => {
|
}).then(({ data: res }) => {
|
||||||
console.log("[add&update] res is: ", res);
|
console.log("[add&update] res is: ", res);
|
||||||
this.$message.success(
|
this.$message.success(
|
||||||
payload.name === "add" ? "添加成功" : "更新成功"
|
payload.name === "add" ? "添加成功" : "更新成功"
|
||||||
|
@ -67,11 +67,12 @@ export default {
|
|||||||
// 可能需要验证权限,如 opt.permission 选项
|
// 可能需要验证权限,如 opt.permission 选项
|
||||||
// 注意:为空字符串或null/undefined都会不验证权限
|
// 注意:为空字符串或null/undefined都会不验证权限
|
||||||
if (!opt.permission || (opt.permission && this.$hasPermission(opt.permission))) {
|
if (!opt.permission || (opt.permission && this.$hasPermission(opt.permission))) {
|
||||||
|
console.log('[operation component]: ', opt.permission, this.$hasPermission(opt.permission))
|
||||||
btns.push(
|
btns.push(
|
||||||
h('el-button',
|
h('el-button',
|
||||||
{
|
{
|
||||||
props: { type: 'text' },
|
props: { type: 'text' },
|
||||||
style: { color: this.colors[optionStr.name] || '#409EFF' },
|
style: { color: this.colors[opt.name] || '#409EFF' },
|
||||||
on: { click: this.emit.bind(null, opt) }
|
on: { click: this.emit.bind(null, opt) }
|
||||||
},
|
},
|
||||||
this.text[opt.name]
|
this.text[opt.name]
|
||||||
|
@ -18,7 +18,7 @@ export default function () {
|
|||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
width: 120,
|
width: 120,
|
||||||
subcomponent: TableOperaionComponent,
|
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: '备注' } }],
|
[{ textarea: true, label: '备注', prop: 'remark', elparams: { placeholder: '备注' } }],
|
||||||
],
|
],
|
||||||
operations: [
|
operations: [
|
||||||
{ name: 'add', label: '保存', type: 'primary', showOnEdit: false },
|
{ name: 'add', label: '保存', type: 'primary', permission: 'pms:blenderStep:save', showOnEdit: false },
|
||||||
{ name: 'update', label: '更新', type: 'primary', showOnEdit: true },
|
{ name: 'update', label: '更新', type: 'primary', permission: 'pms:blenderStep:update', showOnEdit: true },
|
||||||
{ name: 'reset', label: '重置', type: 'warning', showAlways: true },
|
{ name: 'reset', label: '重置', type: 'warning', showAlways: true },
|
||||||
// { name: 'cancel', label: '取消', showAlways: true },
|
// { name: 'cancel', label: '取消', showAlways: true },
|
||||||
],
|
],
|
||||||
@ -96,8 +96,8 @@ export default function () {
|
|||||||
width: 120,
|
width: 120,
|
||||||
subcomponent: TableOperaionComponent,
|
subcomponent: TableOperaionComponent,
|
||||||
options: [
|
options: [
|
||||||
{ name: 'edit', permission: 'pms:blender:edit' },
|
{ name: 'edit', permission: 'pms:blenderStepParam:update' },
|
||||||
{ name: 'delete', permission: 'pms:blender:delete' },
|
{ name: 'delete', permission: 'pms:blenderStepParam:delete' },
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -124,8 +124,8 @@ export default function () {
|
|||||||
]
|
]
|
||||||
],
|
],
|
||||||
operations: [
|
operations: [
|
||||||
{ name: 'add', label: '保存', type: 'primary', showOnEdit: false },
|
{ name: 'add', label: '保存', type: 'primary', permission: 'pms:blenderStepParam:save', showOnEdit: false },
|
||||||
{ name: 'update', label: '更新', type: 'primary', showOnEdit: true },
|
{ name: 'update', label: '更新', type: 'primary', permission: 'pms:blenderStepParam:update', showOnEdit: true },
|
||||||
// { name: 'reset', label: '重置', type: 'warning', showAlways: true },
|
// { name: 'reset', label: '重置', type: 'warning', showAlways: true },
|
||||||
// { name: 'cancel', label: '取消', showAlways: true },
|
// { name: 'cancel', label: '取消', showAlways: true },
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user