From 137fb8ea6af2789b3238b22bac31d80bced41dfe Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 28 七月 2021 11:39:39 +0800 Subject: [PATCH] 2021-07-28 --- src/tabviews/zshare/normalTable/index.jsx | 55 +++++++++++++++++++++++++------------------------------ 1 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 3746355..aa989fb 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -17,6 +17,7 @@ const PopupButton = asyncComponent(() => import('@/tabviews/zshare/actionList/popupbutton')) const TabButton = asyncComponent(() => import('@/tabviews/zshare/actionList/tabbutton')) const NewPageButton = asyncComponent(() => import('@/tabviews/zshare/actionList/newpagebutton')) +const ImgScale = asyncComponent(() => import('@/tabviews/zshare/imgScale')) class NormalTable extends Component { static propTpyes = { @@ -45,7 +46,7 @@ pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 columns: null, // 鏄剧ず鍒� imgShow: false, // 鍥剧墖鏀惧ぇ妯℃�佹 - imgSrc: '', // 鍥剧墖璺緞 + imgData: {}, // 鍥剧墖闆� lineMarks: null, // 琛屾爣璁� activeIndex: null, // 鏍囪褰撳墠閫変腑琛� rowspans: null // 琛屽悎骞跺瓧娈典俊鎭� @@ -139,7 +140,10 @@ if (item.rowspan === 'true') { rowspans.push(item.field) } - if (_format && !Math.floor(Math.random() * radio)) { + if (item.type === 'index') { + item.field = '$Index' + item.type = 'text' + } else if (_format && !Math.floor(Math.random() * radio)) { item.blur = true } @@ -165,14 +169,6 @@ render: (text, record) => { return this.getContent(item, record) } - } - } - - if (item.fixed === true || item.fixed === 'true') { - if (index < columns.length / 2) { - cell.fixed = 'left' - } else { - cell.fixed = 'right' } } @@ -552,7 +548,7 @@ let photos = '' if (item.field && record.hasOwnProperty(item.field)) { photos = record[item.field] + '' - photos = photos.split(',') + photos = photos.split(',').filter(Boolean) } else { photos = '' } @@ -562,7 +558,7 @@ <div className="picture-col"> {photos && photos.map((url, i) => { if (item.scale === 'true') { - return <img style={{maxHeight: maxHeight}} className="image-scale" onClick={this.imgScale} key={`${i}`} src={url} alt=""/> + return <img style={{maxHeight: maxHeight}} className="image-scale" onClick={() => this.imgScale(photos, i)} key={`${i}`} src={url} alt=""/> } else { return <img style={{maxHeight: maxHeight}} key={`${i}`} src={url} alt=""/> } @@ -738,7 +734,7 @@ let photos = [] try { photos = record[col.field] + '' - photos = photos.split(',') + photos = photos.split(',').filter(Boolean) } catch { photos = [] } @@ -874,9 +870,8 @@ <div className="content-fence"> <div className="content-fence-top" style={images[0] ? {textAlign: images[0].align} : null}> {images.map((_img, index) => { - if (!_img.url) return '' if (_img.scale) { - return <img style={{maxHeight: _img.maxHeight}} className="image-scale" onClick={this.imgScale} key={`${index}`} src={_img.url} alt=""/> + return <img style={{maxHeight: _img.maxHeight}} className="image-scale" onClick={() => this.imgScale(images, index)} key={`${index}`} src={_img.url} alt=""/> } else { return (<img style={{maxHeight: _img.maxHeight}} key={`${index}`} src={_img.url} alt=""/>) } @@ -894,9 +889,8 @@ <div className="content-fence"> <div className="content-fence-left" style={images[0] ? {textAlign: images[0].align} : null}> {images.map((_img, index) => { - if (!_img.url) return '' if (_img.scale) { - return <img style={{maxHeight: _img.maxHeight}} className="image-scale" onClick={this.imgScale} key={`${index}`} src={_img.url} alt=""/> + return <img style={{maxHeight: _img.maxHeight}} className="image-scale" onClick={() => this.imgScale(images, index)} key={`${index}`} src={_img.url} alt=""/> } else { return (<img style={{maxHeight: _img.maxHeight}} key={`${index}`} src={_img.url} alt=""/>) } @@ -915,18 +909,19 @@ /** * @description 鍥剧墖缂╂斁 */ - imgScaleClose = () => { + imgScale = (images, index) => { this.setState({ - imgShow: false + imgShow: true, + imgData: { + list: images.map(item => { + if (typeof(item) === 'string') { + return item + } + return item.url + }), + index + } }) - } - imgScale = (e) => { - if (e.target.nodeName === 'IMG') { - this.setState({ - imgShow: true, - imgSrc: e.target.src - }) - } } /** @@ -1242,12 +1237,12 @@ visible={this.state.imgShow} width="70vw" maskClosable={true} - onCancel={this.imgScaleClose} + onCancel={() => {this.setState({ imgShow: false })}} title={this.props.dict['main.form.picture.check']} - footer={[<span key="close" onClick={this.imgScaleClose}>{this.props.dict['main.close']}</span>]} + footer={[<span key="close" onClick={() => {this.setState({ imgShow: false })}}>{this.props.dict['main.close']}</span>]} destroyOnClose > - <img style={{maxWidth:'100%'}} src={this.state.imgSrc} alt="" /> + <ImgScale data={this.state.imgData}/> </Modal> </div> ) -- Gitblit v1.8.0