This commit is contained in:
qsh
2024-06-05 17:08:27 +08:00
parent a557255b4a
commit 94943df4f9
30 changed files with 1069 additions and 846 deletions

View File

@@ -39,7 +39,7 @@
<!-- 分页 -->
<Pagination
v-model:limit="pageSize"
v-model:page="currentPage"
v-model:page="pageNo"
:total="tableObject.total"
@pagination="getList"
/>
@@ -61,7 +61,7 @@ const emit = defineEmits(['update:tableObject', 'getList', 'getCheckedColumns'])
const route = useRoute()
const { id: userId } = useUserStore().user //取用户ID
const currentPage = ref(props.tableObject?.currentPage || 1)
const pageNo = ref(props.tableObject?.pageNo || 1)
const pageSize = ref(props.tableObject?.pageSize || 20)
@@ -74,7 +74,7 @@ const checkedColumns = ref([])
// 调用获取数据的接口,分页时需要使用
function getList({ page, limit }) {
emit('update:tableObject', { ...props.tableObject, currentPage: page, pageSize: limit })
emit('update:tableObject', { ...props.tableObject, pageNo: page, pageSize: limit })
nextTick(() => {
emit('getList')
})

View File

@@ -34,20 +34,14 @@
</div>
</template>
<script setup lang="ts" name="UploadFile">
import { PropType } from 'vue'
import { propTypes } from '@/utils/propTypes'
import { getAccessToken, getTenantId } from '@/utils/auth'
import { getAccessToken, getTenantId, getAppId } from '@/utils/auth'
import type { UploadInstance, UploadUserFile, UploadProps, UploadRawFile } from 'element-plus'
const message = useMessage() // 消息弹窗
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
modelValue: {
type: Array as PropType<UploadUserFile[]>,
required: true
},
modelValue: propTypes.oneOfType<string | string[]>([String, Array<String>]).isRequired,
title: propTypes.string.def('文件上传'),
updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL),
fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf']), // 文件类型, 例如['png', 'jpg', 'jpeg']
@@ -66,8 +60,10 @@ const fileList = ref<UploadUserFile[]>(props.modelValue)
const uploadNumber = ref<number>(0)
const uploadHeaders = ref({
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId()
'tenant-id': getTenantId(),
'instance-id': getAppId()
})
// 文件上传之前判断
const beforeUpload: UploadProps['beforeUpload'] = (file: UploadRawFile) => {
if (fileList.value.length >= props.limit) {

View File

@@ -55,7 +55,7 @@ import type { UploadProps } from 'element-plus'
import { generateUUID } from '@/utils'
import { propTypes } from '@/utils/propTypes'
import { getAccessToken, getTenantId } from '@/utils/auth'
import { getAccessToken, getTenantId, getAppId } from '@/utils/auth'
type FileTypes =
| 'image/apng'
@@ -96,7 +96,8 @@ const deleteImg = () => {
const uploadHeaders = ref({
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId()
'tenant-id': getTenantId(),
'instance-id': getAppId()
})
const editImg = () => {