Commit b4746e93 authored by TZW's avatar TZW

12021920

parent 42ac5eb4
import { useState, useEffect } from 'react';
const App = () => {
return (
<>
<div>新增</div>
</>
);
};
export default App;
......@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-12-02 11:41:03
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-02 11:41:03
* @Last Modified time: 2022-12-02 19:19:52
*/
import * as React from 'react';
......@@ -13,6 +13,7 @@ import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch';
import Addform from './Addform';
function Failure(props) {
const actionRef = useRef(),
......@@ -120,6 +121,14 @@ function Failure(props) {
return defpath;
}, [activeTabKey]);
const selectType = (type) => {
switch (type) {
case 'add':
return <Addform />;
default:
break;
}
};
return (
<div style={{ position: 'relative' }}>
<AutoTable
......@@ -140,7 +149,8 @@ function Failure(props) {
open: true,
item: null,
title: '新增',
val: 'add',
val: 'only',
type: 'add',
}));
},
},
......@@ -174,7 +184,9 @@ function Failure(props) {
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
}
}}
/>
>
{selectType(drawer?.type)}
</DrawerPro>
</div>
);
}
......
......@@ -9,7 +9,7 @@ function getcolumns(setdrawer) {
formItemProps: {
rules: [
{
required: false,
required: true,
message: '此项为必填项',
},
],
......
......@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-02 11:00:31
* @Last Modified time: 2022-12-02 18:35:26
*/
import * as React from 'react';
......@@ -24,7 +24,7 @@ function Rules(props) {
const urlParams = {
save: '/base/bmNumberRule/save',
remove: '/auth/sysFactory/delete',
remove: '/base/bmNumberRule/deleteByNoTypeId',
list: '/base/bmNumberRule/queryList',
detail: '/base/bmNumberRule/queryByNoTypeId',
};
......@@ -60,7 +60,8 @@ function Rules(props) {
setDrawer((s) => ({
...s,
visible: true,
item: row,
detailpath: urlParams.detail,
params: { noTypeId: row?.id },
title: '编辑',
val: 'edit',
onFinish: async (vals) => {
......@@ -154,10 +155,40 @@ function Rules(props) {
title: '新增',
val: 'add',
onFinish: async (vals) => {
console.log(1);
let params = {
...vals,
};
console.log('vals:', vals);
// for (let i in vals) {
// if (i == 'nrList') {
// let reshow = {
// value: vals[i].filter((it) => it.noRuleCode != 'increasing_order'),
// other: vals[i].filter((it) => it.noRuleCode == 'increasing_order')[0] || {},
// };
// reshow.other.increaseList = reshow.other.increaseList.maps((it) => {
// return reshow.value.filter((item) => item.sort == it)[0].id;
// });
// reshow.other.sort =
// reshow.other.sort == 1 ? reshow.other.sort : reshow.other.sort - 1;
// console.log('reshow', reshow);
// }
// }
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;
}
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