-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: support adding license modification feature #7838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,7 @@ | |
| import i18n from '@/lang'; | ||
| import { ref } from 'vue'; | ||
| import { MsgSuccess } from '@/utils/message'; | ||
| import { uploadFileData } from '@/api/modules/setting'; | ||
| import { uploadLicense } from '@/api/modules/setting'; | ||
| import { GlobalStore } from '@/store'; | ||
| import { UploadFile, UploadFiles, UploadInstance, UploadProps, UploadRawFile, genFileId } from 'element-plus'; | ||
| import { useTheme } from '@/global/use-theme'; | ||
|
|
@@ -57,6 +57,18 @@ const open = ref(false); | |
| const uploadRef = ref<UploadInstance>(); | ||
| const uploaderFiles = ref<UploadFiles>([]); | ||
|
|
||
| const oldLicense = ref(); | ||
| interface DialogProps { | ||
| oldLicense: string; | ||
| } | ||
|
|
||
| const acceptParams = (params: DialogProps) => { | ||
| oldLicense.value = params?.oldLicense || ''; | ||
| uploaderFiles.value = []; | ||
| uploadRef.value?.clearFiles(); | ||
| open.value = true; | ||
| }; | ||
|
|
||
| const handleClose = () => { | ||
| open.value = false; | ||
| uploadRef.value!.clearFiles(); | ||
|
|
@@ -88,8 +100,9 @@ const submit = async () => { | |
| const file = uploaderFiles.value[0]; | ||
| const formData = new FormData(); | ||
| formData.append('file', file.raw); | ||
| formData.append('title', oldLicense.value); | ||
| loading.value = true; | ||
| await uploadFileData(formData) | ||
| await uploadLicense(oldLicense.value, formData) | ||
| .then(async () => { | ||
| globalStore.isProductPro = true; | ||
| const xpackRes = await getXpackSetting(); | ||
|
|
@@ -113,12 +126,6 @@ const submit = async () => { | |
| }); | ||
| }; | ||
|
|
||
| const acceptParams = () => { | ||
| uploaderFiles.value = []; | ||
| uploadRef.value?.clearFiles(); | ||
| open.value = true; | ||
| }; | ||
|
|
||
| defineExpose({ | ||
| acceptParams, | ||
| }); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No discrepancies found, but here is some suggestion for further optimization:
Example: // In the context where above code is used, remove the last assignment in the 'export' statement as well
const open = ref(false);
const uploadRef = ref<UploadInstance>();
const uploaderFiles = ref<UploadFiles>([]);This small change would not introduce any problems with the rest of your Vue component. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,7 +85,7 @@ | |
|
|
||
| <script setup lang="ts"> | ||
| import { ref, reactive, onMounted } from 'vue'; | ||
| import { SearchLicense, syncLicense, unbindLicense } from '@/api/modules/setting'; | ||
| import { searchLicense, syncLicense, unbindLicense } from '@/api/modules/setting'; | ||
| import LicenseImport from '@/components/license-import/index.vue'; | ||
| import LicenseDelete from '@/views/setting/license/delete/index.vue'; | ||
| import LicenseBind from '@/views/setting/license/bind/index.vue'; | ||
|
|
@@ -165,7 +165,7 @@ const search = async () => { | |
| page: paginationConfig.currentPage, | ||
| pageSize: paginationConfig.pageSize, | ||
| }; | ||
| await SearchLicense(params) | ||
| await searchLicense(params) | ||
| .then((res) => { | ||
| loading.value = false; | ||
| data.value = res.data.items || []; | ||
|
|
@@ -176,6 +176,7 @@ const search = async () => { | |
| ? i18n.global.t('license.indefinitePeriod') | ||
| : timestampToDate(Number(item.productPro)); | ||
| } | ||
| paginationConfig.total = res.data.total; | ||
| }) | ||
| .catch(() => { | ||
| loading.value = false; | ||
|
|
@@ -233,6 +234,15 @@ const buttons = [ | |
| onUnbind(row); | ||
| }, | ||
| }, | ||
| { | ||
| label: i18n.global.t('commons.button.edit'), | ||
| disabled: (row: any) => { | ||
| return row.status === 'Free'; | ||
| }, | ||
| click: (row: any) => { | ||
| licenseRef.value.acceptParams({ oldLicense: row.licenseName }); | ||
| }, | ||
| }, | ||
| { | ||
| label: i18n.global.t('commons.button.sync'), | ||
| disabled: (row: any) => { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm sorry for any inconvenience caused; however, without seeing the actual content of the code provided or given specific information about expected results or features needed, I am unable to perform an accurate analysis. You may need more detailed guidance if you want help with this matter. Please provide the full code snippet. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no mention of any irregularities, potential issues, or optimizations to be made based on the given code snippet which only contains methods that seem related to uploading licenses.
Here is a concise version:
No specific issues were noted.