Commit 7fac4c55 authored by TZW's avatar TZW

formSelectList

parent 6f3552e3
......@@ -28,7 +28,6 @@ const EditTable = (props) => {
//调用接口
const request = async (params, sort, filter) => {
console.log(params);
if (!path)
return {
data: dataSource ?? [],
......
import React, { useState, useEffect } from 'react';
import AutoTable from '../../AutoTable';
import EditTable from '../EditTable';
function Expandables({ value, onChange, item }) {
console.log(value);
return (
<div>
<AutoTable
columns={item?.columns}
path={item?.path}
extraparams={item?.extraparams}
expandable={{
expandedRowRender: (record) => {
return (
<div>
<EditTable
resizeable={false}
alwaysShowAlert={false}
tableAlertRender={false}
tableAlertOptionRender={false}
columns={[
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
search: false,
editable: false,
},
{
title: '供应商名称',
dataIndex: 'supplierName',
search: false,
key: 'supplierName',
editable: false,
},
{
title: '库存数量',
dataIndex: 'actualStock',
search: false,
key: 'actualStock',
editable: false,
},
{
title: '下架数量',
dataIndex: 'operateNum',
search: false,
key: 'operateNum',
valueType: 'digit',
fieldProps: {
precision: 3,
},
},
]}
path={item?.expandablePath}
extraparams={{ lifePieceAccountId: record?.id }}
rowSelection={{
getCheckboxProps: (record) => ({
disabled: record.isAsh == '1',
}),
columnWidth: 44,
preserveSelectedRowKeys: true,
selectedRowKeys:
value && value.length > 0
? value?.filter?.((it) => it?.lifePieceAccountId == record.id)[0]
? value
?.filter?.((it) => it?.lifePieceAccountId == record.id)[0]
?.lineStockUseList?.map?.((it) => it?.lineStockId)
: []
: [],
onChange: (selectedKeys, selectedRows) => {
// debugger;
const curval =
value?.filter?.((it) => it?.lifePieceAccountId == record.id)[0]
?.lineStockUseList ?? [];
const rowkeylist =
curval && curval.length > 0 ? curval?.map((it) => it?.lineStockId) : [];
const newValue = selectedRows?.map((its) => {
if (rowkeylist?.includes(its?.id)) {
return curval?.filter((it) => it?.lineStockId == its?.id)[0];
} else {
return {
lineStockId: its.id,
operateNum: its.operateNum,
};
}
});
let nvalue = value ? [...value] : [];
if (value && value?.some((it) => it.lineStockId == record?.id)) {
nvalue = value?.map((it, i) => {
if (it.lineStockId == record.id) {
it.lineStockUseList = newValue;
}
return it;
});
} else {
nvalue.push({
id: record?.id,
lineStockUseList: newValue,
});
}
onChange(nvalue);
},
}}
editable={{
onValuesChange: (rower, recordList) => {
console.log(rower);
const curval =
value?.filter?.((it) => it?.lifePieceAccountId == record.id)[0]
?.lineStockUseList ?? [];
const newValue = curval?.map((its) => {
if (its?.lineStockId == rower?.id) {
return {
lineStockId: rower.id,
operateNum: rower.operateNum,
};
} else {
return its;
}
});
let nvalue = value ? [...value] : [];
if (value && value?.some((it) => it.id == record?.id)) {
nvalue = value?.map((it, i) => {
if (it.id == record.id) {
it.lineStockUseList = newValue;
}
return it;
});
} else {
nvalue.push({
id: record.id,
lineStockUseList: newValue,
});
}
onChange(nvalue);
},
onExpandedRowsChange: (expandedRows) => {
console.log(expandedRows);
},
}}
/>
</div>
);
},
}}
/>
</div>
);
}
export default Expandables;
......@@ -39,6 +39,7 @@ import EditTable from './EditTable';
import EditorItem from './EditorItem';
import Diyrule from './Diyrule';
import defaultSetting from '../../../config/defaultSettings';
import Expandables from './Expandable';
const {
Image,
Form,
......@@ -90,6 +91,7 @@ const FormItems = {
CheckboxItem,
RadioItem,
MyAutoComplete,
Expandable,
};
function upperCase(str) {
const newStr = str.slice(0, 1).toUpperCase() + str.slice(1);
......@@ -261,6 +263,7 @@ function MyAutoComplete({ item, colProps, formRef }) {
{...item?.fieldProps}
/>
</ProForm.Item>
{/* createElement(children,{props:value,onChange}) */}
</Col>
);
}
......@@ -1439,6 +1442,18 @@ function Diyrules({ item, colProps, formRef }) {
);
}
function Expandable({ item, colProps }) {
let col = item.colProps ?? colProps;
let curkey = item?.key ?? item?.dataIndex;
return (
<Col {...col} style={{ marginBottom: 16 }}>
<ProForm.Item name={curkey} label={item.title} {...item.formItemProps}>
<Expandables item={item} />
</ProForm.Item>
</Col>
);
}
function FormList({ item, colProps, formRef }) {
let col = item.colProps ?? colProps;
let fields = item.columns;
......
......@@ -229,6 +229,77 @@ export default (props) => {
dataIndex: 'repairContent',
key: 'repairContent',
},
{
title: '非寿命件消耗',
key: 'noLifeConsume',
valueType: 'table',
dataIndex: 'noLifeConsume',
columns: [
{
title: '备件料号',
dataIndex: 'sparePartNo',
key: 'sparePartNo',
},
{
title: '备件名称',
dataIndex: 'sparePartName',
key: 'sparePartName',
},
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
},
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
},
{
title: '消耗数量',
dataIndex: 'operateNum',
key: 'operateNum',
},
],
},
{
title: '寿命件更换',
key: 'yesLifeConsume',
valueType: 'table',
dataIndex: 'yesLifeConsume',
columns: [
{
title: '备件料号',
dataIndex: 'sparePartNo',
key: 'sparePartNo',
},
{
title: '备件名称',
dataIndex: 'sparePartName',
key: 'sparePartName',
},
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
},
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
},
{
title: '安装部位',
dataIndex: 'installPosition',
key: 'installPosition',
},
{
title: '更换数量',
dataIndex: 'operateNum',
key: 'operateNum',
},
],
},
],
4: [
{
......
......@@ -535,4 +535,10 @@ ol {
.ant-table-small {
margin: 0 !important;
}
}
.contianbox___W4bW5 {
.ant-descriptions {
margin-bottom: 24px;
}
}
\ No newline at end of file
......@@ -45,12 +45,14 @@ function Warning(props) {
dataIndex: 'sparePartNo',
key: 'sparePartNo',
span: 3,
search: false,
editable: false,
},
{
title: '备件名称',
dataIndex: 'sparePartName',
key: 'sparePartName',
search: false,
span: 3,
editable: false,
},
......@@ -103,6 +105,11 @@ function Warning(props) {
valueType: 'split',
},
{
title: (
<span style={{ color: 'rgba(0, 0, 0, 0.)', fontSize: 12, fontWeight: 400 }}>
注意:无法选择供应商未维护寿命件周期的数据
</span>
),
dataIndex: 'supplierList',
key: 'supplierList',
valueType: 'formSelectList',
......
......@@ -136,77 +136,77 @@ const getcolumns = {
},
],
},
// {
// title: '非寿命件消耗',
// key: 'maintainTaskItemList',
// valueType: 'table',
// dataIndex: 'maintainTaskItemList',
// columns: [
// {
// title: '备件料号',
// dataIndex: 'sparePartNo',
// key: 'sparePartNo',
// },
// {
// title: '备件名称',
// dataIndex: 'sparePartName',
// key: 'sparePartName',
// },
// {
// title: '供应商编号',
// dataIndex: 'supplierNo',
// key: 'supplierNo',
// },
// {
// title: '供应商名称',
// dataIndex: 'supplierName',
// key: 'supplierName',
// },
// {
// title: '消耗数量',
// dataIndex: 'remark',
// key: 'remark',
// },
// ],
// },
// {
// title: '寿命件更换',
// key: 'maintainTaskItemList',
// valueType: 'table',
// dataIndex: 'maintainTaskItemList',
// columns: [
// {
// title: '备件料号',
// dataIndex: 'sparePartNo',
// key: 'sparePartNo',
// },
// {
// title: '备件名称',
// dataIndex: 'sparePartName',
// key: 'sparePartName',
// },
// {
// title: '供应商编号',
// dataIndex: 'supplierNo',
// key: 'supplierNo',
// },
// {
// title: '供应商名称',
// dataIndex: 'supplierName',
// key: 'supplierName',
// },
// {
// title: '安装部位',
// dataIndex: 'remark',
// key: 'remark',
// },
// {
// title: '更换数量',
// dataIndex: 'remark',
// key: 'remark',
// },
// ],
// },
{
title: '非寿命件消耗',
key: 'noLifeConsume',
valueType: 'table',
dataIndex: 'noLifeConsume',
columns: [
{
title: '备件料号',
dataIndex: 'sparePartNo',
key: 'sparePartNo',
},
{
title: '备件名称',
dataIndex: 'sparePartName',
key: 'sparePartName',
},
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
},
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
},
{
title: '消耗数量',
dataIndex: 'operateNum',
key: 'operateNum',
},
],
},
{
title: '寿命件更换',
key: 'yesLifeConsume',
valueType: 'table',
dataIndex: 'yesLifeConsume',
columns: [
{
title: '备件料号',
dataIndex: 'sparePartNo',
key: 'sparePartNo',
},
{
title: '备件名称',
dataIndex: 'sparePartName',
key: 'sparePartName',
},
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
},
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
},
{
title: '安装部位',
dataIndex: 'installPosition',
key: 'installPosition',
},
{
title: '更换数量',
dataIndex: 'operateNum',
key: 'operateNum',
},
],
},
],
4: [
{
......
......@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2023-01-19 09:53:59
* @Last Modified by: Li Hanlin
* @Last Modified time: 2023-02-17 11:32:56
* @Last Modified time: 2023-02-24 15:56:19
*/
import * as React from 'react';
......@@ -515,36 +515,169 @@ function WorkOrder(props) {
const seletType = {
wcby: (
<div>
<PremButton
btn={{
type: 'primary',
loading,
onClick: () => {
let maintainTaskItemList = drawer?.item?.maintainTaskItemList?.map((it) => {
if (it.judgeType == 1) {
return {
id: it.id,
remark: it.remark,
judgeResultType: it.result,
};
} else {
return {
id: it.id,
remark: it.remark,
qualitativeJudgeResult: it.result,
};
}
});
console.log(maintainTaskItemList);
run({
url: '/maintain/umMaintainTask/finishMaintainTask',
params: { id: drawer?.item?.id, maintainTaskItemList },
});
<InitForm
fields={[
{
title: <span style={{ fontSize: 14, fontWeight: 600 }}>持有寿命件信息</span>,
valueType: 'split',
},
{
dataIndex: 'lineStockUseList',
key: 'lineStockUseList',
valueType: 'formSelectList',
colProps: {
span: 24,
},
span: 3,
columns: [
{
title: '线边库',
dataIndex: 'stockName',
key: 'stockName',
editable: false,
},
{
title: '备件料号',
dataIndex: 'sparePartNo',
key: 'sparePartNo',
span: 3,
editable: false,
},
{
title: '备件名称',
dataIndex: 'sparePartName',
key: 'sparePartName',
span: 3,
editable: false,
},
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
span: 3,
editable: false,
},
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
span: 3,
editable: false,
},
{
title: '可用数量',
dataIndex: 'usedStock',
key: 'usedStock',
search: false,
span: 3,
editable: false,
},
{
title: (
<div>
更换数量 <span style={{ color: 'red' }}>* </span>
</div>
),
search: false,
dataIndex: 'operateNum',
valueType: 'digit',
fieldProps: {
precision: 3,
},
key: 'operateNum',
},
],
hideInSearch: true,
hideInTable: true,
path: '/sparepart/lineStock/queryConsumeStock',
rowName: 'supplierList',
rowSelection: {
type: 'checkbox',
getCheckboxProps: (record) => ({
disabled: record.isAsh == '1',
}),
},
},
{
title: <span style={{ fontSize: 14, fontWeight: 600 }}>寿命件更换</span>,
valueType: 'split',
},
{
dataIndex: 'ifePieceStockUseList',
key: 'ifePieceStockUseList',
valueType: 'Expandable',
colProps: {
span: 24,
},
columns: [
{
title: '备件料号',
dataIndex: 'sparePartNo',
key: 'sparePartNo',
},
{
title: '备件名称',
dataIndex: 'sparePartName',
key: 'sparePartName',
},
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
search: false,
},
{
title: '供应商名称',
dataIndex: 'supplierName',
search: false,
key: 'supplierName',
},
{
title: '安装部位',
dataIndex: 'installPosition',
key: 'installPosition',
},
{
title: '安装数量',
dataIndex: 'installNum',
search: false,
key: 'installNum',
},
{
title: '下次更换日期',
dataIndex: 'nextReplaceDate',
key: 'nextReplaceDate',
valueType: 'dateRange',
},
],
path: '/sparepart/lifePieceAccount/queryPageByEquipment',
extraparams: { equipmentId: drawer?.item?.equipmentId },
expandablePath: '/sparepart/lineStock/queryReplaceStock',
},
]}
onFinish={(vals) => {
console.log(vals);
let maintainTaskItemList = drawer?.item?.maintainTaskItemList?.map((it) => {
if (it.judgeType == 1) {
return {
id: it.id,
remark: it.remark,
judgeResultType: it.result,
};
} else {
return {
id: it.id,
remark: it.remark,
qualitativeJudgeResult: it.result,
};
}
});
run({
url: '/maintain/umMaintainTask/finishMaintainTask',
params: { id: drawer?.item?.id, maintainTaskItemList },
});
}}
>
提交
</PremButton>
/>
</div>
),
yz: (
......
......@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-12-07 11:19:30
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-30 13:56:38
* @Last Modified time: 2023-02-24 14:38:19
*/
import * as React from 'react';
......@@ -318,7 +318,7 @@ function Fault(props) {
...s,
open: false,
}));
gzmcref.current.reload();
gzmcref?.current?.reload();
}
},
}));
......
......@@ -3,7 +3,7 @@
* @Author: Li Hanlin
* @Date: 2022-12-02 11:41:03
* @Last Modified by: Li Hanlin
* @Last Modified time: 2023-02-08 13:22:44
* @Last Modified time: 2023-02-24 15:18:44
*/
import * as React from 'react';
......@@ -19,6 +19,7 @@ import OrderHandle from '../platform/RepairOrderHandle';
import getcolumns from './columns';
import Detail from '@/components/RepaireDetail/Detail';
import { useModel } from '@umijs/max';
import EditTable from '@/components/InitForm/EditTable';
function Failure(props) {
let actionRef = useRef(),
......@@ -710,6 +711,149 @@ function Failure(props) {
};
// 完成维修
const Finishrepair = () => {
const EditTableItem = ({ record }) => {
const [value, setvalue] = useState([]);
console.log(value);
return (
<div>
<EditTable
resizeable={false}
alwaysShowAlert={false}
tableAlertRender={false}
tableAlertOptionRender={false}
columns={[
{
title: '线边库',
dataIndex: 'supplierNo',
key: 'supplierNo',
editable: false,
},
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
span: 3,
editable: false,
},
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
span: 3,
editable: false,
},
{
title: '可用数量',
dataIndex: 'usedStock',
key: 'usedStock',
search: false,
span: 3,
editable: false,
},
{
title: (
<div>
更换数量 <span style={{ color: 'red' }}>* </span>
</div>
),
search: false,
dataIndex: 'operateNum',
valueType: 'digit',
fieldProps: {
precision: 3,
},
key: 'operateNum',
span: 3,
hideInForm: true,
editable: true,
},
]}
path="/sparepart/lineStock/queryReplaceStock"
extraparams={{ lifePieceAccountId: record?.id }}
rowSelection={{
type: 'checkbox',
columnWidth: 44,
preserveSelectedRowKeys: true,
selectedRowKeys: value?.map((it) => it?.lineStockId) ?? [],
onChange: (selectedKeys, selectedRows) => {
const lineStockUseList = selectedRows?.map((it) => {
return { lineStockId: it?.id, operateNum: it?.operateNum };
});
setvalue(lineStockUseList);
},
}}
editable={{
onValuesChange: (rower, recordList) => {
setvalue((value) => {
const curkey = value?.map((it) => it?.lineStockId);
const newValue = value.concat(rower);
return [...newValue];
});
console.log(value);
},
}}
/>
</div>
);
};
const columns_fsmjxh = [
{
title: '线边库',
dataIndex: 'stockName',
key: 'stockName',
editable: false,
},
{
title: '备件料号',
dataIndex: 'sparePartNo',
key: 'sparePartNo',
span: 3,
editable: false,
},
{
title: '备件名称',
dataIndex: 'sparePartName',
key: 'sparePartName',
span: 3,
editable: false,
},
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
span: 3,
editable: false,
},
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
span: 3,
editable: false,
},
{
title: '可用数量',
dataIndex: 'usedStock',
key: 'usedStock',
search: false,
span: 3,
editable: false,
},
{
title: (
<div>
更换数量 <span style={{ color: 'red' }}>* </span>
</div>
),
search: false,
dataIndex: 'operateNum',
valueType: 'digit',
fieldProps: {
precision: 3,
},
key: 'operateNum',
},
];
const columns = [
{
title: '故障类型',
......@@ -836,6 +980,80 @@ function Failure(props) {
mode: 'multiple',
},
},
{
title: '持有寿命件信息',
dataIndex: 'supplierList',
key: 'supplierList',
valueType: 'formSelectList',
colProps: {
span: 24,
},
span: 3,
columns: columns_fsmjxh,
hideInSearch: true,
hideInTable: true,
path: '/sparepart/lineStock/queryConsumeStock',
rowName: 'supplierList',
rowSelection: {
type: 'checkbox',
getCheckboxProps: (record) => ({
disabled: record.isAsh == '1',
}),
},
},
{
title: '寿命件更换',
dataIndex: 'ifePieceStockUseList',
key: 'ifePieceStockUseList',
valueType: 'Expandable',
colProps: {
span: 24,
},
columns: [
{
title: '备件料号',
dataIndex: 'sparePartNo',
key: 'sparePartNo',
},
{
title: '备件名称',
dataIndex: 'sparePartName',
key: 'sparePartName',
},
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
search: false,
},
{
title: '供应商名称',
dataIndex: 'supplierName',
search: false,
key: 'supplierName',
},
{
title: '安装部位',
dataIndex: 'installPosition',
key: 'installPosition',
},
{
title: '安装数量',
dataIndex: 'installNum',
search: false,
key: 'installNum',
},
{
title: '下次更换日期',
dataIndex: 'nextReplaceDate',
key: 'nextReplaceDateList',
valueType: 'dateRange',
},
],
path: '/sparepart/lifePieceAccount/queryPageByEquipment',
extraparams: { equipmentId: drawer?.item?.equipmentId },
expandablePath: '/sparepart/lineStock/queryReplaceStock',
},
];
return (
<>
......@@ -844,7 +1062,6 @@ function Failure(props) {
defaultFormValue={drawer?.item}
fields={columns}
onValuesChange={(changedValues, allValues) => {
console.log(changedValues, allValues);
if (Object.keys(changedValues)[0] == 'faultDetailId') {
doFetch({
url: '/repair/umFaultSettingDetail/queryById',
......@@ -859,6 +1076,7 @@ function Failure(props) {
}
}}
onFinish={async (vals) => {
console.log(vals);
let params = {
repairComplete: {
faultType: vals.faultSettingId,
......@@ -871,18 +1089,19 @@ function Failure(props) {
id: drawer?.item.id,
repairAssistList: vals?.repairAssistList?.map((it) => ({ assistUserId: it })),
};
let res = await doFetch({
url: '/repair/umRepairOrder/completeRepair',
params,
});
if (res.code === '0000') {
message.success('操作成功!');
setdrawer((s) => ({
...s,
open: false,
}));
actionRef.current.reload();
}
console.log(params);
// let res = await doFetch({
// url: '/repair/umRepairOrder/completeRepair',
// params,
// });
// if (res.code === '0000') {
// message.success('操作成功!');
// setdrawer((s) => ({
// ...s,
// open: false,
// }));
// actionRef.current.reload();
// }
}}
{...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