opt:策略管理包结构修改2

This commit is contained in:
zhangzq
2025-06-26 13:58:24 +08:00
parent de643e472c
commit 7b9ad26e11
16 changed files with 117 additions and 28 deletions

View File

@@ -0,0 +1,34 @@
import Vue from 'vue'
import { tableEnum as getEnumDetail } from '@/views/system/dict/enumDetail'
// tableEnums: ['st_ivt_bsrealstorattr#stor_name#stor_code'],
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 => {
const split = n.split('#')
const code = split[0]
const label = split[1]
const 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 }

View File

@@ -11,6 +11,7 @@ import 'mavon-editor/dist/css/index.css'
// 数据字典
import dict from './components/Dict'
import tableEnum from './components/TableEnum'
import scroll from 'vue-seamless-scroll'
// 权限指令
@@ -71,6 +72,7 @@ Vue.use(VueHighlightJS)
Vue.use(mavonEditor)
Vue.use(permission)
Vue.use(dict)
Vue.use(tableEnum)
Vue.use(VueBus)
// 全局设置控件样式https://codeantenna.com/a/0IN5FMJk5h
Element.Table.props.border = { type: Boolean, default: true }

View File

@@ -0,0 +1,22 @@
import request from '@/utils/request'
export function get(code) {
const params = {
code
}
return request({
url: 'api/dict/getStatusEnum',
method: 'get',
params
})
}
export function tableEnum(params) {
return request({
url: 'api/dict/getTableEnum',
method: 'get',
params
})
}
export default { get, tableEnum }

View File

@@ -50,7 +50,7 @@
style="width: 200px"
>
<el-option
v-for="item in classTypeList"
v-for="item in tableEnum.st_ivt_sectattr"
:key="item.id"
:label="item.label"
:value="item.value"
@@ -106,6 +106,8 @@ import CRUD, { form, crud } from '@crud/crud'
export default {
name: 'AddDialog',
tableEnums: ['st_ivt_sectattr#sect_name#sect_code'],
mixins: [form(defaultForm), crud()],
props: {
dialogShow: {
@@ -116,13 +118,6 @@ export default {
type: Object
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
data() {
return {
dialogVisible: false,
@@ -155,6 +150,13 @@ export default {
}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
methods: {
handleClose(done) {
this.$confirm('确认关闭?')