Commit b674812c authored by TZW's avatar TZW

bug

parent 7d3039fe
......@@ -136,6 +136,7 @@ function getcolumns(ifs) {
],
},
search: false,
precision: 0,
},
];
}
......
......@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-19 11:25:53
* @Last Modified time: 2023-01-13 17:07:03
*/
import * as React from 'react';
......@@ -26,7 +26,6 @@ function Field(props) {
visible: false,
}),
[items, setitems] = useState([]),
[extraparams, setextraparams] = useState({}),
urlParams = {
save: '/base/paFormField/save',
remove: '/base/paFormField/delete',
......@@ -43,7 +42,7 @@ function Field(props) {
});
//console.log(result);
if (!result?.data?.dataList.length == 0) {
setitems(
await setitems(
result?.data?.dataList.map((it, index) => {
return {
key: it.id,
......@@ -51,7 +50,7 @@ function Field(props) {
};
}),
);
setDrawer((s) => ({
await setDrawer((s) => ({
...s,
formName: result?.data?.dataList[0]?.formName,
formId: result?.data?.dataList[0]?.id,
......@@ -60,41 +59,42 @@ function Field(props) {
};
fn();
}, []);
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
console.log(drawer);
setDrawer((s) => ({
...s,
visible: true,
title: '编辑',
fields: getcolumns(true),
val: 'edit',
// detailpath: urlParams.detail,
// params: { id: row.id },
item: {
...row,
formName: s?.formName,
fieldChar: String(row?.fieldChar),
formName: drawer?.formName,
formId: drawer?.formId,
// formId: s?.formId,
},
fields: getcolumns(true),
val: 'edit',
// detailpath: urlParams.detail,
// params: { id: row.id },
onFinish: async (vals) => {
//console.log(vals);
console.log(vals);
let params = {
...vals,
id: row.id,
id: row?.id,
formId: drawer?.formId,
};
delete params.formName;
console.log(params);
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('新增成功!');
message.success('编辑成功!');
setDrawer((s) => ({
...s,
visible: false,
......@@ -142,14 +142,13 @@ function Field(props) {
const columns = useMemo(() => {
let defcolumn = getcolumns(setDrawer);
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 200,
render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)],
});
}, []);
}, [drawer?.formId]);
return (
<div style={{ position: 'relative' }}>
......@@ -175,11 +174,7 @@ function Field(props) {
</h3>
<Menu
onClick={async (e) => {
// //console.log(e);
setextraparams({
formId: e?.key,
});
setDrawer((s) => ({
await setDrawer((s) => ({
...s,
formName: items.filter((it) => it?.key == e?.key)[0].label,
formId: e?.key,
......@@ -199,7 +194,7 @@ function Field(props) {
pagetitle={<h3 style={{ marginBottom: 0, fontWeight: 400 }}>字段信息</h3>}
columns={columns}
path={urlParams.list}
params={{ formId: '1' }}
extraparams={{ formId: drawer?.formId }}
actionRef={actionRef}
pageextra={'add'}
resizeable={false}
......@@ -246,7 +241,6 @@ function Field(props) {
},
}}
// x={1500}
extraparams={extraparams}
/>
</Content>
</Layout>
......@@ -259,9 +253,6 @@ function Field(props) {
setDrawer((s) => ({
...s,
visible: false,
item: null,
detailpath: null,
params: null,
}));
}}
{...drawer}
......
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