Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
构建镜像

```bash
docker build -t material:1.0.5 .
docker build -t material:1.0.6 .
```

保存镜像
```bash
docker save material:1.0.5 -o material105.tar
docker save material:1.0.6 -o material106.tar
```
加载镜像
```bash
docker load -i material105.tar
docker load -i material106.tar
```

启动容器
Expand Down
3 changes: 1 addition & 2 deletions backend/app/api/v1/admin/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def create_user(
user_obj = await user_controller.create(obj_in=item)
await user_obj.roles.add(role_obj)
except Exception as e:
logger.error(f"用户 {item.nickname} 已存在")
logger.error(f"用户添加失败:{e}")
continue
return Success(msg="创建成功!")

Expand Down Expand Up @@ -116,4 +116,3 @@ async def reset_pwd(
user.password = get_password_hash(data["newPwd"])
await user.save()
return Success(msg="Reset Successfully")

7 changes: 4 additions & 3 deletions backend/app/api/v1/material/borrowed.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ async def create_borrowed(data: CreateBorrowedInfo):
item["userDepart"] = data.depart
item["uuid"] = data.uuid
user = await user_controller.get_by_uuid(item["uuid"])
item["phone"] = user.mobile
if not (len(item["phone"]) > 0):
item["phone"] = user.mobile
item["reason"] = data.reason
item["material_id"] = material.id
obj: Borrowed = await borrowedController.create(obj_in=item)
Expand Down Expand Up @@ -70,10 +71,10 @@ async def get_home_list(
material = await obj.material.all().values("name", "model", "position", "number", "borrowed")
obj_dict = await obj.to_dict()
if obj.borrowApproveStatus:
borrowApproveUser = await obj.borrowApproveUser.all().values("id", "nickname", "mobile", "department")
borrowApproveUser = await obj.borrowApproveUser.all().values("id", "nickname", "employeeID", "mobile", "department")
obj_dict["borrowApproveUser"] = borrowApproveUser
if obj.returnApproveStatus:
returnApproveUser = await obj.returnApproveUser.all().values("id", "nickname", "mobile", "department")
returnApproveUser = await obj.returnApproveUser.all().values("id", "nickname", "employeeID", "mobile", "department")
obj_dict["returnApproveUser"] = returnApproveUser
obj_dict["material"] = material
data.append(obj_dict)
Expand Down
4 changes: 2 additions & 2 deletions backend/app/api/v1/material/checked.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def get_checked(
data = []
for obj in checked_objs:
user = await obj.toCheckUser.all()
userDepart = user.department
userDepart = user.company + user.department
material = await obj.material.all()
material_dict = await material.to_dict()
user_dict = await user.to_dict()
Expand All @@ -57,7 +57,7 @@ async def get_checked(
obj_dict["toCheckUser"] = user_dict
try:
user2 = await obj.toReturnUser.all()
user2Depart = user2.department
user2Depart = user2.company + user2.department
user_dict2 = await user2.to_dict()
obj_dict["toReturnUser"] = user_dict2
user_dict2["depart"] = user2Depart
Expand Down
2 changes: 1 addition & 1 deletion backend/app/core/init_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def tortoise_init(app: FastAPI):
await init_api(app)
await init_menus()
await init_roles()
await register_superAdmin()
# await register_superAdmin()


async def register_superAdmin():
Expand Down
10 changes: 9 additions & 1 deletion backend/app/schemas/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class UpdateStatus(BaseModel):
status: int = Field(description="状态")



class UserLdap(BaseModel):
sAMAccountName: str = Field(description="邮箱前缀")
employeeID: str = Field(description="工号")
Expand All @@ -47,6 +46,15 @@ class UserLdap(BaseModel):
name: str = Field(description="姓名")
dn: str = Field(description="DN")

class UserLdapCreate(BaseModel):
username: str
nickname: str
email: str
mobile: str
employeeID: str
department: str
company: str


if __name__ == '__main__':
pass
26 changes: 9 additions & 17 deletions backend/app/utils/cnnp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from ldap3 import Server, Connection, ALL, SUBTREE

from app.utils.log import logger
from app.schemas.users import UserLdap, UserCreate
from app.schemas.users import UserLdap, UserLdapCreate
from app.settings import settings


Expand Down Expand Up @@ -35,13 +35,13 @@ def get_user_info(self, username: str) -> UserLdap:
raise HTTPException(status_code=400, detail="用户不存在")
else:
return UserLdap(
company="海南核电有限公司",
department="运行一处运行值",
company="xxx有限公司",
department="xx处xx科",
employeeID="10000",
mobile="13800138000",
mail="EMAIL",
dn="cn=liushuo,ou=海南核电有限公司,dc=cnnp,dc=com,dc=cn",
sAMAccountName="liushuo",
dn="cn=zhangsan,ou=xxx有限公司,dc=com,dc=cn",
sAMAccountName="zhangsan",
name="张三"
)

Expand All @@ -65,7 +65,7 @@ def getUserList(self, fiterKey: str, fiterValue: str) -> list[UserLdap]:
if self.conn.search(settings.LDAP_BASE, f'({fiterKey}={fiterValue})', attributes=self.attr):
userList = self.conn.entries
for user in userList:
userList[userList.index(user)] = UserCreate(
userList[userList.index(user)] = UserLdapCreate(
employeeID=user.employeeID.value,
username=user.sAMAccountName.value,
nickname=user.name.value,
Expand All @@ -86,23 +86,15 @@ def getUserList(self, fiterKey: str, fiterValue: str) -> list[UserLdap]:


if __name__ == '__main__':
from ldap3 import SUBTREE, ALL_ATTRIBUTES
# server = Server('10.20.21.2', get_info=ALL, connect_timeout=10)
server = Server('panel2.pylover.net.', get_info=ALL, connect_timeout=10)
conn = Connection(server, user='uid=test,ou=people,dc=eryajf,dc=net', password='test1234', auto_bind=True, authentication="SIMPLE")
conn.search('ou=海南核电有限公司,dc=cnnp,dc=com,dc=cn', '(sAMAccountName=liushuo)', SUBTREE, attributes=ALL_ATTRIBUTES) # 获取所有信息
attr = ["cn", "company", "department", "employeeID", "mobile", "name", "mail", "distinguishedName"]
conn.search('ou=海南核电有限公司,dc=cnnp,dc=com,dc=cn', '(sAMAccountName=liushuo)', SUBTREE, attributes=attr)
entry = conn.entries[0]
conn.unbind()
"""
cn: 姓名
company: 公司
department: 运行一处运行值
department: xx处xx科
employeeID: 工号
mobile: 手机
name: 姓名
mail: 邮箱
distinguishedName: cn=xxx,ou=xxx,dc=cnnp,dc=com,dc=cn
distinguishedName: cn=xxx,ou=xxx,dc=com,dc=cn
"""
pass

2 changes: 1 addition & 1 deletion frontend/src/views/admin/Approval/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ onMounted(() => {
areaOpt.value = res.data.map(item => {
return {
label: item.name,
value: item.id
value: item.code
};
});
});
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/views/admin/Approval/panels/returned.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const columns: TableColumnList = [
prop: "reason",
cellRenderer: ({ row }) => (
<el-popover
placement="right"
placement="bottom"
width="300"
trigger="hover"
v-slots={{
Expand Down Expand Up @@ -212,9 +212,9 @@ const columns: TableColumnList = [
),
default: () => (
<ul>
<li>姓名:{row.borrowApproveUser?.nickname}</li>
<li>电话:{row.borrowApproveUser?.phone}</li>
<li>部门:{row.borrowApproveUser?.depart}</li>
<li>工号:{row.borrowApproveUser?.employeeID}</li>
<li>电话:{row.borrowApproveUser?.mobile}</li>
<li>部门:{row.borrowApproveUser?.department}</li>
</ul>
)
}}
Expand Down Expand Up @@ -251,9 +251,9 @@ const columns: TableColumnList = [
),
default: () => (
<ul>
<li>姓名:{row.returnApproveUser?.nickname}</li>
<li>电话:{row.returnApproveUser?.phone}</li>
<li>部门:{row.returnApproveUser?.depart}</li>
<li>工号:{row.returnApproveUser?.employeeID}</li>
<li>电话:{row.returnApproveUser?.mobile}</li>
<li>部门:{row.returnApproveUser?.department}</li>
</ul>
)
}}
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/views/admin/Approval/panels/returning.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const onSearchReturn = () => {
});
};

const selectedNum = ref(0);
// 表格ref
const tableRef = ref();

Expand Down Expand Up @@ -201,7 +200,7 @@ const onBatchReturn = () => {

/** 取消选择 */
function onSelectionCancel() {
selectedNum.value = 0;
returnSelectedNum.value = 0;
// 用于多选表格,清空用户的选择
tableRef.value.getTableRef().clearSelection();
}
Expand Down Expand Up @@ -286,7 +285,7 @@ function handleCurrentChange(val: number) {
>
<template #reference>
<el-button
:disabled="selectedNum < 1"
:disabled="returnSelectedNum < 1"
:icon="useRenderIcon(Approve)"
type="success"
>
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/views/admin/MaterialChecked.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const areaOpt: SelectOpt = [
}
];
// 类型配置
const typeOpt: SelectOpt = [
const typeOpt: SelectOpt[] = [
{
label: "工具",
value: "tool"
Expand All @@ -52,7 +52,7 @@ const typeOpt: SelectOpt = [
];

// 送检状态
const checkOpt: SelectOpt = [
const checkOpt: SelectOpt[] = [
{
label: "送检中",
value: false
Expand Down Expand Up @@ -158,7 +158,7 @@ const columns: TableColumnList = [
default: () => (
<ul>
<li>姓名:{row.toCheckUser.nickname}</li>
<li>电话:{row.toCheckUser.phone}</li>
<li>电话:{row.toCheckUser.mobile}</li>
<li>部门:{row.toCheckUser.depart}</li>
</ul>
)
Expand All @@ -184,7 +184,7 @@ const columns: TableColumnList = [
default: () => (
<ul>
<li>姓名:{row.toReturnUser?.nickname}</li>
<li>电话:{row.toReturnUser?.phone}</li>
<li>电话:{row.toReturnUser?.mobile}</li>
<li>部门:{row.toReturnUser?.depart}</li>
</ul>
)
Expand Down Expand Up @@ -280,7 +280,7 @@ const openReturnDialog = (rowList, idList?: [number]) => {
const verifyForm = ref();
addDialog({
title: "验证人",
width: "20%",
width: "30%",
props: {
userInfo: {
account: "",
Expand Down
29 changes: 19 additions & 10 deletions frontend/src/views/admin/MaterialMeta.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const tableRef = ref();
// 表格加载控制
const loading = ref(false);
// 区域配置
const areaOpt: SelectOpt = [
const areaOpt: SelectOpt[] = [
{
label: "隔离办",
value: "glb"
Expand All @@ -50,7 +50,7 @@ const areaOpt: SelectOpt = [
}
];
// 类型配置
const typeOpt: SelectOpt = [
const typeOpt: SelectOpt[] = [
{
label: "工具",
value: "tool"
Expand Down Expand Up @@ -133,10 +133,10 @@ const columns: TableColumnList = [
reserveSelection: true // 数据刷新后保留选项
},
{ label: "序号", type: "index", width: "60" },
{ label: "编号", prop: "code", width: "100" },
{ label: "编号", prop: "code", minWidth: "60" },
{ label: "名称", prop: "name" },
{ label: "位置", prop: "position" },
{ label: "型号", prop: "model", width: "200" },
{ label: "型号", prop: "model", minWidth: "200" },
{ label: "数量", prop: "number", width: "100" },
{ label: "借出数量", prop: "borrowed", width: "100" },
{ label: "送检数量", prop: "checking", width: "100" },
Expand Down Expand Up @@ -172,15 +172,24 @@ const columns: TableColumnList = [
plain
onClick={() => {
addDialog({
title: "送检数量",
title: "送检确认",
width: "15%",
contentRenderer: () => (
<div style="text-align: center; margin-bottom: 10px ">
<el-input-number
v-model={toCheckNumber.value}
min={1}
max={row.number - row.borrowed - row.checking}
/>
<el-form>
<el-form-item label="名称:">
<el-text type="warning" size="large">
{row.name}
</el-text>
</el-form-item>
<el-form-item label="数量:" prop="number">
<el-input-number
v-model={toCheckNumber.value}
min={1}
max={row.number - row.borrowed - row.checking}
/>
</el-form-item>
</el-form>
</div>
),
beforeSure(done, { options, index }) {
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/views/material/page/key.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ const columns: TableColumnList = [
width="200"
trigger="click"
v-slots={{
reference: () => <el-button link>{row.username}</el-button>,
reference: () => <el-button link>{row.nickname}</el-button>,
default: () => (
<ul>
<li>姓名:{row.username}</li>
<li>工号:{row.nickname}</li>
<li>电话:{row.phone}</li>
<li>部门:{row.userDepart}</li>
</ul>
Expand All @@ -121,7 +121,7 @@ const columns: TableColumnList = [
prop: "reason",
cellRenderer: ({ row }) => (
<el-popover
placement="right"
placement="bottom"
width="300"
trigger="hover"
v-slots={{
Expand Down Expand Up @@ -171,7 +171,6 @@ const init = () => {
});
listBorrowed(props.area, 1, 100, true, true, false).then(res => {
tableDataList.push(...res.data);
console.log(tableDataList);
});
getLatestNote(props.area, props.metaType).then(res => {
lastRemark.value = res.data.note;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/material/page/tool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const lastRemark = ref("");
const step2Init = ref(true);

const step2Status = computed(() => {
return remark.value.length > 0 ? StepStatus.Success : StepStatus.Error;
return remark.value?.length > 0 ? StepStatus.Success : StepStatus.Error;
});

const copyLastRemark = () => {
Expand Down
Loading
Loading