Commit 72fc86d5 authored by TZW's avatar TZW

点检计划

parent fd466937
......@@ -140,10 +140,7 @@ function Order(props) {
title: '操作',
valueType: 'option',
width: 120,
render: (text, row, _, action) => [
order(text, row, _, action),
close(text, row, _, action)
],
render: (text, row, _, action) => [order(text, row, _, action), close(text, row, _, action)],
});
}, []);
......@@ -168,7 +165,7 @@ function Order(props) {
hideInForm: true,
},
];
if (drawer?.val == "detail") {
if (drawer?.val == 'detail') {
return [
{
title: '计划信息',
......@@ -222,7 +219,7 @@ function Order(props) {
title: '点检截止日期',
dataIndex: 'checkCloseDate',
key: 'checkCloseDate',
span: 2
span: 2,
},
{
title: '点检项目',
......@@ -245,15 +242,15 @@ function Order(props) {
/>
);
},
}
]
},
];
}
}, [drawer?.val, drawer?.item?.id]);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle="点检接单"
pagetitle={<h3 className="page-title">点检接单</h3>}
columns={columns}
actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
......@@ -277,7 +274,7 @@ function Order(props) {
/>
<DrawerPro
fields={drawer.val == "detail" ? detailsColumns : columns}
fields={drawer.val == 'detail' ? detailsColumns : columns}
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
......
import * as React from 'react';
import { useState, useMemo, useRef } from 'react';
import { message, Popconfirm, Switch } from "antd";
import { message, Popconfirm, Switch } from 'antd';
import DrawerPro from '@/components/DrawerPro';
import DetailPro from '@/components/DetailPro';
import AutoTable from '@/components/AutoTable';
......@@ -67,7 +67,7 @@ function Plan(props) {
item: row,
title: '调整日期',
val: 'detailaddon',
id: row?.id
id: row?.id,
}));
},
}}
......@@ -121,7 +121,8 @@ function Plan(props) {
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 ?? {};
return activeTabKey == 1 ? defcolumn.concat([
return activeTabKey == 1
? defcolumn.concat([
{
title: '启用/停用',
dataIndex: 'checkEnable',
......@@ -131,7 +132,8 @@ function Plan(props) {
valueType: 'switch',
render: (text, row, _, action) => {
//"1停用 2启用 *"
return row.checkEnable == 1 ? <Popconfirm
return row.checkEnable == 1 ? (
<Popconfirm
title="是否开启或停用?"
onConfirm={async () => {
if (row.checkEnable == 1) {
......@@ -153,7 +155,7 @@ function Plan(props) {
disabled={!(row.status == 1 || (row.status == 2 && row.checkLoop == 2))}
/>
</Popconfirm>
:
) : (
<Switch
checked={row.checkEnable == 1 ? true : false}
checkedChildren="开启"
......@@ -166,15 +168,15 @@ function Plan(props) {
...s,
open: true,
item: row,
title: '调整日期',
title: '启用点检计划',
val: 'detailaddon',
type: "delay",
id: row?.id
type: 'delay',
id: row?.id,
}));
}
}}
/>
;
);
},
hideInDescriptions: true,
},
......@@ -183,12 +185,14 @@ function Plan(props) {
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
(row.status == 1 || (row.status == 2 && row.checkLoop == 2)) && editDate(text, row, _, action),
(row.status == 1 || (row.status == 2 && row.checkLoop == 2)) &&
editDate(text, row, _, action),
row.status == 2 && close(text, row, _, action),
defpath?.enabledelete && row.status == 1 && remove(text, row, _, action),
],
}
]) : defcolumn;
},
])
: defcolumn;
}, [activeTabKey]);
const editDateColumns = useMemo(() => {
......@@ -196,7 +200,10 @@ function Plan(props) {
if (drawer?.item?.status == 1) {
return current && current < dayjs().endOf('day');
} else {
if (dayjs(drawer?.item?.planCheckDate).endOf('day').valueOf() >= dayjs().endOf('day').valueOf()) {
if (
dayjs(drawer?.item?.planCheckDate).endOf('day').valueOf() >=
dayjs().endOf('day').valueOf()
) {
return current && current <= dayjs(drawer?.item?.planCheckDate).endOf('day');
} else {
return current && current < dayjs().endOf('day');
......@@ -243,7 +250,7 @@ function Plan(props) {
title: '计划类型',
dataIndex: 'checkLoopName',
key: 'checkLoop',
hideInForm: true
hideInForm: true,
},
{
title: '调整信息',
......@@ -267,7 +274,7 @@ function Plan(props) {
},
valueType: 'date',
hideInSearch: true,
hideInDescriptions: true
hideInDescriptions: true,
},
{
title: '周期(天)',
......@@ -278,7 +285,6 @@ function Plan(props) {
valueType: 'digit',
hideInForm: drawer?.item?.checkLoop == 2 ? false : true,
precision: 0,
},
];
}, [drawer?.item]);
......@@ -304,7 +310,7 @@ function Plan(props) {
hideInForm: true,
},
];
if (drawer?.val == "detail") {
if (drawer?.val == 'detail') {
return [
{
title: '计划信息',
......@@ -334,7 +340,7 @@ function Plan(props) {
title: '下次点检日期',
dataIndex: 'planCheckDate',
key: 'planCheckDate',
span: activeTabKey == 1 ? 2 : 1
span: activeTabKey == 1 ? 2 : 1,
},
{
title: '关单日期',
......@@ -385,7 +391,7 @@ function Plan(props) {
title: '周期(天)',
dataIndex: 'checkCycle',
key: 'checkCycle',
span: activeTabKey == 1 ? 2 : 2
span: activeTabKey == 1 ? 2 : 2,
},
{
title: '点检项目',
......@@ -429,7 +435,7 @@ function Plan(props) {
key: 'shutTime',
hideInDescriptions: drawer?.item?.status != 3 ? true : false,
},
]
];
}
}, [drawer?.val, activeTabKey, drawer?.item?.id]);
const pathconfig = useMemo(() => {
......@@ -446,7 +452,7 @@ function Plan(props) {
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle="点检计划"
pagetitle={<h3 className="page-title">点检计划</h3>}
columns={columns}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
actionRef={actionRef}
......@@ -475,7 +481,13 @@ function Plan(props) {
/>
<DrawerPro
fields={drawer?.val == "detailaddon" ? editDateColumns : drawer?.val == "detail" ? detailsColumns : columns}
fields={
drawer?.val == 'detailaddon'
? editDateColumns
: drawer?.val == 'detail'
? detailsColumns
: columns
}
detailpath={pathconfig?.detail || null}
defaultFormValue={drawer?.item}
params={{ id: drawer?.item?.id }}
......@@ -490,21 +502,24 @@ function Plan(props) {
{...drawer}
onFinish={async (vals) => {
let params = JSON.parse(JSON.stringify(vals));
params.paramList = params?.paramList?.map(it => {
params.paramList = params?.paramList?.map((it) => {
return {
equipmentId: it.id,
checkPlanDate: it.checkPlanDate
}
checkPlanDate: it.checkPlanDate,
};
});
let flag = params.paramList?.some(it => !it.checkPlanDate);
let flag = params.paramList?.some((it) => !it.checkPlanDate);
if (flag) {
message.warning("下次点检日期必填!")
message.warning('下次点检日期必填!');
return;
}
if (drawer?.val == 'add') {
await runAsync({ url: pathconfig?.add || '/add', params: { ...params } });
} else if (drawer?.val == 'edit') {
await runAsync({ url: pathconfig?.edit || '/edit', params: { ...params, id: drawer?.item?.id } });
await runAsync({
url: pathconfig?.edit || '/edit',
params: { ...params, id: drawer?.item?.id },
});
}
}}
>
......@@ -512,12 +527,16 @@ function Plan(props) {
fields={editDateColumns}
defaultFormValue={{ checkCycle: drawer?.item?.checkCycle }}
onFinish={async (vals) => {
await runAsync({ url: drawer?.type == "delay" ? "/check/umEquipmentCheckPlan/enable" : "/check/umEquipmentCheckPlan/adjustDate", params: { ...vals, id: drawer?.item?.id, checkEnable: 1 } });
await runAsync({
url:
drawer?.type == 'delay'
? '/check/umEquipmentCheckPlan/enable'
: '/check/umEquipmentCheckPlan/adjustDate',
params: { ...vals, id: drawer?.item?.id, checkEnable: 1 },
});
}}
/>
</DrawerPro>
</div>
);
}
......
......@@ -38,6 +38,7 @@ function getcolumns(id) {
title: '设备型号',
dataIndex: 'equipmentModelName',
key: 'equipmentModelId',
hideInSearch: true,
formItemProps: {
rules: [
{
......@@ -60,6 +61,30 @@ function getcolumns(id) {
showSearch: true,
},
},
{
title: '设备型号',
dataIndex: 'equipmentModelName',
key: 'equipmentModelId',
hideInForm: true,
hideInTable: true,
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
valueType: 'select',
mode: 'radio',
options: {
path: '/asset/equipmentModel/query/selection',
},
fieldProps: {
placeholder: '请选择',
showSearch: true,
},
},
{
title: '备注',
dataIndex: 'remark',
......
......@@ -135,7 +135,7 @@ function Standard(props) {
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle=" 点检标准"
pagetitle={<h3 className="page-title">点检标准</h3>}
columns={columns}
actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
......
......@@ -15,7 +15,7 @@ function Task(props) {
const [drawer, setdrawer] = useState({
open: false,
}),
[activeTabKey, setactiveTabKey] = useState("1"),
[activeTabKey, setactiveTabKey] = useState('1'),
[detailData, cd] = useState({});
const { run, loading, runAsync } = useRequest(doFetch, {
......@@ -140,22 +140,24 @@ function Task(props) {
btn={{
size: 'small',
onClick: () => {
doFetch({ url: "/check/umEquipmentCheckTask/queryDetails", params: { id: row.id } }).then(res => {
if (res.code == "0000") {
doFetch({
url: '/check/umEquipmentCheckTask/queryDetails',
params: { id: row.id },
}).then((res) => {
if (res.code == '0000') {
setdrawer((s) => ({
...s,
open: true,
item: {
...res.data?.basics,
...res.data?.meet,
id: row.id
id: row.id,
},
title: '点检工单',
val: 'detailaddon',
}));
}
})
});
},
}}
>
......@@ -191,18 +193,23 @@ function Task(props) {
key: 'result',
hideInForm: true,
render: (text, row, _, action) => {
return row.judgeType == 1 ?
<Radio.Group onChange={(e) => {
return row.judgeType == 1 ? (
<Radio.Group
onChange={(e) => {
row.result = e.target.value;
}}>
}}
>
<Radio value={1}>正常</Radio>
<Radio value={2}>异常</Radio>
</Radio.Group>
:
<InputNumber onChange={(value) => {
) : (
<InputNumber
onChange={(value) => {
row.result = value;
}} />
}
}}
/>
);
},
},
{
title: '下限值',
......@@ -222,10 +229,14 @@ function Task(props) {
key: 'remark',
hideInForm: true,
render: (text, row, _, action) => {
return <Input onChange={(e) => {
return (
<Input
onChange={(e) => {
row.remark = e.target.value;
}} />
}
}}
/>
);
},
},
];
return [
......@@ -276,12 +287,12 @@ function Task(props) {
{
title: '点检截止日期',
dataIndex: 'checkCloseDate',
key: 'checkCloseDate'
key: 'checkCloseDate',
},
{
title: '接单时间',
dataIndex: 'checkStartTime',
key: 'checkStartTime'
key: 'checkStartTime',
},
{
title: '完成点检',
......@@ -305,14 +316,12 @@ function Task(props) {
);
},
},
]
];
}
}, [drawer?.item, activeTabKey]);
const detailColumns = useMemo(() => {
if (drawer?.val == "detail") {
if (drawer?.val == 'detail') {
const columnsc = [
{
title: '点检项目',
......@@ -331,7 +340,7 @@ function Task(props) {
dataIndex: 'checkWay',
key: 'checkWay',
hideInForm: true,
}
},
];
const allObj = {
task: [
......@@ -396,7 +405,7 @@ function Task(props) {
title: '点检截止日期',
dataIndex: 'checkCloseDate',
key: 'checkCloseDate',
span: 2
span: 2,
},
{
title: '点检项目',
......@@ -415,7 +424,7 @@ function Task(props) {
/>
);
},
hideInDescriptions: drawer?.item?.task?.status != 4 ? false : true
hideInDescriptions: drawer?.item?.task?.status != 4 ? false : true,
},
],
meet: [
......@@ -432,7 +441,7 @@ function Task(props) {
title: '接单时间',
dataIndex: 'checkStartTime',
key: 'checkStartTime',
span: 2
span: 2,
},
],
delay: [
......@@ -444,7 +453,7 @@ function Task(props) {
title: '完成点检时间',
dataIndex: 'checkEndTime',
key: 'checkEndTime',
span: 3
span: 3,
},
{
title: '点检项目',
......@@ -455,15 +464,24 @@ function Task(props) {
render: (text, row, _, action) => {
return (
<AutoTables
columns={columnsc.concat([
columns={columnsc
.concat([
{
title: '结果',
dataIndex: 'result',
key: 'result',
hideInForm: true,
render: (text, row, _, action) => {
return <span>{row.judgeType == 1 ? row.result == 1 ? "正常" : "异常" : row.result}</span>
}
return (
<span>
{row.judgeType == 1
? row.result == 1
? '正常'
: '异常'
: row.result}
</span>
);
},
},
{
title: '下限值',
......@@ -483,7 +501,8 @@ function Task(props) {
key: 'remark',
hideInForm: true,
},
])?.map((it) => ({
])
?.map((it) => ({
...it,
hideInSearch: true,
}))}
......@@ -491,7 +510,7 @@ function Task(props) {
/>
);
},
hideInDescriptions: drawer?.item?.task?.status == 4 ? false : true
hideInDescriptions: drawer?.item?.task?.status == 4 ? false : true,
},
],
shut: [
......@@ -509,16 +528,20 @@ function Task(props) {
dataIndex: 'shutTime',
key: 'shutTime',
},
]
}, newObject = {};
let data = JSON.parse(JSON.stringify(drawer?.item)), objectData = {};
let dataKeys = Object.keys(data), allObjKeys = Object.keys(allObj), newObjKes = allObjKeys.filter(it => dataKeys.indexOf(it) > -1);
newObjKes.map(it => {
],
},
newObject = {};
let data = JSON.parse(JSON.stringify(drawer?.item)),
objectData = {};
let dataKeys = Object.keys(data),
allObjKeys = Object.keys(allObj),
newObjKes = allObjKeys.filter((it) => dataKeys.indexOf(it) > -1);
newObjKes.map((it) => {
newObject[it] = allObj[it];
});
let newColumns = [];
for (let i in newObject) {
newColumns = [...newColumns, ...newObject[i]]
newColumns = [...newColumns, ...newObject[i]];
}
for (let i in data) {
objectData = Object.assign(objectData, data[i]);
......@@ -531,17 +554,18 @@ function Task(props) {
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 ?? {};
return activeTabKey == 1 ? defcolumn.concat({
return activeTabKey == 1
? defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
row.status == 1 && order(text, row, _, action),
row.status == 1 && close(text, row, _, action),
row.status == 2 && finish(text, row, _, action)
row.status == 2 && finish(text, row, _, action),
],
}) :
defcolumn;
})
: defcolumn;
}, [activeTabKey]);
const pathconfig = useMemo(() => {
......@@ -552,7 +576,7 @@ function Task(props) {
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle="点检工单"
pagetitle={<h3 className="page-title">点检工单</h3>}
columns={columns}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
actionRef={actionRef}
......@@ -581,9 +605,9 @@ function Task(props) {
/>
<DrawerPro
fields={drawer?.val == "detailaddon" ? detailaddonColumns : detailColumns}
fields={drawer?.val == 'detailaddon' ? detailaddonColumns : detailColumns}
detailpath={pathconfig?.detail || null}
detailData={drawer.val == "detail" ? detailData : drawer?.item}
detailData={drawer.val == 'detail' ? detailData : drawer?.item}
defaultFormValue={drawer?.item}
params={{ id: drawer?.item?.id }}
formRef={formRef}
......@@ -609,22 +633,25 @@ function Task(props) {
type: 'primary',
loading,
onClick: () => {
let itemList = drawer?.item?.item?.map(it => {
let itemList = drawer?.item?.item?.map((it) => {
if (it.judgeType == 1) {
return {
id: it.id,
remark: it.remark,
judgeResultQualitative: it.result
}
judgeResultQualitative: it.result,
};
} else {
return {
id: it.id,
remark: it.remark,
judgeResultRation: it.result
}
judgeResultRation: it.result,
};
}
});
run({ url: "/check/umEquipmentCheckTask/complele", params: { id: drawer?.item?.id, itemList } })
run({
url: '/check/umEquipmentCheckTask/complele',
params: { id: drawer?.item?.id, itemList },
});
},
}}
>
......
......@@ -40,6 +40,7 @@ function getcolumns(equipmentModelId) {
dataIndex: 'equipmentModelName',
key: 'equipmentModelId',
valueType: 'select',
hideInSearch: true,
fieldProps: {
showSearch: true,
},
......@@ -55,13 +56,36 @@ function getcolumns(equipmentModelId) {
options: {
path: '/maintain/umMaintainStandard/selected/queryList',
linkParams: {
maintainType: 'maintainType',
maintainType: '',
},
extraParams: {
equipmentModelId,
},
},
},
{
title: '设备型号',
dataIndex: 'equipmentModelName',
key: 'equipmentModelId',
hideInForm: true,
hideInTable: true,
valueType: 'select',
fieldProps: {
showSearch: true,
},
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
mode: 'radio',
options: {
path: '/asset/equipmentModel/query/selection',
},
},
{
title: '备注',
dataIndex: 'remark',
......
......@@ -3,7 +3,7 @@
* @Author: Li Hanlin
* @Date: 2022-12-02 11:41:03
* @Last Modified by: Li Hanlin
* @Last Modified time: 2023-02-08 11:45:14
* @Last Modified time: 2023-02-08 14:50:40
*/
import * as React from 'react';
......@@ -18,8 +18,9 @@ import Addform from '@/components/Addform';
import { Menu, Dropdown, Button, message } from 'antd';
import InitForm from '@/components/InitForm';
import Detail from '@/components/RepaireDetail/Detail';
import { useModel } from '@umijs/max';
function Failure(props) {
const { initialState, setInitialState } = useModel('@@initialState');
const actionRef = useRef(),
containderef = useRef(),
formRef = useRef();
......
......@@ -3,7 +3,7 @@
* @Author: Li Hanlin
* @Date: 2022-12-02 11:41:03
* @Last Modified by: Li Hanlin
* @Last Modified time: 2023-02-08 13:30:00
* @Last Modified time: 2023-02-08 14:50:08
*/
import * as React from 'react';
......@@ -19,8 +19,9 @@ import { Menu, Dropdown, Button, message } from 'antd';
import InitForm from '@/components/InitForm';
import Detail from '@/components/RepaireDetail/Detail';
import OrderHandle from '../platform/RepairOrderHandle';
import { useModel } from '@umijs/max';
function Failure(props) {
const { initialState, setInitialState } = useModel('@@initialState');
const actionRef = useRef(),
containderef = useRef(),
formRef = useRef();
......
......@@ -107,6 +107,35 @@ function getcolumns(changeState) {
title: '状态',
dataIndex: 'statusName',
key: 'status',
hideInSearch: true,
hideInTable: true,
hideInForm: true,
valueType: 'select',
mode: 'radio',
options: [
{
label: '启用',
value: 1,
},
{
label: '停用',
value: 2,
},
],
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
},
{
title: '状态',
dataIndex: 'statusName',
key: 'status',
hideInDescriptions: true,
valueType: 'select',
mode: 'radio',
options: [
......@@ -140,10 +169,12 @@ function getcolumns(changeState) {
);
},
},
{
title: '联系信息',
valueType: 'formList',
dataIndex: 'userList',
span: 3,
colProps: {
xs: 24,
sm: 24,
......
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