Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ems3.3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuhao
ems3.3
Commits
908e661a
Commit
908e661a
authored
Dec 01, 2022
by
TZW
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
12011420
parent
8e4441b6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
617 additions
and
311 deletions
+617
-311
index.jsx
src/components/ExtendField/index.jsx
+35
-10
index.jsx
src/pages/device/account/index.jsx
+259
-174
columns.js
src/pages/setting/users/columns.js
+197
-125
index.jsx
src/pages/setting/users/index.jsx
+47
-2
fieldsDetail.js
src/utils/fieldsDetail.js
+79
-0
No files found.
src/components/ExtendField/index.jsx
View file @
908e661a
...
...
@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-29 14:03:07
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-1
1-29 16:28:29
* @Last Modified time: 2022-1
2-01 11:06:20
*/
import
{
doFetch
}
from
'@/utils/doFetch'
;
...
...
@@ -10,8 +10,9 @@ import { useRequest } from 'ahooks';
import
{
useState
,
useEffect
}
from
'react'
;
import
InitForm
from
'../InitForm'
;
export
default
({
formId
})
=>
{
const
[
columns
,
setcolumns
]
=
useState
([]);
const
App
=
({
setDrawer
,
onFinish
,
drawer
,
actionRef
,
columns
,
urlParams
,
formId
})
=>
{
const
[
value
,
setValue
]
=
useState
(
''
);
const
[
fieldscolumns
,
setfieldscolumns
]
=
useState
(
columns
);
const
selectValueType
=
(
type
,
options
)
=>
{
switch
(
type
)
{
case
1
:
...
...
@@ -43,29 +44,53 @@ export default ({ formId }) => {
let
res
=
await
doFetch
({
url
:
'/base/paFormField/queryList'
,
params
:
{
formId
,
formId
:
formId
,
},
});
if
(
res
?.
data
?.
dataList
)
{
let
column
=
[];
let
column
=
[
{
title
:
'扩展字段'
,
valueType
:
'split'
,
},
];
res
?.
data
?.
dataList
?.
forEach
((
el
)
=>
{
column
.
push
({
...
selectValueType
(
el
.
fieldChar
,
el
.
value
Type
),
...
selectValueType
(
el
.
fieldChar
,
el
.
value
List
),
title
:
el
.
fieldName
,
dataIndex
:
'title'
,
dataIndex
:
el
.
fieldName
,
key
:
el
.
id
,
});
});
console
.
log
(
'11111'
,
column
);
setcolumns
(
column
);
setfieldscolumns
(
fieldscolumns
.
concat
(
column
));
}
};
fn
();
},
[]);
const
selectextendField
=
(
type
)
=>
{
switch
(
Number
(
type
))
{
case
1
:
return
'userCharList'
;
case
2
:
return
'equipmentCharList'
;
case
3
:
return
'equipmentSupplierCharList'
;
default
:
break
;
}
};
return
(
<>
<
InitForm
fields=
{
columns
}
/>
<
InitForm
extendField=
{
selectextendField
(
formId
)
}
detailpath=
{
urlParams
.
detail
}
params=
{
{
id
:
drawer
?.
item
?.
id
}
}
fields=
{
fieldscolumns
}
onFinish=
{
onFinish
}
/>
</>
);
};
export
default
App
;
src/pages/device/account/index.jsx
View file @
908e661a
...
...
@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-1
1-30 14:36:31
* @Last Modified time: 2022-1
2-01 13:59:27
*/
import
*
as
React
from
'react'
;
...
...
@@ -16,6 +16,7 @@ import { message, Dropdown, Menu, Layout, Button, Image, Space, Divider, Tabs }
import
TreeRender
from
'@/components/TreeRender'
;
import
{
ProDescriptions
}
from
'@ant-design/pro-components'
;
import
InitForm
from
'@/components/InitForm'
;
import
ExtendField
from
'@/components/ExtendField'
;
const
{
Sider
,
Content
}
=
Layout
;
...
...
@@ -474,28 +475,42 @@ function Model(props) {
...
s
,
visible
:
true
,
title
:
'编辑'
,
val
:
'edit'
,
detailpath
:
urlParams
.
detail
,
params
:
{
id
:
row
.
id
},
onFinish
:
async
(
vals
)
=>
{
console
.
log
(
1
);
let
params
=
{
...
vals
,
id
:
row
.
id
,
};
let
res
=
await
doFetch
({
url
:
urlParams
.
save
,
params
,
});
if
(
res
.
code
===
'0000'
)
{
message
.
success
(
'编辑成功!'
);
setDrawer
((
s
)
=>
({
...
s
,
visible
:
false
,
}));
actionRef
.
current
.
reload
();
}
},
val
:
'only'
,
type
:
'add'
,
item
:
row
,
// detailpath: urlParams.detail,
// params:
{
id
:
row
.
id
},
// onFinish: async (vals) =>
{
// console.log(1);
// let equipmentCharList = [];
// console.log('id:', row.id);
// for (let i in vals)
{
// if (!isNaN(Number(i)))
{
// equipmentCharList.push(
{
// fieldId: i,
// fieldRealValue: vals[i],
//
});
// delete vals[i];
//
}
//
}
// let params =
{
// ...vals,
// id: row.id,
// equipmentCharList,
//
};
// let res = await doFetch(
{
// url: urlParams.save,
// params,
//
});
// if (res.code === '0000')
{
// message.success('编辑成功!');
// setDrawer((s) => (
{
// ...s,
// visible: false,
//
}));
// actionRef.current.reload();
//
}
//
},
}));
},
}
}
...
...
@@ -646,104 +661,173 @@ function Model(props) {
const
[
activeTab
,
setactiveTab
]
=
useState
(
1
);
// 基础信息
const
BaseInfo
=
()
=>
{
const
columns
=
[
{
title
:
'设备编号'
,
dataIndex
:
'equipmentNo'
,
key
:
'equipmentNo'
,
},
{
title
:
'设备名称'
,
dataIndex
:
'equipmentName'
,
key
:
'equipmentName'
,
},
{
title
:
'位置号'
,
dataIndex
:
'positionNo'
,
key
:
'positionNo'
,
},
{
title
:
'设备类型'
,
dataIndex
:
'equipmentTypeName'
,
key
:
'equipmentTypeId'
,
},
{
title
:
'状态'
,
dataIndex
:
'statusName'
,
key
:
'statusName'
,
span
:
2
,
},
{
title
:
'公司名称'
,
dataIndex
:
'organizationName'
,
key
:
'organizationId'
,
},
{
title
:
'部门名称'
,
dataIndex
:
'departmentName'
,
key
:
'departmentId'
,
},
{
title
:
'工厂名称'
,
dataIndex
:
'factoryName'
,
key
:
'factoryId'
,
},
{
title
:
'车间名称'
,
dataIndex
:
'shopName'
,
key
:
'shopId'
,
},
{
title
:
'工段名称'
,
dataIndex
:
'sectionName'
,
key
:
'sectionId'
,
},
{
title
:
'产线名称'
,
dataIndex
:
'productLineName'
,
key
:
'productLineName'
,
},
{
title
:
'供应商'
,
dataIndex
:
'supplierName'
,
key
:
'supplierId'
,
},
{
title
:
'设备原值'
,
dataIndex
:
'equipmentWorth'
,
key
:
'equipmentWorth'
,
},
{
title
:
'安装投产日期'
,
dataIndex
:
'productDate'
,
key
:
'productDate'
,
},
{
title
:
'图片'
,
dataIndex
:
'pictureUrl'
,
key
:
'pictureUrl'
,
render
:
(
text
,
row
)
=>
<
Image
width=
{
70
}
src=
{
row
.
pictureUrl
}
/>,
},
{
title
:
'二维码'
,
dataIndex
:
'qrCodeUrl'
,
key
:
'qrCodeUrl'
,
render
:
(
text
,
row
)
=>
<
Image
width=
{
70
}
src=
{
row
.
qrCodeUrl
}
/>,
},
];
const
[
newfieldscolumns
,
setnewfieldscolumns
]
=
useState
(
columns
);
const
selectValueType
=
(
type
,
options
)
=>
{
switch
(
type
)
{
case
1
:
return
{
valueType
:
'input'
,
};
case
2
:
return
{
valueType
:
'select'
,
options
,
};
case
3
:
return
{
valueType
:
'radio'
,
options
,
};
case
4
:
return
{
valueType
:
'select'
,
options
,
};
default
:
break
;
}
};
useEffect
(()
=>
{
const
fn
=
async
()
=>
{
let
res
=
await
doFetch
({
url
:
'/base/paFormField/queryList'
,
params
:
{
formId
:
'2'
,
},
});
if
(
res
?.
data
?.
dataList
)
{
let
column
=
[
{
title
:
'扩展字段'
,
valueType
:
'split'
,
},
];
res
?.
data
?.
dataList
?.
forEach
((
el
)
=>
{
column
.
push
({
...
selectValueType
(
el
.
fieldChar
,
el
.
valueList
),
title
:
el
.
fieldName
,
dataIndex
:
el
.
id
,
key
:
el
.
id
,
});
});
setnewfieldscolumns
(
columns
.
concat
(
column
));
}
};
fn
();
},
[]);
return
(
<>
<
ProDescriptions
request=
{
async
()
=>
{
const
{
data
}
=
await
doFetch
({
const
res
=
await
doFetch
({
url
:
urlParams
.
detail
,
params
:
{
id
:
drawer
?.
item
?.
id
},
});
let
obj
=
{};
res
?.
data
?.
data
[
equipmentCharList
]?.
forEach
((
it
)
=>
{
obj
[
it
?.
fieldId
]
=
it
?.
fieldRealValue
;
});
console
.
log
(
'drawerpro:'
,
{
...(
res
?.
data
?.
data
??
{}),
...
obj
,
});
return
{
success
:
true
,
data
:
data
?.
data
,
data
:
{
...(
res
?.
data
?.
data
??
{}),
...
obj
,
}
??
{},
};
}
}
columns=
{
[
{
title
:
'设备编号'
,
dataIndex
:
'equipmentNo'
,
key
:
'equipmentNo'
,
},
{
title
:
'设备名称'
,
dataIndex
:
'equipmentName'
,
key
:
'equipmentName'
,
},
{
title
:
'位置号'
,
dataIndex
:
'positionNo'
,
key
:
'positionNo'
,
},
{
title
:
'设备类型'
,
dataIndex
:
'equipmentTypeName'
,
key
:
'equipmentTypeId'
,
},
{
title
:
'状态'
,
dataIndex
:
'statusName'
,
key
:
'statusName'
,
span
:
2
,
},
{
title
:
'公司名称'
,
dataIndex
:
'organizationName'
,
key
:
'organizationId'
,
},
{
title
:
'部门名称'
,
dataIndex
:
'departmentName'
,
key
:
'departmentId'
,
},
{
title
:
'工厂名称'
,
dataIndex
:
'factoryName'
,
key
:
'factoryId'
,
},
{
title
:
'车间名称'
,
dataIndex
:
'shopName'
,
key
:
'shopId'
,
},
{
title
:
'工段名称'
,
dataIndex
:
'sectionName'
,
key
:
'sectionId'
,
},
{
title
:
'产线名称'
,
dataIndex
:
'productLineName'
,
key
:
'productLineName'
,
},
{
title
:
'供应商'
,
dataIndex
:
'supplierName'
,
key
:
'supplierId'
,
},
{
title
:
'设备原值'
,
dataIndex
:
'equipmentWorth'
,
key
:
'equipmentWorth'
,
},
{
title
:
'安装投产日期'
,
dataIndex
:
'productDate'
,
key
:
'productDate'
,
},
{
title
:
'图片'
,
dataIndex
:
'pictureUrl'
,
key
:
'pictureUrl'
,
render
:
(
text
,
row
)
=>
<
Image
width=
{
70
}
src=
{
row
.
pictureUrl
}
/>,
},
{
title
:
'二维码'
,
dataIndex
:
'qrCodeUrl'
,
key
:
'qrCodeUrl'
,
render
:
(
text
,
row
)
=>
<
Image
width=
{
70
}
src=
{
row
.
qrCodeUrl
}
/>,
},
]
}
columns=
{
newfieldscolumns
}
/>
<
Divider
/>
<
h3
className=
"page-title"
>
扩展字段
</
h3
>
...
...
@@ -1932,51 +2016,6 @@ function Model(props) {
},
]
}
/>
{
/* <Space style={{ marginTop: 16 }}>
<Button
onClick={() => {
console.log(drawer);
setDrawer((s) => ({
...s,
visible: false,
item: null,
detailpath: null,
params: null,
val: null,
onFinish: null,
}));
setSelectArr([]);
}}
>
取消
</Button>
<Button
type="primary"
onClick={async () => {
console.log(selectArr);
let res = await doFetch({
url: urlParams_childEquipment.save,
params: {
equipmentId: drawer?.item?.id,
childrenIdList: selectArr,
},
});
if (res.code === '0000') {
message.success('新增成功!');
setDrawer((s) => ({
...s,
visible: false,
item: null,
}));
setSelectArr([]);
actionRef.current.reload();
}
}}
>
提交
</Button>
</Space> */
}
</>
);
};
...
...
@@ -2030,6 +2069,51 @@ function Model(props) {
return
<
Resume
/>;
case
'detail'
:
return
<
Detail
/>;
case
'add'
:
return
(
<
ExtendField
setDrawer=
{
setDrawer
}
drawer=
{
drawer
}
actionRef=
{
actionRef
}
columns=
{
columns
}
urlParams=
{
urlParams
}
formId=
{
'2'
}
onFinish=
{
async
(
vals
)
=>
{
let
equipmentCharReqList
=
[];
for
(
let
i
in
vals
)
{
if
(
!
isNaN
(
Number
(
i
)))
{
equipmentCharReqList
.
push
({
fieldId
:
i
,
fieldRealValue
:
vals
[
i
],
});
delete
vals
[
i
];
}
}
let
params
=
{
...
vals
,
id
:
drawer
?.
title
==
'编辑'
?
drawer
?.
item
?.
id
:
''
,
equipmentCharReqList
,
};
console
.
log
(
params
,
'!!!!'
);
let
res
=
await
doFetch
({
url
:
urlParams
.
save
,
params
,
});
if
(
res
.
code
===
'0000'
)
{
if
(
drawer
?.
title
==
'编辑'
)
{
message
.
success
(
'编辑成功!'
);
}
else
{
message
.
success
(
'新增成功!'
);
}
setDrawer
((
s
)
=>
({
...
s
,
visible
:
false
,
}));
actionRef
.
current
.
reload
();
}
}
}
/>
);
default
:
return
null
;
}
...
...
@@ -2068,25 +2152,26 @@ function Model(props) {
visible
:
true
,
item
:
null
,
title
:
'新增'
,
val
:
'add'
,
onFinish
:
async
(
vals
)
=>
{
console
.
log
(
vals
);
let
params
=
{
...
vals
,
};
let
res
=
await
doFetch
({
url
:
urlParams
.
save
,
params
,
});
if
(
res
.
code
===
'0000'
)
{
message
.
success
(
'新增成功!'
);
setDrawer
((
s
)
=>
({
...
s
,
visible
:
false
,
}));
actionRef
.
current
.
reload
();
}
},
val
:
'only'
,
type
:
'add'
,
// onFinish: async (vals) =>
{
// console.log(vals);
// let params =
{
// ...vals,
//
};
// let res = await doFetch(
{
// url: urlParams.save,
// params,
//
});
// if (res.code === '0000')
{
// message.success('新增成功!');
// setDrawer((s) => (
{
// ...s,
// visible: false,
//
}));
// actionRef.current.reload();
//
}
//
},
}));
},
},
...
...
src/pages/setting/users/columns.js
View file @
908e661a
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
Image
}
from
'antd'
;
import
fieldsDetail
from
'@/utils/fieldsDetail'
;
import
{
useState
,
useEffect
}
from
'react'
;
function
getcolumns
(
setdrawer
)
{
return
[
...
...
@@ -19,133 +20,204 @@ function getcolumns(setdrawer) {
render
:
(
text
,
row
)
=>
{
return
(
<
a
onClick
=
{
async
()
=>
{
let
newfieldscolumns
=
[];
const
fieldscolumns
=
[
{
title
:
'用户名'
,
dataIndex
:
'username'
,
key
:
'username'
,
},
{
title
:
'姓名'
,
dataIndex
:
'fullName'
,
key
:
'fullName'
,
},
{
title
:
'手机号'
,
dataIndex
:
'telephone'
,
key
:
'telephone'
},
{
title
:
'邮箱'
,
dataIndex
:
'mailNo'
,
key
:
'mailNo'
,
},
{
title
:
'公司名称'
,
dataIndex
:
'organizationName'
,
key
:
'organizationId'
,
},
{
title
:
'部门名称'
,
dataIndex
:
'departmentName'
,
key
:
'departmentId'
,
},
{
title
:
'负责工厂'
,
dataIndex
:
'factoryNames'
,
key
:
'factoryNames'
,
},
{
title
:
'负责车间'
,
dataIndex
:
'shopNames'
,
key
:
'shopNames'
,
},
{
title
:
'负责工段'
,
dataIndex
:
'sectionName'
,
key
:
'sectionIdList'
,
},
{
title
:
'负责产线'
,
dataIndex
:
'productionLines'
,
key
:
'productionLineIdList'
,
},
{
title
:
'角色配置'
,
dataIndex
:
'roleNames'
,
key
:
'roleIdList'
,
},
{
title
:
'直属领导'
,
dataIndex
:
'parentName'
,
key
:
'parentId'
,
},
{
title
:
'状态'
,
dataIndex
:
'statusName'
,
key
:
'status'
,
},
];
const
selectValueType
=
(
type
,
options
)
=>
{
switch
(
type
)
{
case
1
:
return
{
valueType
:
'input'
,
};
case
2
:
return
{
valueType
:
'select'
,
options
,
};
case
3
:
return
{
valueType
:
'radio'
,
options
,
};
case
4
:
return
{
valueType
:
'select'
,
options
,
};
default
:
break
;
}
};
//
onClick={async () => {
//
let newfieldscolumns = [];
//
const fieldscolumns = [
//
{
//
title: '用户名',
//
dataIndex: 'username',
//
key: 'username',
//
},
//
{
//
title: '姓名',
//
dataIndex: 'fullName',
//
key: 'fullName',
//
},
//
{ title: '手机号', dataIndex: 'telephone', key: 'telephone' },
//
{
//
title: '邮箱',
//
dataIndex: 'mailNo',
//
key: 'mailNo',
//
},
//
{
//
title: '公司名称',
//
dataIndex: 'organizationName',
//
key: 'organizationId',
//
},
//
{
//
title: '部门名称',
//
dataIndex: 'departmentName',
//
key: 'departmentId',
//
},
//
{
//
title: '负责工厂',
//
dataIndex: 'factoryNames',
//
key: 'factoryNames',
//
},
//
{
//
title: '负责车间',
//
dataIndex: 'shopNames',
//
key: 'shopNames',
//
},
//
{
//
title: '负责工段',
//
dataIndex: 'sectionName',
//
key: 'sectionIdList',
//
},
//
{
//
title: '负责产线',
//
dataIndex: 'productionLines',
//
key: 'productionLineIdList',
//
},
//
{
//
title: '角色配置',
//
dataIndex: 'roleNames',
//
key: 'roleIdList',
//
},
//
{
//
title: '直属领导',
//
dataIndex: 'parentName',
//
key: 'parentId',
//
},
//
{
//
title: '状态',
//
dataIndex: 'statusName',
//
key: 'status',
//
},
//
];
//
const selectValueType = (type, options) => {
//
switch (type) {
//
case 1:
//
return {
//
valueType: 'input',
//
};
//
case 2:
//
return {
//
valueType: 'select',
//
options,
//
};
//
case 3:
//
return {
//
valueType: 'radio',
//
options,
//
};
//
case 4:
//
return {
//
valueType: 'select',
//
options,
//
};
//
default:
//
break;
//
}
//
};
let
res
=
await
doFetch
({
url
:
'/base/paFormField/queryList'
,
params
:
{
formId
:
'1'
,
},
});
if
(
res
?.
data
?.
dataList
)
{
let
column
=
[
// let res = await doFetch({
// url: '/base/paFormField/queryList',
// params: {
// formId: '1',
// },
// });
// if (res?.data?.dataList) {
// let column = [
// {
// title: '扩展字段',
// valueType: 'split',
// },
// ];
// res?.data?.dataList?.forEach((el) => {
// column.push({
// ...selectValueType(el.fieldChar, el.valueList),
// title: el.fieldName,
// dataIndex: el.id,
// key: el.id,
// });
// });
// newfieldscolumns = fieldscolumns.concat(column);
// console.log('fieldscolumns', newfieldscolumns);
// }
// setdrawer((s) => ({
// ...s,
// visible: true,
// item: row,
// title: '详情',
// fields: newfieldscolumns,
// extendField: 'userCharList',
// detailpath: '/auth/sysUser/detail',
// params: { id: row.id },
// val: 'detail',
// title: row.fullName + '的详细信息',
// }));
// }}
onClick
=
{()
=>
{
fieldsDetail
(
[
{
title
:
'扩展字段'
,
valueType
:
'split'
,
title
:
'用户名'
,
dataIndex
:
'username'
,
key
:
'username'
,
},
];
res
?.
data
?.
dataList
?.
forEach
((
el
)
=>
{
column
.
push
({
...
selectValueType
(
el
.
fieldChar
,
el
.
valueList
),
title
:
el
.
fieldName
,
dataIndex
:
el
.
id
,
key
:
el
.
id
,
});
});
newfieldscolumns
=
fieldscolumns
.
concat
(
column
);
console
.
log
(
'fieldscolumns'
,
newfieldscolumns
);
}
setdrawer
((
s
)
=>
({
...
s
,
visible
:
true
,
item
:
row
,
title
:
'详情'
,
fields
:
newfieldscolumns
,
extendField
:
'userCharList'
,
detailpath
:
'/auth/sysUser/detail'
,
params
:
{
id
:
row
.
id
},
val
:
'detail'
,
title
:
row
.
fullName
+
'的详细信息'
,
}));
{
title
:
'姓名'
,
dataIndex
:
'fullName'
,
key
:
'fullName'
,
},
{
title
:
'手机号'
,
dataIndex
:
'telephone'
,
key
:
'telephone'
},
{
title
:
'邮箱'
,
dataIndex
:
'mailNo'
,
key
:
'mailNo'
,
},
{
title
:
'公司名称'
,
dataIndex
:
'organizationName'
,
key
:
'organizationId'
,
},
{
title
:
'部门名称'
,
dataIndex
:
'departmentName'
,
key
:
'departmentId'
,
},
{
title
:
'负责工厂'
,
dataIndex
:
'factoryNames'
,
key
:
'factoryNames'
,
},
{
title
:
'负责车间'
,
dataIndex
:
'shopNames'
,
key
:
'shopNames'
,
},
{
title
:
'负责工段'
,
dataIndex
:
'sectionName'
,
key
:
'sectionIdList'
,
},
{
title
:
'负责产线'
,
dataIndex
:
'productionLines'
,
key
:
'productionLineIdList'
,
},
{
title
:
'角色配置'
,
dataIndex
:
'roleNames'
,
key
:
'roleIdList'
,
},
{
title
:
'直属领导'
,
dataIndex
:
'parentName'
,
key
:
'parentId'
,
},
{
title
:
'状态'
,
dataIndex
:
'statusName'
,
key
:
'status'
,
},
],
setdrawer
,
row
,
'1'
,
'/auth/sysUser/detail'
,
);
}}
>
{
row
.
fullName
}
...
...
@@ -242,7 +314,7 @@ function getcolumns(setdrawer) {
{
title
:
'负责工段'
,
width
:
120
,
dataIndex
:
'sectionName'
,
dataIndex
:
'sectionName
s
'
,
align
:
'center'
,
search
:
false
,
key
:
'sectionIdList'
,
...
...
src/pages/setting/users/index.jsx
View file @
908e661a
...
...
@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-1
1-30 16:42:10
* @Last Modified time: 2022-1
2-01 11:13:59
*/
import
*
as
React
from
'react'
;
...
...
@@ -14,6 +14,7 @@ import InitForm from '@/components/InitForm';
import
getcolumns
from
'./columns'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
message
,
AutoComplete
}
from
'antd'
;
import
ExtendField
from
'@/components/ExtendField'
;
function
User
(
props
)
{
const
actionRef
=
useRef
(),
...
...
@@ -298,7 +299,51 @@ function User(props) {
}
}
{
...
drawer
}
>
{
drawer
?.
type
==
'add'
?
<
Adduser
/>
:
null
}
{
drawer
?.
type
==
'add'
?
(
<
ExtendField
setDrawer=
{
setDrawer
}
drawer=
{
drawer
}
actionRef=
{
actionRef
}
columns=
{
columns
}
formId=
{
'1'
}
urlParams=
{
urlParams
}
onFinish=
{
async
(
vals
)
=>
{
let
userCharReqList
=
[];
for
(
let
i
in
vals
)
{
if
(
!
isNaN
(
Number
(
i
)))
{
userCharReqList
.
push
({
fieldId
:
i
,
fieldRealValue
:
vals
[
i
],
});
delete
vals
[
i
];
}
}
let
params
=
{
...
vals
,
id
:
drawer
?.
title
==
'编辑'
?
drawer
?.
item
?.
id
:
''
,
userCharReqList
,
};
delete
params
.
shopId
;
console
.
log
(
params
,
'!!!!'
);
let
res
=
await
doFetch
({
url
:
urlParams
.
save
,
params
,
});
if
(
res
.
code
===
'0000'
)
{
if
(
drawer
?.
title
==
'编辑'
)
{
message
.
success
(
'编辑成功!'
);
}
else
{
message
.
success
(
'新增成功!'
);
}
setDrawer
((
s
)
=>
({
...
s
,
visible
:
false
,
}));
actionRef
.
current
.
reload
();
}
}
}
/>
)
:
null
}
</
DrawerPro
>
</
div
>
);
...
...
src/utils/fieldsDetail.js
0 → 100644
View file @
908e661a
import
{
doFetch
}
from
'./doFetch'
;
export
default
async
(
fieldscolumns
,
setdrawer
,
row
,
formId
,
detailpath
)
=>
{
let
newfieldscolumns
=
[];
const
selectValueType
=
(
type
,
options
)
=>
{
switch
(
type
)
{
case
1
:
return
{
valueType
:
'input'
,
};
case
2
:
return
{
valueType
:
'select'
,
options
,
};
case
3
:
return
{
valueType
:
'radio'
,
options
,
};
case
4
:
return
{
valueType
:
'select'
,
options
,
};
default
:
break
;
}
};
const
selectextendField
=
(
type
)
=>
{
switch
(
Number
(
type
))
{
case
1
:
return
'userCharList'
;
case
2
:
return
'equipmentCharList'
;
case
3
:
return
'equipmentSupplierCharList'
;
default
:
break
;
}
};
let
res
=
await
doFetch
({
url
:
'/base/paFormField/queryList'
,
params
:
{
formId
,
},
});
if
(
res
?.
data
?.
dataList
)
{
let
column
=
[
{
title
:
'扩展字段'
,
valueType
:
'split'
,
},
];
res
?.
data
?.
dataList
?.
forEach
((
el
)
=>
{
column
.
push
({
...
selectValueType
(
el
.
fieldChar
,
el
.
valueList
),
title
:
el
.
fieldName
,
dataIndex
:
el
.
id
,
key
:
el
.
id
,
});
});
newfieldscolumns
=
fieldscolumns
.
concat
(
column
);
console
.
log
(
'fieldscolumns'
,
newfieldscolumns
);
}
setdrawer
((
s
)
=>
({
...
s
,
visible
:
true
,
item
:
row
,
title
:
'详情'
,
fields
:
newfieldscolumns
,
extendField
:
selectextendField
(
formId
),
detailpath
,
params
:
{
id
:
row
.
id
},
val
:
'detail'
,
title
:
row
.
fullName
+
'的详细信息'
,
}));
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment