Commit bc536daa authored by TZW's avatar TZW

1125

parent f7ba5a94
...@@ -485,7 +485,18 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) { ...@@ -485,7 +485,18 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) {
}); });
formRef?.current?.setFieldsValue({ [name]: curvals }); formRef?.current?.setFieldsValue({ [name]: curvals });
} else { } else {
formRef?.current?.setFieldsValue({ [curkey]: null }); let curval = formRef?.current?.getFieldValue(curkey),
ifclean;
if (Array.isArray(curval)) {
ifclean = res?.data?.dataList
?.map((it) => it.value)
.filter?.((it) => {
return curval?.includes(it);
});
} else {
ifclean = res?.data?.dataList.filter((it) => it.value == curval)?.[0]?.value;
}
formRef?.current?.setFieldsValue({ [curkey]: ifclean });
} }
return res?.data?.dataList ?? []; return res?.data?.dataList ?? [];
}} }}
...@@ -585,7 +596,18 @@ function LinkTreeSelect({ item, colProps, formRef, name, curindex }) { ...@@ -585,7 +596,18 @@ function LinkTreeSelect({ item, colProps, formRef, name, curindex }) {
}); });
formRef?.current?.setFieldsValue({ [name]: curvals }); formRef?.current?.setFieldsValue({ [name]: curvals });
} else { } else {
formRef?.current?.setFieldsValue({ [curkey]: null }); let curval = formRef?.current?.getFieldValue(curkey),
ifclean;
if (Array.isArray(curval)) {
ifclean = res?.data?.dataList
?.map((it) => it.value)
.filter?.((it) => {
return curval?.includes(it);
});
} else {
ifclean = res?.data?.dataList.filter((it) => it.value == curval)?.[0]?.value;
}
formRef?.current?.setFieldsValue({ [curkey]: ifclean });
} }
} }
prevparse.current = JSON.stringify(parse); prevparse.current = JSON.stringify(parse);
...@@ -696,7 +718,18 @@ function LinkCheckbox({ item, colProps, formRef, name, curindex }) { ...@@ -696,7 +718,18 @@ function LinkCheckbox({ item, colProps, formRef, name, curindex }) {
}); });
formRef?.current?.setFieldsValue({ [name]: curvals }); formRef?.current?.setFieldsValue({ [name]: curvals });
} else { } else {
formRef?.current?.setFieldsValue({ [curkey]: null }); let curval = formRef?.current?.getFieldValue(curkey),
ifclean;
if (Array.isArray(curval)) {
ifclean = res?.data?.dataList
?.map((it) => it.value)
.filter?.((it) => {
return curval?.includes(it);
});
} else {
ifclean = res?.data?.dataList.filter((it) => it.value == curval)?.[0]?.value;
}
formRef?.current?.setFieldsValue({ [curkey]: ifclean });
} }
return res?.data?.dataList ?? []; return res?.data?.dataList ?? [];
}} }}
...@@ -801,7 +834,18 @@ function LinkRadio({ item, colProps, formRef, name, curindex }) { ...@@ -801,7 +834,18 @@ function LinkRadio({ item, colProps, formRef, name, curindex }) {
}); });
formRef?.current?.setFieldsValue({ [name]: curvals }); formRef?.current?.setFieldsValue({ [name]: curvals });
} else { } else {
formRef?.current?.setFieldsValue({ [curkey]: null }); let curval = formRef?.current?.getFieldValue(curkey),
ifclean;
if (Array.isArray(curval)) {
ifclean = res?.data?.dataList
?.map((it) => it.value)
.filter?.((it) => {
return curval?.includes(it);
});
} else {
ifclean = res?.data?.dataList.filter((it) => it.value == curval)?.[0]?.value;
}
formRef?.current?.setFieldsValue({ [curkey]: ifclean });
} }
return res?.data?.dataList ?? []; return res?.data?.dataList ?? [];
}} }}
...@@ -898,7 +942,18 @@ function LinkCascader({ item, colProps, formRef, name, curindex }) { ...@@ -898,7 +942,18 @@ function LinkCascader({ item, colProps, formRef, name, curindex }) {
}); });
formRef?.current?.setFieldsValue({ [name]: curvals }); formRef?.current?.setFieldsValue({ [name]: curvals });
} else { } else {
formRef?.current?.setFieldsValue({ [curkey]: null }); let curval = formRef?.current?.getFieldValue(curkey),
ifclean;
if (Array.isArray(curval)) {
ifclean = res?.data?.dataList
?.map((it) => it.value)
.filter?.((it) => {
return curval?.includes(it);
});
} else {
ifclean = res?.data?.dataList.filter((it) => it.value == curval)?.[0]?.value;
}
formRef?.current?.setFieldsValue({ [curkey]: ifclean });
} }
} }
prevparse.current = JSON.stringify(parse); prevparse.current = JSON.stringify(parse);
......
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return [ return [
{ { title: '报修单号', dataIndex: 'repairNo', key: 'repairNo' },
title: '基础信息', { title: '设备编号', dataIndex: 'equipmentNo', key: 'equipmentNo' },
valueType: 'split', { title: '设备名称', dataIndex: 'equipmentName', key: 'equipmentName' },
}, { title: '故障描述', dataIndex: 'faultDescription', key: 'faultDescription' },
{ { title: '报修人', dataIndex: 'repairUserName', key: 'repairUserName' },
title: '用户名', { title: '报修时间', dataIndex: 'repairTime', key: 'repairTimeList', valueType: 'dateRange' },
dataIndex: 'accountName', {
formItemProps: { title: '工单状态',
rules: [ dataIndex: 'statusName',
{ key: 'status',
required: false, valueType: 'radio',
message: '此项为必填项', options: [
}, { label: '待维修', value: '1' },
], { label: '维修中', value: '2' },
}, ],
initialValue: '默认值',
hideInForm: false,
search: false,
render: (text, row) => {
return (
<a
onClick={() => {
setdrawer?.((s) => ({
...s,
visible: true,
item: null,
title: '新增',
val: 'add',
}));
}}
>
{text}
</a>
);
},
},
{
title: '姓名',
dataIndex: 'userName',
key: 'userId',
hideInForm: {
accountName: {
reverse: ['1', '2', '5'],
},
remark: ['3'],
},
search: false,
},
{
title: '额外信息',
valueType: 'split',
},
{
title: '联系电话',
dataIndex: 'telephone',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
search: false,
},
{
title: '邮箱',
dataIndex: 'mailNo',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
search: false,
},
{
title: '备注',
dataIndex: 'remark',
valueType: 'editor',
search: false,
colProps: { span: 24 },
initialValue: '<p>Hello <b>World!</b></p>',
},
{
title: '上传样式-图片',
dataIndex: 'uploadImage',
key: 'uploadImage',
valueType: 'uploadImage',
fieldProps: {
limit: 2,
},
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
}, },
]; ];
} }
......
/* 故障报修
* @Author: Li Hanlin
* @Date: 2022-11-25 09:18:03
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-25 14:17:48
*/
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';
...@@ -7,11 +14,19 @@ import getcolumns from './columns'; ...@@ -7,11 +14,19 @@ import getcolumns from './columns';
function Failure(props) { function Failure(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef(),
const [drawer, setdrawer] = useState({ [drawer, setdrawer] = useState({
visible: false, visible: false,
}); }),
[activeTabKey, onTabChange] = useState('1');
const urlParams = {
detail: '/repair/umFailureRepair/queryById',
save: '/repair/umFailureRepair/save',
remove: '/repair/umFailureRepair/deleteById',
list_unfinished: '/repair/umFailureRepair/queryNoFinishList',
list_finished: '/repair/umFailureRepair/queryFinishList',
};
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
...@@ -35,27 +50,6 @@ function Failure(props) { ...@@ -35,27 +50,6 @@ function Failure(props) {
); );
}; };
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
visible: true,
item: row,
title: '编辑',
val: 'edit',
}));
},
}}
>
编辑
</PremButton>
);
};
const remove = (text, row, _, action) => { const remove = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
...@@ -63,8 +57,7 @@ function Failure(props) { ...@@ -63,8 +57,7 @@ function Failure(props) {
title: '是否删除该用户?', title: '是否删除该用户?',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onConfirm: () => { onConfirm: () => {},
},
}} }}
btn={{ btn={{
size: 'small', size: 'small',
...@@ -76,6 +69,67 @@ function Failure(props) { ...@@ -76,6 +69,67 @@ function Failure(props) {
); );
}; };
const columns_add = [
{
title: '选择设备',
dataIndex: 'equipmentId',
key: 'equipmentId',
valueType: 'select',
options: { path: '/asset/equipment/selection/user/shop', params: {} },
},
{
title: '是否停机',
dataIndex: 'isShutdown',
key: 'isShutdown',
valueType: 'radio',
options: [
{
label: '是',
value: 1,
},
{
label: '否',
value: 2,
},
],
},
{
title: '故障类型',
dataIndex: 'faultSettingId',
valueType: 'select',
key: 'faultSettingId',
options: {
path: '/repair/umFaultSetting/selected/queryList',
linkParams: {
equipmentId: '',
},
},
},
{
title: '故障名称',
dataIndex: 'faultDetailId',
valueType: 'select',
key: 'faultDetailId',
options: {
path: '/repair/umFaultSettingDetail/selected/queryList',
linkParams: {
faultSettingId: '',
},
},
},
{ title: '故障描述', dataIndex: 'faultDescription', key: 'faultDescription' },
{ title: '故障图片', dataIndex: 'pictureId', key: 'pictureId', valueType: 'updateImage' },
{
title: '工单状态',
dataIndex: 'statusName',
key: 'status',
valueType: 'radio',
options: [
{ label: '待维修', value: '1' },
{ label: '维修中', value: '2' },
],
},
];
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer); let defcolumn = getcolumns(setdrawer);
return defcolumn.concat({ return defcolumn.concat({
...@@ -84,7 +138,6 @@ function Failure(props) { ...@@ -84,7 +138,6 @@ function Failure(props) {
width: 150, width: 150,
render: (text, row, _, action) => [ render: (text, row, _, action) => [
detail(text, row, _, action), detail(text, row, _, action),
edit(text, row, _, action),
remove(text, row, _, action), remove(text, row, _, action),
], ],
}); });
...@@ -93,16 +146,27 @@ function Failure(props) { ...@@ -93,16 +146,27 @@ function Failure(props) {
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="故障报修" pagetitle={<h3 className="page-title">故障报修</h3>}
columns={columns} columns={columns}
path="/ngic-auth/sysUser/query/page"
actionRef={actionRef} actionRef={actionRef}
pageextra={'add'} pageextra={'add'}
resizeable={true} resizeable={true}
path={activeTabKey == '1' ? urlParams.list_unfinished : urlParams.list_finished}
tabList={[
{
tab: '未完成',
key: '1',
},
{
tab: '已完成',
key: '2',
},
]}
addconfig={{ addconfig={{
// access: 'sysDepartment_save', // access: 'sysDepartment_save',
btn: { btn: {
disabled: false, disabled: false,
type: 'primary',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
...@@ -117,7 +181,7 @@ function Failure(props) { ...@@ -117,7 +181,7 @@ function Failure(props) {
/> />
<DrawerPro <DrawerPro
fields={columns} fields={drawer?.val == 'add' ? columns_add : columns}
detailpath="/ngic-auth/sysUser/query/detail" detailpath="/ngic-auth/sysUser/query/detail"
params={{ id: drawer?.item?.id }} params={{ id: drawer?.item?.id }}
formRef={formRef} formRef={formRef}
...@@ -134,4 +198,4 @@ function Failure(props) { ...@@ -134,4 +198,4 @@ function Failure(props) {
); );
} }
export default Failure; export default Failure;
\ No newline at end of file
...@@ -13,7 +13,6 @@ function getcolumns(setdrawer) { ...@@ -13,7 +13,6 @@ function getcolumns(setdrawer) {
], ],
}, },
initialValue: '默认值', initialValue: '默认值',
search: false,
}, },
{ {
title: '组织类型', title: '组织类型',
...@@ -37,7 +36,6 @@ function getcolumns(setdrawer) { ...@@ -37,7 +36,6 @@ function getcolumns(setdrawer) {
}, },
], ],
}, },
search: false,
}, },
{ {
title: '上级组织', title: '上级组织',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-24 11:16:02 * @Date: 2022-11-24 11:16:02
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-24 14:44:11 * @Last Modified time: 2022-11-25 14:29:36
*/ */
import * as React from 'react'; import * as React from 'react';
import { useState, useMemo, useRef } from 'react'; import { useState, useMemo, useRef } from 'react';
...@@ -114,7 +114,7 @@ function Type(props) { ...@@ -114,7 +114,7 @@ function Type(props) {
parentKey: row.title, parentKey: row.title,
departmentTypeName: '部门类型', departmentTypeName: '部门类型',
}, },
title: '新增子级', title: '新增组织',
val: 'addChild', val: 'addChild',
onFinish: async (vals) => { onFinish: async (vals) => {
let params = { let params = {
...@@ -130,7 +130,7 @@ function Type(props) { ...@@ -130,7 +130,7 @@ function Type(props) {
params, params,
}); });
if (res.code === '0000') { if (res.code === '0000') {
message.success('新增子级成功!'); message.success('新增组织成功!');
setDrawer((s) => ({ setDrawer((s) => ({
...s, ...s,
visible: false, visible: false,
...@@ -142,7 +142,7 @@ function Type(props) { ...@@ -142,7 +142,7 @@ function Type(props) {
}, },
}} }}
> >
新增子级 新增组织
</PremButton> </PremButton>
); );
}; };
......
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