Commit 394bf9ae authored by TZW's avatar TZW

cc

parent b61e13e4
...@@ -11,6 +11,10 @@ const { Item } = ProDescriptions; ...@@ -11,6 +11,10 @@ const { Item } = ProDescriptions;
function DetailPro(props) { function DetailPro(props) {
let { fields } = props; let { fields } = props;
if (Object.keys(fields[0]).includes('render')) {
delete fields[0].render;
}
const [curitem, setcuritem] = useState(props.detailData ?? {}); //全部数据 const [curitem, setcuritem] = useState(props.detailData ?? {}); //全部数据
const dataProps = useMemo(() => { const dataProps = useMemo(() => {
......
...@@ -21,6 +21,8 @@ const EditTable = (props) => { ...@@ -21,6 +21,8 @@ const EditTable = (props) => {
dataSource, dataSource,
} = props; } = props;
let actionRefs = useRef(), let actionRefs = useRef(),
formRefs = formRef ?? useRef(), formRefs = formRef ?? useRef(),
ifspagination = pagination == 'false' || pagination === false, ifspagination = pagination == 'false' || pagination === false,
...@@ -34,9 +36,9 @@ const EditTable = (props) => { ...@@ -34,9 +36,9 @@ const EditTable = (props) => {
success: true, success: true,
total: dataSource?.length ?? 0, total: dataSource?.length ?? 0,
}; };
console.log('===================================='); // console.log('====================================');
console.log(extraparams); // console.log(extraparams);
console.log('===================================='); // console.log('====================================');
let newparams = { let newparams = {
...params, ...params,
...extraparams, //父组件传参 ...extraparams, //父组件传参
......
...@@ -183,7 +183,6 @@ let FormRender = memo(({ fields = [], name, curindex, formRef }) => { ...@@ -183,7 +183,6 @@ let FormRender = memo(({ fields = [], name, curindex, formRef }) => {
// colProps 默认删格 // colProps 默认删格
function Input({ item, colProps }) { function Input({ item, colProps }) {
let keys = item?.key ?? item?.dataIndex ?? ''; let keys = item?.key ?? item?.dataIndex ?? '';
keys = keys ?? '';
const defaultrule = const defaultrule =
keys.indexOf('phone') != -1 keys.indexOf('phone') != -1
? { ? {
...@@ -1448,7 +1447,7 @@ function Expandable({ item, colProps }) { ...@@ -1448,7 +1447,7 @@ function Expandable({ item, colProps }) {
return ( return (
<Col {...col} style={{ marginBottom: 16 }}> <Col {...col} style={{ marginBottom: 16 }}>
<ProForm.Item name={curkey} label={item.title} {...item.formItemProps}> <ProForm.Item name={curkey} label={item.title} {...item.formItemProps}>
<Expandables item={item} /> <Expandables item={item} key={item} />
</ProForm.Item> </ProForm.Item>
</Col> </Col>
); );
...@@ -1487,13 +1486,72 @@ function FormList({ item, colProps, formRef }) { ...@@ -1487,13 +1486,72 @@ function FormList({ item, colProps, formRef }) {
); );
} }
const Todo = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => { const Todo = ({ actionRef, value = [], item, params, rowKey, chooses, onChange }) => {
return (
<>
<EditTable
// loading={false}
actionRef={actionRef}
defaultValue={value} //调用接口合并初始值
path={item.path}
extraparams={params ?? {}}
rowKey={rowKey}
key={value}
columns={item.columns}
resizeable={false}
alwaysShowAlert={false}
tableAlertRender={false}
tableAlertOptionRender={false}
rowClassName={(record, index) => {
if (chooses.includes(record[rowKey])) {
return 'lightblue';
} else {
return '';
}
}}
rowSelection={{
...item.rowSelection,
columnWidth: 44,
preserveSelectedRowKeys: true,
selectedRowKeys: value && value?.map((it) => it[rowKey]),
onChange: (selectedKeys, selectedRows) => {
// console.log('row', selectedRows, 'selectkey:', selectedKeys);
// console.log('value:', value);
const rowkeylist = value ? value?.map((it) => it[rowKey]) : [];
// console.log('rowkeyList:', rowkeylist);
const newValue = selectedRows?.map((its) => {
if (rowkeylist.includes(its[rowKey])) {
return value.filter((it) => it[rowKey] == its[rowKey])[0];
} else {
return its;
}
});
// console.log('newValue:', newValue);
onChange(newValue);
},
}}
editable={{
onValuesChange: (record, recordList) => {
const newValue = value?.map((its) => {
if (its[rowKey] == record[rowKey]) {
return record;
} else {
return its;
}
});
// console.log('edit-newvalue:', newValue);
onChange(newValue);
},
}}
/>
</>
);
};
const Done = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => {
return ( return (
<EditTable <EditTable
actionRef={actionRef} value={value}
defaultValue={value} //调用接口合并初始值
path={item.path}
extraparams={params ?? {}}
rowKey={rowKey} rowKey={rowKey}
columns={item.columns} columns={item.columns}
resizeable={false} resizeable={false}
...@@ -1540,54 +1598,6 @@ const Todo = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => ...@@ -1540,54 +1598,6 @@ const Todo = ({ actionRef, value, item, params, rowKey, chooses, onChange }) =>
); );
}; };
const Done = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => (
<EditTable
value={value}
rowKey={rowKey}
columns={item.columns}
resizeable={false}
alwaysShowAlert={false}
tableAlertRender={false}
tableAlertOptionRender={false}
rowClassName={(record, index) => {
if (chooses.includes(record[rowKey])) {
return 'lightblue';
} else {
return '';
}
}}
rowSelection={{
...item.rowSelection,
columnWidth: 44,
preserveSelectedRowKeys: true,
selectedRowKeys: value && value?.map((it) => it[rowKey]),
onChange: (selectedKeys, selectedRows) => {
const rowkeylist = value ? value?.map((it) => it[rowKey]) : [];
const newValue = selectedRows?.map((its) => {
if (rowkeylist.includes(its[rowKey])) {
return value.filter((it) => it[rowKey] == its[rowKey])[0];
} else {
return its;
}
});
onChange(newValue);
},
}}
editable={{
onValuesChange: (record, recordList) => {
const newValue = value?.map((its) => {
if (its[rowKey] == record[rowKey]) {
return record;
} else {
return its;
}
});
onChange(newValue);
},
}}
/>
);
function TableSelect({ item, value, onChange, params = {} }) { function TableSelect({ item, value, onChange, params = {} }) {
const rowKey = item?.rowKey ?? 'id'; const rowKey = item?.rowKey ?? 'id';
const [chooses, setchooses] = useState([]); //mark 标记 const [chooses, setchooses] = useState([]); //mark 标记
......
...@@ -15,6 +15,7 @@ import FormItems from './FormItems'; ...@@ -15,6 +15,7 @@ import FormItems from './FormItems';
import ExtendField from '@/components/ExtendField'; import ExtendField from '@/components/ExtendField';
import { Input, Col } from 'antd'; import { Input, Col } from 'antd';
import { useDebounceFn } from 'ahooks'; import { useDebounceFn } from 'ahooks';
import ColumnsTrans from './ColumnsTrans';
function upperCase(str) { function upperCase(str) {
const newStr = str.slice(0, 1).toUpperCase() + str.slice(1); const newStr = str.slice(0, 1).toUpperCase() + str.slice(1);
...@@ -119,7 +120,9 @@ function InitForm(props) { ...@@ -119,7 +120,9 @@ function InitForm(props) {
const { run } = useDebounceFn(onFinish, { wait: 400 }); const { run } = useDebounceFn(onFinish, { wait: 400 });
let proformRef = useRef(); let proformRef = useRef();
proformRef = formRef ?? proformRef; proformRef = formRef ?? proformRef;
return ( return fields?.length == 0 ? (
<ColumnsTrans />
) : (
<ProForm <ProForm
style={{ overflow: 'hidden', ...style }} style={{ overflow: 'hidden', ...style }}
formRef={proformRef} formRef={proformRef}
......
...@@ -21,6 +21,7 @@ function getcolumns(setdrawer) { ...@@ -21,6 +21,7 @@ function getcolumns(setdrawer) {
hideInSearch: true, hideInSearch: true,
valueType: 'digit', valueType: 'digit',
fieldProps: { fieldProps: {
defaultValue:0,
precision: 0, precision: 0,
}, },
formItemProps: { formItemProps: {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-12-02 11:41:03 * @Date: 2022-12-02 11:41:03
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2023-02-27 17:17:41 * @Last Modified time: 2023-03-07 11:34:10
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -991,6 +991,7 @@ function Failure(props) { ...@@ -991,6 +991,7 @@ function Failure(props) {
} }
}} }}
onFinish={async (vals) => { onFinish={async (vals) => {
console.log(vals);
let params = { let params = {
repairComplete: { repairComplete: {
faultType: vals.faultSettingId, faultType: vals.faultSettingId,
...@@ -1655,7 +1656,7 @@ function Failure(props) { ...@@ -1655,7 +1656,7 @@ function Failure(props) {
detail: ( detail: (
<Detail <Detail
title="维修单号" title="维修单号"
titleno={drawer?.item?.repairNo} titleno={drawer?.item?.repairOrderNo}
detailpath="/repair/umRepairOperation/queryOperationList" detailpath="/repair/umRepairOperation/queryOperationList"
params={{ repairOrderId: drawer?.item?.id }} params={{ repairOrderId: drawer?.item?.id }}
baseRow={drawer?.item} baseRow={drawer?.item}
......
...@@ -124,10 +124,10 @@ function getcolumns(setDrawer, ifs, formRef) { ...@@ -124,10 +124,10 @@ function getcolumns(setDrawer, ifs, formRef) {
dataIndex: 'pictureUrl', dataIndex: 'pictureUrl',
key: 'pictureUrl', key: 'pictureUrl',
render: (text, row) => { render: (text, row) => {
if (row?.pictureUrl == null) { if (row?.userImgList == null || row?.userImgList.length == 0) {
return '暂无图片'; return '暂无图片';
} else { } else {
return <Image width={70} src={row.pictureUrl} />; return <Image width={70} src={row.userImgList[0]?.url} />;
} }
}, },
}, },
......
...@@ -151,38 +151,38 @@ function getcolumns(setdrawer) { ...@@ -151,38 +151,38 @@ function getcolumns(setdrawer) {
hideInSearch: true, hideInSearch: true,
hideInTable: true, hideInTable: true,
}, },
{ // {
title: '供应商信息', // title: '供应商信息',
dataIndex: 'relations', // dataIndex: 'relations',
key: 'relations', // key: 'relations',
valueType: 'split', // valueType: 'split',
}, // },
{ // {
// title: '供应商', // // title: '供应商',
dataIndex: 'relationSupplierList', // dataIndex: 'relationSupplierList',
key: 'relationSupplierList', // key: 'relationSupplierList',
valueType: 'formSelectList', // valueType: 'formSelectList',
colProps: { // colProps: {
span: 24, // span: 24,
}, // },
columns, // columns,
span: 12, // span: 12,
path: '/sparepart/sparePartSupplier/queryList', // path: '/sparepart/sparePartSupplier/queryList',
params: { status: 1 }, // params: { status: 1 },
hideInSearch: true, // hideInSearch: true,
hideInTable: true, // hideInTable: true,
render: (text, row) => { // render: (text, row) => {
return ( // return (
<AutoTable // <AutoTable
columns={columns?.map((it) => ({ // columns={columns?.map((it) => ({
...it, // ...it,
hideInSearch: true, // hideInSearch: true,
}))} // }))}
dataSource={row?.relationSupplierList} // dataSource={row?.relationSupplierList}
/> // />
); // );
}, // },
}, // },
], ],
pathconfig: { pathconfig: {
enableadd: true, enableadd: true,
......
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