kllay 5 дней назад
Родитель
Сommit
986cbbd9af

+ 48 - 0
src/views/system/borrowingnotice/api.ts

@@ -0,0 +1,48 @@
+import { AddReq,EditReq, DelReq,UserPageQuery } from '@fast-crud/fast-crud';
+import { request } from '/@/utils/service';
+
+export const apiPrefix = '/api/system/articles/';
+export function GetList(query: UserPageQuery) {
+	return request({
+		url: apiPrefix+"by-type/borrow_rules/",
+		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,
+	});
+}
+
+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 GetPermission() {
+    return request({
+        url: apiPrefix+"by-type/borrow_rules/",
+        method: 'get',
+    });
+}

+ 162 - 0
src/views/system/borrowingnotice/crud.tsx

@@ -0,0 +1,162 @@
+import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, UserPageQuery,EditReq ,DelReq} from '@fast-crud/fast-crud';
+import * as api from './api';
+import { auth } from '/@/utils/authFunction';
+
+
+export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
+	const pageRequest = async (query: UserPageQuery) => {
+		return await api.GetList(query);
+	};
+	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);
+	};
+
+	return {
+		crudOptions: {
+			request: {
+				pageRequest,
+				addRequest,
+				editRequest,
+				delRequest,
+
+			},
+			actionbar: {
+				buttons: {
+					add: {
+						show: auth('area:Create'),
+					},
+				},
+			},
+			toolbar:{
+				show:false,
+			},
+			rowHandle:{
+				buttons:{
+					remove:{
+						show:true,
+					},
+					edit:{
+						show:true,
+					}
+
+				}
+
+			},
+			pagination: {
+				show: false,
+			},		
+			columns: {
+				_index: {
+					title: '序号',
+					form: { show: false },
+					column: {
+						type: 'index',
+						align: 'center',
+						width: '70px',
+						columnSetDisabled: true, //禁止在列设置中选择
+					},
+				},
+				title: {
+					title: '标题',
+					search: {
+						show: false,
+					},
+					treeNode: true,
+					type: 'input',
+					column: {
+						minWidth: 120,
+					},
+					form: {
+						rules: [
+							// 表单校验规则
+							{ required: true, message: '标题必填项' },
+						],
+						component: {
+							placeholder: '请输入标题',
+						},
+					},
+				},
+				content:{
+					title: '内容',
+					type: 'textarea',
+					column: {
+						show:true,
+						minWidth: 120,
+					},
+					form: {
+						col: {
+							span: 24
+						},
+						component: { showWordLimit: true, maxlength: 200 , placeholder: '请填写内容' },
+						rules: [{ 
+							required: true,
+								message: '内容为必填项',
+							}],
+					},
+				},
+				publisher_name:{
+					title: '发布人',
+					type: 'input',
+					column: {
+						minWidth: 120,
+					},
+					form: {
+						show:false,
+						component: { placeholder: '请填发布人' },
+						rules: [{ required: false, message: '请填写发布人' }],
+					},
+				},
+				publish_time:{
+					title: '发布时间',
+					type: 'input',
+					column: {
+						minWidth: 120,
+					},
+					form: {
+						show:false,
+						component: { placeholder: '请填写发布时间' },
+						rules: [{ required: false, message: '请填写发布时间' }],
+					},
+				},
+				article_type:{
+					title: '是否在顶部',
+					type: 'input',
+					column: {
+						show:false,
+						minWidth: 120,
+					},
+					form: {
+						value:"borrow_rules",
+						show:false,
+						component: { placeholder: '请填写是否在顶部' },
+						rules: [{ required: false, message: '请填写是否在顶部' }],
+					},
+				},
+				status:{
+					title: '状态',
+					type: 'input',
+					column: {
+						show:false,
+						minWidth: 120,
+					},
+					form: {
+						value:1,
+						show:false,
+						component: { placeholder: '请填写状态' },
+						rules: [{ required: false, message: '请填写状态' }],
+					},
+				},
+
+
+
+			},
+		},
+	};
+};

+ 25 - 0
src/views/system/borrowingnotice/index.vue

@@ -0,0 +1,25 @@
+<template>
+	<fs-page>
+		<fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>
+	</fs-page>
+</template>
+
+<script lang="ts" setup name="borrowingnotice">
+import { useFs } from '@fast-crud/fast-crud';
+import { onMounted } from 'vue';
+import { GetList } from './api';
+import { createCrudOptions } from './crud';
+import { handleColumnPermission } from '/@/utils/columnPermission';
+
+const { crudBinding, crudRef, crudExpose, crudOptions, resetCrudOptions } = useFs({ createCrudOptions });
+
+// 页面打开后获取列表数据
+onMounted(async () => {
+	// 设置列权限
+	const newOptions = await handleColumnPermission(GetList, crudOptions);
+	//重置crudBinding
+	resetCrudOptions(newOptions);
+	// 刷新
+	crudExpose.doRefresh();
+});
+</script>

