Browse Source

上传文件参数

master
zhangli 1 year ago
parent
commit
f637abe6b2
  1. 8
      src/components/Annex/src/Annex.vue
  2. 20
      src/components/ChangeRecord/src/ChangeRecord.vue
  3. 6
      src/components/Detail/src/Detail.vue
  4. 3
      src/components/UploadFile/src/UploadFile.vue
  5. 3
      src/components/UploadFile/src/UploadImg.vue
  6. 3
      src/components/UploadFile/src/UploadImgs.vue
  7. 14
      src/store/modules/user.ts
  8. 7
      src/views/system/oauth2/client/ClientForm.vue

8
src/components/Annex/src/Annex.vue

@ -3,7 +3,7 @@
<div class="annex"> <div class="annex">
<div class="title flex items-center"> <div class="title flex items-center">
<div class="title-txt">附件</div> <div class="title-txt">附件</div>
<UploadFile :isShowFile="false" :isShowTip="false" title="添加附件"/> <UploadFile :isShowFile="false" :isShowTip="false" title="添加附件" :upData="upData"/>
</div> </div>
<div class="list"> <div class="list">
<div class="item flex items-start" v-for="(item, index) in data.annexList" :key="index"> <div class="item flex items-start" v-for="(item, index) in data.annexList" :key="index">
@ -36,7 +36,11 @@ const props = defineProps({
data: { data: {
type: Object, type: Object,
required: true required: true
} },
upData: {
type: Object,
required: true
},
}) })
// emit // emit
const emit = defineEmits(['handleImport','deleteAnnexSuccess']) const emit = defineEmits(['handleImport','deleteAnnexSuccess'])

20
src/components/ChangeRecord/src/ChangeRecord.vue

