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
124df178
Commit
124df178
authored
Nov 29, 2022
by
TZW
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1129
parent
7f8afc0d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
221 additions
and
92 deletions
+221
-92
index.jsx
src/components/ExtendField/index.jsx
+71
-0
index.jsx
src/components/InitForm/index.jsx
+14
-0
index.jsx
src/pages/setting/users/index.jsx
+119
-89
columns.js
src/pages/system/rules/columns.js
+15
-1
index.jsx
src/pages/system/rules/index.jsx
+2
-2
No files found.
src/components/ExtendField/index.jsx
0 → 100644
View file @
124df178
/* 扩展字段内容
* @Author: Li Hanlin
* @Date: 2022-11-29 14:03:07
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-29 16:28:29
*/
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
{
useRequest
}
from
'ahooks'
;
import
{
useState
,
useEffect
}
from
'react'
;
import
InitForm
from
'../InitForm'
;
export
default
({
formId
})
=>
{
const
[
columns
,
setcolumns
]
=
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
;
}
};
useEffect
(()
=>
{
const
fn
=
async
()
=>
{
let
res
=
await
doFetch
({
url
:
'/base/paFormField/queryList'
,
params
:
{
formId
,
},
});
if
(
res
?.
data
?.
dataList
)
{
let
column
=
[];
res
?.
data
?.
dataList
?.
forEach
((
el
)
=>
{
column
.
push
({
...
selectValueType
(
el
.
fieldChar
,
el
.
valueType
),
title
:
el
.
fieldName
,
dataIndex
:
'title'
,
key
:
el
.
id
,
});
});
console
.
log
(
'11111'
,
column
);
setcolumns
(
column
);
}
};
fn
();
},
[]);
return
(
<>
<
InitForm
fields=
{
columns
}
/>
</>
);
};
src/components/InitForm/index.jsx
View file @
124df178
...
...
@@ -12,6 +12,7 @@ import moment from 'moment';
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
styles
from
'./index.less'
;
import
FormItems
from
'./FormItems'
;
import
ExtendField
from
'@/components/ExtendField'
;
function
upperCase
(
str
)
{
const
newStr
=
str
.
slice
(
0
,
1
).
toUpperCase
()
+
str
.
slice
(
1
);
...
...
@@ -93,6 +94,7 @@ function InitForm({
defaultFormValue
=
{},
submitter
,
fields
,
extendField
=
''
,
colProps
=
{
xs
:
24
,
sm
:
24
,
md
:
12
,
lg
:
12
,
xl
:
12
,
xxl
:
12
},
})
{
let
proformRef
=
useRef
();
...
...
@@ -117,6 +119,18 @@ function InitForm({
...(
res
?.
data
?.
data
??
{}),
...
defaultFormValue
,
});
if
(
extendField
)
{
let
obj
=
{};
res
?.
data
?.
data
[
extendField
]?.
forEach
((
it
)
=>
{
obj
[
it
?.
fieldId
]
=
it
?.
fieldRealValue
;
});
console
.
log
(
'extendField:'
,
obj
);
return
{
...(
res
?.
data
?.
data
??
{}),
...
obj
,
...
defaultFormValue
,
};
}
return
{
...(
res
?.
data
?.
data
??
{}),
...
defaultFormValue
,
...
...
src/pages/setting/users/index.jsx
View file @
124df178
...
...
@@ -2,11 +2,11 @@
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-2
4 15:02:31
* @Last Modified time: 2022-11-2
9 18:04:45
*/
import
*
as
React
from
'react'
;
import
{
useState
,
useMemo
,
useRef
,
useCallback
}
from
'react'
;
import
{
useState
,
useMemo
,
useRef
,
use
Effect
,
use
Callback
}
from
'react'
;
import
DrawerPro
from
'@/components/DrawerPro'
;
import
AutoTable
from
'@/components/AutoTable'
;
import
PremButton
from
'@/components/PremButton'
;
...
...
@@ -61,11 +61,10 @@ function User(props) {
setDrawer
((
s
)
=>
({
...
s
,
visible
:
true
,
// item: row,
detailpath
:
urlParams
.
detail
,
params
:
{
id
:
row
.
id
},
item
:
row
,
type
:
'add'
,
title
:
'编辑'
,
val
:
'
edit
'
,
val
:
'
only
'
,
onFinish
:
async
(
vals
)
=>
{
console
.
log
(
1
);
let
params
=
{
...
...
@@ -123,55 +122,115 @@ function User(props) {
);
};
// const Adduser = () => {
// const [value, setValue] = useState('');
// const [options, setOptions] = useState([]);
// const debounce = lodash.debounce;
// const serchHandle = useCallback(
// debounce(async (val) => {
// console.log(val + '!!');
// if (val) {
// let res = await doFetch({
// url: '/auth/sysUser/queryLikeIotUsername',
// params: { username: val },
// });
// console.log(res);
// }
// }, 800),
// [],
// );
// const onSearch = (val) => {
// serchHandle(val);
// };
// const onSelect = (data) => {
// console.log('onSelect', data);
// };
// const onChange = (data) => {
// setValue(data);
// };
// return (
// <>
// <div style={{ marginBottom: 22 }}>
// <div style={{ marginBottom: 8 }}>用户名</div>
// <AutoComplete
// options={options}
// style={{
// width: '50%',
// }}
// onSelect={onSelect}
// onSearch={onSearch}
// placeholder="请输入用户名"
// />
// </div>
// <InitForm
// fields={columns}
// onFinish={() => {
// console.log(1);
// }}
// />
// </>
// );
// };
const
Adduser
=
()
=>
{
const
[
value
,
setValue
]
=
useState
(
''
);
const
[
options
,
setOptions
]
=
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
.
valueType
),
title
:
el
.
fieldName
,
dataIndex
:
el
.
fieldName
,
key
:
el
.
id
,
});
});
console
.
log
(
'11111'
,
column
);
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
,
factoryIdList
:
vals
.
factoryNames
,
shopIdList
:
vals
.
shopId
,
sectionIdList
:
vals
.
sectionId
,
productionLineIdList
:
vals
.
productLineName
,
roleIdList
:
vals
.
roleNames
,
userCharReqList
,
};
delete
params
.
factoryNames
;
delete
params
.
shopId
;
delete
params
.
sectionId
;
delete
params
.
productLineName
;
delete
params
.
roleNames
;
console
.
log
(
params
,
'!!!!'
);
let
res
=
await
doFetch
({
url
:
urlParams
.
save
,
params
,
});
if
(
res
.
code
===
'0000'
)
{
message
.
success
(
'新增成功!'
);
setDrawer
((
s
)
=>
({
...
s
,
visible
:
false
,
}));
actionRef
.
current
.
reload
();
}
}
}
/>
</>
);
};
const
columns
=
useMemo
(()
=>
{
let
defcolumn
=
getcolumns
(
setDrawer
);
...
...
@@ -204,40 +263,11 @@ function User(props) {
item
:
{
status
:
1
,
},
detailpath
:
null
,
detailpath
:
''
,
params
:
{},
title
:
'新增'
,
// type: 'add',
val
:
'add'
,
onFinish
:
async
(
vals
)
=>
{
console
.
log
(
vals
);
let
params
=
{
...
vals
,
factoryIdList
:
vals
.
factoryNames
,
shopIdList
:
vals
.
shopId
,
sectionIdList
:
vals
.
sectionId
,
productionLineIdList
:
vals
.
productLineName
,
roleIdList
:
vals
.
roleNames
,
userCharReqList
:
[],
};
delete
params
.
factoryNames
;
delete
params
.
shopId
;
delete
params
.
sectionId
;
delete
params
.
productLineName
;
delete
params
.
roleNames
;
console
.
log
(
params
,
'!!!!'
);
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'
,
}));
},
},
...
...
@@ -259,7 +289,7 @@ function User(props) {
}
}
{
...
drawer
}
>
{
/* {drawer?.type == 'add' ? <Adduser /> : null} */
}
{
drawer
?.
type
==
'add'
?
<
Adduser
/>
:
null
}
</
DrawerPro
>
</
div
>
);
...
...
src/pages/system/rules/columns.js
View file @
124df178
function
getcolumns
(
setdrawer
)
{
return
[
{
title
:
'单号类型'
,
dataIndex
:
'noTypeName'
,
key
:
'noTypeId'
},
{
title
:
'单号类型'
,
dataIndex
:
'noTypeName'
,
key
:
'noTypeId'
,
valueType
:
'select'
,
options
:
{
path
:
'/base/bmNoType/queryAllSelect'
,
params
:
{}
},
formItemProps
:
{
rules
:
[
{
required
:
false
,
message
:
'此项为必填项'
,
},
],
},
},
{
title
:
'预览'
,
dataIndex
:
'ruleNames'
,
...
...
src/pages/system/rules/index.jsx
View file @
124df178
...
...
@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2022-11-2
8 17:56:41
* @Last Modified time: 2022-11-2
9 10:02:24
*/
import
*
as
React
from
'react'
;
...
...
@@ -33,7 +33,6 @@ function Rules(props) {
<
PremButton
btn=
{
{
size
:
'small'
,
type
:
'link'
,
onClick
:
()
=>
{
setDrawer
((
s
)
=>
({
...
s
,
...
...
@@ -135,6 +134,7 @@ function Rules(props) {
<
AutoTable
pagetitle=
{
<
h3
className=
"page-title"
>
编号规则
</
h3
>
}
columns=
{
columns
}
pagination=
{
false
}
path=
{
urlParams
.
list
}
actionRef=
{
actionRef
}
pageextra=
{
'add'
}
...
...
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