+ 48 - 0
src/views/system/devicemanual/api.ts

@@ -0,0 +1,48 @@
+import { AddReq,EditReq, DelReq,UserPageQuery } from '@fast-crud/fast-crud';
+import { request } from '/@/utils/service';
+
+export const apiPrefix = '/api/system/articles/';
+export function GetList(query: UserPageQuery) {
+	return request({
+		url: apiPrefix+"?article_type=device_manual",
+		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,
+	});
+}
+
+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 GetPermission() {
+    return request({
+        url: apiPrefix,
+        method: 'get',
+    });
+}

+ 162 - 0
src/views/system/devicemanual/crud.tsx

@@ -0,0 +1,162 @@
+import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, UserPageQuery,EditReq ,DelReq} from '@fast-crud/fast-crud';
+import * as api from './api';
+import { auth } from '/@/utils/authFunction';
+
+
+export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
+	const pageRequest = async (query: UserPageQuery) => {
+		return await api.GetList(query);
+	};
+	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);
+	};
+
+	return {
+		crudOptions: {
+			request: {
+				pageRequest,
+				addRequest,
+				editRequest,
+				delRequest,
+
+			},
+			actionbar: {
+				buttons: {
+					add: {
+						show: auth('area:Create'),
+					},
+				},
+			},
+			toolbar:{
+				show:false,
+			},
+			rowHandle:{
+				buttons:{
+					remove:{
+						show:true,
+					},
+					edit:{
+						show:true,
+					}
+
+				}
+
+			},
+			pagination: {
+				show: false,
+			},		
+			columns: {
+				_index: {
+					title: '序号',
+					form: { show: false },
+					column: {
+						type: 'index',
+						align: 'center',
+						width: '70px',
+						columnSetDisabled: true, //禁止在列设置中选择
+					},
+				},
+				title: {
+					title: '标题',
+					search: {
+						show: false,
+					},
+					treeNode: true,
+					type: 'input',
+					column: {
+						minWidth: 120,
+					},
+					form: {
+						rules: [
+							// 表单校验规则
+							{ required: true, message: '标题必填项' },
+						],
+						component: {
+							placeholder: '请输入标题',
+						},
+					},
+				},
+				content:{
+					title: '内容',
+					type: 'textarea',
+					column: {
+						show:true,
+						minWidth: 120,
+					},
+					form: {
+						col: {
+							span: 24
+						},
+						component: { showWordLimit: true, maxlength: 200 ,placeholder: '请填写内容' },
+						rules: [{ 
+							required: true,
+								message: '内容为必填项',
+							}],
+					},
+				},
+				publisher_name:{
+					title: '发布人',
+					type: 'input',
+					column: {
+						minWidth: 120,
+					},
+					form: {
+						show:false,
+						component: { placeholder: '请填发布人' },
+						rules: [{ required: false, message: '请填写发布人' }],
+					},
+				},
+				publish_time:{
+					title: '发布时间',
+					type: 'input',
+					column: {
+						minWidth: 120,
+					},
+					form: {
+						show:false,
+						component: { placeholder: '请填写发布时间' },
+						rules: [{ required: false, message: '请填写发布时间' }],
+					},
+				},
+				article_type:{
+					title: '是否在顶部',
+					type: 'input',
+					column: {
+						show:false,
+						minWidth: 120,
+					},
+					form: {
+						value:"borrow_rules",
+						show:false,
+						component: { placeholder: '请填写是否在顶部' },
+						rules: [{ required: false, message: '请填写是否在顶部' }],
+					},
+				},
+				status:{
+					title: '状态',
+					type: 'input',
+					column: {
+						show:false,
+						minWidth: 120,
+					},
+					form: {
+						value:1,
+						show:false,
+						component: { placeholder: '请填写状态' },
+						rules: [{ required: false, message: '请填写状态' }],
+					},
+				},
+
+
+
+			},
+		},
+	};
+};

+ 25 - 0
src/views/system/devicemanual/index.vue

@@ -0,0 +1,25 @@
+<template>
+	<fs-page>
+		<fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>
+	</fs-page>
+</template>
+
+<script lang="ts" setup name="devicemanual">
+import { useFs } from '@fast-crud/fast-crud';
+import { onMounted } from 'vue';
+import { GetList } from './api';
+import { createCrudOptions } from './crud';
+import { handleColumnPermission } from '/@/utils/columnPermission';
+
+const { crudBinding, crudRef, crudExpose, crudOptions, resetCrudOptions } = useFs({ createCrudOptions });
+
+// 页面打开后获取列表数据
+onMounted(async () => {
+	// 设置列权限
+	const newOptions = await handleColumnPermission(GetList, crudOptions);
+	//重置crudBinding
+	resetCrudOptions(newOptions);
+	// 刷新
+	crudExpose.doRefresh();
+});
+</script>

