提交
This commit is contained in:
1 parent
33c038b8d9
commit
54b27a3f0e
253 files changed
+30060
-14298
No files matched your search
@@ -33,6 +33,12 @@
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<ListQuickSearchInput
|
||||
v-model="quickSearchKeyword"
|
||||
placeholder="租户编号/名称"
|
||||
@search="handleQuickSearch"
|
||||
@clear="handleQuickSearchClear"
|
||||
/>
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增租户
|
||||
@@ -76,7 +82,15 @@
|
||||
批量删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="loadData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -106,6 +120,7 @@
|
||||
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('tenantNo')"
|
||||
prop="tenantNo"
|
||||
label="租户编号"
|
||||
min-width="120"
|
||||
@@ -136,6 +151,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('contactName')"
|
||||
prop="contactName"
|
||||
label="联系人"
|
||||
min-width="100"
|
||||
@@ -143,6 +159,7 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('contactPhone')"
|
||||
prop="contactPhone"
|
||||
label="联系电话"
|
||||
min-width="140"
|
||||
@@ -150,6 +167,7 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('createTime')"
|
||||
prop="createTime"
|
||||
label="创建时间"
|
||||
min-width="180"
|
||||
@@ -183,8 +201,9 @@
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-position="top"
|
||||
class="tenant-dialog-form"
|
||||
label-position="right"
|
||||
label-width="100px"
|
||||
class="tenant-dialog-form sys-dialog-form"
|
||||
scroll-to-error
|
||||
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
|
||||
>
|
||||
@@ -258,8 +277,11 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { syncViewRowFromFlatList } from '@/utils/view-dialog-refresh'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
Plus,
|
||||
@@ -285,7 +307,23 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
|
||||
|
||||
defineOptions({ name: 'SystemTenant' })
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'tenantNo', label: '租户编号' },
|
||||
{ prop: 'contactName', label: '联系人' },
|
||||
{ prop: 'contactPhone', label: '联系电话' },
|
||||
{ prop: 'createTime', label: '创建时间' }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('system-tenant-list-columns', listColumnDefs)
|
||||
|
||||
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
|
||||
const quickSearchKeyword = ref('')
|
||||
const tableData = ref<Api.Tenant.TenantItem[]>([])
|
||||
const selectedRows = ref<Api.Tenant.TenantItem[]>([])
|
||||
const loading = ref(false)
|
||||
@@ -299,6 +337,11 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
|
||||
const viewVisible = ref(false)
|
||||
const viewRow = ref<Api.Tenant.TenantItem | null>(null)
|
||||
|
||||
function refreshViewIfOpen() {
|
||||
if (!viewVisible.value) return
|
||||
syncViewRowFromFlatList(viewRow, tableData.value)
|
||||
}
|
||||
|
||||
const formData = reactive({
|
||||
tenantNo: '',
|
||||
tenantName: '',
|
||||
@@ -355,10 +398,11 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
|
||||
async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const quickKeyword = quickSearchKeyword.value?.trim()
|
||||
const res = await fetchTenantList({
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize,
|
||||
keyword: searchForm.keyword || undefined
|
||||
keyword: quickKeyword || searchForm.keyword || undefined
|
||||
})
|
||||
tableData.value = res.list || []
|
||||
pagination.total = res.total ?? 0
|
||||
@@ -368,12 +412,25 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
quickSearchKeyword.value = ''
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
searchForm.keyword = ''
|
||||
quickSearchKeyword.value = ''
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleQuickSearch() {
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleQuickSearchClear() {
|
||||
quickSearchKeyword.value = ''
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
}
|
||||
@@ -429,6 +486,7 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
|
||||
}
|
||||
dialogVisible.value = false
|
||||
await loadData()
|
||||
if (isEdit.value) refreshViewIfOpen()
|
||||
} catch {
|
||||
/* 校验或接口错误已由全局处理 */
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user