Commit 6331efac authored by 左玲玲's avatar 左玲玲 😬

点检标准,点检项目

parent 11dac910
......@@ -171,37 +171,30 @@ export default [
"icon": "",
"component": "./spare/outstore"
},
{
{
"name": "出入库记录",
"path": "/spare/record",
"icon": "",
"component": "./spare/record"
},
{
{
"name": "备件领用",
"path": "/spare/requisition",
"icon": "",
"component": "./spare/requisition"
},
{
{
"name": "备件回冲",
"path": "/spare/spareback",
"icon": "",
"component": "./spare/spareback"
},
// {
// "name": "个人库存",
// "path": "/spare/personalstore",
// "icon": "",
// "component": "./spare/personalstore"
// },
{
"name": " 线边库存",
"path": "/spare/edgestore",
"icon": "",
"component": "./spare/edgestore"
},
{
"name": "备件供应商",
"path": "/spare/supplier",
......@@ -213,9 +206,38 @@ export default [
"path": "/spare/setting",
"icon": "",
"component": "./spare/setting"
}
]
},
{
"name": "点检管理",
"path": "/check",
"icon": "check-circle",
"routes": [
{
"name": " 点检标准",
"path": "/check/standard",
"icon": "",
"component": "./check/standard"
},
{
"name": "点检计划",
"path": "/check/plan",
"icon": "",
"component": "./check/plan"
},
{
"name": "点检接单",
"path": "/check/order",
"icon": "",
"component": "./check/order"
},
{
"name": "点检工单",
"path": "/check/task",
"icon": "",
"component": "./check/task"
}
]
}
];
];
\ No newline at end of file
......@@ -13,7 +13,7 @@ export default {
dev: {
[defaultSetting.proxypath]: {
// 要代理的地址
target: 'http://192.168.40.64:28001', //jf哥
target: 'http://192.168.40.64:28000', //jf哥
// target: 'http://192.168.40.203:8000', //dj哥
changeOrigin: true,
},
......
......@@ -92,10 +92,10 @@ const Mtable = (props) => {
let itemwidth = valueColumns[it.key]?.width
? valueColumns[it.key].width
: it.width
? it.width
: resizeable
? 160
: 'auto';
? it.width
: resizeable
? 160
: 'auto';
let options = {};
if (['select', 'treeSelect', 'radio', 'checkbox', 'cascader'].includes(it?.valueType)) {
if (Array.isArray(it.options)) {
......@@ -279,79 +279,79 @@ const Mtable = (props) => {
//缩放表格
const handleResize =
(index) =>
(e, { size }) => {
e.stopImmediatePropagation();
setcolumnes((s) => {
const nextColumns = [...s];
nextColumns[index] = {
...nextColumns[index],
width: size.width,
};
return nextColumns;
});
};
(e, { size }) => {
e.stopImmediatePropagation();
setcolumnes((s) => {
const nextColumns = [...s];
nextColumns[index] = {
...nextColumns[index],
width: size.width,
};
return nextColumns;
});
};
//更新表格缩放
const handleResizeStop =
(index) =>
(e, { size }) => {
e.stopImmediatePropagation();
let submitdata = { ...valueColumns } ?? {},
curkey = Object.keys(submitdata)[index];
submitdata[curkey].width = parseInt(size.width);
setvalueColumns(submitdata);
doFetch({
url: '/ngic-base-business/paFieldScene/save',
params: {
sceneMark: activeTabKey ? path + activeTabKey : path,
controList: Object.keys(submitdata).map((it, i) => {
return {
fieldKey: it,
fieldWidth: i == index ? parseInt(size.width) : submitdata[it].width,
fieldOrder: submitdata[it].order,
fieldFixed: submitdata[it].fixed,
fieldShow: submitdata[it].show,
};
}),
},
});
};
(e, { size }) => {
e.stopImmediatePropagation();
let submitdata = { ...valueColumns } ?? {},
curkey = Object.keys(submitdata)[index];
submitdata[curkey].width = parseInt(size.width);
setvalueColumns(submitdata);
doFetch({
url: '/ngic-base-business/paFieldScene/save',
params: {
sceneMark: activeTabKey ? path + activeTabKey : path,
controList: Object.keys(submitdata).map((it, i) => {
return {
fieldKey: it,
fieldWidth: i == index ? parseInt(size.width) : submitdata[it].width,
fieldOrder: submitdata[it].order,
fieldFixed: submitdata[it].fixed,
fieldShow: submitdata[it].show,
};
}),
},
});
};
const components = resizeable
? {
components: {
header: {
cell: Resizecell,
},
components: {
header: {
cell: Resizecell,
},
columnsState: {
value: valueColumns,
onChange: (val, state) => {
setvalueColumns((s) => {
let submitdata = {
...s,
...val,
};
doFetch({
url: '/ngic-base-business/paFieldScene/save',
params: {
sceneMark: activeTabKey ? path + activeTabKey : path,
controList: Object.keys(submitdata).map((it) => {
return {
fieldKey: it,
fieldWidth: submitdata[it].width,
fieldOrder: submitdata[it].order,
fieldFixed: submitdata[it].fixed,
fieldShow: submitdata[it].show,
};
}),
},
});
return submitdata;
},
columnsState: {
value: valueColumns,
onChange: (val, state) => {
setvalueColumns((s) => {
let submitdata = {
...s,
...val,
};
doFetch({
url: '/ngic-base-business/paFieldScene/save',
params: {
sceneMark: activeTabKey ? path + activeTabKey : path,
controList: Object.keys(submitdata).map((it) => {
return {
fieldKey: it,
fieldWidth: submitdata[it].width,
fieldOrder: submitdata[it].order,
fieldFixed: submitdata[it].fixed,
fieldShow: submitdata[it].show,
};
}),
},
});
},
return submitdata;
});
},
}
},
}
: {};
const datas = dataSource ? { dataSource, toolBarRender: false } : { request };
......@@ -400,19 +400,19 @@ const Mtable = (props) => {
scroll={
x
? {
x: x,
}
x: x,
}
: {}
}
pagination={
pagination
? {
showTotal: (total, range) => <span>{total}</span>,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: [5, 10, 15, 30, 50, 100, 200],
defaultPageSize: pageSize || 15,
}
showTotal: (total, range) => <span>{total}</span>,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: [5, 10, 15, 30, 50, 100, 200],
defaultPageSize: pageSize || 15,
}
: false
}
search={{
......
......@@ -5,6 +5,7 @@ import { doFetch } from '@/utils/doFetch';
import PropTypes from 'prop-types';
import styles from './index.less';
import { Col } from 'antd';
import { utc } from 'moment';
const { Item } = ProDescriptions;
......@@ -58,7 +59,7 @@ function DetailPro(props) {
return (
<ProDescriptions column={3} {...dataProps} title={props.title}>
{fields?.map((it, i) => {
{fields?.filter(it => !it.hideInDescriptions && it?.valueType != "option")?.map((it, i) => {
const dataIndexs =
!it?.render || it?.valueType == 'option'
? { dataIndex: it.dataIndex, valueType: it.valueType }
......
import InitForm from '../InitForm';
import { Modal } from 'antd';
import React, { useState, memo } from 'react';
import DetailPro from '../DetailPro';
import PropTypes from 'prop-types';
function ModalPro(props) {
let pushSettingFlag = props.pushSettingFlag;
let newProps = { ...props };
delete newProps.children;
delete newProps.style;
const detailprops = {
...newProps,
detailpath: props.detailpath,
fields: props.fields,
detailData: props.detailData,
};
return (
<Modal
maskClosable={false}
closable={true}
width={1000}
destroyOnClose={true}
{...props}
onCancel={() => props?.onClose?.()}
footer={false}
>
{props.val == 'only' ? (
props.children
) : props.val == 'detail' ? (
<DetailPro {...detailprops} />
) : props.val == 'detailaddon' ? (
<div>
<DetailPro {...detailprops} />
{props?.children}
</div>
) : (
<InitForm {...newProps} />
)}
{pushSettingFlag ? (
<a
id="pushSettingBtn"
onClick={() => {
props.checkVariableOpen();
}}
>
查看变量
</a>
) : null}
</Modal>
);
}
ModalPro.propTypes = {
detailpath: PropTypes.string, //详情
params: PropTypes.object, //详情|表单编辑 参数
fields: PropTypes.array, //详情列表
detailData: PropTypes.object, //详情数据
};
export default ModalPro;
function getcolumns(setdrawer) {
return {
"pathconfig": {
"enableadd": false,
"enableedit": false,
"enabledelete": false,
"enabledetail": false,
"add": "",
"edit": "",
"list": "/repair/umRepairOrder/queryRepairOrderList",
"delete": "",
"detail": ""
},
"columns": [
{
"title": "维修单号",
"dataIndex": "repairOrderNo",
"key": "repairOrderNo"
},
{
"title": "设备编号",
"dataIndex": "equipmentNo",
"key": "equipmentNo"
},
{
"title": "设备名称",
"dataIndex": "equipmentName",
"key": "equipmentName"
},
{
"title": "故障描述",
"dataIndex": "faultDescription",
"key": "faultDescription"
},
{
"title": "报修人员",
"dataIndex": "repairUserName",
"key": "repairUserName"
},
{
"title": "报修时间",
"dataIndex": "repairTime",
"key": "repairTimeList",
"valueType": "dateTimeRange"
},
{
"title": "报修单号",
"dataIndex": "repairNo",
"key": "repairNo"
},
{
"title": "工单状态",
"dataIndex": "statusName",
"key": "statusName"
}
]
};
}
export default getcolumns;
\ No newline at end of file
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 Order(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, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
open: false,
}));
}
},
});
const detail = (text, row, _, action) => {
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) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '编辑',
val: 'edit',
}));
},
}}
>
编辑
</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(() => {
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),
],
});
}, []);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle="点检接单"
columns={columns}
actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
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',
}));
},
},
}}
/>
<DrawerPro
fields={columns}
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
detailpath={pathconfig?.detail || null}
detailData={drawer?.item}
defaultFormValue={drawer?.item}
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 Order;
\ No newline at end of file
function getcolumns(setdrawer) {
return [
{
"tab": "未完成",
"key": "1",
"columns": [
{
"title": "维修单号",
"dataIndex": "repairOrderNo",
"key": "repairOrderNo"
},
{
"title": "设备名称",
"dataIndex": "equipmentName",
"key": "equipmentName"
},
{
"title": "故障描述",
"dataIndex": "faultDescription",
"key": "faultDescription"
},
{
"title": "报修人员",
"dataIndex": "repairUserName",
"key": "repairUserName"
},
{
"title": "设备编号",
"dataIndex": "equipmentNo",
"key": "equipmentNo"
},
{
"title": "报修时间",
"dataIndex": "repairTime",
"key": "repairTimeList",
"valueType": "dateTimeRange"
},
{
"title": "报修单号",
"dataIndex": "repairNo",
"key": "repairNo"
},
{
"title": "工单状态",
"dataIndex": "statusName",
"key": "statusName"
}
],
"pathconfig": {
"enableadd": false,
"enableedit": false,
"enabledelete": false,
"enabledetail": false,
"add": "",
"edit": "",
"list": "/repair/umRepairOrder/queryRepairOrderList",
"delete": "",
"detail": ""
}
},
{
"tab": "已完成",
"key": "2",
"columns": [
{
"title": "维修单号",
"dataIndex": "repairOrderNo",
"key": "repairOrderNo"
},
{
"title": "设备编号",
"dataIndex": "equipmentNo",
"key": "equipmentNo"
},
{
"title": "设备名称",
"dataIndex": "equipmentName",
"key": "equipmentName"
},
{
"title": "故障描述",
"dataIndex": "faultDescription",
"key": "faultDescription"
},
{
"title": "报修人员",
"dataIndex": "repairUserName",
"key": "repairUserName"
},
{
"title": "报修时间",
"dataIndex": "repairTime",
"key": "repairTimeList",
"valueType": "dateTimeRange"
},
{
"title": "报修单号",
"dataIndex": "repairNo",
"key": "repairNo"
},
{
"title": "工单状态",
"dataIndex": "statusName",
"key": "statusName"
}
],
"pathconfig": {
"enableadd": false,
"enableedit": false,
"enabledelete": false,
"enabledetail": false,
"add": "",
"edit": "",
"list": "/repair/umRepairOrder/queryRepairOrderList",
"delete": "",
"detail": ""
}
}
];
}
export default getcolumns;
\ No newline at end of file
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 Plan(props) {
const 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 detail = (text, row, _, action) => {
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) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '编辑',
val: 'edit',
}));
},
}}
>
编辑
</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(() => {
let defcolumn = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.columns;
let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
defpath?.enabledetail && detail(text, row, _, action),
defpath?.enableedit && edit(text, row, _, action),
defpath?.enabledelete && remove(text, row, _, action),
],
});
}, [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="点检计划"
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
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;
\ No newline at end of file
import * as React from 'react';
import { useState, useMemo, useRef } from 'react';
import ModalPro from '@/components/ModalPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import procolumns from './procolumns';
import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch';
function Project({ equipmentCheckStandardId }) {
const actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
open: false,
});
const pathconfig = useMemo(() => {
let pathconf = procolumns(setdrawer)?.pathconfig ?? {};
return pathconf;
}, []);
const { run, loading } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
open: false,
}));
}
},
});
const detail = (text, row, _, action) => {
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) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '编辑',
val: 'edit',
id: row?.id
}));
},
}}
>
编辑
</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(() => {
let defcolumn = procolumns(drawer?.id)?.columns;
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
pathconfig?.enableedit && edit(text, row, _, action),
pathconfig?.enabledelete && remove(text, row, _, action),
],
});
}, [drawer?.id]);
return (
<div style={{ position: 'relative' }}>
<AutoTable
columns={columns}
actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={false}
addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: null,
title: '新增',
val: 'add',
id: null
}));
},
},
}}
extraparams={{ equipmentCheckStandardId }}
/>
<ModalPro
fields={columns}
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
detailpath={pathconfig?.detail || null}
detailData={drawer?.item}
defaultFormValue={drawer?.item}
onClose={() => {
setdrawer((s) => ({
...s,
open: false,
}));
}}
{...drawer}
onFinish={(vals) => {
if (drawer?.val == 'add') {
run({ url: pathconfig?.add || '/add', params: { ...vals, equipmentCheckStandardId } });
} else if (drawer?.val == 'edit') {
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id, equipmentCheckStandardId } });
}
}}
/>
</div>
);
}
export default Project;
\ No newline at end of file
function getcolumns(id) {
return {
"columns": [
{
"title": "标准编号",
"dataIndex": "standardNo",
"key": "standardNo",
"formItemProps": {
"rules": [
{
"required": false,
"message": "此项为必填项"
}
]
},
"hideInForm": true
},
{
"title": "点检类型",
"dataIndex": "checkTypeName",
"key": "checkType",
"valueType": "select",
"options": [
{
"label": "制造点检",
"value": 1
},
{
"label": "设备点检",
"value": 2
}
]
},
{
"title": "设备型号",
"dataIndex": "equipmentModelName",
"key": "equipmentModelId",
"formItemProps": {
"rules": [
{
"required": true,
"message": "此项为必填项"
}
]
},
"valueType": "select",
"mode": "radio",
"options": {
"path": "/check/umEquipmentCheckStandard/queryModelByType",
"linkParams": {
"checkType": "",
},
"extraParams": { id }
}
},
{
"title": "备注",
"dataIndex": "remark",
"key": "remark",
"valueType": "textarea",
"colProps": {
"span": 24
},
"hideInSearch": true,
"hideInDescriptions": true
}
],
"pathconfig": {
"enableadd": true,
"enableedit": true,
"enabledelete": true,
"enabledetail": false,
"add": "/check/umEquipmentCheckStandard/save",
"edit": "/check/umEquipmentCheckStandard/save",
"list": "/check/umEquipmentCheckStandard/queryList",
"delete": "/check/umEquipmentCheckStandard/deleteById",
"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';
import Project from "./Project";
function Standard(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, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
open: false,
}));
}
},
});
const detail = (text, row, _, action) => {
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) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '编辑',
val: 'edit',
id: row?.id
}));
},
}}
>
编辑
</PremButton>
);
};
const project = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '点检项目',
val: 'detailaddon',
id: row?.id
}));
},
}}
>
项目明细
</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(() => {
let defcolumn = getcolumns(drawer?.id)?.columns;
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
project(text, row, _, action),
pathconfig?.enabledetail && detail(text, row, _, action),
pathconfig?.enableedit && edit(text, row, _, action),
pathconfig?.enabledelete && remove(text, row, _, action),
],
});
}, [drawer?.id]);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle=" 点检标准"
columns={columns}
actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={false}
addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: null,
title: '新增',
val: 'add',
id: null
}));
},
},
}}
/>
<DrawerPro
fields={columns}
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
detailpath={pathconfig?.detail || null}
detailData={drawer?.item}
defaultFormValue={drawer?.item}
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 } });
}
}}
>
<Project equipmentCheckStandardId={drawer.id} />
</DrawerPro>
</div>
);
}
export default Standard;
\ No newline at end of file
function procolumns(id) {
return {
columns: [
{
title: '点检项目',
dataIndex: 'checkItem',
key: 'checkItem',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '点检部位',
dataIndex: 'checkPosition',
key: 'checkPosition',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '点检方法',
dataIndex: 'checkWay',
key: 'checkWay',
colProps: { span: 24 },
valueType: 'textarea',
},
{
title: '判断类型',
dataIndex: 'judgeType',
key: 'judgeType',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
valueType: 'select',
options: [
{ label: '定性', value: 1 },
{ label: '定量', value: 2 },
],
hideInSearch: true,
},
{
title: '下限值',
dataIndex: 'lowerLimit',
key: 'lowerLimit',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
hideInForm: { judgeType: [1, null, undefined] },
valueType: 'digit',
hideInSearch: true,
},
{
title: '上限值',
dataIndex: 'upperLimit',
key: 'upperLimit',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
valueType: 'digit',
hideInForm: { judgeType: [1, null, undefined] },
hideInSearch: true,
},
{
title: '预计工时',
dataIndex: 'estimatedWork',
key: 'estimatedWork',
valueType: 'digit',
hideInSearch: true,
},
{
title: '备注',
dataIndex: 'remark',
key: 'remark',
colProps: { span: 24 },
valueType: 'textarea',
hideInSearch: true,
},
],
pathconfig: {
enableadd: true,
enableedit: true,
enabledelete: true,
enabledetail: false,
add: '/check/umEquipmentCheckItem/save',
edit: '/check/umEquipmentCheckItem/save',
list: '/check/umEquipmentCheckItem/queryList',
delete: '/check/umEquipmentCheckItem/deleteById',
detail: '',
},
};
}
export default procolumns;
function getcolumns(setdrawer) {
return {
"pathconfig": {
"enableadd": false,
"enableedit": false,
"enabledelete": false,
"enabledetail": false,
"add": "",
"edit": "",
"list": "/repair/umRepairOrder/queryRepairOrderList",
"delete": "",
"detail": ""
},
"columns": [
{
"title": "维修单号",
"dataIndex": "repairOrderNo",
"key": "repairOrderNo"
},
{
"title": "设备编号",
"dataIndex": "equipmentNo",
"key": "equipmentNo"
},
{
"title": "设备名称",
"dataIndex": "equipmentName",
"key": "equipmentName"
},
{
"title": "故障描述",
"dataIndex": "faultDescription",
"key": "faultDescription"
},
{
"title": "报修人员",
"dataIndex": "repairUserName",
"key": "repairUserName"
},
{
"title": "报修时间",
"dataIndex": "repairTime",
"key": "repairTimeList",
"valueType": "dateTimeRange"
},
{
"title": "报修单号",
"dataIndex": "repairNo",
"key": "repairNo"
},
{
"title": "工单状态",
"dataIndex": "statusName",
"key": "statusName"
}
]
};
}
export default getcolumns;
\ No newline at end of file
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 Task(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, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
open: false,
}));
}
},
});
const detail = (text, row, _, action) => {
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) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '编辑',
val: 'edit',
}));
},
}}
>
编辑
</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(() => {
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),
],
});
}, []);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle="点检工单"
columns={columns}
actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
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',
}));
},
},
}}
/>
<DrawerPro
fields={columns}
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
detailpath={pathconfig?.detail || null}
detailData={drawer?.item}
defaultFormValue={drawer?.item}
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 Task;
\ 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