Procházet zdrojové kódy

更新选装

master
liangchao před 3 dny
rodič
revize
378c6dd4d3
1 změnil soubory, kde provedl 66 přidání a 71 odebrání
  1. 66
    71
      src/crud/config.ts

+ 66
- 71
src/crud/config.ts Zobrazit soubor

@@ -268,83 +268,78 @@ const getValue = (value: string, form: any, atLast: any) => {

let index = 0
export function echo(item: IObject, form: IObject, type?) {
const value = item.prop
let atLast: any = ''
if (form[value] || form[value] == '0' || form[value] === false) {
//字典数据转换 && item.form.listData
if (item.listData || item.form?.listData) {
const listData = item.listData || item.form.listData
let isExist = false
// console.log(form[value] + '---------------------&&&&', item.form.multiple);

listData.forEach((element: any) => {
if (
item.form &&
item.form.multiple &&
form[value]
) {
let arrAys = []
if (form[value] instanceof Array) {
arrAys = form[value]
} else {
arrAys = form[value].split(',')
}
arrAys.forEach((item) => {
if (element.value === item + '') {
isExist = true
atLast += element.label + ' | '
const value = item.prop
let atLast: any = ''
if (form[value] || form[value] == '0' || form[value] === false) {
//字典数据转换 && item.form.listData
if (item.listData || item.form?.listData) {
const listData = item.listData || item.form.listData
let isExist = false
listData.forEach((element: any) => {
if (
item.form &&
item.form.multiple &&
form[value] &&
form[value] instanceof Array
) {
form[value].forEach((item) => {
if (element.value === item + '') {
isExist = true
atLast += element.label + ' | '
}
})
} else {
if (element.value + '' == form[value] + '') {
atLast = element.label
isExist = true
}
}
})
if (!isExist) {
atLast = form[value] + ''
}
})
if (atLast && atLast.endsWith(' | ')) {
// 检查字符串末尾是否为逗号
atLast = atLast.slice(0, -2) // 去除末尾逗号
}
return value.indexOf('.') != -1
? form[value.substring(0, value.indexOf('.'))][
value.substring(value.indexOf('.') + 1, value.length)
]
: atLast
} else {
if (element.value + '' == form[value] + '') {
atLast = element.label
isExist = true
}
atLast = form[value]
}
//金额数据转换(只有表格转换做处理了,详情和编辑单独处理)
if (item.isAmount && type) {
return handleAmount(atLast)
}
//api数据转换
if (item.api && atLast) {
let result = ''
index++
if (window.sessionStorage.getItem(item.api) && index != 1) {
result = setData(
JSON.parse(window.sessionStorage.getItem(item.api) + ''),
atLast,
item
)
} else {
baseService.post(item.api, item.form.parameter ?? {}, function (res) {
window.sessionStorage.setItem(item.api, JSON.stringify(res))
result = setData(res, atLast, item)
})
}
return result
}
})
if (!isExist) {
atLast = form[value] + ''
}
if (atLast.endsWith(' | ')) {
// 检查字符串末尾是否为逗号
atLast = atLast.slice(0, -2) // 去除末尾逗号
}
// console.log(value, form, atLast, '---------------3333');

return getValue(value, form, atLast);
} else {
atLast = form[value]
}
//金额数据转换(只有表格转换做处理了,详情和编辑单独处理)
if (item.isAmount && type) {
return handleAmount(atLast)
atLast = '---'
}
//api数据转换
if (item.api && atLast) {
let result = ''
index++
if (window.sessionStorage.getItem(item.api) && index != 1) {
result = setData(
JSON.parse(window.sessionStorage.getItem(item.api) + ''),
atLast,
item
)
} else {
baseService.post(item.api, item.form.parameter ?? {}, function (res) {
window.sessionStorage.setItem(item.api, JSON.stringify(res))
result = setData(res, atLast, item)
})
}
return result
//数据转换 funRuleStarts作为强制转换不判断值为空
if (item.funRuleStarts && item.funRule) {
return item.funRule(atLast,form) ?? '---'
}
} else {
atLast = '---'
}
//数据转换 funRuleStarts作为强制转换不判断值为空
if (item.funRuleStarts && item.funRule) {
return item.funRule(atLast) ?? '---'
}
return atLast
return atLast
}

// 数组去重

Načítá se…
Zrušit
Uložit