Commit bec6748f authored by TZW's avatar TZW

qwe

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