@ -6,7 +6,7 @@
</div> </div>
<div class="list"> <div class="list">
<el-steps direction="vertical" class="mt-16px" :space="90"> <el-steps direction="vertical" class="mt-16px" :space="90">
<el-step v-for="(item, index) in data.changeRecordList" :key="index"> <el-step v-for="(item, index) in changeRecordData.changeRecordList" :key="index">
<template #icon> <template #icon>
<slot> <slot>
<Icon color="#9e9e9e" <Icon color="#9e9e9e"
@ -16,21 +16,24 @@
</template> </template>
<template #title> <template #title>
<slot> <slot>
<span class="color-#9e9e9e font-size-16px time">{{ item.time }}</span> <span class="color-#9e9e9e font-size-16px time">{{ formatDate(item.createTime) }}</span>
</slot> </slot>
</template> </template>
<template #description> <template #description>
<slot> <slot>
<div class="dic color-#303133" v-if="item.type == 1"> <div class="dic color-#303133" v-if="item.type == 1">
{{ item.name }} <span>创建了</span> 记录 {{ item.nickname }} {{ item.content }}
<!-- {{ item.nickname }} <span>创建了</span> 记录 -->
</div> </div>
<div class="dic color-#303133" v-else-if="item.type == 2"> <div class="dic color-#303133" v-else-if="item.type == 2">
{{ item.name }} <span>修改了</span> 状态 {{ item.nickname }} {{ item.content }}
<!-- {{ item.nickname }} <span>修改了</span> 状态 -->
</div> </div>
<div class="dic color-#303133" v-else-if="item.type == 3"> <div class="dic color-#303133" v-else-if="item.type == 3">
{{ item.name }} <span>添加了</span> 附件 {{ item.nickname }} {{ item.content }}
<!-- <span>添加了</span> 附件 -->
</div> </div>
<div class="tips" v-if="item.type == 2"> <!-- <div class="tips" v-if="item.type == 2">
<span class="color-#f56c6c" style="text-decoration:line-through">原值</span>><span <span class="color-#f56c6c" style="text-decoration:line-through">原值</span>><span
class="color-#67c23a">新值</span> class="color-#67c23a">新值</span>
</div> </div>
@ -39,7 +42,7 @@
<Icon color="#70b6ff" icon="ep:document" size="20" style="display:bloc"/> <Icon color="#70b6ff" icon="ep:document" size="20" style="display:bloc"/>
<div class="file-text" type="primary">{{cur.name}}</div> <div class="file-text" type="primary">{{cur.name}}</div>
</div> </div>
</div> </div> -->
</slot> </slot>
</template> </template>
@ -51,12 +54,13 @@
<script lang="ts" setup> <script lang="ts" setup>
import download from '@/utils/download' import download from '@/utils/download'
import { formatDate } from '@/utils/formatTime'
defineComponent({ defineComponent({
name: 'ChangeRecord' name: 'ChangeRecord'
}) })
// //
const props = defineProps({ const props = defineProps({
data: { changeRecordData: {
type: Object, type: Object,
required: true required: true
} }

6
src/components/Detail/src/Detail.vue

@ -17,12 +17,12 @@
</ContentWrap> </ContentWrap>
<ContentWrap class="w-[27%] ml-16px"> <ContentWrap class="w-[27%] ml-16px">
<!-- 附件组件 --> <!-- 附件组件 -->
<Annex :data="annexData" @handleImport="handleImport" @deleteAnnex="deleteAnnexSuccess" /> <Annex :data="annexData" @handleImport="handleImport" @deleteAnnex="deleteAnnexSuccess" :upData="remarksData.data"/>
<!-- 备注组件 --> <!-- 备注组件 -->
<Remarks :remarksData="remarksData" class="mt-20px" <Remarks :remarksData="remarksData" class="mt-20px"
@remarksSubmitScuess="remarksSubmitScuess" /> @remarksSubmitScuess="remarksSubmitScuess" />
<!-- 变更记录组件 --> <!-- 变更记录组件 -->
<ChangeRecord :data="changeRecordData" class="mt-20px" /> <ChangeRecord :changeRecordData="changeRecordData" class="mt-20px" />
</ContentWrap> </ContentWrap>
</div> </div>
<ContentWrap v-else> <ContentWrap v-else>
@ -205,6 +205,8 @@ const remarksSubmitScuess = async (remark) => {
const getChangeRecordList = async () => { const getChangeRecordList = async () => {
// remarksData.data.tableId = '1679654720693248010' // remarksData.data.tableId = '1679654720693248010'
changeRecordData.changeRecordList = await DetailApi.getChangeRecordPage(remarksData.data) changeRecordData.changeRecordList = await DetailApi.getChangeRecordPage(remarksData.data)
console.log(changeRecordData.changeRecordList);
} }
</script> </script>
<style lang="scss"> <style lang="scss">

3
src/components/UploadFile/src/UploadFile.vue

@ -8,7 +8,7 @@
v-model:file-list="fileList" v-model:file-list="fileList"
:show-file-list="true" :show-file-list="true"
:auto-upload="autoUpload" :auto-upload="autoUpload"
:action="updateUrl" :action="updateUrl+'?tableId='+upData?.tableId+'&tableName='+ upData?.tableName"
:headers="uploadHeaders" :headers="uploadHeaders"
:limit="props.limit" :limit="props.limit"
:drag="drag" :drag="drag"
@ -55,6 +55,7 @@ const props = defineProps({
}, },
title: propTypes.string.def('文件上传'), title: propTypes.string.def('文件上传'),
updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL), updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL),
upData: propTypes.object.def(),
fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf']), // , ['png', 'jpg', 'jpeg'] fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf']), // , ['png', 'jpg', 'jpeg']
fileSize: propTypes.number.def(5), // (MB) fileSize: propTypes.number.def(5), // (MB)
limit: propTypes.number.def(5), // limit: propTypes.number.def(5), //

3
src/components/UploadFile/src/UploadImg.vue

@ -1,7 +1,7 @@
<template> <template>
<div class="upload-box"> <div class="upload-box">
<el-upload <el-upload
:action="updateUrl" :action="updateUrl + '?tableId=' + upData?.tableId + '&tableName=' + upData?.tableName"
:id="uuid" :id="uuid"
:class="['upload', drag ? 'no-border' : '']" :class="['upload', drag ? 'no-border' : '']"
:multiple="false" :multiple="false"
@ -75,6 +75,7 @@ type FileTypes =
const props = defineProps({ const props = defineProps({
modelValue: propTypes.string.def(''), modelValue: propTypes.string.def(''),
updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL), updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL),
upData: propTypes.object.def(),
drag: propTypes.bool.def(true), // ==> true drag: propTypes.bool.def(true), // ==> true
disabled: propTypes.bool.def(false), // ==> false disabled: propTypes.bool.def(false), // ==> false
fileSize: propTypes.number.def(5), // ==> 5M fileSize: propTypes.number.def(5), // ==> 5M

3
src/components/UploadFile/src/UploadImgs.vue

@ -3,7 +3,7 @@
<el-upload <el-upload
v-model:file-list="fileList" v-model:file-list="fileList"
:accept="fileType.join(',')" :accept="fileType.join(',')"
:action="updateUrl" :action="updateUrl + '?tableId=' + upData?.tableId + '&tableName=' + upData?.tableName"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:class="['upload', drag ? 'no-border' : '']" :class="['upload', drag ? 'no-border' : '']"
:drag="drag" :drag="drag"
@ -75,6 +75,7 @@ const props = defineProps({
required: true required: true
}, },
updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL), updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL),
upData: propTypes.object.def(),
drag: propTypes.bool.def(true), // ==> true drag: propTypes.bool.def(true), // ==> true
disabled: propTypes.bool.def(false), // ==> false disabled: propTypes.bool.def(false), // ==> false
limit: propTypes.number.def(5), // ==> 5 limit: propTypes.number.def(5), // ==> 5

14
src/store/modules/user.ts

@ -3,6 +3,7 @@ import { defineStore } from 'pinia'
import { getAccessToken, removeToken } from '@/utils/auth' import { getAccessToken, removeToken } from '@/utils/auth'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { getInfo, loginOut } from '@/api/login' import { getInfo, loginOut } from '@/api/login'
import { getUserProfile } from '@/api/system/user/profile'
const { wsCache } = useCache() const { wsCache } = useCache()
@ -16,6 +17,7 @@ interface UserInfoVO {
roles: string[] roles: string[]
isSetUser: boolean isSetUser: boolean
user: UserVO user: UserVO
userSelfInfo:object
} }
export const useUserStore = defineStore('admin-user', { export const useUserStore = defineStore('admin-user', {
@ -27,7 +29,8 @@ export const useUserStore = defineStore('admin-user', {
id: 0, id: 0,
avatar: '', avatar: '',
nickname: '' nickname: ''
} },
userSelfInfo:{}
}), }),
getters: { getters: {
getPermissions(): string[] { getPermissions(): string[] {
@ -41,6 +44,9 @@ export const useUserStore = defineStore('admin-user', {
}, },
getUser(): UserVO { getUser(): UserVO {
return this.user return this.user
},
getUserSelfInfo(): UserVO {
return this.userSelfInfo
} }
}, },
actions: { actions: {
@ -53,6 +59,12 @@ export const useUserStore = defineStore('admin-user', {
if (!userInfo) { if (!userInfo) {
userInfo = await getInfo() userInfo = await getInfo()
} }
this.userSelfInfo = await getUserProfile()
// userInfo = await getInfo()
console.log(4);
console.log(this.userSelfInfo);
console.log(4);
this.permissions = userInfo.permissions this.permissions = userInfo.permissions
this.roles = userInfo.roles this.roles = userInfo.roles
this.user = userInfo.user this.user = userInfo.user

7
src/views/system/oauth2/client/ClientForm.vue

@ -17,7 +17,7 @@
<el-input v-model="formData.name" placeholder="请输入应用名" /> <el-input v-model="formData.name" placeholder="请输入应用名" />
</el-form-item> </el-form-item>
<el-form-item label="应用图标"> <el-form-item label="应用图标">
<UploadImg v-model="formData.logo" :limit="1" /> <UploadImg v-model="formData.logo" :limit="1" :upData="upData"/>
</el-form-item> </el-form-item>
<el-form-item label="应用描述"> <el-form-item label="应用描述">
<el-input v-model="formData.description" placeholder="请输入应用名" type="textarea" /> <el-input v-model="formData.description" placeholder="请输入应用名" type="textarea" />
@ -193,6 +193,7 @@ const formRules = reactive({
const formRef = ref() // Ref const formRef = ref() // Ref
/** 打开弹窗 */ /** 打开弹窗 */
const upData = ref()
const open = async (type: string, id?: number) => { const open = async (type: string, id?: number) => {
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
@ -201,6 +202,10 @@ const open = async (type: string, id?: number) => {
// //
if (id) { if (id) {
formLoading.value = true formLoading.value = true
upData.value = {
tableId : id,
tableName:'systemOauth2Client'
}
try { try {
formData.value = await ClientApi.getOAuth2Client(id) formData.value = await ClientApi.getOAuth2Client(id)
} finally { } finally {

Loading…
Cancel
Save