first commit

This commit is contained in:
2026-09-09 09:14:28 +08:00
commit 5343198112
5199 changed files with 1052895 additions and 0 deletions
@@ -0,0 +1,47 @@
class SysDictData {
constructor(dict) {
this.dict = dict
}
async init(dictNames) {
const ps = [];
dictNames.forEach((name) => {
Vue.set(this.dict.type, name, null)
ps.push(
getDictOptions(name).then((res) => {
const dictValue = res.map(v => {
return {
text: v.name,
label: v.name,
value: v.code,
raw: v
}
})
this.dict.type[name] = Object.freeze(dictValue)
})
)
})
await Promise.all(ps)
}
}
window.dictData = {}
window.dictData.install = function (Vue) {
Vue.mixin({
data() {
if (this.$options.dicts instanceof Array && this.$options.dicts.length > 0) {
return {dict: {type: {}}};
} else {
return {}
}
},
created() {
if (this.$options.dicts instanceof Array && this.$options.dicts.length > 0) {
new SysDictData(this.dict).init(this.$options.dicts);
}
}
})
}
if (window.Vue) {
Vue.use(window.dictData)
}
@@ -0,0 +1,58 @@
/**
*Desc:
*Create by: jug
*Create time:2023/7/28/9:55
*/
<template>
<div>
<template v-for="(item, index) in options">
<template v-if="values.includes(item.value)">
<span
v-if="item.raw.listClass == 'default' || item.raw.listClass == ''"
:key="item.value"
:index="index"
:class="item.raw.cssClass"
>{{ item.label }}</span
>
<van-tag
v-else
:disable-transitions="true"
:key="item.value"
:index="index"
:type="item.raw.listClass == 'primary' ? '' : item.raw.listClass"
:class="item.raw.cssClass"
>
{{ item.label }}
</van-tag>
</template>
</template>
</div>
</template>
<script>
module.exports = {
name: "DictTag",
props: {
options: {
type: Array,
default: null,
},
value: [Number, String, Array],
},
computed: {
values() {
if (this.value !== null && typeof this.value !== 'undefined') {
return Array.isArray(this.value) ? this.value : [String(this.value)];
} else {
return [];
}
},
},
}
</script>
<style scoped>
.el-tag + .el-tag {
margin-left: 10px;
}
</style>