ljw 2025-12-20 11:59:37 +08:00
commit 030f6fcfea
5 changed files with 1267 additions and 1090 deletions

View File

@ -44,6 +44,7 @@ var dTsName = dc + ".d.ts";
import ${ucc}Api from '@/pages/${moduleName}<%if(subModuleName != null){%>/${subModuleName}<%}%>/${apiTsName}' import ${ucc}Api from '@/pages/${moduleName}<%if(subModuleName != null){%>/${subModuleName}<%}%>/${apiTsName}'
import Strings from '@/common/utils/strings.ts' import Strings from '@/common/utils/strings.ts'
import FormUtil from '@/common/utils/formUtil.ts' import FormUtil from '@/common/utils/formUtil.ts'
import Utils from '@/common/utils'
import { import {
ElMessage, ElMessage,
type FormInstance, type FormInstance,
@ -57,7 +58,7 @@ const status = ref<'add' | 'view' | 'modify'>('add')
const ${lcc}FormIns = useTemplateRef<FormInstance>('${lcc}Form') const ${lcc}FormIns = useTemplateRef<FormInstance>('${lcc}Form')
const formData = ref<${ucc}Types.Search${ucc}Result>({}) const formData = Utils.resetAble(reactive<${ucc}Types.Search${ucc}Result>({}))
const rules = reactive<FormRules<${ucc}Types.Search${ucc}Result>>({ const rules = reactive<FormRules<${ucc}Types.Search${ucc}Result>>({
<% <%
for(column in table.columns) { for(column in table.columns) {
@ -67,14 +68,14 @@ ${toCamelCase(column.name)}: [{ required: true, message: '请填写${column.comm
}) })
function dialogCloseHandler() { function dialogCloseHandler() {
formData.value = {} formData.$reset()
} }
function submitHandler() { function submitHandler() {
if (status.value === 'view') return if (status.value === 'view') return
submiting.value = true submiting.value = true
if (formData.value.id != null) { if (formData.id != null) {
FormUtil.submit(${lcc}FormIns, () => ${ucc}Api.modify(formData.value)) FormUtil.submit(${lcc}FormIns, () => ${ucc}Api.modify(formData))
.then(() => { .then(() => {
ElMessage.success('修改成功') ElMessage.success('修改成功')
emits('editSucc') emits('editSucc')
@ -84,7 +85,7 @@ function submitHandler() {
submiting.value = false submiting.value = false
}) })
} else { } else {
FormUtil.submit(${lcc}FormIns, () => ${ucc}Api.add(formData.value)) FormUtil.submit(${lcc}FormIns, () => ${ucc}Api.add(formData))
.then(() => { .then(() => {
ElMessage.success('添加成功') ElMessage.success('添加成功')
emits('editSucc') emits('editSucc')
@ -103,11 +104,11 @@ defineExpose({
status.value = 'modify' status.value = 'modify'
${ucc}Api.detail(data.id!) ${ucc}Api.detail(data.id!)
.then(res => { .then(res => {
formData.value = res.data formData.$reset(res.data)
}) })
} else { } else {
status.value = 'add' status.value = 'add'
formData.value = data formData.$reset(data)
} }
} }
}) })

View File

@ -68,11 +68,14 @@ var dTsName = dc + ".d.ts";
</ElTableColumn> </ElTableColumn>
</ElTable> </ElTable>
<ElPagination <ElPagination
class="pagination" layout="->, sizes, total, prev, pager, next"
layout="prev, pager, next" v-model:current-page="searchForm.current"
:page-size="pagination.size" v-model:page-size="searchForm.size"
:total="pagination.total" :total="totalCount"
@change="pageChangeHandler"/> :page-sizes="[10, 20, 50, 100, 500]"
:hide-on-single-page="false"
:teleported="false"
@change="paging"/>
<${ucc}Form ref="${lcc}Form" @edit-succ="paging"/> <${ucc}Form ref="${lcc}Form" @edit-succ="paging"/>
</Page> </Page>
</template> </template>
@ -82,26 +85,19 @@ import ${ucc}Api from '@/pages/${moduleName}<%if(subModuleName != null){%>/${sub
import ${ucc}Form from '@/pages/${moduleName}<%if(subModuleName != null){%>/${subModuleName}<%}%>/${formVueName}' import ${ucc}Form from '@/pages/${moduleName}<%if(subModuleName != null){%>/${subModuleName}<%}%>/${formVueName}'
import Page from '@/components/page/Page.vue' import Page from '@/components/page/Page.vue'
import { elIcons } from '@/common/element/element.ts' import { elIcons } from '@/common/element/element.ts'
import Utils from '@/common/utils'
const tableData = ref<${ucc}Types.Search${ucc}Result[]>([]) const totalCount = ref(0)
const searchForm = ref<${ucc}Types.Search${ucc}Param>({ const tableData = Utils.resetAble(reactive<${ucc}Types.Search${ucc}Result[]>([]))
const searchForm = Utils.resetAble(reactive<${ucc}Types.Search${ucc}Param>({
current: 1, current: 1,
size: 20, size: 20,
}) }))
const searching = ref(false) const searching = ref(false)
const deling = ref(false) const deling = ref(false)
const showSearchForm = ref(true) const showSearchForm = ref(true)
const ${lcc}FormIns = useTemplateRef<InstanceType<typeof ${ucc}Form>>('${lcc}Form') const ${lcc}FormIns = useTemplateRef<InstanceType<typeof ${ucc}Form>>('${lcc}Form')
const pagination = reactive<G.Pagination>({
total: 0,
current: 1,
size: 1,
})
function pageChangeHandler(currentPage: number, pageSize: number) {
searchForm.value.current = currentPage
searchForm.value.size = pageSize
paging()
}
function showDialog(data?: ${ucc}Types.Search${ucc}Result) { function showDialog(data?: ${ucc}Types.Search${ucc}Result) {
${lcc}FormIns.value?.open(data) ${lcc}FormIns.value?.open(data)
} }
@ -127,18 +123,16 @@ function addHandler() {
} }
function reset() { function reset() {
searchForm.value = { searchForm.$reset()
current: 1,
size: 20,
}
paging() paging()
} }
function paging() { function paging() {
searching.value = true searching.value = true
${ucc}Api.paging(searchForm.value) ${ucc}Api.paging(searchForm)
.then(res => { .then(res => {
tableData.value = res.data?.records ?? [] totalCount.value = res.data?.total ?? 0
tableData.$reset(res.data?.records ?? [])
}) })
.finally(() => { .finally(() => {
searching.value = false searching.value = false
@ -153,6 +147,7 @@ onMounted(() => {
<style lang="stylus" scoped> <style lang="stylus" scoped>
.table-list { .table-list {
flex 1; flex 1;
margin 0 0 20px 0
width 100% width 100%
:deep(.table-header) { :deep(.table-header) {
@ -201,9 +196,4 @@ onMounted(() => {
justify-content space-between justify-content space-between
margin 0 0 20px 0 margin 0 0 20px 0
} }
.pagination {
justify-content: end;
margin: 8px;
}
</style> </style>

View File

@ -24,6 +24,9 @@ public class SearchCustomerParam {
private String keywords; private String keywords;
private Boolean manager;
/** /**
* YueJie-->YuE-->XianFu--> * YueJie-->YuE-->XianFu-->
*/ */

View File

@ -44,7 +44,7 @@
FROM cst_customer a FROM cst_customer a
INNER JOIN sys_user b ON b.id = a.user_id AND b.deleted = 0 INNER JOIN sys_user b ON b.id = a.user_id AND b.deleted = 0
INNER JOIN sys_user_account c ON c.user_id = b.id AND b.deleted = 0 INNER JOIN sys_user_account c ON c.user_id = b.id AND b.deleted = 0
LEFT JOIN cst_org d ON c.id = a.org_id AND d.deleted = 0 LEFT JOIN cst_org d ON d.id = a.org_id AND d.deleted = 0
</sql> </sql>
<resultMap id="searchCustomerResultMap" autoMapping="true" type="com.njzscloud.dispose.cst.customer.pojo.result.SearchCustomerResult"> <resultMap id="searchCustomerResultMap" autoMapping="true" type="com.njzscloud.dispose.cst.customer.pojo.result.SearchCustomerResult">

File diff suppressed because it is too large Load Diff