|
@@ -1,12 +1,28 @@
|
|
|
-import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery } from '@fast-crud/fast-crud';
|
|
|
+import {
|
|
|
+ AddReq,
|
|
|
+ CreateCrudOptionsProps,
|
|
|
+ CreateCrudOptionsRet,
|
|
|
+ DelReq,
|
|
|
+ dict,
|
|
|
+ EditReq,
|
|
|
+ FormWrapperContext,
|
|
|
+ ScopeContext,
|
|
|
+ UserPageQuery,
|
|
|
+ UserPageRes,
|
|
|
+ utils
|
|
|
+ } from '@fast-crud/fast-crud';
|
|
|
import * as api from './api';
|
|
|
import { BorrowingReview, Switchspost } from './api';
|
|
|
-import { ElMessage } from 'element-plus';
|
|
|
-import { Ref } from 'vue';
|
|
|
+import { ElMessage , ElInput, ElDialog, ElButton } from 'element-plus';
|
|
|
+import dayjs from 'dayjs';
|
|
|
+import { h, ref, computed } from "vue";
|
|
|
|
|
|
+export const createCrudOptions = function ({ crudExpose ,context, showRejectDialog, rejectReason, currentFormId }: CreateCrudOptionsProps& {
|
|
|
+ showRejectDialog: Ref<boolean>,
|
|
|
+ rejectReason: Ref<string>,
|
|
|
+ currentFormId: Ref<number | null>
|
|
|
+ }): CreateCrudOptionsRet {
|
|
|
|
|
|
-
|
|
|
-export const createCrudOptions = function ({ crudExpose ,approvalDialogRef}: CreateCrudOptionsProps& { approvalDialogRef: Ref<any> }): CreateCrudOptionsRet {
|
|
|
const pageRequest = async (query: UserPageQuery) => {
|
|
|
try {
|
|
|
const res = await api.GetList(query);
|
|
@@ -47,6 +63,35 @@ export const createCrudOptions = function ({ crudExpose ,approvalDialogRef}: Cre
|
|
|
editRequest,
|
|
|
delRequest,
|
|
|
},
|
|
|
+ form: {
|
|
|
+ labelWidth: computed(() => {
|
|
|
+ return context.labelWidthRef?.value ? context.labelWidthRef.value + "px" : "100px";
|
|
|
+ }),
|
|
|
+ wrapper: {
|
|
|
+ buttons: {
|
|
|
+ ok: {
|
|
|
+ text: "通过",
|
|
|
+ click: async (ctx: FormWrapperContext) => {
|
|
|
+ await api.BorrowingReview(ctx.form.id, "approve", "同意借用");
|
|
|
+ ElMessage.success("审批通过");
|
|
|
+ ctx.close();
|
|
|
+ crudExpose.doRefresh();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ reject: {
|
|
|
+ text: "拒绝",
|
|
|
+ type: "danger",
|
|
|
+ click: async (context: FormWrapperContext) => {
|
|
|
+ currentFormId.value = context.form.id;
|
|
|
+ showRejectDialog.value = true;
|
|
|
+ context.close();
|
|
|
+ crudExpose.doRefresh();
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
search:{
|
|
|
show:true,
|
|
|
label:"搜索",
|
|
@@ -57,35 +102,48 @@ export const createCrudOptions = function ({ crudExpose ,approvalDialogRef}: Cre
|
|
|
},
|
|
|
},
|
|
|
toolbar:{show: false},
|
|
|
- actionbar:{show:false},
|
|
|
+ actionbar:{show:false},
|
|
|
rowHandle:{
|
|
|
fixed:'right',
|
|
|
width: 100,
|
|
|
show: true,
|
|
|
buttons: {
|
|
|
- view: { show: false },
|
|
|
+ view: {
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
edit: { show: false },
|
|
|
remove: { show: false },
|
|
|
- custom: {
|
|
|
- text: "审批",
|
|
|
- order: 5,
|
|
|
- size: "small",
|
|
|
- show: true,
|
|
|
- click({row}) {
|
|
|
- // eslint-disable-next-line no-console
|
|
|
- // console.log("click", context);
|
|
|
- // alert(context);
|
|
|
- try{
|
|
|
- approvalDialogRef.value.openApprovalDialog(row);
|
|
|
- // BorrowingReview(context.row.id,'approve','同意借用');
|
|
|
- // ElMessage.success('审批通过');
|
|
|
- }catch(err){
|
|
|
- // eslint-disable-next-line no-console
|
|
|
- console.log("error:::::", err);
|
|
|
- ElMessage.error("系统错误!");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // custom: {
|
|
|
+ // text: "审批",
|
|
|
+ // order: 5,
|
|
|
+ // size: "small",
|
|
|
+ // show: true,
|
|
|
+ // click({row}) {
|
|
|
+ // // eslint-disable-next-line no-console
|
|
|
+ // // console.log("click", context);
|
|
|
+ // // alert(context);
|
|
|
+ // try{
|
|
|
+ // // approvalDialogRef.value.openApprovalDialog(row);
|
|
|
+ // // BorrowingReview(context.row.id,'approve','同意借用');
|
|
|
+ // // ElMessage.success('审批通过');
|
|
|
+ // }catch(err){
|
|
|
+ // // eslint-disable-next-line no-console
|
|
|
+ // console.log("error:::::", err);
|
|
|
+ // ElMessage.error("系统错误!");
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // customView: {
|
|
|
+ // text: '审批',
|
|
|
+ // type: 'primary',
|
|
|
+ // size: 'small',
|
|
|
+ // order: 1,
|
|
|
+ // show: true,
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
},
|
|
@@ -105,24 +163,24 @@ export const createCrudOptions = function ({ crudExpose ,approvalDialogRef}: Cre
|
|
|
},
|
|
|
},
|
|
|
application_no: {
|
|
|
- title: '借用编号',
|
|
|
+ title: '借用单编号',
|
|
|
search: { show: false },
|
|
|
type: 'input',
|
|
|
column: { minWidth: 120 },
|
|
|
form: {
|
|
|
- show: false,
|
|
|
+ show: true,
|
|
|
component: { placeholder: '请输入借用编号' },
|
|
|
rules: [{ required: false, message: '请输入借用编号' }],
|
|
|
},
|
|
|
},
|
|
|
-
|
|
|
+ borrower_type_label: { title: '借用人角色', column: { minWidth: 100 } },
|
|
|
borrow_type_label: {
|
|
|
title: '借用性质',
|
|
|
search: { show: false },
|
|
|
type: 'input',
|
|
|
column: { minWidth: 120 },
|
|
|
form: {
|
|
|
- show: false,
|
|
|
+ show: true,
|
|
|
component: { placeholder: '请输入借用性质' },
|
|
|
rules: [{ required: false, message: '请输入借用性质' }],
|
|
|
},
|
|
@@ -133,7 +191,7 @@ export const createCrudOptions = function ({ crudExpose ,approvalDialogRef}: Cre
|
|
|
type: 'input',
|
|
|
column: { minWidth: 120 },
|
|
|
form: {
|
|
|
- show: false,
|
|
|
+ show: true,
|
|
|
component: { placeholder: '请输入学号/工号' },
|
|
|
rules: [{ required: false, message: '请输入学号/工号' }],
|
|
|
},
|
|
@@ -144,7 +202,7 @@ export const createCrudOptions = function ({ crudExpose ,approvalDialogRef}: Cre
|
|
|
type: 'input',
|
|
|
column: { minWidth: 120 },
|
|
|
form: {
|
|
|
- show: false,
|
|
|
+ show: true,
|
|
|
component: { placeholder: '请输入借用人' },
|
|
|
rules: [{ required: false, message: '请输入借用人' }],
|
|
|
},
|
|
@@ -157,7 +215,7 @@ export const createCrudOptions = function ({ crudExpose ,approvalDialogRef}: Cre
|
|
|
minWidth: 120
|
|
|
},
|
|
|
form: {
|
|
|
- show: false,
|
|
|
+ show: true,
|
|
|
component: { placeholder: '请输入联系方式' },
|
|
|
rules: [{ required: false, message: '请输入联系方式' }],
|
|
|
}
|
|
@@ -169,66 +227,81 @@ export const createCrudOptions = function ({ crudExpose ,approvalDialogRef}: Cre
|
|
|
type: 'input',
|
|
|
column: { minWidth: 120 },
|
|
|
form: {
|
|
|
- show: false,
|
|
|
+ show: true,
|
|
|
component: { placeholder: '请输入个人/团队' },
|
|
|
rules: [{ required: false, message: '请输入个人/团队' }],
|
|
|
},
|
|
|
},
|
|
|
- expected_start_time: {
|
|
|
+ team_members: { title: '团队成员', column: { show:false,minWidth: 120 } },
|
|
|
+ team_members_count: { title: '团队人数', column: { show:false,minWidth: 80 }},
|
|
|
+ create_datetime: {
|
|
|
title: '创建时间',
|
|
|
search: { show: false },
|
|
|
type: 'input',
|
|
|
column: { minWidth: 120 },
|
|
|
form: {
|
|
|
- show: false,
|
|
|
+ show: true,
|
|
|
component: { placeholder: '请输入创建时间' },
|
|
|
rules: [{ required: false, message: '请输入创建时间' }],
|
|
|
},
|
|
|
},
|
|
|
+ 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:ss') : '') },
|
|
|
+ },
|
|
|
expected_end_time: {
|
|
|
- title: '预计归还时间',
|
|
|
+ title: '预计归还',
|
|
|
search: { show: false },
|
|
|
type: 'input',
|
|
|
column: { minWidth: 120 },
|
|
|
form: {
|
|
|
- show: false,
|
|
|
+ show: true,
|
|
|
component: { placeholder: '请输入预计归还时间' },
|
|
|
rules: [{ required: false, message: '请输入预计归还时间' }],
|
|
|
},
|
|
|
},
|
|
|
- status_label: {
|
|
|
- title: '当前状态',
|
|
|
- search: { show: false },
|
|
|
- type: 'input',
|
|
|
- column: { minWidth: 120 },
|
|
|
- form: {
|
|
|
- show: false,
|
|
|
- component: { placeholder: '请输入当前状态' },
|
|
|
- rules: [{ required: false, message: '请输入当前状态' }],
|
|
|
- },
|
|
|
+ actual_end_time: {
|
|
|
+ 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:true, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '') },
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ approve_time: {
|
|
|
+ title: '审批时间',
|
|
|
+ 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: { show:false,minWidth: 160, formatter: ({ value }: any) => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : '') },
|
|
|
},
|
|
|
- status: {
|
|
|
+
|
|
|
+
|
|
|
+ approver_name: {
|
|
|
title: '当前审批人',
|
|
|
search: { show: false },
|
|
|
type: 'input',
|
|
|
column: { minWidth: 120 },
|
|
|
form: {
|
|
|
- show: false,
|
|
|
+ show: true,
|
|
|
component: { placeholder: '请输入当前审批人' },
|
|
|
rules: [{ required: false, message: '请输入当前审批人' }],
|
|
|
},
|
|
|
},
|
|
|
- return_location: {
|
|
|
- title: '存放仓库',
|
|
|
- search: { show: false },
|
|
|
- type: 'input',
|
|
|
- column: { minWidth: 120 },
|
|
|
- form: {
|
|
|
- show: false,
|
|
|
- component: { placeholder: '请输入存放仓库' },
|
|
|
- rules: [{ required: false, message: '请输入存放仓库' }],
|
|
|
- },
|
|
|
- },
|
|
|
+
|
|
|
|
|
|
|
|
|
|