Commit bec6748f authored by TZW's avatar TZW

qwe

parent 526cfa36
...@@ -1314,6 +1314,7 @@ function Diyrules({ item, colProps, formRef }) { ...@@ -1314,6 +1314,7 @@ function Diyrules({ item, colProps, formRef }) {
<Col {...col}> <Col {...col}>
<ProForm.Item <ProForm.Item
convertValue={(value) => { convertValue={(value) => {
console.log(value);
if (value?.other) return value; if (value?.other) return value;
let nrList = { let nrList = {
other: {}, other: {},
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44 * @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-14 16:38:10 * @Last Modified time: 2022-12-14 18:27:22
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -14,6 +14,7 @@ import getcolumns from './columns'; ...@@ -14,6 +14,7 @@ import getcolumns from './columns';
import { doFetch } from '@/utils/doFetch'; import { doFetch } from '@/utils/doFetch';
import { message } from 'antd'; import { message } from 'antd';
import AddRules from './AddRules'; import AddRules from './AddRules';
import _ from 'lodash';
function Rules(props) { function Rules(props) {
const actionRef = useRef(), const actionRef = useRef(),
...@@ -51,7 +52,7 @@ function Rules(props) { ...@@ -51,7 +52,7 @@ function Rules(props) {
); );
}; };
const edit = (text, row, _, action) => { const edit = (text, row, i, action) => {
return ( return (
<PremButton <PremButton
btn={{ btn={{
...@@ -65,16 +66,40 @@ function Rules(props) { ...@@ -65,16 +66,40 @@ function Rules(props) {
title: '编辑', title: '编辑',
val: 'edit', val: 'edit',
onFinish: async (vals) => { onFinish: async (vals) => {
let params = { vals.nrList.other = _.pick(vals.nrList.other, [
...vals, 'formatType',
id: row.id, 'increaseList',
}; 'noRuleCode',
'sort',
]);
vals.nrList.value = vals.nrList.value.map((it) => {
return _.pick(it, ['id', 'noContent', 'noRuleCode', 'sort', 'paramList']);
});
console.log('1214', vals);
let params = { ...vals };
params.nrList = [];
params.nrList = params.nrList.concat(vals?.nrList.value);
if (vals?.nrList.other.sort) {
vals.nrList.other.increaseList = Array.from(
Array(vals?.nrList.value.length + 1),
(_, index) => index + 1,
).filter((it) => it !== vals?.nrList.other.sort + 1);
params.nrList.splice(vals?.nrList.other.sort, 0, vals?.nrList.other);
params.nrList.forEach((it, i) => {
it.sort = i + 1;
});
} else {
message.warning('请选择顺序递增规则的位置!');
return;
}
params.id = row?.id;
console.log('11111', params);
let res = await doFetch({ let res = await doFetch({
url: urlParams.save, url: urlParams.save,
params, params,
}); });
if (res.code === '0000') { if (res.code === '0000') {
message.success('新增成功!'); message.success('编辑成功!');
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
...@@ -154,10 +179,8 @@ function Rules(props) { ...@@ -154,10 +179,8 @@ function Rules(props) {
title: '新增', title: '新增',
val: 'add', val: 'add',
onFinish: async (vals) => { onFinish: async (vals) => {
console.log('vals:', vals); console.log('myvals:', vals);
let params = { let params = { ...vals };
...vals,
};
//console.log('vals:', vals); //console.log('vals:', vals);
// for (let i in vals) { // for (let i in vals) {
// if (i == 'nrList') { // if (i == 'nrList') {
...@@ -188,7 +211,6 @@ function Rules(props) { ...@@ -188,7 +211,6 @@ function Rules(props) {
message.warning('请选择顺序递增规则的位置!'); message.warning('请选择顺序递增规则的位置!');
return; return;
} }
//console.log('11111', params);
let res = await doFetch({ let res = await doFetch({
url: urlParams.save, url: urlParams.save,
params, params,
......
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