新增
let params = {}
let dialogPageId = ''
gUtil.openDialog(dialogPageId, params, 'new', true, (data) => {
let args = {
...data.data,
}
let compId = ''
gUtil.confirm('是否确认保存?', () => {
gUtil.request(compId, args, () => {
mainTable.load()
gUtil.info('操作成功!')
data.vm.closeDialog()
})
})
}, 'form', null)
修改
let row = mainTable.getRow()
if (!row) {
gUtil.error('请选择需要修改的数据!')
return
}
let {primaryKey, state, optimisticLock} = row
if (![].includes(state)) {
gUtil.error('当前数据不可修改!')
return
}
let params = {primaryKey}
let dialogPageId = ''
gUtil.openDialog(dialogPageId, params, 'edit', false, () => {
mainTable.load()
gUtil.info('操作成功!')
}, null, null)
保存
form.valid(null, () => {
let args = {
...form.getData()
}
let compId = ''
gUtil.confirm('是否确认?', () => {
gUtil.request(compId,args, () => {
$vm.dialogCallback()
}, gUtil.error)
})
}, gUtil.error)
保存回调
form.valid(null, () => {
let data = {
vm: {
closeDialog: () => {
$vm.closeDialog()
},
},
data: {
...form.getData()
}
}
$vm.dialogCallbackWithNoClose(data)
}, gUtil.error)