Browse Source

no message

kllay 2 days ago
parent
commit
cc79805d78

+ 3 - 0
src/theme/element.scss

@@ -410,6 +410,9 @@
 	padding-left: 12px;
 	padding-right: 12px;
 }
+.cell{
+	text-align: center;
+}
 
 /* 表格边框和分割线颜色 */
 .el-table--border, .el-table--group {

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

@@ -78,7 +78,7 @@ export function approveBorrow(id: number, action: 'approve' | 'reject', remark?:
 // 归还设备
 export function returnDevice(id: number, remark?: string) {
 	return request({
-		url: apiPrefix + id + '/return/',
+		url: apiPrefix + id + '/return_device/',
 		method: 'post',
 		data: { remark }
 	});

+ 5 - 5
src/views/system/borrow/component/BorrowTypeSelect/index.vue

@@ -1,10 +1,10 @@
 <template>
-	<el-dialog v-model="visible" title="选择借用性质" width="70%" :close-on-click-modal="false" @close="onCancel">
+	<el-dialog v-model="visible" title="选择借用性质" width="40%" :close-on-click-modal="false" @close="onCancel">
 		<div style="margin-bottom: 16px">
 			<ol style="padding: 10px 30px; margin-bottom: 20px; border: 1px solid #409eff; border-radius: 5px; background: #e6f7ff">
-				<li>1、常规借用:课后自主练习、日常技能巩固等非教学时段的使用需求;</li>
-				<li>2、课堂借用:课堂教学活动、实验操作、课程项目等教学时段的正式使用</li>
-				<li>3、特殊借用:突发紧急情况、非常规教学需求或特殊事件下的临时性借用。</li>
+				<!-- <li>1、常规借用:课后自主练习、日常技能巩固等非教学时段的使用需求;</li> -->
+				<li>1、课堂借用:课堂教学活动、实验操作、课程项目等教学时段的正式使用</li>
+				<li>2、特殊借用:突发紧急情况、非常规教学需求或特殊事件下的临时性借用。</li>
 			</ol>
 			<div style="display: flex; justify-content: space-around; margin: 20px 0">
 				<div v-for="item in types" :key="item.value" @click="select(item.value)" style="cursor: pointer; text-align: center">
@@ -14,7 +14,7 @@
 			</div>
 		</div>
 		<template #footer>
-			<el-button @click="onCancel">取消</el-button>
+			<el-button @click="onCancel">关闭</el-button>
 		</template>
 	</el-dialog>
 </template>

+ 1 - 1
src/views/system/borrow/component/SpecialBorrow/index.vue

@@ -1,5 +1,5 @@
 <template>
-	<el-dialog v-model="visible" title="特殊借用" width="75%" :close-on-click-modal="false" @close="onCancel">
+	<el-dialog v-model="visible" title="借用申请单" width="75%" :close-on-click-modal="false" @close="onCancel">
 		<el-form :model="form" label-width="110px" label-position="top" :rules="rules" ref="formRef">
 			<el-row :gutter="16">
 				<el-col :span="8">

+ 52 - 33
src/views/system/borrow/crud.tsx

@@ -1,7 +1,9 @@
 import * as api from './api';
-import { UserPageQuery, AddReq, DelReq, EditReq, CreateCrudOptionsProps, CreateCrudOptionsRet } from '@fast-crud/fast-crud';
+import { UserPageQuery, AddReq, DelReq, EditReq, CreateCrudOptionsProps, CreateCrudOptionsRet ,useCompute} from '@fast-crud/fast-crud';
 import dayjs from 'dayjs';
 
+const { compute } = useCompute();
+
 export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
 	const pageRequest = async (query: UserPageQuery) => {
 		try {
@@ -54,14 +56,19 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 					view: {
 						show: true,
 						click: ({ row }) => {
+							// eslint-disable-next-line no-console
+							// console.log("row:::",row);
 							window.dispatchEvent(new CustomEvent('borrow-view', { detail: row }));
 						},
 					},
 					edit: {
-						show: true,
+						show:true,	
+						disabled:compute( ({row})=>{
+							return row.borrow_type === 0;
+						}), 
 						click: ({ row }) => {
 							window.dispatchEvent(new CustomEvent('borrow-edit', { detail: row }));
-						},
+						}
 					},
 					remove: {
 						show: true,
@@ -72,7 +79,7 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 				show:false,
 			},
 			toolbar:{
-				show:false,
+				show:true,
 			},
 			columns: {
 				_index: {
@@ -90,11 +97,9 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 					},
 				},
 				application_no: { title: '借用单编号', column: { minWidth: 140 } },
-				borrower_type_label: { title: '借用人类型', column: { minWidth: 100 } },
+				borrower_type_label: { title: '借用人角色', column: { minWidth: 100 } },
 				borrow_type_label: { search: { show: true },title: '借用性质', column: { minWidth: 100 } },
-				team_type_label: { title: '团队/个人', column: { minWidth: 80 } },
-				team_members: { title: '团队成员', column: { minWidth: 120 } },
-				team_members_count: { title: '团队人数', column: { minWidth: 80 } },
+				"borrower_info.user_code":{title:"学号/工号",column: { minWidth: 100 }},
 				borrower_info: {
 					title: '借用人',
 					search:{
@@ -110,41 +115,55 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 						},
 					},
 				},
-				purpose: { title: '借用目的', column: { minWidth: 150 } },
-				expected_start_time: {
-					title: '预计开始',
-					column: { minWidth: 140, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm') : '') },
-				},
-				expected_end_time: {
-					title: '预计结束',
-					column: { minWidth: 140, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm') : '') },
+				emergency_contact: { title: '紧急联系人', column: { show:false, minWidth: 100 } },
+				emergency_phone: { title: '联系方式', column: { minWidth: 120 } },
+				team_type_label: { title: '个人/团队', column: { minWidth: 80 } },
+				team_members: { title: '团队成员', column: { show:false,minWidth: 120 } },
+				team_members_count: { title: '团队人数', column: { show:false,minWidth: 80 }},
+				create_datetime: {
+					title: '创建时间',
+					column: { minWidth: 160, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '') },
 				},
+				status_label: { title: '当前状态', column: { minWidth: 80 } },
 				actual_start_time: {
-					title: '实际开始',
-					column: { minWidth: 140, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm') : '') },
+					title: '借出时间',
+					column: { minWidth: 140, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '') },
+				},
+				expected_end_time: {
+					title: '预计归还',
+					column: { minWidth: 140, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '') },
 				},
 				actual_end_time: {
-					title: '实际结束',
-					column: { minWidth: 140, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm') : '') },
+					title: '完结时间',
+					column: { minWidth: 140, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '') },
+				},
+				return_location: { title: '存放仓库', column: { minWidth: 120 } },
+				
+
+
+
+				
+				purpose: { title: '借用目的', column: { minWidth: 150 ,show:false} },
+				expected_start_time: {
+					title: '预计开始',
+					
+					column: { minWidth: 140,show:false, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '') },
 				},
-				status_label: { title: '状态', column: { minWidth: 80 } },
+			
+				
 				approve_time: {
 					title: '审批时间',
-					column: { minWidth: 140, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm') : '') },
-				},
-				approve_remark: { title: '审批备注', column: { minWidth: 120 } },
-				total_items: { title: '设备数量', column: { minWidth: 80 } },
-				emergency_contact: { title: '紧急联系人', column: { minWidth: 100 } },
-				emergency_phone: { title: '联系电话', column: { minWidth: 120 } },
-				return_location: { title: '归还地点', column: { minWidth: 120 } },
-				applicant_remark: { title: '申请备注', column: { minWidth: 120 } },
-				create_datetime: {
-					title: '创建时间',
-					column: { minWidth: 160, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '') },
+					column: { show:false,minWidth: 140, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm') : '') },
 				},
+				approve_remark: { title: '审批备注', column: {show:false, minWidth: 120 } },
+				total_items: { title: '设备数量', column: { show:false,minWidth: 80 } },
+				
+				
+				applicant_remark: { title: '申请备注', column: { show:false, minWidth: 120 } },
+				
 				update_datetime: {
 					title: '更新时间',
-					column: { minWidth: 160, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '') },
+					column: { show:false,minWidth: 160, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '') },
 				},
 			},
 		},

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

