Commit b674812c authored by TZW's avatar TZW

bug

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