This commit is contained in:
@jyuhsin
2025-09-05 15:10:51 +08:00
parent 43fd3c07fd
commit 6ad78e51ae
8 changed files with 310 additions and 216 deletions
@@ -132,14 +132,13 @@ body {
}
.list-card {
margin: 20px 10px;
margin: 10px;
background: #FFFFFF;
border-radius: 10px;
display: flex;
padding: 15px;
column-gap: 10px;
padding: 10px;
border-bottom: 1px solid #ededed;
box-sizing: border-box;
box-shadow: 0 8px 12px #ebedf0;
}
.list-card:not(:last-child){
@@ -162,6 +161,9 @@ body {
.list-card-body{
flex: 1;
}
.list-card-body .van-cell{
padding: 8px 16px;
}
.list-card-footer{
display: flex;
@@ -170,3 +172,88 @@ body {
margin-top: 10px;
flex-wrap: wrap;
}
.list-card-footer .van-button {
border-radius: 8px;
height: 28px;
padding: 0 12px;
}
.form-container {
padding: 0 16px;
font-family: "PingFang SC", sans-serif;
}
/* 分段标题样式 */
.form-section {
border-radius: 12px;
overflow: hidden;
box-shadow: 0 8px 12px #ebedf0;
}
/* 弹出选择器样式 */
.picker-style {
background-color: #f5f5f5;
border-top-left-radius: 12px;
border-top-right-radius: 12px;
}
/* 输入文本区域样式 */
.van-field__control {
font-size: 14px;
color: #333;
}
.van-field__control input,
.van-field__control textarea {
font-size: 14px;
color: #333;
border-radius: 6px;
padding: 8px 12px;
background-color: #f9f9f9;
}
/* 提交按钮样式 */
.submit-btn {
margin: 20px 16px 30px;
border-radius: 24px;
overflow: hidden;
}
.submit-many-btn {
margin: 20px 16px 30px;
border-radius: 24px;
overflow: hidden;
display: flex;
justify-content: space-evenly;
}
.submit-btn .van-button {
height: 48px;
font-size: 16px;
font-weight: bold;
}
.submit-many-btn .van-button {
height: 48px;
font-size: 16px;
font-weight: bold;
}
.van-cell-group__title {
font-weight: bold;
color: #1867B0;
display: inline-block; /* 确保伪元素正常排列 */
}
.van-cell-group__title::before {
content: '';
display: inline-block;
width: 4px;
height: 1em; /* 高度随字体大小变化,更自适应 */
background-color: #1867B0;
border-radius: 2px;
margin-right: 8px;
vertical-align: middle; /* 垂直居中对齐 */
position: relative;
top: -1px;
}
.more-text .van-field__label{
width: 100%;
}
.more-text {
display: inline-block;
}
@@ -1,12 +1,19 @@
<template>
<div>
<template v-for="item in options">
<el-tag :key="item[value_key]" v-if="item[value_key] === value" v-bind="$attrs"
:type="item.type"
>{{ item[label_key] }}
</el-tag>
</template>
</div>
<div>
<template v-if="mode === 'pc'" v-for="item in options">
<el-tag :key="item[value_key]" v-if="item[value_key] === value" v-bind="$attrs"
:type="item.type"
>{{ item[label_key] }}
</el-tag>
</template>
<template v-if="mode === 'h5'" v-for="item in options">
<van-tag :key="item[value_key]" v-if="item[value_key] === value" v-bind="$attrs"
:type="item.type">
{{ item[label_key] }}
</van-tag>
</template>
</div>
</template>
<script>
@@ -15,73 +22,80 @@ const enumCache = {}
const requestPromises = {}
module.exports = {
name: "DictTag",
props: {
value: {type: String | Number},
name: {type: String},
value_key: {
type: String,
default: "code"
name: "DictTag",
props: {
value: { type: String | Number },
name: { type: String },
value_key: {
type: String,
default: "code"
},
label_key: {
type: String,
default: "name"
},
mode: {
type: String,
default: "pc"
}
},
label_key: {
type: String,
default: "name"
}
},
data() {
return {
options: []
}
},
watch: {
code: {
handler(val) {
this.getEnumOptions()
},
immediate: true
}
},
methods: {
getEnumOptions() {
// // 检查数据缓存
// if (enumCache[this.name]) {
// this.options = enumCache[this.name]
// return
// }
//
// // 检查是否已有相同请求在进行中
// if (requestPromises[this.name]) {
// requestPromises[this.name].then(data => {
// this.options = data
// })
// return
// }
data() {
return {
options: []
}
},
watch: {
code: {
handler(val) {
this.getEnumOptions()
},
immediate: true
}
},
methods: {
getEnumOptions() {
// // 检查数据缓存
// if (enumCache[this.name]) {
// this.options = enumCache[this.name]
// return
// }
//
// // 检查是否已有相同请求在进行中
// if (requestPromises[this.name]) {
// requestPromises[this.name].then(data => {
// this.options = data
// })
// return
// }
// 创建请求Promise并缓存
requestPromises[this.name] = $.get("/open/common/dictEnumOptions", {name: this.name})
.then(res => {
if (res.code === 0) {
// 存入数据缓存
enumCache[this.name] = res.data
// 清除请求Promise缓存
delete requestPromises[this.name]
return res.data
}
})
// 创建请求Promise并缓存
requestPromises[this.name] = $.get("/open/common/dictEnumOptions", { name: this.name })
.then(res => {
if (res.code === 0) {
// 存入数据缓存
enumCache[this.name] = res.data
// 清除请求Promise缓存
delete requestPromises[this.name]
return res.data
}
})
requestPromises[this.name].then(data => {
this.options = data
})
}
},
created() {
requestPromises[this.name].then(data => {
this.options = data
})
}
},
created() {
}
}
</script>
<style scoped>
.el-tag + .el-tag {
margin-left: 10px;
margin-left: 10px;
}
.van-tag {
padding: 4px 8px;
}
</style>
@@ -105,6 +105,7 @@ module.exports = {
}
})
} else {
val = JSON.parse(val)
this.fileList = val.map((v) => {
return {
...v,