From ac84a949ba075b7e180d318b31044b0b64ee0180 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期一, 03 三月 2025 10:00:18 +0800
Subject: [PATCH] 流程推进详情bug
---
src/components/DictData/index.js | 91 +++++++++++++++++++++++----------------------
1 files changed, 47 insertions(+), 44 deletions(-)
diff --git a/src/components/DictData/index.js b/src/components/DictData/index.js
index 7b85d4a..85292ce 100644
--- a/src/components/DictData/index.js
+++ b/src/components/DictData/index.js
@@ -2,48 +2,51 @@
import store from '@/store'
import DataDict from '@/utils/dict'
import { getDicts as getDicts } from '@/api/system/dict/data'
+import { handleTree } from '@/utils/ruoyi'
-function searchDictByKey(dict, key) {
- if (key == null && key == "") {
- return null
- }
- try {
- for (let i = 0; i < dict.length; i++) {
- if (dict[i].key == key) {
- return dict[i].value
- }
- }
- } catch (e) {
- return null
- }
-}
-
-function install() {
- Vue.use(DataDict, {
- metas: {
- '*': {
- labelField: 'dictLabel',
- valueField: 'dictValue',
- request(dictMeta) {
- const storeDict = searchDictByKey(store.getters.dict, dictMeta.type)
- if (storeDict) {
- return new Promise(resolve => { resolve(storeDict) })
- } else {
- return new Promise((resolve, reject) => {
- getDicts(dictMeta.type).then(res => {
- store.dispatch('dict/setDict', { key: dictMeta.type, value: res.data })
- resolve(res.data)
- }).catch(error => {
- reject(error)
- })
- })
- }
- },
- },
- },
- })
-}
-
-export default {
- install,
-}
\ No newline at end of file
+ function searchDictByKey(dict, key) {
+ if (key == null && key == '') {
+ return null
+ }
+ try {
+ for (let i = 0; i < dict.length; i++) {
+ if (dict[i].key == key) {
+ return dict[i].value
+ }
+ }
+ } catch (e) {
+ return null
+ }
+ }
+ function install() {
+ Vue.use(DataDict, {
+ metas: {
+ '*': {
+ labelField: 'dictLabel',
+ valueField: 'dictValue',
+ childrenField: 'children',
+ request(dictMeta) {
+ const storeDict = searchDictByKey(store.getters.dict, dictMeta.type)
+ if (storeDict) {
+ return new Promise(resolve => {
+ resolve(storeDict)
+ })
+ } else {
+ return new Promise((resolve, reject) => {
+ getDicts(dictMeta.type).then(res => {
+ const dictData = handleTree(res.data, 'dictCode', null, null)
+ store.dispatch('dict/setDict', { key: dictMeta.type, value: dictData })
+ resolve(dictData)
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ }
+ }
+ }
+ }
+ })
+ }
+ export default {
+ install
+ }
--
Gitblit v1.8.0