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