Commit 7249b9d6 authored by TZW's avatar TZW

1116

parent 2f5a7431
...@@ -80,7 +80,7 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max ...@@ -80,7 +80,7 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
let res = data?.data?.dataList ?? []; let res = data?.data?.dataList ?? [];
return [ return [
{ {
title: '全部', title: '设备树',
key: '00000000', key: '00000000',
children: res, children: res,
}, },
...@@ -122,7 +122,7 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max ...@@ -122,7 +122,7 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
overflow: 'hidden', overflow: 'hidden',
textOverflow: 'ellipsis', textOverflow: 'ellipsis',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
marginRight: 6 marginRight: 6,
}} }}
> >
{beforeStr} {beforeStr}
...@@ -131,21 +131,21 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max ...@@ -131,21 +131,21 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
</span> </span>
</Tooltip> </Tooltip>
) : ( ) : (
<Tooltip title={item.title} placement="bottom"> <Tooltip title={item.title} placement="bottom">
<span <span
style={{ style={{
display: 'inline-block', display: 'inline-block',
maxWidth: maxWidth ?? 88, maxWidth: maxWidth ?? 88,
overflow: 'hidden', overflow: 'hidden',
textOverflow: 'ellipsis', textOverflow: 'ellipsis',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
marginRight: 6 marginRight: 6,
}} }}
> >
{item.title} {item.title}
</span> </span>
</Tooltip> </Tooltip>
); );
const actiontitle = ( const actiontitle = (
<div <div
...@@ -397,19 +397,19 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max ...@@ -397,19 +397,19 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
></Input> ></Input>
</div> </div>
) : ( ) : (
<div> <div>
<div style={{ marginBottom: 15, color: '#f50', fontSize: 16 }}> <div style={{ marginBottom: 15, color: '#f50', fontSize: 16 }}>
当前结构:{modal.placeholder} 当前结构:{modal.placeholder}
</div>
<Input
placeholder="子结构"
allowClear
onChange={(e) => {
setsavetitle(e.target.value);
}}
></Input>
</div> </div>
)} <Input
placeholder="子结构"
allowClear
onChange={(e) => {
setsavetitle(e.target.value);
}}
></Input>
</div>
)}
</Modal> </Modal>
<Search <Search
value={search} value={search}
...@@ -420,6 +420,7 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max ...@@ -420,6 +420,7 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
<Tree <Tree
onSelect={(selectedKeys, e) => { onSelect={(selectedKeys, e) => {
// console.log(selectedKeys);
onselected?.(selectedKeys, e, alldata); onselected?.(selectedKeys, e, alldata);
}} }}
autoExpandParent={autoExpandParent} autoExpandParent={autoExpandParent}
......
import { Image } from 'antd'; import { Image, Tag } from 'antd';
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
...@@ -6,19 +6,25 @@ function getcolumns(setdrawer) { ...@@ -6,19 +6,25 @@ function getcolumns(setdrawer) {
title: '设备编号', title: '设备编号',
dataIndex: 'equipmentNo', dataIndex: 'equipmentNo',
key: 'equipmentNo', key: 'equipmentNo',
align: 'center',
width: 120,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ {
title: '设备名称', title: '设备名称',
dataIndex: 'equipmentName', dataIndex: 'equipmentName',
align: 'center',
width: 120,
key: 'equipmentName', key: 'equipmentName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ title: '位置号', dataIndex: 'positionNo', key: 'positionNo' }, { title: '位置号', width: 120, align: 'center', dataIndex: 'positionNo', key: 'positionNo' },
{ {
width: 120,
title: '设备类型', title: '设备类型',
align: 'center',
dataIndex: 'equipmentTypeName', dataIndex: 'equipmentTypeName',
key: 'equipmentTypeName', key: 'equipmentTypeId',
valueType: 'treeSelect', valueType: 'treeSelect',
options: { path: '/asset/equipmentType/queryTreeList', params: {} }, options: { path: '/asset/equipmentType/queryTreeList', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
...@@ -26,44 +32,125 @@ function getcolumns(setdrawer) { ...@@ -26,44 +32,125 @@ function getcolumns(setdrawer) {
{ {
title: '设备型号', title: '设备型号',
dataIndex: 'equipmentModelName', dataIndex: 'equipmentModelName',
key: 'equipmentModelName', width: 120,
align: 'center',
key: 'equipmentModelId',
valueType: 'select', valueType: 'select',
options: { path: '/asset/equipmentModel/query/selection', params: {} }, options: { path: '/asset/equipmentModel/query/selection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ {
title: '公司名称', title: '公司名称',
align: 'center',
dataIndex: 'organizationName', dataIndex: 'organizationName',
key: 'organizationName', width: 120,
key: 'organizationId',
valueType: 'select', valueType: 'select',
options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} }, options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{
title: '部门名称',
width: 120,
align: 'center',
valueType: 'select',
dataIndex: 'departmentName',
key: 'departmentId',
options: {
path: '/auth/sysDepartment/query/depart/selectbox',
linkParams: {
organizationId: 'parentId',
},
},
},
{ {
title: '工厂名称', title: '工厂名称',
dataIndex: 'factoryName', dataIndex: 'factoryName',
key: 'factoryName', key: 'factoryId',
width: 120,
align: 'center',
valueType: 'select', valueType: 'select',
options: { path: '/auth/sysDepartment/query/depart/selectbox', params: {} }, options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ title: '部门名称', dataIndex: 'departmentName', key: 'departmentName' },
{ {
title: '车间名称', title: '车间名称',
dataIndex: 'shopName', dataIndex: 'shopName',
key: 'shopName', align: 'center',
width: 120,
valueType: 'select',
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
linkParams: {
factoryId: '',
},
},
key: 'shopId',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
}, },
{ title: '工段名称', dataIndex: 'sectionName', key: 'sectionName' },
{ title: '产线名称', dataIndex: 'productLineName', key: 'productLineName' },
{ title: '供应商', dataIndex: 'supplierName', key: 'supplierName' },
{ title: '设备原值(万元)', dataIndex: 'equipmentWorth', key: 'equipmentWorth' },
{ {
title: '图片地址', title: '工段名称',
width: 100, width: 120,
dataIndex: 'sectionName',
align: 'center',
key: 'sectionId',
valueType: 'select',
options: {
path: '/auth/sysSection/getAllSectionSelectionByShop',
linkParams: {
shopId: '',
},
},
},
{
title: '产线名称',
width: 120,
dataIndex: 'productLineName',
valueType: 'select',
key: 'productLineName',
align: 'center',
options: {
path: 'auth/sysProductionLine/getAllProductLineSelectionByShop',
linkParams: {
shopId: '',
},
},
},
{
title: '供应商',
width: 120,
valueType: 'select',
dataIndex: 'supplierName',
align: 'center',
hideInTable: true,
key: 'supplierId',
options: {
path: '/asset/equipmentSupplier/query/selection',
params: {},
},
},
{
title: '设备原值(万元)',
hideInTable: true,
align: 'center',
dataIndex: 'equipmentWorth',
key: 'equipmentWorth',
},
{
title: '安装投产日期',
hideInTable: true,
align: 'center',
dataIndex: 'productDate',
key: 'productDate',
valueType: 'date',
},
{
title: '图片',
width: 120,
dataIndex: 'pictureUrl', dataIndex: 'pictureUrl',
search: false, search: false,
key: 'picList', key: 'picList',
align: 'center',
valueType: 'uploadImage', valueType: 'uploadImage',
fieldProps: { fieldProps: {
limit: 1, limit: 1,
...@@ -76,20 +163,61 @@ function getcolumns(setdrawer) { ...@@ -76,20 +163,61 @@ function getcolumns(setdrawer) {
}, },
], ],
}, },
render: (text, row) => <Image width={70} src={row.pictureUrl} />, render: (text, row) => {
if (row?.pictureUrl == null) {
return '暂无图片';
} else {
return <Image width={70} src={row.pictureUrl} />;
}
},
}, },
{ {
title: '二维码', title: '二维码',
width: 80, width: 120,
align: 'center',
align: 'center',
dataIndex: 'qrCodeUrl', dataIndex: 'qrCodeUrl',
key: 'qrCodeUrl', key: 'qrCodeUrl',
valueType: 'uploadImage', valueType: 'uploadImage',
search: false, search: false,
hideInForm: true, hideInForm: true,
render: (text, row) => <Image width={70} src={row.pictureUrl} />, render: (text, row) => {
if (row?.qrCodeUrl == null) {
return '暂无图片';
} else {
return <Image width={70} src={row.qrCodeUrl} />;
}
},
},
{
title: '状态名称',
align: 'center',
hideInTable: true,
dataIndex: 'statusName',
key: 'statusName',
hideInForm: true,
},
{
title: '设备状态',
dataIndex: 'status',
width: 120,
align: 'center',
hideInForm: true,
fixed: 'right',
key: 'status',
render: (text, row) => {
switch (row.status) {
case 1:
return <Tag color="success">在用</Tag>;
case 2:
return <Tag>报废</Tag>;
case 3:
return <Tag color="volcano">借用中</Tag>;
default:
break;
}
},
}, },
{ title: '状态名称', fixed: 'right', dataIndex: 'statusName', key: 'statusName' },
{ title: '设备状态', fixed: 'right', dataIndex: 'status', key: 'status' },
]; ];
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56 * @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-15 17:14:29 * @Last Modified time: 2022-11-16 17:19:50
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -12,8 +12,7 @@ import AutoTable from '@/components/AutoTable'; ...@@ -12,8 +12,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 { message } from 'antd'; import { message, Dropdown, Menu, Layout, Button } from 'antd';
import { Layout } from 'antd';
import TreeRender from '@/components/TreeRender'; import TreeRender from '@/components/TreeRender';
const { Sider, Content } = Layout; const { Sider, Content } = Layout;
...@@ -25,10 +24,10 @@ function Model(props) { ...@@ -25,10 +24,10 @@ function Model(props) {
}); });
const urlParams = { const urlParams = {
save: '/asset/equipmentModel/save', save: '/asset/equipment/save',
remove: '/asset/equipment/deleteById', remove: '/asset/equipment/deleteById',
list: '/asset/equipment/queryList', list: '/asset/equipment/queryList',
detail: '/asset/equipmentModel/queryById', detail: '/asset/equipment/detail',
}; };
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
...@@ -124,13 +123,88 @@ function Model(props) { ...@@ -124,13 +123,88 @@ function Model(props) {
); );
}; };
const more = (text, row, _, action) => {
const menu = (
<Menu
items={[
{
label: (
<a
onClick={() => {
setDrawer((s) => ({
...s,
visible: true,
item: row,
title: '详情',
val: 'only',
title: '编辑子设备',
}));
}}
>
编辑子设备
</a>
),
key: '0',
},
{
label: <a>履历登记</a>,
key: '1',
},
{
label: <a>关联备件(暂缓)</a>,
key: '2',
},
{
label: <a>寿命件台账(暂缓)</a>,
key: '3',
},
]}
/>
);
return (
<Dropdown
overlay={menu}
trigger={['click']}
arrow={true}
getPopupContainer={() => document.getElementsByClassName('ant-table-content')[0]}
>
<Button size="small">更多</Button>
</Dropdown>
);
};
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(setDrawer); let defcolumn = getcolumns(setDrawer);
defcolumn[1].render = (text, row) => {
return (
<a
onClick={() => {
setDrawer((s) => ({
...s,
visible: true,
// item: row,
title: '详情',
val: 'detail',
detailpath: urlParams.detail,
params: { id: row.id },
title: row.equipmentName + '的详细信息',
}));
}}
>
{row.equipmentName}
</a>
);
};
return defcolumn.concat({ return defcolumn.concat({
title: '操作', title: '操作',
valueType: 'option', valueType: 'option',
width: 150, fixed: 'right',
render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)], width: 200,
render: (text, row, _, action) => [
edit(text, row, _, action),
remove(text, row, _, action),
more(text, row, _, action),
],
}); });
}, []); }, []);
...@@ -145,7 +219,7 @@ function Model(props) { ...@@ -145,7 +219,7 @@ function Model(props) {
</div> </div>
<Layout style={{ height: '100%' }}> <Layout style={{ height: '100%' }}>
<Sider theme="light" width={300}> <Sider theme="light" width={300}>
<TreeRender /> <TreeRender url="/auth/sysFactory/getTree" onselected={() => {}} noaction={true} />
</Sider> </Sider>
<Content> <Content>
<AutoTable <AutoTable
...@@ -154,34 +228,53 @@ function Model(props) { ...@@ -154,34 +228,53 @@ function Model(props) {
path={urlParams.list} path={urlParams.list}
actionRef={actionRef} actionRef={actionRef}
pageextra={'add'} pageextra={'add'}
resizeable={true} resizeable={false}
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
disabled: false, disabled: false,
type: 'primary', type: 'primary',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: null, item: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
onFinish: async (vals) => {
console.log(vals);
let params = {
...vals,
};
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('新增成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
})); }));
}, },
}, },
}} }}
x={1500}
/> />
</Content> </Content>
</Layout> </Layout>
<DrawerPro <DrawerPro
fields={columns} fields={columns}
detailpath="/ngic-auth/sysUser/query/detail" // detailpath="/ngic-auth/sysUser/query/detail"
params={{ id: drawer?.item?.id }} // params={{ id: drawer?.item?.id }}
formRef={formRef} formRef={formRef}
placement="right" placement="right"
onClose={() => { onClose={() => {
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