Commit f95740a1 authored by TZW's avatar TZW

20221207

parent 12d2fab9
import { useState, useEffect } from 'react'; import { useState, useEffect, useRef } from 'react';
import InitForm from '@/components/InitForm'; import InitForm from '@/components/InitForm';
import { message } from 'antd';
import { doFetch } from '@/utils/doFetch';
const App = () => { const App = ({ url, actionRef, setdrawer }) => {
const columns = [ const columns = [
{ {
title: '选择设备', title: '选择设备',
...@@ -98,9 +100,49 @@ const App = () => { ...@@ -98,9 +100,49 @@ const App = () => {
}, },
}, },
]; ];
const formRef = useRef();
return ( return (
<> <>
<InitForm fields={columns} /> <InitForm
formRef={formRef}
fields={columns}
onValuesChange={(changedValues, allValues) => {
console.log(changedValues, allValues);
if (Object.keys(changedValues)[0] == 'faultDetailId') {
doFetch({
url: '/repair/umFaultSettingDetail/queryById',
params: {
id: changedValues?.faultDetailId,
},
}).then((res) => {
console.log(res);
formRef?.current?.setFieldsValue({
faultDescription: res?.data?.data.faultPhenomenon,
});
});
}
}}
onFinish={async (vals) => {
console.log(vals);
let params = {
...vals,
};
let res = await doFetch({
url,
params,
});
if (res.code === '0000') {
message.success('新建成功!');
setdrawer((s) => ({
...s,
open: false,
}));
actionRef.current.reload();
}
}}
/>
</> </>
); );
}; };
......
...@@ -96,6 +96,9 @@ function InitForm({ ...@@ -96,6 +96,9 @@ function InitForm({
fields, fields,
extendField = '', extendField = '',
colProps = { xs: 24, sm: 24, md: 12, lg: 12, xl: 12, xxl: 12 }, colProps = { xs: 24, sm: 24, md: 12, lg: 12, xl: 12, xxl: 12 },
onValuesChange = (changedValues, allValues) => {
console.log(changedValues, allValues);
},
}) { }) {
let proformRef = useRef(); let proformRef = useRef();
proformRef = formRef ?? proformRef; proformRef = formRef ?? proformRef;
...@@ -145,6 +148,9 @@ function InitForm({ ...@@ -145,6 +148,9 @@ function InitForm({
} }
}} }}
autoFocusFirstInput autoFocusFirstInput
onValuesChange={(changedValues, allValues) => {
onValuesChange?.(changedValues, allValues);
}}
> >
<FormRender <FormRender
fields={fields.filter((it) => it.valueType != 'option')} fields={fields.filter((it) => it.valueType != 'option')}
......
...@@ -18,13 +18,13 @@ import moment from 'moment'; ...@@ -18,13 +18,13 @@ import moment from 'moment';
* 退出登录,并且将当前的 url 保存 * 退出登录,并且将当前的 url 保存
*/ */
const loginOut = async () => { const loginOut = async () => {
await fakeAccountLoginOut(); const { logoutRedirectUrl } = await fakeAccountLoginOut();
const { query = {} } = history.location; const { query = {} } = history.location;
const { redirect } = query; // Note: There may be security issues, please note const { redirect } = query; // Note: There may be security issues, please note
if (window.location.pathname !== '/user/login' && !redirect) { if (window.location.pathname !== '/user/login' && !redirect) {
localStorage.clear(); localStorage.clear();
history.replace('/user/login'); history.replace(logoutRedirectUrl);
} }
}; };
...@@ -122,7 +122,6 @@ const AvatarDropdown = ({ menu }) => { ...@@ -122,7 +122,6 @@ const AvatarDropdown = ({ menu }) => {
return loadings; return loadings;
} }
let saveData = (values) => { let saveData = (values) => {
let newfields = JSON.parse(JSON.stringify(values)); let newfields = JSON.parse(JSON.stringify(values));
delete newfields.confirmPassword; delete newfields.confirmPassword;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56 * @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-01 16:49:23 * @Last Modified time: 2022-12-07 13:43:37
*/ */
import * as React from 'react'; import * as React from 'react';
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @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 16:52:05 * @Last Modified time: 2022-12-07 16:10:34
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -124,7 +124,9 @@ function Failure(props) { ...@@ -124,7 +124,9 @@ function Failure(props) {
const selectType = (type) => { const selectType = (type) => {
switch (type) { switch (type) {
case 'add': case 'add':
return <Addform />; return (
<Addform url="/repair/umFailureRepair/save" actionRef={actionRef} setdrawer={setdrawer} />
);
default: default:
break; break;
} }
......
...@@ -4,6 +4,14 @@ function getcolumns(setdrawer) { ...@@ -4,6 +4,14 @@ function getcolumns(setdrawer) {
title: '故障类型', title: '故障类型',
dataIndex: 'faultType', dataIndex: 'faultType',
key: 'faultType', key: 'faultType',
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
}, },
{ {
title: '故障代码', title: '故障代码',
...@@ -25,6 +33,7 @@ function getcolumns(setdrawer) { ...@@ -25,6 +33,7 @@ function getcolumns(setdrawer) {
dataIndex: 'remark', dataIndex: 'remark',
key: 'remark', key: 'remark',
valueType: 'textarea', valueType: 'textarea',
search: false,
}, },
]; ];
} }
......
/* 故障设置
* @Author: Li Hanlin
* @Date: 2022-12-07 11:19:30
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-07 15:12:48
*/
import * as React from 'react'; import * as React from 'react';
import { useState, useMemo, useRef } from 'react'; import { useState, useMemo, useEffect, 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';
import InitForm from '@/components/InitForm';
import { ProDescriptions } from '@ant-design/pro-components';
const pathconfig = { const pathconfig = {
enableadd: true, enableadd: true,
...@@ -39,7 +48,7 @@ function Fault(props) { ...@@ -39,7 +48,7 @@ function Fault(props) {
}, },
}); });
const detail = (text, row, _, action) => { const gzmc = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
btn={{ btn={{
...@@ -50,7 +59,8 @@ function Fault(props) { ...@@ -50,7 +59,8 @@ function Fault(props) {
open: true, open: true,
item: row, item: row,
title: '详情', title: '详情',
val: 'detail', val: 'only',
type: 'gzmc',
title: '详细信息', title: '详细信息',
})); }));
}, },
...@@ -105,18 +115,97 @@ function Fault(props) { ...@@ -105,18 +115,97 @@ function Fault(props) {
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer); let defcolumn = getcolumns(setdrawer);
if (drawer?.type == 'gzmc') {
return defcolumn;
} else {
return defcolumn.concat({ return defcolumn.concat({
title: '操作', title: '操作',
valueType: 'option', valueType: 'option',
width: 150, width: 150,
render: (text, row, _, action) => [ render: (text, row, _, action) => [
pathconfig?.enabledetail && detail(text, row, _, action), pathconfig?.enabledetail && gzmc(text, row, _, action),
pathconfig?.enableedit && edit(text, row, _, action), pathconfig?.enableedit && edit(text, row, _, action),
pathconfig?.enabledelete && remove(text, row, _, action), pathconfig?.enabledelete && remove(text, row, _, action),
], ],
}); });
}
}, [drawer?.type]);
const FaultName = () => {
const [request, setrequest] = useState();
const [drawergz, setdrawergz] = useState({
open: false,
});
useEffect(() => {
const fn = async () => {
let params = { id: drawer?.item?.id };
let res = await doFetch({ url: '/repair/umFaultSetting/queryById', params });
setrequest(res?.data.data);
};
fn();
}, []); }, []);
return (
<>
<ProDescriptions dataSource={request} columns={columns} />
<AutoTable
columns={[
{
title: '故障名称',
dataIndex: 'faultDetailName',
key: 'faultDetailName',
},
{
title: '故障代码',
dataIndex: 'faultDetailCode',
key: 'faultDetailCode',
},
{
title: '故障描述',
dataIndex: 'faultPhenomenon',
key: 'faultPhenomenon',
},
{
title: '解决方案',
dataIndex: 'faultSolution',
key: 'faultSolution',
search: false,
},
]}
path="/repair/umFaultSettingDetail/queryById"
params={{ id: drawer?.item.id }}
pageextra={'add'}
addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
type: 'primary',
onClick: () => {
setdrawergz((s) => ({
...s,
open: true,
item: {
isShutdown: 1,
},
title: '新建追踪工单',
val: 'add',
type: 'add',
}));
},
},
}}
/>
</>
);
};
function selectType(type) {
switch (type) {
case 'gzmc':
return <FaultName />;
default:
break;
}
}
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
...@@ -125,7 +214,7 @@ function Fault(props) { ...@@ -125,7 +214,7 @@ function Fault(props) {
actionRef={actionRef} actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
pageextra={pathconfig?.enableadd ? 'add' : null} pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={true} resizeable={false}
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
...@@ -145,16 +234,18 @@ function Fault(props) { ...@@ -145,16 +234,18 @@ function Fault(props) {
<DrawerPro <DrawerPro
fields={columns} fields={columns}
params={{ id: drawer?.item?.id }} // params={{ id: drawer?.item?.id }}
formRef={formRef} formRef={formRef}
placement="right" placement="right"
detailpath={pathconfig?.detail || null} // detailpath={pathconfig?.detail || null}
detailData={drawer?.item} detailData={drawer?.item}
defaultFormValue={drawer?.item} defaultFormValue={drawer?.item}
onClose={() => { onClose={() => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
open: false, open: false,
type: null,
item: null,
})); }));
}} }}
{...drawer} {...drawer}
...@@ -165,7 +256,9 @@ function Fault(props) { ...@@ -165,7 +256,9 @@ function Fault(props) {
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } }); run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
} }
}} }}
/> >
{selectType(drawer?.type)}
</DrawerPro>
</div> </div>
); );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @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-07 10:00:30 * @Last Modified time: 2022-12-07 14:31:33
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -105,6 +105,7 @@ function Failure(props) { ...@@ -105,6 +105,7 @@ function Failure(props) {
actionRef.current.reload(); actionRef.current.reload();
} }
}} }}
{...drawer}
/> />
</> </>
); );
...@@ -193,6 +194,7 @@ function Failure(props) { ...@@ -193,6 +194,7 @@ function Failure(props) {
actionRef.current.reload(); actionRef.current.reload();
} }
}} }}
{...drawer}
/> />
</> </>
); );
...@@ -294,6 +296,7 @@ function Failure(props) { ...@@ -294,6 +296,7 @@ function Failure(props) {
actionRef.current.reload(); actionRef.current.reload();
} }
}} }}
{...drawer}
/> />
</> </>
); );
...@@ -334,7 +337,7 @@ function Failure(props) { ...@@ -334,7 +337,7 @@ function Failure(props) {
id: row?.id, id: row?.id,
}; };
let res = await doFetch({ let res = await doFetch({
url: '/repair/umOtherUnitsOrder/orderReceiving', url: '/repair/umTrackOrder/orderReceiving',
params, params,
}); });
if (res.code === '0000') { if (res.code === '0000') {
...@@ -356,7 +359,7 @@ function Failure(props) { ...@@ -356,7 +359,7 @@ function Failure(props) {
id: row?.id, id: row?.id,
}; };
let res = await doFetch({ let res = await doFetch({
url: '/repair/umOtherUnitsOrder/dispatchById', url: '/repair/umTrackOrder/dispatchById',
params, params,
}); });
if (res.code === '0000') { if (res.code === '0000') {
...@@ -386,6 +389,8 @@ function Failure(props) { ...@@ -386,6 +389,8 @@ function Failure(props) {
item: { item: {
id: row.id, id: row.id,
}, },
detailpath: null,
params: null,
val: 'only', val: 'only',
title: '追踪信息', title: '追踪信息',
})); }));
...@@ -403,9 +408,6 @@ function Failure(props) { ...@@ -403,9 +408,6 @@ function Failure(props) {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
open: true, open: true,
// item: {
// id: row.id,
// },
val: 'only', val: 'only',
title: '验证', title: '验证',
detailpath: '/repair/umTrackTraceinfo/queryByTrackOrderId', detailpath: '/repair/umTrackTraceinfo/queryByTrackOrderId',
...@@ -511,7 +513,9 @@ function Failure(props) { ...@@ -511,7 +513,9 @@ function Failure(props) {
const selectType = (type) => { const selectType = (type) => {
switch (type) { switch (type) {
case 'add': case 'add':
return <Addform />; return (
<Addform url={'/repair/umTrackOrder/save'} setdrawer={setdrawer} actionRef={actionRef} />
);
case 'track': case 'track':
return <TrackForm />; return <TrackForm />;
case 'check': case 'check':
...@@ -525,7 +529,7 @@ function Failure(props) { ...@@ -525,7 +529,7 @@ function Failure(props) {
return ( return (
<div style={{ position: 'relative' }} ref={containderef}> <div style={{ position: 'relative' }} ref={containderef}>
<AutoTable <AutoTable
pagetitle={<h3 className="page-title">外协工单</h3>} pagetitle={<h3 className="page-title">追踪工单</h3>}
columns={columns} columns={columns}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
actionRef={actionRef} actionRef={actionRef}
...@@ -543,7 +547,7 @@ function Failure(props) { ...@@ -543,7 +547,7 @@ function Failure(props) {
item: { item: {
isShutdown: 1, isShutdown: 1,
}, },
title: '新建外协工单', title: '新建追踪工单',
val: 'only', val: 'only',
type: 'add', type: 'add',
})); }));
......
...@@ -382,7 +382,7 @@ function getcolumns(setdrawer) { ...@@ -382,7 +382,7 @@ function getcolumns(setdrawer) {
}, },
{ {
title: '状态', title: '状态',
hideInTable: true, // hideInTable: true,
dataIndex: 'statusName', dataIndex: 'statusName',
key: 'status', key: 'status',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
...@@ -398,14 +398,6 @@ function getcolumns(setdrawer) { ...@@ -398,14 +398,6 @@ function getcolumns(setdrawer) {
}, },
], ],
}, },
// {
// title: '状态',
// width: 50,
// hideInForm: true,
// dataIndex: 'statusName',
// key: 'status',
// search: false,
// },
{ {
title: '备注', title: '备注',
hideInTable: true, hideInTable: true,
...@@ -414,7 +406,6 @@ function getcolumns(setdrawer) { ...@@ -414,7 +406,6 @@ function getcolumns(setdrawer) {
key: 'remarks', key: 'remarks',
search: false, search: false,
}, },
// { title: '个人图片', hideInTable: true, dataIndex: 'userImgList', key: 'userImgList' },
{ {
title: '个人图片', title: '个人图片',
search: false, search: false,
...@@ -423,7 +414,7 @@ function getcolumns(setdrawer) { ...@@ -423,7 +414,7 @@ function getcolumns(setdrawer) {
valueType: 'uploadImage', valueType: 'uploadImage',
hideInTable: true, hideInTable: true,
fieldProps: { fieldProps: {
limit: 2, limit: 1,
}, },
render: (text, row) => { render: (text, row) => {
......
function getcolumns(setdrawer) { function getcolumns(ifs) {
return [ return [
{ {
title: '车间代码', title: '车间代码',
...@@ -22,6 +22,9 @@ function getcolumns(setdrawer) { ...@@ -22,6 +22,9 @@ function getcolumns(setdrawer) {
valueType: 'select', valueType: 'select',
options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} }, options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
fieldProps: {
disabled: ifs,
},
}, },
]; ];
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-09 14:44:18 * @Date: 2022-11-09 14:44:18
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-10 15:36:27 * @Last Modified time: 2022-12-07 16:37:56
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -56,13 +56,16 @@ function Factory(props) { ...@@ -56,13 +56,16 @@ function Factory(props) {
<PremButton <PremButton
btn={{ btn={{
size: 'small', size: 'small',
onClick: () => { onClick: async () => {
// let res = await doFetch({ url: '', params: {} });
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
visible: true, visible: true,
item: row, item: row,
title: '编辑', title: '编辑',
val: 'edit', val: 'edit',
fields: getcolumns(true),
onFinish: async (vals) => { onFinish: async (vals) => {
let params = { let params = {
...vals, ...vals,
...@@ -151,6 +154,7 @@ function Factory(props) { ...@@ -151,6 +154,7 @@ function Factory(props) {
detailpath: null, detailpath: null,
title: '新增', title: '新增',
val: 'add', val: 'add',
fields: getcolumns(false),
onFinish: async (vals) => { onFinish: async (vals) => {
let params = { let params = {
...vals, ...vals,
......
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