Browse Source

add data-list mixin

pull/80/head
cKey 5 years ago
parent
commit
6874f958a5
  1. 2
      vueJs/src/api/organizationunit.ts
  2. 2
      vueJs/src/api/roles.ts
  3. 1
      vueJs/src/api/tenant-management.ts
  4. 99
      vueJs/src/mixins/DataListMiXin.ts
  5. 84
      vueJs/src/views/admin/apigateway/aggregateRoute.vue
  6. 70
      vueJs/src/views/admin/apigateway/global.vue
  7. 77
      vueJs/src/views/admin/apigateway/group.vue
  8. 82
      vueJs/src/views/admin/apigateway/route.vue
  9. 81
      vueJs/src/views/admin/identityServer/api-resources/index.vue
  10. 100
      vueJs/src/views/admin/identityServer/client/index.vue
  11. 74
      vueJs/src/views/admin/identityServer/identity-resources/index.vue
  12. 43
      vueJs/src/views/admin/organization-unit/components/RoleOrganizationUint.vue
  13. 29
      vueJs/src/views/admin/organization-unit/components/UserOrganizationUint.vue
  14. 45
      vueJs/src/views/admin/roles/index.vue
  15. 71
      vueJs/src/views/admin/tenants/index.vue
  16. 72
      vueJs/src/views/admin/users/index.vue
  17. 77
      vueJs/src/views/file-management/index.vue

2
vueJs/src/api/organizationunit.ts

@ -204,7 +204,7 @@ export class OrganizationUnitGetRoleByPaged extends PagedAndSortedResultRequestD
/** 主键标识 */ /** 主键标识 */
id!: string id!: string
/** 过滤字符 */ /** 过滤字符 */
filter!: string filter = ''
} }
/** 组织机构创建对象 */ /** 组织机构创建对象 */

2
vueJs/src/api/roles.ts

@ -66,7 +66,7 @@ export class RoleDto extends RoleBaseDto {
} }
export class RoleGetPagedDto extends PagedAndSortedResultRequestDto { export class RoleGetPagedDto extends PagedAndSortedResultRequestDto {
filter?: string filter = ''
} }
export class CreateRoleDto extends RoleBaseDto { export class CreateRoleDto extends RoleBaseDto {

1
vueJs/src/api/tenant-management.ts

@ -87,7 +87,6 @@ export class TenantGetByPaged extends PagedAndSortedResultRequestDto {
this.filter = '' this.filter = ''
this.sorting = '' this.sorting = ''
this.skipCount = 1 this.skipCount = 1
this.maxResultCount = 25
} }
} }

99
vueJs/src/mixins/DataListMiXin.ts

@ -0,0 +1,99 @@
import { Component, Vue } from 'vue-property-decorator'
import { PagedResultDto, ListResultDto, PagedAndSortedResultRequestDto } from '@/api/types'
/**
* mixin
*
*/
@Component
export default class DataListMiXin extends Vue {
/** 数据列表 */
public dataList = new Array<any>()
/** 数据总数 */
public dataTotal = 0
/** 是否正在加载数据 */
public dataLoading = false
/**
*,
*/
public dataFilter = new PagedAndSortedResultRequestDto()
/**
*
*/
protected refreshData() {
this.dataLoading = true
this.getList(this.dataFilter)
.then(res => {
this.dataList = res.items
this.dataTotal = res.items.length
})
.finally(() => {
this.dataLoading = false
})
}
/**
*
*/
protected refreshPagedData() {
this.dataLoading = true
this.getPagedList(this.dataFilter)
.then(res => {
this.dataList = res.items
this.dataTotal = res.totalCount
})
.finally(() => {
this.dataLoading = false
})
}
/**
*
*/
protected getList(filter: any): Promise<ListResultDto<any>> {
console.log(filter)
return new Promise<ListResultDto<any>>((resolve) => {
return resolve(new ListResultDto<any>())
})
}
/** 获取空数据 */
protected getEmptyList() {
return new Promise<ListResultDto<any>>((resolve) => {
return resolve(new ListResultDto<any>())
})
}
/**
*
* @param filter
*/
protected getPagedList(filter: any): Promise<PagedResultDto<any>> {
console.log(filter)
return this.getEmptyPagedList()
}
/** 获取空分页数据 */
protected getEmptyPagedList() {
return new Promise<PagedResultDto<any>>((resolve) => {
return resolve(new PagedResultDto<any>())
})
}
/**
*
* @param column
*/
protected handleSortChange(column: any) {
this.dataFilter.sorting = column.prop
}
/**
*
* @param name
* @param values
*/
protected l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString()
}
}

84
vueJs/src/views/admin/apigateway/aggregateRoute.vue

@ -6,7 +6,7 @@
style="padding-left:10px;" style="padding-left:10px;"
>{{ $t('apiGateWay.appId') }}</label> >{{ $t('apiGateWay.appId') }}</label>
<el-select <el-select
v-model="aggregateRouteGetPagedFilter.appId" v-model="dataFilter.appId"
style="width: 250px;margin-left: 10px;" style="width: 250px;margin-left: 10px;"
class="filter-item" class="filter-item"
:placeholder="$t('pleaseSelectBy', {name: $t('apiGateWay.appId')})" :placeholder="$t('pleaseSelectBy', {name: $t('apiGateWay.appId')})"
@ -23,7 +23,7 @@
style="padding-left:10px;" style="padding-left:10px;"
>{{ $t('queryFilter') }}</label> >{{ $t('queryFilter') }}</label>
<el-input <el-input
v-model="aggregateRouteGetPagedFilter.filter" v-model="dataFilter.filter"
:placeholder="$t('filterString')" :placeholder="$t('filterString')"
style="width: 250px;margin-left: 10px;" style="width: 250px;margin-left: 10px;"
class="filter-item" class="filter-item"
@ -32,7 +32,7 @@
class="filter-item" class="filter-item"
style="margin-left: 10px; text-alignt" style="margin-left: 10px; text-alignt"
type="primary" type="primary"
@click="handleGetAggregateRoutes" @click="refreshPagedData"
> >
{{ $t('searchList') }} {{ $t('searchList') }}
</el-button> </el-button>
@ -47,9 +47,9 @@
</div> </div>
<el-table <el-table
v-loading="aggregateRouteListLoading" v-loading="dataLoading"
row-key="reRouteId" row-key="reRouteId"
:data="aggregateRouteList" :data="dataList"
border border
fit fit
highlight-current-row highlight-current-row
@ -172,11 +172,11 @@
</el-table> </el-table>
<Pagination <Pagination
v-show="routesCount>0" v-show="dataTotal>0"
:total="routesCount" :total="dataTotal"
:page.sync="aggregateRouteGetPagedFilter.skipCount" :page.sync="dataFilter.skipCount"
:limit.sync="aggregateRouteGetPagedFilter.maxResultCount" :limit.sync="dataFilter.maxResultCount"
@pagination="handleGetAggregateRoutes" @pagination="refreshPagedData"
@sort-change="handleSortChange" @sort-change="handleSortChange"
/> />
@ -215,7 +215,8 @@
<script lang="ts"> <script lang="ts">
import { checkPermission } from '@/utils/permission' import { checkPermission } from '@/utils/permission'
import { Component, Vue } from 'vue-property-decorator' import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
import AggregateRouteConfigEditForm from './components/AggregateRouteConfigEditForm.vue' import AggregateRouteConfigEditForm from './components/AggregateRouteConfigEditForm.vue'
import AggregateRouteCreateOrEditForm from './components/AggregateRouteCreateOrEditForm.vue' import AggregateRouteCreateOrEditForm from './components/AggregateRouteCreateOrEditForm.vue'
@ -244,31 +245,15 @@ import ApiGatewayService, { RouteGroupAppIdDto, AggregateReRoute, AggregateReRou
} }
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
private editAggregateRouteId: string private editAggregateRouteId = ''
private routesCount: number private editRouteTitle = ''
private editRouteTitle: any private routeGroupAppIdOptions = new Array<RouteGroupAppIdDto>()
private aggregateRouteList: AggregateReRoute[]
private aggregateRouteListLoading: boolean
private aggregateRouteGetPagedFilter: AggregateReRouteGetByPaged
private routeGroupAppIdOptions: RouteGroupAppIdDto[]
private showEditAggregateRouteDialog: boolean private showEditAggregateRouteDialog = false
private showEditAggregateRouteConfigDialog: boolean private showEditAggregateRouteConfigDialog = false
constructor() { public dataFilter = new AggregateReRouteGetByPaged()
super()
this.editAggregateRouteId = ''
this.routesCount = 0
this.editRouteTitle = ''
this.aggregateRouteListLoading = false
this.aggregateRouteList = new Array<AggregateReRoute>()
this.aggregateRouteGetPagedFilter = new AggregateReRouteGetByPaged()
this.routeGroupAppIdOptions = new Array<RouteGroupAppIdDto>()
this.showEditAggregateRouteDialog = false
this.showEditAggregateRouteConfigDialog = false
}
mounted() { mounted() {
ApiGatewayService.getRouteGroupAppIds().then(appKeys => { ApiGatewayService.getRouteGroupAppIds().then(appKeys => {
@ -276,23 +261,14 @@ export default class extends Vue {
}) })
} }
private handleGetAggregateRoutes() { protected getPagedList(filter: any) {
if (this.aggregateRouteGetPagedFilter.appId) { if (filter.appId) {
this.aggregateRouteListLoading = true return ApiGatewayService.getAggregateReRoutes(filter)
ApiGatewayService.getAggregateReRoutes(this.aggregateRouteGetPagedFilter).then(routes => {
this.aggregateRouteList = routes.items
this.routesCount = routes.totalCount
}).finally(() => {
this.aggregateRouteListLoading = false
})
} else { } else {
const errorMessage = this.$t('apiGateWay.appIdHasRequired').toString() const errorMessage = this.$t('apiGateWay.appIdHasRequired').toString()
this.$message.warning(errorMessage) this.$message.warning(errorMessage)
} }
} return this.getEmptyPagedList()
private handleSortChange(column: any) {
this.aggregateRouteGetPagedFilter.sorting = column.prop
} }
private handleCommand(command: {key: string, row: AggregateReRoute }) { private handleCommand(command: {key: string, row: AggregateReRoute }) {
@ -314,7 +290,7 @@ export default class extends Vue {
if (action === 'confirm') { if (action === 'confirm') {
ApiGatewayService.deleteAggregateReRoute(reRouteId).then(() => { ApiGatewayService.deleteAggregateReRoute(reRouteId).then(() => {
this.$message.success(this.l('apiGateWay.deleteAggregateRouteSuccess', { name: name })) this.$message.success(this.l('apiGateWay.deleteAggregateRouteSuccess', { name: name }))
this.handleGetAggregateRoutes() this.refreshPagedData()
}) })
} }
} }
@ -323,9 +299,9 @@ export default class extends Vue {
private handleCreateOrEditAggregateRoute(reRouteId: string, name: string) { private handleCreateOrEditAggregateRoute(reRouteId: string, name: string) {
this.editAggregateRouteId = reRouteId this.editAggregateRouteId = reRouteId
this.editRouteTitle = this.$t('apiGateWay.createAggregateRoute') this.editRouteTitle = this.l('apiGateWay.createAggregateRoute')
if (reRouteId) { if (reRouteId) {
this.editRouteTitle = this.$t('apiGateWay.updateAggregateRouteByName', { name: name }) this.editRouteTitle = this.l('apiGateWay.updateAggregateRouteByName', { name: name })
} }
this.showEditAggregateRouteDialog = true this.showEditAggregateRouteDialog = true
} }
@ -334,8 +310,8 @@ export default class extends Vue {
this.editAggregateRouteId = '' this.editAggregateRouteId = ''
this.editRouteTitle = '' this.editRouteTitle = ''
this.showEditAggregateRouteDialog = false this.showEditAggregateRouteDialog = false
if (changed && this.aggregateRouteGetPagedFilter.appId) { if (changed && this.dataFilter.appId) {
this.handleGetAggregateRoutes() this.refreshPagedData()
} }
} }
@ -343,10 +319,6 @@ export default class extends Vue {
this.editAggregateRouteId = '' this.editAggregateRouteId = ''
this.showEditAggregateRouteConfigDialog = false this.showEditAggregateRouteConfigDialog = false
} }
private l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString()
}
} }
</script> </script>

