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

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

@ -6,7 +6,7 @@
</div>
<div class="list">
<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>
<slot>
<Icon color="#9e9e9e"
@ -16,21 +16,24 @@
</template>
<template #title>
<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>
</template>
<template #description>
<slot>
<div class="dic color-#303133" v-if="item.type == 1">
{{ item.name }} <span>创建了</span> 记录
{{ item.nickname }} {{ item.content }}
<!-- {{ item.nickname }} <span>创建了</span> 记录 -->
</div>
<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 class="dic color-#303133" v-else-if="item.type == 3">
{{ item.name }} <span>添加了</span> 附件
{{ item.nickname }} {{ item.content }}
<!-- <span>添加了</span> 附件 -->
</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
class="color-#67c23a">新值</span>
</div>
@ -39,7 +42,7 @@
<Icon color="#70b6ff" icon="ep:document" size="20" style="display:bloc"/>
<div class="file-text" type="primary">{{cur.name}}</div>
</div>
</div>
</div> -->
</slot>
</template>
@ -51,12 +54,13 @@
<script lang="ts" setup>
import download from '@/utils/download'
import { formatDate } from '@/utils/formatTime'
defineComponent({
name: 'ChangeRecord'
})
//
const props = defineProps({
data: {
changeRecordData: {
type: Object,
required: true
}

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

@ -17,12 +17,12 @@
</ContentWrap>
<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"
@remarksSubmitScuess="remarksSubmitScuess" />
<!-- 变更记录组件 -->
<ChangeRecord :data="changeRecordData" class="mt-20px" />
<ChangeRecord :changeRecordData="changeRecordData" class="mt-20px" />
</ContentWrap>
</div>
<ContentWrap v-else>
@ -205,6 +205,8 @@ const remarksSubmitScuess = async (remark) => {
const getChangeRecordList = async () => {
// remarksData.data.tableId = '1679654720693248010'
changeRecordData.changeRecordList = await DetailApi.getChangeRecordPage(remarksData.data)
console.log(changeRecordData.changeRecordList);
}
</script>
<style lang="scss">

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

@ -8,7 +8,7 @@
v-model:file-list="fileList"
:show-file-list="true"
:auto-upload="autoUpload"
:action="updateUrl"
:action="updateUrl+'?tableId='+upData?.tableId+'&tableName='+ upData?.tableName"
:headers="uploadHeaders"
:limit="props.limit"
:drag="drag"
@ -55,6 +55,7 @@ const props = defineProps({
},
title: propTypes.string.def('文件上传'),
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']
fileSize: propTypes.number.def(5), // (MB)
limit: propTypes.number.def(5), //

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

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

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

@ -3,7 +3,7 @@
<el-upload
v-model:file-list="fileList"
:accept="fileType.join(',')"
:action="updateUrl"
:action="updateUrl + '?tableId=' + upData?.tableId + '&tableName=' + upData?.tableName"
:before-upload="beforeUpload"
:class="['upload', drag ? 'no-border' : '']"
:drag="drag"
@ -75,6 +75,7 @@ const props = defineProps({
required: true
},
updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL),
upData: propTypes.object.def(),
drag: propTypes.bool.def(true), // ==> true
disabled: propTypes.bool.def(false), // ==> false
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 { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { getInfo, loginOut } from '@/api/login'
import { getUserProfile } from '@/api/system/user/profile'
const { wsCache } = useCache()
@ -16,6 +17,7 @@ interface UserInfoVO {
roles: string[]
isSetUser: boolean
user: UserVO
userSelfInfo:object
}
export const useUserStore = defineStore('admin-user', {
@ -27,7 +29,8 @@ export const useUserStore = defineStore('admin-user', {
id: 0,
avatar: '',
nickname: ''
}
},
userSelfInfo:{}
}),
getters: {
getPermissions(): string[] {
@ -41,6 +44,9 @@ export const useUserStore = defineStore('admin-user', {
},
getUser(): UserVO {
return this.user
},
getUserSelfInfo(): UserVO {
return this.userSelfInfo
}
},
actions: {
@ -53,6 +59,12 @@ export const useUserStore = defineStore('admin-user', {
if (!userInfo) {
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.roles = userInfo.roles
this.user = userInfo.user

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

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

Loading…
Cancel
Save