From 5c8860f3cd8921e7eb0da7749628e9dc669b3203 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 17 三月 2020 10:19:16 +0800 Subject: [PATCH] 2020-03-17 --- src/tabviews/tableshare/actionList/index.jsx | 109 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 88 insertions(+), 21 deletions(-) diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx index ad7dd32..1bbb6e4 100644 --- a/src/tabviews/tableshare/actionList/index.jsx +++ b/src/tabviews/tableshare/actionList/index.jsx @@ -28,8 +28,9 @@ ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� refreshdata: PropTypes.func, // 鎵ц瀹屾垚鍚庢暟鎹埛鏂� triggerPopview: PropTypes.func, // 寮圭獥鏍囩椤佃Е鍙� - getexceloutparam: PropTypes.func, // 鑾峰彇excel瀵煎嚭鏁版嵁 - gettableselected: PropTypes.func // 鑾峰彇琛ㄦ牸涓暟鎹� + getexceloutparam: PropTypes.func, // 鑾峰彇excel瀵煎嚭鏁版嵁 + gettableselected: PropTypes.func, // 鑾峰彇琛ㄦ牸涓暟鎹� + permRoles: PropTypes.any // 鐢ㄦ埛鏉冮檺鍒楄〃 } state = { @@ -234,36 +235,56 @@ } let printlist = [] - let templates = [] + let templates = [btn.verify.Template] this.setState({loadingUuid: btn.uuid}) new Promise(resolve => { if (btn.intertype === 'inner' && !btn.innerFunc) { formdata.TemplateID = btn.verify.Template - templates.push(btn.verify.Template) if (btn.Ot === 'notRequired') { - printlist.push(formdata) + if (formdata.printCount && typeof(formdata.printCount) === 'number' && formdata.printCount > 1) { + for (let i = 0; i < formdata.printCount; i++) { + printlist.push(JSON.parse(JSON.stringify(formdata))) + } + } else { + printlist.push(formdata) + } } else { - printlist = data.map(cell => { + data.forEach(cell => { let _cell = {...cell, ...formdata} - return _cell + if (formdata.printCount && typeof(formdata.printCount) === 'number' && formdata.printCount > 1) { + for (let i = 0; i < formdata.printCount; i++) { + printlist.push(JSON.parse(JSON.stringify(_cell))) + } + } else { + printlist.push(_cell) + } }) } resolve('getTemp') } else { this.getprintdata(btn, data, formdata, formlist).then(result => { - printlist = result.list.map(item => { - if (item.TemplateID) { - templates.push(item.TemplateID) - } else { - item.TemplateID = btn.verify.Template - } - return item - }) + result.list.forEach(item => { + let _cell = item.data + if (_cell.TemplateID) { + templates.push(_cell.TemplateID) + } else { + _cell.TemplateID = btn.verify.Template + } + + if (item.count && typeof(item.count) === 'number' && item.count > 1) { + for (let i = 0; i < item.count; i++) { + printlist.push(JSON.parse(JSON.stringify(_cell))) + } + } else { + printlist.push(_cell) + } + }) + resolve(result.next) }) } @@ -280,8 +301,8 @@ ID: tempId } - if (options.cloudServiceApi) { - param.rduri = options.cloudServiceApi.replace('dostars', 'dostar') + if (window.GLOB.mainSystemApi) { // 浠庡崟鐐圭櫥褰曟湇鍔″櫒鍙栨墦鍗伴厤缃俊鎭� + param.rduri = window.GLOB.mainSystemApi } Api.getLocalConfig(param).then(result => { @@ -389,7 +410,9 @@ let errorMsg = '' result.forEach(res => { if (res.status) { - _list.push(res.data) + res.data.forEach(_item => { + _list.push({data: _item, count: res.printCount}) + }) } else { errorMsg = res } @@ -471,8 +494,12 @@ return Api.genericInterface(res) }).then(response => { if (!response) return - // 鍥炶皟璇锋眰 + if (response.status) { + response.data.forEach(_item => { + _list.push({data: _item, count: response.printCount}) + }) + // 涓�娆¤姹傛垚鍔燂紝杩涜涓嬩竴椤硅姹� if (params.length === 0) { _resolve({next: 'getTemp', list: _list}) @@ -494,7 +521,9 @@ Api.genericInterface(param).then(res => { if (res.status) { - _list.push(res.data) + res.data.forEach(_item => { + _list.push({data: _item, count: res.printCount}) + }) if (params.length === 0) { _resolve({next: 'getTemp', list: _list}) @@ -526,11 +555,17 @@ error = '鎵撳嵃妯℃澘瑙f瀽閿欒锛�' } else { let control = configParam.elements.map(element => { + let _field = element.field + + if (_field === 'other_field') { + _field = element.cusfield || '' + } + let item = { Name: element.name || '', Type: element.type, Value: element.value || '', - Field: element.field || '', + Field: _field, Left: element.left, Top: element.top, Width: element.width, @@ -1333,6 +1368,38 @@ btnloading: false }) } else { + if (_LongParam.groups.length > 0) { + _LongParam.groups.forEach(group => { + group.sublist = group.sublist.filter(cell => { + if (!cell.blacklist || cell.blacklist.length === 0) return true + + let _black = cell.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) { + return false + } else { + return true + } + }) + }) + } else { + _LongParam.fields = _LongParam.fields.filter(cell => { + if (!cell.blacklist || cell.blacklist.length === 0) return true + + let _black = cell.blacklist.filter(v => { + return this.props.permRoles.indexOf(v) !== -1 + }) + + if (_black.length > 0) { + return false + } else { + return true + } + }) + } + this.setState({ configMap: {...configMap, [action.uuid]: _LongParam}, execAction: {..._LongParam, ...execAction} -- Gitblit v1.8.0