70
vueJs/src/views/admin/apigateway/global.vue

@ -6,7 +6,7 @@
style="padding-left:10px;" style="padding-left:10px;"
>{{ $t('queryFilter') }}</label> >{{ $t('queryFilter') }}</label>
<el-input <el-input
v-model="globalConfigurationGetQuery.filter" v-model="dataFilter.filter"
:placeholder="$t('filterString')" :placeholder="$t('filterString')"
style="width: 250px;margin-left: 10px;" style="width: 250px;margin-left: 10px;"
class="filter-item" class="filter-item"
@ -15,7 +15,7 @@
class="filter-item" class="filter-item"
style="margin-left: 10px; text-alignt" style="margin-left: 10px; text-alignt"
type="primary" type="primary"
@click="handledGetGlobalConfigurations" @click="refreshPagedData"
> >
{{ $t('searchList') }} {{ $t('searchList') }}
</el-button> </el-button>
@ -30,9 +30,9 @@
</div> </div>
<el-table <el-table
v-loading="globalConfigurationsLoading" v-loading="dataLoading"
row-key="itemId" row-key="itemId"
:data="globalConfigurations" :data="dataList"
border border
fit fit
highlight-current-row highlight-current-row
@ -138,11 +138,11 @@
</el-table> </el-table>
<Pagination <Pagination
v-show="globalConfigurationsCount>0" v-show="dataTotal>0"
:total="globalConfigurationsCount" :total="dataTotal"
:page.sync="globalConfigurationGetQuery.skipCount" :page.sync="dataFilter.skipCount"
:limit.sync="globalConfigurationGetQuery.maxResultCount" :limit.sync="dataFilter.maxResultCount"
@pagination="handledGetGlobalConfigurations" @pagination="refreshPagedData"
/> />
<el-dialog <el-dialog
@ -162,10 +162,11 @@
<script lang="ts"> <script lang="ts">
import { checkPermission } from '@/utils/permission' import { checkPermission } from '@/utils/permission'
import { Component, Vue } from 'vue-property-decorator' import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
import GlobalCreateOrEditForm from './components/GlobalCreateOrEditForm.vue' import GlobalCreateOrEditForm from './components/GlobalCreateOrEditForm.vue'
import ApiGatewayService, { GlobalGetByPagedDto, GlobalConfigurationDto } from '@/api/apigateway' import ApiGatewayService, { GlobalGetByPagedDto } from '@/api/apigateway'
@Component({ @Component({
name: 'GlobalRoute', name: 'GlobalRoute',
@ -177,44 +178,26 @@ import ApiGatewayService, { GlobalGetByPagedDto, GlobalConfigurationDto } from '
checkPermission checkPermission
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
private editGlobalConfigurationTitle!: any private editGlobalConfigurationTitle = ''
private globalConfigurationsCount!: number private showEditGlobalConfiguration = false
private globalConfigurationsLoading!: boolean private editGlobalConfigurationAppId = ''
private showEditGlobalConfiguration!: boolean
private editGlobalConfigurationAppId!: string
private globalConfigurations!: GlobalConfigurationDto[]
private globalConfigurationGetQuery!: GlobalGetByPagedDto
constructor() { public dataFilter = new GlobalGetByPagedDto()
super()
this.globalConfigurationsCount = 0
this.editGlobalConfigurationTitle = ''
this.editGlobalConfigurationAppId = ''
this.globalConfigurationsLoading = false
this.showEditGlobalConfiguration = false
this.globalConfigurationGetQuery = new GlobalGetByPagedDto()
this.globalConfigurations = new Array<GlobalConfigurationDto>()
}
mounted() { mounted() {
this.handledGetGlobalConfigurations() this.refreshPagedData()
} }
private handledGetGlobalConfigurations() { protected getPagedList(filter: any) {
this.globalConfigurationsLoading = true return ApiGatewayService.getGlobalConfigurations(filter)
ApiGatewayService.getGlobalConfigurations(this.globalConfigurationGetQuery).then(globals => {
this.globalConfigurations = globals.items
this.globalConfigurationsCount = globals.totalCount
this.globalConfigurationsLoading = false
})
} }
private handleCreateOrEditGlobalConfiguration(appId: string) { private handleCreateOrEditGlobalConfiguration(appId: string) {
this.editGlobalConfigurationAppId = appId this.editGlobalConfigurationAppId = appId
this.editGlobalConfigurationTitle = this.$t('apiGateWay.createGlobal') this.editGlobalConfigurationTitle = this.l('apiGateWay.createGlobal')
if (appId) { if (appId) {
this.editGlobalConfigurationTitle = this.$t('apiGateWay.updateGlobalByApp', { name: appId }) this.editGlobalConfigurationTitle = this.l('apiGateWay.updateGlobalByApp', { name: appId })
} }
this.showEditGlobalConfiguration = true this.showEditGlobalConfiguration = true
} }
@ -224,7 +207,7 @@ export default class extends Vue {
this.editGlobalConfigurationTitle = '' this.editGlobalConfigurationTitle = ''
this.showEditGlobalConfiguration = false this.showEditGlobalConfiguration = false
if (changed) { if (changed) {
this.handledGetGlobalConfigurations() this.refreshPagedData()
} }
} }
@ -237,15 +220,10 @@ export default class extends Vue {
await ApiGatewayService.deleteGlobalConfiguration(itemId) await ApiGatewayService.deleteGlobalConfiguration(itemId)
const successMessage = this.$t('dataHasBeenDeleted', { name: appId }).toString() const successMessage = this.$t('dataHasBeenDeleted', { name: appId }).toString()
this.$message.success(successMessage) this.$message.success(successMessage)
this.handledGetGlobalConfigurations() this.refreshPagedData()
} }
} }
}) })
} }
/** 响应表格排序事件 */
private handleSortChange(column: any) {
this.globalConfigurationGetQuery.sorting = column.prop
}
} }
</script> </script>

77
vueJs/src/views/admin/apigateway/group.vue

