Commit 729e1d5e authored by TZW's avatar TZW

detail

parent fc3688a2
......@@ -26,6 +26,7 @@ let handlEmptyChild = (tree = []) => {
const Mtable = (props) => {
const {
headerTitle,
actionRef, //表格动作
formRef, //表单Ref
rowKey, // key
......@@ -42,7 +43,7 @@ const Mtable = (props) => {
resizeable = false,
dataSource,
} = props;
console.log(dataSource);
const actionRefs = actionRef ?? useRef(),
formRefs = formRef ?? useRef(),
ifspagination = pagination == 'false' || pagination === false,
......
import { ProDescriptions } from '@ant-design/pro-components';
import { Divider } from 'antd';
import React, { useState, useEffect } from 'react';
const DetailNode = (props) => {
const { data, index, columns, hasTable = false, operationType } = props;
console.log(props);
return (
<>
<div className="fault-detail">
<div style={{ flex: 1, display: 'flex', flexDirection: 'row' }}>
<div className="fault-index">{Number(index) + 1}</div>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<label style={{ width: '80px', fontSize: 18, fontWeight: 600 }}>
{data?.operationTypeName}
</label>
<span>{data?.updateUserName}</span>
<span>{data?.updateTime}</span>
</div>
</div>
<div style={{ flex: 6 }}>
<div>
<h2 className="page-title" style={{ marginBottom: 16 }}>
{operationType == 0 ? '基础信息' : data?.operationTypeName}
</h2>
</div>
<ProDescriptions dataSource={data} columns={columns} />
{hasTable ? props.children : null}
<Divider />
</div>
</div>
</>
);
};
export default DetailNode;
/* eslint-disable react/jsx-key */
import { doFetch } from '@/utils/doFetch';
import { useRequest } from 'ahooks';
import { Divider } from 'antd';
import React, { useState, useEffect } from 'react';
import { ProDescriptions } from '@ant-design/pro-components';
import DetailNode from './detailnode';
import AutoTable from '../AutoTable/mtable';
const Detail = (props) => {
console.log(props);
const { path, params, titleColumns, detailKey, columns } = props;
let [firstcolumns, ...mescolumns] = titleColumns;
// columns?.forEach((it) => {
// if (it?.valueType == 'table') {
// tableColumns.push(it);
// } else {
// detailColumns.push(it);
// }
// });
const detailData = useRequest(async () => {
let res = await doFetch({ url: path, params });
return res?.data?.dataList;
});
console.log(columns);
return (
<>
<h2 style={{ fontWeight: 700, marginBottom: 16 }}>
{firstcolumns?.title}{detailData?.data?.[0]?.[firstcolumns?.dataIndex] || '--'}
</h2>
<ProDescriptions columns={mescolumns} dataSource={detailData?.data?.[0]} />
<Divider />
<div>
{detailData?.data?.map((it, index) => {
console.log(it);
const detailColumns = [],
tableColumns = [];
columns[it?.operationType]?.forEach((it) => {
if (it?.valueType == 'table') {
tableColumns.push(it);
} else {
detailColumns.push(it);
}
});
return (
<DetailNode
key={it?.id}
data={it}
index={index}
operationType={it?.operationType}
columns={detailColumns}
hasTable={true}
>
{tableColumns?.map((t) => {
return (
<div style={{ marginTop: 8, marginBottom: 8 }}>
<b>{t?.title}</b>
<AutoTable
dataSource={it[t?.key]}
columns={t?.columns}
style={{ marginTop: 8 }}
/>
</div>
);
})}
</DetailNode>
);
})}
</div>
</>
);
};
export default Detail;
......@@ -25,7 +25,7 @@ let Diyrule = (props) => {
defval?.other || {
noRuleCode: '',
sort: null,
formatType: 3,
formatType: null,
increaseList: [],
}
);
......@@ -34,7 +34,7 @@ let Diyrule = (props) => {
useEffect(() => {
onChange(defval);
});
console.log('other.sort :', other?.sort);
let { data, loading } = useRequest(() => {
return doFetch({ url: '/base/bmNoRule/querySelect', params: {} });
});
......@@ -520,9 +520,10 @@ let Diyrule = (props) => {
value={other?.sort}
options={Array.apply(null, { length: value ? value.length : 0 }).map((it, i) => ({
label: `第${i + 1}个`,
value: i + 2,
value: i + 1,
}))}
onChange={(val) => {
console.log('改变的val', val);
onChange({
value: value,
other: {
......
......@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-19 14:18:44
* @Last Modified time: 2023-01-18 15:25:43
*/
import * as React from 'react';
......
import dayjs from 'dayjs';
import { doFetch } from '@/utils/doFetch';
function getcolumns(setdrawer) {
return {
"pathconfig": {
"enableadd": false,
"enableedit": false,
"enabledelete": false,
"enabledetail": false,
"add": "",
"edit": "",
"list": "/repair/umRepairOrder/queryRepairOrderList",
"delete": "",
"detail": ""
columns: [
{
title: '保养单号',
dataIndex: 'taskNo',
key: 'taskNo',
render: (text, row, _, action) => {
return (
<a
onClick={() => {
setdrawer((s) => ({
...s,
open: true,
val: 'only',
title: '详细信息',
item: row,
}));
}}
>
{row?.maintainNo}
</a>
);
},
},
"columns": [
{
"title": "维修单号",
"dataIndex": "repairOrderNo",
"key": "repairOrderNo"
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
"title": "设备编号",
"dataIndex": "equipmentNo",
"key": "equipmentNo"
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
"title": "设备名称",
"dataIndex": "equipmentName",
"key": "equipmentName"
title: '保养类型',
dataIndex: 'maintainTypeName',
key: 'maintainType',
valueType: 'select',
mode: 'radio',
options: [
{
label: '自主保养',
value: '1',
},
{
"title": "故障描述",
"dataIndex": "faultDescription",
"key": "faultDescription"
label: '专业保养',
value: '2',
},
],
},
{
title: '保养频次',
dataIndex: 'maintainFrequencyName',
key: 'maintainFrequency',
valueType: 'select',
mode: 'radio',
options: [
{
"title": "报修人员",
"dataIndex": "repairUserName",
"key": "repairUserName"
label: '周',
value: '0',
},
{
"title": "报修时间",
"dataIndex": "repairTime",
"key": "repairTimeList",
"valueType": "dateTimeRange"
label: '月度',
value: '1',
},
{
"title": "报修单号",
"dataIndex": "repairNo",
"key": "repairNo"
label: '季度',
value: '2',
},
{
"title": "工单状态",
"dataIndex": "statusName",
"key": "statusName"
}
]
};
label: '半年',
value: '3',
},
{
label: '一年',
value: '4',
},
],
},
{
title: '保养截至日期',
dataIndex: 'planMaintainDate',
key: 'planMaintainDateList',
valueType: 'dateRange',
render: (text, row, _, action) => {
return (
<span
style={{
color: `${
dayjs(row.planMaintainDate).valueOf() < dayjs().format('YYYY-MM-DD').valueOf()
? '#f50'
: 'rgba(0, 0, 0, 0.85)'
}`,
}}
>
{row.planMaintainDate}
</span>
);
},
},
],
pathconfig: {
enableadd: false,
enableedit: false,
enabledelete: false,
enabledetail: false,
add: '',
edit: '',
list: '/maintain/umMaintainTask/queryReceivingList',
delete: '',
detail: '',
},
};
}
export default getcolumns;
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';
function Orders(props) {
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 DetailNode from '@/components/DetailNode';
import getDetailColumns from '../workOrder/detailColumns';
function Orders(props) {
const actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
......@@ -17,7 +18,7 @@ import * as React from 'react';
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
return pathconf;
}, []);
const { run, loading } = useRequest(doFetch, {
const { run, loading, runAsync } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
......@@ -95,29 +96,106 @@ import * as React from 'react';
);
};
const order = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否接单?',
okText: '确认',
cancelText: '取消',
onConfirm: async () => {
await runAsync({
url: '/maintain/umMaintainTask/orderReceiving',
params: { id: row?.id },
});
},
}}
btn={{
size: 'small',
}}
>
接单
</PremButton>
);
};
const close = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否关单?',
okText: '确认',
cancelText: '取消',
onConfirm: async () => {
await runAsync({
url: '/maintain/umMaintainTask/customsDeclaration',
params: { id: row?.id },
});
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
关单
</PremButton>
);
};
const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer)?.columns;
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
pathconfig?.enabledetail && detail(text, row, _, action),
pathconfig?.enableedit && edit(text, row, _, action),
pathconfig?.enabledelete && remove(text, row, _, action),
],
render: (text, row, _, action) => [order(text, row, _, action), close(text, row, _, action)],
});
}, []);
const DetailLine = () => {
return (
<>
<DetailNode
path="/maintain/umMaintainTaskOperation/queryDetailList"
params={{ maintainTaskId: drawer?.item?.id }}
titleColumns={[
{
title: '保养单号',
dataIndex: 'taskNo',
key: 'taskNo',
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
},
{
title: '工单状态',
dataIndex: 'taskStatusName',
key: 'taskStatusName',
},
{
title: '保养计划单号',
dataIndex: 'maintainNo',
key: 'maintainNo',
},
]}
detailKey="maintainTaskItemList"
columns={getDetailColumns}
/>
</>
);
};
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'}
pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={true}
resizeable={false}
addconfig={{
// access: 'sysDepartment_save',
btn: {
......@@ -157,10 +235,11 @@ import * as React from 'react';
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
}
}}
/>
>
{drawer?.val == 'only' ? <DetailLine /> : null}
</DrawerPro>
</div>
);
}
export default Orders;
}
export default Orders;
......@@ -385,7 +385,7 @@ function getcolumns(setdrawer) {
add: '/maintain/umMaintainPlan/save',
edit: '/maintain/umMaintainPlan/save',
list: '/maintain/umMaintainPlan/queryList',
delete: '/maintain/umMaintainPlan/enableDeactivate',
delete: '/maintain/umMaintainPlan/deleteById',
detail: '/maintain/umMaintainPlan/queryById',
},
},
......@@ -564,7 +564,7 @@ function getcolumns(setdrawer) {
add: '/maintain/umMaintainPlan/save',
edit: '/maintain/umMaintainPlan/save',
list: '/maintain/umMaintainPlan/queryList',
delete: '/maintain/umMaintainPlan/enableDeactivate',
delete: '/maintain/umMaintainPlan/deleteById',
detail: '/maintain/umMaintainPlan/queryById',
},
},
......
......@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2023-01-16 15:35:00
* @Last Modified by: Li Hanlin
* @Last Modified time: 2023-01-17 11:35:36
* @Last Modified time: 2023-01-18 15:20:30
*/
import * as React from 'react';
......
import dayjs from 'dayjs';
function getcolumns(setdrawer) {
return {
"pathconfig": {
"enableadd": false,
"enableedit": false,
"enabledelete": false,
"enabledetail": false,
"add": "",
"edit": "",
"list": "/repair/umRepairOrder/queryRepairOrderList",
"delete": "",
"detail": ""
return [
{
tab: '我的待办',
key: '1',
columns: [
{
title: '保养单号',
dataIndex: 'taskNo',
key: 'taskNo',
render: (text, row, _, action) => {
return (
<a
onClick={() => {
setdrawer((s) => ({
...s,
open: true,
val: 'only',
title: '详细信息',
item: row,
}));
}}
>
{row?.maintainNo}
</a>
);
},
},
"columns": [
{
"title": "维修单号",
"dataIndex": "repairOrderNo",
"key": "repairOrderNo"
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
"title": "设备编号",
"dataIndex": "equipmentNo",
"key": "equipmentNo"
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
"title": "设备名称",
"dataIndex": "equipmentName",
"key": "equipmentName"
title: '保养类型',
dataIndex: 'maintainTypeName',
key: 'maintainType',
valueType: 'select',
mode: 'radio',
options: [
{
label: '自主保养',
value: '1',
},
{
"title": "故障描述",
"dataIndex": "faultDescription",
"key": "faultDescription"
label: '专业保养',
value: '2',
},
],
},
{
"title": "报修人员",
"dataIndex": "repairUserName",
"key": "repairUserName"
title: '保养频次',
dataIndex: 'maintainFrequencyName',
key: 'maintainFrequency',
valueType: 'select',
mode: 'radio',
options: [
{
label: '周',
value: '0',
},
{
"title": "报修时间",
"dataIndex": "repairTime",
"key": "repairTimeList",
"valueType": "dateTimeRange"
label: '月度',
value: '1',
},
{
"title": "报修单号",
"dataIndex": "repairNo",
"key": "repairNo"
label: '季度',
value: '2',
},
{
"title": "工单状态",
"dataIndex": "statusName",
"key": "statusName"
}
]
};
label: '半年',
value: '3',
},
{
label: '一年',
value: '4',
},
],
},
{
title: '保养截止日期',
dataIndex: 'planMaintainDate',
key: 'planMaintainDateList',
valueType: 'dateRange',
render: (text, row, _, action) => {
return (
<span
style={{
color: `${
dayjs(row.planMaintainDate).valueOf() < dayjs().format('YYYY-MM-DD').valueOf()
? '#f50'
: 'rgba(0, 0, 0, 0.85)'
}`,
}}
>
{row.planMaintainDate}
</span>
);
},
},
{
title: '接单时间',
dataIndex: 'maintainStartTime',
key: 'maintainStartTimeList',
valueType: 'dateRange',
},
{
title: '保养人员',
dataIndex: 'maintainUserName',
key: 'maintainUserName',
},
{
title: '状态',
dataIndex: 'taskStatusName',
key: 'taskStatus',
valueType: 'select',
fieldProps: {
dropdownMatchSelectWidth: 100,
},
mode: 'radio',
options: [
{
label: '待接单',
value: '1',
},
{
label: '保养中',
value: '2',
},
{
label: '待验证',
value: '5',
},
],
},
],
pathconfig: {
enableadd: false,
enableedit: false,
enabledelete: false,
enabledetail: false,
add: '',
edit: '',
list: '/maintain/umMaintainTask/queryMyDealwithList',
delete: '',
detail: '',
},
},
{
tab: '未完成',
key: '2',
columns: [
{
title: '保养单号',
dataIndex: 'taskNo',
key: 'taskNo',
render: (text, row, _, action) => {
return (
<a
onClick={() => {
setdrawer((s) => ({
...s,
open: true,
val: 'only',
title: '详细信息',
item: row,
}));
}}
>
{row?.maintainNo}
</a>
);
},
},
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '保养类型',
dataIndex: 'maintainTypeName',
key: 'maintainType',
valueType: 'select',
mode: 'radio',
options: [
{
label: '自主保养',
value: '1',
},
{
label: '专业保养',
value: '2',
},
],
},
{
title: '保养频次',
dataIndex: 'maintainFrequencyName',
key: 'maintainFrequency',
valueType: 'select',
mode: 'radio',
options: [
{
label: '周',
value: '0',
},
{
label: '月度',
value: '1',
},
{
label: '季度',
value: '2',
},
{
label: '半年',
value: '3',
},
{
label: '一年',
value: '4',
},
],
},
{
title: '保养截止日期',
dataIndex: 'planMaintainDate',
key: 'planMaintainDateList',
valueType: 'dateRange',
render: (text, row, _, action) => {
return (
<span
style={{
color: `${
dayjs(row.planMaintainDate).valueOf() < dayjs().format('YYYY-MM-DD').valueOf()
? '#f50'
: 'rgba(0, 0, 0, 0.85)'
}`,
}}
>
{row.planMaintainDate}
</span>
);
},
},
{
title: '接单时间',
dataIndex: 'maintainStartTime',
key: 'maintainStartTimeList',
valueType: 'dateRange',
},
{
title: '保养人员',
dataIndex: 'maintainUserName',
key: 'maintainUserName',
},
{
title: '状态',
dataIndex: 'taskStatusName',
key: 'taskStatus',
fieldProps: {
dropdownMatchSelectWidth: 100,
},
valueType: 'select',
mode: 'radio',
options: [
{
label: '待接单',
value: '1',
},
{
label: '保养中',
value: '2',
},
{
label: '待验证',
value: '5',
},
],
},
],
pathconfig: {
enableadd: false,
enableedit: false,
enabledelete: false,
enabledetail: false,
add: '',
edit: '',
list: '/maintain/umMaintainTask/queryList',
delete: '',
detail: '',
},
},
{
tab: '已完成',
key: '3',
columns: [
{
title: '保养单号',
dataIndex: 'taskNo',
key: 'taskNo',
render: (text, row, _, action) => {
return (
<a
onClick={() => {
setdrawer((s) => ({
...s,
open: true,
val: 'only',
title: '详细信息',
item: row,
}));
}}
>
{row?.maintainNo}
</a>
);
},
},
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '保养类型',
dataIndex: 'maintainTypeName',
key: 'maintainType',
valueType: 'select',
mode: 'radio',
options: [
{
label: '自主保养',
value: '1',
},
{
label: '专业保养',
value: '2',
},
],
},
{
title: '保养频次',
dataIndex: 'maintainFrequencyName',
key: 'maintainFrequency',
valueType: 'select',
mode: 'radio',
options: [
{
label: '周',
value: '0',
},
{
label: '月度',
value: '1',
},
{
label: '季度',
value: '2',
},
{
label: '半年',
value: '3',
},
{
label: '一年',
value: '4',
},
],
},
{
title: '保养截止日期',
dataIndex: 'planMaintainDate',
key: 'planMaintainDateList',
valueType: 'dateRange',
render: (text, row, _, action) => {
return (
<span
style={{
color: `${
dayjs(row.planMaintainDate).valueOf() < dayjs().format('YYYY-MM-DD').valueOf()
? '#f50'
: 'rgba(0, 0, 0, 0.85)'
}`,
}}
>
{row.planMaintainDate}
</span>
);
},
},
{
title: '接单时间',
dataIndex: 'maintainStartTime',
key: 'maintainStartTimeList',
valueType: 'dateRange',
},
{
dataIndex: 'customsTime',
valueType: 'dateRange',
title: '关单时间',
key: 'customsTimeList',
},
{
title: '保养人员',
dataIndex: 'maintainUserName',
key: 'maintainUserName',
},
{
title: '状态',
dataIndex: 'taskStatusName',
key: 'taskStatus',
fieldProps: {
dropdownMatchSelectWidth: 100,
},
valueType: 'select',
mode: 'radio',
options: [
{
label: '待接单',
value: '1',
},
{
label: '保养中',
value: '2',
},
{
label: '待验证',
value: '5',
},
],
},
],
pathconfig: {
enableadd: false,
enableedit: false,
enabledelete: false,
enabledetail: false,
add: '',
edit: '',
list: '/maintain/umMaintainTaskHis/queryList',
delete: '',
detail: '',
},
},
];
}
export default getcolumns;
import dayjs from 'dayjs';
const getcolumns = {
0: [
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '设备型号',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '保养类型',
dataIndex: 'maintainTypeName',
key: 'maintainType',
},
{
title: '保养频次',
dataIndex: 'maintainFrequencyName',
key: 'maintainFrequency',
},
{
title: '保养截止日期',
dataIndex: 'planMaintainDate',
key: 'planMaintainDateList',
},
{
title: '保养项目',
key: 'maintainTaskItemList',
valueType: 'table',
dataIndex: 'maintainTaskItemList',
columns: [
{
title: '保养项目',
dataIndex: 'maintainItemName',
key: 'maintainItemName',
},
{
title: '部位',
dataIndex: 'maintainPosition',
key: 'maintainPosition',
},
{
title: '保养方法',
dataIndex: 'maintainMethod',
key: 'maintainMethod',
},
],
},
],
1: [
{
title: '保养人员',
dataIndex: 'maintainUserName',
key: 'maintainUserName',
},
{
title: '接单时间',
dataIndex: 'maintainStartTime',
key: 'maintainStartTime',
},
],
2: [
{
title: '关单人员',
dataIndex: 'customsUserName',
key: 'customsUserName',
},
{
title: '强制关单时间',
dataIndex: 'offSingleDate',
key: 'offSingleDate',
},
],
3: [
{
title: '完成保养时间',
dataIndex: 'maintainEndTime',
key: 'maintainEndTime',
},
{
title: '保养项目',
key: 'maintainTaskItemList',
valueType: 'table',
dataIndex: 'maintainTaskItemList',
columns: [
{
title: '保养项目',
dataIndex: 'maintainItemName',
key: 'maintainItemName',
},
{
title: '部位',
dataIndex: 'maintainPosition',
key: 'maintainPosition',
},
{
title: '保养方法',
dataIndex: 'maintainMethod',
key: 'maintainMethod',
},
{
title: '结果',
dataIndex: 'judgeResultName',
key: 'judgeResultName',
},
{
title: '下限值',
dataIndex: 'lowerLimit',
key: 'lowerLimit',
},
{
title: '上限值',
dataIndex: 'upperLimit',
key: 'upperLimit',
},
{
title: '备注',
dataIndex: 'remark',
key: 'remark',
},
],
},
{
title: '非寿命件消耗',
key: 'maintainTaskItemList',
valueType: 'table',
dataIndex: 'maintainTaskItemList',
columns: [
{
title: '备件料号',
dataIndex: 'sparePartNo',
key: 'sparePartNo',
},
{
title: '备件名称',
dataIndex: 'sparePartName',
key: 'sparePartName',
},
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
},
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
},
{
title: '消耗数量',
dataIndex: 'remark',
key: 'remark',
},
],
},
{
title: '寿命件更换',
key: 'maintainTaskItemList',
valueType: 'table',
dataIndex: 'maintainTaskItemList',
columns: [
{
title: '备件料号',
dataIndex: 'sparePartNo',
key: 'sparePartNo',
},
{
title: '备件名称',
dataIndex: 'sparePartName',
key: 'sparePartName',
},
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
},
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
},
{
title: '安装部位',
dataIndex: 'remark',
key: 'remark',
},
{
title: '更换数量',
dataIndex: 'remark',
key: 'remark',
},
],
},
],
4: [
{
title: '验证人员',
dataIndex: 'reviewerName',
key: 'reviewerName',
},
{
title: '验证时间',
dataIndex: 'reviewerName',
key: 'reviewerName',
},
{
title: '验证结果',
dataIndex: 'reviewerName',
key: 'reviewerName',
},
{
title: '备注',
dataIndex: 'reviewerName',
key: 'reviewerName',
},
],
};
export default getcolumns;
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 { 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 AutoTables from '@/components/AutoTable/mtable';
import { Radio, InputNumber, Input, Divider } from 'antd';
import InitForm from '@/components/InitForm';
import getDetailColumns from './detailColumns';
import DetailNode from '@/components/DetailNode';
function WorkOrder(props) {
function WorkOrder(props) {
const actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
open: false,
});
const pathconfig = useMemo(() => {
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
return pathconf;
}, []);
const { run, loading } = useRequest(doFetch, {
}),
[activeTabKey, setactiveTabKey] = useState('1');
const { run, loading, runAsync } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
......@@ -53,23 +56,356 @@ import * as React from 'react';
);
};
const edit = (text, row, _, action) => {
const detailaddonColumns = useMemo(() => {
if (activeTabKey == 1) {
if (drawer?.type == 'yz') {
const columnsc = [
{
title: '保养项目',
dataIndex: 'maintainItemName',
key: 'maintainItemName',
hideInForm: true,
},
{
title: '部位',
dataIndex: 'maintainPosition',
key: 'maintainPosition',
hideInForm: true,
},
{
title: '保养方法',
dataIndex: 'maintainMethod',
key: 'maintainMethod',
hideInForm: true,
},
{
title: '结果',
dataIndex: 'judgeResultName',
key: 'judgeResultName',
hideInForm: true,
},
{
title: '下限值',
dataIndex: 'lowerLimit',
key: 'lowerLimit',
hideInForm: true,
},
{
title: '上限值',
dataIndex: 'upperLimit',
key: 'upperLimit',
hideInForm: true,
},
{
title: '备注',
dataIndex: 'remark',
key: 'remark',
hideInForm: true,
},
];
return [
{
title: '工单信息',
valueType: 'split',
},
{
title: '保养单号',
dataIndex: 'taskNo',
key: 'taskNo',
},
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '保养类型',
dataIndex: 'maintainTypeName',
key: 'maintainTypeName',
},
{
title: '保养频次',
dataIndex: 'maintainFrequencyName',
key: 'maintainFrequency',
},
{
title: '保养截止日期',
dataIndex: 'planMaintainDate',
key: 'planMaintainDate',
},
{
title: '接单时间',
dataIndex: 'maintainStartTime',
key: 'maintainStartTime',
},
{
title: '完成保养时间',
dataIndex: 'maintainEndTime',
key: 'maintainEndTime',
},
{
title: '保养项目',
valueType: 'split',
},
{
dataIndex: 'itemList',
key: 'itemList',
valueType: 'formList',
columns,
span: 3,
render: (text, row, _, action) => {
return (
<AutoTables
columns={columnsc?.map((it) => ({
...it,
hideInSearch: true,
}))}
dataSource={drawer?.item?.maintainTaskItemList}
/>
);
},
},
];
} else if (drawer?.type == 'wcby') {
const columnsc = [
{
title: '保养项目',
dataIndex: 'maintainItemName',
key: 'maintainItemName',
hideInForm: true,
},
{
title: '部位',
dataIndex: 'maintainPosition',
key: 'maintainPosition',
hideInForm: true,
},
{
title: '保养方法',
dataIndex: 'maintainMethod',
key: 'maintainMethod',
hideInForm: true,
},
{
title: '结果',
dataIndex: 'result',
key: 'result',
hideInForm: true,
render: (text, row, _, action) => {
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) => {
row.result = value;
}}
/>
);
},
},
{
title: '下限值',
dataIndex: 'lowerLimit',
key: 'lowerLimit',
hideInForm: true,
},
{
title: '上限值',
dataIndex: 'upperLimit',
key: 'upperLimit',
hideInForm: true,
},
{
title: '备注',
dataIndex: 'remark',
key: 'remark',
hideInForm: true,
render: (text, row, _, action) => {
return (
<Input
onChange={(e) => {
row.remark = e.target.value;
}}
/>
);
},
},
];
return [
{
title: '工单信息',
valueType: 'split',
},
{
title: '保养单号',
dataIndex: 'taskNo',
key: 'taskNo',
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
},
{
title: '工单状态',
dataIndex: 'taskStatusName',
key: 'taskStatusName',
},
{
title: '保养计划单号',
dataIndex: 'maintainNo',
key: 'maintainNo',
},
{
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '设备型号',
dataIndex: 'equipmentModelName',
key: 'equipmentModelName',
},
{
title: '保养类型',
dataIndex: 'maintainTypeName',
key: 'maintainTypeName',
},
{
title: '保养频次',
dataIndex: 'maintainFrequencyName',
key: 'maintainFrequency',
},
{
title: '保养截止日期',
dataIndex: 'planMaintainDate',
key: 'planMaintainDate',
},
{
title: '接单时间',
dataIndex: 'maintainStartTime',
key: 'maintainStartTime',
span: 2,
},
{
title: '保养项目',
valueType: 'split',
},
{
dataIndex: 'itemList',
key: 'itemList',
valueType: 'formList',
columns,
span: 3,
render: (text, row, _, action) => {
return (
<AutoTables
columns={columnsc?.map((it) => ({
...it,
hideInSearch: true,
}))}
dataSource={drawer?.item?.maintainTaskItemList}
/>
);
},
},
];
}
}
}, [drawer?.item, activeTabKey]);
const order = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否接单?',
okText: '确认',
cancelText: '取消',
onConfirm: async () => {
await runAsync({
url: '/maintain/umMaintainTask/orderReceiving',
params: { id: row?.id },
});
},
}}
btn={{
size: 'small',
}}
>
接单
</PremButton>
);
};
const close = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否关单?',
okText: '确认',
cancelText: '取消',
onConfirm: async () => {
await runAsync({
url: '/maintain/umMaintainTask/customsDeclaration',
params: { id: row?.id },
});
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
关单
</PremButton>
);
};
const finish = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
doFetch({
url: '/maintain/umMaintainTask/queryById',
params: { id: row.id },
}).then((res) => {
console.log(res);
if (res.code == '0000') {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '编辑',
val: 'edit',
item: {
...res.data?.data,
id: row.id,
},
title: '完成保养',
val: 'detailaddon',
type: 'wcby',
}));
}
});
},
}}
>
编辑
完成保养
</PremButton>
);
};
......@@ -95,29 +431,217 @@ import * as React from 'react';
);
};
const verify = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
doFetch({
url: '/maintain/umMaintainTask/queryById',
params: { id: row.id },
}).then((res) => {
console.log(res);
if (res.code == '0000') {
setdrawer((s) => ({
...s,
open: true,
item: {
...res.data?.data,
id: row.id,
},
title: '验证',
val: 'detailaddon',
type: 'yz',
}));
}
});
},
}}
>
验证
</PremButton>
);
};
const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer)?.columns;
return defcolumn.concat({
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({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
pathconfig?.enabledetail && detail(text, row, _, action),
pathconfig?.enableedit && edit(text, row, _, action),
pathconfig?.enabledelete && remove(text, row, _, action),
order(text, row, _, action),
close(text, row, _, action),
finish(text, row, _, action),
verify(text, row, _, action),
],
})
: defcolumn;
}, [activeTabKey]);
const pathconfig = useMemo(() => {
let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
return defpath;
}, [activeTabKey]);
const seletType = {
wcby: (
<div>
<PremButton
btn={{
type: 'primary',
loading,
onClick: () => {
let maintainTaskItemList = drawer?.item?.item?.map((it) => {
if (it.judgeType == 1) {
return {
id: it.id,
remark: it.remark,
judgeResultType: it.result,
};
} else {
return {
id: it.id,
remark: it.remark,
qualitativeJudgeResult: it.result,
};
}
});
run({
url: '/maintain/umMaintainTask/finishMaintainTask',
params: { id: drawer?.item?.id, maintainTaskItemList },
});
},
}}
>
提交
</PremButton>
</div>
),
yz: (
<div>
<Divider />
<InitForm
fields={[
{
title: '验证结果',
valueType: 'select',
dataIndex: 'approveStatus',
key: 'approveStatus',
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
options: [
{
value: '1',
label: '通过',
},
{
value: '2',
label: '不通过',
},
],
},
{
title: '备注',
valueType: 'textarea',
dataIndex: 'approveContent',
key: 'approveContent',
},
]}
onFinish={(vals) => {
run({
url: '/maintain/umMaintainTask/verification',
params: { ...vals, id: drawer?.item?.id },
});
}, []);
}}
/>
</div>
),
};
const DetailLine = () => {
return (
<>
<DetailNode
path="/maintain/umMaintainTaskOperation/queryDetailList"
params={{ maintainTaskId: drawer?.item?.id }}
titleColumns={
activeTabKey == 3
? [
{
title: '保养单号',
dataIndex: 'taskNo',
key: 'taskNo',
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
},
{
title: '工单状态',
dataIndex: 'taskStatusName',
key: 'taskStatusName',
},
{
title: '保养计划单号',
dataIndex: 'maintainNo',
key: 'maintainNo',
},
{
title: '关单时间',
dataIndex: 'customsTime',
key: 'customsTime',
},
]
: [
{
title: '保养单号',
dataIndex: 'taskNo',
key: 'taskNo',
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
},
{
title: '工单状态',
dataIndex: 'taskStatusName',
key: 'taskStatusName',
},
{
title: '保养计划单号',
dataIndex: 'maintainNo',
key: 'maintainNo',
},
]
}
detailKey="maintainTaskItemList"
columns={getDetailColumns}
/>
</>
);
};
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'}
actionRef={actionRef}
pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={true}
resizeable={false}
addconfig={{
// access: 'sysDepartment_save',
btn: {
......@@ -133,16 +657,21 @@ import * as React from 'react';
},
},
}}
tabList={getcolumns()}
activeTabKey={activeTabKey}
onTabChange={(key) => {
setactiveTabKey(key);
}}
/>
<DrawerPro
fields={columns}
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
fields={detailaddonColumns}
detailpath={pathconfig?.detail || null}
detailData={drawer?.item}
defaultFormValue={drawer?.item}
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
onClose={() => {
setdrawer((s) => ({
...s,
......@@ -157,10 +686,15 @@ import * as React from 'react';
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
}
}}
/>
>
{drawer?.val == 'only' ? (
<DetailLine />
) : drawer?.val == 'detailaddon' ? (
seletType[drawer?.type]
) : null}
</DrawerPro>
</div>
);
}
export default WorkOrder;
}
export default WorkOrder;
......@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2023-01-11 19:37:17
* @Last Modified time: 2023-01-17 09:30:00
*/
import * as React from 'react';
......@@ -182,21 +182,6 @@ function Rules(props) {
onFinish: async (vals) => {
console.log('新增:', vals);
let params = { ...vals };
//console.log('vals:', vals);
// for (let i in vals) {
// if (i == 'nrList') {
// let reshow = {
// value: vals[i].filter((it) => it.noRuleCode != 'increasing_order'),
// other: vals[i].filter((it) => it.noRuleCode == 'increasing_order')[0] || {},
// };
// reshow.other.increaseList = reshow.other.increaseList.maps((it) => {
// return reshow.value.filter((item) => item.sort == it)[0].id;
// });
// reshow.other.sort =
// reshow.other.sort == 1 ? reshow.other.sort : reshow.other.sort - 1;
// //console.log('reshow', reshow);
// }
// }
params.nrList = [];
params.nrList = params.nrList.concat(vals?.nrList.value);
if (vals?.nrList.other.sort) {
......
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