🐛fix: #ID31JE 代码生成器生成的模板,新增修改后直接调整为查询列表

This commit is contained in:
yubaolee
2025-10-23 00:31:31 +08:00
parent 35300b9c43
commit 4bf28c77a1
17 changed files with 31 additions and 80 deletions

View File

@@ -17,7 +17,7 @@
<div class="app-container flex-item flex-column"> <div class="app-container flex-item flex-column">
<div class="flex-item"> <div class="flex-item">
<el-card shadow="nerver" class="demo-card fh"> <el-card shadow="nerver" class="demo-card fh">
<auth-table style="height:calc(100% - 52px)" ref="mainTable" :select-type="'radio'" :table-fields="firstHeaderList" :data="mainList" :v-loading="listLoading" @row-click="rowClickFirstTable"></auth-table> <auth-table style="height:calc(100% - 52px)" ref="mainTable" :select-type="'radio'" :table-fields="firstHeaderList" :data="mainList" :loading="listLoading" @row-click="rowClickFirstTable"></auth-table>
<pagination v-show="firstTotal > 0" :total="firstTotal" :page.sync="firstQuery.page" :limit.sync="firstQuery.limit" @pagination="handleCurrentChange" /> <pagination v-show="firstTotal > 0" :total="firstTotal" :page.sync="firstQuery.page" :limit.sync="firstQuery.limit" @pagination="handleCurrentChange" />
</el-card> </el-card>
</div> </div>
@@ -249,7 +249,7 @@ export default {
tempData = this.setDetails(tempData) tempData = this.setDetails(tempData)
tempData.OrgId = this.defaultorgid tempData.OrgId = this.defaultorgid
{FirstTableName}s.add(tempData).then(() => { {FirstTableName}s.add(tempData).then(() => {
this.mainList.unshift(this.firstTemp) this.getList()
this.editModel = false this.editModel = false
this.$notify({ this.$notify({
title: '成功', title: '成功',
@@ -289,13 +289,7 @@ export default {
let tempData = Object.assign({}, this.firstTemp) let tempData = Object.assign({}, this.firstTemp)
tempData = this.setDetails(tempData) tempData = this.setDetails(tempData)
{FirstTableName}s.update(tempData).then(() => { {FirstTableName}s.update(tempData).then(() => {
for (const v of this.mainList) { this.getList()
if (v.id === this.firstTemp.id) {
const index = this.mainList.indexOf(v)
this.mainList.splice(index, 1, this.firstTemp)
break
}
}
this.editModel = false this.editModel = false
this.$notify({ this.$notify({

View File

@@ -18,7 +18,7 @@
<div class="flex-item flex flex-column main-context"> <div class="flex-item flex flex-column main-context">
<!-- 主表 --> <!-- 主表 -->
<div class="flex-item flex flex-column b-w" v-show="showNotFullScreen && !showDetailInTable"> <div class="flex-item flex flex-column b-w" v-show="showNotFullScreen && !showDetailInTable">
<auth-table size="small" ref="mainTable" id="mainTable" :table-fields="firstHeaderList" :data="mainList" :v-loading="listLoading" @row-click="rowClickFirstTable" <auth-table size="small" ref="mainTable" id="mainTable" :table-fields="firstHeaderList" :data="mainList" :loading="listLoading" @row-click="rowClickFirstTable"
@row-dblclick="rowDblClickFirstTable"></auth-table> @row-dblclick="rowDblClickFirstTable"></auth-table>
<div class="flex flex-direction-r p-r-10 b-w p-b-5 p-t-5"> <div class="flex flex-direction-r p-r-10 b-w p-b-5 p-t-5">
<el-pagination size="small" background v-show="firstTotal > 0" v-model:currentPage="firstQuery.page" <el-pagination size="small" background v-show="firstTotal > 0" v-model:currentPage="firstQuery.page"
@@ -385,13 +385,7 @@ const updateData = () => {
let tempData = Object.assign({}, firstTemp) let tempData = Object.assign({}, firstTemp)
tempData = setDetails(tempData) tempData = setDetails(tempData)
{FirstTableName}s.update(tempData).then(() => { {FirstTableName}s.update(tempData).then(() => {
for (const v of mainList.value) { getList()
if (v.id === firstTemp.id) {
const index = mainList.value.indexOf(v)
mainList.value.splice(index, 1, tempData)
break
}
}
editModel.value = false editModel.value = false
showDetailInTable.value = false // 保存后返回列表视图 showDetailInTable.value = false // 保存后返回列表视图
ElNotification.success('更新成功') ElNotification.success('更新成功')

View File

@@ -18,7 +18,7 @@
<div class="flex-item flex flex-column main-context"> <div class="flex-item flex flex-column main-context">
<!-- 主表 --> <!-- 主表 -->
<div class="flex-item flex flex-column b-w" v-show="showNotFullScreen && !showDetailInTable"> <div class="flex-item flex flex-column b-w" v-show="showNotFullScreen && !showDetailInTable">
<auth-table size="small" ref="mainTable" id="mainTable" :table-fields="firstHeaderList" :data="mainList" :v-loading="listLoading" @row-click="rowClickFirstTable" <auth-table size="small" ref="mainTable" id="mainTable" :table-fields="firstHeaderList" :data="mainList" :loading="listLoading" @row-click="rowClickFirstTable"
@row-dblclick="rowDblClickFirstTable"></auth-table> @row-dblclick="rowDblClickFirstTable"></auth-table>
<div class="flex flex-direction-r p-r-10 b-w p-b-5 p-t-5"> <div class="flex flex-direction-r p-r-10 b-w p-b-5 p-t-5">
<el-pagination size="small" background v-show="firstTotal > 0" v-model:currentPage="firstQuery.page" <el-pagination size="small" background v-show="firstTotal > 0" v-model:currentPage="firstQuery.page"
@@ -374,13 +374,7 @@ const updateData = () => {
let tempData = Object.assign({}, firstTemp) let tempData = Object.assign({}, firstTemp)
tempData = setDetails(tempData) tempData = setDetails(tempData)
{FirstTableName}s.update(tempData).then(() => { {FirstTableName}s.update(tempData).then(() => {
for (const v of mainList.value) { getList()
if (v.id === firstTemp.id) {
const index = mainList.value.indexOf(v)
mainList.value.splice(index, 1, tempData)
break
}
}
editModel.value = false editModel.value = false
showDetailInTable.value = false // 保存后返回列表视图 showDetailInTable.value = false // 保存后返回列表视图
ElNotification.success('更新成功') ElNotification.success('更新成功')

View File

@@ -17,7 +17,7 @@
<div class="app-container flex-item flex-column"> <div class="app-container flex-item flex-column">
<div class="flex-item"> <div class="flex-item">
<el-card shadow="nerver" class="demo-card fh"> <el-card shadow="nerver" class="demo-card fh">
<auth-table style="height:calc(100% - 52px)" ref="mainTable" :select-type="'radio'" :table-fields="firstHeaderList" :data="mainList" :v-loading="listLoading" @row-click="rowClickFirstTable"></auth-table> <auth-table style="height:calc(100% - 52px)" ref="mainTable" :select-type="'radio'" :table-fields="firstHeaderList" :data="mainList" :loading="listLoading" @row-click="rowClickFirstTable"></auth-table>
<pagination v-show="firstTotal > 0" :total="firstTotal" :page.sync="firstQuery.page" :limit.sync="firstQuery.limit" @pagination="handleCurrentChange" /> <pagination v-show="firstTotal > 0" :total="firstTotal" :page.sync="firstQuery.page" :limit.sync="firstQuery.limit" @pagination="handleCurrentChange" />
</el-card> </el-card>
</div> </div>
@@ -246,7 +246,7 @@ export default {
tempData = this.setDetails(tempData) tempData = this.setDetails(tempData)
tempData.OrgId = this.defaultorgid tempData.OrgId = this.defaultorgid
{FirstTableName}s.add(tempData).then(() => { {FirstTableName}s.add(tempData).then(() => {
this.mainList.unshift(this.firstTemp) this.getList()
this.editModel = false this.editModel = false
this.$notify({ this.$notify({
title: '成功', title: '成功',
@@ -286,14 +286,7 @@ export default {
let tempData = Object.assign({}, this.firstTemp) let tempData = Object.assign({}, this.firstTemp)
tempData = this.setDetails(tempData) tempData = this.setDetails(tempData)
{FirstTableName}s.update(tempData).then(() => { {FirstTableName}s.update(tempData).then(() => {
for (const v of this.mainList) { this.getList()
if (v.id === this.firstTemp.id) {
const index = this.mainList.indexOf(v)
this.mainList.splice(index, 1, this.firstTemp)
break
}
}
this.editModel = false this.editModel = false
this.$notify({ this.$notify({
title: '成功', title: '成功',

View File

@@ -20,7 +20,7 @@
:select-type="'checkbox'" :select-type="'checkbox'"
:table-fields="headerList" :table-fields="headerList"
:data="list" :data="list"
:v-loading="listLoading" :loading="listLoading"
@row-click="rowClick" @row-click="rowClick"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
></auth-table> ></auth-table>
@@ -180,7 +180,7 @@ export default {
// 保存提交 // 保存提交
this.$refs['dataForm'].validate(() => { this.$refs['dataForm'].validate(() => {
{TableName}s.add(this.temp).then(() => { {TableName}s.add(this.temp).then(() => {
this.list.unshift(this.temp) this.getList()
this.dialogFormVisible = false this.dialogFormVisible = false
this.$notify({ this.$notify({
title: '成功', title: '成功',
@@ -205,13 +205,7 @@ export default {
this.$refs['dataForm'].validate(() => { this.$refs['dataForm'].validate(() => {
const tempData = Object.assign({}, this.temp) const tempData = Object.assign({}, this.temp)
{TableName}s.update(tempData).then(() => { {TableName}s.update(tempData).then(() => {
for (const v of this.list) { this.getList()
if (v.id === this.temp.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.temp)
break
}
}
this.dialogFormVisible = false this.dialogFormVisible = false
this.$notify({ this.$notify({
title: '成功', title: '成功',

View File

@@ -16,7 +16,7 @@
<permission-btn v-on:btn-event="onBtnClicked"></permission-btn> <permission-btn v-on:btn-event="onBtnClicked"></permission-btn>
</sticky> </sticky>
<auth-table ref="mainTableRef" :select-type="'checkbox'" :table-fields="headerList" :data="list" <auth-table ref="mainTableRef" :select-type="'checkbox'" :table-fields="headerList" :data="list"
:v-loading="listLoading" @row-click="rowClick" @selection-change="handleSelectionChange"></auth-table> :loading="listLoading" @row-click="rowClick" @selection-change="handleSelectionChange"></auth-table>
<el-pagination v-show="total > 0" :total="total" v-model:currentPage="listQuery.page" <el-pagination v-show="total > 0" :total="total" v-model:currentPage="listQuery.page"
v-model:page-size="listQuery.limit" @current-change="handleCurrentChange" /> v-model:page-size="listQuery.limit" @current-change="handleCurrentChange" />
</div> </div>
@@ -171,7 +171,7 @@ const handleCreate = async function () {
const createData = function () { const createData = function () {
dataFormRef.value.validate(() => { dataFormRef.value.validate(() => {
{TableName}s.add(temp).then(() => { {TableName}s.add(temp).then(() => {
list.value.unshift(temp) getList()
dialogFormVisible.value = false dialogFormVisible.value = false
ElNotification.success('创建成功') ElNotification.success('创建成功')
}) })
@@ -188,13 +188,7 @@ const updateData = function () {
dataFormRef.value.validate(() => { dataFormRef.value.validate(() => {
const tempData = Object.assign({}, temp) const tempData = Object.assign({}, temp)
{TableName}s.update(tempData).then(() => { {TableName}s.update(tempData).then(() => {
for (const v of list.value) { getList()
if (v.id === temp.id) {
const index = list.value.indexOf(v)
list.value.splice(index, 1, temp)
break
}
}
dialogFormVisible.value = false dialogFormVisible.value = false
ElNotification.success('更新成功') ElNotification.success('更新成功')
}) })

View File

@@ -16,7 +16,7 @@
<permission-btn v-on:btn-event="onBtnClicked"></permission-btn> <permission-btn v-on:btn-event="onBtnClicked"></permission-btn>
</sticky> </sticky>
<auth-table ref="mainTableRef" :select-type="'checkbox'" :table-fields="headerList" :data="list" <auth-table ref="mainTableRef" :select-type="'checkbox'" :table-fields="headerList" :data="list"
:v-loading="listLoading" @row-click="rowClick" @selection-change="handleSelectionChange"></auth-table> :loading="listLoading" @row-click="rowClick" @selection-change="handleSelectionChange"></auth-table>
<el-pagination v-show="total > 0" :total="total" v-model:currentPage="listQuery.page" <el-pagination v-show="total > 0" :total="total" v-model:currentPage="listQuery.page"
v-model:page-size="listQuery.limit" @current-change="handleCurrentChange" /> v-model:page-size="listQuery.limit" @current-change="handleCurrentChange" />
</div> </div>
@@ -172,7 +172,7 @@ const handleCreate = async function () {
const createData = function () { const createData = function () {
dataFormRef.value.validate(() => { dataFormRef.value.validate(() => {
{TableName}s.add(temp).then(() => { {TableName}s.add(temp).then(() => {
list.value.unshift(temp) getList()
dialogFormVisible.value = false dialogFormVisible.value = false
ElNotification.success('创建成功') ElNotification.success('创建成功')
}) })
@@ -189,13 +189,7 @@ const updateData = function () {
dataFormRef.value.validate(() => { dataFormRef.value.validate(() => {
const tempData = Object.assign({}, temp) const tempData = Object.assign({}, temp)
{TableName}s.update(tempData).then(() => { {TableName}s.update(tempData).then(() => {
for (const v of list.value) { getList()
if (v.id === temp.id) {
const index = list.value.indexOf(v)
list.value.splice(index, 1, temp)
break
}
}
dialogFormVisible.value = false dialogFormVisible.value = false
ElNotification.success('更新成功') ElNotification.success('更新成功')
}) })

View File

@@ -20,7 +20,7 @@
:select-type="'checkbox'" :select-type="'checkbox'"
:table-fields="headerList" :table-fields="headerList"
:data="list" :data="list"
:v-loading="listLoading" :loading="listLoading"
@row-click="rowClick" @row-click="rowClick"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
></auth-table> ></auth-table>
@@ -181,7 +181,7 @@ export default {
// 保存提交 // 保存提交
this.$refs['dataForm'].validate(() => { this.$refs['dataForm'].validate(() => {
{TableName}s.add(this.temp).then(() => { {TableName}s.add(this.temp).then(() => {
this.list.unshift(this.temp) this.getList()
this.dialogFormVisible = false this.dialogFormVisible = false
this.$notify({ this.$notify({
title: '成功', title: '成功',
@@ -206,13 +206,7 @@ export default {
this.$refs['dataForm'].validate(() => { this.$refs['dataForm'].validate(() => {
const tempData = Object.assign({}, this.temp) const tempData = Object.assign({}, this.temp)
{TableName}s.update(tempData).then(() => { {TableName}s.update(tempData).then(() => {
for (const v of this.list) { this.getList()
if (v.id === this.temp.id) {
const index = this.list.indexOf(v)
this.list.splice(index, 1, this.temp)
break
}
}
this.dialogFormVisible = false this.dialogFormVisible = false
this.$notify({ this.$notify({
title: '成功', title: '成功',

View File

@@ -21,7 +21,7 @@
<div class="flex-item" v-show="showNotFullScreen"> <div class="flex-item" v-show="showNotFullScreen">
<el-card shadow="nerver" class="demo-card fh"> <el-card shadow="nerver" class="demo-card fh">
<auth-table style="height:calc(100% - 52px)" ref="mainTable" :select-type="'radio'" <auth-table style="height:calc(100% - 52px)" ref="mainTable" :select-type="'radio'"
:table-fields="firstHeaderList" :data="mainList" :v-loading="listLoading" :table-fields="firstHeaderList" :data="mainList" :loading="listLoading"
@row-click="rowClickFirstTable"></auth-table> @row-click="rowClickFirstTable"></auth-table>
<pagination v-show="firstTotal > 0" :total="firstTotal" :page.sync="firstQuery.page" <pagination v-show="firstTotal > 0" :total="firstTotal" :page.sync="firstQuery.page"
:limit.sync="firstQuery.limit" @pagination="handleCurrentChange" /> :limit.sync="firstQuery.limit" @pagination="handleCurrentChange" />

View File

@@ -39,7 +39,7 @@
</div> </div>
</sticky> </sticky>
<auth-table style="height:calc(100% - 60px)" ref="mainTable" :select-type="'checkbox'" :table-fields="headerList" :templates="['privilegeRules']" :data="list" :v-loading="listLoading" @row-click="rowClick" @selection-change="handleSelectionChange"></auth-table> <auth-table style="height:calc(100% - 60px)" ref="mainTable" :select-type="'checkbox'" :table-fields="headerList" :templates="['privilegeRules']" :data="list" :loading="listLoading" @row-click="rowClick" @selection-change="handleSelectionChange"></auth-table>
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="handleCurrentChange" /> <pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="handleCurrentChange" />
</el-main> </el-main>
</div> </div>

View File

@@ -17,7 +17,7 @@
</sticky> </sticky>
<div class="app-container flex-item"> <div class="app-container flex-item">
<div class="bg-white" style="height: 100%;"> <div class="bg-white" style="height: 100%;">
<auth-table style="height:calc(100% - 60px)" ref="mainTable" :select-type="'checkbox'" :table-fields="headerList" :templates="['privilegeRules']" :data="list" :v-loading="listLoading" @row-click="rowClick" @selection-change="handleSelectionChange"></auth-table> <auth-table style="height:calc(100% - 60px)" ref="mainTable" :select-type="'checkbox'" :table-fields="headerList" :templates="['privilegeRules']" :data="list" :loading="listLoading" @row-click="rowClick" @selection-change="handleSelectionChange"></auth-table>
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="handleCurrentChange" /> <pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="handleCurrentChange" />
</div> </div>

View File

@@ -19,7 +19,7 @@
<div class="app-container flex-item"> <div class="app-container flex-item">
<div class="bg-white" style="height: 100%;"> <div class="bg-white" style="height: 100%;">
<auth-table style="height:calc(100% - 60px)" ref="mainTable" :select-type="'checkbox'" <auth-table style="height:calc(100% - 60px)" ref="mainTable" :select-type="'checkbox'"
:table-fields="headerList" :data="list" :v-loading="listLoading" @row-click="rowClick" :table-fields="headerList" :data="list" :loading="listLoading" @row-click="rowClick"
@selection-change="handleSelectionChange"></auth-table> @selection-change="handleSelectionChange"></auth-table>
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" <pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"
@pagination="handleCurrentChange" /> @pagination="handleCurrentChange" />

View File

@@ -26,7 +26,7 @@
:select-type="'checkbox'" :select-type="'checkbox'"
:table-fields="headerList" :table-fields="headerList"
:data="list" :data="list"
:v-loading="listLoading" :loading="listLoading"
@row-click="rowClick" @row-click="rowClick"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
></auth-table> ></auth-table>

View File

@@ -23,7 +23,7 @@
:select-type="'null'" :select-type="'null'"
:table-fields="headerList" :table-fields="headerList"
:data="list" :data="list"
:v-loading="listLoading" :loading="listLoading"
@row-click="rowClick" @row-click="rowClick"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
></auth-table> ></auth-table>

View File

@@ -19,7 +19,7 @@
<div class="app-container flex-item"> <div class="app-container flex-item">
<div class="bg-white" style="height: 100%;"> <div class="bg-white" style="height: 100%;">
<auth-table style="height:calc(100% - 60px)" ref="mainTable" :select-type="'checkbox'" :table-fields="headerList" <auth-table style="height:calc(100% - 60px)" ref="mainTable" :select-type="'checkbox'" :table-fields="headerList"
:data="list" :v-loading="listLoading" @row-click="rowClick" :data="list" :loading="listLoading" @row-click="rowClick"
@selection-change="handleSelectionChange"></auth-table> @selection-change="handleSelectionChange"></auth-table>
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" <pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"
@pagination="handleCurrentChange" /> @pagination="handleCurrentChange" />

View File

@@ -19,7 +19,7 @@
<div class="flex-item"> <div class="flex-item">
<el-card shadow="nerver" class="demo-card fh"> <el-card shadow="nerver" class="demo-card fh">
<auth-table style="height:calc(100% - 52px)" ref="mainTable" :select-type="'radio'" <auth-table style="height:calc(100% - 52px)" ref="mainTable" :select-type="'radio'"
:table-fields="firstHeaderList" :data="mainList" :v-loading="listLoading" :table-fields="firstHeaderList" :data="mainList" :loading="listLoading"
@row-click="rowClickFirstTable"></auth-table> @row-click="rowClickFirstTable"></auth-table>
<pagination v-show="firstTotal > 0" :total="firstTotal" :page.sync="firstQuery.page" <pagination v-show="firstTotal > 0" :total="firstTotal" :page.sync="firstQuery.page"
:limit.sync="firstQuery.limit" @pagination="handleCurrentChange" /> :limit.sync="firstQuery.limit" @pagination="handleCurrentChange" />

View File

@@ -18,7 +18,7 @@ permalink: /pro/table/
:table-fields="tableFields" :table-fields="tableFields"
:data="dataList" :data="dataList"
:edit-model="true" :edit-model="true"
:v-loading="loading" :loading="loading"
:templates="{'id': idtemplate}" :templates="{'id': idtemplate}"
select-type="checkbox" select-type="checkbox"
@row-click="handleRowClick" @row-click="handleRowClick"