yangg 2 napja
szülő
commit
96551faa96

+ 9 - 0
src/views/system/device/crud.tsx

@@ -196,6 +196,15 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 						},
 					},
 				},
+				search:{
+					title: '关键字搜索',
+					search: { show: true,type: 'input', },
+					type: 'input',
+					form: {
+						component: { placeholder: '请输入' },
+						show:false},
+					column: {show:false}
+				},
 				code: {
 					title: '设备编号',
 					search: { show: true },

+ 6 - 1
src/views/system/devicepreserveplan/crud.tsx

@@ -280,7 +280,12 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 					},
 					form: {
 						show:true,
-						component: { placeholder: '请填写维护开始时间' },
+						component: { 
+							placeholder: '请填写维护开始时间',
+							disabledDate: (time: Date) => {
+								return time.getTime() < Date.now() - 8.64e7; // 禁用今天之前的日期
+							}
+						},
 						rules: [{ required: true, message: '请填写维护开始时间' }],
 					},
 					viewForm:{

+ 1 - 1
src/views/system/home/api.ts

@@ -50,7 +50,7 @@ export function GetUtilizationList() {
 
 export function GetBorrowTrends() {
 	return request({
-		url: apiPrefix+'borrow_trends/?period=week',
+		url: apiPrefix+'borrow_trends/?period=year',
 		method: 'get',
 	});
 }

+ 27 - 32
src/views/system/home/index.vue

@@ -128,42 +128,32 @@
 								<div v-if="panelSettings.deviceBorrowRanking" class="boxall" :style="{ height: !panelSettings.activeUsers ? '670px' : '400px', overflow: 'hidden' }">
 									<div class="alltitle">单台设备累计借用次数排名</div>
 									<div class="navboxall">
-
-										<!-- <div class="filter-bar"
-											style="margin-bottom: 10px; display: flex; gap: 12px; align-items: center;">
-									
-											<el-select class="transparent-select"  v-model="selectedType"
-												placeholder="借用类型" @change="fetchRankings">
-												<el-option label="全部" value="all" />
-												<el-option label="常规借用" value="regular" />
-												<el-option label="课堂借用" value="classroom" />
-												<el-option label="特殊借用" value="special" />
-											</el-select>
-
-
-											
-											<el-date-picker v-model="dateRange" type="daterange"
-												start-placeholder="开始日期" end-placeholder="结束日期" format="YYYY-MM-DD"
-												value-format="YYYY-MM-DD" @change="fetchRankings" />
-
-											<el-select multiple clearable v-model="deviceTagId" placeholder="标签名" 
-											@change="fetchRankings">
-											<el-option v-for="item in labelType" :key="item.id" :label="item.name" :value="item.id" />
-											</el-select>
-
-										</div> -->
-
-										<el-table :data="teamRankings" style="width: 100%;height: 95%;">
+										<div class="wraptit">
+											<span>排名</span><span>设备名称</span><span>标签名</span><span>借用次数</span>
+										</div>
+										<div class="wrap" :style="isFullscreen?'height: 85%':'height: 60%'">
+											<ul>
+												<li v-for="(hero, index) in teamRankings" :key="index" style="width: 100%;padding:5px 0 ;border-bottom: 1px solid #232e63 ;">
+													<div
+														style="display: flex;justify-content: space-between; width: 100%;">
+														<span>{{ index + 1 }}</span>
+														<span>{{ hero.device_name }}</span>
+														<span>{{ hero.device_code }}</span>
+														<span>{{ hero.borrow_count }}</span>
+													</div>
+												</li>
+											</ul>
+										</div>
+										<!-- <el-table :data="teamRankings" style="width: 100%;height: 95%;">
 											<el-table-column type="index" label="排名" width="80" />
 											<el-table-column prop="device_name" label="设备名称" />
-											<!-- <el-table-column prop="device_code" label="设备编码" /> -->
 											 <el-table-column prop="device_name" label="标签名">
 												<template #default="scope">
 													<span v-for="tag in scope.row.device_tags" :key="tag" :type="tag.type">{{' '+tag.name }}</span>
 												</template>
 											</el-table-column>
 											<el-table-column prop="borrow_count" label="借用次数" />
-										</el-table>
+										</el-table> -->
 
 									</div>
 
@@ -208,6 +198,7 @@
 			width="500px"
 			:close-on-click-modal="false"
 			destroy-on-close
+			:before-close="handleClose"
 		>
 			<div class="panel-settings">
 				<el-checkbox v-model="panelSettings.deviceUtilization">设备利用率趋势</el-checkbox>
@@ -219,7 +210,7 @@
 			</div>
 			<template #footer>
 				<span class="dialog-footer">
-					<el-button @click="() => state.settingsDialogVisible = false">取消</el-button>
+					<el-button @click="handleClose">取消</el-button>
 					<el-button type="primary" @click="saveSettings">确定</el-button>
 				</span>
 			</template>
@@ -347,7 +338,9 @@ export default defineComponent({
 
 
 
-
+		const handleClose=()=>{
+			state.settingsDialogVisible = false;
+		}
 
 
 		// 折线图
@@ -785,7 +778,7 @@ export default defineComponent({
 
 		const groupByMonth = (data: Array<{ date: string; borrow_count: number; total_duration: number }>) => {
 				const map = new Map<string, { borrow_count: number; total_duration: number }>()
-
+				console.log('map::',data)
 				data.forEach(item => {
 					const month = dayjs(item.date).format('YYYY-MM')
 					if (!map.has(month)) {
@@ -819,7 +812,8 @@ export default defineComponent({
 		};
 		//更新整体借用趋势
 		const updateBorrowTrendChart = (trendData: Array<{ date: string; borrow_count: number; total_duration: number }>) => {
-			const monthlyData = groupByMonth(trendData) 
+			const monthlyData =trendData /* groupByMonth()  */
+			console.log("monthlyData:::", monthlyData)
 			const echart3 = echarts.init(document.getElementById('echart3'));
 			if (!echart3) return;
 
@@ -1108,6 +1102,7 @@ export default defineComponent({
 			panelSettings,
 			isFullscreen,
 			toggleFullScreen,
+			handleClose,
 			// 打开设置弹窗
 			openSettings: () => {
 				state.settingsDialogVisible = true;