kllay il y a 1 jour
Parent
commit
3636db8dce

+ 1 - 1
.env.development

@@ -5,7 +5,7 @@ ENV = 'development'
 #线下:http://192.168.100.187:8083
 # 本地环境接口地址 121.36.251.245
 
-VITE_API_URL = 'http://192.168.100.101:8086'
+VITE_API_URL = 'http://1.94.168.85:8086'
 # VITE_API_URL = 'http://192.168.100.187:9084'
 # VITE_API_URL = 'https://backend.qicai321.com'
 VITE_API_WX_URL='https://api.weixin.qq.com/'

+ 1 - 1
src/views/system/borrow/workflow/WorkflowDialog/index.vue

@@ -120,7 +120,7 @@
 								>
 									<!-- <el-select v-model="role.name" placeholder="请选择角色" style="width: 300px" @change="onRoleChange(idx, ridx, $event)"> -->
 										<el-select v-model="role.name" placeholder="请选择角色" style="width: 300px">
-										<el-option label="指导老师" value="指导老师" />
+										<el-option label="老师" value="老师" />
 										<el-option label="管理员" value="管理员" />
 										<el-option label="学院领导" value="学院领导" />
 									</el-select>

+ 11 - 10
src/views/system/device/crud.tsx

@@ -3,7 +3,7 @@ import dayjs from 'dayjs';
 import * as api from './api';
 import { uploadFile } from './api';
 import { auth } from '/@/utils/authFunction';
-import { commonCrudConfig } from '/@/utils/commonCrud';
+// import { commonCrudConfig } from '/@/utils/commonCrud';
 import {request} from '/@/utils/service';
 import {getBaseURL} from '/@/utils/baseUrl';
 import Cookies from 'js-cookie';
@@ -434,12 +434,13 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 					form: {
 						component: { placeholder: '请选择设备标签' },
 						rules: [{ required: true, message: '请选择设备标签' }],
-						valueResolve({ form, value }) {
-							form.tags = Array.from(String(value), Number);
-						},
+						// valueResolve({ form, value }) {
+						// 	form.tags = Array.from(String(value), Number);
+						// },
 						valueBuilder({ form, value }) {
-							// form.tags =Array.from(String(value), Number);
-							form.tags = Array.isArray(value)? value.length > 0 ? Number(value[0]) : '': Number(value);
+							if(value){
+								form.tags = Array.isArray(value)? value.length > 0 ? Number(value[0]) : '': Number(value);
+							}
 
 						},
 					}
@@ -530,10 +531,10 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 				// 		rules: [{ required: true, message: '请输入设备购入价格' }],
 				// 	},
 				// },
