批量推送
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<!--
|
||||
业务审核状态标签
|
||||
通用封装, 后端 BizAuditStatusEnum 对应
|
||||
0=未提交 1=待审核 2=通过 3=拒绝
|
||||
-->
|
||||
<el-tag
|
||||
v-if="resolved"
|
||||
:type="resolved.type"
|
||||
:effect="effect"
|
||||
:size="size"
|
||||
>{{ resolved.text }}</el-tag>
|
||||
<span v-else style="color:#c0c4cc">{{ emptyText }}</span>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
|
||||
/**
|
||||
* 审核状态标签
|
||||
*
|
||||
* 用法:
|
||||
* <audit-status-tag :status="row.auditStatus" />
|
||||
* <audit-status-tag :status="row.auditStatus" size="small" effect="dark" />
|
||||
*
|
||||
* 兼容: 若传入旧值 ('审核通过'/'已退回'/'已驳回'/'待审核' 等中文), 自动归一化到新枚举
|
||||
*/
|
||||
const props = defineProps({
|
||||
status: { type: [String, Number, null], default: null },
|
||||
size: { type: String, default: 'small' }, // small / default / large
|
||||
effect: { type: String, default: 'light' }, // light / dark / plain
|
||||
emptyText: { type: String, default: '-' },
|
||||
})
|
||||
|
||||
// 映射表: 后端 BizAuditStatusEnum 一致
|
||||
const MAP = {
|
||||
'0': { text: '未提交', type: 'info' },
|
||||
'1': { text: '待审核', type: 'warning' },
|
||||
'2': { text: '通过', type: 'success' },
|
||||
'3': { text: '拒绝', type: 'danger' },
|
||||
}
|
||||
|
||||
// 旧值兼容 (历史脏数据 / 老代码)
|
||||
const LEGACY = {
|
||||
'待审核': '1',
|
||||
'审核通过': '2',
|
||||
'通过': '2',
|
||||
'已退回': '3',
|
||||
'已驳回': '3',
|
||||
'退回': '3',
|
||||
'驳回': '3',
|
||||
'拒绝': '3',
|
||||
}
|
||||
|
||||
const resolved = computed(() => {
|
||||
let s = props.status
|
||||
if (s == null || s === '') return null
|
||||
s = String(s).trim()
|
||||
if (MAP[s]) return MAP[s]
|
||||
if (LEGACY[s]) return MAP[LEGACY[s]]
|
||||
return null
|
||||
})
|
||||
</script>
|
||||
@@ -7,17 +7,18 @@
|
||||
placeholder="证书"
|
||||
/>
|
||||
|
||||
block=true 时撑满父容器宽度 (用于表单行内全宽上传), 字体缩小到 14px
|
||||
readonly=true 时不触发上传, 点击缩略图弹 el-image 预览
|
||||
上传走 OSS 直传 (utils/oss.js 的 uploadToOss)
|
||||
-->
|
||||
<template>
|
||||
<div class="ht-image-upload-content" :class="{ 'has-file': modelValue }" @click="handleClick">
|
||||
<div class="ht-image-upload-content" :class="{ 'has-file': modelValue, 'is-block': block }" @click="handleClick">
|
||||
<div v-if="!modelValue && !readonly" class="ht-image-placeholder-wrap">
|
||||
<span class="placeholder-text">{{ placeholder }}</span>
|
||||
</div>
|
||||
<div v-else-if="!modelValue && readonly" style="width: 90px;height: 60px; background: #f2f4f5;"></div>
|
||||
<div v-else-if="!modelValue && readonly" :style="readonlyBoxStyle"></div>
|
||||
<img v-else-if="!readonly" class="ht-image" :src="modelValue" />
|
||||
<el-image v-else :src="modelValue" style="width: 90px;height: 60px; display: flex; justify-content: center; align-items: center; background: #f2f4f5;"
|
||||
<el-image v-else :src="modelValue" :style="readonlyBoxStyle"
|
||||
:preview-src-list="[modelValue]"></el-image>
|
||||
</div>
|
||||
<input
|
||||
@@ -30,7 +31,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { uploadToOss } from '@/utils/oss'
|
||||
|
||||
@@ -38,7 +39,9 @@ const props = defineProps({
|
||||
modelValue: { type: String, default: '' },
|
||||
dir: { type: String, default: 'ry8080/image/' },
|
||||
placeholder: { type: String, default: '点击上传' },
|
||||
readonly: { type: Boolean, default: false }
|
||||
readonly: { type: Boolean, default: false },
|
||||
/** true 时撑满父容器宽度, 用于表单行内全宽上传 */
|
||||
block: { type: Boolean, default: false }
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
@@ -46,6 +49,13 @@ const emit = defineEmits(['update:modelValue'])
|
||||
const fileInput = ref(null)
|
||||
const uploading = ref(false)
|
||||
|
||||
const readonlyBoxStyle = computed(() => {
|
||||
if (props.block) {
|
||||
return 'width: 100%; height: 100px; background: #f2f4f5; display: flex; justify-content: center; align-items: center;'
|
||||
}
|
||||
return 'width: 90px; height: 60px; background: #f2f4f5; display: flex; justify-content: center; align-items: center;'
|
||||
})
|
||||
|
||||
function handleClick() {
|
||||
if (props.readonly || uploading.value) return
|
||||
fileInput.value?.click()
|
||||
@@ -90,6 +100,10 @@ async function onFileChange(e) {
|
||||
cursor: pointer;
|
||||
background: #fafafa;
|
||||
}
|
||||
.ht-image-upload-content.is-block {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
}
|
||||
.ht-image-upload-content:hover {
|
||||
border-color: #1890ff;
|
||||
}
|
||||
@@ -105,11 +119,16 @@ async function onFileChange(e) {
|
||||
justify-content: center;
|
||||
}
|
||||
.placeholder-text {
|
||||
font-size: 24px;
|
||||
font-weight: 300;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: #8c8c8c;
|
||||
line-height: 1;
|
||||
}
|
||||
.ht-image-upload-content.is-block .placeholder-text {
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: #8c8c8c;
|
||||
}
|
||||
.ht-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
Reference in New Issue
Block a user