| | |
| | | result = [] |
| | | |
| | | list.forEach(item => { |
| | | if (item.Op === 'lessorequal') { |
| | | item.Op = '<=' |
| | | } else if (item.Op === 'greaterorequal') { |
| | | item.Op = '>=' |
| | | } |
| | | let cell = { |
| | | uuid: Utils.getuuid(), |
| | | label: item.Label, |
| | |
| | | ratio: 6, |
| | | type: 'text' |
| | | } |
| | | // options |
| | | // resourceType |
| | | // orderType |
| | | |
| | | if (item.Type === 'string') { |
| | | cell.type = 'text' |
| | | } else if (item.Type === 'select') { |
| | | cell.type = 'select' |
| | | cell.resourceType = '1' |
| | | cell.valueField = item.IdField |
| | | cell.valueText = item.TextField |
| | | cell.dataSource = item.FromField |
| | | cell.orderBy = item.OrderField || '' |
| | | cell.orderType = 'asc' |
| | | cell.options = [] |
| | | cell.initval = item.InitVal || '' |
| | | |
| | | if (cell.dataSource) { |
| | | cell.dataSource = `select * from @db@${cell.dataSource}` |
| | | |
| | | if (item.WhereField) { |
| | | cell.dataSource += ' where ' + item.WhereField.replace(/^\s*\(|\)\s*$/g, '') |
| | | } |
| | | } |
| | | |
| | | cell.dataSource = cell.dataSource.replace(/@userid[^0-9a-z_@]/ig, '@UserID@') |
| | | |
| | | if (item.multiple === 'true') { |
| | | cell.type = 'multiselect' |
| | | } |
| | | } else if (item.Type === 'date') { |
| | | cell.type = 'date' |
| | | cell.precision = 'day' |
| | | } |
| | | |
| | | result.push(cell) |
| | | }) |
| | |
| | | let list = JSON.parse(textInput) |
| | | |
| | | if (list.rows) { |
| | | list = list.rows |
| | | list = list.rows.filter(item => item.IsButton === '1') |
| | | list = list.map(item => { |
| | | item.Sort = +item.Sort |
| | | return item |
| | | }) |
| | | list.sort((a, b) => a.Sort - b.Sort) |
| | | } |
| | | |
| | | result = [] |
| | | |
| | | list.forEach(item => { |
| | | if (item.IsButton !== '1') return |
| | | |
| | | let cell = { |
| | | uuid: Utils.getuuid(), |
| | | label: item.MenuName, |
| | |
| | | // if (item.ReloadForm === 'grid') { |
| | | // cell.execSuccess = 'grid' |
| | | // } |
| | | if (item.Action === 'PopDlg') { |
| | | cell.OpenType = 'pop' |
| | | } else if (item.Action === 'Add' || item.Action === 'Update') { |
| | | cell.OpenType = 'pop' |
| | | } else if (item.Action === 'View') { |
| | | cell.OpenType = 'popview' |
| | | } else if (item.Action === 'Prompt') { |
| | | cell.OpenType = 'prompt' |
| | | } else if (item.Action === 'ExportExcel') { |
| | | cell.OpenType = 'excelOut' |
| | | } |
| | | |
| | | if (/添加/.test(cell.label)) { |
| | | cell.Ot = 'notRequired' |
| | |
| | | } else if (/导入/.test(cell.label)) { |
| | | cell.Ot = 'notRequired' |
| | | cell.class = 'border-dgreen' |
| | | } else if (/导出/.test(cell.label)) { |
| | | } else if (cell.OpenType === 'excelOut') { |
| | | cell.Ot = 'requiredOnce' |
| | | cell.class = 'dgreen' |
| | | } |
| | | |
| | | if (item.Action === 'PopDlg') { |
| | | cell.OpenType = 'pop' |
| | | } |
| | | |
| | | if (item.TableName) { |
| | | cell.sql = item.TableName |
| | | } |
| | |
| | | cell.sqlType = 'custom' |
| | | } |
| | | } |
| | | } else if (cell.OpenType === 'excelOut') { |
| | | cell.intertype = 'system' |
| | | } |
| | | |
| | | if (cell.Ot === 'required') { |
| | | cell.execError = 'grid' |
| | | } |
| | | |
| | | if (cell.class) { |
| | |
| | | if (tb && data.AppendWhere) { |
| | | tb += ` where ${data.AppendWhere.replace(/^\s*\(|\)\s*$/g, '')}` |
| | | } |
| | | |
| | | tb = tb.replace(/@ID[^0-9a-z_@]/ig, '@ID@') |
| | | tb = tb.replace(/@BID[^0-9a-z_@]/ig, '@BID@') |
| | | tb = tb.replace(/@userid[^0-9a-z_@]/ig, '@UserID@') |
| | | |
| | | result = { |
| | | tableName: '@db@' + data.TableName, |
| | |
| | | let list = JSON.parse(textInput) |
| | | |
| | | if (list.rows) { |
| | | list = list.rows |
| | | // list.reverse() |
| | | let types = [] |
| | | list = list.rows.map(item => { |
| | | item.Sort = +item.Sort |
| | | types.push(item.SubMenu) |
| | | return item |
| | | }) |
| | | types = Array.from(new Set(types)) |
| | | |
| | | if (types.length > 1) { |
| | | list = list.filter(item => !item.SubMenu) |
| | | } |
| | | |
| | | list.sort((a, b) => a.Sort - b.Sort) |
| | | } |
| | | |
| | | result = [] |
| | | let groups = [] |
| | | |
| | | list.forEach(item => { |
| | | if (item.InputType === 'hidden' && item.FieldName === 'ID') return |
| | | |
| | | if (item.GROUPLabel && !groups.includes(item.GROUPLabel)) { |
| | | groups.push(item.GROUPLabel) |
| | | |
| | | result.push({ |
| | | uuid: Utils.getuuid(), |
| | | label: item.GROUPLabel, |
| | | type: 'split', |
| | | hidden: 'false', |
| | | }) |
| | | } |
| | | |
| | | let cell = { |
| | | uuid: Utils.getuuid(), |
| | | label: item.Label, |
| | |
| | | } |
| | | } |
| | | |
| | | cell.dataSource = cell.dataSource.replace(/@userid[^0-9a-z_@]/ig, '@UserID@') |
| | | |
| | | if (item.Multi === 'true') { |
| | | cell.type = 'multiselect' |
| | | } |
| | |
| | | w = w.replace(/\n/, ' */\n') |
| | | return w |
| | | }) |
| | | |
| | | result = result.replace(/@ID[^0-9a-z_@]/ig, '@ID@') |
| | | result = result.replace(/@BID[^0-9a-z_@]/ig, '@BID@') |
| | | result = result.replace(/@userid[^0-9a-z_@]/ig, '@UserID@') |
| | | // result = result.replace(/\n+/g, '\n') |
| | | } |
| | | |