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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.eslintcache
report.html
*/logs
*/.venv

yarn.lock
npm-debug.log*
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# backend
*.toml
.env.*
.env
*.pyc
Expand All @@ -8,6 +7,7 @@
*/migrations
*/logs
*/config
material-*/

# frontend
node_modules
Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list.d/deb

RUN apt-get update \
# && apt-get install -y --no-install-recommends gcc python3-dev bash nginx vim curl procps net-tools\
&& apt-get install -y --no-install-recommends nginx\
&& apt-get install -y --no-install-recommends nginx vim\
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

RUN pip install poetry -i https://pypi.tuna.tsinghua.edu.cn/simple\
&& poetry config virtualenvs.create false \
&& poetry install
RUN pip install uv -i https://pypi.tuna.tsinghua.edu.cn/simple\
&& uv sync

COPY --from=frontend /app/frontend/dist /app/frontend
ADD mm.conf /etc/nginx/sites-available/mm.conf
Expand Down
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.6 .
docker build -t material:1.0.7 .
```

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

启动容器
Expand Down
1 change: 1 addition & 0 deletions backend/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
5 changes: 0 additions & 5 deletions backend/app/utils/password.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import hashlib

from passlib import pwd
from passlib.context import CryptContext

pwd_context = CryptContext(schemes=["argon2"], deprecated="auto")
Expand Down Expand Up @@ -34,7 +33,3 @@ def verify_password(plain_password: str, hashed_password: str) -> int:

def get_password_hash(password: str) -> str:
return pwd_context.hash(password)


def generate_password() -> str:
return pwd.genword()
1,548 changes: 0 additions & 1,548 deletions backend/poetry.lock

This file was deleted.

23 changes: 23 additions & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[project]
name = "MaterialManager"
version = "1.0.7"
description = "Add your description here"
readme = "../README.md"
requires-python = ">=3.11"
dependencies = [
"aerich[toml]>=0.8.1",
"cryptography>=44.0.0",
"fastapi>=0.115.6",
"ldap3>=2.9.1",
"loguru>=0.7.3",
"passlib[bcrypt]>=1.7.4",
"pyjwt>=2.10.1",
"pymysql>=1.1.1",
"ruamel-yaml>=0.18.10",
"tortoise-orm[asyncmy]>=0.23.0",
"uvicorn>=0.34.0",
]

[[tool.uv.index]]
url = "https://mirrors.aliyun.com/pypi/simple"
default = true
593 changes: 593 additions & 0 deletions backend/uv.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions create_db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE DATABASE material DEFAULT CHARACTER SET = 'utf8mb4' DEFAULT COLLATE = 'utf8mb4_0900_ai_ci';
9 changes: 4 additions & 5 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
configs:
create_db_sql:
content: |
CREATE DATABASE material DEFAULT CHARACTER SET = 'utf8mb4' DEFAULT COLLATE = 'utf8mb4_0900_ai_ci';
file: ./create_db.sql

services:
db:
Expand All @@ -21,12 +20,12 @@ services:
aliases:
- db
material:
image: material:1.0.5
image: material:1.0.7
restart: unless-stopped
environment:
- DB_HOST=localhost
- DB_HOST=db
- DB_DRIVER=org.mysql.jdbc.Driver
- DB_URL=jdbc:mysql://home-db-1:3306/material?serverTimezone=Asia/Shanghai
- DB_URL=jdbc:mysql://db:3306/material?serverTimezone=Asia/Shanghai
- DB_USERNAME=root
- DB_PASSWORD=mysql
- DEV=false
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -e

nginx
python run.py
uv run run.py
7 changes: 5 additions & 2 deletions frontend/public/platform-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": "0.0.7",
"Version": "1.0.7",
"Title": "物资管理平台",
"FixedHeader": true,
"HiddenSideBar": false,
Expand All @@ -23,5 +23,8 @@
"CachingAsyncRoutes": false,
"TooltipEffect": "light",
"ResponsiveStorageNameSpace": "responsive-",
"MenuSearchHistory": 6
"MenuSearchHistory": 6,
"DocxUrl": "https://hn-disk.cnnp.com.cn/ucdisk/s/AraYn2",
"AdminName": "刘硕",
"AdminEmail": "liushuo@cnnp.com.cn"
}
4 changes: 1 addition & 3 deletions frontend/src/api/material.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ export const deleteCheckedMaterial = (idList: Array<number>) => {
"delete",
baseUrlApi("/material/checked/delete"),
{
data: {
idList
}
data: idList
}
);
};
Expand Down
17 changes: 16 additions & 1 deletion frontend/src/layout/hooks/useNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ export function useNav() {
return $config.Title;
});

const docxUrl = computed(() => {
return $config.DocxUrl;
});

const adminName = computed(() => {
return $config.AdminName;
});

const adminEmail = computed(() => {
return $config.AdminEmail;
});

/** 动态title */
function changeTitle(meta: routeMetaType) {
const Title = getConfig().Title;
Expand Down Expand Up @@ -363,6 +375,9 @@ export function useNav() {
tooltipEffect,
getDropdownItemStyle,
getDropdownItemClass,
updatePwdDialog
updatePwdDialog,
docxUrl,
adminName,
adminEmail
};
}
59 changes: 51 additions & 8 deletions frontend/src/views/admin/MaterialChecked.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ import verifyDialog from "@/views/welcome/dialog/VerifyDialog.vue";
import type { userInfo } from "@/views/welcome/types";
import { successNotification, warningNotification } from "@/utils/notification";
import { deviceDetection, getKeyList } from "@pureadmin/utils";
import { getCheckedMaterial, updateCheckedMaterial } from "@/api/material";
import {
deleteCheckedMaterial,
getCheckedMaterial,
updateCheckedMaterial
} from "@/api/material";
import { auth } from "@/api/base";
import Delete from "@iconify-icons/ep/delete";

defineOptions({
name: "MaterialChecked"
Expand All @@ -25,7 +30,7 @@ const optionBar = reactive({
returnStatus: false
});
// 区域配置
const areaOpt: SelectOpt = [
const areaOpt: SelectOpt[] = [
{
label: "隔离办",
value: "glb"
Expand Down Expand Up @@ -65,22 +70,28 @@ const checkOpt: SelectOpt[] = [
const loading = ref(false);
// 表格数据
const dataList = ref([]);
const returnData = reactive({
reactive({
username: "",
uuid: ""
});
const onSearch = () => {
loading.value = true;
getCheckedMaterial(
optionBar.area,
optionBar.type,
optionBar.returnStatus,
pagination.currentPage,
pagination.pageSize
).then(res => {
dataList.value = res.data;
pagination.total = res.total;
pagination.pageSize = res.pageSize;
});
)
.then(res => {
dataList.value = res.data;
pagination.total = res.total;
pagination.pageSize = res.pageSize;
})
.finally(() => {
loading.value = false;
onSelectionCancel();
});
};
// 分页设置
const pagination = reactive<PaginationProps>({
Expand Down Expand Up @@ -337,12 +348,29 @@ const openReturnDialog = (rowList, idList?: [number]) => {
});
};

const onBatchBtnLoading = ref(false);

const onBatchReturn = () => {
const curSelected = tableRef.value.getTableRef().getSelectionRows();
const idList = getKeyList(curSelected, "id");
openReturnDialog(curSelected, idList as [number]);
};

const onBatchDel = () => {
onBatchBtnLoading.value = true;
const curSelected = tableRef.value.getTableRef().getSelectionRows();
const idList = getKeyList(curSelected, "id");
deleteCheckedMaterial(idList)
.then(() => {
successNotification("删除成功!");
onSearch();
})
.finally(() => {
onSelectionCancel();
onBatchBtnLoading.value = false;
});
};

/** 当CheckBox选择项发生变化时会触发该事件 */
function handleSelectionChange(val) {
selectedNum.value = val.length;
Expand Down Expand Up @@ -386,8 +414,10 @@ function handleCurrentChange(val: number) {
<el-form-item label="归还状态" prop="returnStatus">
<el-select-v2
v-model="optionBar.returnStatus"
:disabled="optionBar.area === ''"
:options="checkOpt"
class="!w-[150px]"
@change="onSearch"
/>
</el-form-item>
<el-form-item>
Expand Down Expand Up @@ -422,6 +452,7 @@ function handleCurrentChange(val: number) {
<el-popconfirm title="要批量归还吗?" @confirm="onBatchReturn">
<template #reference>
<el-button
v-show="!optionBar.returnStatus"
:disabled="selectedNum < 1"
:icon="useRenderIcon(Approve)"
type="success"
Expand All @@ -430,6 +461,18 @@ function handleCurrentChange(val: number) {
</el-button>
</template>
</el-popconfirm>
<el-popconfirm title="要批量删除吗?" @confirm="onBatchDel">
<template #reference>
<el-button
v-show="optionBar.returnStatus"
:disabled="selectedNum < 1"
:icon="useRenderIcon(Delete)"
type="danger"
>
删除所选
</el-button>
</template>
</el-popconfirm>
</template>
<template v-slot="{ size, dynamicColumns }">
<pure-table
Expand Down
13 changes: 4 additions & 9 deletions frontend/src/views/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ initStorage();
const { t } = useI18n();
const { dataTheme, dataThemeChange } = useDataThemeChange();
dataThemeChange();
const { title } = useNav();
const { title, docxUrl, adminName, adminEmail } = useNav();

const ruleForm = reactive({
username: "",
Expand Down Expand Up @@ -77,8 +77,6 @@ function onkeypress({ code }: KeyboardEvent) {
}
}

const clipboardText = ref("liushuo@cnnp.com.cn");

onMounted(() => {
window.document.addEventListener("keypress", onkeypress);
});
Expand Down Expand Up @@ -169,10 +167,7 @@ onBeforeUnmount(() => {
</Motion>
<Motion :delay="300">
<el-row class="flex mt-4" justify="space-between">
<el-link
:underline="false"
href="https://hn-disk.hnpc.cc/ucdisk/s/AraYn2"
target="_blank"
<el-link :href="docxUrl" :underline="false" target="_blank"
>使用说明下载
</el-link>
<div>
Expand All @@ -186,11 +181,11 @@ onBeforeUnmount(() => {
placement="bottom"
>
<el-button
v-copy="clipboardText"
v-copy="adminEmail"
link
size="small"
type="primary"
>刘硕
>{{ adminName }}
</el-button>
</el-tooltip>
</div>
Expand Down
3 changes: 3 additions & 0 deletions frontend/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ declare global {
TooltipEffect?: Effect;
ResponsiveStorageNameSpace?: string;
MenuSearchHistory?: number;
DocxUrl?: string;
AdminName?: string;
AdminEmail?: string;
}

/**
Expand Down
23 changes: 0 additions & 23 deletions qodana.yaml

This file was deleted.

Loading