|
@@ -29,7 +29,6 @@
|
|
|
</el-button>
|
|
|
<el-button type="primary"
|
|
|
link
|
|
|
- v-if="scope.row.${treeParentCode} != 0"
|
|
|
icon="Delete" v-auth="['${moduleName}:${businessName}:remove']"
|
|
|
@click="delete${BusinessName}(scope.row)"
|
|
|
>
|
|
@@ -55,30 +54,31 @@
|
|
|
update${BusinessName}Api,
|
|
|
get${BusinessName}Api
|
|
|
} from '@/api/modules/${moduleName}/${businessName}'
|
|
|
-#if(${dicts} != '')
|
|
|
- #set($dictsNoSymbol=$dicts.replace("'", ""))
|
|
|
-const { proxy } = getCurrentInstance() as ComponentInternalInstance
|
|
|
-const { ${dictsNoSymbol} } = toRefs<any>(proxy?.useDict(${dicts}));
|
|
|
-#end
|
|
|
+ #if(${dicts} != '')
|
|
|
+ #set($dictsNoSymbol=$dicts.replace("'", ""))
|
|
|
+ const { proxy } = getCurrentInstance() as ComponentInternalInstance
|
|
|
+ const { ${dictsNoSymbol} } = toRefs<any>(proxy?.useDict(${dicts}));
|
|
|
+ #end
|
|
|
|
|
|
// ProTable 实例
|
|
|
const proTable = ref<ProTableInstance>()
|
|
|
// 表单model
|
|
|
const model = ref({})
|
|
|
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
|
|
- const initParam = reactive({ type: 1 })
|
|
|
+ const initParam = reactive({})
|
|
|
const ${businessName}Options = ref<any[]>([])
|
|
|
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total && pageNum && pageSize 这些字段,可以在这里进行处理成这些字段
|
|
|
const dataCallback = (res: any) => {
|
|
|
const data = handleTree(res, '${pkColumn.javaField}')
|
|
|
- ${businessName}Options.value = data
|
|
|
+ ${businessName}Options.value = Object.assign([], data)
|
|
|
+ ${businessName}Options.value.push({ ${pkColumn.javaField}: 0, ${treeName}: '顶层', children: null })
|
|
|
setItemsOptions()
|
|
|
return data
|
|
|
}
|
|
|
|
|
|
// 删除${functionName}信息
|
|
|
const delete${BusinessName} = async (params: any) => {
|
|
|
- await useHandleData(del${BusinessName}Api, params.${pkColumn.javaField}, '删除【' + params.${pkColumn.javaField} + '】${functionName}')
|
|
|
+ await useHandleData(del${BusinessName}Api, params.${pkColumn.javaField}, '删除【' + params.${treeName} + '】${functionName}')
|
|
|
proTable.value?.getTableList()
|
|
|
}
|
|
|
|
|
@@ -89,23 +89,23 @@ const { ${dictsNoSymbol} } = toRefs<any>(proxy?.useDict(${dicts}));
|
|
|
if (row?.${pkColumn.javaField}) {
|
|
|
res = await get${BusinessName}Api(row?.${pkColumn.javaField} || null)
|
|
|
}
|
|
|
- model.value = type == 1 ? {} : res.data
|
|
|
// 重置表单项
|
|
|
setItemsOptions()
|
|
|
if (row?.${treeParentCode} == 0 && type == 2) {
|
|
|
itemsOptions.splice(0, 1)
|
|
|
}
|
|
|
// 增加子节点
|
|
|
- if (type == 4 && row?.${treeParentCode}) {
|
|
|
+ if (type == 4) {
|
|
|
res.data = {
|
|
|
- parentId: row?.${treeParentCode}
|
|
|
+ parentId: row?.${pkColumn.javaField}
|
|
|
}
|
|
|
}
|
|
|
+ model.value = type == 1 ? {} : res.data
|
|
|
const params = {
|
|
|
title,
|
|
|
width: 580,
|
|
|
isEdit: type !== 3,
|
|
|
- api: type == 1 ? add${BusinessName}Api : update${BusinessName}Api,
|
|
|
+ api: [1, 4].includes(type) ? add${BusinessName}Api : update${BusinessName}Api,
|
|
|
getTableList: proTable.value?.getTableList
|
|
|
}
|
|
|
formDialogRef.value?.openDialog(params)
|
|
@@ -137,12 +137,24 @@ const { ${dictsNoSymbol} } = toRefs<any>(proxy?.useDict(${dicts}));
|
|
|
#end
|
|
|
width: 120
|
|
|
},
|
|
|
- #elseif($column.list && "" != $column.dictType)
|
|
|
+ #elseif($column.list && $column.htmlType == "input-number")
|
|
|
+ {
|
|
|
+ prop: '${javaField}',
|
|
|
+ label: '${comment}',
|
|
|
+ #if($column.query)
|
|
|
+ search: {
|
|
|
+ el: 'input',
|
|
|
+ },
|
|
|
+ #else
|
|
|
+ #end
|
|
|
+ width: 120
|
|
|
+ },
|
|
|
+ #elseif($column.list && $column.dictType && "" != $column.dictType)
|
|
|
{
|
|
|
prop: '${javaField}',
|
|
|
label: '${comment}',
|
|
|
tag: true,
|
|
|
- enum: ${column.dictType},
|
|
|
+ enum: ${businessName}Options,
|
|
|
#if($column.query)
|
|
|
search: {
|
|
|
el: 'tree-select'
|
|
@@ -181,7 +193,27 @@ const { ${dictsNoSymbol} } = toRefs<any>(proxy?.useDict(${dicts}));
|
|
|
#set($comment=$column.columnComment)
|
|
|
#end
|
|
|
#set($dictType=$column.dictType)
|
|
|
- #if($column.htmlType == "input")
|
|
|
+ #if(${field} == "parentId")
|
|
|
+ {
|
|
|
+ label: '${comment}',
|
|
|
+ prop: '${field}',
|
|
|
+ #if($column.required)
|
|
|
+ rules: [{required: true, message: '${comment}不能为空', trigger: 'blur'}],
|
|
|
+ #else
|
|
|
+ #end
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'tree-select',
|
|
|
+ enum: ${businessName}Options.value,
|
|
|
+ valueKey: '${pkColumn.javaField}',
|
|
|
+ checkStrictly: true,
|
|
|
+ props: {
|
|
|
+ value: '${pkColumn.javaField}',
|
|
|
+ label: '${treeName}'
|
|
|
+ },
|
|
|
+ placeholder: '请选择${comment}'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ #elseif($column.htmlType == "input")
|
|
|
{
|
|
|
label: '${comment}',
|
|
|
prop: '${field}',
|
|
@@ -193,6 +225,18 @@ const { ${dictsNoSymbol} } = toRefs<any>(proxy?.useDict(${dicts}));
|
|
|
placeholder: '请输入${comment}'
|
|
|
}
|
|
|
},
|
|
|
+ #elseif($column.htmlType == "input-number")
|
|
|
+ {
|
|
|
+ label: '${comment}',
|
|
|
+ prop: '${field}',
|
|
|
+ #if($column.required)
|
|
|
+ rules: [{required: true, message: '${comment}不能为空', trigger: 'blur'}],
|
|
|
+ #else
|
|
|
+ #end
|
|
|
+ compOptions: {
|
|
|
+ elTagName: 'input-number',
|
|
|
+ }
|
|
|
+ },
|
|
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
|
|
{
|
|
|
label: '${comment}',
|