first commit

This commit is contained in:
2026-08-26 14:25:17 +08:00
commit 06debfd1fc
10595 changed files with 1836924 additions and 0 deletions
@@ -0,0 +1,48 @@
class SysDictData {
constructor(dict) {
this.dict = dict
}
async init(dictNames) {
const ps = []
dictNames.forEach((name) => {
Vue.set(this.dict.type, name, null)
ps.push(
$.get("/open/common/dictOptions", { code: name }).then((res) => {
const dictValue = res.data.map((v) => {
return {
name: v.name,
text: v.name,
label: v.name,
code: 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).then()
}
}
})
}
if (window.Vue) {
Vue.use(window.dictData)
}