src/main/resources/vm/vue/index-tree.vue.vm | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/vm/vue/index.vue.vm | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/vm/vue/v3/index-tree.vue.vm | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/vm/vue/v3/index.vue.vm | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/resources/vm/vue/index-tree.vue.vm
@@ -283,9 +283,9 @@ </template> <script> import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}" import Treeselect from "@riophae/vue-treeselect" import "@riophae/vue-treeselect/dist/vue-treeselect.css" export default { name: "${BusinessName}", @@ -346,18 +346,18 @@ #end #end } }; } }, created() { this.getList(); this.getList() }, methods: { /** 查询${functionName}列表 */ getList() { this.loading = true; this.loading = true #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") this.queryParams.params = {}; this.queryParams.params = {} #break #end #end @@ -365,40 +365,40 @@ #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) { this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]; this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]; this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0] this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1] } #end #end list${BusinessName}(this.queryParams).then(response => { this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); this.loading = false; }); this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}") this.loading = false }) }, /** 转换${functionName}数据结构 */ normalizer(node) { if (node.children && !node.children.length) { delete node.children; delete node.children } return { id: node.${treeCode}, label: node.${treeName}, children: node.children }; } }, /** 查询${functionName}下拉树结构 */ getTreeselect() { list${BusinessName}().then(response => { this.${businessName}Options = []; const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] }; data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); this.${businessName}Options.push(data); }); this.${businessName}Options = [] const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] } data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}") this.${businessName}Options.push(data) }) }, // 取消按钮 cancel() { this.open = false; this.reset(); this.open = false this.reset() }, // 表单重置 reset() { @@ -410,61 +410,61 @@ $column.javaField: null#if($foreach.count != $columns.size()),#end #end #end }; this.resetForm("form"); } this.resetForm("form") }, /** 搜索按钮操作 */ handleQuery() { this.getList(); this.getList() }, /** 重置按钮操作 */ resetQuery() { #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) this.daterange${AttrName} = []; this.daterange${AttrName} = [] #end #end this.resetForm("queryForm"); this.handleQuery(); this.resetForm("queryForm") this.handleQuery() }, /** 新增按钮操作 */ handleAdd(row) { this.reset(); this.getTreeselect(); this.reset() this.getTreeselect() if (row != null && row.${treeCode}) { this.form.${treeParentCode} = row.${treeCode}; this.form.${treeParentCode} = row.${treeCode} } else { this.form.${treeParentCode} = 0; this.form.${treeParentCode} = 0 } this.open = true; this.title = "添加${functionName}"; this.open = true this.title = "添加${functionName}" }, /** 展开/折叠操作 */ toggleExpandAll() { this.refreshTable = false; this.isExpandAll = !this.isExpandAll; this.refreshTable = false this.isExpandAll = !this.isExpandAll this.$nextTick(() => { this.refreshTable = true; }); this.refreshTable = true }) }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); this.getTreeselect(); this.reset() this.getTreeselect() if (row != null) { this.form.${treeParentCode} = row.${treeParentCode}; this.form.${treeParentCode} = row.${treeParentCode} } get${BusinessName}(row.${pkColumn.javaField}).then(response => { this.form = response.data; this.form = response.data #foreach ($column in $columns) #if($column.htmlType == "checkbox") this.form.$column.javaField = this.form.${column.javaField}.split(","); this.form.$column.javaField = this.form.${column.javaField}.split(",") #end #end this.open = true; this.title = "修改${functionName}"; }); this.open = true this.title = "修改${functionName}" }) }, /** 提交按钮 */ submitForm() { @@ -472,34 +472,34 @@ if (valid) { #foreach ($column in $columns) #if($column.htmlType == "checkbox") this.form.$column.javaField = this.form.${column.javaField}.join(","); this.form.$column.javaField = this.form.${column.javaField}.join(",") #end #end if (this.form.${pkColumn.javaField} != null) { update${BusinessName}(this.form).then(response => { this.#[[$modal]]#.msgSuccess("修改成功"); this.open = false; this.getList(); }); this.#[[$modal]]#.msgSuccess("修改成功") this.open = false this.getList() }) } else { add${BusinessName}(this.form).then(response => { this.#[[$modal]]#.msgSuccess("新增成功"); this.open = false; this.getList(); }); this.#[[$modal]]#.msgSuccess("新增成功") this.open = false this.getList() }) } } }); }) }, /** 删除按钮操作 */ handleDelete(row) { this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() { return del${BusinessName}(row.${pkColumn.javaField}); return del${BusinessName}(row.${pkColumn.javaField}) }).then(() => { this.getList(); this.#[[$modal]]#.msgSuccess("删除成功"); }).catch(() => {}); this.getList() this.#[[$modal]]#.msgSuccess("删除成功") }).catch(() => {}) } } }; } </script> src/main/resources/vm/vue/index.vue.vm
@@ -353,7 +353,7 @@ </template> <script> import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}" export default { name: "${BusinessName}", @@ -423,18 +423,18 @@ #end #end } }; } }, created() { this.getList(); this.getList() }, methods: { /** 查询${functionName}列表 */ getList() { this.loading = true; this.loading = true #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") this.queryParams.params = {}; this.queryParams.params = {} #break #end #end @@ -442,21 +442,21 @@ #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) if (null != this.daterange${AttrName} && '' != this.daterange${AttrName}) { this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0]; this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1]; this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0] this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1] } #end #end list${BusinessName}(this.queryParams).then(response => { this.${businessName}List = response.rows; this.total = response.total; this.loading = false; }); this.${businessName}List = response.rows this.total = response.total this.loading = false }) }, // 取消按钮 cancel() { this.open = false; this.reset(); this.open = false this.reset() }, // 表单重置 reset() { @@ -468,27 +468,27 @@ $column.javaField: null#if($foreach.count != $columns.size()),#end #end #end }; } #if($table.sub) this.${subclassName}List = []; this.${subclassName}List = [] #end this.resetForm("form"); this.resetForm("form") }, /** 搜索按钮操作 */ handleQuery() { this.queryParams.pageNum = 1; this.getList(); this.queryParams.pageNum = 1 this.getList() }, /** 重置按钮操作 */ resetQuery() { #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) this.daterange${AttrName} = []; this.daterange${AttrName} = [] #end #end this.resetForm("queryForm"); this.handleQuery(); this.resetForm("queryForm") this.handleQuery() }, // 多选框选中数据 handleSelectionChange(selection) { @@ -498,27 +498,27 @@ }, /** 新增按钮操作 */ handleAdd() { this.reset(); this.open = true; this.title = "添加${functionName}"; this.reset() this.open = true this.title = "添加${functionName}" }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); this.reset() const ${pkColumn.javaField} = row.${pkColumn.javaField} || this.ids get${BusinessName}(${pkColumn.javaField}).then(response => { this.form = response.data; this.form = response.data #foreach ($column in $columns) #if($column.htmlType == "checkbox") this.form.$column.javaField = this.form.${column.javaField}.split(","); this.form.$column.javaField = this.form.${column.javaField}.split(",") #end #end #if($table.sub) this.${subclassName}List = response.data.${subclassName}List; this.${subclassName}List = response.data.${subclassName}List #end this.open = true; this.title = "修改${functionName}"; }); this.open = true this.title = "修改${functionName}" }) }, /** 提交按钮 */ submitForm() { @@ -526,64 +526,64 @@ if (valid) { #foreach ($column in $columns) #if($column.htmlType == "checkbox") this.form.$column.javaField = this.form.${column.javaField}.join(","); this.form.$column.javaField = this.form.${column.javaField}.join(",") #end #end #if($table.sub) this.form.${subclassName}List = this.${subclassName}List; this.form.${subclassName}List = this.${subclassName}List #end if (this.form.${pkColumn.javaField} != null) { update${BusinessName}(this.form).then(response => { this.#[[$modal]]#.msgSuccess("修改成功"); this.open = false; this.getList(); }); this.#[[$modal]]#.msgSuccess("修改成功") this.open = false this.getList() }) } else { add${BusinessName}(this.form).then(response => { this.#[[$modal]]#.msgSuccess("新增成功"); this.open = false; this.getList(); }); this.#[[$modal]]#.msgSuccess("新增成功") this.open = false this.getList() }) } } }); }) }, /** 删除按钮操作 */ handleDelete(row) { const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids; const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids this.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(function() { return del${BusinessName}(${pkColumn.javaField}s); return del${BusinessName}(${pkColumn.javaField}s) }).then(() => { this.getList(); this.#[[$modal]]#.msgSuccess("删除成功"); }).catch(() => {}); this.getList() this.#[[$modal]]#.msgSuccess("删除成功") }).catch(() => {}) }, #if($table.sub) /** ${subTable.functionName}序号 */ row${subClassName}Index({ row, rowIndex }) { row.index = rowIndex + 1; row.index = rowIndex + 1 }, /** ${subTable.functionName}添加按钮操作 */ handleAdd${subClassName}() { let obj = {}; let obj = {} #foreach($column in $subTable.columns) #if($column.pk || $column.javaField == ${subTableFkclassName}) #elseif($column.list && "" != $javaField) obj.$column.javaField = ""; obj.$column.javaField = "" #end #end this.${subclassName}List.push(obj); this.${subclassName}List.push(obj) }, /** ${subTable.functionName}删除按钮操作 */ handleDelete${subClassName}() { if (this.checked${subClassName}.length == 0) { this.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据"); this.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据") } else { const ${subclassName}List = this.${subclassName}List; const checked${subClassName} = this.checked${subClassName}; const ${subclassName}List = this.${subclassName}List const checked${subClassName} = this.checked${subClassName} this.${subclassName}List = ${subclassName}List.filter(function(item) { return checked${subClassName}.indexOf(item.index) == -1 }); }) } }, /** 复选框选中数据 */ @@ -598,5 +598,5 @@ }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`) } } }; } </script> src/main/resources/vm/vue/v3/index-tree.vue.vm
@@ -271,26 +271,26 @@ </template> <script setup name="${BusinessName}"> import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}" const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance() #if(${dicts} != '') #set($dictsNoSymbol=$dicts.replace("'", "")) const { ${dictsNoSymbol} } = proxy.useDict(${dicts}); const { ${dictsNoSymbol} } = proxy.useDict(${dicts}) #end const ${businessName}List = ref([]); const ${businessName}Options = ref([]); const open = ref(false); const loading = ref(true); const showSearch = ref(true); const title = ref(""); const isExpandAll = ref(true); const refreshTable = ref(true); const ${businessName}List = ref([]) const ${businessName}Options = ref([]) const open = ref(false) const loading = ref(true) const showSearch = ref(true) const title = ref("") const isExpandAll = ref(true) const refreshTable = ref(true) #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) const daterange${AttrName} = ref([]); const daterange${AttrName} = ref([]) #end #end @@ -318,16 +318,16 @@ #end #end } }); }) const { queryParams, form, rules } = toRefs(data); const { queryParams, form, rules } = toRefs(data) /** 查询${functionName}列表 */ function getList() { loading.value = true; loading.value = true #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") queryParams.value.params = {}; queryParams.value.params = {} #break #end #end @@ -335,31 +335,31 @@ #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) if (null != daterange${AttrName} && '' != daterange${AttrName}) { queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]; queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]; queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0] queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1] } #end #end list${BusinessName}(queryParams.value).then(response => { ${businessName}List.value = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}"); loading.value = false; }); ${businessName}List.value = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}") loading.value = false }) } /** 查询${functionName}下拉树结构 */ function getTreeselect() { list${BusinessName}().then(response => { ${businessName}Options.value = []; const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] }; data.children = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}"); ${businessName}Options.value.push(data); }); ${businessName}Options.value = [] const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] } data.children = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}") ${businessName}Options.value.push(data) }) } // 取消按钮 function cancel() { open.value = false; reset(); open.value = false reset() } // 表单重置 @@ -372,13 +372,13 @@ $column.javaField: null#if($foreach.count != $columns.size()),#end #end #end }; proxy.resetForm("${businessName}Ref"); } proxy.resetForm("${businessName}Ref") } /** 搜索按钮操作 */ function handleQuery() { getList(); getList() } /** 重置按钮操作 */ @@ -386,52 +386,52 @@ #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) daterange${AttrName}.value = []; daterange${AttrName}.value = [] #end #end proxy.resetForm("queryRef"); handleQuery(); proxy.resetForm("queryRef") handleQuery() } /** 新增按钮操作 */ function handleAdd(row) { reset(); getTreeselect(); reset() getTreeselect() if (row != null && row.${treeCode}) { form.value.${treeParentCode} = row.${treeCode}; form.value.${treeParentCode} = row.${treeCode} } else { form.value.${treeParentCode} = 0; form.value.${treeParentCode} = 0 } open.value = true; title.value = "添加${functionName}"; open.value = true title.value = "添加${functionName}" } /** 展开/折叠操作 */ function toggleExpandAll() { refreshTable.value = false; isExpandAll.value = !isExpandAll.value; refreshTable.value = false isExpandAll.value = !isExpandAll.value nextTick(() => { refreshTable.value = true; }); refreshTable.value = true }) } /** 修改按钮操作 */ async function handleUpdate(row) { reset(); await getTreeselect(); reset() await getTreeselect() if (row != null) { form.value.${treeParentCode} = row.${treeParentCode}; form.value.${treeParentCode} = row.${treeParentCode} } get${BusinessName}(row.${pkColumn.javaField}).then(response => { form.value = response.data; form.value = response.data #foreach ($column in $columns) #if($column.htmlType == "checkbox") form.value.$column.javaField = form.value.${column.javaField}.split(","); form.value.$column.javaField = form.value.${column.javaField}.split(",") #end #end open.value = true; title.value = "修改${functionName}"; }); open.value = true title.value = "修改${functionName}" }) } /** 提交按钮 */ @@ -440,35 +440,35 @@ if (valid) { #foreach ($column in $columns) #if($column.htmlType == "checkbox") form.value.$column.javaField = form.value.${column.javaField}.join(","); form.value.$column.javaField = form.value.${column.javaField}.join(",") #end #end if (form.value.${pkColumn.javaField} != null) { update${BusinessName}(form.value).then(response => { proxy.#[[$modal]]#.msgSuccess("修改成功"); open.value = false; getList(); }); proxy.#[[$modal]]#.msgSuccess("修改成功") open.value = false getList() }) } else { add${BusinessName}(form.value).then(response => { proxy.#[[$modal]]#.msgSuccess("新增成功"); open.value = false; getList(); }); proxy.#[[$modal]]#.msgSuccess("新增成功") open.value = false getList() }) } } }); }) } /** 删除按钮操作 */ function handleDelete(row) { proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() { return del${BusinessName}(row.${pkColumn.javaField}); return del${BusinessName}(row.${pkColumn.javaField}) }).then(() => { getList(); proxy.#[[$modal]]#.msgSuccess("删除成功"); }).catch(() => {}); getList() proxy.#[[$modal]]#.msgSuccess("删除成功") }).catch(() => {}) } getList(); getList() </script> src/main/resources/vm/vue/v3/index.vue.vm
@@ -343,33 +343,33 @@ </template> <script setup name="${BusinessName}"> import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}" const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance() #if(${dicts} != '') #set($dictsNoSymbol=$dicts.replace("'", "")) const { ${dictsNoSymbol} } = proxy.useDict(${dicts}); const { ${dictsNoSymbol} } = proxy.useDict(${dicts}) #end const ${businessName}List = ref([]); const ${businessName}List = ref([]) #if($table.sub) const ${subclassName}List = ref([]); const ${subclassName}List = ref([]) #end const open = ref(false); const loading = ref(true); const showSearch = ref(true); const ids = ref([]); const open = ref(false) const loading = ref(true) const showSearch = ref(true) const ids = ref([]) #if($table.sub) const checked${subClassName} = ref([]); const checked${subClassName} = ref([]) #end const single = ref(true); const multiple = ref(true); const total = ref(0); const title = ref(""); const single = ref(true) const multiple = ref(true) const total = ref(0) const title = ref("") #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) const daterange${AttrName} = ref([]); const daterange${AttrName} = ref([]) #end #end @@ -399,16 +399,16 @@ #end #end } }); }) const { queryParams, form, rules } = toRefs(data); const { queryParams, form, rules } = toRefs(data) /** 查询${functionName}列表 */ function getList() { loading.value = true; loading.value = true #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") queryParams.value.params = {}; queryParams.value.params = {} #break #end #end @@ -416,22 +416,22 @@ #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) if (null != daterange${AttrName} && '' != daterange${AttrName}) { queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]; queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]; queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0] queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1] } #end #end list${BusinessName}(queryParams.value).then(response => { ${businessName}List.value = response.rows; total.value = response.total; loading.value = false; }); ${businessName}List.value = response.rows total.value = response.total loading.value = false }) } // 取消按钮 function cancel() { open.value = false; reset(); open.value = false reset() } // 表单重置 @@ -444,17 +444,17 @@ $column.javaField: null#if($foreach.count != $columns.size()),#end #end #end }; } #if($table.sub) ${subclassName}List.value = []; ${subclassName}List.value = [] #end proxy.resetForm("${businessName}Ref"); proxy.resetForm("${businessName}Ref") } /** 搜索按钮操作 */ function handleQuery() { queryParams.value.pageNum = 1; getList(); queryParams.value.pageNum = 1 getList() } /** 重置按钮操作 */ @@ -462,44 +462,44 @@ #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) daterange${AttrName}.value = []; daterange${AttrName}.value = [] #end #end proxy.resetForm("queryRef"); handleQuery(); proxy.resetForm("queryRef") handleQuery() } // 多选框选中数据 function handleSelectionChange(selection) { ids.value = selection.map(item => item.${pkColumn.javaField}); single.value = selection.length != 1; multiple.value = !selection.length; ids.value = selection.map(item => item.${pkColumn.javaField}) single.value = selection.length != 1 multiple.value = !selection.length } /** 新增按钮操作 */ function handleAdd() { reset(); open.value = true; title.value = "添加${functionName}"; reset() open.value = true title.value = "添加${functionName}" } /** 修改按钮操作 */ function handleUpdate(row) { reset(); reset() const _${pkColumn.javaField} = row.${pkColumn.javaField} || ids.value get${BusinessName}(_${pkColumn.javaField}).then(response => { form.value = response.data; form.value = response.data #foreach ($column in $columns) #if($column.htmlType == "checkbox") form.value.$column.javaField = form.value.${column.javaField}.split(","); form.value.$column.javaField = form.value.${column.javaField}.split(",") #end #end #if($table.sub) ${subclassName}List.value = response.data.${subclassName}List; ${subclassName}List.value = response.data.${subclassName}List #end open.value = true; title.value = "修改${functionName}"; }); open.value = true title.value = "修改${functionName}" }) } /** 提交按钮 */ @@ -508,68 +508,68 @@ if (valid) { #foreach ($column in $columns) #if($column.htmlType == "checkbox") form.value.$column.javaField = form.value.${column.javaField}.join(","); form.value.$column.javaField = form.value.${column.javaField}.join(",") #end #end #if($table.sub) form.value.${subclassName}List = ${subclassName}List.value; form.value.${subclassName}List = ${subclassName}List.value #end if (form.value.${pkColumn.javaField} != null) { update${BusinessName}(form.value).then(response => { proxy.#[[$modal]]#.msgSuccess("修改成功"); open.value = false; getList(); }); proxy.#[[$modal]]#.msgSuccess("修改成功") open.value = false getList() }) } else { add${BusinessName}(form.value).then(response => { proxy.#[[$modal]]#.msgSuccess("新增成功"); open.value = false; getList(); }); proxy.#[[$modal]]#.msgSuccess("新增成功") open.value = false getList() }) } } }); }) } /** 删除按钮操作 */ function handleDelete(row) { const _${pkColumn.javaField}s = row.${pkColumn.javaField} || ids.value; const _${pkColumn.javaField}s = row.${pkColumn.javaField} || ids.value proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + _${pkColumn.javaField}s + '"的数据项?').then(function() { return del${BusinessName}(_${pkColumn.javaField}s); return del${BusinessName}(_${pkColumn.javaField}s) }).then(() => { getList(); proxy.#[[$modal]]#.msgSuccess("删除成功"); }).catch(() => {}); getList() proxy.#[[$modal]]#.msgSuccess("删除成功") }).catch(() => {}) } #if($table.sub) /** ${subTable.functionName}序号 */ function row${subClassName}Index({ row, rowIndex }) { row.index = rowIndex + 1; row.index = rowIndex + 1 } /** ${subTable.functionName}添加按钮操作 */ function handleAdd${subClassName}() { let obj = {}; let obj = {} #foreach($column in $subTable.columns) #if($column.pk || $column.javaField == ${subTableFkclassName}) #elseif($column.list && "" != $javaField) obj.$column.javaField = ""; obj.$column.javaField = "" #end #end ${subclassName}List.value.push(obj); ${subclassName}List.value.push(obj) } /** ${subTable.functionName}删除按钮操作 */ function handleDelete${subClassName}() { if (checked${subClassName}.value.length == 0) { proxy.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据"); proxy.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据") } else { const ${subclassName}s = ${subclassName}List.value; const checked${subClassName}s = checked${subClassName}.value; const ${subclassName}s = ${subclassName}List.value const checked${subClassName}s = checked${subClassName}.value ${subclassName}List.value = ${subclassName}s.filter(function(item) { return checked${subClassName}s.indexOf(item.index) == -1 }); }) } } @@ -586,5 +586,5 @@ }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`) } getList(); getList() </script>