@ -6,7 +6,7 @@
style="padding-left:0;" style="padding-left:0;"
>{{ $t('apiGateWay.appId') }}</label> >{{ $t('apiGateWay.appId') }}</label>
<el-input <el-input
v-model="routeGroupQuery.appId" v-model="dataFilter.appId"
:placeholder="$t('apiGateWay.appId')" :placeholder="$t('apiGateWay.appId')"
style="width: 250px;margin-left: 10px;" style="width: 250px;margin-left: 10px;"
class="filter-item" class="filter-item"
@ -16,7 +16,7 @@
style="padding-left:10px;" style="padding-left:10px;"
>{{ $t('queryFilter') }}</label> >{{ $t('queryFilter') }}</label>
<el-input <el-input
v-model="routeGroupQuery.filter" v-model="dataFilter.filter"
:placeholder="$t('filterString')" :placeholder="$t('filterString')"
style="width: 250px;margin-left: 10px;" style="width: 250px;margin-left: 10px;"
class="filter-item" class="filter-item"
@ -25,7 +25,7 @@
class="filter-item" class="filter-item"
style="margin-left: 10px; text-alignt" style="margin-left: 10px; text-alignt"
type="primary" type="primary"
@click="handleGetRouteGroups" @click="refreshPagedData"
> >
{{ $t('searchList') }} {{ $t('searchList') }}
</el-button> </el-button>
@ -40,14 +40,13 @@
</div> </div>
<el-table <el-table
v-loading="routeGroupListLoading" v-loading="dataLoading"
row-key="id" row-key="id"
:data="routeGroupList" :data="dataList"
border border
fit fit
highlight-current-row highlight-current-row
style="width: 100%;" style="width: 100%;"
:default-sort="sortRule"
@sort-change="handleSortChange" @sort-change="handleSortChange"
> >
<el-table-column <el-table-column
@ -155,11 +154,11 @@
</el-table> </el-table>
<Pagination <Pagination
v-show="routeGroupCount>0" v-show="dataTotal>0"
:total="routeGroupCount" :total="dataTotal"
:page.sync="routeGroupQuery.skipCount" :page.sync="dataFilter.skipCount"
:limit.sync="routeGroupQuery.maxResultCount" :limit.sync="dataFilter.maxResultCount"
@pagination="handleGetRouteGroups" @pagination="refreshPagedData"
/> />
<el-dialog <el-dialog
@ -179,10 +178,11 @@
<script lang="ts"> <script lang="ts">
import { dateFormat } from '@/utils' import { dateFormat } from '@/utils'
import { checkPermission } from '@/utils/permission' import { checkPermission } from '@/utils/permission'
import { Component, Vue } from 'vue-property-decorator'
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import RouteGroupCreateOrEditForm from './components/RouteGroupCreateOrEditForm.vue' import RouteGroupCreateOrEditForm from './components/RouteGroupCreateOrEditForm.vue'
import ApiGatewayService, { RouteGroupDto, RouteGroupGetByPagedDto } from '@/api/apigateway' import ApiGatewayService, { GlobalGetByPagedDto } from '@/api/apigateway'
@Component({ @Component({
name: 'RouteGroup', name: 'RouteGroup',
@ -200,47 +200,26 @@ import ApiGatewayService, { RouteGroupDto, RouteGroupGetByPagedDto } from '@/api
checkPermission checkPermission
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
private editRouteGroupAppId!: string private editRouteGroupAppId = ''
private editRouteGroupTitle!: any private editRouteGroupTitle = ''
private showEditRouteGroupDialog!: boolean private showEditRouteGroupDialog = false
private routeGroupListLoading!: boolean
private routeGroupList?: RouteGroupDto[]
private routeGroupQuery!: RouteGroupGetByPagedDto
private routeGroupCount!: number
/** 排序组别 */
private sortRule!: { prop: string, sort: string }
constructor() { public dataFilter = new GlobalGetByPagedDto()
super()
this.routeGroupCount = 0
this.editRouteGroupAppId = ''
this.editRouteGroupTitle = ''
this.routeGroupListLoading = false
this.showEditRouteGroupDialog = false
this.sortRule = { prop: '', sort: '' }
this.routeGroupList = new Array<RouteGroupDto>()
this.routeGroupQuery = new RouteGroupGetByPagedDto()
}
mounted() { mounted() {
this.handleGetRouteGroups() this.refreshPagedData()
} }
private handleGetRouteGroups() { protected getPagedList(filter: any) {
this.routeGroupListLoading = true return ApiGatewayService.getRouteGroups(filter)
ApiGatewayService.getRouteGroups(this.routeGroupQuery).then(groupData => {
this.routeGroupList = groupData.items
this.routeGroupCount = groupData.totalCount
this.routeGroupListLoading = false
})
} }
private handleCreateOrEditRouteGroup(appId: string, appName: string) { private handleCreateOrEditRouteGroup(appId: string, appName: string) {
this.editRouteGroupAppId = appId this.editRouteGroupAppId = appId
this.editRouteGroupTitle = this.$t('apiGateWay.createGroup') this.editRouteGroupTitle = this.l('apiGateWay.createGroup')
if (appName) { if (appName) {
this.editRouteGroupTitle = this.$t('apiGateWay.updateGroupByApp', { name: appName }) this.editRouteGroupTitle = this.l('apiGateWay.updateGroupByApp', { name: appName })
} }
this.showEditRouteGroupDialog = true this.showEditRouteGroupDialog = true
} }
@ -250,7 +229,7 @@ export default class extends Vue {
this.editRouteGroupTitle = '' this.editRouteGroupTitle = ''
this.showEditRouteGroupDialog = false this.showEditRouteGroupDialog = false
if (hasChanged) { if (hasChanged) {
this.handleGetRouteGroups() this.refreshPagedData()
} }
} }
@ -263,16 +242,10 @@ export default class extends Vue {
await ApiGatewayService.deleteRouteGroup(appId) await ApiGatewayService.deleteRouteGroup(appId)
const successMessage = this.$t('dataHasBeenDeleted', { name: appName }).toString() const successMessage = this.$t('dataHasBeenDeleted', { name: appName }).toString()
this.$message.success(successMessage) this.$message.success(successMessage)
this.handleGetRouteGroups() this.refreshPagedData()
} }
} }
}) })
} }
/** 响应表格排序事件 */
private handleSortChange(column: any) {
this.sortRule.prop = column.prop
this.sortRule.sort = column.sort
}
} }
</script> </script>

82
vueJs/src/views/admin/apigateway/route.vue

