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, //父组件传参
......
import { doFetch } from '@/utils/doFetch'; import { doFetch } from '@/utils/doFetch';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect, useForceUpdate } from 'react';
import AutoTable from '../../AutoTable/mtable'; import AutoTable from '../../AutoTable/mtable';
import EditTable from '../EditTable'; import EditTable from '../EditTable';
function Expandables({ value = [], onChange, item }) { function Expandables({ value = [], onChange, item }) {
const [allDatasource, setallDatasource] = useState({}); const [allDatasource, setallDatasource] = useState({});
const [nvalue, setnvalue] = useState([]);
return ( return (
<div> <div>
<AutoTable <AutoTable
...@@ -21,6 +21,7 @@ function Expandables({ value = [], onChange, item }) { ...@@ -21,6 +21,7 @@ function Expandables({ value = [], onChange, item }) {
? value.filter((it) => it.lifePieceAccountId == record.id)?.[0] ? value.filter((it) => it.lifePieceAccountId == record.id)?.[0]
: {}; : {};
//value中的list //value中的list
let curvalist = curvalue?.lineStockUseList ?? []; let curvalist = curvalue?.lineStockUseList ?? [];
doFetch({ url: item.expandablePath, params: { lifePieceAccountId: record.id } }).then( doFetch({ url: item.expandablePath, params: { lifePieceAccountId: record.id } }).then(
(res) => { (res) => {
...@@ -47,12 +48,29 @@ function Expandables({ value = [], onChange, item }) { ...@@ -47,12 +48,29 @@ function Expandables({ value = [], onChange, item }) {
let curvalue = value let curvalue = value
? value.filter((it) => it.lifePieceAccountId == record.id)?.[0] ? value.filter((it) => it.lifePieceAccountId == record.id)?.[0]
: {}; : {};
// console.log('nvalue', nvalue);
// console.log('record', record);
// console.log('allDatasource:', allDatasource);
// console.log(
// 'defaultvalue:',
// nvalue?.filter((it) => it.lifePieceAccountId == record.id)?.[0]?.lineStockUseList,
// );
return ( return (
<>
<EditTable <EditTable
key={nvalue
.filter((it) => it.lifePieceAccountId == record.id)?.[0]
?.lineStockUseList.map((it) => it.lineStockId)}
resizeable={false} resizeable={false}
alwaysShowAlert={false} alwaysShowAlert={false}
tableAlertRender={false} tableAlertRender={false}
tableAlertOptionRender={false} tableAlertOptionRender={false}
defaultValue={nvalue
?.filter((it) => it.lifePieceAccountId == record.id)?.[0]
?.lineStockUseList.map((i) => ({
id: i.lineStockId,
operateNum: i.operateNum,
}))}
columns={[ columns={[
{ {
title: '线边库', title: '线边库',
...@@ -108,8 +126,9 @@ function Expandables({ value = [], onChange, item }) { ...@@ -108,8 +126,9 @@ function Expandables({ value = [], onChange, item }) {
selectedRowKeys: curvalue?.lineStockUseList selectedRowKeys: curvalue?.lineStockUseList
? curvalue.lineStockUseList?.map?.((it) => it?.lineStockId) ? curvalue.lineStockUseList?.map?.((it) => it?.lineStockId)
: [], : [],
onChange: (selectedKeys, selectedRows) => { onChange: async (selectedKeys, selectedRows) => {
// debugger; // debugger;
const curval = curvalue?.lineStockUseList ?? []; const curval = curvalue?.lineStockUseList ?? [];
const rowkeylist = curval?.map?.((it) => it?.lineStockId); const rowkeylist = curval?.map?.((it) => it?.lineStockId);
...@@ -138,11 +157,14 @@ function Expandables({ value = [], onChange, item }) { ...@@ -138,11 +157,14 @@ function Expandables({ value = [], onChange, item }) {
lineStockUseList: newValue, lineStockUseList: newValue,
}); });
} }
onChange(nvalue); // console.log('nvalue', nvalue);
nvalue = nvalue.filter((it) => it.lineStockUseList.length !== 0);
await onChange(nvalue);
await setnvalue(nvalue);
}, },
}} }}
editable={{ editable={{
onValuesChange: (rower, recordList) => { onValuesChange: async (rower, recordList) => {
const curval = curvalue?.lineStockUseList ?? []; const curval = curvalue?.lineStockUseList ?? [];
const newValue = curval?.map((its) => { const newValue = curval?.map((its) => {
if (its?.lineStockId == rower?.id) { if (its?.lineStockId == rower?.id) {
...@@ -164,14 +186,17 @@ function Expandables({ value = [], onChange, item }) { ...@@ -164,14 +186,17 @@ function Expandables({ value = [], onChange, item }) {
}); });
} else { } else {
nvalue.push({ nvalue.push({
id: record.id, lifePieceAccountId: record.id,
lineStockUseList: newValue, lineStockUseList: newValue,
}); });
} }
onChange(nvalue); // console.log('nvalue', nvalue);
await onChange(nvalue);
await setnvalue(nvalue);
}, },
}} }}
/> />
</>
); );
}, },
}} }}
......
...@@ -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,14 +1486,17 @@ function FormList({ item, colProps, formRef }) { ...@@ -1487,14 +1486,17 @@ function FormList({ item, colProps, formRef }) {
); );
} }
const Todo = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => { const Todo = ({ actionRef, value = [], item, params, rowKey, chooses, onChange }) => {
return ( return (
<>
<EditTable <EditTable
// loading={false}
actionRef={actionRef} actionRef={actionRef}
defaultValue={value} //调用接口合并初始值 defaultValue={value} //调用接口合并初始值
path={item.path} path={item.path}
extraparams={params ?? {}} extraparams={params ?? {}}
rowKey={rowKey} rowKey={rowKey}
key={value}
columns={item.columns} columns={item.columns}
resizeable={false} resizeable={false}
alwaysShowAlert={false} alwaysShowAlert={false}
...@@ -1513,7 +1515,10 @@ const Todo = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => ...@@ -1513,7 +1515,10 @@ const Todo = ({ actionRef, value, item, params, rowKey, chooses, onChange }) =>
preserveSelectedRowKeys: true, preserveSelectedRowKeys: true,
selectedRowKeys: value && value?.map((it) => it[rowKey]), selectedRowKeys: value && value?.map((it) => it[rowKey]),
onChange: (selectedKeys, selectedRows) => { onChange: (selectedKeys, selectedRows) => {
// console.log('row', selectedRows, 'selectkey:', selectedKeys);
// console.log('value:', value);
const rowkeylist = value ? value?.map((it) => it[rowKey]) : []; const rowkeylist = value ? value?.map((it) => it[rowKey]) : [];
// console.log('rowkeyList:', rowkeylist);
const newValue = selectedRows?.map((its) => { const newValue = selectedRows?.map((its) => {
if (rowkeylist.includes(its[rowKey])) { if (rowkeylist.includes(its[rowKey])) {
return value.filter((it) => it[rowKey] == its[rowKey])[0]; return value.filter((it) => it[rowKey] == its[rowKey])[0];
...@@ -1521,6 +1526,7 @@ const Todo = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => ...@@ -1521,6 +1526,7 @@ const Todo = ({ actionRef, value, item, params, rowKey, chooses, onChange }) =>
return its; return its;
} }
}); });
// console.log('newValue:', newValue);
onChange(newValue); onChange(newValue);
}, },
}} }}
...@@ -1533,14 +1539,17 @@ const Todo = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => ...@@ -1533,14 +1539,17 @@ const Todo = ({ actionRef, value, item, params, rowKey, chooses, onChange }) =>
return its; return its;
} }
}); });
// console.log('edit-newvalue:', newValue);
onChange(newValue); onChange(newValue);
}, },
}} }}
/> />
</>
); );
}; };
const Done = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => ( const Done = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => {
return (
<EditTable <EditTable
value={value} value={value}
rowKey={rowKey} rowKey={rowKey}
...@@ -1586,7 +1595,8 @@ const Done = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => ...@@ -1586,7 +1595,8 @@ const Done = ({ actionRef, value, item, params, rowKey, chooses, onChange }) =>
}, },
}} }}
/> />
); );
};
function TableSelect({ item, value, onChange, params = {} }) { function TableSelect({ item, value, onChange, params = {} }) {
const rowKey = item?.rowKey ?? 'id'; const rowKey = item?.rowKey ?? 'id';
......
...@@ -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