Commit 06fb1ac1 authored by 皮倩雯's avatar 皮倩雯

fix: '台账编辑新增列计算规则项'

parent 7c4c8c9b
Pipeline #82018 passed with stages
/* eslint-disable no-unused-expressions */
/* eslint-disable no-lonely-if */ /* eslint-disable no-lonely-if */
/* eslint-disable no-else-return */ /* eslint-disable no-else-return */
/* eslint-disable prefer-promise-reject-errors */ /* eslint-disable prefer-promise-reject-errors */
...@@ -134,6 +135,17 @@ const BookConfigNew = props => { ...@@ -134,6 +135,17 @@ const BookConfigNew = props => {
let obj = let obj =
type === 'add' ? { ...datas, Order: maxLength } : { ...datas, Order, ID: formObj.ID }; type === 'add' ? { ...datas, Order: maxLength } : { ...datas, Order, ID: formObj.ID };
obj.LedgerFieids = tableRef.current.onFinish(); obj.LedgerFieids = tableRef.current.onFinish();
obj.LedgerFieids.forEach(i => {
if (i.ColumnCalculationRule === '无') {
i.ColumnCalculationRule = 0;
} else if (i.ColumnCalculationRule === '合计') {
i.ColumnCalculationRule = 1;
} else if (i.ColumnCalculationRule === '平均') {
i.ColumnCalculationRule = 2;
} else if (i.ColumnCalculationRule === '计数') {
i.ColumnCalculationRule = 3;
}
});
currentId ? (obj.ID = currentId) : ''; currentId ? (obj.ID = currentId) : '';
setSubmitObj(obj); setSubmitObj(obj);
Ledger_SaveLedger(obj) Ledger_SaveLedger(obj)
...@@ -428,7 +440,17 @@ const BookConfigNew = props => { ...@@ -428,7 +440,17 @@ const BookConfigNew = props => {
item.AccurateSearch = 0; item.AccurateSearch = 0;
item.LikeSearch = 0; item.LikeSearch = 0;
} }
if (item.ColumnCalculationRule === 0) {
item.ColumnCalculationRule = '无';
} else if (item.ColumnCalculationRule === 1) {
item.ColumnCalculationRule = '合计';
} else if (item.ColumnCalculationRule === 2) {
item.ColumnCalculationRule = '平均';
} else if (item.ColumnCalculationRule === 3) {
item.ColumnCalculationRule = '计数';
}
}); });
tableRef.current.setTableData(false, editArr); tableRef.current.setTableData(false, editArr);
} else { } else {
// Fields 切换表后清空台账字段和表数据 // Fields 切换表后清空台账字段和表数据
...@@ -496,6 +518,15 @@ const BookConfigNew = props => { ...@@ -496,6 +518,15 @@ const BookConfigNew = props => {
allArr.map(item => { allArr.map(item => {
tableArr.map(ele => { tableArr.map(ele => {
if (item === ele.FieldName) { if (item === ele.FieldName) {
if (ele.ColumnCalculationRule === 0) {
ele.ColumnCalculationRule = '无';
} else if (ele.ColumnCalculationRule === 1) {
ele.ColumnCalculationRule = '合计';
} else if (ele.ColumnCalculationRule === 2) {
ele.ColumnCalculationRule = '平均';
} else if (ele.ColumnCalculationRule === 3) {
ele.ColumnCalculationRule = '计数';
}
arr.push(ele); arr.push(ele);
} }
}); });
...@@ -507,6 +538,7 @@ const BookConfigNew = props => { ...@@ -507,6 +538,7 @@ const BookConfigNew = props => {
// }), // }),
arr, arr,
); );
form.setFieldsValue(obj); form.setFieldsValue(obj);
saveOutFieldsLength(prop.pickItem, allFileds); saveOutFieldsLength(prop.pickItem, allFileds);
}; };
...@@ -856,7 +888,11 @@ const BookConfigNew = props => { ...@@ -856,7 +888,11 @@ const BookConfigNew = props => {
confirmLoading={viewModalLoading} confirmLoading={viewModalLoading}
// okText= // okText=
> >
<Account ref={accountRef} accountName={form.getFieldValue('Name')} notUse={'other,edit,add,del'} /> <Account
ref={accountRef}
accountName={form.getFieldValue('Name')}
notUse={'other,edit,add,del'}
/>
</Modal> </Modal>
</Modal> </Modal>
); );
......
...@@ -191,6 +191,16 @@ const EditableCell = ({ ...@@ -191,6 +191,16 @@ const EditableCell = ({
</Select> </Select>
); );
} }
if (val === '列计算规则') {
return (
<Select ref={inputRef} onPressEnter={save} onBlur={save} showSearch>
<Select.Option value="合计">合计</Select.Option>
<Select.Option value="平均">平均</Select.Option>
<Select.Option value="计数">计数</Select.Option>
<Select.Option value="无">(无)</Select.Option>
</Select>
);
}
if (val === '字段长度') { if (val === '字段长度') {
return ( return (
<InputNumber <InputNumber
...@@ -725,6 +735,14 @@ const TableView = forwardRef((props, ref) => { ...@@ -725,6 +735,14 @@ const TableView = forwardRef((props, ref) => {
editable: true, editable: true,
align: 'center', align: 'center',
}, },
{
title: '列计算规则',
dataIndex: 'ColumnCalculationRule',
width: 100,
ellipsis: true,
editable: true,
align: 'center',
},
{ {
title: '列表对齐', title: '列表对齐',
dataIndex: 'Alignment', dataIndex: 'Alignment',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment