rev:出入库流程兼容

This commit is contained in:
zhangzq
2024-06-03 10:09:04 +08:00
parent e446f8b743
commit a243c910ce
85 changed files with 741 additions and 301 deletions

View File

@@ -0,0 +1,33 @@
import Vue from 'vue'
import { tableEnum as getEnumDetail } from '@/views/system/dict/enumDetail'
export default class TableEnum {
constructor(tableEnum) {
this.tableEnum = tableEnum
}
async init(names, completeCallback) {
if (names === undefined || name === null) {
throw new Error('need TableEnum names')
}
const ps = []
names.forEach(n => {
let split = n.split('#');
let code = split[0];
let label = split[1];
let value = split[2];
Vue.set(this.tableEnum.tableEnum, code, {})
Vue.set(this.tableEnum.label, code, {})
Vue.set(this.tableEnum, code, [])
ps.push(getEnumDetail({'code':code,'label':label,'value':value}).then(data => {
this.tableEnum[code].splice(0, 0, ...data)
data.forEach(d => {
Vue.set(this.tableEnum.tableEnum[code], d.value, d)
Vue.set(this.tableEnum.label[code], d.value, d.label)
})
}))
})
await Promise.all(ps)
completeCallback()
}
}

View File

@@ -0,0 +1,29 @@
import TableEnum from './TableEnum'
const install = function(Vue) {
Vue.mixin({
data() {
if (this.$options.tableEnums instanceof Array) {
const tableEnum = {
tableEnum: {},
label: {}
}
return {
tableEnum
}
}
return {}
},
created() {
if (this.$options.tableEnums instanceof Array) {
new TableEnum(this.tableEnum).init(this.$options.tableEnums, () => {
this.$nextTick(() => {
this.$emit('dictReady')
})
})
}
}
})
}
export default { install }