diff --git a/apps/web-antd/src/views/license/license/data.ts b/apps/web-antd/src/views/license/license/data.ts index 3a26021..ff5fd79 100644 --- a/apps/web-antd/src/views/license/license/data.ts +++ b/apps/web-antd/src/views/license/license/data.ts @@ -12,9 +12,12 @@ import { formatDate, formatDateTime } from '@vben/utils'; import dayjs, { Dayjs } from 'dayjs'; import { z } from '#/adapter/form'; -import { getLicenseCustomerList } from '#/api/license/customer'; +import { + getCustomerList, + getLicenseCustomerList, +} from '#/api/license/customer'; import { isLicenseSnUnique } from '#/api/license/license'; -import { getLicenseProjectList } from '#/api/license/project'; +import { getLicenseProjectList, getProjectList } from '#/api/license/project'; import { getLicenseAdminList, getSimpleUserList } from '#/api/system/user'; import { DictTag } from '#/components/dict-tag'; import { $t } from '#/locales'; @@ -39,16 +42,22 @@ export function useFormSchema(): VbenFormSchema[] { fieldName: 'customerId', label: $t('license.customer'), rules: 'required', - component: 'ApiSelect', + component: 'Select', dependencies: { triggerFields: ['id'], disabled: (values) => !!values.id, + componentProps: async (values) => { + customerList.value = await (values.id + ? getCustomerList() + : getLicenseCustomerList()); + + return { + options: customerList, + }; + }, }, componentProps: { - api: async () => { - customerList.value = await getLicenseCustomerList(); - return customerList.value; - }, + options: customerList, allowClear: true, fieldNames: { label: 'name', value: 'id' }, showSearch: true, @@ -71,15 +80,23 @@ export function useFormSchema(): VbenFormSchema[] { }, dependencies: { componentProps: async (values) => { - projectList.value = await getLicenseProjectList({ - customerId: values.customerId, - }); - const hasProject = projectList.value.find((project) => { - return project.id === values.projectId; - }); - if (!hasProject) { - values.projectId = ''; + projectList.value = await (values.id + ? getProjectList({ + customerId: values.customerId, + }) + : getLicenseProjectList({ + customerId: values.customerId, + })); + + if (!values.id) { + const hasProject = projectList.value.find((project) => { + return project.id === values.projectId; + }); + if (!hasProject) { + values.projectId = ''; + } } + return { options: projectList, }; diff --git a/apps/web-antd/src/views/license/license/modules/import-form.vue b/apps/web-antd/src/views/license/license/modules/import-form.vue index 0ef2b2d..3949d52 100644 --- a/apps/web-antd/src/views/license/license/modules/import-form.vue +++ b/apps/web-antd/src/views/license/license/modules/import-form.vue @@ -7,7 +7,7 @@ import { useVbenModal } from '@vben/common-ui'; // import { InboxOutlined } from '@vben/icons'; import { downloadFileFromBlobPart } from '@vben/utils'; -import { Button, message, UploadDragger } from 'ant-design-vue'; +import { Button, notification, UploadDragger } from 'ant-design-vue'; import { useVbenForm } from '#/adapter/form'; import { importLicense, importTemplate } from '#/api/license/license'; @@ -41,40 +41,42 @@ const [Modal, modalApi] = useVbenModal({ await modalApi.close(); emit('success'); let failuresMsg: any; - if (result.creates && result.creates.length > 0) { - failuresMsg = h( - 'div', - { - style: { - color: 'green', - }, + const createsLength = result.creates ? result.creates.length : 0; + const updatesLength = result.updates ? result.updates.length : 0; + const total = result.total || 0; + const failuresLength = total - createsLength - updatesLength; + const resultMsg = `总共${total}条,新增成功${createsLength}条, 更新成功${updatesLength}条, 导入失败${failuresLength}条`; + + failuresMsg = h( + 'div', + { + style: { + color: 'blue', }, - [failuresMsg, `新增成功:${result.creates.join(',')}`], - ); - } - if (result.updates && result.updates.length > 0) { - failuresMsg = h( - 'div', - { - style: { - color: 'blue', - }, - }, - [failuresMsg, `更新成功:${result.updates.join(',')}`], - ); - } - for (const key in result.failures) { + }, + [failuresMsg, resultMsg], + ); + for (const key in result.failureMap) { failuresMsg = h( 'div', { style: { color: 'red', + overflowY: 'auto', + maxHeight: '600px', }, }, - [failuresMsg, `导入失败:${key},失败原因:${result.failures[key]}`], + [failuresMsg, `导入失败SN(${key}):${result.failureMap[key]}`], ); } - message.info(failuresMsg, 10); + notification.open({ + message: '导入结果', + description: failuresMsg, + style: { + color: failuresLength > 0 ? 'red' : 'green', + }, + duration: 0, + }); } finally { modalApi.unlock(); } diff --git a/packages/locales/src/langs/zh-CN/authentication.json b/packages/locales/src/langs/zh-CN/authentication.json index ce6d21d..0004301 100644 --- a/packages/locales/src/langs/zh-CN/authentication.json +++ b/packages/locales/src/langs/zh-CN/authentication.json @@ -1,7 +1,7 @@ { "welcomeBack": "欢迎回来", - "pageTitle": "", - "pageDesc": "", + "pageTitle": "智维通管理系统", + "pageDesc": "智:智能管理lic,维:项目运维管理, 通:客户沟通商务协调", "loginSuccess": "登录成功", "loginSuccessDesc": "欢迎回来", "loginSubtitle": "请输入您的LDAP账号以开始管理您的项目",