@ -6,7 +6,7 @@
style="padding-left:10px;" style="padding-left:10px;"
>{{ $t('apiGateWay.appId') }}</label> >{{ $t('apiGateWay.appId') }}</label>
<el-select <el-select
v-model="routeGetPagedFilter.appId" v-model="dataFilter.appId"
style="width: 250px;margin-left: 10px;" style="width: 250px;margin-left: 10px;"
class="filter-item" class="filter-item"
:placeholder="$t('pleaseSelectBy', {name: $t('apiGateWay.appId')})" :placeholder="$t('pleaseSelectBy', {name: $t('apiGateWay.appId')})"
@ -23,7 +23,7 @@
style="padding-left:10px;" style="padding-left:10px;"
>{{ $t('queryFilter') }}</label> >{{ $t('queryFilter') }}</label>
<el-input <el-input
v-model="routeGetPagedFilter.filter" v-model="dataFilter.filter"
:placeholder="$t('filterString')" :placeholder="$t('filterString')"
style="width: 250px;margin-left: 10px;" style="width: 250px;margin-left: 10px;"
class="filter-item" class="filter-item"
@ -32,7 +32,7 @@
class="filter-item" class="filter-item"
style="margin-left: 10px; text-alignt" style="margin-left: 10px; text-alignt"
type="primary" type="primary"
@click="handleGetRoutes" @click="refreshPagedData"
> >
{{ $t('searchList') }} {{ $t('searchList') }}
</el-button> </el-button>
@ -47,9 +47,9 @@
</div> </div>
<el-table <el-table
v-loading="routeListLoading" v-loading="dataLoading"
row-key="itemId" row-key="itemId"
:data="routeList" :data="dataList"
border border
fit fit
highlight-current-row highlight-current-row
@ -187,11 +187,11 @@
</el-table> </el-table>
<Pagination <Pagination
v-show="routesCount>0" v-show="dataTotal>0"
:total="routesCount" :total="dataTotal"
:page.sync="routeGetPagedFilter.skipCount" :page.sync="dataFilter.skipCount"
:limit.sync="routeGetPagedFilter.maxResultCount" :limit.sync="dataFilter.maxResultCount"
@pagination="handleGetRoutes" @pagination="refreshPagedData"
@sort-change="handleSortChange" @sort-change="handleSortChange"
/> />
@ -216,10 +216,11 @@
<script lang="ts"> <script lang="ts">
import { checkPermission } from '@/utils/permission' import { checkPermission } from '@/utils/permission'
import { Component, Vue } from 'vue-property-decorator' import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
import RouteCreateOrEditForm from './components/RouteCreateOrEditForm.vue' import RouteCreateOrEditForm from './components/RouteCreateOrEditForm.vue'
import ApiGatewayService, { RouteGroupAppIdDto, ReRouteGetByPagedDto, ReRouteDto } from '@/api/apigateway' import ApiGatewayService, { RouteGroupAppIdDto, ReRouteGetByPagedDto } from '@/api/apigateway'
@Component({ @Component({
name: 'Route', name: 'Route',
@ -243,27 +244,13 @@ import ApiGatewayService, { RouteGroupAppIdDto, ReRouteGetByPagedDto, ReRouteDto
} }
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
private editRouteId: number private editRouteId = 0
private routesCount: number private editRouteTitle = ''
private editRouteTitle: any private showEditRouteDialog = false
private routeList: ReRouteDto[] private routeGroupAppIdOptions = new Array<RouteGroupAppIdDto>()
private routeListLoading: boolean
private showEditRouteDialog: boolean
private routeGetPagedFilter: ReRouteGetByPagedDto
private routeGroupAppIdOptions: RouteGroupAppIdDto[]
constructor() { public dataFilter = new ReRouteGetByPagedDto()
super()
this.editRouteId = 0
this.routesCount = 0
this.editRouteTitle = ''
this.routeListLoading = false
this.showEditRouteDialog = false
this.routeList = new Array<ReRouteDto>()
this.routeGetPagedFilter = new ReRouteGetByPagedDto()
this.routeGroupAppIdOptions = new Array<RouteGroupAppIdDto>()
}
mounted() { mounted() {
ApiGatewayService.getRouteGroupAppIds().then(appKeys => { ApiGatewayService.getRouteGroupAppIds().then(appKeys => {
@ -271,23 +258,14 @@ export default class extends Vue {
}) })
} }
private handleGetRoutes() { protected getPagedList(filter: any) {
if (this.routeGetPagedFilter.appId) { if (filter.appId) {
this.routeListLoading = true return ApiGatewayService.getReRoutes(filter)
ApiGatewayService.getReRoutes(this.routeGetPagedFilter).then(routes => {
this.routeList = routes.items
this.routesCount = routes.totalCount
}).finally(() => {
this.routeListLoading = false
})
} else { } else {
const errorMessage = this.$t('apiGateWay.appIdHasRequired').toString() const errorMessage = this.$t('apiGateWay.appIdHasRequired').toString()
this.$message.warning(errorMessage) this.$message.warning(errorMessage)
} }
} return this.getEmptyPagedList()
private handleSortChange(column: any) {
this.routeGetPagedFilter.sorting = column.prop
} }
private handleDeleteRoute(reRouteId: number, reRouteName: string) { private handleDeleteRoute(reRouteId: number, reRouteName: string) {
@ -297,7 +275,7 @@ export default class extends Vue {
if (action === 'confirm') { if (action === 'confirm') {
ApiGatewayService.deleteReRoute(reRouteId).then(() => { ApiGatewayService.deleteReRoute(reRouteId).then(() => {
this.$message.success(this.l('apiGateWay.deleteRouteSuccess', { name: reRouteName })) this.$message.success(this.l('apiGateWay.deleteRouteSuccess', { name: reRouteName }))
this.handleGetRoutes() this.refreshPagedData()
}) })
} }
} }
@ -306,9 +284,9 @@ export default class extends Vue {
private handleCreateOrEditRoute(reRouteId: number, reRouteName: string) { private handleCreateOrEditRoute(reRouteId: number, reRouteName: string) {
this.editRouteId = reRouteId this.editRouteId = reRouteId
this.editRouteTitle = this.$t('apiGateWay.createRoute') this.editRouteTitle = this.l('apiGateWay.createRoute')
if (reRouteId) { if (reRouteId) {
this.editRouteTitle = this.$t('apiGateWay.updateRouteByApp', { name: reRouteName }) this.editRouteTitle = this.l('apiGateWay.updateRouteByApp', { name: reRouteName })
} }
this.showEditRouteDialog = true this.showEditRouteDialog = true
} }
@ -317,13 +295,9 @@ export default class extends Vue {
this.editRouteId = -1 this.editRouteId = -1
this.editRouteTitle = '' this.editRouteTitle = ''
this.showEditRouteDialog = false this.showEditRouteDialog = false
if (changed && this.routeGetPagedFilter.appId) { if (changed && this.dataFilter.appId) {
this.handleGetRoutes() this.refreshPagedData()
} }
} }
private l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString()
}
} }
</script> </script>

81
vueJs/src/views/admin/identityServer/api-resources/index.vue

@ -6,7 +6,7 @@
style="padding-left:10px;" style="padding-left:10px;"
>{{ $t('queryFilter') }}</label> >{{ $t('queryFilter') }}</label>
<el-input <el-input
v-model="apiResourceGetPagedFilter.filter" v-model="dataFilter.filter"
:placeholder="$t('filterString')" :placeholder="$t('filterString')"
style="width: 250px;margin-left: 10px;" style="width: 250px;margin-left: 10px;"
class="filter-item" class="filter-item"
@ -15,7 +15,7 @@
class="filter-item" class="filter-item"
style="margin-left: 10px; text-alignt" style="margin-left: 10px; text-alignt"
type="primary" type="primary"
@click="handleGetApiResources" @click="refreshPagedData"
> >
{{ $t('searchList') }} {{ $t('searchList') }}
</el-button> </el-button>
@ -30,9 +30,9 @@
</div> </div>
<el-table <el-table
v-loading="apiResourceListLoading" v-loading="dataLoading"
row-key="id" row-key="id"
:data="apiResourceList" :data="dataList"
border border
fit fit
highlight-current-row highlight-current-row
@ -165,11 +165,11 @@
</el-table> </el-table>
<Pagination <Pagination
v-show="apiResourceListCount>0" v-show="dataTotal>0"
:total="apiResourceListCount" :total="dataTotal"
:page.sync="apiResourceGetPagedFilter.skipCount" :page.sync="dataFilter.skipCount"
:limit.sync="apiResourceGetPagedFilter.maxResultCount" :limit.sync="dataFilter.maxResultCount"
@pagination="handleGetApiResources" @pagination="refreshPagedData"
@sort-change="handleSortChange" @sort-change="handleSortChange"
/> />
@ -202,7 +202,7 @@
ref="formApiSecret" ref="formApiSecret"
:api-resource-id="editApiResource.id" :api-resource-id="editApiResource.id"
:api-secrets="editApiResource.secrets" :api-secrets="editApiResource.secrets"
@apiSecretChanged="handleGetApiResources" @apiSecretChanged="refreshPagedData"
/> />
</el-dialog> </el-dialog>
@ -219,16 +219,17 @@
ref="formApiScope" ref="formApiScope"
:api-resource-id="editApiResource.id" :api-resource-id="editApiResource.id"
:api-scopes="editApiResource.scopes" :api-scopes="editApiResource.scopes"
@apiSecretChanged="handleGetApiResources" @apiSecretChanged="refreshPagedData"
/> />
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { checkPermission } from '@/utils/permission'
import { Component, Vue } from 'vue-property-decorator'
import { dateFormat } from '@/utils/index' import { dateFormat } from '@/utils/index'
import { checkPermission } from '@/utils/permission'
import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
import ApiScopeEditForm from './components/ApiResourceScopeEditForm.vue' import ApiScopeEditForm from './components/ApiResourceScopeEditForm.vue'
import ApiSecretEditForm from './components/ApiResourceSecretEditForm.vue' import ApiSecretEditForm from './components/ApiResourceSecretEditForm.vue'
@ -262,48 +263,22 @@ import ApiResourceService, { ApiResource, ApiResourceGetByPaged } from '@/api/ap
} }
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
private editApiResource: ApiResource private editApiResource = new ApiResource()
private apiResourceListCount: number private editApiResourceTitle = ''
private editApiResourceTitle: any
private apiResourceList: ApiResource[]
private apiResourceListLoading: boolean
private apiResourceGetPagedFilter: ApiResourceGetByPaged
private showEditApiScopeDialog: boolean
private showEditApiSecretDialog: boolean
private showEditApiResourceDialog: boolean
constructor() { private showEditApiScopeDialog = false
super() private showEditApiSecretDialog = false
this.apiResourceListCount = 0 private showEditApiResourceDialog = false
this.editApiResourceTitle = ''
this.apiResourceListLoading = false
this.editApiResource = new ApiResource()
this.apiResourceList = new Array<ApiResource>()
this.apiResourceGetPagedFilter = new ApiResourceGetByPaged()
this.showEditApiScopeDialog = false public dataFilter = new ApiResourceGetByPaged()
this.showEditApiSecretDialog = false
this.showEditApiResourceDialog = false
}
mounted() { mounted() {
this.handleGetApiResources() this.refreshPagedData()
}
private handleGetApiResources() {
this.apiResourceListLoading = true
ApiResourceService.getApiResources(this.apiResourceGetPagedFilter).then(resources => {
this.apiResourceList = resources.items
this.apiResourceListCount = resources.totalCount
}).finally(() => {
this.apiResourceListLoading = false
})
} }
private handleSortChange(column: any) { protected getPagedList(filter: any) {
this.apiResourceGetPagedFilter.sorting = column.prop return ApiResourceService.getApiResources(filter)
} }
private handleShowEditApiResourceForm(resource: ApiResource) { private handleShowEditApiResourceForm(resource: ApiResource) {
@ -322,7 +297,7 @@ export default class extends Vue {
this.editApiResource = ApiResource.empty() this.editApiResource = ApiResource.empty()
this.showEditApiResourceDialog = false this.showEditApiResourceDialog = false
if (changed) { if (changed) {
this.handleGetApiResources() this.refreshPagedData()
} }
} }
@ -345,7 +320,7 @@ export default class extends Vue {
if (action === 'confirm') { if (action === 'confirm') {
ApiResourceService.deleteApiResource(id).then(() => { ApiResourceService.deleteApiResource(id).then(() => {
this.$message.success(this.l('identityServer.deleteApiResourceSuccess', { name: name })) this.$message.success(this.l('identityServer.deleteApiResourceSuccess', { name: name }))
this.handleGetApiResources() this.refreshPagedData()
}) })
} }
} }
@ -368,10 +343,6 @@ export default class extends Vue {
} }
} }
private l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString()
}
private formatStatusText(status: boolean) { private formatStatusText(status: boolean) {
let statusText = '' let statusText = ''
if (status) { if (status) {

100
vueJs/src/views/admin/identityServer/client/index.vue

@ -6,7 +6,7 @@
style="padding-left:10px;" style="padding-left:10px;"
>{{ $t('queryFilter') }}</label> >{{ $t('queryFilter') }}</label>
<el-input <el-input
v-model="clientGetPagedFilter.filter" v-model="dataFilter.filter"
:placeholder="$t('filterString')" :placeholder="$t('filterString')"
style="width: 250px;margin-left: 10px;" style="width: 250px;margin-left: 10px;"
class="filter-item" class="filter-item"
@ -15,7 +15,7 @@
class="filter-item" class="filter-item"
style="margin-left: 10px; text-alignt" style="margin-left: 10px; text-alignt"
type="primary" type="primary"
@click="handleGetClients" @click="refreshPagedData"
> >
{{ $t('searchList') }} {{ $t('searchList') }}
</el-button> </el-button>
@ -30,9 +30,9 @@
</div> </div>
<el-table <el-table
v-loading="clientListLoading" v-loading="dataLoading"
row-key="id" row-key="id"
:data="clientList" :data="dataList"
border border
fit fit
highlight-current-row highlight-current-row
@ -216,11 +216,11 @@
</el-table> </el-table>
<Pagination <Pagination
v-show="clientListCount>0" v-show="dataTotal>0"
:total="clientListCount" :total="dataTotal"
:page.sync="clientGetPagedFilter.skipCount" :page.sync="dataFilter.skipCount"
:limit.sync="clientGetPagedFilter.maxResultCount" :limit.sync="dataFilter.maxResultCount"
@pagination="handleGetClients" @pagination="refreshPagedData"
@sort-change="handleSortChange" @sort-change="handleSortChange"
/> />
@ -285,7 +285,7 @@
ref="formClientSecret" ref="formClientSecret"
:client-id="editClient.id" :client-id="editClient.id"
:client-secrets="editClient.clientSecrets" :client-secrets="editClient.clientSecrets"
@clientSecretChanged="handleGetClients" @clientSecretChanged="refreshPagedData"
/> />
</el-dialog> </el-dialog>
@ -297,7 +297,7 @@
custom-class="modal-form" custom-class="modal-form"
:show-close="false" :show-close="false"
@closed="handleClientClaimEditFormClosed" @closed="handleClientClaimEditFormClosed"
@clientClaimChanged="handleGetClients" @clientClaimChanged="refreshPagedData"
> >
<ClientClaimEditForm <ClientClaimEditForm
ref="formClientClaim" ref="formClientClaim"
@ -314,7 +314,7 @@
custom-class="modal-form" custom-class="modal-form"
:show-close="false" :show-close="false"
@closed="handleClientPropertyEditFormClosed" @closed="handleClientPropertyEditFormClosed"
@clientPropertyChanged="handleGetClients" @clientPropertyChanged="refreshPagedData"
> >
<ClientPropertyEditForm <ClientPropertyEditForm
ref="formClientProperty" ref="formClientProperty"
@ -343,7 +343,8 @@
<script lang="ts"> <script lang="ts">
import { checkPermission } from '@/utils/permission' import { checkPermission } from '@/utils/permission'
import { Component, Vue } from 'vue-property-decorator' import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
import ClientEditForm from './components/ClientEditForm.vue' import ClientEditForm from './components/ClientEditForm.vue'
import ClientCloneForm from './components/ClientCloneForm.vue' import ClientCloneForm from './components/ClientCloneForm.vue'
@ -381,66 +382,37 @@ import ClientService, { Client, ClientGetByPaged } from '@/api/clients'
} }
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
private editClient: Client private editClient = Client.empty()
private clientListCount: number private editClientTitle = ''
private editClientTitle: any
private clientList: Client[]
private clientListLoading: boolean
private clientGetPagedFilter: ClientGetByPaged
private showEditClientDialog: boolean private showEditClientDialog = false
private showCloneClientDialog: boolean private showCloneClientDialog = false
private showCreateClientDialog: boolean private showCreateClientDialog = false
private showEditClientSecretDialog: boolean private showEditClientSecretDialog = false
private showEditClientClaimDialog: boolean private showEditClientClaimDialog = false
private showEditClientPropertyDialog: boolean private showEditClientPropertyDialog = false
private showEditClientPermissionDialog: boolean private showEditClientPermissionDialog = false
constructor() { public dataFilter = new ClientGetByPaged()
super()
this.clientListCount = 0
this.editClientTitle = ''
this.clientListLoading = false
this.showEditClientDialog = false
this.showCreateClientDialog = false
this.showEditClientPermissionDialog = false
this.editClient = Client.empty()
this.clientList = new Array<Client>()
this.showCloneClientDialog = false
this.showEditClientSecretDialog = false
this.showEditClientClaimDialog = false
this.showEditClientPropertyDialog = false
this.clientGetPagedFilter = new ClientGetByPaged()
}
mounted() { mounted() {
this.handleGetClients() this.refreshPagedData()
} }
private handleGetClients() { protected getPagedList(filter: any) {
this.clientListLoading = true return ClientService.getClients(filter)
ClientService.getClients(this.clientGetPagedFilter).then(routes => {
this.clientList = routes.items
this.clientListCount = routes.totalCount
}).finally(() => {
this.clientListLoading = false
})
}
private handleSortChange(column: any) {
this.clientGetPagedFilter.sorting = column.prop
} }
private handleShowCreateClientForm() { private handleShowCreateClientForm() {
this.editClient = Client.empty() this.editClient = Client.empty()
this.editClientTitle = this.$t('identityServer.createClient') this.editClientTitle = this.l('identityServer.createClient')
this.showCreateClientDialog = true this.showCreateClientDialog = true
} }
private handleShowEditClientForm(client: Client) { private handleShowEditClientForm(client: Client) {
this.editClient = client this.editClient = client
this.editClientTitle = this.$t('identityServer.updateClientByName', { name: this.editClient.clientName }) this.editClientTitle = this.l('identityServer.updateClientByName', { name: this.editClient.clientName })
this.showEditClientDialog = true this.showEditClientDialog = true
} }
@ -451,7 +423,7 @@ export default class extends Vue {
const frmClient = this.$refs.formCreateClient as ClientCreateForm const frmClient = this.$refs.formCreateClient as ClientCreateForm
frmClient.resetFields() frmClient.resetFields()
if (changed) { if (changed) {
this.handleGetClients() this.refreshPagedData()
} }
} }
@ -462,7 +434,7 @@ export default class extends Vue {
const frmClient = this.$refs.formCloneClient as ClientCloneForm const frmClient = this.$refs.formCloneClient as ClientCloneForm
frmClient.resetFields() frmClient.resetFields()
if (changed) { if (changed) {
this.handleGetClients() this.refreshPagedData()
} }
} }
@ -471,7 +443,7 @@ export default class extends Vue {
this.editClient = Client.empty() this.editClient = Client.empty()
this.showEditClientDialog = false this.showEditClientDialog = false
if (changed) { if (changed) {
this.handleGetClients() this.refreshPagedData()
} }
} }
@ -505,7 +477,7 @@ export default class extends Vue {
if (action === 'confirm') { if (action === 'confirm') {
ClientService.deleteClient(id).then(() => { ClientService.deleteClient(id).then(() => {
this.$message.success(this.l('identityServer.deleteClientSuccess', { id: clientId })) this.$message.success(this.l('identityServer.deleteClientSuccess', { id: clientId }))
this.handleGetClients() this.refreshPagedData()
}) })
} }
} }
@ -537,10 +509,6 @@ export default class extends Vue {
} }
} }
private l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString()
}
private formatStatusText(status: boolean) { private formatStatusText(status: boolean) {
let statusText = '' let statusText = ''
if (status) { if (status) {

74
vueJs/src/views/admin/identityServer/identity-resources/index.vue

@ -6,7 +6,7 @@
style="padding-left:10px;" style="padding-left:10px;"
>{{ $t('global.queryFilter') }}</label> >{{ $t('global.queryFilter') }}</label>
<el-input <el-input
v-model="identityResourceGetPagedFilter.filter" v-model="dataFilter.filter"
:placeholder="$t('filterString')" :placeholder="$t('filterString')"
style="width: 250px;margin-left: 10px;" style="width: 250px;margin-left: 10px;"
class="filter-item" class="filter-item"
@ -15,7 +15,7 @@
class="filter-item" class="filter-item"
style="margin-left: 10px; text-alignt" style="margin-left: 10px; text-alignt"
type="primary" type="primary"
@click="handleGetIdentityResources" @click="refreshPagedData"
> >
{{ $t('global.searchList') }} {{ $t('global.searchList') }}
</el-button> </el-button>
@ -30,9 +30,9 @@
</div> </div>
<el-table <el-table
v-loading="identityResourceListLoading" v-loading="dataLoading"
row-key="id" row-key="id"
:data="identityResourceList" :data="dataList"
border border
fit fit
highlight-current-row highlight-current-row
@ -159,11 +159,11 @@
</el-table> </el-table>
<Pagination <Pagination
v-show="identityResourceListCount>0" v-show="dataTotal>0"
:total="identityResourceListCount" :total="dataTotal"
:page.sync="identityResourceGetPagedFilter.skipCount" :page.sync="dataFilter.skipCount"
:limit.sync="identityResourceGetPagedFilter.maxResultCount" :limit.sync="dataFilter.maxResultCount"
@pagination="handleGetIdentityResources" @pagination="refreshPagedData"
@sort-change="handleSortChange" @sort-change="handleSortChange"
/> />
@ -204,9 +204,10 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { checkPermission } from '@/utils/permission'
import { Component, Vue } from 'vue-property-decorator'
import { dateFormat } from '@/utils/index' import { dateFormat } from '@/utils/index'
import { checkPermission } from '@/utils/permission'
import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
import IdentityPropertyEditForm from './components/IdentityResourcePropertyEditForm.vue' import IdentityPropertyEditForm from './components/IdentityResourcePropertyEditForm.vue'
import IdentityResourceCreateOrEditForm from './components/IdentityResourceCreateOrEditForm.vue' import IdentityResourceCreateOrEditForm from './components/IdentityResourceCreateOrEditForm.vue'
@ -235,46 +236,21 @@ import IdentityResourceService, { IdentityResource, IdentityResourceGetByPaged }
} }
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
private editIdentityResource: IdentityResource private editIdentityResource = IdentityResource.empty()
private identityResourceListCount: number private editIdentityResourceTitle = ''
private editIdentityResourceTitle: any
private identityResourceList: IdentityResource[]
private identityResourceListLoading: boolean
private identityResourceGetPagedFilter: IdentityResourceGetByPaged
private showEditIdentityPropertyDialog: boolean
private showEditIdentityResourceDialog: boolean
constructor() { private showEditIdentityPropertyDialog = false
super() private showEditIdentityResourceDialog = false
this.identityResourceListCount = 0
this.editIdentityResourceTitle = ''
this.identityResourceListLoading = false
this.editIdentityResource = IdentityResource.empty()
this.identityResourceList = new Array<IdentityResource>()
this.identityResourceGetPagedFilter = new IdentityResourceGetByPaged()
this.showEditIdentityPropertyDialog = false public dataFilter = new IdentityResourceGetByPaged()
this.showEditIdentityResourceDialog = false
}
mounted() { mounted() {
this.handleGetIdentityResources() this.refreshPagedData()
}
private handleGetIdentityResources() {
this.identityResourceListLoading = true
IdentityResourceService.getIdentityResources(this.identityResourceGetPagedFilter).then(resources => {
this.identityResourceList = resources.items
this.identityResourceListCount = resources.totalCount
}).finally(() => {
this.identityResourceListLoading = false
})
} }
private handleSortChange(column: any) { protected getPagedList(filter: any) {
this.identityResourceGetPagedFilter.sorting = column.prop return IdentityResourceService.getIdentityResources(filter)
} }
private handleShowEditIdentityResourceForm(resource: IdentityResource) { private handleShowEditIdentityResourceForm(resource: IdentityResource) {
@ -303,7 +279,7 @@ export default class extends Vue {
if (action === 'confirm') { if (action === 'confirm') {
IdentityResourceService.deleteIdentityResource(id).then(() => { IdentityResourceService.deleteIdentityResource(id).then(() => {
this.$message.success(this.l('identityServer.deleteIdentityResourceSuccess', { name: name })) this.$message.success(this.l('identityServer.deleteIdentityResourceSuccess', { name: name }))
this.handleGetIdentityResources() this.refreshPagedData()
}) })
} }
} }
@ -323,10 +299,6 @@ export default class extends Vue {
} }
} }
private l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString()
}
private formatStatusText(status: boolean) { private formatStatusText(status: boolean) {
let statusText = '' let statusText = ''
if (status) { if (status) {
@ -343,7 +315,7 @@ export default class extends Vue {
this.showEditIdentityResourceDialog = false this.showEditIdentityResourceDialog = false
this.showEditIdentityPropertyDialog = false this.showEditIdentityPropertyDialog = false
if (changed) { if (changed) {
this.handleGetIdentityResources() this.refreshPagedData()
} }
} }
} }

43
vueJs/src/views/admin/organization-unit/components/RoleOrganizationUint.vue

@ -6,7 +6,7 @@
fit fit
highlight-current-row highlight-current-row
style="width: 100%;" style="width: 100%;"
:data="organizationUnitRoles" :data="dataList"
> >
<el-table-column <el-table-column
:label="$t('roles.name')" :label="$t('roles.name')"
@ -58,19 +58,20 @@
</el-table> </el-table>
<pagination <pagination
v-show="organizationUnitRoleCount>0" v-show="dataTotal>0"
:total="organizationUnitRoleCount" :total="dataTotal"
:page.sync="organizationUnitRoleFilter.skipCount" :page.sync="dataFilter.skipCount"
:limit.sync="organizationUnitRoleFilter.maxResultCount" :limit.sync="dataFilter.maxResultCount"
@pagination="handleGetOrganizationUnitRoles" @pagination="refreshPagedData"
/> />
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Watch, Vue } from 'vue-property-decorator' import DataListMiXin from '@/mixins/DataListMiXin'
import { Prop, Watch } from 'vue-property-decorator'
import Component, { mixins } from 'vue-class-component'
import OrganizationUnitService, { OrganizationUnitGetRoleByPaged } from '@/api/organizationunit' import OrganizationUnitService, { OrganizationUnitGetRoleByPaged } from '@/api/organizationunit'
import { RoleDto } from '@/api/roles'
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
@Component({ @Component({
@ -79,36 +80,26 @@ import Pagination from '@/components/Pagination/index.vue'
Pagination Pagination
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
@Prop({ default: '' }) @Prop({ default: '' })
private organizationUnitId?: string private organizationUnitId?: string
private organizationUnitRoleFilter: OrganizationUnitGetRoleByPaged public dataFilter = new OrganizationUnitGetRoleByPaged()
private organizationUnitRoleCount: number
private organizationUnitRoles: RoleDto[]
constructor() {
super()
this.organizationUnitRoleCount = 0
this.organizationUnitRoles = new Array<RoleDto>()
this.organizationUnitRoleFilter = new OrganizationUnitGetRoleByPaged()
}
@Watch('organizationUnitId', { immediate: true }) @Watch('organizationUnitId', { immediate: true })
private onOrganizationUnitIdChanged() { private onOrganizationUnitIdChanged() {
this.organizationUnitRoles = new Array<RoleDto>() this.dataList = new Array<any>()
if (this.organizationUnitId) { if (this.organizationUnitId) {
this.handleGetOrganizationUnitRoles() this.dataFilter.id = this.organizationUnitId
this.refreshPagedData()
} }
} }
private handleGetOrganizationUnitRoles() { protected getPagedList(filter: any) {
if (this.organizationUnitId) { if (this.organizationUnitId) {
this.organizationUnitRoleFilter.id = this.organizationUnitId return OrganizationUnitService.organizationUnitGetRoles(filter)
OrganizationUnitService.organizationUnitGetRoles(this.organizationUnitRoleFilter).then(res => {
this.organizationUnitRoles = res.items
})
} }
return this.getEmptyPagedList()
} }
} }
</script> </script>

29
vueJs/src/views/admin/organization-unit/components/UserOrganizationUint.vue

@ -5,7 +5,7 @@
fit fit
highlight-current-row highlight-current-row
style="width: 100%;" style="width: 100%;"
:data="organizationUnitUsers" :data="dataList"
> >
<el-table-column <el-table-column
:label="$t('users.userName')" :label="$t('users.userName')"
@ -75,8 +75,9 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Watch, Vue } from 'vue-property-decorator' import DataListMiXin from '@/mixins/DataListMiXin'
import { UserDataDto } from '@/api/users' import Component, { mixins } from 'vue-class-component'
import { Prop, Watch } from 'vue-property-decorator'
import { dateFormat } from '@/utils' import { dateFormat } from '@/utils'
import OrganizationUnitService from '@/api/organizationunit' import OrganizationUnitService from '@/api/organizationunit'
@ -89,25 +90,23 @@ import OrganizationUnitService from '@/api/organizationunit'
} }
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
@Prop({ default: '' }) @Prop({ default: '' })
private organizationUnitId?: string private organizationUnitId?: string
private organizationUnitUsers: UserDataDto[]
constructor() {
super()
this.organizationUnitUsers = new Array<UserDataDto>()
}
@Watch('organizationUnitId', { immediate: true }) @Watch('organizationUnitId', { immediate: true })
private onOrganizationUnitIdChanged() { private onOrganizationUnitIdChanged() {
this.organizationUnitUsers = new Array<UserDataDto>() this.dataList = new Array<any>()
if (this.organizationUnitId) {
this.refreshData()
}
}
protected getList() {
if (this.organizationUnitId) { if (this.organizationUnitId) {
OrganizationUnitService.organizationUnitGetUsers(this.organizationUnitId).then(res => { return OrganizationUnitService.organizationUnitGetUsers(this.organizationUnitId)
this.organizationUnitUsers = res.items
})
} }
return this.getEmptyList()
} }
} }
</script> </script>

