vue2-client 1.18.62 → 1.18.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/base-client/components/common/HIS/HTab/HTab.vue +1 -0
- package/src/base-client/components/his/XTitle/XTitle.vue +10 -0
- package/src/pages/userInfoDetailManage/uploadFilesHistory/ImagePreview.vue +58 -4
- package/src/pages/userInfoDetailManage/uploadFilesHistory/index.vue +212 -166
package/package.json
CHANGED
|
@@ -60,6 +60,7 @@ const localMap = {
|
|
|
60
60
|
'x-select': () => import('@vue2-client/base-client/components/his/XSelect/XSelect.vue'),
|
|
61
61
|
'x-radio': () => import('@vue2-client/base-client/components/his/XRadio/XRadio.vue'),
|
|
62
62
|
'x-buttons': () => import('@vue2-client/base-client/components/common/XButtons/XButtons.vue'),
|
|
63
|
+
'x-time-select': () => import('@vue2-client/base-client/components/his/XTimeSelect/XTimeSelect.vue'),
|
|
63
64
|
'h-buttons': () => import('@vue2-client/base-client/components/common/HIS/HButtons/HButtons.vue')
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -80,6 +80,7 @@ const wrapperClassObject = computed(() => {
|
|
|
80
80
|
'littlefont',
|
|
81
81
|
'dot',
|
|
82
82
|
'nodot',
|
|
83
|
+
'notitle',
|
|
83
84
|
'yizhu-title',
|
|
84
85
|
'left-title',
|
|
85
86
|
'line-style', // 分割线样式
|
|
@@ -199,6 +200,15 @@ onMounted(() => {
|
|
|
199
200
|
}
|
|
200
201
|
}
|
|
201
202
|
|
|
203
|
+
.x-title-notitle {
|
|
204
|
+
&.x-title-container,
|
|
205
|
+
.x-title-container {
|
|
206
|
+
:deep(.x-title) {
|
|
207
|
+
display: none;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
202
212
|
.title-icon {
|
|
203
213
|
font-size: 16px;
|
|
204
214
|
flex-shrink: 0;
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
<div v-if="visible" class="preview-mask">
|
|
3
3
|
<div class="preview-container">
|
|
4
4
|
<img
|
|
5
|
-
:src="
|
|
5
|
+
:src="imageSrc"
|
|
6
6
|
:style="imgStyle"
|
|
7
7
|
class="preview-img"
|
|
8
8
|
@mousedown="startDrag"
|
|
9
|
+
@error="handleImageError"
|
|
9
10
|
draggable="false"
|
|
10
11
|
/>
|
|
11
12
|
<div class="preview-actions">
|
|
@@ -20,22 +21,43 @@
|
|
|
20
21
|
</template>
|
|
21
22
|
|
|
22
23
|
<script setup>
|
|
23
|
-
import { ref, computed } from 'vue'
|
|
24
|
+
import { ref, computed, watch } from 'vue'
|
|
24
25
|
|
|
25
|
-
defineProps({
|
|
26
|
+
const props = defineProps({
|
|
26
27
|
src: {
|
|
27
28
|
type: String,
|
|
28
29
|
required: true
|
|
29
30
|
},
|
|
31
|
+
originalPath: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: ''
|
|
34
|
+
},
|
|
30
35
|
visible: Boolean
|
|
31
36
|
})
|
|
32
|
-
const emits = defineEmits(['close'])
|
|
37
|
+
const emits = defineEmits(['close', 'src-updated'])
|
|
33
38
|
|
|
34
39
|
const scale = ref(1)
|
|
35
40
|
const rotate = ref(0)
|
|
36
41
|
const offset = ref({ x: 0, y: 0 })
|
|
37
42
|
const dragging = ref(false)
|
|
38
43
|
const dragStart = ref({ x: 0, y: 0 })
|
|
44
|
+
const imageSrc = ref(props.src)
|
|
45
|
+
const isFixed = ref(false) // 标记是否已修复过路径
|
|
46
|
+
|
|
47
|
+
// 当src变化时,更新imageSrc(如果路径没有被修复过)
|
|
48
|
+
watch(() => props.src, (newSrc) => {
|
|
49
|
+
if (!isFixed.value) {
|
|
50
|
+
imageSrc.value = newSrc
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
// 当visible变化时,如果是打开状态,重置imageSrc和修复标记
|
|
55
|
+
watch(() => props.visible, (newVisible) => {
|
|
56
|
+
if (newVisible) {
|
|
57
|
+
imageSrc.value = props.src
|
|
58
|
+
isFixed.value = false
|
|
59
|
+
}
|
|
60
|
+
})
|
|
39
61
|
|
|
40
62
|
const imgStyle = computed(() => ({
|
|
41
63
|
transform: `scale(${scale.value}) rotate(${rotate.value}deg) translate(${offset.value.x}px, ${offset.value.y}px)`,
|
|
@@ -69,6 +91,38 @@ const stopDrag = () => {
|
|
|
69
91
|
document.removeEventListener('mousemove', onDrag)
|
|
70
92
|
document.removeEventListener('mouseup', stopDrag)
|
|
71
93
|
}
|
|
94
|
+
|
|
95
|
+
const handleImageError = (event) => {
|
|
96
|
+
if (!event.target || !props.originalPath) return
|
|
97
|
+
|
|
98
|
+
const currentSrc = imageSrc.value || ''
|
|
99
|
+
console.log('ImagePreview error - currentSrc:', currentSrc, 'originalPath:', props.originalPath)
|
|
100
|
+
|
|
101
|
+
if (currentSrc.includes('/files/')) {
|
|
102
|
+
console.log('ImagePreview: 已经是新格式,不再处理')
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
if (!currentSrc.includes('/rs/image/file/')) {
|
|
106
|
+
console.log('ImagePreview: 不是旧格式,不再处理')
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const baseUrl = `${window.location.protocol}//${window.location.host}`
|
|
111
|
+
|
|
112
|
+
// 如果是本地文件路径,尝试新格式(保留目录结构)
|
|
113
|
+
if (props.originalPath.match(/^[A-Za-z]:[/\\]/)) {
|
|
114
|
+
const normalizedPath = props.originalPath.replace(/\\/g, '/')
|
|
115
|
+
const filesIndex = normalizedPath.toLowerCase().indexOf('/files/')
|
|
116
|
+
if (filesIndex !== -1) {
|
|
117
|
+
const relativePath = normalizedPath.substring(filesIndex + 1)
|
|
118
|
+
const newUrl = `${baseUrl}/${relativePath}`
|
|
119
|
+
console.log('ImagePreview: 切换到新格式URL:', newUrl)
|
|
120
|
+
imageSrc.value = newUrl
|
|
121
|
+
isFixed.value = true // 标记已修复
|
|
122
|
+
emits('src-updated', newUrl) // 通知父组件更新路径
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
72
126
|
</script>
|
|
73
127
|
|
|
74
128
|
<style scoped>
|
|
@@ -1,166 +1,212 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="filter-bar">
|
|
4
|
-
<a-date-picker v-model="upload_date" placeholder="上传日期" @change="selfSearch" />
|
|
5
|
-
<a-select
|
|
6
|
-
style="width: 200px"
|
|
7
|
-
v-model="fusetype"
|
|
8
|
-
:options="fusetypes"
|
|
9
|
-
placeholder="分类"
|
|
10
|
-
@change="selfSearch"
|
|
11
|
-
allow-clear
|
|
12
|
-
/>
|
|
13
|
-
<a-button type="primary" @click="selfSearch">查询</a-button>
|
|
14
|
-
</div>
|
|
15
|
-
<a-list bordered>
|
|
16
|
-
<a-list-item v-for="item in files" :key="item.days">
|
|
17
|
-
<div class="file-group">
|
|
18
|
-
<h4>{{ item.days }}</h4>
|
|
19
|
-
<div class="file-items">
|
|
20
|
-
<div v-for="file in item.arrays" :key="file.id" class="file-card">
|
|
21
|
-
<img
|
|
22
|
-
:src="getFileUrl(file.f_downloadpath)"
|
|
23
|
-
class="file-image"
|
|
24
|
-
v-if="file.f_filetype.includes('jpg') || file.f_filetype.includes('png')"
|
|
25
|
-
@click="openPreview(file.f_downloadpath)"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<p
|
|
30
|
-
<p
|
|
31
|
-
<p
|
|
32
|
-
<
|
|
33
|
-
<a
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
import {
|
|
46
|
-
import
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.fusetypes
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
console.log('
|
|
113
|
-
return
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="filter-bar">
|
|
4
|
+
<a-date-picker v-model="upload_date" placeholder="上传日期" @change="selfSearch" />
|
|
5
|
+
<a-select
|
|
6
|
+
style="width: 200px"
|
|
7
|
+
v-model="fusetype"
|
|
8
|
+
:options="fusetypes"
|
|
9
|
+
placeholder="分类"
|
|
10
|
+
@change="selfSearch"
|
|
11
|
+
allow-clear
|
|
12
|
+
/>
|
|
13
|
+
<a-button type="primary" @click="selfSearch">查询</a-button>
|
|
14
|
+
</div>
|
|
15
|
+
<a-list bordered>
|
|
16
|
+
<a-list-item v-for="item in files" :key="item.days">
|
|
17
|
+
<div class="file-group">
|
|
18
|
+
<h4>{{ item.days }}</h4>
|
|
19
|
+
<div class="file-items">
|
|
20
|
+
<div v-for="file in item.arrays" :key="file.id" class="file-card">
|
|
21
|
+
<img
|
|
22
|
+
:src="getFileUrl(file.f_downloadpath)"
|
|
23
|
+
class="file-image"
|
|
24
|
+
v-if="file.f_filetype.includes('jpg') || file.f_filetype.includes('png')"
|
|
25
|
+
@click="openPreview(file.f_downloadpath)"
|
|
26
|
+
@error="(e) => handleImageError(e, file.f_downloadpath)"
|
|
27
|
+
style="cursor: pointer"
|
|
28
|
+
/>
|
|
29
|
+
<p>上传时间: {{ file.f_uploaddate }}</p>
|
|
30
|
+
<p>操作员: {{ file.f_username }}</p>
|
|
31
|
+
<p>分类: {{ file.fusetype }}</p>
|
|
32
|
+
<p>说明: {{ file.fremarks }}</p>
|
|
33
|
+
<a :href="getFileUrl(file.f_downloadpath)" target="_blank">预览</a>
|
|
34
|
+
<a-button v-if="isDelete === '1'" @click="delet(file.id)">删除</a-button>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</a-list-item>
|
|
39
|
+
</a-list>
|
|
40
|
+
<ImagePreview :src="previewImg" :original-path="previewOriginalPath" :visible="previewVisible" @close="previewVisible = false" @src-updated="handleSrcUpdated" />
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
import { post } from '@vue2-client/services/api'
|
|
46
|
+
import { del } from '@vue2-client/services/api/restTools'
|
|
47
|
+
import ImagePreview from './ImagePreview.vue'
|
|
48
|
+
export default {
|
|
49
|
+
props: {
|
|
50
|
+
currUserInfo: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => undefined
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
components: { ImagePreview },
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
upload_date: null,
|
|
59
|
+
fusetype: null,
|
|
60
|
+
files: [],
|
|
61
|
+
fusetypes: [],
|
|
62
|
+
isDelete: '0',
|
|
63
|
+
previewVisible: false,
|
|
64
|
+
previewImg: '',
|
|
65
|
+
previewOriginalPath: ''
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
methods: {
|
|
69
|
+
async getfusetypes() {
|
|
70
|
+
this.fusetypes = [{ label: '全部', value: '' }]
|
|
71
|
+
const res = await post('/api/af-revenue/logic/getFileUseType', {})
|
|
72
|
+
this.fusetypes.push(...res.map(item => ({ label: item.fusetype, value: item.fusetype })))
|
|
73
|
+
},
|
|
74
|
+
async getFiles() {
|
|
75
|
+
if (!this.currUserInfo) return
|
|
76
|
+
this.files = []
|
|
77
|
+
let condition = `f_blobid = '${this.currUserInfo.f_userinfo_id}'`
|
|
78
|
+
if (this.upload_date) {
|
|
79
|
+
condition += ` and CONVERT(VARCHAR(100), f_uploaddate, 23) = '${this.upload_date}'`
|
|
80
|
+
}
|
|
81
|
+
if (this.fusetype) {
|
|
82
|
+
condition += ` and fusetype = '${this.fusetype}'`
|
|
83
|
+
}
|
|
84
|
+
const res = await post('/api/af-revenue/logic/getAllFiles', { data: { condition } })
|
|
85
|
+
this.files = res.days.map(day => ({
|
|
86
|
+
days: day.uploadday,
|
|
87
|
+
arrays: res.array.filter(file => file.uploadday === day.uploadday)
|
|
88
|
+
}))
|
|
89
|
+
},
|
|
90
|
+
async delet(fileId) {
|
|
91
|
+
await del('api/af-revenue/entity/save/t_files', { id: fileId }, { resolveMsg: '删除成功', rejectMsg: '删除失败' })
|
|
92
|
+
this.getFiles()
|
|
93
|
+
},
|
|
94
|
+
selfSearch() {
|
|
95
|
+
this.getFiles()
|
|
96
|
+
},
|
|
97
|
+
openPreview(src) {
|
|
98
|
+
this.previewOriginalPath = src
|
|
99
|
+
this.previewImg = this.getFileUrl(src)
|
|
100
|
+
this.previewVisible = true
|
|
101
|
+
},
|
|
102
|
+
handleImageError(event, path) {
|
|
103
|
+
if (!path || !event.target) return
|
|
104
|
+
const currentSrc = event.target.src || ''
|
|
105
|
+
console.log('列表图片error - currentSrc:', currentSrc, 'path:', path)
|
|
106
|
+
|
|
107
|
+
if (currentSrc.includes('/files/')) {
|
|
108
|
+
console.log('列表图片: 已经是新格式,不再处理')
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
if (!currentSrc.includes('/rs/image/file/')) {
|
|
112
|
+
console.log('列表图片: 不是旧格式,不再处理')
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
const baseUrl = `${window.location.protocol}//${window.location.host}`
|
|
116
|
+
// 如果是本地文件路径,尝试新格式(保留目录结构)
|
|
117
|
+
if (path.match(/^[A-Za-z]:[/\\]/)) {
|
|
118
|
+
const normalizedPath = path.replace(/\\/g, '/')
|
|
119
|
+
const filesIndex = normalizedPath.toLowerCase().indexOf('/files/')
|
|
120
|
+
if (filesIndex !== -1) {
|
|
121
|
+
const relativePath = normalizedPath.substring(filesIndex + 1)
|
|
122
|
+
const newUrl = `${baseUrl}/${relativePath}`
|
|
123
|
+
console.log('列表图片: 切换到新格式URL:', newUrl)
|
|
124
|
+
event.target.src = newUrl
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
handleSrcUpdated(newUrl) {
|
|
129
|
+
console.log('ImagePreview通知更新路径:', newUrl)
|
|
130
|
+
this.previewImg = newUrl
|
|
131
|
+
},
|
|
132
|
+
getFileUrl(path) {
|
|
133
|
+
if (!path) return ''
|
|
134
|
+
console.log('原始路径:', path)
|
|
135
|
+
// 获取当前域名和端口
|
|
136
|
+
const baseUrl = `${window.location.protocol}//${window.location.host}`
|
|
137
|
+
// 如果是本地文件路径,优先使用新格式(/files/...保留目录结构)
|
|
138
|
+
if (path.match(/^[A-Za-z]:[/\\]/)) {
|
|
139
|
+
const normalizedPath = path.replace(/\\/g, '/')
|
|
140
|
+
const filesIndex = normalizedPath.toLowerCase().indexOf('/files/')
|
|
141
|
+
if (filesIndex !== -1) {
|
|
142
|
+
// 找到 /files/ 位置,使用新格式(保留目录结构)
|
|
143
|
+
const relativePath = normalizedPath.substring(filesIndex + 1)
|
|
144
|
+
const newUrl = `${baseUrl}/${relativePath}`
|
|
145
|
+
console.log('使用新格式路径:', newUrl)
|
|
146
|
+
return newUrl
|
|
147
|
+
} else {
|
|
148
|
+
// 如果路径中没有 /files/,使用旧格式
|
|
149
|
+
const fileName = normalizedPath.split('/').pop()
|
|
150
|
+
const newUrl = `${baseUrl}/rs/image/file/${encodeURIComponent(fileName)}`
|
|
151
|
+
console.log('使用旧格式路径:', newUrl)
|
|
152
|
+
return newUrl
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// 如果已经是HTTP路径,直接返回
|
|
156
|
+
if (path.startsWith('http')) {
|
|
157
|
+
console.log('HTTP路径,直接返回:', path)
|
|
158
|
+
return path
|
|
159
|
+
}
|
|
160
|
+
// 如果是相对路径,添加域名前缀
|
|
161
|
+
if (path.startsWith('/resource/')) {
|
|
162
|
+
const newUrl = `${baseUrl}${path}`
|
|
163
|
+
console.log('相对路径转换:', newUrl)
|
|
164
|
+
return newUrl
|
|
165
|
+
}
|
|
166
|
+
// 如果已经是 /files/ 开头的相对路径,直接添加域名前缀
|
|
167
|
+
if (path.startsWith('/files/')) {
|
|
168
|
+
const newUrl = `${baseUrl}${path}`
|
|
169
|
+
console.log('files相对路径转换:', newUrl)
|
|
170
|
+
return newUrl
|
|
171
|
+
}
|
|
172
|
+
console.log('其他路径,直接返回:', path)
|
|
173
|
+
return path
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
mounted() {
|
|
177
|
+
if (this.$login.r.includes('上传附件删除')) {
|
|
178
|
+
this.isDelete = '1'
|
|
179
|
+
}
|
|
180
|
+
this.getFiles()
|
|
181
|
+
this.getfusetypes()
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
</script>
|
|
185
|
+
|
|
186
|
+
<style scoped>
|
|
187
|
+
.filter-bar {
|
|
188
|
+
display: flex;
|
|
189
|
+
gap: 10px;
|
|
190
|
+
margin-bottom: 15px;
|
|
191
|
+
}
|
|
192
|
+
.file-group {
|
|
193
|
+
margin-bottom: 15px;
|
|
194
|
+
}
|
|
195
|
+
.file-items {
|
|
196
|
+
display: flex;
|
|
197
|
+
flex-wrap: wrap;
|
|
198
|
+
gap: 10px;
|
|
199
|
+
}
|
|
200
|
+
.file-card {
|
|
201
|
+
border: 1px solid #ddd;
|
|
202
|
+
padding: 10px;
|
|
203
|
+
border-radius: 5px;
|
|
204
|
+
width: 200px;
|
|
205
|
+
}
|
|
206
|
+
.file-image {
|
|
207
|
+
width: 100%; /* 让图片填充整个容器 */
|
|
208
|
+
height: 150px; /* 调整高度 */
|
|
209
|
+
object-fit: cover; /* 保持图片比例,填充整个区域 */
|
|
210
|
+
border-radius: 5px; /* 圆角边框 */
|
|
211
|
+
}
|
|
212
|
+
</style>
|