|
|
@@ -163,15 +163,15 @@ export const usermanagementsList = () => {
|
|
|
const fetchUserList = async () => {
|
|
|
setLoading(true);
|
|
|
try {
|
|
|
- const response = await dataProvider.getList('users', {
|
|
|
+ const response = await dataProvider.getList('usermanagements', {
|
|
|
+ pagination: { page: 1, perPage: 9999 },
|
|
|
filter: {}
|
|
|
});
|
|
|
|
|
|
const formattedData = response.data.map((user: any) => ({
|
|
|
userId: user.userId || '',
|
|
|
password: user.password || '',
|
|
|
- userName: user.userName || '',
|
|
|
- id: user.id || user.userId
|
|
|
+ userNm: user.userNm || '',
|
|
|
}));
|
|
|
|
|
|
setRowData(formattedData);
|
|
|
@@ -200,7 +200,7 @@ export const usermanagementsList = () => {
|
|
|
setIsEditing(false);
|
|
|
setEditingData({
|
|
|
userId: '',
|
|
|
- userName: '',
|
|
|
+ userNm: '',
|
|
|
password: ''
|
|
|
});
|
|
|
};
|
|
|
@@ -209,11 +209,11 @@ export const usermanagementsList = () => {
|
|
|
const handleDelete = async (data: any) => {
|
|
|
if (isDeleting) return;
|
|
|
|
|
|
- if (window.confirm(`确定要删除用户 ${data.userName} (${data.userId}) 吗?`)) {
|
|
|
+ if (window.confirm(`确定要删除用户 ${data.userNm} (${data.userId}) 吗?`)) {
|
|
|
setIsDeleting(true);
|
|
|
try {
|
|
|
- await dataProvider.delete('users', {
|
|
|
- id: data.id || data.userId,
|
|
|
+ await dataProvider.delete('usermanagements', {
|
|
|
+ id: data.userId,
|
|
|
previousData: data
|
|
|
});
|
|
|
setRowData(prev => prev.filter(row => row.userId !== data.userId));
|
|
|
@@ -247,7 +247,7 @@ export const usermanagementsList = () => {
|
|
|
const updateParams = {
|
|
|
...originalUser,
|
|
|
...editingData,
|
|
|
- id: originalUser.id || originalUser.userId
|
|
|
+ id: originalUser.userId
|
|
|
};
|
|
|
|
|
|
await dataProvider.update('usermanagements', {
|
|
|
@@ -268,26 +268,26 @@ export const usermanagementsList = () => {
|
|
|
// 保存新增用户
|
|
|
const handleAddSave = async () => {
|
|
|
try {
|
|
|
- if (!editingData.userId || !editingData.userName || !editingData.password) {
|
|
|
+
|
|
|
+ if (!editingData.userId || !editingData.userNm || !editingData.password) {
|
|
|
alert("ユーザID、ユーザ名及びパスワードは必須です");
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ // 验证ユーザID是否为正整数
|
|
|
+ if (!/^\d+$/.test(editingData.userId) || parseInt(editingData.userId) <= 0) {
|
|
|
+ alert("ユーザIDは正の整数で入力してください");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
const newUser = {
|
|
|
...editingData,
|
|
|
- nickName: editingData.userName,
|
|
|
- userType: '0',
|
|
|
- email: '',
|
|
|
- phonenumber: '',
|
|
|
- sex: '0',
|
|
|
- avatar: '',
|
|
|
- status: '0',
|
|
|
- delFlag: '0',
|
|
|
- loginIp: '',
|
|
|
- createBy: '',
|
|
|
- updateBy: '',
|
|
|
- remark: '',
|
|
|
- id: editingData.userId
|
|
|
+ haisiFlg: '0',
|
|
|
+ haisiDt: '',
|
|
|
+ insSyainCd: '',
|
|
|
+ insPgId: '',
|
|
|
+ updSyainCd: '',
|
|
|
+ updPgId: '',
|
|
|
};
|
|
|
|
|
|
await dataProvider.create('usermanagements', {
|
|
|
@@ -303,6 +303,12 @@ export const usermanagementsList = () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ // 处理ユーザID输入变化,只允许输入数字
|
|
|
+ const handleUserIdChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
|
+ const value = e.target.value.replace(/\D/g, '');
|
|
|
+ setEditingData({...editingData, userId: value});
|
|
|
+ };
|
|
|
+
|
|
|
// 表格列定义
|
|
|
const columnDefs: ColDef[] = [
|
|
|
{
|
|
|
@@ -316,7 +322,7 @@ export const usermanagementsList = () => {
|
|
|
minWidth: 100,
|
|
|
},
|
|
|
{
|
|
|
- field: "userName",
|
|
|
+ field: "userNm",
|
|
|
headerClass: "header-center",
|
|
|
headerName: "ユーザ名",
|
|
|
cellRenderer: (params: ICellRendererParams) => (
|
|
|
@@ -381,14 +387,15 @@ export const usermanagementsList = () => {
|
|
|
type="text"
|
|
|
value={editingData.userId || ''}
|
|
|
onChange={(e) => setEditingData({...editingData, userId: e.target.value})}
|
|
|
- disabled={!!editingData.userId}
|
|
|
+ disabled
|
|
|
/>
|
|
|
<br/>
|
|
|
<label>ユーザ名</label>
|
|
|
<input
|
|
|
type="text"
|
|
|
- value={editingData.userName || ''}
|
|
|
- onChange={(e) => setEditingData({...editingData, userName: e.target.value})}
|
|
|
+ value={editingData.userNm || ''}
|
|
|
+ onChange={(e) => setEditingData({...editingData, userNm: e.target.value})}
|
|
|
+ maxLength={50}
|
|
|
/>
|
|
|
<br/>
|
|
|
<label>パスワード</label>
|
|
|
@@ -396,6 +403,7 @@ export const usermanagementsList = () => {
|
|
|
type="password"
|
|
|
value={editingData.password || ''}
|
|
|
onChange={(e) => setEditingData({...editingData, password: e.target.value})}
|
|
|
+ maxLength={8}
|
|
|
/>
|
|
|
<button className="issue-button" style={{ marginLeft: '30px' }}>発行</button>
|
|
|
<div className="user-edit-buttons">
|
|
|
@@ -413,16 +421,18 @@ export const usermanagementsList = () => {
|
|
|
<input
|
|
|
type="text"
|
|
|
value={editingData.userId || ''}
|
|
|
- onChange={(e) => setEditingData({...editingData, userId: e.target.value})}
|
|
|
+ onChange={handleUserIdChange}
|
|
|
placeholder=""
|
|
|
+ maxLength={6}
|
|
|
/>
|
|
|
<br/>
|
|
|
<label>ユーザ名</label>
|
|
|
<input
|
|
|
type="text"
|
|
|
- value={editingData.userName || ''}
|
|
|
- onChange={(e) => setEditingData({...editingData, userName: e.target.value})}
|
|
|
+ value={editingData.userNm || ''}
|
|
|
+ onChange={(e) => setEditingData({...editingData, userNm: e.target.value})}
|
|
|
placeholder=""
|
|
|
+ maxLength={50}
|
|
|
/>
|
|
|
<br/>
|
|
|
<label>パスワード</label>
|
|
|
@@ -431,6 +441,7 @@ export const usermanagementsList = () => {
|
|
|
value={editingData.password || ''}
|
|
|
onChange={(e) => setEditingData({...editingData, password: e.target.value})}
|
|
|
placeholder=""
|
|
|
+ maxLength={8}
|
|
|
/>
|
|
|
<button className="issue-button" style={{ marginLeft: '30px' }}>発行</button>
|
|
|
<div className="user-edit-buttons">
|