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

1722

parent d1d0c1d5
...@@ -331,6 +331,12 @@ export default [ ...@@ -331,6 +331,12 @@ export default [
icon: '', icon: '',
component: './lease/devicedata', component: './lease/devicedata',
}, },
{
name: '租赁合同',
path: '/lease/contract',
icon: '',
component: './lease/contract',
},
], ],
}, },
]; ];
...@@ -43,6 +43,8 @@ const Mtable = (props) => { ...@@ -43,6 +43,8 @@ const Mtable = (props) => {
resizeable = false, resizeable = false,
dataSource, dataSource,
iscurrent = true, iscurrent = true,
toolBarRender = false,
dataSourceFieldsChange
} = props; } = props;
const actionRefs = actionRef ?? useRef(), const actionRefs = actionRef ?? useRef(),
formRefs = formRef ?? useRef(), formRefs = formRef ?? useRef(),
...@@ -358,7 +360,7 @@ const Mtable = (props) => { ...@@ -358,7 +360,7 @@ const Mtable = (props) => {
} }
: {}; : {};
const datas = dataSource ? { dataSource, toolBarRender: false } : { request }; const datas = dataSource ? { dataSource, toolBarRender: toolBarRender == false ? false : () => { } } : { request };
return ( return (
<ProTable <ProTable
{...props} {...props}
...@@ -385,6 +387,7 @@ const Mtable = (props) => { ...@@ -385,6 +387,7 @@ const Mtable = (props) => {
...newparams, ...newparams,
})); }));
} }
dataSourceFieldsChange && dataSourceFieldsChange(params)
}} }}
onSizeChange={(size) => { onSizeChange={(size) => {
localStorage.setItem('size', size); //设置全局表格规格缓存 localStorage.setItem('size', size); //设置全局表格规格缓存
......
...@@ -74,7 +74,7 @@ function DetailPro(props) { ...@@ -74,7 +74,7 @@ function DetailPro(props) {
return ( return (
<> <>
<Col span={24}> <Col span={24}>
<div className={styles.title} style={{ borderWidth: i == 0 ? 0 : 1 }}> <div className={styles.title} style={{ borderWidth: i == 0 ? 0 : 1, '--before': !(it.title || it?.render) ? 'none' : 'block', '--after': !(it.title || it?.render) ? '100%' : 'calc(100% - 160px)','--padb':!(it.title || it?.render) ? '20px' : '0' }}>
{it?.render ? it?.render?.(curitem[it.dataIndex], curitem) : it.title} {it?.render ? it?.render?.(curitem[it.dataIndex], curitem) : it.title}
</div> </div>
</Col> </Col>
......
@import '~antd/es/style/variable.less'; @import '~antd/es/style/variable.less';
.title { .title {
position: relative; position: relative;
width: 100%; width: 100%;
padding-top: 8px; padding-top: 8px;
padding-left: 12px; padding-left: 12px;
font-weight: bolder; font-weight: bolder;
padding-bottom: var(--padb);
&::before { &::before {
position: absolute; position: absolute;
top: 11px; top: 11px;
...@@ -14,12 +17,14 @@ ...@@ -14,12 +17,14 @@
background-color: @primary-color; background-color: @primary-color;
border-radius: 4px; border-radius: 4px;
content: ''; content: '';
display: var(--before);
} }
&::after { &::after {
position: absolute; position: absolute;
top: 18px; top: 18px;
right: 0px; right: 0px;
width: calc(100% - 160px); width: var(--after);
height: 1px; height: 1px;
border-bottom: 1px dotted rgba(0, 0, 0, 0.1); border-bottom: 1px dotted rgba(0, 0, 0, 0.1);
border-radius: 4px; border-radius: 4px;
......
...@@ -336,14 +336,14 @@ function Textarea({ item, colProps }) { ...@@ -336,14 +336,14 @@ function Textarea({ item, colProps }) {
} }
//digit //digit
function Digit({ item, colProps }) { function Digit({ item, colProps, curindex = 0 }) {
return ( return (
<> <>
<ProFormDigit <ProFormDigit
formItemProps={item.formItemProps} formItemProps={item.formItemProps}
name={item?.key ?? item?.dataIndex} name={item?.key ?? item?.dataIndex}
colProps={item.colProps ?? colProps} colProps={item.colProps ?? colProps}
label={item.title} label={curindex == 0 ? item.title : ""}
placeholder={`请输入${item.title}`} placeholder={`请输入${item.title}`}
min={item.min} min={item.min}
max={item.max} max={item.max}
......
...@@ -115,7 +115,7 @@ function InitForm(props) { ...@@ -115,7 +115,7 @@ function InitForm(props) {
function formartData(item, val) { function formartData(item, val) {
let formartValue = val; let formartValue = val;
if (item.valueType == 'uploadBtn' || item.valueType == "uploadImage" || item.valueType == "uploadDragger") { if (item?.valueType == 'uploadBtn' || item?.valueType == "uploadImage" || item?.valueType == "uploadDragger") {
let stepval = val?.filter(it => { let stepval = val?.filter(it => {
if (!it?.response) { if (!it?.response) {
return it; return it;
......
...@@ -567,3 +567,13 @@ ol { ...@@ -567,3 +567,13 @@ ol {
} }
} }
} }
.ledgerf {
.ant-card-head {
display: none !important;
}
.ant-card-body {
padding: 0 !important;
}
}
\ No newline at end of file
...@@ -712,7 +712,7 @@ function Model(props) { ...@@ -712,7 +712,7 @@ function Model(props) {
render: (text, row) => <Image width={70} src={row.qrCodeUrl} />, render: (text, row) => <Image width={70} src={row.qrCodeUrl} />,
}, },
]; ];
const [newfieldscolumns, setnewfieldscolumns] = useState(columns); const [newfieldscolumns, setnewfieldscolumns] = useState([]);
const selectValueType = (type, options) => { const selectValueType = (type, options) => {
switch (type) { switch (type) {
case 1: case 1:
......
This diff is collapsed.
/* 故障报修
* @Author: Li Hanlin
* @Date: 2022-12-02 11:41:03
* @Last Modified by: Li Hanlin
* @Last Modified time: 2023-02-10 17:58:21
*/
import * as React from 'react';
import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch';
import Addform from '@/components/Addform';
import Detail from '@/components/RepaireDetail/Detail';
function Contract(props) {
let actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
open: false,
}),
[activeTabKey, setactiveTabKey] = useState('1');
const { run, loading } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
open: false,
}));
}
},
});
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '编辑',
val: 'edit',
}));
},
}}
>
编辑
</PremButton>
);
};
const remove = (text, row, _, action) => {
if (row?.status == 1) {
return (
<PremButton
pop={{
title: '是否删除?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
删除
</PremButton>
);
} else {
return <></>;
}
};
const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.columns;
let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
if (activeTabKey == 1) {
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [],
});
} else {
return defcolumn;
}
}, [activeTabKey]);
const pathconfig = useMemo(() => {
let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
return defpath;
}, [activeTabKey]);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle={<h3 className="page-title">租赁合同</h3>}
columns={columns}
path={pathconfig?.list}
actionRef={actionRef}
pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={false}
addconfig={{
// access: 'sysDepartment_save',
name: '新增',
btn: {
disabled: false,
type: 'primary',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: {},
title: '新增',
val: 'add'
}));
},
},
}}
tabList={getcolumns()}
activeTabKey={activeTabKey}
onTabChange={(key) => {
setactiveTabKey(key);
}}
/>
<DrawerPro
fields={columns}
detailpath={pathconfig?.detail || null}
detailData={drawer?.item}
defaultFormValue={drawer?.item}
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
onClose={() => {
setdrawer((s) => ({
...s,
open: false,
}));
}}
{...drawer}
onFinish={(vals) => {
if (drawer?.val == 'add') {
run({ url: pathconfig?.add || '/add', params: { ...vals } });
} else if (drawer?.val == 'edit') {
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
}
}}
>
{/* {selectType(drawer?.val)} */}
</DrawerPro>
</div>
);
}
export default Contract;
...@@ -24,7 +24,7 @@ function getcolumns(setdrawer) { ...@@ -24,7 +24,7 @@ function getcolumns(setdrawer) {
onClick={() => { onClick={() => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, open: true,
item: row, item: row,
val: 'detailaddon', val: 'detailaddon',
title: '客户信息' title: '客户信息'
......
...@@ -8,7 +8,7 @@ import { useRequest } from "ahooks"; ...@@ -8,7 +8,7 @@ import { useRequest } from "ahooks";
const Custom = () => { const Custom = () => {
let actionRef = useRef(); let actionRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setdrawer] = useState({
visible: false, open: false,
}); });
const { run, loading, runAsync } = useRequest(doFetch, { const { run, loading, runAsync } = useRequest(doFetch, {
manual: true, manual: true,
...@@ -17,7 +17,7 @@ const Custom = () => { ...@@ -17,7 +17,7 @@ const Custom = () => {
actionRef?.current?.reload(); actionRef?.current?.reload();
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: false, open: false,
item: {} item: {}
})); }));
} }
...@@ -33,7 +33,7 @@ const Custom = () => { ...@@ -33,7 +33,7 @@ const Custom = () => {
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, open: true,
item: row, item: row,
val: 'edit', val: 'edit',
title: '编辑' title: '编辑'
...@@ -106,7 +106,7 @@ const Custom = () => { ...@@ -106,7 +106,7 @@ const Custom = () => {
// let res = await doFetch({url:}) // let res = await doFetch({url:})
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, open: true,
item: {}, item: {},
params: {}, params: {},
title: '新增', title: '新增',
...@@ -126,7 +126,7 @@ const Custom = () => { ...@@ -126,7 +126,7 @@ const Custom = () => {
onClose={() => { onClose={() => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: false, open: false,
})); }));
}} }}
onFinish={async (vals) => { onFinish={async (vals) => {
......
This diff is collapsed.
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import DetailPro from '@/components/DetailPro'; import DetailPro from '@/components/DetailPro';
import getcolumns from './columns'; import getcolumns from './columns';
import { doFetch } from '@/utils/doFetch';
const Basemsg = ({ drawer, activeKey }) => { const Basemsg = ({ drawer, activeKey, setdrawer }) => {
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = []; let defcolumn = [];
if (activeKey == 'item-1') { if (activeKey == 'item-1') {
...@@ -29,14 +29,13 @@ const Basemsg = ({ drawer, activeKey }) => { ...@@ -29,14 +29,13 @@ const Basemsg = ({ drawer, activeKey }) => {
const detailData = useMemo(() => { const detailData = useMemo(() => {
let data = {}; let data = {};
if (activeKey == 'item-1') { if (activeKey == 'item-1') {
doFetch({ url: '/asset/equipment/detail', params: { id: row.id } }).then(res => { doFetch({ url: '/asset/equipment/detail', params: { id: drawer?.item?.id } }).then(res => {
if (res.code == '0000') { if (res.code == '0000') {
data = res?.data?.data ?? {}; data = res?.data?.data ?? {};
} }
}) })
} else { } else {
doFetch({ url: '/asset/equipment/detail', params: { id: drawer?.item?.id } }).then(res => {
doFetch({ url: '/asset/equipment/detail', params: { id: row.id } }).then(res => {
if (res.code == '0000') { if (res.code == '0000') {
let obj = {}; let obj = {};
res?.data?.data['equipmentCharList']?.forEach?.((it) => { res?.data?.data['equipmentCharList']?.forEach?.((it) => {
...@@ -51,7 +50,7 @@ const Basemsg = ({ drawer, activeKey }) => { ...@@ -51,7 +50,7 @@ const Basemsg = ({ drawer, activeKey }) => {
}, [activeKey]); }, [activeKey]);
return <DetailPro return <DetailPro
fields={columns} fields={columns}
detailpath="/" detailData={detailData}
params={{ id: drawer?.item?.id }} params={{ id: drawer?.item?.id }}
/> />
} }
......
...@@ -3,6 +3,10 @@ import { doFetch } from '@/utils/doFetch'; ...@@ -3,6 +3,10 @@ import { doFetch } from '@/utils/doFetch';
function getcolumns(setdrawer, activeKey) { function getcolumns(setdrawer, activeKey) {
return activeKey == 'item-1' ? { return activeKey == 'item-1' ? {
columns: [ columns: [
{
title: '设备信息',
valueType: 'split'
},
{ {
title: '设备编号', title: '设备编号',
dataIndex: 'f1', dataIndex: 'f1',
...@@ -21,10 +25,10 @@ function getcolumns(setdrawer, activeKey) { ...@@ -21,10 +25,10 @@ function getcolumns(setdrawer, activeKey) {
<Tooltip title={row.f2}> <Tooltip title={row.f2}>
<a <a
className="table-cell" className="table-cell"
onClick={async () => { onClick={() => {
setdrawer && setdrawer((s) => ({ setdrawer && setdrawer((s) => ({
...s, ...s,
visible: true, open: true,
item: row, item: row,
val: 'only', val: 'only',
title: '设备详情' title: '设备详情'
...@@ -43,12 +47,40 @@ function getcolumns(setdrawer, activeKey) { ...@@ -43,12 +47,40 @@ function getcolumns(setdrawer, activeKey) {
key: 'f3', key: 'f3',
colProps: { span: 8 } colProps: { span: 8 }
}, },
{
title: '关联设备',
dataIndex: 'f18',
key: 'f18',
hideInForm: true,
colProps: { span: 8 }
},
{ {
title: '设备品牌', title: '设备品牌',
dataIndex: 'f4', dataIndex: 'f4',
key: 'f4', key: 'f4',
colProps: { span: 8 } colProps: { span: 8 }
}, },
{
title: '开始租赁日期',
dataIndex: 'f3',
key: 'f3',
valueType: 'dateRange',
hideInDescriptions: true,
},
{
title: '结束租赁日期',
dataIndex: 'f4',
key: 'f4',
valueType: 'dateRange',
hideInDescriptions: true,
},
{
title: '租赁合同单号',
dataIndex: 'f5',
key: 'f5',
valueType: 'dateRange',
hideInDescriptions: true,
},
{ {
title: '设备型号', title: '设备型号',
dataIndex: 'f5', dataIndex: 'f5',
...@@ -58,6 +90,23 @@ function getcolumns(setdrawer, activeKey) { ...@@ -58,6 +90,23 @@ function getcolumns(setdrawer, activeKey) {
options: { path: '/', params: {} }, options: { path: '/', params: {} },
colProps: { span: 8 } 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: '所属信息',
valueType: 'split'
},
{ {
title: '公司名称', title: '公司名称',
dataIndex: 'f6', dataIndex: 'f6',
...@@ -139,6 +188,22 @@ function getcolumns(setdrawer, activeKey) { ...@@ -139,6 +188,22 @@ function getcolumns(setdrawer, activeKey) {
}, },
colProps: { span: 8 } colProps: { span: 8 }
}, },
{
title: '关联客户',
dataIndex: 'f19',
key: 'f19',
hideInSearch: false,
hideInTable: false,
hideInForm: true,
valueType: 'select',
options: { path: '/', params: {} },
colProps: { span: 8 },
span: 3
},
{
title: '其他信息',
valueType: 'split'
},
{ {
title: '供应商', title: '供应商',
dataIndex: 'f13', dataIndex: 'f13',
...@@ -176,6 +241,7 @@ function getcolumns(setdrawer, activeKey) { ...@@ -176,6 +241,7 @@ function getcolumns(setdrawer, activeKey) {
dataIndex: 'f21', dataIndex: 'f21',
key: 'f21', key: 'f21',
hideInSearch: true, hideInSearch: true,
hideInForm: true,
render: (_, row) => { render: (_, row) => {
return row.f21?.length && <Image src={row?.f21?.[0]?.url} /> return row.f21?.length && <Image src={row?.f21?.[0]?.url} />
} }
...@@ -185,25 +251,22 @@ function getcolumns(setdrawer, activeKey) { ...@@ -185,25 +251,22 @@ function getcolumns(setdrawer, activeKey) {
dataIndex: 'f22', dataIndex: 'f22',
key: 'f22', key: 'f22',
hideInSearch: true, hideInSearch: true,
hideInForm: true,
render: (_, row) => { render: (_, row) => {
return row.f22?.length && <Image src={row?.f22?.[0]?.url} /> return row.f22?.length && <Image src={row?.f22?.[0]?.url} />
} }
}, },
{ {
title: '经营状态', title: '采集状态',
dataIndex: 'f20', dataIndex: 'f20',
key: 'f20', key: 'f20',
hideInForm: true, hideInForm: true,
valueType: 'select', valueType: 'select',
options: [ options: [
{ label: '闲置', value: '1' }, { label: '工作', value: '1' },
{ label: '预占', value: '2' }, { label: '待机', value: '2' },
{ label: '租赁', value: '3' }, { label: '报警', value: '3' },
{ label: '待复检', value: '4' }, { label: '关机', value: '4' }
{ label: '报废', value: '5' },
{ label: '未绑定', value: '6' },
{ label: '绑定', value: '7' },
{ label: '销售', value: '8' },
], ],
fixed: 'right' fixed: 'right'
}, },
......
...@@ -11,13 +11,13 @@ import { Divider, Tabs, ProDescriptions } from "antd"; ...@@ -11,13 +11,13 @@ import { Divider, Tabs, ProDescriptions } from "antd";
import Account from "./Account"; import Account from "./Account";
import Basemsg from "./Basemsg"; import Basemsg from "./Basemsg";
const Devicedata = () => { const Devicedata = () => {
let actionRef = useRef(); let actionRef = useRef(), formRef = useRef(), boxRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setdrawer] = useState({
visible: false, open: false,
}), }),
[activeKey, catk] = useState('item-1'), [activeKey, catk] = useState('item-1'),
[currDrawer, setCurrDrawer] = useState({ [currDrawer, setCurrDrawer] = useState({
visible: false, open: false,
}); });
const { run, loading, runAsync } = useRequest(doFetch, { const { run, loading, runAsync } = useRequest(doFetch, {
manual: true, manual: true,
...@@ -26,7 +26,7 @@ const Devicedata = () => { ...@@ -26,7 +26,7 @@ const Devicedata = () => {
actionRef?.current?.reload(); actionRef?.current?.reload();
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: false, open: false,
})); }));
} }
}, },
...@@ -41,7 +41,7 @@ const Devicedata = () => { ...@@ -41,7 +41,7 @@ const Devicedata = () => {
if (drawer.val == 'only') { if (drawer.val == 'only') {
if (activeKey == 'item-1') { if (activeKey == 'item-1') {
return [ return [
{ label: '基础信息', key: 'item-1', children: <Basemsg drawer={drawer} activeKey={activeKey} /> } { label: '基础信息', key: 'item-1', children: <Basemsg drawer={drawer} activeKey={activeKey} setdrawer={setdrawer} /> }
] ]
} }
} }
...@@ -52,7 +52,6 @@ const Devicedata = () => { ...@@ -52,7 +52,6 @@ const Devicedata = () => {
label: '租赁设备', label: '租赁设备',
key: 'item-1', key: 'item-1',
children: <AutoTable children: <AutoTable
pagetitle={'设备列表'}
columns={columns} columns={columns}
path='' path=''
actionRef={actionRef} actionRef={actionRef}
...@@ -60,15 +59,20 @@ const Devicedata = () => { ...@@ -60,15 +59,20 @@ const Devicedata = () => {
dataSource={[{ 'f1': '111', 'f2': '222', id: 1, status: 1, f12: 1, intelligentUnit: '11' }]} dataSource={[{ 'f1': '111', 'f2': '222', id: 1, status: 1, f12: 1, intelligentUnit: '11' }]}
bordered={false} bordered={false}
x={1500} x={1500}
toolBarRender={true}
formRef={formRef}
dataSourceFieldsChange={(val) => {
console.log(val);
}}
/> />
}, },
{ {
label: '自主设备', label: '自主设备',
key: 'item-2', key: 'item-2',
children: <Account /> children: <Account boxRef={boxRef} />
} }
] ]
}, [columns]); }, []);
const onselecteTree = async (selectedKeys, e, alldata) => { const onselecteTree = async (selectedKeys, e, alldata) => {
// let params = { // let params = {
// treeNodeType: e.node.type, // treeNodeType: e.node.type,
...@@ -76,54 +80,9 @@ const Devicedata = () => { ...@@ -76,54 +80,9 @@ const Devicedata = () => {
// }; // };
// setextraparams(params); // 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}> return <div className={styles.ledgerbox} ref={boxRef}>
<div className={styles.ledgerheader}> <div className={styles.ledgerheader}>
<div className="ant-card-head" style={{ backgroundColor: 'white' }}> <div className="ant-card-head" style={{ backgroundColor: 'white' }}>
<div className="ant-card-head-wrapper"> <div className="ant-card-head-wrapper">
...@@ -137,7 +96,7 @@ const Devicedata = () => { ...@@ -137,7 +96,7 @@ const Devicedata = () => {
<div className={styles.ledgerleft}> <div className={styles.ledgerleft}>
<TreeRender url="/auth/sysFactory/getTree" onselected={onselecteTree} noaction={true} /> <TreeRender url="/auth/sysFactory/getTree" onselected={onselecteTree} noaction={true} />
</div> </div>
<div className={styles.ledgerright}> <div className={`${styles.ledgerright} ledgerf`}>
<Tabs activeKey={activeKey} onChange={(key) => { <Tabs activeKey={activeKey} onChange={(key) => {
catk(key); catk(key);
}} items={tableItems} /> }} items={tableItems} />
...@@ -154,7 +113,7 @@ const Devicedata = () => { ...@@ -154,7 +113,7 @@ const Devicedata = () => {
onClose={() => { onClose={() => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: false, open: false,
})); }));
}} }}
> >
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
} }
.ledgerright { .ledgerright {
padding: 0 16px;
flex: 1; flex: 1;
border-left: 1px solid #f0f0f0; border-left: 1px solid #f0f0f0;
overflow: hidden; overflow: hidden;
......
This diff is collapsed.
...@@ -4,7 +4,7 @@ import AutoTable from '@/components/AutoTable'; ...@@ -4,7 +4,7 @@ import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton'; import PremButton from '@/components/PremButton';
import getcolumns from './columns'; import getcolumns from './columns';
import { doFetch } from '@/utils/doFetch'; import { doFetch } from '@/utils/doFetch';
import { useRequest } from "ahooks"; import { useRequest, useAsyncEffect } from "ahooks";
import styles from "./index.less"; import styles from "./index.less";
import TreeRender from '@/components/TreeRender'; import TreeRender from '@/components/TreeRender';
import { Divider, Tabs } from "antd"; import { Divider, Tabs } from "antd";
...@@ -15,8 +15,14 @@ import Basemsg from "./Basemsg"; ...@@ -15,8 +15,14 @@ import Basemsg from "./Basemsg";
const Ledger = () => { const Ledger = () => {
let actionRef = useRef(); let actionRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setdrawer] = useState({
visible: false, open: false,
}); }),
[defaultmsg, cds] = useState({
supplier: {},
factory: {}
}),
[node, cnode] = useState({}),
[extraparams, setextraparams] = useState({});
const { run, loading, runAsync } = useRequest(doFetch, { const { run, loading, runAsync } = useRequest(doFetch, {
manual: true, manual: true,
onSuccess: (res, params) => { onSuccess: (res, params) => {
...@@ -24,7 +30,7 @@ const Ledger = () => { ...@@ -24,7 +30,7 @@ const Ledger = () => {
actionRef?.current?.reload(); actionRef?.current?.reload();
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: false, open: false,
})); }));
} }
}, },
...@@ -45,36 +51,49 @@ const Ledger = () => { ...@@ -45,36 +51,49 @@ const Ledger = () => {
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {}; let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
return pathconf; return pathconf;
}, []); }, []);
useAsyncEffect(async () => {
let res = await doFetch({ url: "/lease/umEquipmentSupplier/queryByDefault", params: {} }),
res2 = await doFetch({ url: "/auth/sysFactory/queryByDefault", params: {} });
cds({
supplier: res?.data?.data ?? {},
factory: res2?.data?.data ?? {}
});
}, [])
const onselecteTree = async (selectedKeys, e, alldata) => { const onselecteTree = async (selectedKeys, e, alldata) => {
// let params = { let params = {};
// treeNodeType: e.node.type, switch (e.node.type) {
// treeNodeKey: e.node.key, case 1:
// }; params = { factoryId: e.node.key }
// setextraparams(params); break;
case 2:
params = { shopId: e.node.key }
break;
case 3:
params = { sectionId: e.node.key }
break;
case 4:
params = { productionLineId: e.node.key }
break;
default:
params = {};
}
setextraparams(params);
}; };
const getExtra = (text, row, _, action) => { const getExtra = (text, row, _, action) => {
/** //0: 报废 1: 预占 2: 租赁 3: 销售 4: 闲置 5:待复检 6: 未绑定 7: 绑定
* 1:闲置 let ifsd = row.status == 0,
* 2:预占 ifsa = row.status == 1,
* 3:租赁 ifsb = row.status == 2,
* 4:待复检 ifsg = row.status == 3,
* 5:报废 ifs = row.status == 4,
* 6:未绑定 ifsc = row.status == 5,
* 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, ifse = row.status == 6,
ifsf = row.status == 7, ifsf = row.status == 7,
ifsg = row.status == 8, devicetype1 = row.equipmentType == 1,
devicetype1 = row.f12 == 1, devicetype2 = row.equipmentType == 2,
devicetype2 = row.f12 == 2, intelligentUnit = row.ledgerEquipment;
intelligentUnit = row.intelligentUnit;
return [ return [
(ifs || ifse || ifsd) && <PremButton (ifs || ifse || ifsd) && <PremButton
...@@ -84,7 +103,7 @@ const Ledger = () => { ...@@ -84,7 +103,7 @@ const Ledger = () => {
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, open: true,
item: row, item: row,
val: 'edit', val: 'edit',
title: '编辑' title: '编辑'
...@@ -197,7 +216,7 @@ const Ledger = () => { ...@@ -197,7 +216,7 @@ const Ledger = () => {
} }
const items = useMemo(() => { const items = useMemo(() => {
if (drawer.val == 'only') { if (drawer.val == 'only') {
if (drawer.item.f12 == 1) { if (drawer.item.equipmentType == 1) {
return [ return [
{ label: '基础信息', key: 'item-1', children: <Basemsg drawer={drawer} /> }, { label: '基础信息', key: 'item-1', children: <Basemsg drawer={drawer} /> },
{ label: '绑定履历', key: 'item-2', children: <Resume drawer={drawer} /> }, { label: '绑定履历', key: 'item-2', children: <Resume drawer={drawer} /> },
...@@ -222,9 +241,13 @@ const Ledger = () => { ...@@ -222,9 +241,13 @@ const Ledger = () => {
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, open: true,
val: 'add', val: 'add',
title: '新增' title: '新增',
item: {
factoryName: defaultmsg?.factory?.factoryName,
supplierId: defaultmsg?.supplier?.id
}
})); }));
} }
}} }}
...@@ -291,10 +314,10 @@ const Ledger = () => { ...@@ -291,10 +314,10 @@ const Ledger = () => {
path={pathconfig?.list} path={pathconfig?.list}
actionRef={actionRef} actionRef={actionRef}
resizeable={false} resizeable={false}
dataSource={[{ 'f1': '111', 'f2': '222', id: 1, status: 1, f12: 1, intelligentUnit: '11' }]}
pageextra={rightExtra} pageextra={rightExtra}
bordered={false} bordered={false}
x={1500} x={1500}
extraparams={extraparams}
/> />
</div> </div>
</div> </div>
...@@ -310,7 +333,7 @@ const Ledger = () => { ...@@ -310,7 +333,7 @@ const Ledger = () => {
onClose={() => { onClose={() => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: false, open: false,
})); }));
}} }}
onFinish={async (vals) => { onFinish={async (vals) => {
......
...@@ -22,99 +22,7 @@ const urlParams = { ...@@ -22,99 +22,7 @@ const urlParams = {
list: '/lease/umEquipmentSupplier/queryList', list: '/lease/umEquipmentSupplier/queryList',
detail: '/lease/umEquipmentSupplier/queryById' detail: '/lease/umEquipmentSupplier/queryById'
}; };
function Supplier(props) { const detailcolumns = [
let actionRef = useRef(),
formRef = useRef();
const [drawer, setDrawer] = useState({
visible: false,
});
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setDrawer((s) => ({
...s,
visible: true,
// detailpath: urlParams.detail,
// params: { id: row?.id },
title: '编辑',
val: 'only',
type: 'edit',
item: row,
// onFinish: async (vals) => {
// let equipmentSupplierCharReqList = [];
// //console.log('id:', row.id);
// for (let i in vals) {
// if (!isNaN(Number(i))) {
// equipmentSupplierCharReqList.push({
// fieldId: i,
// fieldRealValue: vals[i],
// });
// delete vals[i];
// }
// }
// let params = {
// ...vals,
// id: row?.id,
// shopIdList: vals.shopId,
// equipmentSupplierCharReqList,
// };
// delete params.shopId;
// let res = await doFetch({
// url: urlParams.save,
// params,
// });
// if (res.code === '0000') {
// message.success('编辑成功!');
// setDrawer((s) => ({
// ...s,
// visible: false,
// }));
// actionRef.current.reload();
// }
// },
}));
},
}}
>
编辑
</PremButton>
);
};
const remove = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否删除该供应商?',
okText: '确认',
cancelText: '取消',
onConfirm: async () => {
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',
}}
>
删除
</PremButton>
);
};
const Details = () => {
const columns = [
{ {
title: '供应商编号', title: '供应商编号',
dataIndex: 'supplierNo', dataIndex: 'supplierNo',
...@@ -138,8 +46,8 @@ function Supplier(props) { ...@@ -138,8 +46,8 @@ function Supplier(props) {
}, },
{ {
title: '公司邮箱', title: '公司邮箱',
dataIndex: 'email', dataIndex: 'companyEmail',
key: 'email', key: 'companyEmail',
}, },
{ {
title: '地址', title: '地址',
...@@ -161,9 +69,12 @@ function Supplier(props) { ...@@ -161,9 +69,12 @@ function Supplier(props) {
dataIndex: 'remark', dataIndex: 'remark',
key: 'remark', key: 'remark',
}, },
]; ];
const Details = ({ drawer }) => {
const [newfieldscolumns, setnewfieldscolumns] = useState([]); const [newfieldscolumns, setnewfieldscolumns] = useState([]);
const [request, setrequest] = useState();
const selectValueType = (type, options) => { const selectValueType = (type, options) => {
switch (type) { switch (type) {
case 1: case 1:
...@@ -189,7 +100,7 @@ function Supplier(props) { ...@@ -189,7 +100,7 @@ function Supplier(props) {
break; break;
} }
}; };
const [request, setrequest] = useState();
useEffect(() => { useEffect(() => {
fn(); fn();
fn2(); fn2();
...@@ -223,7 +134,6 @@ function Supplier(props) { ...@@ -223,7 +134,6 @@ function Supplier(props) {
res?.data?.data['equipmentSupplierCharList']?.forEach?.((it) => { res?.data?.data['equipmentSupplierCharList']?.forEach?.((it) => {
obj[it?.fieldId] = it?.fieldRealValue; obj[it?.fieldId] = it?.fieldRealValue;
}); });
setrequest( setrequest(
{ {
...(res?.data?.data ?? {}), ...(res?.data?.data ?? {}),
...@@ -233,7 +143,7 @@ function Supplier(props) { ...@@ -233,7 +143,7 @@ function Supplier(props) {
}; };
return ( return (
<> <>
<ProDescriptions dataSource={request} columns={columns} /> <ProDescriptions dataSource={request} columns={detailcolumns} />
<AutoTable <AutoTable
pagetitle="联系信息" pagetitle="联系信息"
columns={[ columns={[
...@@ -292,6 +202,65 @@ function Supplier(props) { ...@@ -292,6 +202,65 @@ function Supplier(props) {
<ProDescriptions dataSource={request} columns={newfieldscolumns} /> <ProDescriptions dataSource={request} columns={newfieldscolumns} />
</> </>
); );
};
function Supplier(props) {
let actionRef = useRef(),
formRef = useRef();
const [drawer, setDrawer] = useState({
visible: false,
});
const edit = (text, row, _, action) => {
return (
<PremButton
key='edit'
btn={{
size: 'small',
onClick: () => {
setDrawer((s) => ({
...s,
visible: true,
// detailpath: urlParams.detail,
// params: { id: row?.id },
title: '编辑',
val: 'only',
type: 'edit',
item: row
}));
},
}}
>
编辑
</PremButton>
);
};
const remove = (text, row, _, action) => {
return (
<PremButton
key='remove'
pop={{
title: '是否删除该供应商?',
okText: '确认',
cancelText: '取消',
onConfirm: async () => {
let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
if (res.code === '0000') {
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
删除
</PremButton>
);
}; };
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(false, actionRef); let defcolumn = getcolumns(false, actionRef);
...@@ -324,7 +293,7 @@ function Supplier(props) { ...@@ -324,7 +293,7 @@ function Supplier(props) {
const selectMoreDrawerType = (type) => { const selectMoreDrawerType = (type) => {
switch (type) { switch (type) {
case 'detail': case 'detail':
return <Details />; return <Details drawer={drawer} />;
case 'add': case 'add':
return ( return (
<ExtendField <ExtendField
...@@ -357,11 +326,6 @@ function Supplier(props) { ...@@ -357,11 +326,6 @@ function Supplier(props) {
params, params,
}); });
if (res.code === '0000') { if (res.code === '0000') {
if (drawer?.title == '编辑') {
message.success('编辑成功!');
} else {
message.success('新增成功!');
}
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
...@@ -402,11 +366,6 @@ function Supplier(props) { ...@@ -402,11 +366,6 @@ function Supplier(props) {
params, params,
}); });
if (res.code === '0000') { if (res.code === '0000') {
if (drawer?.title == '编辑') {
message.success('编辑成功!');
} else {
message.success('新增成功!');
}
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: 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