Commit f69798e6 authored by TZW's avatar TZW

12060928

parent 7b6fce2b
/* 故障报修 /* 维修工单
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-12-02 11:41:03 * @Date: 2022-12-02 11:41:03
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-06 09:04:06 * @Last Modified time: 2022-12-06 09:16:46
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -123,7 +123,7 @@ function Failure(props) { ...@@ -123,7 +123,7 @@ function Failure(props) {
const selectType = (type) => { const selectType = (type) => {
switch (type) { switch (type) {
case 'add': case 'add':
return <Addform />; return;
default: default:
break; break;
} }
......
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
{ {
title: '基础信息', tab: '我的待办',
valueType: 'split', key: '1',
}, columns: [
{ {
title: '用户名', title: '外协单号',
dataIndex: 'accountName', dataIndex: 'repairOrderNo',
formItemProps: { key: 'repairOrderNo',
rules: [ },
{ {
required: false, title: '设备编号',
message: '此项为必填项', dataIndex: 'equipmentNo',
}, key: 'equipmentNo',
], },
}, {
initialValue: '默认值', title: '设备名称',
hideInForm: false, dataIndex: 'equipmentName',
search: false, key: 'equipmentName',
render: (text, row) => { },
return ( {
<a title: '故障描述',
onClick={() => { dataIndex: 'faultDescription',
setdrawer?.((s) => ({ key: 'faultDescription',
...s, valueType: 'textarea',
visible: true, },
item: null, {
title: '新增', title: '创建时间',
val: 'add', dataIndex: 'repairTime',
})); key: 'repairTimeList',
}} valueType: 'dateTimeRange',
> },
{text} {
</a> title: '创建人员',
); dataIndex: 'repairUserName',
}, key: 'repairUserName',
}, },
{ {
title: '姓名', title: '最新外协人员',
dataIndex: 'userName', dataIndex: 'newRepairUserName',
key: 'userId', key: 'newRepairUserName',
hideInForm: { },
accountName: { {
reverse: ['1', '2', '5'], title: '来源单号',
}, dataIndex: 'repairNo',
remark: ['3'], key: 'repairNo',
}, },
search: false, {
}, title: '工单状态',
{ dataIndex: 'statusName',
title: '额外信息', key: 'status',
valueType: 'split', valueType: 'radio',
}, options: [
{ {
title: '联系电话', label: '待维修',
dataIndex: 'telephone', value: '1',
formItemProps: { },
rules: [ {
{ label: '维修中',
required: false, value: '2',
message: '此项为必填项', },
}, ],
], },
],
pathconfig: {
enableadd: true,
enableedit: false,
enabledelete: true,
enabledetail: false,
add: '',
edit: '',
list: '/repair/umFailureRepair/queryNoFinishList',
delete: '/repair/umFailureRepair/deleteById',
detail: '',
}, },
search: false,
}, },
{ {
title: '邮箱', tab: '我的待办',
dataIndex: 'mailNo', key: '1',
formItemProps: { columns: [
rules: [ {
{ title: '外协单号',
required: false, dataIndex: 'repairOrderNo',
message: '此项为必填项', key: 'repairOrderNo',
}, },
], {
title: '设备编号',
dataIndex: 'equipmentNo',
key: 'equipmentNo',
},
{
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '故障描述',
dataIndex: 'faultDescription',
key: 'faultDescription',
valueType: 'textarea',
},
{
title: '创建时间',
dataIndex: 'repairTime',
key: 'repairTimeList',
valueType: 'dateTimeRange',
},
{
title: '创建人员',
dataIndex: 'repairUserName',
key: 'repairUserName',
},
{
title: '最新外协人员',
dataIndex: 'newRepairUserName',
key: 'newRepairUserName',
},
{
title: '来源单号',
dataIndex: 'repairNo',
key: 'repairNo',
},
{
title: '工单状态',
dataIndex: 'statusName',
key: 'status',
valueType: 'radio',
options: [
{
label: '待维修',
value: '1',
},
{
label: '维修中',
value: '2',
},
],
},
],
pathconfig: {
enableadd: true,
enableedit: false,
enabledelete: true,
enabledetail: false,
add: '',
edit: '',
list: '/repair/umFailureRepair/queryNoFinishList',
delete: '/repair/umFailureRepair/deleteById',
detail: '',
}, },
search: false,
},
{
title: '备注',
dataIndex: 'remark',
valueType: 'editor',
search: false,
colProps: { span: 24 },
initialValue: '<p>Hello <b>World!</b></p>',
}, },
{ {
title: '上传样式-图片', tab: '我的待办',
dataIndex: 'uploadImage', key: '1',
key: 'uploadImage', columns: [
valueType: 'uploadImage', {
fieldProps: { title: '外协单号',
limit: 2, dataIndex: 'repairOrderNo',
}, key: 'repairOrderNo',
formItemProps: { },
rules: [ {
{ title: '设备编号',
required: false, dataIndex: 'equipmentNo',
message: '此项为必填项', key: 'equipmentNo',
}, },
], {
title: '设备名称',
dataIndex: 'equipmentName',
key: 'equipmentName',
},
{
title: '故障描述',
dataIndex: 'faultDescription',
key: 'faultDescription',
valueType: 'textarea',
},
{
title: '创建时间',
dataIndex: 'repairTime',
key: 'repairTimeList',
valueType: 'dateTimeRange',
},
{
title: '创建人员',
dataIndex: 'repairUserName',
key: 'repairUserName',
},
{
title: '最新外协人员',
dataIndex: 'newRepairUserName',
key: 'newRepairUserName',
},
{
title: '来源单号',
dataIndex: 'repairNo',
key: 'repairNo',
},
{
title: '工单状态',
dataIndex: 'statusName',
key: 'status',
valueType: 'radio',
options: [
{
label: '待维修',
value: '1',
},
{
label: '维修中',
value: '2',
},
],
},
],
pathconfig: {
enableadd: true,
enableedit: false,
enabledelete: true,
enabledetail: false,
add: '',
edit: '',
list: '/repair/umFailureRepair/queryNoFinishList',
delete: '/repair/umFailureRepair/deleteById',
detail: '',
}, },
}, },
]; ];
} }
export default getcolumns; export default getcolumns;
/* 维修工单
* @Author: Li Hanlin
* @Date: 2022-12-02 11:41:03
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-06 09:16:55
*/
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 { doFetch } from '@/utils/doFetch';
function Outsourcing(props) { function Failure(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setdrawer] = useState({
visible: false, 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) => { const detail = (text, row, _, action) => {
...@@ -21,11 +44,11 @@ function Outsourcing(props) { ...@@ -21,11 +44,11 @@ function Outsourcing(props) {
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, open: true,
item: row, item: row,
title: '详情', title: '详情',
val: 'detail', val: 'detail',
title: row.userName + '的详细信息', title: '详细信息',
})); }));
}, },
}} }}
...@@ -43,7 +66,7 @@ function Outsourcing(props) { ...@@ -43,7 +66,7 @@ function Outsourcing(props) {
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, open: true,
item: row, item: row,
title: '编辑', title: '编辑',
val: 'edit', val: 'edit',
...@@ -60,10 +83,11 @@ function Outsourcing(props) { ...@@ -60,10 +83,11 @@ function Outsourcing(props) {
return ( return (
<PremButton <PremButton
pop={{ pop={{
title: '是否删除该用户?', title: '是否删除?',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onConfirm: () => { onConfirm: () => {
run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
}, },
}} }}
btn={{ btn={{
...@@ -77,59 +101,93 @@ function Outsourcing(props) { ...@@ -77,59 +101,93 @@ function Outsourcing(props) {
}; };
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer); 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({ return defcolumn.concat({
title: '操作', title: '操作',
valueType: 'option', valueType: 'option',
width: 150, width: 150,
render: (text, row, _, action) => [ render: (text, row, _, action) => [
detail(text, row, _, action), defpath?.enabledetail && detail(text, row, _, action),
edit(text, row, _, action), defpath?.enableedit && edit(text, row, _, action),
remove(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]);
const selectType = (type) => {
switch (type) {
case 'add':
return;
default:
break;
}
};
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="外协工单" pagetitle={<h3 className="page-title">维修工单</h3>}
columns={columns} columns={columns}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
actionRef={actionRef} actionRef={actionRef}
pageextra={'add'} pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={true} resizeable={true}
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
disabled: false, disabled: false,
type: 'primary',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, open: true,
item: null, item: null,
title: '新增', title: '新增',
val: 'add', val: 'only',
type: 'add',
})); }));
}, },
}, },
}} }}
tabList={getcolumns()}
activeTabKey={activeTabKey}
onTabChange={(key) => {
setactiveTabKey(key);
}}
/> />
<DrawerPro <DrawerPro
fields={columns} fields={columns}
detailpath={pathconfig?.detail || null}
detailData={drawer?.item}
defaultFormValue={drawer?.item}
params={{ id: drawer?.item?.id }} params={{ id: drawer?.item?.id }}
formRef={formRef} formRef={formRef}
placement="right" placement="right"
onClose={() => { onClose={() => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: false, open: false,
})); }));
}} }}
{...drawer} {...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 } });
}
}}
>
{selectType(drawer?.type)}
</DrawerPro>
</div> </div>
); );
} }
export default Outsourcing; export default Failure;
\ 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