45
vueJs/src/views/admin/roles/index.vue

@ -5,7 +5,7 @@
class="filter-item" class="filter-item"
style="margin-left: 10px; text-alignt" style="margin-left: 10px; text-alignt"
type="primary" type="primary"
@click="handleGetRoles" @click="refreshPagedData"
> >
{{ $t('roles.refreshList') }} {{ $t('roles.refreshList') }}
</el-button> </el-button>
@ -20,9 +20,9 @@
</div> </div>
<el-table <el-table
v-loading="roleListLoading" v-loading="dataLoading"
row-key="id" row-key="id"
:data="roleList" :data="dataList"
border border
fit fit
highlight-current-row highlight-current-row
@ -134,11 +134,11 @@
</el-table> </el-table>
<pagination <pagination
v-show="roleCount>0" v-show="dataTotal>0"
:total="roleCount" :total="dataTotal"
:page.sync="roleQueryFilter.skipCount" :page.sync="dataFilter.skipCount"
:limit.sync="roleQueryFilter.maxResultCount" :limit.sync="dataFilter.maxResultCount"
@pagination="handleGetRoles" @pagination="refreshPagedData"
/> />
<el-dialog <el-dialog
@ -156,7 +156,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator' import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import RoleService, { CreateRoleDto, RoleDto, UpdateRoleDto, RoleGetPagedDto } from '@/api/roles' import RoleService, { CreateRoleDto, RoleDto, UpdateRoleDto, RoleGetPagedDto } from '@/api/roles'
import { checkPermission } from '@/utils/permission' import { checkPermission } from '@/utils/permission'
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
@ -174,27 +175,19 @@ import RoleEditForm from './components/RoleEditForm.vue'
checkPermission checkPermission
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
private roleCount = 0
private roleQueryFilter = new RoleGetPagedDto()
private roleList = new Array<RoleDto>()
private roleListLoading = false
private showEditDialog = false private showEditDialog = false
private editRoleId = '' private editRoleId = ''
public dataFilter = new RoleGetPagedDto()
mounted() { mounted() {
this.handleGetRoles() this.refreshPagedData()
} }
/** 获取角色权限列表 */ /** 获取角色权限列表 */
private handleGetRoles() { protected getPagedList(filter: any) {
this.roleListLoading = true return RoleService.getRoles(filter)
RoleService.getRoles(this.roleQueryFilter).then(res => {
this.roleList = res.items
this.roleCount = res.totalCount
this.roleListLoading = false
})
} }
/** 响应角色行操作事件 */ /** 响应角色行操作事件 */
@ -232,7 +225,7 @@ export default class extends Vue {
RoleService.createRole(createRoleDto).then(role => { RoleService.createRole(createRoleDto).then(role => {
const message = this.$t('roles.createRoleSuccess', { name: role.name }).toString() const message = this.$t('roles.createRoleSuccess', { name: role.name }).toString()
this.$message.success(message) this.$message.success(message)
this.handleGetRoles() this.refreshPagedData()
}) })
}) })
} }
@ -251,7 +244,7 @@ export default class extends Vue {
setDefaultRoleDto.concurrencyStamp = role.concurrencyStamp setDefaultRoleDto.concurrencyStamp = role.concurrencyStamp
RoleService.updateRole(role.id, setDefaultRoleDto).then(role => { RoleService.updateRole(role.id, setDefaultRoleDto).then(role => {
this.$message.success(this.$t('roles.roleHasBeenSetDefault', { name: role.name }).toString()) this.$message.success(this.$t('roles.roleHasBeenSetDefault', { name: role.name }).toString())
this.handleGetRoles() this.refreshPagedData()
}) })
} }
@ -263,7 +256,7 @@ export default class extends Vue {
if (action === 'confirm') { if (action === 'confirm') {
RoleService.deleteRole(role.id).then(() => { RoleService.deleteRole(role.id).then(() => {
this.$message.success(this.$t('roles.roleHasBeenDeleted', { name: role.name }).toString()) this.$message.success(this.$t('roles.roleHasBeenDeleted', { name: role.name }).toString())
this.handleGetRoles() this.refreshPagedData()
}) })
} }
} }

