diff --git a/frontend/.env.production b/frontend/.env.production
index 15a08c3..2c054f1 100644
--- a/frontend/.env.production
+++ b/frontend/.env.production
@@ -1 +1 @@
-VITE_API_BASE_URL=https://api.example.com/api
+VITE_API_BASE_URL=http://101.42.1.64:2260/api
diff --git a/frontend/src/main.js b/frontend/src/main.js
index 5224f16..3ce4b36 100644
--- a/frontend/src/main.js
+++ b/frontend/src/main.js
@@ -2,10 +2,11 @@
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
+import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'
import './styles/base.css'
const app = createApp(App)
app.use(router)
-app.use(ElementPlus)
+app.use(ElementPlus, { locale: zhCn })
app.mount('#app')
diff --git a/frontend/src/styles/base.css b/frontend/src/styles/base.css
index 8418b18..919e599 100644
--- a/frontend/src/styles/base.css
+++ b/frontend/src/styles/base.css
@@ -87,6 +87,10 @@ a {
overflow: hidden;
}
+.table-maxheight {
+ max-height: 560px;
+}
+
.el-table th.el-table__cell {
background: var(--bg-soft);
color: var(--text-900);
diff --git a/frontend/src/views/FactoryManage.vue b/frontend/src/views/FactoryManage.vue
index 49331f9..148c30a 100644
--- a/frontend/src/views/FactoryManage.vue
+++ b/frontend/src/views/FactoryManage.vue
@@ -4,7 +4,7 @@
新增工厂
-
+
@@ -23,6 +23,18 @@
+
@@ -73,6 +85,11 @@ import { fetchFactories, fetchFactoryDetail, createFactory, updateFactory, delet
const router = useRouter()
const { isAdmin } = useAuth()
const factories = ref([])
+const pagination = reactive({
+ page: 1,
+ pageSize: 10,
+ total: 0
+})
const dialogVisible = ref(false)
const dialogTitle = ref('')
const isEdit = ref(false)
@@ -94,8 +111,9 @@ const form = reactive({
})
const loadFactories = async () => {
- const data = await fetchFactories()
+ const data = await fetchFactories({ page: pagination.page, page_size: pagination.pageSize })
factories.value = data.results || data
+ pagination.total = data.count || factories.value.length
}
const resetForm = () => {
@@ -164,8 +182,27 @@ const goDetail = (row) => {
router.push(`/factories/${row.id}`)
}
+const onPageChange = (page) => {
+ pagination.page = page
+ loadFactories()
+}
+
+const onPageSizeChange = (size) => {
+ pagination.pageSize = size
+ pagination.page = 1
+ loadFactories()
+}
+
onMounted(() => {
loadFactories()
})
+
+
diff --git a/frontend/src/views/MaterialManage.vue b/frontend/src/views/MaterialManage.vue
index e62cf1f..f94c9f5 100644
--- a/frontend/src/views/MaterialManage.vue
+++ b/frontend/src/views/MaterialManage.vue
@@ -13,7 +13,7 @@
新增材料
-
+
@@ -33,6 +33,18 @@
+
@@ -163,6 +175,11 @@ import { fetchFactorySimple } from '@/api/factory'
const router = useRouter()
const { isAdmin } = useAuth()
const materials = ref([])
+const pagination = reactive({
+ page: 1,
+ pageSize: 10,
+ total: 0
+})
const factories = ref([])
const dialogVisible = ref(false)
const dialogTitle = ref('')
@@ -216,8 +233,13 @@ const filterSubcategoryOptions = ref([])
const allSubcategories = ref([])
const loadMaterials = async () => {
- const data = await fetchMaterials({ ...filters })
+ const data = await fetchMaterials({
+ ...filters,
+ page: pagination.page,
+ page_size: pagination.pageSize
+ })
materials.value = data.results || data
+ pagination.total = data.count || materials.value.length
}
const loadChoices = async () => {
@@ -384,6 +406,17 @@ const goDetail = (row) => {
router.push(`/materials/${row.id}`)
}
+const onPageChange = (page) => {
+ pagination.page = page
+ loadMaterials()
+}
+
+const onPageSizeChange = (size) => {
+ pagination.pageSize = size
+ pagination.page = 1
+ loadMaterials()
+}
+
onMounted(() => {
loadChoices()
loadCategories()
@@ -393,6 +426,14 @@ onMounted(() => {
})
+
+