| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- export const updateClassName = (genList, fields, className, updateType) => {
- for (let i = 0; i < genList.length; i++) {
- if (genList[i].type === 'grid') {
- genList[i].columns.forEach(item => {
- updateClassName(item.list, fields, className, updateType)
- })
- } else if (genList[i].type === 'tabs') {
- genList[i].tabs.forEach(item => {
- updateClassName(item.list, fields, className, updateType)
- })
- } else if (genList[i].type === 'collapse') {
- genList[i].tabs.forEach(item => {
- updateClassName(item.list, fields, className, updateType)
- })
- } else if (genList[i].type === 'report') {
- genList[i].rows.forEach(row => {
- row.columns.forEach(column => {
- updateClassName(column.list, fields, className, updateType)
- })
- })
- } else if (genList[i].type === 'inline') {
- updateClassName(genList[i].list, fields, className, updateType)
- } else if (genList[i].type === 'card') {
- updateClassName(genList[i].list, fields, className, updateType)
- } else {
- if (fields.length === 1) {
- if (genList[i].model === fields[0]) {
- if (updateType == 'add' && !genList[i].options.customClass.split(' ').includes(className)) {
-
- genList[i].options.customClass = [...genList[i].options.customClass.split(' '), className].join(' ')
- }
-
- if (updateType == 'remove' && genList[i].options.customClass.split(' ').includes(className)) {
- let originArray = genList[i].options.customClass.split(' ')
- originArray.splice(originArray.findIndex(item => item == className), 1)
- genList[i].options.customClass = originArray.join(' ')
- }
- }
- } else {
- if (genList[i].model === fields[0]) {
- let newFields = [...fields]
- newFields.splice(0, 1)
- if (genList[i].type === 'table') {
- updateClassName(genList[i].tableColumns, newFields, className, updateType)
- }
- if (genList[i].type === 'subform') {
- updateClassName(genList[i].list, newFields, className, updateType)
- }
- if (genList[i].type === 'group') {
- updateClassName(genList[i].list, newFields, className, updateType)
- }
- if (genList[i].type === 'dialog') {
- updateClassName(genList[i].list, newFields, className, updateType)
- }
- }
- }
- }
- }
- }
|