71
vueJs/src/views/admin/tenants/index.vue

@ -6,7 +6,7 @@
style="padding-left:10px;" style="padding-left:10px;"
>{{ $t('global.queryFilter') }}</label> >{{ $t('global.queryFilter') }}</label>
<el-input <el-input
v-model="tenantGetPagedFilter.filter" v-model="dataFilter.filter"
:placeholder="$t('filterString')" :placeholder="$t('filterString')"
style="width: 250px;margin-left: 10px;" style="width: 250px;margin-left: 10px;"
class="filter-item" class="filter-item"
@ -15,7 +15,7 @@
class="filter-item" class="filter-item"
style="margin-left: 10px; text-alignt" style="margin-left: 10px; text-alignt"
type="primary" type="primary"
@click="handleGetTenants" @click="refreshPagedData"
> >
{{ $t('global.searchList') }} {{ $t('global.searchList') }}
</el-button> </el-button>
@ -30,9 +30,9 @@
</div> </div>
<el-table <el-table
v-loading="tenantListLoading" v-loading="dataLoading"
row-key="id" row-key="id"
:data="tenantList" :data="dataList"
border border
fit fit
highlight-current-row highlight-current-row
@ -142,11 +142,11 @@
</el-table> </el-table>
<Pagination <Pagination
v-show="tenantListCount>0" v-show="dataTotal>0"
:total="tenantListCount" :total="dataTotal"
:page.sync="tenantGetPagedFilter.skipCount" :page.sync="dataFilter.skipCount"
:limit.sync="tenantGetPagedFilter.maxResultCount" :limit.sync="dataFilter.maxResultCount"
@pagination="handleGetTenants" @pagination="refreshPagedData"
@sort-change="handleSortChange" @sort-change="handleSortChange"
/> />
@ -191,7 +191,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator' import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import TenantService, { TenantDto, TenantGetByPaged } from '@/api/tenant-management' import TenantService, { TenantDto, TenantGetByPaged } from '@/api/tenant-management'
import { dateFormat } from '@/utils/index' import { dateFormat } from '@/utils/index'
import { checkPermission } from '@/utils/permission' import { checkPermission } from '@/utils/permission'
@ -218,40 +219,20 @@ import TenantEditConnectionForm from './components/TenantEditConnectionForm.vue'
} }
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
private editTenantId: string private editTenantId = ''
private tenantList: TenantDto[] private showEditTenantConnectionDialog = false
private tenantListCount: number private showCreateOrEditTenantDialog = false
private tenantListLoading: boolean
private tenantGetPagedFilter: TenantGetByPaged
private showEditTenantConnectionDialog: boolean
private showCreateOrEditTenantDialog: boolean
private showFeatureEditFormDialog = false private showFeatureEditFormDialog = false
constructor() { public dataFilter = new TenantGetByPaged()
super()
this.editTenantId = ''
this.tenantListCount = 0
this.tenantListLoading = false
this.tenantList = new Array<TenantDto>()
this.tenantGetPagedFilter = new TenantGetByPaged()
this.showCreateOrEditTenantDialog = false
this.showEditTenantConnectionDialog = false
}
mounted() { mounted() {
this.handleGetTenants() this.refreshPagedData()
} }
private handleGetTenants() { protected getPagedList(filter: any) {
this.tenantListLoading = true return TenantService.getTenants(filter)
TenantService.getTenants(this.tenantGetPagedFilter).then(tenants => {
this.tenantList = tenants.items
this.tenantListCount = tenants.totalCount
this.tenantListLoading = false
})
} }
private handleCommand(command: {key: string, row: TenantDto}) { private handleCommand(command: {key: string, row: TenantDto}) {
@ -283,7 +264,7 @@ export default class extends Vue {
if (action === 'confirm') { if (action === 'confirm') {
TenantService.deleteTenant(id).then(() => { TenantService.deleteTenant(id).then(() => {
this.$message.success(this.l('tenant.deleteTenantSuccess', { name: name })) this.$message.success(this.l('tenant.deleteTenantSuccess', { name: name }))
this.handleGetTenants() this.refreshPagedData()
}) })
} }
} }
@ -294,7 +275,7 @@ export default class extends Vue {
this.showEditTenantConnectionDialog = false this.showEditTenantConnectionDialog = false
this.editTenantId = '' this.editTenantId = ''
if (changed) { if (changed) {
this.handleGetTenants() this.refreshPagedData()
} }
} }
@ -302,22 +283,14 @@ export default class extends Vue {
this.showCreateOrEditTenantDialog = false this.showCreateOrEditTenantDialog = false
this.editTenantId = '' this.editTenantId = ''
if (changed) { if (changed) {
this.handleGetTenants() this.refreshPagedData()
} }
} }
private handleSortChange(column: any) {
this.tenantGetPagedFilter.sorting = column.prop
}
private onFeatureEditFormClosed() { private onFeatureEditFormClosed() {
this.showFeatureEditFormDialog = false this.showFeatureEditFormDialog = false
this.editTenantId = '' this.editTenantId = ''
} }
private l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString()
}
} }
</script> </script>

