Commit d1d0c1d5 authored by 左玲玲's avatar 左玲玲 😬

租赁客户,设备供应商,设备查看

parent 668ec201
......@@ -325,6 +325,12 @@ export default [
icon: '',
component: './lease/supplier',
},
{
name: '设备查看',
path: '/lease/devicedata',
icon: '',
component: './lease/devicedata',
},
],
},
];
......@@ -15,7 +15,6 @@ function DrawerPro(props) {
fields: props.fields,
detailData: props.detailData,
};
return (
<Drawer
maskClosable={false}
......
import React from 'react';
const Filedetail = ({ files }) => {
return <div style={{ display: "flex", flexFlow: "row wrap", width: "100%" }}>
{
files && typeof (files) == "string" ?
<a href={files} download={files} style={{ margin: '0 20px 0 0', display: 'block' }}>{urlName ? urlName : "下载"}</a>
: files && Array.isArray(files) && files?.length ?
files?.map(el => {
return <a title={el.name} key={el.url} href={el.url} download={el.name} style={{ margin: '0 20px 0 0', display: 'block' }}>{el.name}</a>
})
:
"-"
}
</div>
}
export default Filedetail;
\ No newline at end of file
......@@ -1262,10 +1262,15 @@ function UploadImg({ value, onChange, fieldProps, valueType }) {
} else {
url = file.thumbUrl;
}
let suffixArr = url.split('.');
if (suffixArr?.length > 0 && (suffixArr[suffixArr?.length - 1] == 'png' || suffixArr[suffixArr?.length - 1] == 'jpg' || suffixArr[suffixArr?.length - 1] == 'jpeg' || suffixArr[suffixArr?.length - 1] == 'svg')) {
setImage({
url,
visible: true,
});
} else {
}
},
className: "upload-list-inline"
};
......
import { Tooltip } from "antd";
import Filedetail from "@/components/Filedetail";
function getcolumns(setdrawer) {
return {
columns: [
{
title: '客户编号',
dataIndex: 'f1',
key: 'f1',
dataIndex: 'customerNo',
key: 'customerNo',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
colProps: { span: 8 },
},
{
title: '客户名称',
dataIndex: 'f2',
key: 'f2',
dataIndex: 'customerName',
key: 'customerName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
colProps: { span: 8 },
render: (_, row) => {
return (
<Tooltip title={row.f2}>
<Tooltip title={row.customerName}>
<a
className="table-cell"
onClick={() => {
......@@ -30,7 +31,7 @@ function getcolumns(setdrawer) {
}));
}}
>
{row.f2}
{row.customerName}
</a>
</Tooltip>
);
......@@ -38,99 +39,104 @@ function getcolumns(setdrawer) {
},
{
title: '负责工厂',
dataIndex: 'f3',
key: 'f3',
dataIndex: 'factoryName',
key: 'factoryId',
valueType: 'select',
options: { path: '/', params: {} },
options: { path: '/lease/umLeaseCustomer/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
colProps: { span: 8 },
},
{ title: '企业法人', dataIndex: 'f4', key: 'f4', colProps: { span: 8 }, hideInSearch: true },
{ title: '联系电话', dataIndex: 'f5', key: 'f5', colProps: { span: 8 }, hideInSearch: true },
{ title: '企业法人', dataIndex: 'enterpriseLegalPerson', key: 'enterpriseLegalPerson', colProps: { span: 8 }, hideInSearch: true },
{ title: '联系电话', dataIndex: 'phone', key: 'phone', colProps: { span: 8 }, hideInSearch: true },
{
title: '产值',
dataIndex: 'f6',
key: 'f6',
dataIndex: 'outputValue',
key: 'outputValue',
colProps: { span: 8 },
hideInTable: true,
hideInSearch: true,
hideInSearch: true
},
{
title: '所属行业',
dataIndex: 'f7',
key: 'f7',
dataIndex: 'industry',
key: 'industry',
colProps: { span: 8 },
hideInTable: true,
hideInSearch: true,
},
{
title: '地址',
dataIndex: 'f8',
key: 'f8',
dataIndex: 'address',
key: 'address',
colProps: { span: 8 },
hideInTable: true,
hideInSearch: true,
},
{
title: '纳税人识别号',
dataIndex: 'f9',
key: 'f9',
dataIndex: 'taxpayerIdentificationNumber',
key: 'taxpayerIdentificationNumber',
colProps: { span: 8 },
hideInSearch: true,
},
{
title: '开户行银行',
dataIndex: 'f10',
key: 'f10',
dataIndex: 'openingBank',
key: 'openingBank',
colProps: { span: 8 },
hideInSearch: true,
},
{
title: '收款账户',
dataIndex: 'f11',
key: 'f11',
dataIndex: 'collectionAccount',
key: 'collectionAccount',
colProps: { span: 8 },
hideInSearch: true,
},
{
title: '所属区域',
dataIndex: 'f12',
key: 'f12',
dataIndex: 'regionName',
key: 'regionId',
colProps: { span: 8 },
valueType: 'select',
mode: 'multiple',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
options: { path: '/', params: {} },
options: { path: '/lease/umLeaseCustomer/getAllShopSelection', params: {} },
hideInSearch: true,
},
{
title: '企业简介',
dataIndex: 'f13',
key: 'f13',
dataIndex: 'enterpriseIntroduction',
key: 'enterpriseIntroduction',
hideInSearch: true,
hideInTable: true,
valueType: 'textarea',
colProps: { span: 24 },
span: 3
},
{
title: '附件上传(最多5个)',
dataIndex: 'f14',
key: 'f14',
dataIndex: 'picList',
key: 'picList',
hideInSearch: true,
hideInTable: true,
valueType: 'uploadBtn',
colProps: { span: 24 },
span: 3,
fieldProps: {
limit: 5,
},
hideInDescriptions: true
render: (_, row) => {
return <Filedetail files={row?.['picList']} />
}
},
],
pathconfig: {
add: '',
edit: '',
list: '',
delete: '',
add: '/lease/umLeaseCustomer/save',
edit: '/lease/umLeaseCustomer/save',
list: '/lease/umLeaseCustomer/queryList',
delete: '/lease/umLeaseCustomer/deleteById',
detail: '/lease/umLeaseCustomer/queryById'
},
};
}
......
......@@ -18,6 +18,7 @@ const Custom = () => {
setdrawer((s) => ({
...s,
visible: false,
item: {}
}));
}
},
......@@ -54,7 +55,7 @@ const Custom = () => {
okText: '确认',
cancelText: '取消',
onConfirm: async () => {
let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
let res = await doFetch({ url: pathconfig.delete, params: { id: row.id } });
if (res.code === '0000') {
actionRef.current.reload();
}
......@@ -71,24 +72,28 @@ const Custom = () => {
};
const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer)?.columns ?? [];
let factory = defcolumn.filter(it => it.key == 'factoryId')?.[0];
if (drawer.val == 'add') {
factory.options.params = {}
} else if (drawer.val == 'edit') {
factory.options.params = { factoryId: drawer.item.factoryId };
}
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)],
});
}, []);
}, [drawer.val, drawer.item]);
const pathconfig = useMemo(() => {
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
return pathconf;
}, []);
return <div>
<AutoTable
pagetitle={<h3 className="page-title">客户管理</h3>}
columns={columns}
path={pathconfig?.list}
// dataSource={[{ 'f1': '111', 'f2': '222', id: 1 }]}
actionRef={actionRef}
pageextra={'add'}
resizeable={false}
......@@ -112,11 +117,11 @@ const Custom = () => {
}}
/>
<DrawerPro
{...drawer}
fields={columns}
// detailpath={drawer.type == 'add' ? '' : drawer?.detailpath}
params={{ id: drawer?.item?.id }}
detailpath={drawer.val == 'add' || !drawer?.item?.id ? '' : pathconfig?.detail}
params={drawer.val == 'add' ? {} : { id: drawer?.item?.id }}
defaultFormValue={drawer?.item ?? {}}
detailData={drawer?.item ?? {}}
placement="right"
onClose={() => {
setdrawer((s) => ({
......@@ -124,7 +129,6 @@ const Custom = () => {
visible: false,
}));
}}
{...drawer}
onFinish={async (vals) => {
if (drawer?.val == "add") {
await runAsync({ url: pathconfig?.add, params: { ...vals } });
......@@ -136,23 +140,6 @@ const Custom = () => {
}
}}
>
{
<div>
<div>附件</div>
<div style={{ display: "flex", flexFlow: "row wrap", width: "100%" }}>
{
drawer?.item?.['f14'] && typeof (drawer?.item?.['f14']) == "string" ?
<a href={drawer?.item?.['f14']} download={drawer?.item?.['f14']} style={{ margin: '0 10px 0 0', display: 'block' }}>{urlName ? urlName : "下载"}</a>
: drawer?.item?.['f14'] && Array.isArray(drawer?.item?.['f14']) && drawer?.item?.['f14']?.length ?
drawer?.item?.['f14']?.map(el => {
return <a key={el.url} href={el.url} download={el.name} style={{ margin: '0 10px 0 0', display: 'block' }}>{el.name}</a>
})
:
"-"
}
</div>
</div>
}
</DrawerPro>
</div>
}
......
/* 设备台账
* @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin
* @Last Modified time: 2023-02-16 17:23:15
*/
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,
Tooltip,
} from 'antd';
import TreeRender from '@/components/TreeRender';
import { ProDescriptions } from '@ant-design/pro-components';
import InitForm from '@/components/InitForm';
import dayjs from 'dayjs';
const { Sider, Content } = Layout;
function Account(props) {
const disabledDateOfDay = (current) => {
// Can not select days before today and today
return current && current > dayjs().endOf('day');
};
const [activeTab, setactiveTab] = useState(1);
let actionRef = useRef(),
formRef = useRef(),
[drawer, setDrawer] = useState({
visible: false,
}),
[extraparams, setextraparams] = useState({}),
[currDrawer, setCurrDrawer] = useState({
visible: false,
}),
[resumeTab, setresumeTab] = useState(null),
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: '上传文件',
key: 'urlIds',
valueType: 'uploadDragger',
// column: { xs: 1, sm: 2, md: 3 },
span: '3',
fieldProps: {
maxCount: 5,
},
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
render: (text, row) => {
return (
<div>
{row?.urlIds.map((it) => (
// eslint-disable-next-line react/jsx-key
<div style={{ marginBottom: '8px' }}>
<a href={it?.url} download target="_blank" rel="noopener noreferrer">
{it?.name}
</a>
</div>
))}
</div>
);
},
},
],
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',
span: '3',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
fieldProps: {
maxCount: 5,
},
render: (text, row) => {
return (
<div>
{row?.urlIds.map((it) => (
// eslint-disable-next-line react/jsx-key
<div style={{ marginBottom: '8px' }}>
<a href={it?.url} download target="_blank" rel="noopener noreferrer">
{it?.name}
</a>
</div>
))}
</div>
);
},
},
],
3: [
{
title: '操作人',
dataIndex: 'updateUserName',
key: 'updateUserName',
},
{
title: '操作时间',
dataIndex: 'updateTime',
key: 'updateTime',
},
{
title: '调入公司',
dataIndex: 'toOrganizationName',
key: 'toOrganizationId',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '调入部门',
valueType: 'treeSelect',
dataIndex: 'toDepartmentName',
key: 'toDepartmentId',
options: {
path: '/auth/sysDepartment/query/children/tree',
linkParams: {
toOrganizationId: 'parentId',
},
},
},
{
title: '调入工厂',
dataIndex: 'toFactoryName',
key: 'toFactoryId',
valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '调入车间',
dataIndex: 'toShopName',
valueType: 'select',
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
toFactoryId: 'factoryId',
},
},
key: 'toShopId',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '调入工段',
dataIndex: 'toSectionName',
key: 'toSectionId',
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelectionByShop',
linkParams: {
toShopId: 'shopId',
},
},
},
{
title: '调入产线',
dataIndex: 'toProductLineName',
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: 'toOrganizationName',
key: 'toOrganizationName',
},
{
title: '借用部门',
valueType: 'treeSelect',
dataIndex: 'toDepartmentName',
key: 'toDepartmentName',
},
{
title: '借用工厂',
dataIndex: 'toFactoryName',
key: 'toFactoryName',
},
{
title: '借用车间',
dataIndex: 'toShopName',
valueType: 'select',
key: 'toShopName',
},
{
title: '借用工段',
dataIndex: 'toSectionName',
key: 'toSectionName',
},
{
title: '借用产线',
dataIndex: 'toProductLineName',
key: 'toProductLineName',
},
{
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: 'returnOrganizationName',
key: 'returnOrganizationName',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '接收部门',
valueType: 'treeSelect',
dataIndex: 'returnDepartmentName',
key: 'returnDepartmentName',
options: {
path: '/auth/sysDepartment/query/children/tree',
linkParams: {
returnOrganizationId: 'parentId',
},
},
},
{
title: '接收工厂',
dataIndex: 'returnFactoryName',
key: 'returnFactoryName',
valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '接收车间',
dataIndex: 'returnShopName',
valueType: 'select',
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
returnFactoryId: 'factoryId',
},
},
key: 'returnShopId',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '接收工段',
dataIndex: 'returnSectionName',
key: 'returnSectionId',
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelectionByShop',
linkParams: {
returnShopId: 'shopId',
},
},
},
{
title: '接收产线',
dataIndex: 'returnProductLineName',
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',
};
function formatDate(date) {
var myyear = date.getFullYear();
var mymonth = date.getMonth() + 1;
var myweekday = date.getDate();
if (mymonth < 10) {
mymonth = '0' + mymonth;
}
if (myweekday < 10) {
myweekday = '0' + myweekday;
}
return myyear + '-' + mymonth + '-' + myweekday; //想要什么格式都可以随便自己拼
}
//设备详情
const Detail = () => {
// 基础信息
const BaseInfo = () => {
const columns1 = [
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '位置号',
dataIndex: 'positionNo',
key: 'positionNo',
},
{
title: '设备类型',
dataIndex: 'equipmentTypeName',
key: 'equipmentTypeId',
},
{
title: '设备型号',
dataIndex: 'equipmentModelName',
key: 'equipmentModelName',
},
{
title: '状态',
dataIndex: 'statusName',
key: 'statusName',
span: 2,
},
];
const columns2 = [
{
title: '公司名称',
dataIndex: 'organizationName',
key: 'organizationId',
},
{
title: '部门名称',
dataIndex: 'departmentName',
key: 'departmentId',
},
{
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryId',
},
{
title: '车间名称',
dataIndex: 'shopName',
key: 'shopId',
},
{
title: '工段名称',
dataIndex: 'sectionName',
key: 'sectionId',
},
{
title: '产线名称',
dataIndex: 'productLineName',
key: 'productLineName',
},
];
const columns3 = [
{
title: '供应商',
dataIndex: 'supplierName',
key: 'supplierId',
},
{
title: '设备原值',
dataIndex: 'equipmentWorth',
key: 'equipmentWorth',
},
{
title: '安装投产日期',
dataIndex: 'productDate',
key: 'productDate',
},
{
title: '图片',
dataIndex: 'pictureUrl',
key: 'pictureUrl',
render: (text, row) => <Image width={70} src={row.pictureUrl} />,
},
{
title: '二维码',
dataIndex: 'qrCodeUrl',
key: 'qrCodeUrl',
render: (text, row) => <Image width={70} src={row.qrCodeUrl} />,
},
];
const [newfieldscolumns, setnewfieldscolumns] = useState(columns);
const selectValueType = (type, options) => {
switch (type) {
case 1:
return {
valueType: 'input',
};
case 2:
return {
valueType: 'select',
options,
};
case 3:
return {
valueType: 'radio',
options,
};
case 4:
return {
valueType: 'select',
options,
};
default:
break;
}
};
const [request, setrequest] = useState();
useEffect(() => {
const fn = async () => {
let res = await doFetch({
url: '/base/paFormField/queryList',
params: {
formId: '2',
},
});
if (res?.data?.dataList) {
let column = [];
res?.data?.dataList?.forEach?.((el) => {
column.push({
...selectValueType(el.fieldChar, el.valueList),
title: el.fieldName,
dataIndex: el.id,
key: el.id,
});
});
setnewfieldscolumns(column);
}
},
fn2 = async () => {
const res = await doFetch({
url: urlParams.detail,
params: { id: drawer?.item?.id },
});
let obj = {};
res?.data?.data['equipmentCharList']?.forEach?.((it) => {
obj[it?.fieldId] = it?.fieldRealValue;
});
console.log('drawerpro:', {
...(res?.data?.data ?? {}),
...obj,
});
setrequest(
{
...(res?.data?.data ?? {}),
...obj,
} ?? {},
);
};
fn();
fn2();
}, []);
return (
<>
<ProDescriptions dataSource={request} columns={columns1} />
<Divider style={{ marginTop: 0 }} />
<ProDescriptions dataSource={request} columns={columns2} />
<Divider style={{ marginTop: 0 }} />
<ProDescriptions dataSource={request} columns={columns3} />
<h3 className="page-title" style={{ marginBottom: 24 }}>
扩展字段
</h3>
<ProDescriptions dataSource={request} columns={newfieldscolumns} />
</>
);
};
// 相关设备
const Correlation = () => {
return (
<>
<AutoTable
pagetitle="子设备"
columns={[
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
search: false,
width: 120,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '设备名称',
dataIndex: 'equipmentName',
search: false,
width: 120,
key: 'equipmentName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '公司名称',
search: false,
dataIndex: 'organizationName',
width: 120,
key: 'organizationId',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '部门名称',
width: 120,
search: false,
valueType: 'treeSelect',
dataIndex: 'departmentName',
key: 'departmentId',
options: {
path: '/auth/sysDepartment/query/children/tree',
linkParams: {
organizationId: 'parentId',
},
},
},
{
title: '工厂名称',
dataIndex: 'factoryName',
search: false,
key: 'factoryId',
width: 120,
valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '车间名称',
dataIndex: 'shopName',
search: false,
width: 120,
valueType: 'select',
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
factoryId: '',
},
},
key: 'shopId',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '工段名称',
search: false,
width: 120,
dataIndex: 'sectionName',
key: 'sectionId',
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelectionByShop',
linkParams: {
shopId: '',
},
},
},
{
title: '产线名称',
search: false,
width: 120,
dataIndex: 'productLineName',
valueType: 'select',
key: 'productLineName',
options: {
path: '/auth/sysProductionLine/getAllProductLineSelectionByShop',
linkParams: {
shopId: '',
},
},
},
]}
path={urlParams_correlation.zsb}
params={{ id: drawer?.item?.id }}
resizeable={false}
/>
<Divider />
<AutoTable
pagetitle="父设备"
columns={[
{
title: '设备编号',
dataIndex: 'equipmentNo',
search: false,
key: 'equipmentNo',
width: 120,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '设备名称',
dataIndex: 'equipmentName',
search: false,
width: 120,
key: 'equipmentName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '公司名称',
dataIndex: 'organizationName',
width: 120,
key: 'organizationId',
search: false,
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '部门名称',
width: 120,
search: false,
valueType: 'treeSelect',
dataIndex: 'departmentName',
key: 'departmentId',
options: {
path: '/auth/sysDepartment/query/children/tree',
linkParams: {
organizationId: 'parentId',
},
},
},
{
title: '工厂名称',
search: false,
dataIndex: 'factoryName',
key: 'factoryId',
width: 120,
valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '车间名称',
dataIndex: 'shopName',
search: false,
width: 120,
valueType: 'select',
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
factoryId: '',
},
},
key: 'shopId',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '工段名称',
width: 120,
dataIndex: 'sectionName',
key: 'sectionId',
search: false,
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelectionByShop',
linkParams: {
shopId: '',
},
},
},
{
title: '产线名称',
width: 120,
dataIndex: 'productLineName',
valueType: 'select',
search: false,
key: 'productLineName',
options: {
path: '/auth/sysProductionLine/getAllProductLineSelectionByShop',
linkParams: {
shopId: '',
},
},
},
]}
path={urlParams_correlation.fsb}
params={{ id: drawer?.item?.id }}
resizeable={false}
/>
</>
);
};
//履历查询
const Curritae = () => {
return (
<>
<ProDescriptions
title="设备信息"
request={async () => {
const { data } = await doFetch({
url: urlParams.detail,
params: { id: drawer?.item?.id },
});
return {
success: true,
data: data?.data,
};
}}
columns={[
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '位置号',
dataIndex: 'positionNo',
key: 'positionNo',
},
{
title: '公司名称',
dataIndex: 'organizationName',
key: 'organizationId',
},
{
title: '部门名称',
dataIndex: 'departmentName',
key: 'departmentId',
},
{
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryId',
},
{
title: '车间名称',
dataIndex: 'shopName',
key: 'shopId',
},
{
title: '工段名称',
dataIndex: 'sectionName',
key: 'sectionId',
},
{
title: '产线名称',
dataIndex: 'productLineName',
key: 'productLineName',
},
]}
/>
<Divider />
<AutoTable
pagetitle="履历详情"
columns={[
{
title: '操作时间',
dataIndex: 'createTime',
key: 'operateTimeList',
width: 120,
searchValueType: 'dateRange',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '履历类型',
dataIndex: 'logTypeName',
width: 120,
key: 'logType',
valueType: 'select',
options: [
{
label: '改造',
value: '1',
},
{
label: '报废',
value: '2',
},
{
label: '调拨',
value: '3',
},
{
label: '借用',
value: '4',
},
{
label: '归还',
value: '5',
},
],
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '相关单号',
dataIndex: 'relateNo',
width: 120,
key: 'relateNo',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
render: (text, row) => {
return (
<a
onClick={() => {
setCurrDrawer((s) => ({
...s,
visible: true,
item: row,
val: 'only',
title: `${row.logTypeName}详情`,
}));
}}
>
{row.relateNo}
</a>
);
},
},
]}
path={urlParams_resume.list}
params={{ equipmentId: drawer?.item?.id }}
resizeable={false}
/>
</>
);
};
return (
<>
<Tabs
activeKey={activeTab}
onChange={setactiveTab}
items={[
{
label: '基础信息',
key: 1,
children: <BaseInfo />,
},
{
label: '相关设备',
key: 2,
children: <Correlation />,
},
{
label: '履历查询',
key: 3,
children: <Curritae />,
},
]}
/>
</>
);
};
// 子设备
const EditChildEquipment = () => {
const [selectArr, setSelectArr] = useState([]);
useEffect(() => {
const fun = async () => {
const result = await doFetch({
url: '/asset/equipment/children/selected/queryList',
params: { id: drawer?.item?.id },
});
// //console.log(result);
if (!result?.data?.dataList.length == 0) {
setSelectArr(result?.data?.dataList.map((it) => it.id));
}
};
fun();
}, []);
const columns = [
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
search: false,
width: 120,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '设备名称',
dataIndex: 'equipmentName',
width: 120,
key: 'equipmentName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '公司名称',
dataIndex: 'organizationName',
width: 120,
key: 'organizationId',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '部门名称',
width: 120,
valueType: 'treeSelect',
dataIndex: 'departmentName',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
key: 'departmentId',
options: {
path: '/auth/sysDepartment/query/children/tree',
linkParams: {
organizationId: 'parentId',
},
},
},
{
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryId',
width: 120,
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '车间名称',
dataIndex: 'shopName',
width: 120,
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
valueType: 'select',
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
factoryId: '',
},
},
search: false,
key: 'shopId',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '车间名称',
dataIndex: 'shopName',
width: 120,
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
options: {
path: '/auth/sysShop/getAllShopSelection',
params: {},
},
key: 'shopId',
hideInForm: true,
hideInTable: true,
},
{
title: '工段名称',
width: 120,
dataIndex: 'sectionName',
key: 'sectionId',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelectionByShop',
linkParams: {
shopId: '',
},
},
search: false,
},
{
title: '工段名称',
width: 120,
dataIndex: 'sectionName',
key: 'sectionId',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelection',
params: {},
},
hideInForm: true,
hideInTable: true,
},
{
title: '产线名称',
width: 120,
dataIndex: 'productLineName',
valueType: 'select',
key: 'productLineName',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
options: {
path: '/auth/sysProductionLine/getAllProductLineSelectionByShop',
linkParams: {
shopId: '',
},
},
search: false,
},
{
title: '产线名称',
width: 120,
dataIndex: 'productLineName',
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
key: 'productLineId',
options: {
path: '/auth/sysProductionLine/getAllProductLineSelection',
params: {},
},
hideInForm: true,
hideInTable: true,
},
];
return (
<>
<ProDescriptions
request={async () => {
const { data } = await doFetch({
url: urlParams.detail,
params: { id: drawer.item.id },
});
return {
success: true,
data: data.data,
};
}}
columns={[
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '位置号',
dataIndex: 'positionNo',
key: 'positionNo',
},
{
title: '公司名称',
dataIndex: 'organizationName',
key: 'organizationId',
},
{
title: '部门名称',
dataIndex: 'departmentName',
key: 'departmentId',
},
{
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryId',
},
{
title: '车间名称',
dataIndex: 'shopName',
key: 'shopId',
},
{
title: '工段名称',
dataIndex: 'sectionName',
key: 'sectionId',
},
{
title: '产线名称',
dataIndex: 'productLineName',
key: 'productLineName',
},
]}
/>
<AutoTable
pagetitle="选择子设备"
columns={columns}
path={urlParams_childEquipment.list}
params={{ id: drawer?.item?.id }}
resizeable={false}
rowSelection={{
type: 'checkbox',
selectedRowKeys: selectArr,
// defaultSelectedRowKeys: ,
onSelect: (record, selected, selectedRows, nativeEvent) => {
//console.log('selectedRowKeys changed: ', record, selected, selectedRows);
setSelectArr(() => {
return selectedRows.map((it) => it.id);
});
},
onSelectAll: (selected, selectedRows, changeRows) => {
//console.log(selected, selectedRows, changeRows);
if (selected) {
let arr = selectArr.concat(changeRows.map((it) => it.id));
setSelectArr(arr);
} else {
setSelectArr([]);
}
},
onSelectNone: () => {
//console.log(11);
setSelectArr([]);
},
}}
/>
<Space style={{ marginTop: 16 }}>
<Button
onClick={() => {
//console.log(drawer);
setDrawer((s) => ({
...s,
visible: false,
item: null,
detailpath: null,
params: null,
val: null,
onFinish: null,
}));
setSelectArr([]);
}}
>
取消
</Button>
<Button
type="primary"
onClick={async () => {
//console.log(selectArr);
let res = await doFetch({
url: urlParams_childEquipment.save,
params: {
equipmentId: drawer?.item?.id,
childrenIdList: selectArr,
},
});
if (res.code === '0000') {
message.success('新增成功!');
setDrawer((s) => ({
...s,
visible: false,
item: null,
}));
setSelectArr([]);
actionRef.current.reload();
}
}}
>
提交
</Button>
</Space>
</>
);
};
// 履历登记
const Resume = () => {
const [selectArr, setSelectArr] = useState([]);
const [activeTab, setactiveTab] = useState(1);
useEffect(() => {
const fun = async () => {
const result = await doFetch({
url: '/asset/equipment/children/selected/queryList',
params: { id: drawer?.item?.id },
});
// //console.log(result);
if (!result?.data?.dataList.length == 0) {
setSelectArr(result?.data?.dataList.map((it) => it.id));
}
};
fun();
let dis = resumeTab?.filter((it) => it?.disabled);
if (dis?.length > 0 && dis[0].key == 1) {
setactiveTab(
menulist?.filter((it) => !dis?.map((item) => item.key).includes(it?.key))[0]?.key,
);
} else {
setactiveTab(1);
}
}, []);
const menulist = useMemo(() => {
console.log(activeTab);
const fields = {
1: [
{
title: '改造日期',
dataIndex: 'reformDate',
key: 'reformDate',
valueType: 'date',
fieldProps: {
disabledDate: disabledDateOfDay,
},
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: {
maxCount: 5,
name: 'file',
},
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
},
],
2: [
{
title: '报废日期',
dataIndex: 'scrapDate',
key: 'scrapDate',
fieldProps: {
disabledDate: disabledDateOfDay,
},
valueType: 'date',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '报废原因',
dataIndex: 'scrapReason',
key: 'scrapReason',
valueType: 'textarea',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '上传文件(上限为5个)',
key: 'urlIds',
valueType: 'UploadDragger',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
fieldProps: {
name: 'file',
maxCount: 5,
},
},
],
3: [
{
title: '调入公司',
dataIndex: 'organizationName',
key: 'toOrganizationId',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '调入部门',
valueType: 'treeSelect',
dataIndex: 'departmentName',
key: 'toDepartmentId',
options: {
path: '/auth/sysDepartment/query/children/tree',
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',
fieldProps: {
disabledDate: disabledDateOfDay,
},
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '调拨原因',
dataIndex: 'transferReason',
key: 'transferReason',
valueType: 'textarea',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
],
4: [
{
title: '借用公司',
dataIndex: 'organizationName',
key: 'toOrganizationId',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '借用部门',
valueType: 'treeSelect',
dataIndex: 'departmentName',
key: 'toDepartmentId',
options: {
path: '/auth/sysDepartment/query/children/tree',
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',
fieldProps: {
disabledDate: disabledDateOfDay,
},
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: 'returnOrganizationId',
key: 'returnOrganizationId',
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '接收部门',
valueType: 'treeSelect',
dataIndex: 'returnDepartmentId',
key: 'returnDepartmentId',
options: {
path: '/auth/sysDepartment/query/children/tree',
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',
fieldProps: {
disabledDate: disabledDateOfDay,
},
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '备注',
dataIndex: 'remark',
key: 'remark',
valueType: 'textarea',
formItemProps: { rules: [{ required: false, message: '此项为必填项' }] },
},
],
};
let arr = [
{
label: '改造',
key: 1,
children: activeTab == 1 && (
<InitForm
fields={fields[activeTab]}
defaultFormValue={drawer?.item}
onFinish={async (vals) => {
//console.log(vals);
let res = await doFetch({
url: urlParams_resume.save,
params: { ...vals, type: '1', equipmentId: drawer?.item?.id },
});
if (res.code === '0000') {
message.success('登记成功!');
await setDrawer((s) => ({
...s,
visible: false,
item: null,
}));
actionRef.current.reload();
}
}}
/>
),
}, // remember to pass the key prop
{
label: '报废',
key: 2,
children: activeTab == 2 && (
<InitForm
fields={fields[activeTab]}
defaultFormValue={drawer?.item}
onFinish={async (vals) => {
let res = await doFetch({
url: urlParams_resume.save,
params: { ...vals, type: '2', equipmentId: drawer?.item?.id },
});
if (res.code === '0000') {
message.success('登记成功!');
await setDrawer((s) => ({
...s,
visible: false,
item: null,
}));
actionRef.current.reload();
}
}}
/>
),
},
{
label: '调拨',
key: 3,
children: activeTab == 3 && (
<InitForm
fields={fields[activeTab]}
defaultFormValue={drawer?.item}
onFinish={async (vals) => {
//console.log(vals);
let res = await doFetch({
url: urlParams_resume.save,
params: { ...vals, type: '3', equipmentId: drawer?.item?.id },
});
if (res.code === '0000') {
message.success('登记成功!');
await setDrawer((s) => ({
...s,
visible: false,
item: null,
}));
actionRef.current.reload();
}
}}
/>
),
},
{
label: '借用',
key: 4,
children: activeTab == 4 && (
<InitForm
defaultFormValue={drawer?.item}
fields={fields[activeTab]}
onFinish={async (vals) => {
//console.log(vals);
let res = await doFetch({
url: urlParams_resume.save,
params: { ...vals, type: '4', equipmentId: drawer?.item?.id },
});
if (res.code === '0000') {
message.success('登记成功!');
await setDrawer((s) => ({
...s,
visible: false,
item: null,
}));
actionRef.current.reload();
}
}}
/>
),
},
{
label: '归还',
key: 5,
children: activeTab == 5 && (
<InitForm
fields={fields[activeTab]}
defaultFormValue={drawer?.item}
onFinish={async (vals) => {
//console.log(vals);
let res = await doFetch({
url: urlParams_resume.save,
params: { ...vals, type: '5', equipmentId: drawer?.item?.id },
});
if (res.code === '0000') {
message.success('登记成功!');
await setDrawer((s) => ({
...s,
visible: false,
item: null,
}));
actionRef.current.reload();
}
}}
/>
),
},
];
let dis = resumeTab?.filter((it) => it?.disabled);
arr.forEach((item) => {
dis?.forEach((it) => {
if (item?.key == it?.key) {
let string = item.label;
item.disabled = true;
item.label = (
<Tooltip placement="topLeft" title={it.disabledReason}>
<span>{string}</span>
</Tooltip>
);
}
});
});
return arr;
}, [activeTab]);
return (
<>
<ProDescriptions
request={async () => {
const { data } = await doFetch({
url: urlParams.detail,
params: { id: drawer?.item?.id },
});
return {
success: true,
data: data?.data,
};
}}
columns={[
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '位置号',
dataIndex: 'positionNo',
key: 'positionNo',
},
{
title: '公司名称',
dataIndex: 'organizationName',
key: 'organizationId',
},
{
title: '部门名称',
dataIndex: 'departmentName',
key: 'departmentId',
},
{
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryId',
},
{
title: '车间名称',
dataIndex: 'shopName',
key: 'shopId',
},
{
title: '工段名称',
dataIndex: 'sectionName',
key: 'sectionId',
},
{
title: '产线名称',
dataIndex: 'productLineName',
key: 'productLineName',
},
{
title: '供应商',
dataIndex: 'supplierName',
key: 'supplierId',
},
{
title: '安装投产日期',
dataIndex: 'productDate',
key: 'productDate',
},
]}
/>
<Divider />
<Tabs activeKey={activeTab} onChange={setactiveTab} items={menulist} />
</>
);
};
const columns = useMemo(() => {
let defcolumn = getcolumns(setDrawer);
defcolumn[1].render = (text, row) => {
return (
<a
onClick={() => {
setDrawer((s) => ({
...s,
visible: true,
type: 'detail',
item: row,
val: 'only',
title: row.equipmentName + '的详细信息',
}));
}}
>
{row.equipmentName}
</a>
);
};
return defcolumn;
}, []);
const selectMoreDrawerType = (type) => {
switch (type) {
case 'detail':
return <Detail />;
default:
return null;
}
};
const containderef = useRef();
return (
<div style={{ position: 'relative' }}>
<AutoTable
columns={columns}
path={urlParams.list}
actionRef={actionRef}
resizeable={false}
x={1500}
extraparams={extraparams}
/>
<DrawerPro
fields={columns}
formRef={formRef}
placement="right"
onClose={() => {
setDrawer((s) => ({
...s,
visible: false,
}));
}}
{...drawer}
colProps={{
span: 8,
}}
>
{drawer?.visible && selectMoreDrawerType(drawer?.type)}
</DrawerPro>
<DrawerPro
placement="right"
onClose={async () => {
await setactiveTab(3);
await setCurrDrawer((s) => ({
...s,
visible: false,
item: null,
}));
}}
{...currDrawer}
colProps={{
span: 8,
}}
>
<ProDescriptions
title="设备信息"
request={async () => {
const { data } = await doFetch({
url: urlParams.detail,
params: { id: drawer?.item?.id },
});
return {
success: true,
data: data?.data,
};
}}
columns={[
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '位置号',
dataIndex: 'positionNo',
key: 'positionNo',
},
{
title: '公司名称',
dataIndex: 'organizationName',
key: 'organizationId',
},
{
title: '部门名称',
dataIndex: 'departmentName',
key: 'departmentId',
},
{
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryId',
},
{
title: '车间名称',
dataIndex: 'shopName',
key: 'shopId',
},
{
title: '工段名称',
dataIndex: 'sectionName',
key: 'sectionId',
},
{
title: '产线名称',
dataIndex: 'productLineName',
key: 'productLineName',
},
]}
/>
<Divider />
<ProDescriptions
title={currDrawer?.item?.logTypeName + '信息'}
column={2}
request={async () => {
const { data } = await doFetch({
url: urlParams_resume.detail,
params: { id: currDrawer?.item?.id },
});
return {
success: true,
data: data?.data?.resume,
};
}}
columns={currfields[currDrawer?.item?.logType]}
/>
</DrawerPro>
</div>
);
}
export default Account;
import React, { useMemo } from 'react';
import DetailPro from '@/components/DetailPro';
import getcolumns from './columns';
const Basemsg = ({ drawer, activeKey }) => {
const columns = useMemo(() => {
let defcolumn = [];
if (activeKey == 'item-1') {
defcolumn = getcolumns(setdrawer, activeKey)?.columns ?? [];
} else {
doFetch({ url: '/base/paFormField/queryList', params: { formId: '2' } }).then(res => {
if (res.code == '0000') {
let column = [];
res?.data?.dataList?.forEach?.((el) => {
column.push({
...selectValueType(el.fieldChar, el.valueList),
title: el.fieldName,
dataIndex: el.id,
key: el.id,
});
});
defcolumn = [...(getcolumns(setdrawer, activeKey)?.columns ?? []), ...column];
}
})
}
return defcolumn;
}, [activeKey]);
const detailData = useMemo(() => {
let data = {};
if (activeKey == 'item-1') {
doFetch({ url: '/asset/equipment/detail', params: { id: row.id } }).then(res => {
if (res.code == '0000') {
data = res?.data?.data ?? {};
}
})
} else {
doFetch({ url: '/asset/equipment/detail', params: { id: row.id } }).then(res => {
if (res.code == '0000') {
let obj = {};
res?.data?.data['equipmentCharList']?.forEach?.((it) => {
obj[it?.fieldId] = it?.fieldRealValue;
});
data = { ...(res?.data?.data ?? {}), ...obj };
}
})
}
return data;
}, [activeKey]);
return <DetailPro
fields={columns}
detailpath="/"
params={{ id: drawer?.item?.id }}
/>
}
export default Basemsg;
\ No newline at end of file
import { Tooltip, Image, Tag } from 'antd';
import { doFetch } from '@/utils/doFetch';
function getcolumns(setdrawer, activeKey) {
return activeKey == 'item-1' ? {
columns: [
{
title: '设备编号',
dataIndex: 'f1',
key: 'f1',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
colProps: { span: 8 },
},
{
title: '设备名称',
dataIndex: 'f2',
key: 'f2',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
colProps: { span: 8 },
render: (_, row) => {
return (
<Tooltip title={row.f2}>
<a
className="table-cell"
onClick={async () => {
setdrawer && setdrawer((s) => ({
...s,
visible: true,
item: row,
val: 'only',
title: '设备详情'
}));
}}
>
{row.f2}
</a>
</Tooltip>
);
}
},
{
title: '资产编号',
dataIndex: 'f3',
key: 'f3',
colProps: { span: 8 }
},
{
title: '设备品牌',
dataIndex: 'f4',
key: 'f4',
colProps: { span: 8 }
},
{
title: '设备型号',
dataIndex: 'f5',
key: 'f5',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
valueType: 'select',
options: { path: '/', params: {} },
colProps: { span: 8 }
},
{
title: '公司名称',
dataIndex: 'f6',
key: 'f6',
hideInSearch: true,
hideInTable: true,
valueType: 'select',
options: { path: '/', params: {} },
colProps: { span: 8 }
},
{
title: '部门名称',
dataIndex: 'f7',
key: 'f7',
formItemProps: { rules: [{ required: false, message: '此项为必填项' }] },
hideInSearch: true,
hideInTable: true,
valueType: 'select',
options: { path: '/', linkParams: { f6: '' } },
colProps: { span: 8 }
},
{
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryName',
valueType: 'input',
hideInSearch: true,
hideInTable: true,
hideInDescriptions: true,
colProps: { span: 8 },
fieldProps: {
disabled: true
}
},
{
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryId',
valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
hideInForm: true,
colProps: { span: 8 }
},
{
title: '车间名称',
dataIndex: 'shopName',
key: 'shopId',
hideInSearch: true,
hideInTable: true,
valueType: 'select',
options: { path: '/auth/sysShop/getShopSelectionByFactory', linkParams: { factoryId: '' } },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
colProps: { span: 8 }
},
{
title: '工段名称',
dataIndex: 'sectionName',
key: 'sectionId',
hideInSearch: true,
hideInTable: true,
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelectionByShop',
linkParams: { shopId: '' },
},
colProps: { span: 8 }
},
{
title: '产线名称',
dataIndex: 'productionLineName',
key: 'productionLineId',
valueType: 'select',
hideInSearch: true,
hideInTable: true,
options: {
path: '/auth/sysProductionLine/getAllProductLineSelectionByShop',
linkParams: { shopId: '' },
},
colProps: { span: 8 }
},
{
title: '供应商',
dataIndex: 'f13',
key: 'f13',
valueType: 'select',
options: { path: '/', params: {} },
colProps: { span: 8 }
},
{
title: '保管单位',
dataIndex: 'f14',
key: 'f14',
colProps: { span: 8 }
},
{
title: '产权单位',
dataIndex: 'f15',
key: 'f15',
colProps: { span: 8 }
},
{
title: '上传图片',
dataIndex: 'f16',
key: 'f16',
hideInSearch: true,
hideInTable: true,
hideInDescriptions: true,
valueType: 'uploadImage',
fieldProps: {
limit: 1,
}
},
{
title: '图片',
dataIndex: 'f21',
key: 'f21',
hideInSearch: true,
render: (_, row) => {
return row.f21?.length && <Image src={row?.f21?.[0]?.url} />
}
},
{
title: '二维码',
dataIndex: 'f22',
key: 'f22',
hideInSearch: true,
render: (_, row) => {
return row.f22?.length && <Image src={row?.f22?.[0]?.url} />
}
},
{
title: '经营状态',
dataIndex: 'f20',
key: 'f20',
hideInForm: true,
valueType: 'select',
options: [
{ label: '闲置', value: '1' },
{ label: '预占', value: '2' },
{ label: '租赁', value: '3' },
{ label: '待复检', value: '4' },
{ label: '报废', value: '5' },
{ label: '未绑定', value: '6' },
{ label: '绑定', value: '7' },
{ label: '销售', value: '8' },
],
fixed: 'right'
},
],
pathconfig: {
add: '',
edit: '',
list: '',
delete: '',
},
} : {
columns: [
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
width: 120,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '设备名称',
dataIndex: 'equipmentName',
width: 220,
key: 'equipmentName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '位置号',
width: 120,
dataIndex: 'positionNo',
search: false,
hideInTable: true,
key: 'positionNo',
},
{
width: 120,
title: '设备类型',
dataIndex: 'equipmentTypeName',
key: 'equipmentTypeId',
valueType: 'treeSelect',
options: { path: '/asset/equipmentType/queryTreeList', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '设备型号',
dataIndex: 'equipmentModelName',
width: 120,
key: 'equipmentModelId',
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
options: { path: '/asset/equipmentModel/query/selection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '公司名称',
dataIndex: 'organizationName',
width: 120,
key: 'organizationId',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '部门名称',
width: 120,
valueType: 'treeSelect',
dataIndex: 'departmentName',
key: 'departmentId',
options: {
path: '/auth/sysDepartment/query/children/tree',
linkParams: {
organizationId: 'parentId',
},
},
},
{
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryId',
width: 120,
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '车间名称',
dataIndex: 'shopName',
width: 120,
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
factoryId: '',
},
},
key: 'shopId',
search: false,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '车间名称',
dataIndex: 'shopName',
width: 120,
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
options: {
path: '/auth/sysShop/getAllShopSelection',
params: {},
},
key: 'shopId',
hideInForm: true,
hideInTable: true,
},
{
title: '工段名称',
width: 120,
dataIndex: 'sectionName',
key: 'sectionId',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelectionByShop',
linkParams: {
shopId: '',
},
},
search: false,
},
{
title: '工段名称',
width: 120,
dataIndex: 'sectionName',
key: 'sectionId',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelection',
params: {},
},
hideInForm: true,
hideInTable: true,
},
{
title: '产线名称',
width: 120,
dataIndex: 'productLineName',
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
key: 'productLineId',
options: {
path: '/auth/sysProductionLine/getAllProductLineSelectionByShop',
linkParams: {
shopId: '',
},
},
search: false,
},
{
title: '产线名称',
width: 120,
dataIndex: 'productLineName',
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
key: 'productLineId',
options: {
path: '/auth/sysProductionLine/getAllProductLineSelection',
params: {},
},
hideInForm: true,
hideInTable: true,
},
{
title: '供应商',
width: 120,
valueType: 'select',
dataIndex: 'supplierName',
hideInTable: true,
search: false,
key: 'supplierId',
options: {
path: '/asset/equipmentSupplier/query/selection',
params: {},
},
},
{
title: '设备原值(万元)',
valueType: 'digit',
search: false,
hideInTable: true,
dataIndex: 'equipmentWorth',
key: 'equipmentWorth',
},
{
title: '安装投产日期',
hideInTable: true,
search: false,
dataIndex: 'productDate',
key: 'productDate',
valueType: 'date',
},
{
title: '图片',
width: 120,
dataIndex: 'pictureUrl',
search: false,
search: false,
key: 'picList',
valueType: 'uploadImage',
fieldProps: {
limit: 1,
},
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
render: (text, row) => {
if (row?.pictureUrl == null) {
return '暂无图片';
} else {
return <Image width={70} src={row.pictureUrl} />;
}
},
},
{
title: '二维码',
width: 120,
search: false,
dataIndex: 'qrCodeUrl',
key: 'qrCodeUrl',
valueType: 'uploadImage',
search: false,
hideInForm: true,
render: (text, row) => {
if (row?.qrCodeUrl == null) {
return (
<div
style={{
height: 50,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}
>
<span>暂无图片</span>
</div>
);
} else {
return <Image width={50} src={row.qrCodeUrl} />;
}
},
},
{
title: '状态名称',
search: false,
hideInTable: true,
dataIndex: 'statusName',
key: 'statusName',
hideInForm: true,
},
{
title: '设备状态',
dataIndex: 'status',
width: 120,
hideInForm: true,
fixed: 'right',
valueType: 'select',
options: [
{
label: '在用',
value: 1,
},
{
label: '借用中',
value: 2,
},
{
label: '报废',
value: 3,
},
],
key: 'status',
render: (text, row) => {
switch (row.status) {
case 1:
return <Tag color="success">在用</Tag>;
case 3:
return <Tag>报废</Tag>;
case 2:
return <Tag color="volcano">借用中</Tag>;
default:
break;
}
},
},
]
};
}
export default getcolumns;
import React, { 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 { useRequest } from "ahooks";
import styles from "./index.less";
import TreeRender from '@/components/TreeRender';
import { Divider, Tabs, ProDescriptions } from "antd";
import Account from "./Account";
import Basemsg from "./Basemsg";
const Devicedata = () => {
let actionRef = useRef();
const [drawer, setdrawer] = useState({
visible: false,
}),
[activeKey, catk] = useState('item-1'),
[currDrawer, setCurrDrawer] = useState({
visible: false,
});
const { run, loading, runAsync } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == "0000") {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
visible: false,
}));
}
},
});
const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer, activeKey)?.columns ?? [];
return defcolumn;
}, [activeKey]);
const items = useMemo(() => {
if (drawer.val == 'only') {
if (activeKey == 'item-1') {
return [
{ label: '基础信息', key: 'item-1', children: <Basemsg drawer={drawer} activeKey={activeKey} /> }
]
}
}
}, [drawer.val, activeKey]);
const tableItems = useMemo(() => {
return [
{
label: '租赁设备',
key: 'item-1',
children: <AutoTable
pagetitle={'设备列表'}
columns={columns}
path=''
actionRef={actionRef}
resizeable={false}
dataSource={[{ 'f1': '111', 'f2': '222', id: 1, status: 1, f12: 1, intelligentUnit: '11' }]}
bordered={false}
x={1500}
/>
},
{
label: '自主设备',
key: 'item-2',
children: <Account />
}
]
}, [columns]);
const onselecteTree = async (selectedKeys, e, alldata) => {
// let params = {
// treeNodeType: e.node.type,
// treeNodeKey: e.node.key,
// };
// setextraparams(params);
};
const selectValueType = (type, options) => {
switch (type) {
case 1:
return {
valueType: 'input',
};
case 2:
return {
valueType: 'select',
options,
};
case 3:
return {
valueType: 'radio',
options,
};
case 4:
return {
valueType: 'select',
options,
};
default:
break;
}
};
const fn2 = async () => {
const res = await doFetch({
url: urlParams.detail,
params: { id: drawer?.item?.id },
});
let obj = {};
res?.data?.data['equipmentCharList']?.forEach?.((it) => {
obj[it?.fieldId] = it?.fieldRealValue;
});
console.log('drawerpro:', {
...(res?.data?.data ?? {}),
...obj,
});
setrequest(
{
...(res?.data?.data ?? {}),
...obj,
} ?? {},
);
};
return <div className={styles.ledgerbox}>
<div className={styles.ledgerheader}>
<div className="ant-card-head" style={{ backgroundColor: 'white' }}>
<div className="ant-card-head-wrapper">
<div className="ant-card-head-title">
<h3 className="page-title">设备台账</h3>
</div>
</div>
</div>
</div>
<div className={styles.ledgercontent}>
<div className={styles.ledgerleft}>
<TreeRender url="/auth/sysFactory/getTree" onselected={onselecteTree} noaction={true} />
</div>
<div className={styles.ledgerright}>
<Tabs activeKey={activeKey} onChange={(key) => {
catk(key);
}} items={tableItems} />
</div>
</div>
<DrawerPro
{...drawer}
fields={columns}
params={{ id: drawer?.item?.id }}
defaultFormValue={drawer?.item ?? {}}
placement="right"
onClose={() => {
setdrawer((s) => ({
...s,
visible: false,
}));
}}
>
<Tabs items={items} />
</DrawerPro>
</div>
}
export default Devicedata;
\ No newline at end of file
.ledgerbox {
width: 100%;
height: 100%;
overflow: hidden;
background-color: #fff;
display: flex;
flex-direction: column;
position: relative;
.ledgerheader {
width: 100%;
border-bottom: 1px solid #f0f0f0;
flex-shrink: 0;
}
.ledgercontent {
flex: 1;
width: 100%;
overflow: hidden;
display: flex;
justify-content: space-between;
.ledgerleft {
width: 300px;
display: flex;
flex-direction: column;
height: 100%;
overflow-y: hidden;
padding: 0 16px;
flex-shrink: 0;
}
.ledgerright {
flex: 1;
border-left: 1px solid #f0f0f0;
overflow: hidden;
}
}
}
\ No newline at end of file
import React, { useMemo } from 'react';
import DetailPro from '@/components/DetailPro';
import AutoTable from '@/components/AutoTable/mtable';
const Resume = ({ setdrawer, drawer }) => {
const columns = [
......
......@@ -212,32 +212,8 @@ const Ledger = () => {
]
}
}
}, [drawer.val, drawer.item])
return <div className={styles.ledgerbox}>
<div className={styles.ledgerheader}>
<div className="ant-card-head" style={{ backgroundColor: 'white' }}>
<div className="ant-card-head-wrapper">
<div className="ant-card-head-title">
<h3 className="page-title">租赁台账</h3>
</div>
</div>
</div>
</div>
<div className={styles.ledgercontent}>
<div className={styles.ledgerleft}>
<TreeRender url="/auth/sysFactory/getTree" onselected={onselecteTree} noaction={true} />
</div>
<div className={styles.ledgerright}>
<AutoTable
pagetitle={'设备列表'}
columns={columns}
path={pathconfig?.list}
actionRef={actionRef}
resizeable={false}
dataSource={[{ 'f1': '111', 'f2': '222', id: 1, status: 1, f12: 1, intelligentUnit: '11' }]}
pageextra={() => {
}, [drawer.val, drawer.item]);
const rightExtra = () => {
return [
<PremButton
key='add'
......@@ -291,7 +267,32 @@ const Ledger = () => {
状态查看
</PremButton>,
];
}}
}
return <div className={styles.ledgerbox}>
<div className={styles.ledgerheader}>
<div className="ant-card-head" style={{ backgroundColor: 'white' }}>
<div className="ant-card-head-wrapper">
<div className="ant-card-head-title">
<h3 className="page-title">租赁台账</h3>
</div>
</div>
</div>
</div>
<div className={styles.ledgercontent}>
<div className={styles.ledgerleft}>
<TreeRender url="/auth/sysFactory/getTree" onselected={onselecteTree} noaction={true} />
</div>
<div className={styles.ledgerright}>
<AutoTable
pagetitle={'设备列表'}
columns={columns}
path={pathconfig?.list}
actionRef={actionRef}
resizeable={false}
dataSource={[{ 'f1': '111', 'f2': '222', id: 1, status: 1, f12: 1, intelligentUnit: '11' }]}
pageextra={rightExtra}
bordered={false}
x={1500}
/>
......@@ -300,11 +301,11 @@ const Ledger = () => {
<DrawerPro
{...drawer}
fields={columns}
// detailpath={drawer.type == 'add' ? '' : drawer?.detailpath}
params={{ id: drawer?.item?.id }}
detailpath={drawer.val == 'add' || !drawer?.item?.id ? '' : pathconfig?.detail}
params={drawer.val == 'add' ? {} : { id: drawer?.item?.id }}
defaultFormValue={drawer?.item ?? {}}
detailData={drawer?.item ?? {}}
placement="right"
onClose={() => {
setdrawer((s) => ({
......@@ -312,7 +313,6 @@ const Ledger = () => {
visible: false,
}));
}}
{...drawer}
onFinish={async (vals) => {
// if (drawer?.val == "add") {
// await runAsync({ url: pathconfig?.add, params: { ...vals } });
......
......@@ -8,13 +8,11 @@ function getcolumns(ifs, actionRef) {
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
width: 120,
},
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
width: 150,
formItemProps: {
rules: [
{
......@@ -24,10 +22,15 @@ function getcolumns(ifs, actionRef) {
],
},
},
{
title: '纳税人识别号',
dataIndex: 'taxpayerIdentificationNumber',
key: 'taxpayerIdentificationNumber',
},
{
title: '公司官网',
dataIndex: 'officialWebsite',
key: 'officialWebsite',
dataIndex: 'companyWebsite',
key: 'companyWebsite',
hideInTable: true,
search: false,
formItemProps: {
......@@ -41,8 +44,8 @@ function getcolumns(ifs, actionRef) {
},
{
title: '联系电话',
dataIndex: 'telephone',
key: 'telephone',
dataIndex: 'phone',
key: 'phone',
formItemProps: {
rules: [
{
......@@ -54,8 +57,8 @@ function getcolumns(ifs, actionRef) {
},
{
title: '邮箱',
dataIndex: 'email',
key: 'email',
dataIndex: 'companyEmail',
key: 'companyEmail',
formItemProps: {
rules: [
{
......@@ -70,7 +73,6 @@ function getcolumns(ifs, actionRef) {
dataIndex: 'address',
key: 'address',
search: false,
width: 320,
formItemProps: {
rules: [
{
......@@ -81,29 +83,24 @@ function getcolumns(ifs, actionRef) {
},
},
{
title: '状态',
dataIndex: 'status',
valueType: 'radio',
key: 'status',
options: [
{
label: '启用',
value: 1,
title: '设备总数(租赁)',
dataIndex: 'address1',
key: 'address1',
search: false,
hideInForm: true
},
{
label: '禁用',
value: 2,
},
],
hideInTable: true,
hideInForm: true,
title: '智能单元总数(租赁)',
dataIndex: 'address2',
key: 'address2',
search: false,
hideInForm: true
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
valueType: 'select',
search: false,
formItemProps: {
rules: [
{
......@@ -129,22 +126,21 @@ function getcolumns(ifs, actionRef) {
return (
<Switch
checkedChildren="启用"
unCheckedChildren="用"
unCheckedChildren="用"
checked={row?.status == 1}
disabled={row?.statusChangeable == 1 ? false : true}
onChange={(flag) => {
// //console.log(e);
if (flag) {
doFetch({
url: '/asset/equipmentSupplier/update/status',
params: { id: row.id, status: '1' },
url: '/lease/umEquipmentSupplier/startStop',
params: { id: row.id, status: '0' },
}).then(() => {
actionRef.current.reload();
});
} else {
doFetch({
url: '/asset/equipmentSupplier/update/status',
params: { id: row.id, status: '2' },
url: '/lease/umEquipmentSupplier/startStop',
params: { id: row.id, status: '1' },
}).then(() => {
actionRef.current.reload();
});
......@@ -158,8 +154,8 @@ function getcolumns(ifs, actionRef) {
title: '评分',
dataIndex: 'score',
key: 'score',
width: 50,
valueType: 'rate',
search: false,
searchValueType: 'digit',
fieldProps: {
defaultValue: 0,
......@@ -181,7 +177,6 @@ function getcolumns(ifs, actionRef) {
key: 'remark',
search: false,
valueType: 'textarea',
width: 300,
fieldProps: {
placeholder: '请输入',
showCount: true,
......@@ -200,7 +195,7 @@ function getcolumns(ifs, actionRef) {
title: '联系信息',
valueType: 'formList',
dataIndex: 'list',
key: 'supplierUserList',
key: 'supplierContactsList',
initialValue: [
{
state: 'all',
......@@ -214,8 +209,8 @@ function getcolumns(ifs, actionRef) {
columns: [
{
title: '联系人',
dataIndex: 'userName',
key: 'userName',
dataIndex: 'contactsName',
key: 'contactsName',
formItemProps: {
rules: [
{
......@@ -230,8 +225,8 @@ function getcolumns(ifs, actionRef) {
},
{
title: '手机号码',
dataIndex: 'telephone',
key: 'telephone',
dataIndex: 'mobilePhone',
key: 'mobilePhone',
colProps: {
sm: 6,
},
......@@ -255,8 +250,8 @@ function getcolumns(ifs, actionRef) {
},
{
title: '职务',
dataIndex: 'title',
key: 'title',
dataIndex: 'postName',
key: 'postName',
fieldProps: {
placeholder: '请输入职务',
},
......
......@@ -16,22 +16,18 @@ import ExtendField from '@/components/ExtendField';
import { doFetch } from '@/utils/doFetch';
import { Image, message, Divider } from 'antd';
import { ProDescriptions } from '@ant-design/pro-components';
const urlParams = {
save: '/lease/umEquipmentSupplier/save',
remove: '/lease/umEquipmentSupplier/deleteById',
list: '/lease/umEquipmentSupplier/queryList',
detail: '/lease/umEquipmentSupplier/queryById'
};
function Supplier(props) {
let actionRef = useRef(),
formRef = useRef();
const [drawer, setDrawer] = useState({
visible: false,
});
const urlParams = {
save: '/asset/equipmentSupplier/save',
remove: '/asset/equipmentSupplier/deleteById',
list: '/asset/equipmentSupplier/queryList',
detail: '/asset/equipmentSupplier/query/detail',
detail_nocp: '/asset/equipmentSupplier/queryById',
};
const edit = (text, row, _, action) => {
return (
<PremButton
......@@ -129,11 +125,16 @@ function Supplier(props) {
dataIndex: 'supplierName',
key: 'supplierName',
},
{ title: '公司官网', dataIndex: 'officialWebsite', key: 'officialWebsite' },
{
title: '纳税人识别号',
dataIndex: 'taxpayerIdentificationNumber',
key: 'taxpayerIdentificationNumber'
},
{ title: '公司官网', dataIndex: 'companyWebsite', key: 'companyWebsite' },
{
title: '联系电话',
dataIndex: 'telephone',
key: 'telephone',
dataIndex: 'phone',
key: 'phone',
},
{
title: '公司邮箱',
......@@ -190,6 +191,9 @@ function Supplier(props) {
};
const [request, setrequest] = useState();
useEffect(() => {
fn();
fn2();
}, []);
const fn = async () => {
let res = await doFetch({
url: '/base/paFormField/queryList',
......@@ -227,9 +231,6 @@ function Supplier(props) {
} ?? {},
);
};
fn();
fn2();
}, []);
return (
<>
<ProDescriptions dataSource={request} columns={columns} />
......@@ -238,8 +239,8 @@ function Supplier(props) {
columns={[
{
title: '联系人',
dataIndex: 'userName',
key: 'userName',
dataIndex: 'contactsName',
key: 'contactsName',
search: false,
formItemProps: {
rules: [
......@@ -253,8 +254,8 @@ function Supplier(props) {
{
title: '手机号码',
search: false,
dataIndex: 'telephone',
key: 'telephone',
dataIndex: 'mobilePhone',
key: 'mobilePhone',
},
{
title: '邮箱',
......@@ -265,8 +266,8 @@ function Supplier(props) {
{
title: '职务',
search: false,
dataIndex: 'title',
key: 'title',
dataIndex: 'postName',
key: 'postName',
fieldProps: {
placeholder: '请选择',
},
......@@ -280,7 +281,7 @@ function Supplier(props) {
},
},
]}
dataSource={request?.supplierUserList}
dataSource={request?.supplierContactsList}
resizeable={false}
pagination={false}
/>
......
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