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

1722

parent d1d0c1d5
......@@ -331,6 +331,12 @@ export default [
icon: '',
component: './lease/devicedata',
},
{
name: '租赁合同',
path: '/lease/contract',
icon: '',
component: './lease/contract',
},
],
},
];
......@@ -43,6 +43,8 @@ const Mtable = (props) => {
resizeable = false,
dataSource,
iscurrent = true,
toolBarRender = false,
dataSourceFieldsChange
} = props;
const actionRefs = actionRef ?? useRef(),
formRefs = formRef ?? useRef(),
......@@ -358,7 +360,7 @@ const Mtable = (props) => {
}
: {};
const datas = dataSource ? { dataSource, toolBarRender: false } : { request };
const datas = dataSource ? { dataSource, toolBarRender: toolBarRender == false ? false : () => { } } : { request };
return (
<ProTable
{...props}
......@@ -385,6 +387,7 @@ const Mtable = (props) => {
...newparams,
}));
}
dataSourceFieldsChange && dataSourceFieldsChange(params)
}}
onSizeChange={(size) => {
localStorage.setItem('size', size); //设置全局表格规格缓存
......
......@@ -74,7 +74,7 @@ function DetailPro(props) {
return (
<>
<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}
</div>
</Col>
......
@import '~antd/es/style/variable.less';
.title {
position: relative;
width: 100%;
padding-top: 8px;
padding-left: 12px;
font-weight: bolder;
padding-bottom: var(--padb);
&::before {
position: absolute;
top: 11px;
......@@ -14,15 +17,17 @@
background-color: @primary-color;
border-radius: 4px;
content: '';
display: var(--before);
}
&::after {
position: absolute;
top: 18px;
right: 0px;
width: calc(100% - 160px);
width: var(--after);
height: 1px;
border-bottom: 1px dotted rgba(0, 0, 0, 0.1);
border-radius: 4px;
content: '';
}
}
}
\ No newline at end of file
......@@ -336,14 +336,14 @@ function Textarea({ item, colProps }) {
}
//digit
function Digit({ item, colProps }) {
function Digit({ item, colProps, curindex = 0 }) {
return (
<>
<ProFormDigit
formItemProps={item.formItemProps}
name={item?.key ?? item?.dataIndex}
colProps={item.colProps ?? colProps}
label={item.title}
label={curindex == 0 ? item.title : ""}
placeholder={`请输入${item.title}`}
min={item.min}
max={item.max}
......
......@@ -115,7 +115,7 @@ function InitForm(props) {
function formartData(item, 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 => {
if (!it?.response) {
return it;
......
......@@ -566,4 +566,14 @@ 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) {
render: (text, row) => <Image width={70} src={row.qrCodeUrl} />,
},
];
const [newfieldscolumns, setnewfieldscolumns] = useState(columns);
const [newfieldscolumns, setnewfieldscolumns] = useState([]);
const selectValueType = (type, options) => {
switch (type) {
case 1:
......@@ -741,25 +741,25 @@ function Model(props) {
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,
});
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);
}
},
});
setnewfieldscolumns(column);
}
},
fn2 = async () => {
const res = await doFetch({
url: urlParams.detail,
......
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) {
onClick={() => {
setdrawer((s) => ({
...s,
visible: true,
open: true,
item: row,
val: 'detailaddon',
title: '客户信息'
......
......@@ -8,7 +8,7 @@ import { useRequest } from "ahooks";
const Custom = () => {
let actionRef = useRef();
const [drawer, setdrawer] = useState({
visible: false,
open: false,
});
const { run, loading, runAsync } = useRequest(doFetch, {
manual: true,
......@@ -17,7 +17,7 @@ const Custom = () => {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
visible: false,
open: false,
item: {}
}));
}
......@@ -33,7 +33,7 @@ const Custom = () => {
onClick: () => {
setdrawer((s) => ({
...s,
visible: true,
open: true,
item: row,
val: 'edit',
title: '编辑'
......@@ -106,7 +106,7 @@ const Custom = () => {
// let res = await doFetch({url:})
setdrawer((s) => ({
...s,
visible: true,
open: true,
item: {},
params: {},
title: '新增',
......@@ -126,7 +126,7 @@ const Custom = () => {
onClose={() => {
setdrawer((s) => ({
...s,
visible: false,
open: false,
}));
}}
onFinish={async (vals) => {
......
This diff is collapsed.
import React, { useMemo } from 'react';
import DetailPro from '@/components/DetailPro';
import getcolumns from './columns';
const Basemsg = ({ drawer, activeKey }) => {
import { doFetch } from '@/utils/doFetch';
const Basemsg = ({ drawer, activeKey, setdrawer }) => {
const columns = useMemo(() => {
let defcolumn = [];
if (activeKey == 'item-1') {
......@@ -29,14 +29,13 @@ const Basemsg = ({ drawer, activeKey }) => {
const detailData = useMemo(() => {
let data = {};
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') {
data = res?.data?.data ?? {};
}
})
} else {
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') {
let obj = {};
res?.data?.data['equipmentCharList']?.forEach?.((it) => {
......@@ -51,7 +50,7 @@ const Basemsg = ({ drawer, activeKey }) => {
}, [activeKey]);
return <DetailPro
fields={columns}
detailpath="/"
detailData={detailData}
params={{ id: drawer?.item?.id }}
/>
}
......
......@@ -3,6 +3,10 @@ import { doFetch } from '@/utils/doFetch';
function getcolumns(setdrawer, activeKey) {
return activeKey == 'item-1' ? {
columns: [
{
title: '设备信息',
valueType: 'split'
},
{
title: '设备编号',
dataIndex: 'f1',
......@@ -21,10 +25,10 @@ function getcolumns(setdrawer, activeKey) {
<Tooltip title={row.f2}>
<a
className="table-cell"
onClick={async () => {
onClick={() => {
setdrawer && setdrawer((s) => ({
...s,
visible: true,
open: true,
item: row,
val: 'only',
title: '设备详情'
......@@ -43,12 +47,40 @@ function getcolumns(setdrawer, activeKey) {
key: 'f3',
colProps: { span: 8 }
},
{
title: '关联设备',
dataIndex: 'f18',
key: 'f18',
hideInForm: true,
colProps: { span: 8 }
},
{
title: '设备品牌',
dataIndex: 'f4',
key: 'f4',
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: '设备型号',
dataIndex: 'f5',
......@@ -58,6 +90,23 @@ function getcolumns(setdrawer, activeKey) {
options: { path: '/', params: {} },
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: '公司名称',
dataIndex: 'f6',
......@@ -139,6 +188,22 @@ function getcolumns(setdrawer, activeKey) {
},
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: '供应商',
dataIndex: 'f13',
......@@ -176,6 +241,7 @@ function getcolumns(setdrawer, activeKey) {
dataIndex: 'f21',
key: 'f21',
hideInSearch: true,
hideInForm: true,
render: (_, row) => {
return row.f21?.length && <Image src={row?.f21?.[0]?.url} />
}
......@@ -185,25 +251,22 @@ function getcolumns(setdrawer, activeKey) {
dataIndex: 'f22',
key: 'f22',
hideInSearch: true,
hideInForm: true,
render: (_, row) => {
return row.f22?.length && <Image src={row?.f22?.[0]?.url} />
}
},
{
title: '经营状态',
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' },
{ label: '工作', value: '1' },
{ label: '待机', value: '2' },
{ label: '报警', value: '3' },
{ label: '关机', value: '4' }
],
fixed: 'right'
},
......
......@@ -11,13 +11,13 @@ import { Divider, Tabs, ProDescriptions } from "antd";
import Account from "./Account";
import Basemsg from "./Basemsg";
const Devicedata = () => {
let actionRef = useRef();
let actionRef = useRef(), formRef = useRef(), boxRef = useRef();
const [drawer, setdrawer] = useState({
visible: false,
open: false,
}),
[activeKey, catk] = useState('item-1'),
[currDrawer, setCurrDrawer] = useState({
visible: false,
open: false,
});
const { run, loading, runAsync } = useRequest(doFetch, {
manual: true,
......@@ -26,7 +26,7 @@ const Devicedata = () => {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
visible: false,
open: false,
}));
}
},
......@@ -41,7 +41,7 @@ const Devicedata = () => {
if (drawer.val == 'only') {
if (activeKey == 'item-1') {
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 = () => {
label: '租赁设备',
key: 'item-1',
children: <AutoTable
pagetitle={'设备列表'}
columns={columns}
path=''
actionRef={actionRef}
......@@ -60,15 +59,20 @@ const Devicedata = () => {
dataSource={[{ 'f1': '111', 'f2': '222', id: 1, status: 1, f12: 1, intelligentUnit: '11' }]}
bordered={false}
x={1500}
toolBarRender={true}
formRef={formRef}
dataSourceFieldsChange={(val) => {
console.log(val);
}}
/>
},
{
label: '自主设备',
key: 'item-2',
children: <Account />
children: <Account boxRef={boxRef} />
}
]
}, [columns]);
}, []);
const onselecteTree = async (selectedKeys, e, alldata) => {
// let params = {
// treeNodeType: e.node.type,
......@@ -76,54 +80,9 @@ const Devicedata = () => {
// };
// 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="ant-card-head" style={{ backgroundColor: 'white' }}>
<div className="ant-card-head-wrapper">
......@@ -137,7 +96,7 @@ const Devicedata = () => {
<div className={styles.ledgerleft}>
<TreeRender url="/auth/sysFactory/getTree" onselected={onselecteTree} noaction={true} />
</div>
<div className={styles.ledgerright}>
<div className={`${styles.ledgerright} ledgerf`}>
<Tabs activeKey={activeKey} onChange={(key) => {
catk(key);
}} items={tableItems} />
......@@ -154,7 +113,7 @@ const Devicedata = () => {
onClose={() => {
setdrawer((s) => ({
...s,
visible: false,
open: false,
}));
}}
>
......
......@@ -31,6 +31,7 @@
}
.ledgerright {
padding: 0 16px;
flex: 1;
border-left: 1px solid #f0f0f0;
overflow: hidden;
......
This diff is collapsed.
......@@ -4,7 +4,7 @@ import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import { doFetch } from '@/utils/doFetch';
import { useRequest } from "ahooks";
import { useRequest, useAsyncEffect } from "ahooks";
import styles from "./index.less";
import TreeRender from '@/components/TreeRender';
import { Divider, Tabs } from "antd";
......@@ -15,8 +15,14 @@ import Basemsg from "./Basemsg";
const Ledger = () => {
let actionRef = useRef();
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, {
manual: true,
onSuccess: (res, params) => {
......@@ -24,7 +30,7 @@ const Ledger = () => {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
visible: false,
open: false,
}));
}
},
......@@ -45,36 +51,49 @@ const Ledger = () => {
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
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) => {
// let params = {
// treeNodeType: e.node.type,
// treeNodeKey: e.node.key,
// };
// setextraparams(params);
let params = {};
switch (e.node.type) {
case 1:
params = { factoryId: e.node.key }
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) => {
/**
* 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,
//0: 报废 1: 预占 2: 租赁 3: 销售 4: 闲置 5:待复检 6: 未绑定 7: 绑定
let ifsd = row.status == 0,
ifsa = row.status == 1,
ifsb = row.status == 2,
ifsg = row.status == 3,
ifs = row.status == 4,
ifsc = 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;
devicetype1 = row.equipmentType == 1,
devicetype2 = row.equipmentType == 2,
intelligentUnit = row.ledgerEquipment;
return [
(ifs || ifse || ifsd) && <PremButton
......@@ -84,7 +103,7 @@ const Ledger = () => {
onClick: () => {
setdrawer((s) => ({
...s,
visible: true,
open: true,
item: row,
val: 'edit',
title: '编辑'
......@@ -197,7 +216,7 @@ const Ledger = () => {
}
const items = useMemo(() => {
if (drawer.val == 'only') {
if (drawer.item.f12 == 1) {
if (drawer.item.equipmentType == 1) {
return [
{ label: '基础信息', key: 'item-1', children: <Basemsg drawer={drawer} /> },
{ label: '绑定履历', key: 'item-2', children: <Resume drawer={drawer} /> },
......@@ -222,9 +241,13 @@ const Ledger = () => {
onClick: () => {
setdrawer((s) => ({
...s,
visible: true,
open: true,
val: 'add',
title: '新增'
title: '新增',
item: {
factoryName: defaultmsg?.factory?.factoryName,
supplierId: defaultmsg?.supplier?.id
}
}));
}
}}
......@@ -291,10 +314,10 @@ const Ledger = () => {
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}
extraparams={extraparams}
/>
</div>
</div>
......@@ -310,7 +333,7 @@ const Ledger = () => {
onClose={() => {
setdrawer((s) => ({
...s,
visible: false,
open: false,
}));
}}
onFinish={async (vals) => {
......
This diff is collapsed.
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