Commit 6a05b2c7 authored by 左玲玲's avatar 左玲玲 😬

设备台账

parent 1c6fb9a4
...@@ -312,7 +312,13 @@ export default [ ...@@ -312,7 +312,13 @@ export default [
path: '/lease/custom', path: '/lease/custom',
icon: '', icon: '',
component: './lease/custom', component: './lease/custom',
} },
{
name: '租赁台账',
path: '/lease/ledger',
icon: '',
component: './lease/ledger',
},
], ],
}, },
]; ];
...@@ -586,7 +586,7 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) { ...@@ -586,7 +586,7 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) {
formRef?.current?.setFieldsValue({ [curkey]: ifclean }); formRef?.current?.setFieldsValue({ [curkey]: ifclean });
} }
return item.showAll ? [{ label: '全部', value: 'all' }, ...(res?.data?.dataList ?? [])] : []; return item.showAll ? [{ label: '全部', value: 'all' }, ...(res?.data?.dataList ?? [])] : (res?.data?.dataList ?? []);
}} }}
showSearch showSearch
/> />
...@@ -611,7 +611,7 @@ function NolinkSelect({ item, colProps }) { ...@@ -611,7 +611,7 @@ function NolinkSelect({ item, colProps }) {
options = { options = {
request: async (params) => { request: async (params) => {
let list = await doFetch({ url: curoption?.path, params: curoption?.params }); let list = await doFetch({ url: curoption?.path, params: curoption?.params });
return item.showAll ? [{ label: '全部', value: 'all' }, ...(list?.data?.dataList ?? [])] : []; return item.showAll ? [{ label: '全部', value: 'all' }, ...(list?.data?.dataList ?? [])] : (list?.data?.dataList ?? []);
}, },
}; };
} }
......
...@@ -329,7 +329,7 @@ function TreeRender({ ...@@ -329,7 +329,7 @@ function TreeRender({
return dataLists; return dataLists;
} }
return ( return (
<div style={{ ...style }}> <div style={{ ...style }} className='treenode'>
<Modal <Modal
{...modal} {...modal}
onCancel={() => { onCancel={() => {
......
...@@ -124,7 +124,7 @@ ol { ...@@ -124,7 +124,7 @@ ol {
font-size: 16px !important; font-size: 16px !important;
.ant-tabs-tab-btn { .ant-tabs-tab-btn {
color: @primary-color !important; color: @primary-color !important;
} }
} }
...@@ -541,4 +541,11 @@ ol { ...@@ -541,4 +541,11 @@ ol {
.ant-descriptions { .ant-descriptions {
margin-bottom: 24px; margin-bottom: 24px;
} }
}
.treenode {
.ant-tree-title {
display: flex !important;
align-items: center;
}
} }
\ No newline at end of file
import React, { useMemo } from 'react';
import DetailPro from '@/components/DetailPro';
import getcolumns from './columns';
const Basemsg = ({ drawer }) => {
const columns = useMemo(() => {
let defcolumn = getcolumns()?.columns ?? [];
return defcolumn;
}, []);
return <DetailPro
fields={columns}
detailpath="/"
params={{ id: drawer?.item?.id }}
/>
}
export default Basemsg;
\ No newline at end of file
import React, { useMemo } from 'react';
import DetailPro from '@/components/DetailPro';
import AutoTable from '@/components/AutoTable/mtable';
import { Tooltip } from "antd";
const Leaseresume = ({ setdrawer, drawer }) => {
const columns = [
{
title: '客户名称',
dataIndex: 'f1',
key: 'f1',
},
{
title: '开始租赁日期',
dataIndex: 'f3',
key: 'f3',
valueType: 'dateRange',
},
{
title: '实际结束日期',
dataIndex: 'f4',
key: 'f4',
valueType: 'dateRange',
},
{
title: '相关单号',
dataIndex: 'f2',
key: 'f2',
render: (_, row) => {
return (
<Tooltip title={row.f2}>
<a
className="table-cell"
onClick={() => {
}}
>
{row.f2}
</a>
</Tooltip>
);
}
},
];
return (
<AutoTable
columns={columns}
path={'/'}
resizeable={false}
dataSource={[{ f1: '111', f2: '222', id: 1, status: 1, f12: 1, intelligentUnit: '11' }]}
pageextra="none"
bordered={false}
/>
);
};
export default Leaseresume;
import React, { useMemo } from 'react';
import DetailPro from '@/components/DetailPro';
import AutoTable from '@/components/AutoTable/mtable';
import { Tooltip } from "antd";
const Operatinghistory = ({ setdrawer, drawer }) => {
const columns = useMemo(() => {
return [
{
title: '操作时间',
dataIndex: 'f3',
key: 'f3',
valueType: 'dateRange',
},
{
title: '操作人',
dataIndex: 'f4',
key: 'f4'
},
{
title: '操作类型',
dataIndex: 'f20',
key: 'f20',
valueType: 'select',
options: drawer.item.f12 == 1 ? [
{ label: '闲置', value: '1' },
{ label: '预占', value: '2' },
{ label: '租赁', value: '3' },
{ label: '待复检', value: '4' },
{ label: '报废', value: '5' },
{ label: '新增', value: '6' },
{ label: '销售', value: '8' },
] : [
{ label: '报废', value: '5' },
{ label: '未绑定', value: '6' },
{ label: '绑定', value: '7' },
{ label: '新增', value: '8' },
]
},
];
}, [drawer.item]);
return (
<AutoTable
columns={columns}
path={'/'}
resizeable={false}
dataSource={[{ f1: '111', f2: '222', id: 1, status: 1, f12: 1, intelligentUnit: '11' }]}
pageextra="none"
bordered={false}
/>
);
};
export default Operatinghistory;
import React, { useMemo } from 'react';
import DetailPro from '@/components/DetailPro';
import AutoTable from '@/components/AutoTable/mtable';
const Resume = ({ setdrawer, drawer }) => {
const columns = [
{
title: '设备编号',
dataIndex: 'f1',
key: 'f1',
},
{
title: '设备名称',
dataIndex: 'f2',
key: 'f2',
},
{
title: '绑定时间',
dataIndex: 'f3',
key: 'f3',
valueType: 'dateRange',
},
{
title: '解绑时间',
dataIndex: 'f4',
key: 'f4',
valueType: 'dateRange',
},
];
return (
<AutoTable
columns={columns}
path={'/'}
resizeable={false}
dataSource={[{ f1: '111', f2: '222', id: 1, status: 1, f12: 1, intelligentUnit: '11' }]}
pageextra="none"
bordered={false}
/>
);
};
export default Resume;
import { Tooltip, Image } from 'antd';
function getcolumns(setdrawer) {
return {
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={() => {
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: 'f18',
key: 'f18',
hideInForm: true,
hideInDescriptions: true,
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: 'f12',
key: 'f12',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
hideInSearch: false,
valueType: 'select',
options: [
{ label: '设备', value: '1' },
{ label: '智能单元', value: '2' },
],
colProps: { span: 8 }
},
{
title: '关联客户',
dataIndex: 'f19',
key: 'f19',
hideInSearch: false,
hideInTable: false,
hideInForm: true,
hideInDescriptions: true,
valueType: 'select',
options: { path: '/', params: {} },
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' },
],
colProps: {
fixed: 'right'
}
},
],
pathconfig: {
add: '',
edit: '',
list: '',
delete: '',
},
};
}
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 } from "antd";
import Leaseresume from "./Leaseresume";
import Operatinghistory from "./Operatinghistory";
import Resume from "./Resume";
import Basemsg from "./Basemsg";
const Ledger = () => {
let actionRef = useRef();
const [drawer, setdrawer] = 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)?.columns ?? [];
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 170,
render: (text, row, _, action) => getExtra(text, row, _, action),
colProps: {
fixed: 'right'
}
});
}, []);
const pathconfig = useMemo(() => {
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
return pathconf;
}, []);
const onselecteTree = async (selectedKeys, e, alldata) => {
// let params = {
// treeNodeType: e.node.type,
// treeNodeKey: e.node.key,
// };
// setextraparams(params);
};
const getExtra = (text, row, _, action) => {
/**
* 1:闲置
* 2:预占
* 3:租赁
* 4:待复检
* 5:报废
* 6:未绑定
* 7:绑定
* 8:销售
*/
let ifs = row.status == 1,
ifsa = row.status == 2,
ifsb = row.status == 3,
ifsc = row.status == 4,
ifsd = row.status == 5,
ifse = row.status == 6,
ifsf = row.status == 7,
ifsg = row.status == 8,
devicetype1 = row.f12 == 1,
devicetype2 = row.f12 == 2,
intelligentUnit = row.intelligentUnit;
return [
(ifs || ifse || ifsd) && <PremButton
key='edit'
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
visible: true,
item: row,
val: 'edit',
title: '编辑'
}));
},
}}
>
修改
</PremButton>,
devicetype1 && <PremButton
key='bind'
btn={{
size: 'small',
onClick: () => {
},
}}
>
绑定
</PremButton>,
devicetype2 && <PremButton
key='unbind'
pop={{
title: '是否解绑?',
okText: '确认',
cancelText: '取消',
onConfirm: async () => {
},
}}
btn={{
size: 'small',
}}
>
解绑
</PremButton>,
(ifs && !intelligentUnit || ifse) && <PremButton
key='Scrapped1'
pop={{
title: '是否报废?',
okText: '确认',
cancelText: '取消',
onConfirm: async () => {
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
报废
</PremButton>,
ifs && devicetype1 && intelligentUnit && <PremButton
key='Scrapped2'
pop={{
title: <div>该设备有关联智能单元,请确认是一同报废或释放出关联智能单元?<br />
一同报废-将关联智能单元也置为报废状态,<br />
释放-将关联智能单元的绑定解除且清空设备中关联智能单元的信息</div>,
okText: '释放',
cancelText: '一同报废',
onConfirm: async () => {
},
onCancel: async () => {
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
报废
</PremButton>,
ifsc && <PremButton
key='Scrapped1'
pop={{
title: '是否转闲置?',
okText: '确认',
cancelText: '取消',
onConfirm: async () => {
},
}}
btn={{
size: 'small',
}}
>
转闲置
</PremButton>,
ifsd && <PremButton
key='remove'
pop={{
title: '是否删除该设备?',
okText: '确认',
cancelText: '取消',
onConfirm: async () => {
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
删除
</PremButton>,
];
}
const items = useMemo(() => {
if (drawer.val == 'only') {
if (drawer.item.f12 == 1) {
return [
{ label: '基础信息', key: 'item-1', children: <Basemsg drawer={drawer} /> },
{ label: '绑定履历', key: 'item-2', children: <Resume drawer={drawer} /> },
{ label: '租赁履历', key: 'item-3', children: <Leaseresume drawer={drawer} /> },
{ label: '操作履历', key: 'item-4', children: <Operatinghistory drawer={drawer} /> }
]
} else {
return [
{ label: '基础信息', key: 'item-1', children: <Basemsg drawer={drawer} /> },
{ label: '绑定履历', key: 'item-2', children: <Resume drawer={drawer} /> },
{ label: '操作履历', key: 'item-4', children: <Operatinghistory drawer={drawer} /> }
]
}
}
}, [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={() => {
return [
<PremButton
key='add'
btn={{
type: 'primary',
onClick: () => {
setdrawer((s) => ({
...s,
visible: true,
val: 'add',
title: '新增'
}));
}
}}
>
新增
</PremButton>,
<PremButton
key='export'
btn={{
type: 'default',
onClick: () => {
},
style: { margin: '0 12px' }
}}
>
导出
</PremButton>,
<PremButton
key='exportqrcode'
btn={{
type: 'default',
onClick: () => {
},
}}
>
导出二维码
</PremButton>,
<PremButton
key='status'
btn={{
type: 'default',
onClick: () => {
},
style: { marginLeft: 12 }
}}
>
状态查看
</PremButton>,
];
}}
bordered={false}
x={1200}
/>
</div>
</div>
<DrawerPro
fields={columns}
// detailpath={drawer.type == 'add' ? '' : drawer?.detailpath}
params={{ id: drawer?.item?.id }}
defaultFormValue={drawer?.item ?? {}}
detailData={drawer?.item ?? {}}
placement="right"
onClose={() => {
setdrawer((s) => ({
...s,
visible: false,
}));
}}
{...drawer}
onFinish={async (vals) => {
// if (drawer?.val == "add") {
// await runAsync({ url: pathconfig?.add, params: { ...vals } });
// } else if (drawer?.val == "edit") {
// await runAsync({
// url: pathconfig?.edit,
// params: { ...vals, id: drawer?.item?.id },
// });
// }
}}
>
<Tabs items={items} />
</DrawerPro>
</div>
}
export default Ledger;
\ 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;
}
}
}
\ No newline at end of file
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