Commit a27b111127850157391a4035d2b4bdd61608dc23

Authored by Min
1 parent 6bca754b

1.commonList不允许输入

src/components/Common/CommonTable/index.js
@@ -840,7 +840,7 @@ class CommonTableRc extends React.Component { @@ -840,7 +840,7 @@ class CommonTableRc extends React.Component {
840 'div': target.getAttribute('data-name') ? target : target.childNodes[0], 840 'div': target.getAttribute('data-name') ? target : target.childNodes[0],
841 'input': target, 841 'input': target,
842 }[tagName.toLowerCase()]; 842 }[tagName.toLowerCase()];
843 - 843 +
844 if (!oDiv) return; 844 if (!oDiv) return;
845 if (!oDiv.getAttribute('data-control-name')?.includes('_Sum')) return; 845 if (!oDiv.getAttribute('data-control-name')?.includes('_Sum')) return;
846 // 阻止右键菜单 846 // 阻止右键菜单
@@ -4164,7 +4164,7 @@ class CommonTableRc extends React.Component { @@ -4164,7 +4164,7 @@ class CommonTableRc extends React.Component {
4164 handleCellClick = (record) => { 4164 handleCellClick = (record) => {
4165 try { 4165 try {
4166 const { target } = event; 4166 const { target } = event;
4167 - 4167 +
4168 const { tagName } = target; 4168 const { tagName } = target;
4169 const oDiv = { 4169 const oDiv = {
4170 'span': target.getAttribute('data-name') ? target : target.parentNode, 4170 'span': target.getAttribute('data-name') ? target : target.parentNode,
@@ -4172,9 +4172,9 @@ class CommonTableRc extends React.Component { @@ -4172,9 +4172,9 @@ class CommonTableRc extends React.Component {
4172 'div': target.getAttribute('data-name') ? target : target.childNodes[0], 4172 'div': target.getAttribute('data-name') ? target : target.childNodes[0],
4173 'input': target, 4173 'input': target,
4174 }[tagName.toLowerCase()]; 4174 }[tagName.toLowerCase()];
4175 - 4175 +
4176 if (!oDiv || window.getSelection().toString()) return false; 4176 if (!oDiv || window.getSelection().toString()) return false;
4177 - 4177 +
4178 const [sName, sControlName] = [oDiv.getAttribute('data-name'), oDiv.getAttribute('data-control-name')]; 4178 const [sName, sControlName] = [oDiv.getAttribute('data-name'), oDiv.getAttribute('data-control-name')];
4179 if (sControlName?.includes('_Sum')) { 4179 if (sControlName?.includes('_Sum')) {
4180 const { sumGroup = {}, totalData = [{}], totalDataNew: totalDataNew0 = [{}] } = this.state; 4180 const { sumGroup = {}, totalData = [{}], totalDataNew: totalDataNew0 = [{}] } = this.state;
@@ -4185,7 +4185,7 @@ class CommonTableRc extends React.Component { @@ -4185,7 +4185,7 @@ class CommonTableRc extends React.Component {
4185 } else { 4185 } else {
4186 sumGroup[sName].push(record[this.rowKey]); 4186 sumGroup[sName].push(record[this.rowKey]);
4187 } 4187 }
4188 - 4188 +
4189 let totalDataNew = [...totalDataNew0]; 4189 let totalDataNew = [...totalDataNew0];
4190 if (sumGroup[sName].length) { 4190 if (sumGroup[sName].length) {
4191 const sum = sumGroup[sName].reduce((pre, cur) => { 4191 const sum = sumGroup[sName].reduce((pre, cur) => {
@@ -4201,12 +4201,12 @@ class CommonTableRc extends React.Component { @@ -4201,12 +4201,12 @@ class CommonTableRc extends React.Component {
4201 } 4201 }
4202 return pre; 4202 return pre;
4203 }, 0); 4203 }, 0);
4204 - 4204 +
4205 totalDataNew = [{ ...totalData[0], ...totalDataNew[0], [sName]: sum }]; 4205 totalDataNew = [{ ...totalData[0], ...totalDataNew[0], [sName]: sum }];
4206 } else { 4206 } else {
4207 totalDataNew[0][sName] = totalData[0][sName]; 4207 totalDataNew[0][sName] = totalData[0][sName];
4208 } 4208 }
4209 - 4209 +
4210 this.setState({ sumGroup, totalDataNew }); 4210 this.setState({ sumGroup, totalDataNew });
4211 return !this.props.enabled; 4211 return !this.props.enabled;
4212 } 4212 }
@@ -5545,8 +5545,8 @@ class CommonTableRc extends React.Component { @@ -5545,8 +5545,8 @@ class CommonTableRc extends React.Component {
5545 onKeyDown={e => this.onKeyDownDiv(e, sName)} 5545 onKeyDown={e => this.onKeyDownDiv(e, sName)}
5546 onCut={e => e.preventDefault()} 5546 onCut={e => e.preventDefault()}
5547 onPaste={e => e.preventDefault()} 5547 onPaste={e => e.preventDefault()}
5548 - suppressContentEditableWarning  
5549 - contentEditable="true" 5548 + // suppressContentEditableWarning
  5549 + // contentEditable="true"
5550 onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, isSlaveInfo ? 'slaveInfo' : this.props.name, showConfig.sName, record, index, showConfig) : null} 5550 onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, isSlaveInfo ? 'slaveInfo' : this.props.name, showConfig.sName, record, index, showConfig) : null}
5551 > {sValue}</div>} 5551 > {sValue}</div>}
5552 {bShow}{imgBox} 5552 {bShow}{imgBox}
@@ -5574,8 +5574,8 @@ class CommonTableRc extends React.Component { @@ -5574,8 +5574,8 @@ class CommonTableRc extends React.Component {
5574 onKeyDown={e => this.onKeyDownDiv(e, sName)} 5574 onKeyDown={e => this.onKeyDownDiv(e, sName)}
5575 onCut={e => e.preventDefault()} 5575 onCut={e => e.preventDefault()}
5576 onPaste={e => e.preventDefault()} 5576 onPaste={e => e.preventDefault()}
5577 - suppressContentEditableWarning  
5578 - contentEditable="true" 5577 + // suppressContentEditableWarning
  5578 + // contentEditable="true"
5579 onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, isSlaveInfo ? 'slaveInfo' : this.props.name, showConfig.sName, record, index, showConfig) : null} 5579 onClick={commonUtils.isNotEmptyObject(linkStyle) ? this.handleViewClick.bind(this, isSlaveInfo ? 'slaveInfo' : this.props.name, showConfig.sName, record, index, showConfig) : null}
5580 > {sValue}</span> 5580 > {sValue}</span>
5581 </Tooltip> 5581 </Tooltip>
@@ -5822,7 +5822,7 @@ class CommonTableRc extends React.Component { @@ -5822,7 +5822,7 @@ class CommonTableRc extends React.Component {
5822 this.hasSpanBgColor = true; 5822 this.hasSpanBgColor = true;
5823 } 5823 }
5824 5824
5825 - res = (<span 5825 + res = (<span
5826 className={`noInput readonlySpanStyle ${bReadonlyField ? "readonlyField" : ""}`} 5826 className={`noInput readonlySpanStyle ${bReadonlyField ? "readonlyField" : ""}`}
5827 style={{ color: `${cellColor}`, backgroundColor: `${backgroundColor}` }} 5827 style={{ color: `${cellColor}`, backgroundColor: `${backgroundColor}` }}
5828 data-name={showConfig.sName} 5828 data-name={showConfig.sName}
@@ -6207,7 +6207,7 @@ class CommonTableRc extends React.Component { @@ -6207,7 +6207,7 @@ class CommonTableRc extends React.Component {
6207 const { dNetMoney, dNetPrice } = this.props.app.decimals; 6207 const { dNetMoney, dNetPrice } = this.props.app.decimals;
6208 let totalDataNew = [...totalDataNew0]; 6208 let totalDataNew = [...totalDataNew0];
6209 const sumData = {}; 6209 const sumData = {};
6210 - Object.keys(sumGroup).forEach(sName => { 6210 + Object.keys(sumGroup).forEach(sName => {
6211 if (sumGroup[sName].length) { 6211 if (sumGroup[sName].length) {
6212 const sum = sumGroup[sName].reduce((pre, cur) => { 6212 const sum = sumGroup[sName].reduce((pre, cur) => {
6213 const curData = this.props.data.find(item => item[this.rowKey] === cur); 6213 const curData = this.props.data.find(item => item[this.rowKey] === cur);
@@ -6222,7 +6222,7 @@ class CommonTableRc extends React.Component { @@ -6222,7 +6222,7 @@ class CommonTableRc extends React.Component {
6222 } 6222 }
6223 return pre; 6223 return pre;
6224 }, 0); 6224 }, 0);
6225 - 6225 +
6226 sumData[sName] = sum; 6226 sumData[sName] = sum;
6227 } 6227 }
6228 }); 6228 });