feat: 新增意见反馈功能。
This commit is contained in:
@@ -50,6 +50,28 @@
|
||||
<el-table-column label="活动时长" align="center" prop="exerciseTimeStr" width="150"> </el-table-column>
|
||||
<el-table-column label="成员" align="center" prop="partner" />
|
||||
<el-table-column label="总费用(元)" width="120" align="center" prop="totalCost" />
|
||||
<el-table-column label="附件" align="center" prop="attachment" width="120">
|
||||
<template #default="scope">
|
||||
<el-popover v-if="parseAttachments(scope.row.attachment).length" placement="left" width="280" trigger="click">
|
||||
<template #reference>
|
||||
<el-button link type="primary">查看{{ parseAttachments(scope.row.attachment).length }}个</el-button>
|
||||
</template>
|
||||
<div class="attachment-popover-list">
|
||||
<el-link
|
||||
v-for="(file, index) in parseAttachments(scope.row.attachment)"
|
||||
:key="file"
|
||||
type="primary"
|
||||
:href="getAttachmentUrl(file)"
|
||||
target="_blank"
|
||||
:underline="false"
|
||||
>
|
||||
{{ getAttachmentName(file, index) }}
|
||||
</el-link>
|
||||
</div>
|
||||
</el-popover>
|
||||
<span v-else class="attachment-empty">无</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<div class="ctrl-btn d-flex">
|
||||
@@ -115,6 +137,22 @@
|
||||
<el-form-item label="收获" style="width: 792px" prop="harvest">
|
||||
<el-input v-model="form.harvest" type="textarea" placeholder="请输入收获" />
|
||||
</el-form-item>
|
||||
<el-form-item label="附件" style="width: 792px" prop="attachment">
|
||||
<div v-if="title === '查看活动记录'" class="attachment-readonly-list attachment-form-list">
|
||||
<el-link
|
||||
v-for="(file, index) in parseAttachments(form.attachment)"
|
||||
:key="file"
|
||||
type="primary"
|
||||
:href="getAttachmentUrl(file)"
|
||||
target="_blank"
|
||||
:underline="false"
|
||||
>
|
||||
{{ getAttachmentName(file, index) }}
|
||||
</el-link>
|
||||
<span v-if="!parseAttachments(form.attachment).length" class="attachment-empty">暂无附件</span>
|
||||
</div>
|
||||
<file-upload v-else v-model="form.attachment" :limit="9" :file-size="10" :file-type="attachmentFileTypes" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" style="width: 792px" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
@@ -190,6 +228,7 @@ const expenseList = ref([])
|
||||
const selectedExpenses = ref([])
|
||||
const currentActivityId = ref(null)
|
||||
const summaryTotal = ref(0)
|
||||
const attachmentFileTypes = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx']
|
||||
const operateList = ref([
|
||||
{ id: 'view', icon: 'View', title: '查看', hasPermi: ['health:activity:query'] },
|
||||
{ id: 'edit', icon: 'Edit', title: '修改', hasPermi: ['health:activity:edit'] },
|
||||
@@ -240,6 +279,39 @@ const handleOperate = (operate, row) => {
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
function parseAttachments(attachment) {
|
||||
if (!attachment) {
|
||||
return []
|
||||
}
|
||||
return String(attachment)
|
||||
.split(',')
|
||||
.map((item) => item.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function getAttachmentUrl(file) {
|
||||
if (!file) {
|
||||
return ''
|
||||
}
|
||||
if (/^(https?:)?\/\//.test(file) || file.startsWith('/') || file.startsWith('blob:') || file.startsWith('data:')) {
|
||||
return file
|
||||
}
|
||||
return `/${file}`
|
||||
}
|
||||
|
||||
function getAttachmentName(file, index) {
|
||||
const purePath = String(file || '').split('?')[0]
|
||||
const name = purePath.slice(purePath.lastIndexOf('/') + 1)
|
||||
if (!name) {
|
||||
return `附件${index + 1}`
|
||||
}
|
||||
try {
|
||||
return decodeURIComponent(name)
|
||||
} catch {
|
||||
return name
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询活动记录列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
@@ -277,7 +349,8 @@ function reset() {
|
||||
remark: null,
|
||||
totalCost: 0,
|
||||
partner: null,
|
||||
costDetail: null
|
||||
costDetail: null,
|
||||
attachment: null
|
||||
}
|
||||
proxy.resetForm('activityRef')
|
||||
}
|
||||
@@ -501,3 +574,23 @@ function confirmSummary() {
|
||||
|
||||
getList()
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.attachment-popover-list,
|
||||
.attachment-readonly-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.attachment-form-list {
|
||||
min-height: 32px;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.attachment-empty {
|
||||
color: #909399;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user