Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
admin-ci-test
Commits
bb0dc5ea
提交
bb0dc5ea
authored
7月 04, 2023
作者:
ZhangLingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:单位管理
上级
4cf79b1d
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
465 行增加
和
6 行删除
+465
-6
systemManageType.ts
src/api/interface/systemManageType.ts
+75
-6
systemManage.ts
src/api/modules/systemManage.ts
+24
-0
district.json
src/assets/json/district.json
+0
-0
index.tsx
...es/systemManage/companyManage/comp/addEditModal/index.tsx
+157
-0
index.tsx
src/pages/systemManage/companyManage/index.tsx
+198
-0
router.tsx
src/router/router.tsx
+11
-0
没有找到文件。
src/api/interface/systemManageType.ts
浏览文件 @
bb0dc5ea
...
@@ -79,18 +79,87 @@ export type updateBAccountType = InterFunction<
...
@@ -79,18 +79,87 @@ export type updateBAccountType = InterFunction<
// 账号-修改密码
// 账号-修改密码
export
type
updatePasswordType
=
InterFunction
<
export
type
updatePasswordType
=
InterFunction
<
{
{
accountNo
:
string
;
accountNo
?
:
string
;
accountStatus
:
number
;
accountStatus
?
:
number
;
alertPwd
:
number
;
alertPwd
?
:
number
;
cityCode
?:
number
;
cityCode
?:
number
;
districtCode
?:
number
;
districtCode
?:
number
;
email
?:
string
;
email
?:
string
;
id
?:
number
;
passWord
?:
number
;
phoneNum
?:
string
;
provinceCode
?:
number
;
remark
?:
string
;
userName
?:
string
;
},
NonNullable
<
unknown
>
>
;
// 单位-列表
export
type
listCompanyPage
=
InterListFunction
<
{
companyName
?:
string
},
{
address
:
string
;
city
:
string
;
companyName
:
string
;
companyType
:
number
;
companyUserName
:
string
;
district
:
string
;
fullName
:
string
;
id
:
number
;
id
:
number
;
passWord
:
number
;
phoneNum
:
string
;
phoneNum
:
string
;
provinceCode
?:
number
;
province
:
string
;
remark
:
string
;
}
>
;
// 单位-新增
export
type
listCompanyAdd
=
InterFunction
<
{
address
?:
string
;
city
?:
string
;
companyName
?:
string
;
companyType
?:
number
;
companyUserName
?:
string
;
district
?:
string
;
fullName
?:
string
;
id
?:
number
;
phoneNum
?:
number
;
province
?:
string
;
remark
?:
string
;
remark
?:
string
;
userName
:
string
;
area
?:
string
[];
},
NonNullable
<
unknown
>
>
;
// 单位-修改
export
type
listCompanyUpdate
=
InterFunction
<
{
address
?:
string
;
city
?:
string
;
companyName
?:
string
;
companyType
?:
number
;
companyUserName
?:
string
;
district
?:
string
;
fullName
?:
string
;
id
?:
number
;
phoneNum
?:
number
;
province
?:
string
;
remark
?:
string
;
area
?:
string
[];
},
NonNullable
<
unknown
>
>
;
// 单位-地域
export
type
getSecondDistrictInfo
=
InterFunction
<
NonNullable
<
unknown
>
,
{
childInfo
:
any
[];
id
:
number
;
name
:
string
;
}[]
>
;
// 单位-删除
export
type
listCompanyRemove
=
InterFunction
<
{
id
:
number
;
},
},
NonNullable
<
unknown
>
NonNullable
<
unknown
>
>
;
>
;
src/api/modules/systemManage.ts
浏览文件 @
bb0dc5ea
import
{
import
{
getSecondDistrictInfo
,
insertBAccountType
,
insertBAccountType
,
listBAccountPageType
,
listBAccountPageType
,
listCompanyAdd
,
listCompanyPage
,
listCompanyRemove
,
listCompanyUpdate
,
removeBAccountType
,
removeBAccountType
,
updateBAccountType
,
updateBAccountType
,
updatePasswordType
,
updatePasswordType
,
...
@@ -27,4 +32,23 @@ export class SystemManageAPI {
...
@@ -27,4 +32,23 @@ export class SystemManageAPI {
// 账号-修改密码
// 账号-修改密码
static
updatePassword
:
updatePasswordType
=
(
params
)
=>
static
updatePassword
:
updatePasswordType
=
(
params
)
=>
axios
.
post
(
'/userapp/back-user/updatePassword'
,
params
);
axios
.
post
(
'/userapp/back-user/updatePassword'
,
params
);
// 单位-列表
static
listCompanyPage
:
listCompanyPage
=
(
params
)
=>
axios
.
post
(
'/userapp/company/listCompanyPage'
,
params
);
// 单位-新增
static
listCompanyAdd
:
listCompanyAdd
=
(
params
)
=>
axios
.
post
(
'/userapp/company/add'
,
params
);
// 单位-修改
static
listCompanyUpdate
:
listCompanyUpdate
=
(
params
)
=>
axios
.
post
(
'/userapp/company/update'
,
params
);
// 单位-删除
static
listCompanyRemove
:
listCompanyRemove
=
(
params
)
=>
axios
.
get
(
'/userapp/company/remove'
,
{
params
});
// 单位-区域
static
getSecondDistrictInfo
:
getSecondDistrictInfo
=
(
params
)
=>
axios
.
get
(
'/pms/webDevice/getSecondDistrictInfo'
,
{
params
});
}
}
src/assets/json/district.json
0 → 100644
浏览文件 @
bb0dc5ea
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/pages/systemManage/companyManage/comp/addEditModal/index.tsx
0 → 100644
浏览文件 @
bb0dc5ea
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
InterListType
,
InterReqType
}
from
'~/api/interface'
;
import
{
listCompanyAdd
,
listCompanyPage
}
from
'~/api/interface/systemManageType'
;
import
{
Cascader
,
Form
,
Input
,
message
,
Modal
}
from
'antd'
;
import
{
SystemManageAPI
}
from
'~/api'
;
import
DistrictData
from
'~/assets/json/district.json'
;
// 列表的类型
type
TableType
=
InterListType
<
listCompanyPage
>
;
// 请求的表单类型
type
ReqType
=
InterReqType
<
listCompanyAdd
>
;
// 传参类型
interface
propType
{
title
:
string
;
open
:
boolean
;
closed
:
any
;
data
?:
TableType
[
0
];
}
const
AddEditModal
:
React
.
FC
<
propType
>
=
(
props
)
=>
{
// 参数
const
{
title
,
open
,
closed
,
data
}
=
props
;
/// 表单钩子
const
[
form
]
=
Form
.
useForm
<
ReqType
>
();
// 地区
const
[
localList
,
setLocalList
]
=
useState
<
{
childInfo
:
any
[];
id
:
number
;
name
:
string
;
}[]
>
();
// 关闭弹窗
const
handleCancel
=
()
=>
{
form
.
resetFields
();
closed
();
};
// 确认事件
const
handleOk
=
()
=>
{
form
.
validateFields
()
.
then
(
async
(
values
)
=>
{
await
handleSubmit
({
...
values
,
province
:
values
?.
area
?.
at
(
0
),
city
:
values
?.
area
?.
at
(
1
),
district
:
values
?.
area
?.
at
(
2
),
});
})
.
catch
((
err
)
=>
{
message
.
warning
({
content
:
err
.
errorFields
[
0
].
errors
[
0
],
})
.
then
();
});
};
// 提交事件
const
handleSubmit
=
async
(
values
:
ReqType
)
=>
{
const
res
=
await
SystemManageAPI
[
data
?.
id
?
'listCompanyUpdate'
:
'listCompanyAdd'
]({
...
values
,
id
:
Number
(
data
?.
id
),
});
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
);
handleCancel
();
}
};
// 获取地区信息
const
getSecondDistrictInfo
=
async
()
=>
{
setLocalList
(
DistrictData
||
[]);
};
// componentDidMount
useEffect
(()
=>
{
if
(
!
open
)
return
;
getSecondDistrictInfo
().
then
();
if
(
!
data
)
return
;
form
.
setFieldsValue
({
...
data
,
area
:
[
data
?.
province
,
data
?.
city
,
data
?.
district
],
});
// console.log('data --->', data);
},
[
open
]);
return
(
<
Modal
open=
{
open
}
title=
{
title
}
onCancel=
{
handleCancel
}
onOk=
{
handleOk
}
destroyOnClose
width=
{
450
}
>
<
Form
name=
'addForm'
form=
{
form
}
labelAlign=
'right'
labelCol=
{
{
span
:
4
}
}
>
<
Form
.
Item
label=
'单位名称'
rules=
{
[{
required
:
true
,
message
:
'请输入单位名称'
}]
}
name=
'companyName'
>
<
Input
placeholder=
{
'请输入单位名称'
}
maxLength=
{
25
}
allowClear
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'单位全称'
rules=
{
[{
required
:
false
,
message
:
'请输入单位全称'
}]
}
name=
'fullName'
>
<
Input
placeholder=
{
'请输入单位全称'
}
maxLength=
{
50
}
allowClear
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'行政区划'
name=
'area'
rules=
{
[{
required
:
true
,
message
:
'请选择行政区划'
}]
}
>
<
Cascader
options=
{
localList
}
placeholder=
'请选择行政区划'
allowClear
fieldNames=
{
{
label
:
'name'
,
value
:
'name'
,
children
:
'childInfo'
,
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'详细地址'
name=
'address'
rules=
{
[{
required
:
true
,
message
:
'请输入详细地址'
}]
}
>
<
Input
.
TextArea
placeholder=
'请输入详细地址'
maxLength=
{
70
}
showCount
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'联系人'
name=
'companyUserName'
>
<
Input
placeholder=
'请输入联系人'
maxLength=
{
15
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'联系方式'
name=
'phoneNum'
rules=
{
[
()
=>
({
validator
(
_
,
value
)
{
if
(
!
value
||
/^1
[
3-9
]\d
{9}$/
.
test
(
value
))
{
return
Promise
.
resolve
();
}
return
Promise
.
reject
(
'请输入正确的手机号'
);
},
}),
]
}
>
<
Input
placeholder=
'请输入联系方式'
maxLength=
{
11
}
type=
{
'number'
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'备注'
name=
'remark'
>
<
Input
.
TextArea
placeholder=
'请输入备注'
maxLength=
{
70
}
showCount
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
);
};
export
default
AddEditModal
;
src/pages/systemManage/companyManage/index.tsx
0 → 100644
浏览文件 @
bb0dc5ea
import
{
useState
,
useEffect
}
from
'react'
;
import
SearchBox
from
'~/components/search-box'
;
import
{
Button
,
message
,
Modal
,
Table
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
InterListType
,
InterReqType
}
from
'~/api/interface'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
SystemManageAPI
}
from
'~/api'
;
import
{
listCompanyPage
}
from
'~/api/interface/systemManageType'
;
import
AddEditModal
from
'./comp/addEditModal'
;
// 列表的数据类型
type
TableType
=
InterListType
<
listCompanyPage
>
;
// 请求数据的类型
type
ReqType
=
InterReqType
<
listCompanyPage
>
;
// 搜索表单的数据
let
query
:
ReqType
=
{};
const
CompanyManageView
=
()
=>
{
const
{
confirm
}
=
Modal
;
// 新增编辑弹窗是否开启
const
[
addEditModalVisible
,
setAddEditModalVisible
]
=
useState
(
false
);
// 需要编辑的数据
const
[
editData
,
setEditData
]
=
useState
<
TableType
[
0
]
>
();
// 表格数据
const
[
tableData
,
setTableData
]
=
useState
<
TableType
>
([]);
// 表格分页配置
const
[
pagination
,
setPagination
]
=
useState
({
total
:
0
,
pageSize
:
10
,
current
:
1
,
totalPage
:
0
,
});
// 加载列表
const
getTableList
=
async
(
value
=
{})
=>
{
// 只需要修改这个地方的接口即可
const
res
=
await
SystemManageAPI
.
listCompanyPage
({
pageNo
:
pagination
.
current
,
pageSize
:
pagination
.
pageSize
,
...
value
,
...
query
,
});
if
(
res
&&
res
.
code
===
'200'
)
{
const
{
list
,
pageNo
,
totalCount
,
pageSize
,
totalPage
}
=
res
.
result
;
// 解构
setPagination
({
total
:
totalCount
,
current
:
pageNo
,
pageSize
,
totalPage
,
});
setTableData
(
list
);
}
};
// 翻页
const
paginationChange
=
(
pageNo
:
number
,
pageSize
:
number
)
=>
{
getTableList
({
pageNo
,
pageSize
}).
then
();
};
// 表单提交
const
onFinish
=
(
data
:
ReqType
)
=>
{
pagination
.
current
=
1
;
query
=
data
;
getTableList
(
data
).
then
();
};
// 删除单位
const
handleDelete
=
(
value
:
TableType
[
0
])
=>
{
confirm
({
title
:
'提示'
,
content
:
'是否删除该单位?'
,
onOk
:
async
()
=>
{
const
res
=
await
SystemManageAPI
.
listCompanyRemove
({
id
:
value
.
id
});
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'删除成功'
);
paginationChange
(
tableData
.
length
===
1
?
pagination
.
current
-
1
:
pagination
.
current
,
pagination
.
pageSize
,
);
}
},
});
};
// componentDidMount
useEffect
(()
=>
{
query
=
{};
getTableList
().
then
();
},
[]);
// 表格结构
const
columns
:
ColumnsType
<
TableType
[
0
]
>
=
[
{
title
:
'单位名称'
,
dataIndex
:
'companyName'
,
align
:
'center'
,
width
:
'150px'
,
fixed
:
'left'
,
ellipsis
:
true
,
},
{
title
:
'行政区划'
,
dataIndex
:
'province'
,
align
:
'center'
,
render
:
(
_value
,
record
)
=>
`
${
record
.
province
}
/
${
record
.
city
}
/
${
record
.
district
}
`
,
},
{
title
:
'详细地址'
,
dataIndex
:
'address'
,
align
:
'center'
,
width
:
'250px'
,
ellipsis
:
true
,
},
{
title
:
'联系人'
,
dataIndex
:
'companyUserName'
,
align
:
'center'
,
},
{
title
:
'联系电话'
,
dataIndex
:
'phoneNum'
,
align
:
'center'
,
},
{
title
:
'操作'
,
width
:
'100px'
,
fixed
:
'right'
,
align
:
'center'
,
render
:
(
_text
,
record
)
=>
(
<>
<
Button
type=
'link'
onClick=
{
()
=>
{
setEditData
(
JSON
.
parse
(
JSON
.
stringify
(
record
)));
setAddEditModalVisible
(
true
);
}
}
>
变更
</
Button
>
<
Button
type=
'link'
danger
onClick=
{
()
=>
handleDelete
(
record
)
}
>
删除
</
Button
>
</>
),
},
];
return
(
<>
<
SearchBox
search=
{
[
{
label
:
'单位名称'
,
name
:
'companyName'
,
type
:
'input'
,
placeholder
:
'请输入单位名称'
,
},
]
}
searchData=
{
onFinish
}
child=
{
<>
<
Button
type=
{
'primary'
}
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
{
setAddEditModalVisible
(
true
);
}
}
>
新增单位
</
Button
>
</>
}
/>
<
Table
size=
'small'
dataSource=
{
tableData
}
columns=
{
columns
}
rowKey=
'id'
// scroll={{ x: 1500 }}
bordered
pagination=
{
{
total
:
pagination
.
total
,
pageSize
:
pagination
.
pageSize
,
current
:
pagination
.
current
,
showSizeChanger
:
true
,
showQuickJumper
:
true
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
}
}
/>
<
AddEditModal
open=
{
addEditModalVisible
}
title=
{
editData
?
'变更单位'
:
'新增单位'
}
data=
{
editData
}
closed=
{
()
=>
{
setAddEditModalVisible
(
false
);
setEditData
(
undefined
);
paginationChange
(
pagination
.
current
,
pagination
.
pageSize
);
}
}
/>
</>
);
};
export
default
CompanyManageView
;
src/router/router.tsx
浏览文件 @
bb0dc5ea
...
@@ -32,6 +32,7 @@ import {
...
@@ -32,6 +32,7 @@ import {
PaperClipOutlined
,
PaperClipOutlined
,
ReadOutlined
,
ReadOutlined
,
ThunderboltOutlined
,
ThunderboltOutlined
,
BankOutlined
,
}
from
'@ant-design/icons'
;
}
from
'@ant-design/icons'
;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// @ts-ignore
...
@@ -107,6 +108,7 @@ import TenderManageDetail from '~/pages/resourceManage/tenderManage/detail';
...
@@ -107,6 +108,7 @@ import TenderManageDetail from '~/pages/resourceManage/tenderManage/detail';
import
TenderManageFeedback
from
'~/pages/resourceManage/tenderManage/feedback'
;
import
TenderManageFeedback
from
'~/pages/resourceManage/tenderManage/feedback'
;
import
BusinessCaseManage
from
'~/pages/resourceManage/businessCaseManage'
;
import
BusinessCaseManage
from
'~/pages/resourceManage/businessCaseManage'
;
import
CustomIdentityView
from
'~/pages/customManage/customIdentity'
;
import
CustomIdentityView
from
'~/pages/customManage/customIdentity'
;
import
CompanyManageView
from
'~/pages/systemManage/companyManage'
;
// const IndustryListView = React.lazy(() => import('~/pages/mallManage/industryManage/industryList')); //行业列表
// const IndustryListView = React.lazy(() => import('~/pages/mallManage/industryManage/industryList')); //行业列表
// const IndustryDetailView = React.lazy(
// const IndustryDetailView = React.lazy(
...
@@ -846,6 +848,15 @@ export const routerList: Array<RouteObjectType> = [
...
@@ -846,6 +848,15 @@ export const routerList: Array<RouteObjectType> = [
icon
:
<
UserOutlined
/>,
icon
:
<
UserOutlined
/>,
},
},
},
},
{
path
:
'/systemManage/companyManage'
,
element
:
withLoadingComponent
(<
CompanyManageView
/>),
meta
:
{
id
:
28200
,
title
:
'单位管理'
,
icon
:
<
BankOutlined
/>,
},
},
],
],
},
},
];
];
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论