/* 设备台账
* @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-09 15:56:35
*/
import * as React from 'react';
import { useState, useMemo, useRef, useEffect } from 'react';
import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import { doFetch } from '@/utils/doFetch';
import { message, Dropdown, Menu, Layout, Button, Image, Space, Divider, Tabs } from 'antd';
import TreeRender from '@/components/TreeRender';
import { ProDescriptions } from '@ant-design/pro-components';
import InitForm from '@/components/InitForm';
import ExtendField from '@/components/ExtendField';
const { Sider, Content } = Layout;
function Model(props) {
const actionRef = useRef(),
formRef = useRef(),
[drawer, setDrawer] = useState({
visible: false,
}),
[extraparams, setextraparams] = useState({}),
[currDrawer, setCurrDrawer] = useState({
visible: false,
}),
currfields = {
1: [
{
title: '操作人',
dataIndex: 'updateUserName',
key: 'updateUserName',
},
{
title: '操作时间',
dataIndex: 'updateTime',
key: 'updateTime',
},
{
title: '改造日期',
dataIndex: 'reformDate',
key: 'reformDate',
valueType: 'date',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '改造承包商',
dataIndex: 'supplierId',
key: 'supplierId',
valueType: 'select',
options: {
path: '/asset/equipmentSupplier/query/selection',
params: {},
},
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
},
{
title: '改造内容',
dataIndex: 'reformContent',
key: 'reformContent',
valueType: 'textarea',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '上传文件(上限为5个)',
key: 'urlIds ',
valueType: 'uploadDragger',
// colProps: { span: 24 },
fieldProps: {
limit: 5,
},
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
render: (text, row) => {
return row?.urlIds?.map((it) => {
;
});
},
},
],
2: [
{
title: '操作人',
dataIndex: 'updateUserName',
key: 'updateUserName',
},
{
title: '操作时间',
dataIndex: 'updateTime',
key: 'updateTime',
},
{
title: '报废日期',
dataIndex: 'scrapDate',
key: 'scrapDate',
valueType: 'date',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '报废原因',
dataIndex: 'scrapReason',
key: 'scrapReason',
valueType: 'textarea',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '上传文件',
key: 'urlIds ',
valueType: 'uploadDragger',
// colProps: { span: 24 },
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
fieldProps: {
limit: 5,
},
render: (text, row) => {
return row?.urlIds.map((it) => {
;
});
},
},
],
3: [
{
title: '操作人',
dataIndex: 'updateUserName',
key: 'updateUserName',
},
{
title: '操作时间',
dataIndex: 'updateTime',
key: 'updateTime',
},
{
title: '调入公司',
dataIndex: 'organizationName',
key: 'toOrganizationId',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '调入部门',
valueType: 'select',
dataIndex: 'departmentName',
key: 'toDepartmentId',
options: {
path: '/auth/sysDepartment/query/depart/selectbox',
linkParams: {
toOrganizationId: 'parentId',
},
},
},
{
title: '调入工厂',
dataIndex: 'factoryName',
key: 'toFactoryId',
valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '调入车间',
dataIndex: 'shopName',
valueType: 'select',
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
toFactoryId: 'factoryId',
},
},
key: 'toShopId',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '调入工段',
dataIndex: 'sectionName',
key: 'toSectionId',
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelectionByShop',
linkParams: {
toShopId: 'shopId',
},
},
},
{
title: '调入产线',
dataIndex: 'productionLines',
valueType: 'select',
key: 'toProductLineId',
options: {
path: '/auth/sysProductionLine/getAllProductLineSelectionByShop',
linkParams: {
toShopId: 'shopId',
},
},
},
{
title: '调入位置号',
dataIndex: 'toPositionNo',
valueType: 'input',
key: 'toPositionNo',
},
{
title: '调拨日期',
dataIndex: 'transferDate',
key: 'transferDate',
valueType: 'date',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '调拨原因',
dataIndex: 'transferReason',
key: 'transferReason',
valueType: 'textarea',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
],
4: [
{
title: '操作人',
dataIndex: 'updateUserName',
key: 'updateUserName',
},
{
title: '操作时间',
dataIndex: 'updateTime',
key: 'updateTime',
},
{
title: '借用公司',
dataIndex: 'organizationName',
key: 'toOrganizationId',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '借用部门',
valueType: 'select',
dataIndex: 'departmentName',
key: 'toDepartmentId',
options: {
path: '/auth/sysDepartment/query/depart/selectbox',
linkParams: {
toOrganizationId: 'parentId',
},
},
},
{
title: '借用工厂',
dataIndex: 'factoryName',
key: 'toFactoryId',
valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '借用车间',
dataIndex: 'shopName',
valueType: 'select',
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
toFactoryId: 'factoryId',
},
},
key: 'toShopId',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '借用工段',
dataIndex: 'sectionName',
key: 'toSectionId',
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelectionByShop',
linkParams: {
toShopId: 'shopId',
},
},
},
{
title: '借用产线',
dataIndex: 'productionLines',
valueType: 'select',
key: 'toProductLineId',
options: {
path: '/auth/sysProductionLine/getAllProductLineSelectionByShop',
linkParams: {
toShopId: 'shopId',
},
},
},
{
title: '借用位置号',
dataIndex: 'toPositionNo',
valueType: 'input',
key: 'toPositionNo',
},
{
title: '借用日期',
dataIndex: 'borrowDate',
key: 'borrowDate',
valueType: 'date',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '预计归还日期',
dataIndex: 'planReturnDate',
key: 'planReturnDate',
valueType: 'date',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '借用原因',
dataIndex: 'borrowReason',
key: 'borrowReason',
valueType: 'textarea',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
],
5: [
{
title: '操作人',
dataIndex: 'updateUserName',
key: 'updateUserName',
},
{
title: '操作时间',
dataIndex: 'updateTime',
key: 'updateTime',
},
{
title: '接收公司',
dataIndex: 'returnOrganizationId',
key: 'returnOrganizationId',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '接收部门',
valueType: 'select',
dataIndex: 'returnDepartmentId',
key: 'returnDepartmentId',
options: {
path: '/auth/sysDepartment/query/depart/selectbox',
linkParams: {
returnOrganizationId: 'parentId',
},
},
},
{
title: '接收工厂',
dataIndex: 'returnFactoryId',
key: 'returnFactoryId',
valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '接收车间',
dataIndex: 'returnShopId',
valueType: 'select',
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
returnFactoryId: 'factoryId',
},
},
key: 'returnShopId',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '接收工段',
dataIndex: 'returnSectionId',
key: 'returnSectionId',
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelectionByShop',
linkParams: {
returnShopId: 'shopId',
},
},
},
{
title: '接收产线',
dataIndex: 'returnProductLineId',
valueType: 'select',
key: 'returnProductLineId',
options: {
path: '/auth/sysProductionLine/getAllProductLineSelectionByShop',
linkParams: {
returnShopId: 'shopId',
},
},
},
{
title: '接收位置号',
dataIndex: 'returnPositionNo',
valueType: 'input',
key: 'returnPositionNo',
},
{
title: '实际归还日期',
dataIndex: 'realReturnDate',
key: 'realReturnDate',
valueType: 'date',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '备注',
dataIndex: 'remark',
key: 'remark',
valueType: 'textarea',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
],
},
urlParams = {
save: '/asset/equipment/save',
remove: '/asset/equipment/deleteById',
list: '/asset/equipment/queryList',
detail: '/asset/equipment/detail',
},
urlParams_childEquipment = {
list: '/asset/equipment/children/queryList',
checked: '/asset/equipment/children/selected/queryList',
save: '/asset/equipmentChildren/save',
},
urlParams_resume = {
save: '/asset/equipmentLog/save',
list: '/asset/equipmentLog/queryEquipmentLogPage',
detail: '/asset/equipmentLog/query/resumeDetail',
},
urlParams_correlation = {
zsb: '/asset/equipment/detail/children/page',
fsb: '/asset/equipment/detail/parent/page',
};
const edit = (text, row, _, action) => {
return (
{
setDrawer((s) => ({
...s,
visible: true,
title: '编辑',
val: 'only',
type: 'add',
item: row,
// detailpath: urlParams.detail,
// params: { id: row.id },
// onFinish: async (vals) => {
// //console.log(1);
// let equipmentCharList = [];
// //console.log('id:', row.id);
// for (let i in vals) {
// if (!isNaN(Number(i))) {
// equipmentCharList.push({
// fieldId: i,
// fieldRealValue: vals[i],
// });
// delete vals[i];
// }
// }
// let params = {
// ...vals,
// id: row.id,
// equipmentCharList,
// };
// let res = await doFetch({
// url: urlParams.save,
// params,
// });
// if (res.code === '0000') {
// message.success('编辑成功!');
// setDrawer((s) => ({
// ...s,
// visible: false,
// }));
// actionRef.current.reload();
// }
// },
}));
},
}}
>
编辑
);
};
const remove = (text, row, _, action) => {
return (
{
let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
if (res.code === '0000') {
message.success('删除成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
删除
);
};
const more = (text, row, _, action) => {
const menu = (