feat: i18n
This commit is contained in:
parent
f44f910c80
commit
557c077feb
@ -106,8 +106,8 @@
|
|||||||
</template>
|
</template>
|
||||||
<div class="status-tag">
|
<div class="status-tag">
|
||||||
<el-tag type="warning" v-if="isWorkFlow(item.type)" style="height: 22px">
|
<el-tag type="warning" v-if="isWorkFlow(item.type)" style="height: 22px">
|
||||||
{{ $t('views.application.workflow') }}</el-tag
|
{{ $t('views.application.workflow') }}
|
||||||
>
|
</el-tag>
|
||||||
<el-tag class="blue-tag" v-else style="height: 22px">
|
<el-tag class="blue-tag" v-else style="height: 22px">
|
||||||
{{ $t('views.application.simple') }}
|
{{ $t('views.application.simple') }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
@ -180,6 +180,8 @@ import { isWorkFlow } from '@/utils/application'
|
|||||||
import { ValidType, ValidCount } from '@/enums/common'
|
import { ValidType, ValidCount } from '@/enums/common'
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
|
import { reject } from 'lodash'
|
||||||
|
|
||||||
const elUploadRef = ref<any>()
|
const elUploadRef = ref<any>()
|
||||||
const { application, user, common } = useStore()
|
const { application, user, common } = useStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -195,6 +197,7 @@ const paginationConfig = reactive({
|
|||||||
page_size: 30,
|
page_size: 30,
|
||||||
total: 0
|
total: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
interface UserOption {
|
interface UserOption {
|
||||||
label: string
|
label: string
|
||||||
value: string
|
value: string
|
||||||
@ -210,13 +213,16 @@ const apiInputParams = ref([])
|
|||||||
|
|
||||||
function copyApplication(row: any) {
|
function copyApplication(row: any) {
|
||||||
application.asyncGetApplicationDetail(row.id, loading).then((res: any) => {
|
application.asyncGetApplicationDetail(row.id, loading).then((res: any) => {
|
||||||
|
if (res?.data) {
|
||||||
CopyApplicationDialogRef.value.open({ ...res.data, model_id: res.data.model })
|
CopyApplicationDialogRef.value.open({ ...res.data, model_id: res.data.model })
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const is_show_copy_button = (row: any) => {
|
const is_show_copy_button = (row: any) => {
|
||||||
return user.userInfo ? user.userInfo.id == row.user_id : false
|
return user.userInfo ? user.userInfo.id == row.user_id : false
|
||||||
}
|
}
|
||||||
|
|
||||||
function settingApplication(row: any) {
|
function settingApplication(row: any) {
|
||||||
if (isWorkFlow(row.type)) {
|
if (isWorkFlow(row.type)) {
|
||||||
router.push({ path: `/application/${row.id}/workflow` })
|
router.push({ path: `/application/${row.id}/workflow` })
|
||||||
@ -224,13 +230,12 @@ function settingApplication(row: any) {
|
|||||||
router.push({ path: `/application/${row.id}/${row.type}/setting` })
|
router.push({ path: `/application/${row.id}/${row.type}/setting` })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportApplication = (application: any) => {
|
const exportApplication = (application: any) => {
|
||||||
applicationApi.exportApplication(application.id, application.name, loading).catch((e) => {
|
applicationApi.exportApplication(application.id, application.name, loading).catch((e) => {
|
||||||
if (e.response.status !== 403) {
|
if (e.response.status !== 403) {
|
||||||
e.response.data.text().then((res: string) => {
|
e.response.data.text().then((res: string) => {
|
||||||
MsgError(
|
MsgError(`${t('views.application.tip.ExportError')}:${JSON.parse(res).message}`)
|
||||||
`${t('views.application.tip.ExportError')}:${JSON.parse(res).message}`
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -239,35 +244,40 @@ const importApplication = (file: any) => {
|
|||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append('file', file.raw, file.name)
|
formData.append('file', file.raw, file.name)
|
||||||
elUploadRef.value.clearFiles()
|
elUploadRef.value.clearFiles()
|
||||||
applicationApi.importApplication(formData, loading).then((ok) => {
|
applicationApi
|
||||||
|
.importApplication(formData, loading)
|
||||||
|
.then(async (res: any) => {
|
||||||
|
if (res?.data) {
|
||||||
searchHandle()
|
searchHandle()
|
||||||
})
|
|
||||||
}
|
}
|
||||||
function openCreateDialog() {
|
})
|
||||||
if (user.isEnterprise()) {
|
.catch((e) => {
|
||||||
CreateApplicationDialogRef.value.open()
|
if (e.code === 400) {
|
||||||
} else {
|
MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), {
|
||||||
MsgConfirm(
|
|
||||||
t('common.tip'),
|
|
||||||
t('views.application.tip.professionalMessage'),
|
|
||||||
{
|
|
||||||
cancelButtonText: t('common.confirm'),
|
cancelButtonText: t('common.confirm'),
|
||||||
confirmButtonText: t('common.professional')
|
confirmButtonText: t('common.professional')
|
||||||
}
|
}).then(() => {
|
||||||
)
|
|
||||||
.then(() => {
|
|
||||||
window.open('https://maxkb.cn/pricing.html', '_blank')
|
window.open('https://maxkb.cn/pricing.html', '_blank')
|
||||||
})
|
})
|
||||||
.catch(() => {
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function openCreateDialog() {
|
||||||
common
|
common
|
||||||
.asyncGetValid(ValidType.Application, ValidCount.Application, loading)
|
.asyncGetValid(ValidType.Application, ValidCount.Application, loading)
|
||||||
.then(async (res: any) => {
|
.then(async (res: any) => {
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
CreateApplicationDialogRef.value.open()
|
CreateApplicationDialogRef.value.open()
|
||||||
}
|
} else if (res?.code === 400) {
|
||||||
})
|
MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), {
|
||||||
|
cancelButtonText: t('common.confirm'),
|
||||||
|
confirmButtonText: t('common.professional')
|
||||||
|
}).then(() => {
|
||||||
|
window.open('https://maxkb.cn/pricing.html', '_blank')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchHandle() {
|
function searchHandle() {
|
||||||
@ -361,6 +371,7 @@ function getList() {
|
|||||||
paginationConfig.total = res.data.total
|
paginationConfig.total = res.data.total
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUserList() {
|
function getUserList() {
|
||||||
applicationApi.getUserList('APPLICATION', loading).then((res) => {
|
applicationApi.getUserList('APPLICATION', loading).then((res) => {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
@ -394,15 +405,18 @@ onMounted(() => {
|
|||||||
background: var(--el-disabled-bg-color);
|
background: var(--el-disabled-bg-color);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
border: 1px solid var(--el-card-bg-color);
|
border: 1px solid var(--el-card-bg-color);
|
||||||
background-color: var(--el-card-bg-color);
|
background-color: var(--el-card-bg-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-add-button {
|
.card-add-button {
|
||||||
&:hover {
|
&:hover {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: var(--app-text-color-light-1);
|
background: var(--app-text-color-light-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-upload) {
|
:deep(.el-upload) {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -410,6 +424,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.application-card {
|
.application-card {
|
||||||
.status-tag {
|
.status-tag {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -417,10 +432,12 @@ onMounted(() => {
|
|||||||
top: 15px;
|
top: 15px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-custom-switch {
|
.dropdown-custom-switch {
|
||||||
padding: 5px 11px;
|
padding: 5px 11px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
|
||||||
span {
|
span {
|
||||||
margin-right: 26px;
|
margin-right: 26px;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -182,9 +182,10 @@ const userOptions = ref<UserOption[]>([])
|
|||||||
const selectUserId = ref('all')
|
const selectUserId = ref('all')
|
||||||
|
|
||||||
function openCreateDialog() {
|
function openCreateDialog() {
|
||||||
if (user.isEnterprise()) {
|
common.asyncGetValid(ValidType.Dataset, ValidCount.Dataset, loading).then(async (res: any) => {
|
||||||
|
if (res?.data) {
|
||||||
CreateDatasetDialogRef.value.open()
|
CreateDatasetDialogRef.value.open()
|
||||||
} else {
|
} else if (res?.code === 400) {
|
||||||
MsgConfirm(t('common.tip'), t('views.dataset.tip.professionalMessage'), {
|
MsgConfirm(t('common.tip'), t('views.dataset.tip.professionalMessage'), {
|
||||||
cancelButtonText: t('common.confirm'),
|
cancelButtonText: t('common.confirm'),
|
||||||
confirmButtonText: t('common.professional')
|
confirmButtonText: t('common.professional')
|
||||||
@ -192,16 +193,9 @@ function openCreateDialog() {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
window.open('https://maxkb.cn/pricing.html', '_blank')
|
window.open('https://maxkb.cn/pricing.html', '_blank')
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {})
|
||||||
common
|
|
||||||
.asyncGetValid(ValidType.Dataset, ValidCount.Dataset, loading)
|
|
||||||
.then(async (res: any) => {
|
|
||||||
if (res?.data) {
|
|
||||||
CreateDatasetDialogRef.value.open()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
|
|||||||
@ -156,10 +156,11 @@ function editUser(row: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createUser() {
|
function createUser() {
|
||||||
if (user.isEnterprise()) {
|
common.asyncGetValid(ValidType.User, ValidCount.User, loading).then(async (res: any) => {
|
||||||
|
if (res?.data) {
|
||||||
title.value = t('views.user.createUser')
|
title.value = t('views.user.createUser')
|
||||||
UserDialogRef.value.open()
|
UserDialogRef.value.open()
|
||||||
} else {
|
} else if (res?.code === 400) {
|
||||||
MsgConfirm(t('common.tip'), t('views.user.tip.professionalMessage'), {
|
MsgConfirm(t('common.tip'), t('views.user.tip.professionalMessage'), {
|
||||||
cancelButtonText: t('common.confirm'),
|
cancelButtonText: t('common.confirm'),
|
||||||
confirmButtonText: t('common.professional')
|
confirmButtonText: t('common.professional')
|
||||||
@ -167,15 +168,9 @@ function createUser() {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
window.open('https://maxkb.cn/pricing.html', '_blank')
|
window.open('https://maxkb.cn/pricing.html', '_blank')
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {})
|
||||||
common.asyncGetValid(ValidType.User, ValidCount.User, loading).then(async (res: any) => {
|
|
||||||
if (res?.data) {
|
|
||||||
title.value = t('views.user.createUser')
|
|
||||||
UserDialogRef.value.open()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteUserManage(row: any) {
|
function deleteUserManage(row: any) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user