Commit 394bf9ae authored by TZW's avatar TZW

cc

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