Browse Source

Merge pull request #206 from colinin/4.2

some bug fixed
pull/252/head
cKey 5 years ago
committed by GitHub
parent
commit
372075a76b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      aspnet-core/LINGYUN.MicroService.Common.sln
  2. 49
      vueJs/src/utils/request.ts
  3. 9
      vueJs/src/views/admin/components/FeatureManagement.vue
  4. 38
      vueJs/src/views/admin/tenants/components/HostFeatureEditForm.vue
  5. 63
      vueJs/src/views/admin/tenants/index.vue

6
aspnet-core/LINGYUN.MicroService.Common.sln

@ -105,11 +105,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.BlobStoring.Ali
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "console", "console", "{8D2AD50B-DD4B-48A2-88EC-0E8E8236D883}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "console", "console", "{8D2AD50B-DD4B-48A2-88EC-0E8E8236D883}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Encryption.Console", "modules\console\LINGYUN.Abp.Encryption.Console\LINGYUN.Abp.Encryption.Console.csproj", "{8FB74B18-CA5C-4DC3-8DFA-600133A05712}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Encryption.Console", "modules\console\LINGYUN.Abp.Encryption.Console\LINGYUN.Abp.Encryption.Console.csproj", "{8FB74B18-CA5C-4DC3-8DFA-600133A05712}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Aliyun.Tests", "tests\LINGYUN.Abp.Aliyun.Tests\LINGYUN.Abp.Aliyun.Tests.csproj", "{3DBF0975-B09D-49CA-9AF8-69175EDB9D52}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Aliyun.Tests", "tests\LINGYUN.Abp.Aliyun.Tests\LINGYUN.Abp.Aliyun.Tests.csproj", "{3DBF0975-B09D-49CA-9AF8-69175EDB9D52}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Sms.Aliyun.Tests", "tests\LINGYUN.Abp.Sms.Aliyun.Tests\LINGYUN.Abp.Sms.Aliyun.Tests.csproj", "{93DD5A05-B67A-4E11-BB56-F6B4E7F1489C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Sms.Aliyun.Tests", "tests\LINGYUN.Abp.Sms.Aliyun.Tests\LINGYUN.Abp.Sms.Aliyun.Tests.csproj", "{93DD5A05-B67A-4E11-BB56-F6B4E7F1489C}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

49
vueJs/src/utils/request.ts

@ -16,17 +16,18 @@ service.interceptors.request.use(
(config) => { (config) => {
if (AbpModule.configuration) { if (AbpModule.configuration) {
if (AbpModule.configuration.currentTenant.isAvailable) { if (AbpModule.configuration.currentTenant.isAvailable) {
config.headers.__tenant = AbpModule.configuration.currentTenant.id config.headers['__tenant'] = AbpModule.configuration.currentTenant.id
} }
config.headers['Accept-Language'] = AbpModule.configuration.localization?.currentCulture?.cultureName config.headers['Accept-Language'] = AbpModule.configuration.localization?.currentCulture?.cultureName
}
// abp官方类库用的 zh-Hans 的简体中文包 这里直接粗暴一点
// 顺序调整到token之前
const language = getLanguage()
if (language?.indexOf('zh') !== -1) {
config.headers['Accept-Language'] = 'zh-Hans'
} else { } else {
config.headers['Accept-Language'] = language // abp官方类库用的 zh-Hans 的简体中文包 这里直接粗暴一点
// 顺序调整到token之前
const language = getLanguage()
if (language?.indexOf('zh') !== -1) {
config.headers['Accept-Language'] = 'zh-Hans'
} else {
config.headers['Accept-Language'] = language
}
} }
if (config.url === '/connect/token') { if (config.url === '/connect/token') {
return config return config
@ -46,11 +47,33 @@ function l(name: string) {
return i18n.tc(name) return i18n.tc(name)
} }
function showError(response: any) { function showError(error: any) {
let message = '' let message = ''
let title = '' let title = ''
let response = error.response
console.log(response)
// 特别处理返回数据为blob类型时的错误信息
if (error.config.responseType && error.config.responseType === 'blob') {
const fileReader = new FileReader()
fileReader.onload = (e) => {
if (e.target?.result) {
const jsonError = JSON.parse(e.target.result.toString())
Notification({
title: l('AbpUi.DefaultErrorMessage'),
message: jsonError.error.message,
type: 'error',
duration: 5 * 1000
})
}
}
fileReader.readAsText(error.response.data, 'utf-8')
return
}
if (response.data && response.data.error) { if (response.data && response.data.error) {
if (response.data.error.details) { if (response.data.error_description) {
title = response.data.error
message = response.data.error_description
} else if (response.data.error.details) {
message = response.data.error.details message = response.data.error.details
title = response.data.error.message title = response.data.error.message
} else if (response.data.error.message) { } else if (response.data.error.message) {
@ -58,10 +81,6 @@ function showError(response: any) {
} }
} else { } else {
switch (response.status) { switch (response.status) {
case 400:
title = response.data.error
message = response.data.error_description
break
case 401: case 401:
title = l('AbpUi.DefaultErrorMessage401') title = l('AbpUi.DefaultErrorMessage401')
message = l('AbpUi.DefaultErrorMessage401Detail') message = l('AbpUi.DefaultErrorMessage401Detail')
@ -121,7 +140,7 @@ service.interceptors.response.use(
}) })
}) })
} else { } else {
showError(error.response) showError(error)
} }
return Promise.reject(error) return Promise.reject(error)
} }

9
vueJs/src/views/admin/components/FeatureManagement.vue

@ -37,7 +37,7 @@
> >
<el-switch <el-switch
:value="getBooleanValue(feature.value)" :value="getBooleanValue(feature.value)"
@change="(value) => handleCheckBoxValueChanged(feature, value)" @change="(value) => handleValueChanged(feature, value)"
/> />
</div> </div>
<div <div
@ -47,6 +47,7 @@
v-if="feature.valueType.validator.name === 'NUMERIC'" v-if="feature.valueType.validator.name === 'NUMERIC'"
v-model.number="feature.value" v-model.number="feature.value"
type="number" type="number"
@change="(value) => handleValueChanged(feature, value)"
/> />
<el-input <el-input
v-else v-else
@ -188,8 +189,8 @@ export default class extends Vue {
this.handleGetFeatures() this.handleGetFeatures()
} }
private handleCheckBoxValueChanged(feature: Feature, value: any) { private handleValueChanged(feature: Feature, value: any) {
feature.value = value.toString() feature.value = String(value)
} }
/** /**
@ -204,7 +205,7 @@ export default class extends Vue {
* 获取功能列表 * 获取功能列表
*/ */
private handleGetFeatures() { private handleGetFeatures() {
if (this.loadFeature && this.providerKey) { if (this.loadFeature) {
FeatureManagementService.getFeatures(this.providerName, this.providerKey).then(res => { FeatureManagementService.getFeatures(this.providerName, this.providerKey).then(res => {
this.featureGroups = res this.featureGroups = res
if (this.featureGroups.groups.length > 0) { if (this.featureGroups.groups.length > 0) {

38
vueJs/src/views/admin/tenants/components/HostFeatureEditForm.vue

@ -0,0 +1,38 @@
<template>
<el-dialog
:visible="showDialog"
:title="$t('AbpTenantManagement.ManageHostFeatures')"
width="800px"
custom-class="modal-form"
:show-close="false"
@close="onFormClosed"
>
<feature-management
ref="featureManagement"
provider-name="G"
provider-key=""
:load-feature="showDialog"
@closed="onFormClosed"
/>
</el-dialog>
</template>
<script lang="ts">
import { Component, Prop, Vue } from 'vue-property-decorator'
import FeatureManagement from '../../components/FeatureManagement.vue'
@Component({
name: 'HostFeatureEditForm',
components: {
FeatureManagement
}
})
export default class extends Vue {
@Prop({ default: false })
private showDialog!: boolean
private onFormClosed() {
this.$emit('closed')
}
}
</script>

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

@ -27,6 +27,15 @@
> >
{{ $t('tenant.createTenant') }} {{ $t('tenant.createTenant') }}
</el-button> </el-button>
<el-button
v-if="isHost"
class="filter-item"
type="primary"
:disabled="!checkPermission(['FeatureManagement.ManageHostFeatures'])"
@click="handleManageHostFeatures"
>
{{ $t('AbpTenantManagement.ManageHostFeatures') }}
</el-button>
</div> </div>
<el-table <el-table
@ -162,21 +171,45 @@
@closed="handleTenantConnectionEditFormClosed" @closed="handleTenantConnectionEditFormClosed"
/> />
<tenant-feature-editForm <!-- <tenant-feature-edit-form
:show-dialog="showFeatureEditFormDialog" :show-dialog="showFeatureEditFormDialog"
:tenant-id="editTenantId" :tenant-id="editTenantId"
@closed="onFeatureEditFormClosed" @closed="onFeatureEditFormClosed"
/> />
<host-feature-edit-form
v-if="isHost"
:show-dialog="showHostFeatureDialog"
@closed="showHostFeatureDialog=false"
/> -->
<el-dialog
:visible="showFeatureDialog"
:title="featureManagementTitle"
width="800px"
custom-class="modal-form"
:show-close="false"
@close="showFeatureDialog=false"
>
<feature-management
:provider-name="featureProviderName"
:provider-key="featureProviderKey"
:load-feature="showFeatureDialog"
@closed="showFeatureDialog=false"
/>
</el-dialog>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { AbpModule } from '@/store/modules/abp'
import DataListMiXin from '@/mixins/DataListMiXin' import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component' 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, abpPagerFormat } from '@/utils/index' import { dateFormat, abpPagerFormat } from '@/utils/index'
import { checkPermission } from '@/utils/permission' import { checkPermission } from '@/utils/permission'
import Pagination from '@/components/Pagination/index.vue' import Pagination from '@/components/Pagination/index.vue'
import FeatureManagement from '../components/FeatureManagement.vue'
import TenantFeatureEditForm from './components/TenantFeatureEditForm.vue' import TenantFeatureEditForm from './components/TenantFeatureEditForm.vue'
import TenantCreateOrEditForm from './components/TenantCreateOrEditForm.vue' import TenantCreateOrEditForm from './components/TenantCreateOrEditForm.vue'
import TenantConnectionEditForm from './components/TenantConnectionEditForm.vue' import TenantConnectionEditForm from './components/TenantConnectionEditForm.vue'
@ -185,6 +218,7 @@ import TenantConnectionEditForm from './components/TenantConnectionEditForm.vue'
name: 'RoleList', name: 'RoleList',
components: { components: {
Pagination, Pagination,
FeatureManagement,
TenantFeatureEditForm, TenantFeatureEditForm,
TenantCreateOrEditForm, TenantCreateOrEditForm,
TenantConnectionEditForm TenantConnectionEditForm
@ -205,8 +239,20 @@ export default class extends mixins(DataListMiXin) {
private showCreateOrEditTenantDialog = false private showCreateOrEditTenantDialog = false
private showFeatureEditFormDialog = false private showFeatureEditFormDialog = false
private showFeatureDialog = false
private featureManagementTitle = ''
private featureProviderName = ''
private featureProviderKey = ''
public dataFilter = new TenantGetByPaged() public dataFilter = new TenantGetByPaged()
get isHost() {
if (!AbpModule.configuration) {
return true
}
return !AbpModule.configuration.currentTenant.isAvailable
}
mounted() { mounted() {
this.refreshPagedData() this.refreshPagedData()
} }
@ -226,8 +272,10 @@ export default class extends mixins(DataListMiXin) {
this.showEditTenantConnectionDialog = true this.showEditTenantConnectionDialog = true
break break
case 'feature' : case 'feature' :
this.editTenantId = command.row.id this.featureProviderName = 'T'
this.showFeatureEditFormDialog = true this.featureProviderKey = command.row.id
this.featureManagementTitle = this.l('AbpTenantManagement.Permission:ManageFeatures')
this.showFeatureDialog = true
break break
case 'delete' : case 'delete' :
this.handleDeleteTenant(command.row.id, command.row.name) this.handleDeleteTenant(command.row.id, command.row.name)
@ -271,8 +319,15 @@ export default class extends mixins(DataListMiXin) {
} }
} }
private handleManageHostFeatures() {
this.featureProviderName = 'T'
this.featureProviderKey = ''
this.featureManagementTitle = this.l('AbpTenantManagement.ManageHostFeatures')
this.showFeatureDialog = true
}
private onFeatureEditFormClosed() { private onFeatureEditFormClosed() {
this.showFeatureEditFormDialog = false this.showFeatureDialog = false
this.editTenantId = '' this.editTenantId = ''
} }
} }

Loading…
Cancel
Save