Skip to content

Commit

Permalink
fix: 修复字典服务重载字典数据报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
kanyxmo committed Apr 10, 2024
1 parent 8790a44 commit 5ee48a2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/components/ma-form/js/columnService.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ const objectService = function (item) {
* @param dictData
* @constructor
*/
const dictService = function (dataIndex, dictData) {
this.dict = dictData
const dictService = function (dataIndex, dictData, dicts, columns) {
this.columns = columns
this.dicts = dicts
this.dictData = dictData
this.dataIndex = dataIndex

/**
* 返回原DictData对象
* @returns {*}
*/
this.getRawDictData = () => {
return this.dict
return this.dictData
}
/**
* 追加
Expand All @@ -62,8 +64,9 @@ const dictService = function (dataIndex, dictData) {
* @param dictConfig
* @returns {Promise<void>}
*/
this.loadDict = (dictConfig) => {
return loadDict(dictList, { formType: "select", dict: dictConfig, dataIndex: this.dataIndex })
this.loadDict = async (dictConfig) => {
this.columns.setAttr('dict', dictConfig)
await loadDict(this.dicts, { formType: "select", dict: dictConfig, dataIndex: this.dataIndex })
}
}

Expand Down Expand Up @@ -101,7 +104,7 @@ class ColumnService {
})

for (const [dataIndex, dictData] of Object.entries(this.dicts)) {
this.dictMap.set(dataIndex, new dictService(dataIndex, dictData))
this.dictMap.set(dataIndex, new dictService(dataIndex, dictData, this.dicts, this.columnMap.get(dataIndex)))
}
}

Expand Down

0 comments on commit 5ee48a2

Please sign in to comment.