!398 修改代码生成模板,调整打开对话框和接口请求顺序

Merge pull request !398 from 小驴/5.X
feature/model
疯狂的狮子Li 1 year ago committed by Gitee
commit 6d7f1adea8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -421,17 +421,15 @@ const resetQuery = () => {
/** 新增按钮操作 */ /** 新增按钮操作 */
const handleAdd = (row?: ${BusinessName}VO) => { const handleAdd = (row?: ${BusinessName}VO) => {
dialog.visible = true; reset();
dialog.title = "添加${functionName}"; getTreeselect();
nextTick(() => { if (row != null && row.${treeCode}) {
reset();
getTreeselect();
if (row != null && row.${treeCode}) {
form.value.${treeParentCode} = row.${treeCode}; form.value.${treeParentCode} = row.${treeCode};
} else { } else {
form.value.${treeParentCode} = 0; form.value.${treeParentCode} = 0;
} }
}); dialog.visible = true;
dialog.title = "添加${functionName}";
} }
/** 展开/折叠操作 */ /** 展开/折叠操作 */
@ -449,23 +447,21 @@ const toggleExpandAll = (data: ${BusinessName}VO[], status: boolean) => {
} }
/** 修改按钮操作 */ /** 修改按钮操作 */
const handleUpdate = (row: ${BusinessName}VO) => { const handleUpdate = async (row: ${BusinessName}VO) => {
dialog.visible = true; reset();
dialog.title = "修改${functionName}"; await getTreeselect();
nextTick(async () => { if (row != null) {
reset(); form.value.${treeParentCode} = row.${treeCode};
await getTreeselect(); }
if (row != null) { const res = await get${BusinessName}(row.${treeCode});
form.value.${treeParentCode} = row.${treeCode}; Object.assign(form.value, res.data);
}
const res = await get${BusinessName}(row.${treeCode});
Object.assign(form.value, res.data);
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
form.value.$column.javaField = form.value.${column.javaField}.split(","); form.value.$column.javaField = form.value.${column.javaField}.split(",");
#end
#end #end
#end dialog.visible = true;
}); dialog.title = "修改${functionName}";
} }
/** 提交按钮 */ /** 提交按钮 */

@ -404,28 +404,24 @@ const handleSelectionChange = (selection: ${BusinessName}VO[]) => {
/** 新增按钮操作 */ /** 新增按钮操作 */
const handleAdd = () => { const handleAdd = () => {
reset();
dialog.visible = true; dialog.visible = true;
dialog.title = "添加${functionName}"; dialog.title = "添加${functionName}";
nextTick(() => {
reset();
});
} }
/** 修改按钮操作 */ /** 修改按钮操作 */
const handleUpdate = (row?: ${BusinessName}VO) => { const handleUpdate = async (row?: ${BusinessName}VO) => {
dialog.visible = true; reset();
dialog.title = "修改${functionName}"; const _${pkColumn.javaField} = row?.${pkColumn.javaField} || ids.value[0]
nextTick(async () => { const res = await get${BusinessName}(_${pkColumn.javaField});
reset(); Object.assign(form.value, res.data);
const _${pkColumn.javaField} = row?.${pkColumn.javaField} || ids.value[0]
const res = await get${BusinessName}(_${pkColumn.javaField});
Object.assign(form.value, res.data);
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.htmlType == "checkbox") #if($column.htmlType == "checkbox")
form.value.$column.javaField = form.value.${column.javaField}.split(","); form.value.$column.javaField = form.value.${column.javaField}.split(",");
#end #end
#end #end
}); dialog.visible = true;
dialog.title = "修改${functionName}";
} }
/** 提交按钮 */ /** 提交按钮 */

Loading…
Cancel
Save