refactor: 优化文件上传组件,修改文件命名
This commit is contained in:
parent
e6a18ec527
commit
aa0fe7f056
@ -33,21 +33,18 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
|
|
||||||
const attrs: UploadProps = useAttrs();
|
const attrs: UploadProps = useAttrs();
|
||||||
|
|
||||||
const value = defineModel<CommonType.IdType[]>('value', { required: false, default: [] });
|
|
||||||
|
|
||||||
let fileNum = 0;
|
let fileNum = 0;
|
||||||
const fileList = ref<UploadFileInfo[]>([]);
|
const fileList = ref<UploadFileInfo[]>([]);
|
||||||
const needRelaodData = defineModel<boolean>('needRelaodData', {
|
|
||||||
default: false
|
const needRelaodData = ref(false);
|
||||||
});
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
refreshList: needRelaodData
|
needRelaodData
|
||||||
});
|
});
|
||||||
watch(
|
watch(
|
||||||
() => fileList.value,
|
() => fileList.value,
|
||||||
newValue => {
|
newValue => {
|
||||||
needRelaodData.value = newValue.length > 0;
|
needRelaodData.value = newValue.length > 0;
|
||||||
value.value = newValue.map(item => item.id);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import { useLoading } from '@sa/hooks';
|
|||||||
import { fetchForceLogout, fetchGetOnlineDeviceList } from '@/service/api/monitor';
|
import { fetchForceLogout, fetchGetOnlineDeviceList } from '@/service/api/monitor';
|
||||||
import { useAppStore } from '@/store/modules/app';
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import { useTable } from '@/hooks/common/table';
|
import { useTable } from '@/hooks/common/table';
|
||||||
import { getBrowserIcon, getOsIcon } from '@/utils/format';
|
import { getBrowserIcon, getOsIcon } from '@/utils/icon-tag-format';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import ButtonIcon from '@/components/custom/button-icon.vue';
|
import ButtonIcon from '@/components/custom/button-icon.vue';
|
||||||
import SvgIcon from '@/components/custom/svg-icon.vue';
|
import SvgIcon from '@/components/custom/svg-icon.vue';
|
||||||
|
@ -11,7 +11,7 @@ import { useAuth } from '@/hooks/business/auth';
|
|||||||
import { useDownload } from '@/hooks/business/download';
|
import { useDownload } from '@/hooks/business/download';
|
||||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||||
import { useDict } from '@/hooks/business/dict';
|
import { useDict } from '@/hooks/business/dict';
|
||||||
import { getBrowserIcon, getOsIcon } from '@/utils/format';
|
import { getBrowserIcon, getOsIcon } from '@/utils/icon-tag-format';
|
||||||
import DictTag from '@/components/custom/dict-tag.vue';
|
import DictTag from '@/components/custom/dict-tag.vue';
|
||||||
import SvgIcon from '@/components/custom/svg-icon.vue';
|
import SvgIcon from '@/components/custom/svg-icon.vue';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getBrowserIcon, getOsIcon } from '@/utils/format';
|
import { getBrowserIcon, getOsIcon } from '@/utils/icon-tag-format';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
|
@ -5,7 +5,7 @@ import { useAppStore } from '@/store/modules/app';
|
|||||||
import { useAuth } from '@/hooks/business/auth';
|
import { useAuth } from '@/hooks/business/auth';
|
||||||
import { useTable } from '@/hooks/common/table';
|
import { useTable } from '@/hooks/common/table';
|
||||||
import { useDict } from '@/hooks/business/dict';
|
import { useDict } from '@/hooks/business/dict';
|
||||||
import { getBrowserIcon, getOsIcon } from '@/utils/format';
|
import { getBrowserIcon, getOsIcon } from '@/utils/icon-tag-format';
|
||||||
import ButtonIcon from '@/components/custom/button-icon.vue';
|
import ButtonIcon from '@/components/custom/button-icon.vue';
|
||||||
import DictTag from '@/components/custom/dict-tag.vue';
|
import DictTag from '@/components/custom/dict-tag.vue';
|
||||||
import SvgIcon from '@/components/custom/svg-icon.vue';
|
import SvgIcon from '@/components/custom/svg-icon.vue';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { NDescriptions, NDescriptionsItem, NTag } from 'naive-ui';
|
import { NDescriptions, NDescriptionsItem, NTag } from 'naive-ui';
|
||||||
import { getRequestMethodTagType } from '@/utils/format';
|
import { getRequestMethodTagType } from '@/utils/icon-tag-format';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import DictTag from '@/components/custom/dict-tag.vue';
|
import DictTag from '@/components/custom/dict-tag.vue';
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ function closeDrawer() {
|
|||||||
|
|
||||||
function handleClose() {
|
function handleClose() {
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
if (fileUploadRef.value?.refreshList) {
|
if (fileUploadRef.value?.needRelaodData) {
|
||||||
emit('close');
|
emit('close');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user