72
vueJs/src/views/admin/users/index.vue

@ -6,6 +6,7 @@
style="padding-left:0;" style="padding-left:0;"
>{{ $t('users.queryFilter') }}</label> >{{ $t('users.queryFilter') }}</label>
<el-input <el-input
v-model="dataFilter.filter"
:placeholder="$t('users.filterString')" :placeholder="$t('users.filterString')"
style="width: 250px;margin-left: 10px;" style="width: 250px;margin-left: 10px;"
class="filter-item" class="filter-item"
@ -14,7 +15,7 @@
class="filter-item" class="filter-item"
style="margin-left: 10px; text-alignt" style="margin-left: 10px; text-alignt"
type="primary" type="primary"
@click="handleGetUsers" @click="refreshPagedData"
> >
{{ $t('users.searchList') }} {{ $t('users.searchList') }}
</el-button> </el-button>
@ -29,14 +30,13 @@
</div> </div>
<el-table <el-table
v-loading="userListLoading" v-loading="dataLoading"
row-key="id" row-key="id"
:data="userList" :data="dataList"
border border
fit fit
highlight-current-row highlight-current-row
style="width: 100%;" style="width: 100%;"
:default-sort="sortRule"
@sort-change="handleSortChange" @sort-change="handleSortChange"
> >
<el-table-column <el-table-column
@ -150,11 +150,11 @@
</el-table> </el-table>
<Pagination <Pagination
v-show="totalCount>0" v-show="dataTotal>0"
:total="totalCount" :total="dataTotal"
:page.sync="getUserQuery.skipCount" :page.sync="dataFilter.skipCount"
:limit.sync="getUserQuery.maxResultCount" :limit.sync="dataFilter.maxResultCount"
@pagination="handleGetUsers" @pagination="refreshPagedData"
/> />
<el-dialog <el-dialog
@ -185,7 +185,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue } from 'vue-property-decorator' import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
import { dateFormat } from '@/utils' import { dateFormat } from '@/utils'
import UserApiService, { UserDataDto, UsersGetPagedDto } from '@/api/users' import UserApiService, { UserDataDto, UsersGetPagedDto } from '@/api/users'
@ -210,48 +211,22 @@ import { checkPermission } from '@/utils/permission'
checkPermission checkPermission
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
/** 用户列表加载中 */
private userListLoading: boolean
/** 用户列表 */
private userList: UserDataDto[]
/** 最大用户数量 */
private totalCount: number
/** 当前编辑用户 */ /** 当前编辑用户 */
private editUser: UserDataDto private editUser = new UserDataDto()
/** 排序组别 */
private sortRule: { prop: string, sort: string }
/** 查询用户过滤参数 */
private getUserQuery: UsersGetPagedDto
private showCreateUserDialog: boolean public dataFilter = new UsersGetPagedDto()
private showEditUserDialog: boolean
constructor() { private showCreateUserDialog = false
super() private showEditUserDialog = false
this.totalCount = 0
this.editUser = new UserDataDto()
this.userListLoading = false
this.sortRule = { prop: '', sort: '' }
this.getUserQuery = new UsersGetPagedDto()
this.userList = new Array<UserDataDto>()
this.showEditUserDialog = false
this.showCreateUserDialog = false
}
mounted() { mounted() {
this.handleGetUsers() this.refreshPagedData()
} }
/** 查询用户列表 */ /** 查询用户列表 */
private handleGetUsers() { protected getPagedList(filter: any) {
this.userListLoading = true return UserApiService.getUsers(filter)
UserApiService.getUsers(this.getUserQuery).then(res => {
this.totalCount = res.totalCount
this.userList = res.items
this.userListLoading = false
})
} }
/** /**
@ -273,7 +248,7 @@ export default class extends Vue {
} }
private handleUserProfileChanged() { private handleUserProfileChanged() {
this.handleGetUsers() this.refreshPagedData()
} }
private handleCreateUser() { private handleCreateUser() {
@ -302,17 +277,12 @@ export default class extends Vue {
if (action === 'confirm') { if (action === 'confirm') {
UserApiService.deleteUser(row.id).then(() => { UserApiService.deleteUser(row.id).then(() => {
this.$message.success(this.$t('users.userHasBeenDeleted', { name: row.userName }).toString()) this.$message.success(this.$t('users.userHasBeenDeleted', { name: row.userName }).toString())
this.handleGetUsers() this.refreshPagedData()
}) })
} }
} }
}) })
} }
/** 响应表格排序事件 */
private handleSortChange(column: any) {
this.getUserQuery.sorting = column.sort
}
} }
</script> </script>

