Skip to content

Commit 557c077

Browse files
committed
feat: i18n
1 parent f44f910 commit 557c077

File tree

3 files changed

+75
-69
lines changed

3 files changed

+75
-69
lines changed

ui/src/views/application/index.vue

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@
106106
</template>
107107
<div class="status-tag">
108108
<el-tag type="warning" v-if="isWorkFlow(item.type)" style="height: 22px">
109-
{{ $t('views.application.workflow') }}</el-tag
110-
>
109+
{{ $t('views.application.workflow') }}
110+
</el-tag>
111111
<el-tag class="blue-tag" v-else style="height: 22px">
112112
{{ $t('views.application.simple') }}
113113
</el-tag>
@@ -180,6 +180,8 @@ import { isWorkFlow } from '@/utils/application'
180180
import { ValidType, ValidCount } from '@/enums/common'
181181
import { t } from '@/locales'
182182
import useStore from '@/stores'
183+
import { reject } from 'lodash'
184+
183185
const elUploadRef = ref<any>()
184186
const { application, user, common } = useStore()
185187
const router = useRouter()
@@ -195,6 +197,7 @@ const paginationConfig = reactive({
195197
page_size: 30,
196198
total: 0
197199
})
200+
198201
interface UserOption {
199202
label: string
200203
value: string
@@ -210,27 +213,29 @@ const apiInputParams = ref([])
210213
211214
function copyApplication(row: any) {
212215
application.asyncGetApplicationDetail(row.id, loading).then((res: any) => {
213-
CopyApplicationDialogRef.value.open({ ...res.data, model_id: res.data.model })
216+
if (res?.data) {
217+
CopyApplicationDialogRef.value.open({ ...res.data, model_id: res.data.model })
218+
}
214219
})
215220
}
216221
217222
const is_show_copy_button = (row: any) => {
218223
return user.userInfo ? user.userInfo.id == row.user_id : false
219224
}
225+
220226
function settingApplication(row: any) {
221227
if (isWorkFlow(row.type)) {
222228
router.push({ path: `/application/${row.id}/workflow` })
223229
} else {
224230
router.push({ path: `/application/${row.id}/${row.type}/setting` })
225231
}
226232
}
233+
227234
const exportApplication = (application: any) => {
228235
applicationApi.exportApplication(application.id, application.name, loading).catch((e) => {
229236
if (e.response.status !== 403) {
230237
e.response.data.text().then((res: string) => {
231-
MsgError(
232-
`${t('views.application.tip.ExportError')}:${JSON.parse(res).message}`
233-
)
238+
MsgError(`${t('views.application.tip.ExportError')}:${JSON.parse(res).message}`)
234239
})
235240
}
236241
})
@@ -239,35 +244,40 @@ const importApplication = (file: any) => {
239244
const formData = new FormData()
240245
formData.append('file', file.raw, file.name)
241246
elUploadRef.value.clearFiles()
242-
applicationApi.importApplication(formData, loading).then((ok) => {
243-
searchHandle()
244-
})
247+
applicationApi
248+
.importApplication(formData, loading)
249+
.then(async (res: any) => {
250+
if (res?.data) {
251+
searchHandle()
252+
}
253+
})
254+
.catch((e) => {
255+
if (e.code === 400) {
256+
MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), {
257+
cancelButtonText: t('common.confirm'),
258+
confirmButtonText: t('common.professional')
259+
}).then(() => {
260+
window.open('https://maxkb.cn/pricing.html', '_blank')
261+
})
262+
}
263+
})
245264
}
265+
246266
function openCreateDialog() {
247-
if (user.isEnterprise()) {
248-
CreateApplicationDialogRef.value.open()
249-
} else {
250-
MsgConfirm(
251-
t('common.tip'),
252-
t('views.application.tip.professionalMessage'),
253-
{
254-
cancelButtonText: t('common.confirm'),
255-
confirmButtonText: t('common.professional')
267+
common
268+
.asyncGetValid(ValidType.Application, ValidCount.Application, loading)
269+
.then(async (res: any) => {
270+
if (res?.data) {
271+
CreateApplicationDialogRef.value.open()
272+
} else if (res?.code === 400) {
273+
MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), {
274+
cancelButtonText: t('common.confirm'),
275+
confirmButtonText: t('common.professional')
276+
}).then(() => {
277+
window.open('https://maxkb.cn/pricing.html', '_blank')
278+
})
256279
}
257-
)
258-
.then(() => {
259-
window.open('https://maxkb.cn/pricing.html', '_blank')
260-
})
261-
.catch(() => {
262-
common
263-
.asyncGetValid(ValidType.Application, ValidCount.Application, loading)
264-
.then(async (res: any) => {
265-
if (res?.data) {
266-
CreateApplicationDialogRef.value.open()
267-
}
268-
})
269-
})
270-
}
280+
})
271281
}
272282
273283
function searchHandle() {
@@ -361,6 +371,7 @@ function getList() {
361371
paginationConfig.total = res.data.total
362372
})
363373
}
374+
364375
function getUserList() {
365376
applicationApi.getUserList('APPLICATION', loading).then((res) => {
366377
if (res.data) {
@@ -394,33 +405,39 @@ onMounted(() => {
394405
background: var(--el-disabled-bg-color);
395406
border-radius: 8px;
396407
box-sizing: border-box;
408+
397409
&:hover {
398410
border: 1px solid var(--el-card-bg-color);
399411
background-color: var(--el-card-bg-color);
400412
}
413+
401414
.card-add-button {
402415
&:hover {
403416
border-radius: 4px;
404417
background: var(--app-text-color-light-1);
405418
}
419+
406420
:deep(.el-upload) {
407421
display: block;
408422
width: 100%;
409423
color: var(--el-text-color-regular);
410424
}
411425
}
412426
}
427+
413428
.application-card {
414429
.status-tag {
415430
position: absolute;
416431
right: 16px;
417432
top: 15px;
418433
}
419434
}
435+
420436
.dropdown-custom-switch {
421437
padding: 5px 11px;
422438
font-size: 14px;
423439
font-weight: 400;
440+
424441
span {
425442
margin-right: 26px;
426443
}

ui/src/views/dataset/index.vue

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -182,26 +182,20 @@ const userOptions = ref<UserOption[]>([])
182182
const selectUserId = ref('all')
183183
184184
function openCreateDialog() {
185-
if (user.isEnterprise()) {
186-
CreateDatasetDialogRef.value.open()
187-
} else {
188-
MsgConfirm(t('common.tip'), t('views.dataset.tip.professionalMessage'), {
189-
cancelButtonText: t('common.confirm'),
190-
confirmButtonText: t('common.professional')
191-
})
192-
.then(() => {
193-
window.open('https://maxkb.cn/pricing.html', '_blank')
194-
})
195-
.catch(() => {
196-
common
197-
.asyncGetValid(ValidType.Dataset, ValidCount.Dataset, loading)
198-
.then(async (res: any) => {
199-
if (res?.data) {
200-
CreateDatasetDialogRef.value.open()
201-
}
202-
})
185+
common.asyncGetValid(ValidType.Dataset, ValidCount.Dataset, loading).then(async (res: any) => {
186+
if (res?.data) {
187+
CreateDatasetDialogRef.value.open()
188+
} else if (res?.code === 400) {
189+
MsgConfirm(t('common.tip'), t('views.dataset.tip.professionalMessage'), {
190+
cancelButtonText: t('common.confirm'),
191+
confirmButtonText: t('common.professional')
203192
})
204-
}
193+
.then(() => {
194+
window.open('https://maxkb.cn/pricing.html', '_blank')
195+
})
196+
.catch(() => {})
197+
}
198+
})
205199
}
206200
207201
function refresh() {

ui/src/views/user-manage/index.vue

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -156,26 +156,21 @@ function editUser(row: any) {
156156
}
157157
158158
function createUser() {
159-
if (user.isEnterprise()) {
160-
title.value = t('views.user.createUser')
161-
UserDialogRef.value.open()
162-
} else {
163-
MsgConfirm(t('common.tip'), t('views.user.tip.professionalMessage'), {
164-
cancelButtonText: t('common.confirm'),
165-
confirmButtonText: t('common.professional')
166-
})
167-
.then(() => {
168-
window.open('https://maxkb.cn/pricing.html', '_blank')
159+
common.asyncGetValid(ValidType.User, ValidCount.User, loading).then(async (res: any) => {
160+
if (res?.data) {
161+
title.value = t('views.user.createUser')
162+
UserDialogRef.value.open()
163+
} else if (res?.code === 400) {
164+
MsgConfirm(t('common.tip'), t('views.user.tip.professionalMessage'), {
165+
cancelButtonText: t('common.confirm'),
166+
confirmButtonText: t('common.professional')
169167
})
170-
.catch(() => {
171-
common.asyncGetValid(ValidType.User, ValidCount.User, loading).then(async (res: any) => {
172-
if (res?.data) {
173-
title.value = t('views.user.createUser')
174-
UserDialogRef.value.open()
175-
}
168+
.then(() => {
169+
window.open('https://maxkb.cn/pricing.html', '_blank')
176170
})
177-
})
178-
}
171+
.catch(() => {})
172+
}
173+
})
179174
}
180175
181176
function deleteUserManage(row: any) {

0 commit comments

Comments
 (0)