Commit 5f10de68 authored by 左玲玲's avatar 左玲玲 😬

1720

parent b252d3b5
...@@ -39,7 +39,7 @@ const Mtable = (props) => { ...@@ -39,7 +39,7 @@ const Mtable = (props) => {
activeTabKey, //激活的tabKey 拖拽表格唯一标识使用 其他情况用不到 activeTabKey, //激活的tabKey 拖拽表格唯一标识使用 其他情况用不到
refreshDep, //依赖刷新 (已废弃) refreshDep, //依赖刷新 (已废弃)
getDefaultSelected, //存在默认选中向上返回选中值 getDefaultSelected, //存在默认选中向上返回选中值
resizeable = true, resizeable = false,
dataSource, dataSource,
} = props; } = props;
...@@ -101,6 +101,7 @@ const Mtable = (props) => { ...@@ -101,6 +101,7 @@ const Mtable = (props) => {
if (Array.isArray(it.options)) { if (Array.isArray(it.options)) {
options = { options = {
fieldProps: { fieldProps: {
...it?.fieldProps,
options: [...it.options], options: [...it.options],
}, },
}; };
...@@ -162,6 +163,7 @@ const Mtable = (props) => { ...@@ -162,6 +163,7 @@ const Mtable = (props) => {
if (Array.isArray(it.options)) { if (Array.isArray(it.options)) {
options = { options = {
fieldProps: { fieldProps: {
...it?.fieldProps,
options: [...it.options], options: [...it.options],
}, },
}; };
......
...@@ -120,7 +120,7 @@ ol { ...@@ -120,7 +120,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;
} }
} }
...@@ -497,7 +497,7 @@ ol { ...@@ -497,7 +497,7 @@ ol {
top: -162px; top: -162px;
left: 74px; left: 74px;
color: #1890ff; color: #1890ff;
} }
.ant-popover-buttons { .ant-popover-buttons {
...@@ -508,4 +508,8 @@ ol { ...@@ -508,4 +508,8 @@ ol {
.ant-input-number { .ant-input-number {
width: 100%; width: 100%;
}
.ant-form-item-label {
pointer-events: none;
} }
\ No newline at end of file
function getcolumns(setdrawer) { import { Popconfirm, Switch } from 'antd';
return [ function getcolumns(setdrawer, run) {
{ return [
"tab": "未完成", {
"key": "1", tab: '未完成',
"columns": [ key: 1,
{ columns: [
"title": "维修单号", {
"dataIndex": "repairOrderNo", title: '点检计划单号',
"key": "repairOrderNo" dataIndex: 'checkNo',
}, key: 'checkNo',
{ hideInForm: true,
"title": "设备名称", render: (text, row, _, action) => {
"dataIndex": "equipmentName", return (
"key": "equipmentName" <a
}, onClick={() => {
{ setdrawer((s) => ({
"title": "故障描述", ...s,
"dataIndex": "faultDescription", open: true,
"key": "faultDescription" title: '详情',
}, val: 'detail',
{ type: 'detail',
"title": "报修人员", title: '详细信息',
"dataIndex": "repairUserName", item: row,
"key": "repairUserName" }));
}, }}
{ >
"title": "设备编号", {row?.checkNo}
"dataIndex": "equipmentNo", </a>
"key": "equipmentNo" );
}, },
{ },
"title": "报修时间", {
"dataIndex": "repairTime", title: '设备编号',
"key": "repairTimeList", dataIndex: 'equipmentNo',
"valueType": "dateTimeRange" key: 'equipmentNo',
}, hideInForm: true,
{ },
"title": "报修单号", {
"dataIndex": "repairNo", title: '设备名称',
"key": "repairNo" dataIndex: 'equipmentName',
}, key: 'equipmentName',
{ hideInForm: true,
"title": "工单状态", },
"dataIndex": "statusName", {
"key": "statusName" title: '工厂名称',
} dataIndex: 'factoryName',
], key: 'factoryId',
"pathconfig": { hideInForm: true,
"enableadd": false, valueType: 'select',
"enableedit": false, options: {
"enabledelete": false, path: '/auth/sysFactory/getAllFactorySelection',
"enabledetail": false, params: {},
"add": "", },
"edit": "", },
"list": "/repair/umRepairOrder/queryRepairOrderList", {
"delete": "", title: '车间名称',
"detail": "" dataIndex: 'shopName',
} key: 'shopId',
}, hideInForm: true,
{ valueType: 'select',
"tab": "已完成", options: {
"key": "2", path: '/auth/sysShop/getShopSelectionByFactory',
"columns": [ linkParams: {
{ factoryId: '',
"title": "维修单号", },
"dataIndex": "repairOrderNo", },
"key": "repairOrderNo" },
}, {
{ title: '点检类型',
"title": "设备编号", dataIndex: 'checkTypeName',
"dataIndex": "equipmentNo", key: 'checkType',
"key": "equipmentNo" valueType: 'select',
}, options: [
{ {
"title": "设备名称", label: '制造点检',
"dataIndex": "equipmentName", value: 1,
"key": "equipmentName" },
}, {
{ label: '设备点检',
"title": "故障描述", value: 2,
"dataIndex": "faultDescription", },
"key": "faultDescription" ],
}, formItemProps: {
{ rules: [
"title": "报修人员", {
"dataIndex": "repairUserName", required: true,
"key": "repairUserName" message: '此项为必填项',
}, },
{ ],
"title": "报修时间", },
"dataIndex": "repairTime", },
"key": "repairTimeList", {
"valueType": "dateTimeRange" title: '计划类型',
}, dataIndex: 'checkLoopName',
{ key: 'checkLoop',
"title": "报修单号", formItemProps: {
"dataIndex": "repairNo", rules: [
"key": "repairNo" {
}, required: true,
{ message: '此项为必填项',
"title": "工单状态", },
"dataIndex": "statusName", ],
"key": "statusName" },
} valueType: 'radio',
], searchValueType: 'select',
"pathconfig": { options: [
"enableadd": false, {
"enableedit": false, label: '单次',
"enabledelete": false, value: 1,
"enabledetail": false, },
"add": "", {
"edit": "", label: '周期',
"list": "/repair/umRepairOrder/queryRepairOrderList", value: 2,
"delete": "", },
"detail": "" ],
} },
} {
]; title: '周期(天)',
} dataIndex: 'checkCycle',
export default getcolumns; key: 'checkCycle',
hideInSearch: true,
\ No newline at end of file valueType: 'digit',
hideInForm: {
checkLoop: [1],
},
},
{
title: '下次点检日期',
dataIndex: 'planCheckDate',
key: 'planCheckDateList',
hideInForm: true,
valueType: 'dateRange',
},
{
title: '状态',
dataIndex: 'statusName',
key: 'status',
hideInForm: true,
valueType: 'select',
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
options: [
{
label: '未开始',
value: 1,
},
{
label: '执行中',
value: 2,
},
],
},
{
title: '启用/停用',
dataIndex: 'checkEnable',
key: 'checkEnable',
hideInForm: true,
hideInSearch: true,
valueType: 'switch',
render: (text, row, _, action) => {
return <Popconfirm
title="是否开启或停用?"
onConfirm={() => {
if (row.checkEnable == 1) {
run({ url: "/check/umEquipmentCheckPlan/enable", params: { id: row.id, checkEnable: 2 } })
}
}}
okText="确定"
cancelText="取消"
>
< Switch checked={row.checkEnable == 1 ? true : false} checkedChildren="开启" unCheckedChildren="停用" defaultChecked={false} />
</Popconfirm>
}
},
{
title: '选择设备',
dataIndex: 'equipmentId',
key: 'equipmentId',
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
hideInSearch: true,
hideInTable: true,
valueType: 'formSelectList',
colProps: {
span: 24,
},
},
],
pathconfig: {
enableadd: true,
enableedit: false,
enabledelete: true,
enabledetail: true,
add: '/check/umEquipmentCheckPlan/save',
edit: '',
list: '/check/umEquipmentCheckPlan/queryNoComplete',
delete: '/check/umEquipmentCheckPlan/deleteById',
detail: '/check/umEquipmentCheckPlan/queryDetails',
},
},
{
tab: '已完成',
key: 2,
columns: [
{
title: '点检计划单号',
dataIndex: 'checkNo',
key: 'checkNo',
},
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '工厂名称',
dataIndex: 'factoryName',
key: 'factoryId',
valueType: 'select',
options: {
path: '/auth/sysFactory/getAllFactorySelection',
params: {},
},
},
{
title: '车间名称',
dataIndex: 'shopName',
key: 'shopId',
valueType: 'select',
options: {
path: '/auth/sysShop/getShopSelectionByFactory',
params: {},
},
},
{
title: '点检类型',
dataIndex: 'checkTypeName',
key: 'checkType',
valueType: 'select',
options: [
{
label: '制造点检',
value: 1,
},
{
label: '设备点检',
value: 2,
},
],
},
{
title: '计划类型',
dataIndex: 'checkLoopName',
key: 'checkLoop',
valueType: 'select',
options: [
{
label: '单次',
value: 1,
},
{
label: '周期',
value: 2,
},
],
},
{
title: '周期(天)',
dataIndex: 'checkCycle',
key: 'checkCycle',
hideInSearch: true,
},
{
title: '关单日期',
dataIndex: 'endDate',
key: 'endDateList',
valueType: 'dateRange',
},
{
title: '状态',
dataIndex: 'statusName',
key: 'statusName',
hideInSearch: true,
},
],
pathconfig: {
enableadd: false,
enableedit: false,
enabledelete: false,
enabledetail: true,
add: '',
edit: '',
list: '/check/umEquipmentCheckPlan/queryYesComplete',
delete: '',
detail: '/check/umEquipmentCheckPlan/queryDetails',
},
},
];
}
export default getcolumns;
import * as React from 'react'; import * as React from 'react';
import { useState, useMemo, useRef } from 'react'; import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro'; import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable'; import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton'; import PremButton from '@/components/PremButton';
import getcolumns from './columns'; import getcolumns from './columns';
import { useRequest } from 'ahooks'; import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch'; import { doFetch } from '@/utils/doFetch';
function Plan(props) { function Plan(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setdrawer] = useState({ 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, open: false,
}), }));
[activeTabKey, setactiveTabKey] = useState(1); }
},
});
const { run, loading } = useRequest(doFetch, { const detail = (text, row, _, action) => {
manual: true, return (
onSuccess: (res, params) => { <PremButton
if (res?.code == '0000') { btn={{
actionRef?.current?.reload(); size: 'small',
type: 'link',
onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
open: false, open: true,
item: row,
title: '详情',
val: 'detail',
title: '详细信息',
})); }));
} },
}, }}
}); >
详情
const detail = (text, row, _, action) => { </PremButton>
return ( );
<PremButton };
btn={{
size: 'small',
type: 'link',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '详情',
val: 'detail',
title: '详细信息',
}));
},
}}
>
详情
</PremButton>
);
};
const edit = (text, row, _, action) => { const edit = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
btn={{ btn={{
size: 'small', size: 'small',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
open: true, open: true,
item: row, item: row,
title: '编辑', title: '编辑',
val: 'edit', val: 'edit',
})); }));
}, },
}} }}
> >
编辑 编辑
</PremButton> </PremButton>
); );
}; };
const remove = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否删除?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
删除
</PremButton>
);
};
const columns = useMemo(() => { const remove = (text, row, _, action) => {
let defcolumn = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.columns; return (
let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {}; <PremButton
return defcolumn.concat({ pop={{
title: '操作', title: '是否删除?',
valueType: 'option', okText: '确认',
width: 150, cancelText: '取消',
render: (text, row, _, action) => [ onConfirm: () => {
defpath?.enabledetail && detail(text, row, _, action), run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
defpath?.enableedit && edit(text, row, _, action), },
defpath?.enabledelete && remove(text, row, _, action), }}
], btn={{
}); size: 'small',
}, [activeTabKey]); type: 'danger',
}}
>
删除
</PremButton>
);
};
const pathconfig = useMemo(() => { const columns = useMemo(() => {
let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {}; let defcolumn = getcolumns(setdrawer, run).filter((it) => it.key == activeTabKey)[0]?.columns;
return defpath; let defpath = getcolumns(setdrawer, run).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
}, [activeTabKey]); return activeTabKey == 1 ? defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
defpath?.enableedit && edit(text, row, _, action),
defpath?.enabledelete && remove(text, row, _, action),
],
}) : defcolumn;
}, [activeTabKey]);
return ( const pathconfig = useMemo(() => {
<div style={{ position: 'relative' }}> let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
<AutoTable return defpath;
pagetitle="点检计划" }, [activeTabKey]);
columns={columns}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
actionRef={actionRef}
pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={true}
addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: null,
title: '新增',
val: 'add',
}));
},
},
}}
tabList={getcolumns()}
activeTabKey={activeTabKey}
onTabChange={(key) => {
setactiveTabKey(key);
}}
/>
<DrawerPro return (
fields={columns} <div style={{ position: 'relative' }}>
detailpath={pathconfig?.detail || null} <AutoTable
detailData={drawer?.item} pagetitle="点检计划"
defaultFormValue={drawer?.item} columns={columns}
params={{ id: drawer?.item?.id }} path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
formRef={formRef} actionRef={actionRef}
placement="right" pageextra={pathconfig?.enableadd ? 'add' : null}
onClose={() => { addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
open: false, open: true,
item: null,
title: '新增',
val: 'add',
})); }));
}} },
{...drawer} },
onFinish={(vals) => { }}
if (drawer?.val == 'add') { tabList={getcolumns()}
run({ url: pathconfig?.add || '/add', params: { ...vals } }); activeTabKey={activeTabKey}
} else if (drawer?.val == 'edit') { onTabChange={(key) => {
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } }); setactiveTabKey(key);
} }}
}} />
/>
</div> <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 } });
}
}}
/>
</div>
);
}
export default Plan; export default Plan;
\ 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