kllay 1 週間 前
コミット
0e94675709

+ 19 - 2
src/views/system/borrow/approval/api.ts

@@ -1,7 +1,7 @@
 import { AddReq, DelReq, EditReq, InfoReq, UserPageQuery } from '@fast-crud/fast-crud';
 import { request } from '/@/utils/service';
 
-export const apiPrefix = '/api/system/approval/workflow/';
+export const apiPrefix = '/api/system/borrow/application/?status=1';
 
 export function GetList(query: UserPageQuery) {
 	return request({
@@ -47,10 +47,27 @@ export function DelObj(id: DelReq) {
 
 
 
-export function switchspost(tenant_id:number) {
+export function Switchspost(tenant_id:number) {
 	return request({
 		url: '/api/system/tenant/switch/',
 		method: 'post',
 		data: {tenant_id},
 	});
 }
+
+
+export function BorrowingReview(id:number,action:string,remark:string) {
+	return request({
+		url: `/api/system/borrow/${id}/review/`,
+		method: 'post',
+		data: {action,remark},
+	});
+}
+
+// export function getUserInfo(id: number) {
+// 	request({
+// 		url: `/api/system/app_user/${id}/`,
+// 		method: 'get',
+// 	});
+//   }
+  

+ 112 - 115
src/views/system/borrow/approval/curd.tsx

@@ -1,6 +1,8 @@
 import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery } from '@fast-crud/fast-crud';
 import * as api from './api';
-import { switchspost } from './api';
+import { BorrowingReview, Switchspost } from './api';
+
+
 
 export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
 	const pageRequest = async (query: UserPageQuery) => {
@@ -31,7 +33,8 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 		return await api.AddObj(form);
 	};
 	//切换合作商
-	const res = switchspost(1);		;
+	const res = Switchspost(1);		
+
 
 	return {
 		crudOptions: {
@@ -42,6 +45,29 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 				editRequest,
 				delRequest,
 			},
+			toolbar:{show: false},
+			actionbar:{show:false},
+			rowHandle:{
+				show: true,
+				width: 330,
+				buttons: {
+					view: { show: false },
+					edit: { show: false },
+					remove: { show: false },
+				custom: {
+					text: "审批",
+					order: 5,
+					size: "small",
+					show: true,
+					click(context) {
+						// console.log("click", context);
+						// alert(context);
+						BorrowingReview(1,'approve','同意借用');
+					}
+				}
+				}
+
+			},
 			columns: {
 				_index: {
 					title: '序号',
@@ -57,164 +83,135 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 						},
 					},
 				},
-				name: {
-					title: '审批单名称',
+				application_no: {
+					title: '借用编号',
 					search: { show: true },
 					type: 'input',
 					column: { minWidth: 120 },
 					form: {
-						component: { placeholder: '请输入审批单名称' },
-						rules: [{ required: true, message: '请输入审批单名称' }],
+						show: false,
+						component: { placeholder: '请输入借用编号' },
+						rules: [{ required: false, message: '请输入借用编号' }],
 					},
 				},
-				workflow_type: {
-					title: '流程类型',
-					search: { show: true },
-					type: 'dict-select',
+				
+				borrow_type_label: {
+					title: '借用性质',
+					search: { show: false },
+					type: 'input',
 					column: { minWidth: 120 },
-					dict: dict({
-						data: [
-							{ label: '设备借用申请', value: 0 },
-							{ label: '设备维修申请', value: 1 },
-							{ label: '设备采购申请', value: 2 },
-							{ label: '其他申请', value: 3 },
-						],
-					}),
 					form: {
-						component: { placeholder: '请选择流程类型' },
-						rules: [{ required: true, message: '请选择流程类型' }],
+						show: false,
+						component: { placeholder: '请输入借用性质' },
+						rules: [{ required: false, message: '请输入借用编号' }],
 					},
 				},
-				description: {
-					title: '流程描述',
+				"borrower_info.user_code": {
+					title: '学号',
 					search: { show: false },
 					type: 'input',
 					column: { minWidth: 120 },
 					form: {
-						component: { placeholder: '请输入流程描述' },
-						rules: [{ required: false, message: '请输入流程描述' }],
+						show: false,
+						component: { placeholder: '请输入借用性质' },
+						rules: [{ required: false, message: '请输入借用编号' }],
 					},
 				},
-				is_active: {
-					title: '状态',
-					type: 'dict-select',
+				"borrower_info.name": {
+					title: '借用人',
 					search: { show: false },
-					dict: dict({
-						data: [
-							{ label: '启用', value: true },
-							{ label: '禁用', value: false },
-						],
-					}),
-					column: { minWidth: 100 },
+					type: 'input',
+					column: { minWidth: 120 },
 					form: {
-						component: { placeholder: '请选择状态' },
-						rules: [{ required: true, message: '请选择状态' }],
+						show: false,
+						component: { placeholder: '请输入借用性质' },
+						rules: [{ required: false, message: '请输入借用编号' }],
 					},
 				},
-				'trigger_conditions.equipment_categories': {
-					title: '分类列表',
-					type: 'dict-select',
+				"borrower_info.id": {
+					title: '联系电话',
 					search: { show: false },
+					type: 'dict-select',
 					column: {
-						minWidth: 160,
+						minWidth: 120
 					},
 					dict: dict({
-						url: '/api/system/device/category/',
+						url: "/api/system/app_user/", 
 						value: 'id', 
-						label: 'name'
-					}),
-					form: { 
-						component: { placeholder: '请选择分类列表' },
-						valueResolve({ form, value }) {
-							form.trigger_conditions.equipment_categories =[value];
-						},
-						// valueBuilder({ form, value }) {
-						// 	form.trigger_conditions.equipment_categories =Array.from(value);
-						// },
-				},
+						label: 'mobile' }),
+					form: {
+						show: false,
+						component: { placeholder: '请输入联系电话' },
+						rules: [{ required: false, message: '请输入借用编号' }],
+					}
+
 				},
-				'trigger_conditions.borrow_types': {
-					title: '借用类型',
-					type: 'dict-select',
+				team_type_label: {
+					title: '个人/团队',
 					search: { show: false },
-					
-					column: {
-						minWidth: 160,
-						// formatter: ({ value }) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '')
+					type: 'input',
+					column: { minWidth: 120 },
+					form: {
+						show: false,
+						component: { placeholder: '请输入借用性质' },
+						rules: [{ required: false, message: '请输入借用编号' }],
 					},
-					dict: dict({
-						data: [
-							{ label: '常规借用', value: "0" },
-							{ label: '课堂借用', value: '1' },
-							{ label: '特殊借用', value: '2' },
-						],
-					}),
-					form: { 
-						component: { placeholder: '请选择借用类型' },
-						valueResolve({ form, value }) {
-							form.trigger_conditions.borrow_types = [value];
-						},
-						// valueBuilder({ form, value }) {
-						// 	form.trigger_conditions.borrow_types=Array.from(value);
-						// },
+				},
+				expected_start_time: {
+					title: '创建时间',
+					search: { show: false },
+					type: 'input',
+					column: { minWidth: 120 },
+					form: {
+						show: false,
+						component: { placeholder: '请输入借用性质' },
+						rules: [{ required: false, message: '请输入借用编号' }],
 					},
 				},
-				'trigger_conditions.team_type': {
-					title: '借用方式',
-					type: 'dict-select',
+				expected_end_time: {
+					title: '预计归还时间',
 					search: { show: false },
+					type: 'input',
 					column: { minWidth: 120 },
-					dict: dict({
-						data: [
-							{ label: '个人借用', value: '0' },
-							{ label: '团队借用', value: '1' },
-						],
-					}),
 					form: {
-						component: { placeholder: '请选择借用方式' },
-						valueResolve({ form, value }) {
-							form.trigger_conditions.team_type =[value];
-						},
+						show: false,
+						component: { placeholder: '请输入借用性质' },
+						rules: [{ required: false, message: '请输入借用编号' }],
 					},
 				},
-				'trigger_conditions.user_types': {
-					title: '用户类型',
-					type: 'dict-select',
+				status_label: {
+					title: '当前状态',
 					search: { show: false },
+					type: 'input',
 					column: { minWidth: 120 },
-					dict: dict({
-						data: [
-							{ label: '学生', value: 'student' },
-							{ label: '老师', value: 'teacher' },
-						],
-					}),
 					form: {
-						component: { placeholder: '请选择用户类型' },
-						valueResolve({ form, value }) {
-							form.trigger_conditions.user_types =[value];
-						},
+						show: false,
+						component: { placeholder: '请输入借用性质' },
+						rules: [{ required: false, message: '请输入借用编号' }],
 					},
 				},
-				tenant_id:{
-					title: '租户id',
-					type: 'dict-select',
-					column: {
+				status: {
+					title: '当前审批人',
+					search: { show: false },
+					type: 'input',
+					column: { minWidth: 120 },
+					form: {
 						show: false,
-						minWidth: 120,
+						component: { placeholder: '请输入借用性质' },
+						rules: [{ required: false, message: '请输入借用编号' }],
 					},
-					dict: dict({
-						url: '/api/system/tenant/list/',
-						value: 'id', 
-						label: 'name'
-					}),
+				},
+				return_location: {
+					title: '存放仓库',
+					search: { show: false },
+					type: 'input',
+					column: { minWidth: 120 },
 					form: {
-						component: { placeholder: '请填租户id' },
-						rules: [{ required: false, message: '请填租户id' }],
+						show: false,
+						component: { placeholder: '请输入借用性质' },
+						rules: [{ required: false, message: '请输入借用编号' }],
 					},
 				},
-
-		
-			
 		
 		
 		

+ 56 - 0
src/views/system/borrow/processcreate/api.ts

@@ -0,0 +1,56 @@
+import { AddReq, DelReq, EditReq, InfoReq, UserPageQuery } from '@fast-crud/fast-crud';
+import { request } from '/@/utils/service';
+
+export const apiPrefix = '/api/system/approval/workflow/';
+
+export function GetList(query: UserPageQuery) {
+	return request({
+		url: apiPrefix,
+		method: 'get',
+		params: query,
+	});
+}
+
+export function GetObj(id: InfoReq) {
+	return request({
+		url: apiPrefix + id,
+		method: 'get',
+	});
+}
+
+export function AddObj(obj: AddReq) {
+	return request({
+		url: apiPrefix,
+		method: 'post',
+		data: obj,
+		// headers:{
+		// 	"Authorization":"JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzgzMjIyOTM2LCJpYXQiOjE3NTE2ODY5MzYsImp0aSI6ImMxNmQ4N2Y0NzdhMTQwN2FiN2Q3MmY3OTA2YzdhNmYwIiwidXNlcl9pZCI6MX0.NGSukWjyl_WlpMBAQ3VyGtc5O5ZRgdTlAjp0cEtgoLw"
+		// }
+	});
+}
+
+export function UpdateObj(obj: EditReq) {
+	return request({
+		url: apiPrefix + obj.id + '/',
+		method: 'put',
+		data: obj,
+	});
+}
+
+export function DelObj(id: DelReq) {
+	return request({
+		url: apiPrefix + id + '/',
+		method: 'delete',
+		data: { id },
+	});
+}
+
+
+
+export function switchspost(tenant_id:number) {
+	return request({
+		url: '/api/system/tenant/switch/',
+		method: 'post',
+		data: {tenant_id},
+	});
+}

+ 224 - 0
src/views/system/borrow/processcreate/curd.tsx

@@ -0,0 +1,224 @@
+import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery } from '@fast-crud/fast-crud';
+import * as api from './api';
+import { switchspost } from './api';
+
+export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
+	const pageRequest = async (query: UserPageQuery) => {
+		try {
+			const res = await api.GetList(query);
+			return {
+				...res,
+				records: res.data,
+				total: res.total,
+			};
+		} catch (error) {
+			return {
+				code: 2000,
+				msg: 'success',
+				records: [],
+				total: 0,
+			};
+		}
+	};
+	const editRequest = async ({ form, row }: EditReq) => {
+		form.id = row.id;
+		return await api.UpdateObj(form);
+	};
+	const delRequest = async ({ row }: DelReq) => {
+		return await api.DelObj(row.id);
+	};
+	const addRequest = async ({ form }: AddReq) => {
+		return await api.AddObj(form);
+	};
+	//切换合作商
+	const res = switchspost(1);		;
+
+	return {
+		crudOptions: {
+			request: {
+				// switchspost,
+				pageRequest,
+				addRequest,
+				editRequest,
+				delRequest,
+			},
+			columns: {
+				_index: {
+					title: '序号',
+					form: { show: false },
+					column: {
+						align: 'center',
+						width: '70px',
+						columnSetDisabled: true,
+						formatter: (context) => {
+							let index = context.index ?? 1;
+							let pagination = crudExpose!.crudBinding.value.pagination;
+							return ((pagination!.currentPage ?? 1) - 1) * pagination!.pageSize + index + 1;
+						},
+					},
+				},
+				name: {
+					title: '审批单名称',
+					search: { show: true },
+					type: 'input',
+					column: { minWidth: 120 },
+					form: {
+						component: { placeholder: '请输入审批单名称' },
+						rules: [{ required: true, message: '请输入审批单名称' }],
+					},
+				},
+				workflow_type: {
+					title: '流程类型',
+					search: { show: true },
+					type: 'dict-select',
+					column: { minWidth: 120 },
+					dict: dict({
+						data: [
+							{ label: '设备借用申请', value: 0 },
+							{ label: '设备维修申请', value: 1 },
+							{ label: '设备采购申请', value: 2 },
+							{ label: '其他申请', value: 3 },
+						],
+					}),
+					form: {
+						component: { placeholder: '请选择流程类型' },
+						rules: [{ required: true, message: '请选择流程类型' }],
+					},
+				},
+				description: {
+					title: '流程描述',
+					search: { show: false },
+					type: 'input',
+					column: { minWidth: 120 },
+					form: {
+						component: { placeholder: '请输入流程描述' },
+						rules: [{ required: false, message: '请输入流程描述' }],
+					},
+				},
+				is_active: {
+					title: '状态',
+					type: 'dict-select',
+					search: { show: false },
+					dict: dict({
+						data: [
+							{ label: '启用', value: true },
+							{ label: '禁用', value: false },
+						],
+					}),
+					column: { minWidth: 100 },
+					form: {
+						component: { placeholder: '请选择状态' },
+						rules: [{ required: true, message: '请选择状态' }],
+					},
+				},
+				'trigger_conditions.equipment_categories': {
+					title: '分类列表',
+					type: 'dict-select',
+					search: { show: false },
+					column: {
+						minWidth: 160,
+					},
+					dict: dict({
+						url: '/api/system/device/category/',
+						value: 'id', 
+						label: 'name'
+					}),
+					form: { 
+						component: { placeholder: '请选择分类列表' },
+						valueResolve({ form, value }) {
+							form.trigger_conditions.equipment_categories =[value];
+						},
+						// valueBuilder({ form, value }) {
+						// 	form.trigger_conditions.equipment_categories =Array.from(value);
+						// },
+				},
+				},
+				'trigger_conditions.borrow_types': {
+					title: '借用类型',
+					type: 'dict-select',
+					search: { show: false },
+					
+					column: {
+						minWidth: 160,
+						// formatter: ({ value }) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '')
+					},
+					dict: dict({
+						data: [
+							{ label: '常规借用', value: "0" },
+							{ label: '课堂借用', value: '1' },
+							{ label: '特殊借用', value: '2' },
+						],
+					}),
+					form: { 
+						component: { placeholder: '请选择借用类型' },
+						valueResolve({ form, value }) {
+							form.trigger_conditions.borrow_types = [value];
+						},
+						// valueBuilder({ form, value }) {
+						// 	form.trigger_conditions.borrow_types=Array.from(value);
+						// },
+					},
+				},
+				'trigger_conditions.team_type': {
+					title: '借用方式',
+					type: 'dict-select',
+					search: { show: false },
+					column: { minWidth: 120 },
+					dict: dict({
+						data: [
+							{ label: '个人借用', value: '0' },
+							{ label: '团队借用', value: '1' },
+						],
+					}),
+					form: {
+						component: { placeholder: '请选择借用方式' },
+						valueResolve({ form, value }) {
+							form.trigger_conditions.team_type =[value];
+						},
+					},
+				},
+				'trigger_conditions.user_types': {
+					title: '用户类型',
+					type: 'dict-select',
+					search: { show: false },
+					column: { minWidth: 120 },
+					dict: dict({
+						data: [
+							{ label: '学生', value: 'student' },
+							{ label: '老师', value: 'teacher' },
+						],
+					}),
+					form: {
+						component: { placeholder: '请选择用户类型' },
+						valueResolve({ form, value }) {
+							form.trigger_conditions.user_types =[value];
+						},
+					},
+				},
+				tenant_id:{
+					title: '租户id',
+					type: 'dict-select',
+					column: {
+						show: false,
+						minWidth: 120,
+					},
+					dict: dict({
+						url: '/api/system/tenant/list/',
+						value: 'id', 
+						label: 'name'
+					}),
+					form: {
+						component: { placeholder: '请填租户id' },
+						rules: [{ required: false, message: '请填租户id' }],
+					},
+				},
+
+		
+			
+		
+		
+		
+		},
+		},
+	};
+};

+ 19 - 0
src/views/system/borrow/processcreate/index.vue

@@ -0,0 +1,19 @@
+<template>
+	<fs-page>
+		<fs-crud ref="crudRef" v-bind="crudBinding" />
+	</fs-page>
+</template>
+
+<script lang="ts" setup name="processcreate">
+import { useFs } from '@fast-crud/fast-crud';
+import { onMounted } from 'vue';
+import { createCrudOptions } from './curd';
+
+const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
+
+onMounted(() => {
+	crudExpose.doRefresh();
+});
+</script>
+
+<style scoped lang="scss"></style>