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
7120c0d2
Commit
7120c0d2
authored
Dec 01, 2022
by
TZW
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
12011738
parent
c89192a7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
276 additions
and
163 deletions
+276
-163
index.jsx
src/components/AutoTable/index.jsx
+1
-1
index.jsx
src/pages/device/account/index.jsx
+1
-1
columns.js
src/pages/device/supplier/columns.js
+6
-1
index.jsx
src/pages/device/supplier/index.jsx
+267
-53
index.jsx
src/pages/setting/users/index.jsx
+1
-107
No files found.
src/components/AutoTable/index.jsx
View file @
7120c0d2
...
...
@@ -27,7 +27,7 @@ export default (props) => {
),
};
//右上角
page
extra 类型 1.reactDom 2.string 以逗号隔开 为none时不显示
//右上角
extra 类型 1.reactDom 2.string 以逗号隔开 为none时不显示
const
renderextra
=
()
=>
{
if
(
props
.
pageextra
&&
!
isString
(
props
.
pageextra
))
{
if
(
typeof
props
?.
pageextra
==
'function'
)
{
...
...
src/pages/device/account/index.jsx
View file @
7120c0d2
...
...
@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-01 1
5:05:17
* @Last Modified time: 2022-12-01 1
6:49:23
*/
import
*
as
React
from
'react'
;
...
...
src/pages/device/supplier/columns.js
View file @
7120c0d2
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
Switch
}
from
'antd'
;
import
fieldsDetail
from
'@/utils/fieldsDetail'
;
function
getcolumns
(
setdrawer
)
{
return
[
{
title
:
'供应商编号'
,
dataIndex
:
'supplierNo'
,
key
:
'supplierNo'
,
width
:
120
,
},
{
title
:
'供应商名称'
,
dataIndex
:
'supplierName'
,
key
:
'supplierName'
,
width
:
150
,
formItemProps
:
{
rules
:
[
{
...
...
@@ -65,7 +69,7 @@ function getcolumns(setdrawer) {
title
:
'地址'
,
dataIndex
:
'address'
,
key
:
'address'
,
width
:
3
0
0
,
width
:
3
2
0
,
formItemProps
:
{
rules
:
[
{
...
...
@@ -126,6 +130,7 @@ function getcolumns(setdrawer) {
title
:
'评分'
,
dataIndex
:
'score'
,
key
:
'score'
,
width
:
50
,
valueType
:
'rate'
,
fieldProps
:
{
defaultValue
:
1
,
...
...
src/pages/device/supplier/index.jsx
View file @
7120c0d2
...
...
@@ -2,17 +2,20 @@
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-1
1-23 15:43:57
* @Last Modified time: 2022-1
2-01 17:13:05
*/
import
*
as
React
from
'react'
;
import
{
useState
,
useMemo
,
useRef
}
from
'react'
;
import
{
useState
,
useMemo
,
use
Effect
,
use
Ref
}
from
'react'
;
import
DrawerPro
from
'@/components/DrawerPro'
;
import
AutoTable
from
'@/components/AutoTable'
;
import
PremButton
from
'@/components/PremButton'
;
import
getcolumns
from
'./columns'
;
import
InitForm
from
'@/components/InitForm'
;
import
ExtendField
from
'@/components/ExtendField'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
message
}
from
'antd'
;
import
{
Image
,
message
,
Divider
}
from
'antd'
;
import
{
ProDescriptions
}
from
'@ant-design/pro-components'
;
function
Supplier
(
props
)
{
const
actionRef
=
useRef
(),
...
...
@@ -29,29 +32,6 @@ function Supplier(props) {
detail_nocp
:
'/asset/equipmentSupplier/queryById'
,
};
const
detail
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
btn=
{
{
size
:
'small'
,
type
:
'link'
,
onClick
:
()
=>
{
setDrawer
((
s
)
=>
({
...
s
,
visible
:
true
,
item
:
row
,
title
:
'详情'
,
val
:
'detail'
,
title
:
row
.
userName
+
'的详细信息'
,
}));
},
}
}
>
详情
</
PremButton
>
);
};
const
edit
=
(
text
,
row
,
_
,
action
)
=>
{
return
(
<
PremButton
...
...
@@ -64,13 +44,27 @@ function Supplier(props) {
detailpath
:
urlParams
.
detail
,
params
:
{
id
:
row
?.
id
},
title
:
'编辑'
,
val
:
'edit'
,
val
:
'only'
,
type
:
'add'
,
onFinish
:
async
(
vals
)
=>
{
console
.
log
(
1
);
let
equipmentSupplierCharReqList
=
[];
console
.
log
(
'id:'
,
row
.
id
);
for
(
let
i
in
vals
)
{
if
(
!
isNaN
(
Number
(
i
)))
{
equipmentSupplierCharReqList
.
push
({
fieldId
:
i
,
fieldRealValue
:
vals
[
i
],
});
delete
vals
[
i
];
}
}
let
params
=
{
...
vals
,
id
:
row
.
id
,
id
:
row
?.
id
,
shopIdList
:
vals
.
shopId
,
equipmentSupplierCharReqList
,
};
delete
params
.
shopId
;
let
res
=
await
doFetch
({
url
:
urlParams
.
save
,
params
,
...
...
@@ -121,7 +115,189 @@ function Supplier(props) {
</
PremButton
>
);
};
const
Details
=
()
=>
{
const
columns
=
[
{
title
:
'供应商编号'
,
dataIndex
:
'supplierNo'
,
key
:
'supplierNo'
,
},
{
title
:
'供应商名称'
,
dataIndex
:
'supplierName'
,
key
:
'supplierName'
,
},
{
title
:
'公司官网'
,
dataIndex
:
'officialWebsite'
,
key
:
'officialWebsite'
},
{
title
:
'联系电话'
,
dataIndex
:
'telephone'
,
key
:
'telephone'
,
},
{
title
:
'公司邮箱'
,
dataIndex
:
'email'
,
key
:
'email'
,
},
{
title
:
'地址'
,
dataIndex
:
'address'
,
key
:
'address'
,
},
{
title
:
'状态'
,
dataIndex
:
'status'
,
key
:
'status'
,
},
{
title
:
'评分'
,
dataIndex
:
'score'
,
key
:
'score'
,
},
{
title
:
'备注'
,
dataIndex
:
'remark'
,
key
:
'remark'
,
},
];
const
[
newfieldscolumns
,
setnewfieldscolumns
]
=
useState
([]);
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
[
request
,
setrequest
]
=
useState
();
useEffect
(()
=>
{
const
fn
=
async
()
=>
{
let
res
=
await
doFetch
({
url
:
'/base/paFormField/queryList'
,
params
:
{
formId
:
'3'
,
},
});
if
(
res
?.
data
?.
dataList
)
{
let
column
=
[];
res
?.
data
?.
dataList
?.
forEach
((
el
)
=>
{
column
.
push
({
...
selectValueType
(
el
.
fieldChar
,
el
.
valueList
),
title
:
el
.
fieldName
,
dataIndex
:
el
.
id
,
key
:
el
.
id
,
});
});
setnewfieldscolumns
(
column
);
}
},
fn2
=
async
()
=>
{
const
res
=
await
doFetch
({
url
:
urlParams
.
detail
,
params
:
{
id
:
drawer
?.
item
?.
id
},
});
console
.
log
(
res
?.
data
?.
data
);
let
obj
=
{};
res
?.
data
?.
data
[
'equipmentSupplierCharReqList'
]?.
forEach
((
it
)
=>
{
obj
[
it
?.
fieldId
]
=
it
?.
fieldRealValue
;
});
console
.
log
(
'drawerpro:'
,
{
...(
res
?.
data
?.
data
??
{}),
...
obj
,
});
setrequest
(
{
...(
res
?.
data
?.
data
??
{}),
...
obj
,
}
??
{},
);
};
fn
();
fn2
();
},
[]);
return
(
<>
<
ProDescriptions
dataSource=
{
request
}
columns=
{
columns
}
/>
<
AutoTable
pagetitle=
"联系信息"
columns=
{
[
{
title
:
'联系人'
,
dataIndex
:
'userName'
,
key
:
'userName'
,
formItemProps
:
{
rules
:
[
{
required
:
true
,
message
:
'此项为必填项'
,
},
],
},
},
{
title
:
'手机号码'
,
dataIndex
:
'telephone'
,
key
:
'telephone'
,
formItemProps
:
{
rules
:
[
{
required
:
true
,
message
:
'此项为必填项'
,
},
],
},
},
{
title
:
'邮箱'
,
dataIndex
:
'email'
,
key
:
'email'
,
},
{
title
:
'职务'
,
dataIndex
:
'title'
,
key
:
'title'
,
fieldProps
:
{
placeholder
:
'请选择'
,
},
formItemProps
:
{
rules
:
[
{
required
:
false
,
message
:
'此项为必填项'
,
},
],
},
},
]
}
dataSource=
{
request
?.
supplierUserList
}
resizeable=
{
false
}
pagination=
{
false
}
/>
<
Divider
/>
<
h3
className=
"page-title"
style=
{
{
marginBottom
:
16
}
}
>
扩展字段
</
h3
>
<
ProDescriptions
dataSource=
{
request
}
columns=
{
newfieldscolumns
}
/>
</>
);
};
const
columns
=
useMemo
(()
=>
{
let
defcolumn
=
getcolumns
(
setDrawer
);
defcolumn
[
1
].
render
=
(
text
,
row
)
=>
{
...
...
@@ -131,11 +307,10 @@ function Supplier(props) {
setDrawer
((
s
)
=>
({
...
s
,
visible
:
true
,
title
:
'查看详情'
,
fields
:
columns
,
val
:
'detail'
,
detailpath
:
urlParams
.
detail
,
params
:
{
id
:
row
.
id
},
type
:
'detail'
,
item
:
row
,
val
:
'only'
,
title
:
row
.
supplierName
+
'的详细信息'
,
}));
}
}
>
...
...
@@ -151,6 +326,59 @@ function Supplier(props) {
});
},
[]);
const
selectMoreDrawerType
=
(
type
)
=>
{
switch
(
type
)
{
case
'detail'
:
return
<
Details
/>;
case
'add'
:
return
(
<
ExtendField
setDrawer=
{
setDrawer
}
drawer=
{
drawer
}
actionRef=
{
actionRef
}
columns=
{
columns
}
formId=
{
'3'
}
urlParams=
{
urlParams
}
onFinish=
{
async
(
vals
)
=>
{
let
equipmentSupplierCharReqList
=
[];
for
(
let
i
in
vals
)
{
if
(
!
isNaN
(
Number
(
i
)))
{
equipmentSupplierCharReqList
.
push
({
fieldId
:
i
,
fieldRealValue
:
vals
[
i
],
});
delete
vals
[
i
];
}
}
let
params
=
{
...
vals
,
id
:
drawer
?.
title
==
'编辑'
?
drawer
?.
item
?.
id
:
''
,
equipmentSupplierCharReqList
,
};
delete
params
.
shopId
;
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
;
}
};
return
(
<
div
style=
{
{
position
:
'relative'
}
}
>
<
AutoTable
...
...
@@ -174,24 +402,8 @@ function Supplier(props) {
},
title
:
'新增'
,
detailpath
:
null
,
val
:
'add'
,
onFinish
:
async
(
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
();
}
},
type
:
'add'
,
val
:
'only'
,
}));
},
},
...
...
@@ -211,7 +423,9 @@ function Supplier(props) {
actionRef
.
current
.
reload
();
}
}
{
...
drawer
}
/>
>
{
selectMoreDrawerType
(
drawer
?.
type
)
}
</
DrawerPro
>
</
div
>
);
}
...
...
src/pages/setting/users/index.jsx
View file @
7120c0d2
...
...
@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-12-01 1
1:13:59
* @Last Modified time: 2022-12-01 1
5:10:22
*/
import
*
as
React
from
'react'
;
...
...
@@ -136,112 +136,6 @@ function User(props) {
);
};
const
Adduser
=
()
=>
{
const
[
value
,
setValue
]
=
useState
(
''
);
const
[
fieldscolumns
,
setfieldscolumns
]
=
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
:
'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
.
fieldName
,
key
:
el
.
id
,
});
});
setfieldscolumns
(
fieldscolumns
.
concat
(
column
));
}
};
fn
();
},
[]);
return
(
<>
<
InitForm
extendField=
"userCharList"
detailpath=
{
urlParams
.
detail
}
params=
{
{
id
:
drawer
?.
item
?.
id
}
}
fields=
{
fieldscolumns
}
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
:
''
,
shopIdList
:
vals
.
shopId
,
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
();
}
}
}
/>
</>
);
};
const
columns
=
useMemo
(()
=>
{
let
defcolumn
=
getcolumns
(
setDrawer
);
return
defcolumn
.
concat
({
...
...
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