Commit bc536daa authored by TZW's avatar TZW

1125

parent f7ba5a94
......@@ -485,7 +485,18 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) {
});
formRef?.current?.setFieldsValue({ [name]: curvals });
} 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 ?? [];
}}
......@@ -585,7 +596,18 @@ function LinkTreeSelect({ item, colProps, formRef, name, curindex }) {
});
formRef?.current?.setFieldsValue({ [name]: curvals });
} 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);
......@@ -696,7 +718,18 @@ function LinkCheckbox({ item, colProps, formRef, name, curindex }) {
});
formRef?.current?.setFieldsValue({ [name]: curvals });
} 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 ?? [];
}}
......@@ -801,7 +834,18 @@ function LinkRadio({ item, colProps, formRef, name, curindex }) {
});
formRef?.current?.setFieldsValue({ [name]: curvals });
} 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 ?? [];
}}
......@@ -898,7 +942,18 @@ function LinkCascader({ item, colProps, formRef, name, curindex }) {
});
formRef?.current?.setFieldsValue({ [name]: curvals });
} 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);
......
function getcolumns(setdrawer) {
return [
{
title: '基础信息',
valueType: 'split',
},
{
title: '用户名',
dataIndex: 'accountName',
formItemProps: {
rules: [
{
required: false,
message: '此项为必填项',
},
],
},
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: '此项为必填项',
},
],
},
{ title: '报修单号', dataIndex: 'repairNo', key: 'repairNo' },
{ 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: 'dateRange' },
{
title: '工单状态',
dataIndex: 'statusName',
key: 'status',
valueType: 'radio',
options: [
{ label: '待维修', value: '1' },
{ label: '维修中', value: '2' },
],
},
];
}
......
/* 故障报修
* @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 { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro';
......@@ -7,11 +14,19 @@ import getcolumns from './columns';
function Failure(props) {
const actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
visible: false,
});
formRef = useRef(),
[drawer, setdrawer] = useState({
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) => {
return (
<PremButton
......@@ -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) => {
return (
<PremButton
......@@ -63,8 +57,7 @@ function Failure(props) {
title: '是否删除该用户?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
},
onConfirm: () => {},
}}
btn={{
size: 'small',
......@@ -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(() => {
let defcolumn = getcolumns(setdrawer);
return defcolumn.concat({
......@@ -84,7 +138,6 @@ function Failure(props) {
width: 150,
render: (text, row, _, action) => [
detail(text, row, _, action),
edit(text, row, _, action),
remove(text, row, _, action),
],
});
......@@ -93,16 +146,27 @@ function Failure(props) {
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle="故障报修"
pagetitle={<h3 className="page-title">故障报修</h3>}
columns={columns}
path="/ngic-auth/sysUser/query/page"
actionRef={actionRef}
pageextra={'add'}
resizeable={true}
path={activeTabKey == '1' ? urlParams.list_unfinished : urlParams.list_finished}
tabList={[
{
tab: '未完成',
key: '1',
},
{
tab: '已完成',
key: '2',
},
]}
addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
type: 'primary',
onClick: () => {
setdrawer((s) => ({
...s,
......@@ -117,7 +181,7 @@ function Failure(props) {
/>
<DrawerPro
fields={columns}
fields={drawer?.val == 'add' ? columns_add : columns}
detailpath="/ngic-auth/sysUser/query/detail"
params={{ id: drawer?.item?.id }}
formRef={formRef}
......@@ -134,4 +198,4 @@ function Failure(props) {
);
}
export default Failure;
\ No newline at end of file
export default Failure;
......@@ -13,7 +13,6 @@ function getcolumns(setdrawer) {
],
},
initialValue: '默认值',
search: false,
},
{
title: '组织类型',
......@@ -37,7 +36,6 @@ function getcolumns(setdrawer) {
},
],
},
search: false,
},
{
title: '上级组织',
......
......@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-24 11:16:02
* @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 { useState, useMemo, useRef } from 'react';
......@@ -114,7 +114,7 @@ function Type(props) {
parentKey: row.title,
departmentTypeName: '部门类型',
},
title: '新增子级',
title: '新增组织',
val: 'addChild',
onFinish: async (vals) => {
let params = {
......@@ -130,7 +130,7 @@ function Type(props) {
params,
});
if (res.code === '0000') {
message.success('新增子级成功!');
message.success('新增组织成功!');
setDrawer((s) => ({
...s,
visible: false,
......@@ -142,7 +142,7 @@ function Type(props) {
},
}}
>
新增子级
新增组织
</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