-				...commonCrudConfig({
-					create_datetime: { search: false },
-					update_datetime: { search: false },
-				}),
+				// ...commonCrudConfig({
+				// 	create_datetime: { search: false },
+				// 	update_datetime: { search: false },
+				// }),
 			},
 			form: {
 				row: { gutter: 20 },

+ 3 - 4
src/views/system/screenconsole/api.ts

@@ -1,11 +1,10 @@
 import { request } from '/@/utils/service';
 import { UserPageQuery, AddReq, DelReq, EditReq, InfoReq } from '@fast-crud/fast-crud';
 
-export const apiPrefix = '/api/system/login_log/';
-export function GetList(query: UserPageQuery) {
+export const apiPrefix = '/api/system/dashboard/';
+export function GetList() {
 	return request({
-		url: 'api/dashboard/stats',
+		url: apiPrefix,
 		method: 'get',
-		params: { ...query, tenant_id: 1 },
 	});
 }

+ 14 - 10
src/views/system/screenconsole/component/InfoCards.vue

@@ -28,18 +28,22 @@ import {
   Coin, Box, Document, Avatar, Folder,
   Monitor, ShoppingCart, User, Setting, Tools
 } from '@element-plus/icons-vue'
+import { defineProps } from 'vue'
+
+const props = defineProps({
+  summaryData: {
+    type: Object,
+    required: true
+  }
+})
 
 const infoList = [
-  { label: '借用数', value: 195, icon: Coin },
-  { label: '设备柜', value: 15, icon: Box },
-  { label: '审核数', value: 14, icon: Document },
-  { label: '学生数', value: 114, icon: Avatar },
-  { label: '盘点数', value: 3, icon: Folder },
-  { label: '设备数', value: 95, icon: Monitor },
-  { label: '仓库数', value: 3, icon: ShoppingCart },
-  { label: '库位数', value: 5, icon: Setting },
-  { label: '管理员', value: 10, icon: User },
-  { label: '维修数', value: 10, icon: Tools },
+  { label: '设备总数', value: props.summaryData.total_devices, icon: Coin },
+  { label: '在借数', value: props.summaryData.total_borrows, icon: Box },
+  { label: '在库数', value: props.summaryData.total_warehouses, icon: Document },
+  { label: '维修中', value: props.summaryData.total_maintenances, icon: Avatar },
+  { label: '用户数', value: props.summaryData.total_students, icon: Folder },
+  { label: '借用件次数', value: props.summaryData.total_applications, icon: Monitor },
 ];
 function handleClick(item: any) {
   console.log('点击信息卡片:', item.label);

+ 13 - 6
src/views/system/screenconsole/component/StatusCards.vue

@@ -33,14 +33,21 @@
 import {
   Edit, Refresh, Tools, Box, Folder, Monitor
 } from '@element-plus/icons-vue'
+import { defineProps } from 'vue'
+
+
+const props = defineProps({
+  statusData: {
+    type: Object,
+    required: true
+  }
+})
 
 const statusList = [
-  { label: '待审核', value: 2, icon: Edit },
-  { label: '待归还', value: 5, icon: Refresh },
-  { label: '待维修', value: 5, icon: Tools },
-  { label: '待补货', value: 5, icon: Box },
-  { label: '待入库', value: 5, icon: Folder },
-  { label: '待盘点', value: 5, icon: Monitor },
+  { label: '待审核', value: props.statusData.pending_approval, icon: Edit },
+  { label: '待归还', value: props.statusData.pending_return, icon: Refresh },
+  { label: '待维修', value: props.statusData.pending_maintenance, icon: Tools },
+  { label: '已逾期', value: props.statusData.pending_restock, icon: Box },
 ];
   
   function handleClick(item: any) {

+ 39 - 4
src/views/system/screenconsole/index.vue

@@ -3,19 +3,19 @@
 		<!-- 第一行 -->
 		<el-row :gutter="15" class="home-row">
 		<el-col :span="8">
-			<StatusCards />
+			<StatusCards :statusData="pendingItems" />
 		</el-col>
 		<el-col :span="16">
-			<InfoCards />
+			<InfoCards  :summaryData="dataSummary" />
 		</el-col>
 		</el-row>
 
 		<!-- 第二行 -->
 		<el-row :gutter="15" class="home-row" style="margin-top: 20px">
-		<el-col :span="17">
+		<el-col :span="8">
 			<InboundOrders />
 		</el-col>
-		<el-col :span="7">
+		<el-col :span="16">
 			<StockAlerts />
 		</el-col>
 		</el-row>
@@ -39,6 +39,7 @@ import * as echarts from 'echarts';
 import { storeToRefs } from 'pinia';
 import { useThemeConfig } from '/@/stores/themeConfig';
 import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
+import * as api from './api';
 // import { GetList } from './api';
 // import { useRouter } from 'vue-router';
 
@@ -48,6 +49,40 @@ import InboundOrders from './component/InboundOrders.vue';
 import StockAlerts from './component/StockAlerts.vue';
 
 
+const pendingItems = ref({
+  pending_approval: 0,
+  pending_return: 0,
+  pending_maintenance: 0,
+  pending_restock: 0,
+  pending_warehousing: 0,
+  pending_inventory_check: 0
+})
+
+const dataSummary = ref({
+  total_borrows: 0,
+  device_cabinets: 0,
+  total_applications: 0,
+  total_students: 0,
+  total_inventory_checks: 0,
+  total_devices: 0,
+  total_warehouses: 0,
+  storage_locations: 0,
+  total_admins: 0,
+  total_maintenances: 0
+})
+
+onMounted(async () => {
+  try {
+    const res = await api.GetList()
+    if (res.code === 2000) {
+      pendingItems.value = res.data.pending_items
+      dataSummary.value = res.data.data_summary
+    }
+  } catch (error) {
+    console.error('获取数据失败:', error)
+  }
+})
+
 
 // 定义API数据接口
 interface ApiData {