77
vueJs/src/views/file-management/index.vue

@ -27,9 +27,9 @@
<el-table <el-table
ref="fileSystemTable" ref="fileSystemTable"
v-loading="fileSystemListLoading" v-loading="dataLoading"
row-key="name" row-key="name"
:data="fileSystemList" :data="dataList"
border border
fit fit
highlight-current-row highlight-current-row
@ -38,6 +38,7 @@
@row-click="onRowClick" @row-click="onRowClick"
@row-dblclick="onRowDoubleClick" @row-dblclick="onRowDoubleClick"
@contextmenu.native="onContextMenu" @contextmenu.native="onContextMenu"
@sort-change="handleSortChange"
> >
<el-table-column <el-table-column
type="selection" type="selection"
@ -151,11 +152,11 @@
</el-table> </el-table>
<Pagination <Pagination
v-show="fileSystemCount>0" v-show="dataTotal>0"
:total="fileSystemCount" :total="dataTotal"
:page.sync="fileSystemGetFilter.skipCount" :page.sync="dataFilter.skipCount"
:limit.sync="fileSystemGetFilter.maxResultCount" :limit.sync="dataFilter.maxResultCount"
@pagination="handleGetFileSystemList" @pagination="refreshPagedData"
/> />
<el-dialog <el-dialog
@ -176,10 +177,12 @@
<script lang="ts"> <script lang="ts">
import { dateFormat } from '@/utils' import { dateFormat } from '@/utils'
import { checkPermission } from '@/utils/permission' import { checkPermission } from '@/utils/permission'
import { Component, Vue } from 'vue-property-decorator' import { Vue } from 'vue-property-decorator'
import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import FileUploadForm from './components/FileUploadForm.vue' import FileUploadForm from './components/FileUploadForm.vue'
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
import FileSystemService, { FileSystem, FileSystemGetByPaged, FileSystemType } from '@/api/filemanagement' import FileSystemService, { FileSystemGetByPaged, FileSystemType } from '@/api/filemanagement'
const kbUnit = 1 * 1024 const kbUnit = 1 * 1024
const mbUnit = kbUnit * 1024 const mbUnit = kbUnit * 1024
@ -247,48 +250,28 @@ const $contextmenu = Vue.prototype.$contextmenu
} }
} }
}) })
export default class extends Vue { export default class extends mixins(DataListMiXin) {
private showFileUploadDialog!: boolean private showFileUploadDialog = false
private downloading!: boolean private downloading = false
private lastFilePath!: string private lastFilePath = ''
private fileSystemRoot!: string[] private fileSystemRoot = new Array<string>()
private fileSystemList?: FileSystem[]
private fileSystemCount!: number
private fileSystemListLoading!: boolean
private fileSystemGetFilter!: FileSystemGetByPaged
constructor() { public dataFilter = new FileSystemGetByPaged()
super()
this.lastFilePath = ''
this.fileSystemCount = 0
this.downloading = false
this.fileSystemListLoading = false
this.showFileUploadDialog = false
this.fileSystemRoot = new Array<string>()
this.fileSystemList = new Array<FileSystem>()
this.fileSystemGetFilter = new FileSystemGetByPaged()
}
mounted() { mounted() {
this.fileSystemRoot.push(this.$t('fileSystem.root').toString()) this.fileSystemRoot.push(this.$t('fileSystem.root').toString())
this.handleGetFileSystemList() this.refreshPagedData()
} }
private handleGetFileSystemList() { protected getPagedList(filter: any) {
this.fileSystemListLoading = true return FileSystemService.getFileSystemList(filter)
FileSystemService.getFileSystemList(this.fileSystemGetFilter).then(res => {
this.fileSystemCount = res.totalCount
this.fileSystemList = res.items
}).finally(() => {
this.fileSystemListLoading = false
})
} }
private navigationToFilePath() { private navigationToFilePath() {
const fileSystemPathArray = this.fileSystemRoot.slice(1) const fileSystemPathArray = this.fileSystemRoot.slice(1)
const fileSystemPath = fileSystemPathArray.join('/') const fileSystemPath = fileSystemPathArray.join('/')
this.fileSystemGetFilter.parent = fileSystemPath this.dataFilter.parent = fileSystemPath
this.handleGetFileSystemList() this.refreshPagedData()
} }
private handleGoToLastFolder() { private handleGoToLastFolder() {
@ -311,12 +294,12 @@ export default class extends Vue {
} }
FileSystemService.deleteFolder(path).then(() => { FileSystemService.deleteFolder(path).then(() => {
this.$notify.success(this.l('global.dataHasBeenDeleted', { name: row.name })) this.$notify.success(this.l('global.dataHasBeenDeleted', { name: row.name }))
this.handleGetFileSystemList() this.refreshPagedData()
}) })
} else { } else {
FileSystemService.deleteFile(row.parent, row.name).then(() => { FileSystemService.deleteFile(row.parent, row.name).then(() => {
this.$notify.success(this.l('global.dataHasBeenDeleted', { name: row.name })) this.$notify.success(this.l('global.dataHasBeenDeleted', { name: row.name }))
this.handleGetFileSystemList() this.refreshPagedData()
}) })
} }
} }
@ -412,12 +395,12 @@ export default class extends Vue {
this.fileSystemRoot.splice(index + 1) this.fileSystemRoot.splice(index + 1)
this.navigationToFilePath() this.navigationToFilePath()
} else { } else {
this.handleGetFileSystemList() this.refreshPagedData()
} }
} }
private onFileUploaded() { private onFileUploaded() {
this.handleGetFileSystemList() this.refreshPagedData()
} }
private onFileUploadFormClosed() { private onFileUploadFormClosed() {
@ -450,7 +433,7 @@ export default class extends Vue {
}).then((val: any) => { }).then((val: any) => {
FileSystemService.createFolder(val.value, parent).then(() => { FileSystemService.createFolder(val.value, parent).then(() => {
this.$message.success(this.$t('fileSystem.folderCreateSuccess', { name: val.value }).toString()) this.$message.success(this.$t('fileSystem.folderCreateSuccess', { name: val.value }).toString())
this.handleGetFileSystemList() this.refreshPagedData()
}) })
}).catch(_ => _) }).catch(_ => _)
}, },
@ -476,10 +459,6 @@ export default class extends Vue {
}) })
return false return false
} }
private l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString()
}
} }
</script> </script>

Loading…
Cancel
Save