pref#hmc_生日祝福、短信优化

This commit is contained in:
Paidax
2025-12-31 10:12:55 +08:00
parent e2cf8b224b
commit 857819741f
36 changed files with 2924 additions and 172 deletions
@@ -1,103 +1,112 @@
<template>
<el-select v-model="valueAsString" :placeholder="placeholder" @change="onChange" :disabled="disabled" :clearable="clearable"
:style="style"
:multiple="multiple"
:size="size">
<el-option
v-for="item in options"
v-if="!item.disabled"
:key="item[option_value]"
:label="item[option_label]"
:value="item[option_value]">
</el-option>
</el-select>
<el-select
v-model="valueAsString"
:placeholder="placeholder"
@change="onChange"
:disabled="disabled"
:clearable="clearable"
:style="style"
:multiple="multiple"
:size="size"
>
<el-option
v-for="item in options"
v-if="!item.disabled"
:key="item[option_value]"
:label="item[option_label]"
:value="item[option_value]"
></el-option>
</el-select>
</template>
<script>
module.exports = {
props: {
value: {type: String},
code: {
type: String,
default: ""
props: {
value: { type: [String, Array] },
code: {
type: [String, Array],
default: ""
},
option_value: {
type: String,
default: "code"
},
option_label: {
type: String,
default: "name"
},
style: {
type: String,
default: ""
},
size: {
type: String,
default: ""
},
placeholder: {
type: String,
default: "请选择"
},
clearable: {
type: Boolean,
default: true
},
disabled: {
type: Boolean,
default: false
},
multiple: {
type: Boolean,
default: false
}
},
option_value: {
type: String,
default: "code"
model: {
prop: "value",
event: "change"
},
option_label: {
type: String,
default: "name"
data() {
return {
options: []
}
},
style: {
type: String,
default: ""
},
size: {
type: String,
default: ""
},
placeholder: {
type: String,
default: "请选择"
},
clearable: {
type: Boolean,
default: true
},
disabled: {
type: Boolean,
default: false
},
multiple: {
type: Boolean,
default: false
},
},
model: {
prop: 'value',
event: 'change'
},
data() {
return {
options: []
}
},
computed:{
valueAsString(){
if(Array.isArray(this.value)){
return this.value
}else{
return this.value ? this.value.toString() : ''
}
}
},
computed: {
valueAsString: {
get() {
if (Array.isArray(this.value)) {
return this.value
} else {
return this.value ? this.value.toString() : ""
}
},
set(val) {}
}
},
watch: {
code(val) {
this.flushOptions()
watch: {
code(val) {
this.flushOptions()
}
},
methods: {
onChange(val) {
this.$emit("change", val)
},
async flushOptions() {
if (!this.code) {
this.options = []
return
}
this.options = await getDictOptions(this.code)
}
},
created() {
this.flushOptions()
}
},
methods: {
onChange(val) {
this.$emit("change", val)
},
async flushOptions() {
if (!this.code) {
this.options = []
return
}
this.options = await getDictOptions(this.code)
},
},
created() {
this.flushOptions()
}
}
</script>
<style>
</style>
</style>