+ 48 - 0
src/views/system/noticelist/api.ts

@@ -0,0 +1,48 @@
+import { AddReq,EditReq, DelReq,UserPageQuery } from '@fast-crud/fast-crud';
+import { request } from '/@/utils/service';
+
+export const apiPrefix = '/api/system/announcements/';
+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,
+	});
+}
+
+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 GetPermission() {
+    return request({
+        url: apiPrefix,
+        method: 'get',
+    });
+}

+ 162 - 0
src/views/system/noticelist/crud.tsx

@@ -0,0 +1,162 @@
+import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, UserPageQuery ,EditReq,DelReq} from '@fast-crud/fast-crud';
+import * as api from './api';
+import { auth } from '/@/utils/authFunction';
+
+
+export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
+	const pageRequest = async (query: UserPageQuery) => {
+		return await api.GetList(query);
+	};
+	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);
+	};
+
+	return {
+		crudOptions: {
+			request: {
+				pageRequest,
+				addRequest,
+				editRequest,
+				delRequest,
+
+			},
+			actionbar: {
+				buttons: {
+					add: {
+						show: auth('area:Create'),
+					},
+				},
+			},
+			toolbar:{
+				show:false,
+			},
+			rowHandle:{
+				buttons:{
+					remove:{
+						show:true,
+					},
+					edit:{
+						show:true,
+					}
+
+				}
+
+			},
+			pagination: {
+				show: false,
+			},		
+			columns: {
+				_index: {
+					title: '序号',
+					form: { show: false },
+					column: {
+						type: 'index',
+						align: 'center',
+						width: '70px',
+						columnSetDisabled: true, //禁止在列设置中选择
+					},
+				},
+				title: {
+					title: '公告标题',
+					search: {
+						show: true,
+					},
+					treeNode: true,
+					type: 'input',
+					column: {
+						minWidth: 120,
+					},
+					form: {
+						rules: [
+							// 表单校验规则
+							{ required: true, message: '公告标题必填项' },
+						],
+						component: {
+							placeholder: '请输入公告标题',
+						},
+					},
+				},
+				content:{
+					title: '公告内容',
+					type: 'textarea',
+					column: {
+						show:true,
+						minWidth: 120,
+					},
+					form: {
+						col: {
+							span: 24
+						},
+						component: { showWordLimit: true, maxlength: 200 ,placeholder: '请填写公告内容' },
+						rules: [{ 
+							required: true,
+								message: '内容为必填项',
+							}],
+					},
+				},
+				publisher_name:{
+					title: '发布人',
+					type: 'input',
+					column: {
+						minWidth: 120,
+					},
+					form: {
+						show:false,
+						component: { placeholder: '请填发布人' },
+						rules: [{ required: false, message: '请填写发布人' }],
+					},
+				},
+				publish_time:{
+					title: '发布时间',
+					type: 'input',
+					column: {
+						minWidth: 120,
+					},
+					form: {
+						show:false,
+						component: { placeholder: '请填写发布时间' },
+						rules: [{ required: false, message: '请填写发布时间' }],
+					},
+				},
+				is_top:{
+					title: '是否在顶部',
+					type: 'input',
+					column: {
+						show:false,
+						minWidth: 120,
+					},
+					form: {
+						value:true,
+						show:false,
+						component: { placeholder: '请填写是否在顶部' },
+						rules: [{ required: false, message: '请填写是否在顶部' }],
+					},
+				},
+				status:{
+					title: '状态',
+					type: 'input',
+					column: {
+						show:false,
+						minWidth: 120,
+					},
+					form: {
+						value:1,
+						show:false,
+						component: { placeholder: '请填写状态' },
+						rules: [{ required: false, message: '请填写状态' }],
+					},
+				},
+
+
+
+			},
+		},
+	};
+};

+ 25 - 0
src/views/system/noticelist/index.vue

@@ -0,0 +1,25 @@
+<template>
+	<fs-page>
+		<fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>
+	</fs-page>
+</template>
+
+<script lang="ts" setup name="noticelist">
+import { useFs } from '@fast-crud/fast-crud';
+import { onMounted } from 'vue';
+import { GetPermission } from './api';
+import { createCrudOptions } from './crud';
+import { handleColumnPermission } from '/@/utils/columnPermission';
+
+const { crudBinding, crudRef, crudExpose, crudOptions, resetCrudOptions } = useFs({ createCrudOptions });
+
+// 页面打开后获取列表数据
+onMounted(async () => {
+	// 设置列权限
+	const newOptions = await handleColumnPermission(GetPermission, crudOptions);
+	//重置crudBinding
+	resetCrudOptions(newOptions);
+	// 刷新
+	crudExpose.doRefresh();
+});
+</script>