@@ -40,7 +40,7 @@ function onBorrowTypeSelected(type: number, mode: 'view' | 'edit' | 'add',record
 			borrowForm.value = { ...(record || {}), borrow_type: type, mode };
 		});
 	if (type == 0) {
-		// showCommonBorrowDialog.value = true;
+		showSpecialBorrowDialog.value = true;
 		
 	} else if (type == 1) {
 		showClassroomBorrowDialog.value = true;

+ 123 - 86
src/views/system/device/crud.tsx

@@ -10,6 +10,7 @@ import Cookies from 'js-cookie';
 import { successMessage } from '/@/utils/message';
 import { dictionary } from '/@/utils/dictionary';
 import { APIResponseData } from '../columns/types';
+import { h } from 'vue';
 
 export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
 	const pageRequest = async (query: UserPageQuery) => {
@@ -46,15 +47,10 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 				width: 220,
 				view: {
 					show: true,
-					click: ({ row }) => {
-						window.dispatchEvent(new CustomEvent('workflow-view', { detail: row }));
-					},
+				
 				},
 				edit: {
 					show: true,
-					click: ({ row }) => {
-						window.dispatchEvent(new CustomEvent('workflow-edit', { detail: row }));
-					},
 				},
 				remove: {
 					show: true,
@@ -223,13 +219,13 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 					editForm:{show:false},
 					from:{ 
 						show:false,
-						component: { placeholder: '请输入已借出' },
-						rules: [{ required: true, message: '请输入已借出' }],
+						component: { placeholder: '请输入库存数量' },
+						rules: [{ required: false, message: '请输入库存数量' }],
 
 					}
 				},
 				warehouse:{
-					title:'存仓库',
+					title:'存仓库',
 					type:"dict-select",
 					column: { minWidth: 150 },
 					dict: dict({
@@ -238,7 +234,8 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 						label: 'name'
 					}),
 					form: {
-						component: { placeholder: '请选择库存仓库' }
+						component: { placeholder: '请选择存放仓库' },
+						rules: [{ required: true, message: '请选择存放仓库' }],
 					}
 				},
 				status:{
@@ -263,6 +260,9 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 					dict: dict({
 						data: dictionary('device_button_status_bool'),
 					}),
+					form: {
+						rules: [{ required: true, message: '请选择是否可见' }],
+					}
 
 				},
 				
@@ -284,8 +284,8 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 						formatter: ({ value }) => (value ? dayjs(value).format('YYYY-MM-DD') : ''),
 					},
 					form: {
-						component: { placeholder: '请选择购买日期' },
-						rules: [{ required: true, message: '请选择购买日期' }],
+						component: { placeholder: '请选择采购时间' },
+						rules: [{ required: false, message: '请选择采购时间' }],
 					},
 					valueResolve({ form, value }) {
 						form.purchase_date = value ? dayjs(value).format('YYYY-MM-DD') : null;
@@ -318,19 +318,42 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 					column: { minWidth: 100 },
 					form: {
 						component: { placeholder: '请输入设备购入价格' },
-						rules: [{ required: true, message: '请输入设备购入价格' }],
+						rules: [{ required: false, message: '请输入设备购入价格' }],
 					},
 				},
 				warranty_expiration: {
-					title: '质期',
+					title: '质期',
 					type: 'date',
 					search: { show: false },
 					column: { minWidth: 120 ,
 						formatter: ({ value }) => (value ? dayjs(value).format('YYYY-MM-DD') : ''),
 					},
+					viewForm: {
+						title: '质保到期',
+						component: {
+							render({ value }) {
+								// eslint-disable-next-line no-console
+								console.log("valuevaluevalue:::",value);
+								if (!value) return '未设置';
+								const formatted = dayjs(value).format('YYYY-MM-DD');
+								const isExpired = dayjs(value).isBefore(dayjs(), 'day');
+								return h(
+									'span',
+									{
+										style: {
+										color: isExpired ? 'red' : 'inherit',
+										fontWeight: isExpired ? 'bold' : 'normal'
+										}
+									},
+									isExpired ? `${formatted}(已过期)` : formatted
+									);
+							},
+							showHtml: true,
+						}
+					},
 					form: {
-						component: { placeholder: '请选择购买日期' },
-						rules: [{ required: true, message: '请选择购买日期' }],
+						component: { placeholder: '请选择质保期' },
+						rules: [{ required: false, message: '请选择质保期' }],
 					},
 					valueResolve({ form, value }) {
 						form.warranty_expiration = value ? dayjs(value).format('YYYY-MM-DD') : null;
@@ -339,6 +362,88 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 						form.warranty_expiration = value;
 					},
 				},
+				tenant_id:{
+					title: '租户id',
+					type: 'input',
+					value: 1,
+					column: {
+						show:false,
+						minWidth: 120,
+					},
+					// dict: dict({
+					// 	url: '/api/system/tenant/list/',
+					// 	value: 'id', 
+					// 	label: 'name'
+					// }),
+					form: {
+						value:1,
+						show:false,
+						component: { placeholder: '请填租户id' },
+						rules: [{ required: false, message: '请填租户id' }],
+					},
+				},
+				category:{
+					show: false,
+					title: '设备类别',
+					search: { show: false },
+					type: 'dict-select',
+					column: { show: false,minWidth: 120 },
+					dict: dict({
+						url: '/api/system/device/category/',
+						value: 'id', 
+						label: 'name'
+					}),
+					form: {
+						component: { placeholder: '请输入设备类别' },
+						rules: [{ required: true, message: '请输入设备类别' }],
+					}
+				},
+				quantity:{
+					show: false,
+					title: '库存数量',
+					search: { show: false },
+					type: 'input',
+					column: { show: false,minWidth: 120 },
+					viewForm:{
+						component:{placeholder:""}
+					},
+					form: {
+						component: { placeholder: '请输入库存数量' },
+						rules: [{ required: true, message: '请输入库存数量' }],
+						valueBuilder({ form, value }) {
+							// form.tags =Array.from(String(value), Number);
+							form.quantity = form.total_quantity;
+
+						},
+					}
+				},
+				tags:{
+					show: false,
+					title: '设备标签',
+					search: { show: false },
+					type: 'dict-select',
+					column: { show: false,minWidth: 120 },
+					dict: dict({
+						url: '/api/system/device_tags/',
+						value: 'id', 
+						label: 'name'
+					}),
+					viewForm:{
+						component:{placeholder:""}
+					},
+					form: {
+						component: { placeholder: '请选择设备标签' },
+						rules: [{ required: true, message: '请选择设备标签' }],
+						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);
+
+						},
+					}
+				},
 				image:{			
 					title: '设备图片',
 					type: 'image-uploader',
@@ -356,8 +461,6 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 								accept: ".jpg,.png",
 								uploadRequest: async ({ action, file, onProgress }) => {
 									const token = Cookies.get('token'); 
-									// eslint-disable-next-line no-console
-									console.log("token:::",token);
 									const data = new FormData();
 									data.append("image", file);
 									return await request({
@@ -376,7 +479,7 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 								},
 								successHandle(ret) {
 									// eslint-disable-next-line no-console
-									console.log("ret.data.image_url:::",ret.data.image_url);
+									// console.log("ret.data.image_url:::",ret.data.image_url);
 
 									return {
 										url: getBaseURL(ret.data.image_url), 
@@ -416,72 +519,6 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 					// },
 	
 					
-				},
-				tenant_id:{
-					title: '租户id',
-					type: 'input',
-					value: 1,
-					column: {
-						show:false,
-						minWidth: 120,
-					},
-					// dict: dict({
-					// 	url: '/api/system/tenant/list/',
-					// 	value: 'id', 
-					// 	label: 'name'
-					// }),
-					form: {
-						value:1,
-						show:false,
-						component: { placeholder: '请填租户id' },
-						rules: [{ required: false, message: '请填租户id' }],
-					},
-				},
-				category:{
-					show: false,
-					title: '类别id',
-					search: { show: false },
-					type: 'dict-select',
-					column: { show: false,minWidth: 120 },
-					dict: dict({
-						url: '/api/system/device/category/',
-						value: 'id', 
-						label: 'name'
-					}),
-					form: {
-						component: { placeholder: '请输入类别id' }
-					}
-				},
-				quantity:{
-					show: false,
-					title: '库存数量',
-					search: { show: false },
-					type: 'input',
-					column: { show: false,minWidth: 120 },
-					form: {
-						component: { placeholder: '请输入库存数量' }
-					}
-				},
-				tags:{
-					show: false,
-					title: '设备标签',
-					search: { show: false },
-					type: 'dict-select',
-					column: { show: false,minWidth: 120 },
-					dict: dict({
-						url: '/api/system/device_tags/',
-						value: 'id', 
-						label: 'name'
-					}),
-					form: {
-						component: { placeholder: '请选择设备标签' },
-						valueResolve({ form, value }) {
-							form.tags = Array.from(String(value), Number);
-						},
-						valueBuilder({ form, value }) {
-							form.tags =Array.from(String(value), Number);
-						},
-					}
 				},
 				// maintenancename: {
 				// 	title: '维修名称',
@@ -516,7 +553,7 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 						}
 					},
 						icon: "el-icon-goods",
-						columns: ["code","category_name", "name", "status","borrowed_quantity","brand","specification","serial_number","warehouse","is_visible","department","purchase_date","supplier","price","warranty_expiration","image","tenant_id","category","quantity","tags"]
+						columns: ["code","category_name", "name", "status","borrowed_quantity","brand","specification","serial_number","warehouse","is_visible","department","purchase_date","supplier","price","warranty_expiration","tenant_id","category","quantity","tags","image"]
 					},
 					borrow: {
 						label: "借用记录",

+ 4 - 1
src/views/system/device/index.vue

@@ -22,4 +22,7 @@ onMounted(async () => {
 	crudExpose.doRefresh();
 });
 </script>
-<style lang="scss" scoped></style>
+<style  scoped>
+
+
+</style>