Browse Source

reactor:对接小休审批;

zhangchong 1 month ago
parent
commit
7f4ef802c5

+ 1 - 1
.env.development

@@ -3,7 +3,7 @@ VITE_MODE_NAME=development
 # 防止部署多套系统到同一域名不同目录时,变量共用的问题 设置不同的前缀
 VITE_STORAGE_NAME=dev
 # 业务系统基础请求地址
-VITE_API_URL=http://110.188.24.28:50300
+VITE_API_URL=http://110.188.24.28:50100
 # 业务系统socket请求地址
 VITE_API_SOCKET_URL=http://110.188.24.28:50100/hubs/hotline
 # 业务系统文件上传上传请求地址

+ 44 - 5
src/api/tels/restApply.ts

@@ -3,7 +3,30 @@
  * @description 话务管理 - 小休申请
  */
 import request from '@/utils/request';
-
+/**
+ * @description 小休申请
+ * @param {object} data
+ * @return {*}
+ */
+export const restApply = (data: object) => {
+	return request({
+		url: '/api/v1/TelRest/addtelrest',
+		method: 'post',
+		data,
+	});
+}
+/**
+ * @description 小休审批
+ * @param {object} data
+ * @return {*}
+ */
+export const restApplyProcess = (data: object) => {
+	return request({
+		url: '/api/v1/TelRest/telrest_apply_audit',
+		method: 'post',
+		data,
+	});
+}
 /**
  * @description 小休申请列表
  * @param {object} params  
@@ -11,19 +34,35 @@ import request from '@/utils/request';
  */
 export const restApplyPaged = (params?: object) => {
 	return request({
-		url: '/api/v1/User/rest-apply-paged',
+		url: '/api/v1/TelRest/get_restapply_list',
 		method: 'get',
-		params: params,
+		params,
 	});
 };
+/**
+ * @description 小休申请列表导出
+ * @param {object} data
+ * @return {*}
+ */
+export const restApplyExport = (data: object) => {
+	return request({
+		url: '/api/v1/TelRest/get_restapply_list_export',
+		method: 'post',
+			data,
+			responseType: 'blob',
+		},
+		{
+			reduce_data_format: false,
+		})
+}
 /**
  * @description 小休申请基础信息
  * @param {object} params  
  * @return {*}
  */
-export const baseData = (params?: object) => {
+export const restBaseData = (params?: object) => {
 	return request({
-		url: '/api/v1/User/rest-apply-basedata',
+		url: '/api/v1/TelRest/base-data',
 		method: 'get',
 		params: params,
 	});

+ 23 - 34
src/layout/navBars/breadcrumb/zgTel.vue

@@ -82,19 +82,12 @@
 			</template>
 
 			<!-- 小休和结束休息 可用 -->
-			<template v-if="m_bLogin && activeArr.includes('rest') && !isRestAudit">
+			<template v-if="m_bLogin && activeArr.includes('rest')">
 				<div class="item active" :title="m_bTelBusy ? '示闲' : '小休'" @click="onEvent(m_bTelBusy ? 'idle' : 'busy')">
 					<SvgIcon name="iconfont icon-rest" class="icon mr3" size="16px" />
 					{{ m_bTelBusy ? '示闲' : '小休' }}
 				</div>
 			</template>
-			<!-- 小休审核中 -->
-			<template v-if="m_bLogin && isRestAudit">
-				<div class="item disabled" title="小休审核中">
-					<SvgIcon name="iconfont icon-rest" class="icon mr3" size="16px" />
-					审核中
-				</div>
-			</template>
 			<!-- 灰色小休不可用 -->
 			<template v-else>
 				<div class="item disabled" title="小休"><SvgIcon name="iconfont icon-rest" class="icon mr3" size="18px" />小休</div>
@@ -316,13 +309,13 @@
 		</template>
 	</el-dialog>
 	<!-- 小休弹窗 -->
-	<el-dialog v-model="state.restDialogVisible" draggable title="小休" width="450px" @close="restFormOpened">
+	<el-dialog v-model="state.restDialogVisible" draggable title="小休申请" width="450px" @close="restFormClose">
 		<el-form :model="state.restForm" label-width="80px" ref="restFormRef" @submit.native.prevent>
 			<el-form-item label="小休" prop="reason" :rules="[{ required: true, message: '请选择小休原因', trigger: 'change' }]">
-				<el-select v-model="state.restForm.reason" placeholder="请选择小休原因" class="w100" clearable>
-					<el-option v-for="item in state.restReasonOptions" :key="item.dicDataValue" :label="item.dicDataName" :value="item.dicDataValue" />
+				<el-select v-model="state.restForm.reason" placeholder="请选择小休原因" class="w100" clearable value-key="dicDataValue">
+					<el-option v-for="item in state.restReasonOptions" :key="item.dicDataValue" :label="item.dicDataName" :value="item" />
 				</el-select>
-				<!--        <el-text type="danger">注意:小休审批通过,状态才会变成小休</el-text>-->
+				<el-text type="danger">注意:小休审批通过,状态才会变成小休</el-text>
 			</el-form-item>
 		</el-form>
 		<template #footer>
@@ -361,6 +354,7 @@ import { useTransition } from '@vueuse/core';
 import { busyOff, busyOn, telRestBaseData } from '@/api/public/wex';
 import { getSpecialNumberDetailByPhone } from '@/api/auxiliary/specialNumber';
 import signalR from '@/utils/signalR';
+import { restApply, restBaseData } from '@/api/tels/restApply';
 
 const globalState = useGlobalState(); // 全局变量
 const state = reactive<any>({
@@ -405,7 +399,6 @@ const activeArr = computed(() => {
 		'100': [], // 登录成功
 		'200': ['dutyOff', 'rest', 'outbound'], // 空闲
 		'201': ['dutyOff', 'rest', 'outbound'], // 小休
-		'202': ['dutyOff'], // 小休审批中
 		'300': ['hangup'], // 呼入振铃
 		'301': ['hangup', 'hold', 'consult', 'transferMz', 'evaluate'], // 呼入通话
 		'302': ['hangup'], // 呼出振铃
@@ -429,7 +422,6 @@ const currentStatusText = computed(() => {
 		'100': '登录成功',
 		'200': '空闲',
 		'201': '小休',
-		'202': '小休审批中',
 		'300': '呼入振铃',
 		'301': '呼入通话',
 		'302': '呼出振铃',
@@ -1244,7 +1236,6 @@ const retSignOut = () => {
 	}
 	currentWait.value = 0; // 当前等待重置
 	globalState.callCenterWs = null;
-	isRestAudit.value = false; // 重置小休审核状态
 	console.log(`${getNowDateTime()} 呼叫中心签出回调`);
 
 	const objMsg = {
@@ -1338,28 +1329,32 @@ const onBusy = () => {
 };
 // 确认小休
 const restReason = ref(''); // 小休原因
-const isRestAudit = ref(false); // 是否小休审核
 const clickOnRest = (formEl: FormInstance | undefined) => {
 	if (!formEl) return;
 	formEl.validate((valid: boolean) => {
 		if (!valid) return;
 		state.loading = true;
 		restReason.value = state.restForm.reason; // 小休原因
-		const objMsg = {
-			Action: 'ReqAgentBusy',
-			Param: {
-				Extension: m_strUserNo.value,
-			},
+		console.log(state.restForm.reason, '小休原因');
+		const reason = {
+			key: state.restForm.reason.dicDataValue,
+			value: state.restForm.reason.dicDataName,
 		};
-		// 发送请求
-		e_TelSendMsg(objMsg);
-		isRestAudit.value = true; // 正在小休审核中
+		restApply({ telNo: m_strUserNo.value, reason })
+			.then(() => {
+				state.restDialogVisible = false;
+				ElMessage.success('小休申请成功');
+				state.loading = false;
+			})
+			.catch(() => {
+				state.loading = false;
+			});
 	});
 };
 
-const restFormOpened = () => {
-	restFormRef.value?.resetFields();
+const restFormClose = () => {
 	restFormRef.value?.clearValidate();
+	restFormRef.value?.resetFields();
 };
 /*
 * 小休返回值
@@ -2602,7 +2597,7 @@ const currentWaitValue = useTransition(currentWait, {
 const getReason = async () => {
 	try {
 		// 查询小休原因
-		const { result } = await telRestBaseData();
+		const { result } = await restBaseData();
 		state.restReasonOptions = result?.restReason ?? [];
 	} catch (err) {
 		console.log(err);
@@ -2618,12 +2613,6 @@ const signalRStart = () => {
 };
 // 小休审批通过消息
 const RestApplyPassFn = (data: any) => {
-	ElNotification({
-		title: '成功',
-		message: '小休审批通过,开始小休',
-		type: 'success',
-	});
-	isRestAudit.value = false;
 	const objMsg = {
 		Action: 'ReqAgentBusy',
 		Param: {
@@ -2637,7 +2626,7 @@ const RestApplyPassFn = (data: any) => {
 onMounted(async () => {
 	await getBaseInfo(); // 查询可以签入的分机
 	await getThreeWayAndTransfer(); // 查询呼叫转接的号码列表
-	// await getReason(); // 获取小休原因
+	await getReason(); // 获取小休原因
 	initWs();
 	await checkLogin();
 	signalRStart();

+ 89 - 0
src/views/tels/restApply/components/Audit.vue

@@ -0,0 +1,89 @@
+<template>
+	<el-dialog v-model="state.dialogVisible" width="769px" draggable title="小休审批" ref="dialogRef" append-to-body destroy-on-close @close="close">
+		<el-form :model="state.ruleForm" label-width="90px" ref="ruleFormRef">
+			<el-form-item label="审核结果" prop="isPass" :rules="[{ required: true, message: '请选择审批结果', trigger: 'change' }]">
+				<el-radio-group v-model="state.ruleForm.isPass">
+					<el-radio :value="true">同意</el-radio>
+					<el-radio :value="false">不同意</el-radio>
+				</el-radio-group>
+			</el-form-item>
+			<el-form-item label="审核意见" prop="auditOpinion" :rules="[{ required: !state.ruleForm.isPass, message: '请填写审核意见', trigger: 'blur' }]">
+				<el-input
+					v-model="state.ruleForm.auditOpinion"
+					placeholder="请填写审核意见"
+					type="textarea"
+					:autosize="{ minRows: 4, maxRows: 8 }"
+				></el-input>
+			</el-form-item>
+		</el-form>
+		<template #footer>
+			<span class="dialog-footer">
+				<el-button @click="closeDialog" class="default-button">取 消</el-button>
+				<el-button type="primary" @click="onSubmit(ruleFormRef)" :loading="loading">确 定</el-button>
+			</span>
+		</template>
+	</el-dialog>
+</template>
+
+<script setup lang="ts" name="systemUserAdd">
+import { reactive, ref } from 'vue';
+import { ElMessage, FormInstance } from 'element-plus';
+import { throttle } from '@/utils/tools';
+import { restApplyProcess } from '@/api/tels/restApply';
+
+// 定义子组件向父组件传值/事件
+const emit = defineEmits(['updateList']);
+// 定义变量内容
+const state = reactive<any>({
+	dialogVisible: false, // 弹窗显示隐藏
+	ruleForm: {
+		isPass: true,
+		auditOpinion: null,
+		ids: [],
+	},
+});
+let loading = ref<boolean>(false); // 确定按钮loading
+// 打开弹窗
+const ruleFormRef = ref<RefType>();
+const openDialog = (ids: string[]) => {
+	state.ruleForm.ids = ids;
+	state.dialogVisible = true;
+};
+// 关闭弹窗
+const closeDialog = () => {
+	state.dialogVisible = false;
+};
+const close = () => {
+	ruleFormRef.value?.clearValidate();
+	ruleFormRef.value?.resetFields();
+};
+
+// 新增
+const onSubmit = throttle((formEl: FormInstance | undefined) => {
+	if (!formEl) return;
+	formEl.validate((valid: boolean) => {
+		if (!valid) return;
+		loading.value = true;
+		restApplyProcess(state.ruleForm)
+			.then(() => {
+				ElMessage({
+					message: '审批成功',
+					type: 'success',
+				});
+				loading.value = false;
+				closeDialog();
+				emit('updateList');
+			})
+			.catch(() => {
+				// 新增失败
+				loading.value = false;
+				closeDialog();
+			});
+	});
+}, 300);
+// 暴露变量
+defineExpose({
+	openDialog,
+	closeDialog,
+});
+</script>

+ 162 - 107
src/views/tels/restApply/index.vue

@@ -1,13 +1,22 @@
 <template>
 	<div class="tels-restApply-container layout-padding">
 		<div class="layout-padding-auto layout-padding-view pd20">
-			<el-form :model="state.queryParams" ref="ruleFormRef" inline @submit.native.prevent >
-				<el-form-item label="关键词" prop="KeyWords">
-					<el-input v-model="state.queryParams.KeyWords" placeholder="坐席名称/工号" clearable @keyup.enter="queryList" />
+			<el-tabs v-model="state.queryParams.Type" @tab-change="handleQuery">
+				<el-tab-pane :name="0" label="待审批" :disabled="state.loading"></el-tab-pane>
+				<el-tab-pane :name="1" label="已审批" :disabled="state.loading"></el-tab-pane>
+			</el-tabs>
+			<el-form :model="state.queryParams" ref="ruleFormRef" inline @submit.native.prevent>
+				<el-form-item label="申请人" prop="ApplyUserName">
+					<el-input v-model="state.queryParams.ApplyUserName" placeholder="申请人" clearable @keyup.enter="handleQuery" class="keyword-input" />
 				</el-form-item>
-				<el-form-item label="申请时间" prop="time">
+				<el-form-item label="小休原因" prop="ReasonId">
+					<el-select v-model="state.queryParams.ReasonId" placeholder="请选择小休原因" @change="handleQuery" clearable>
+						<el-option v-for="item in state.restReason" :key="item.dicDataValue" :label="item.dicDataName" :value="item.dicDataValue" />
+					</el-select>
+				</el-form-item>
+				<el-form-item label="申请时间" prop="crTime">
 					<el-date-picker
-						v-model="state.queryParams.time"
+						v-model="state.queryParams.crTime"
 						type="datetimerange"
 						range-separator="至"
 						start-placeholder="开始时间"
@@ -15,29 +24,14 @@
 						value-format="YYYY-MM-DD[T]HH:mm:ss"
 						:shortcuts="shortcuts"
 						:default-time="defaultTimeStartEnd"
-						@change="
-							(val: any[]) => {
-								state.queryParams.BeginTime = val[0];
-								state.queryParams.EndTime = val[1];
-							}
-						"
+						@change="handleQuery"
 					/>
 				</el-form-item>
-				<el-form-item label="小休原因" prop="Reason">
-					<el-select v-model="state.queryParams.Reason" placeholder="请选择小休原因" class="w100">
-						<el-option v-for="item in state.restReason" :key="item.id" :label="item.content" :value="item.content" />
-					</el-select>
-				</el-form-item>
-				<el-form-item label="审批状态" prop="Status">
-					<el-select v-model="state.queryParams.Status" placeholder="请选择审批状态" class="w100">
-						<el-option v-for="item in state.restApplyStatus" :key="item.key" :label="item.value" :value="item.key" />
-					</el-select>
-				</el-form-item>
 				<el-form-item>
-					<el-button type="primary" @click="handleQuery" :loading="state.loading" v-waves> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
-					<el-button @click="resetQuery(ruleFormRef)" v-waves class="default-button" :loading="state.loading">
-						<SvgIcon name="ele-Refresh" class="mr5" />重置
-					</el-button>
+					<el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
+					<el-button @click="drawer = true" class="default-button" :loading="state.loading">
+						<SvgIcon name="ele-Search" class="mr5" />更多查询</el-button
+					>
 				</el-form-item>
 			</el-form>
 			<vxe-toolbar
@@ -47,7 +41,19 @@
 				:refresh="{
 					queryMethod: handleQuery,
 				}"
+				:tools="[{ toolRender: { name: 'exportCurrent' } }, { toolRender: { name: 'exportAll' } }]"
 			>
+				<template #buttons>
+					<el-button
+						type="primary"
+						@click="onAuditBatch"
+						:disabled="isChecked"
+						:loading="state.loading"
+						v-auth="'tels:restApply:audit:batch'"
+						v-if="state.queryParams.Type === 0"
+						>批量审批</el-button
+					>
+				</template>
 			</vxe-toolbar>
 			<div style="overflow: hidden; width: 100%; height: 100%; flex: 1">
 				<vxe-table
@@ -62,43 +68,32 @@
 					auto-resize
 					show-overflow
 					:scrollY="{ enabled: true, gt: 100 }"
-					id="restApply"
+					id="telsRestApply"
 					:custom-config="{ storage: true }"
+					:params="{ exportMethod: restApplyExport, exportParams: requestParams }"
+					@sort-change="sortChange"
+					@checkbox-all="selectAllChangeEvent"
+					@checkbox-change="selectChangeEvent"
 				>
-
-					<vxe-column field="userName" title="坐席" width="140"></vxe-column>
-					<vxe-column field="creationTime" title="申请时间" sortable width="160">
+					<vxe-column type="checkbox" width="50" align="center"></vxe-column>
+					<vxe-column field="reason" title="小休原因"></vxe-column>
+					<vxe-column field="applyUserName" title="申请人"></vxe-column>
+					<vxe-column field="applyTime" title="申请时间" sortable width="160">
 						<template #default="{ row }">
-							{{ formatDate(row.creationTime, 'YYYY-mm-dd HH:MM:SS') }}
+							{{ formatDate(row.applyTime, 'YYYY-mm-dd HH:MM:SS') }}
 						</template>
 					</vxe-column>
-					<vxe-column field="creationTime" title="开始时间" sortable width="160">
+					<vxe-column field="auditStatusText" title="审核结果"> </vxe-column>
+					<vxe-column field="auditOpinion" title="审核意见" min-width="140"></vxe-column>
+					<vxe-column field="auditUserName" title="审核人" min-width="140"></vxe-column>
+					<vxe-column field="auditTime" title="审核时间" sortable width="160">
 						<template #default="{ row }">
-							{{ formatDate(row.creationTime, 'YYYY-mm-dd HH:MM:SS') }}
+							{{ formatDate(row.auditTime, 'YYYY-mm-dd HH:MM:SS') }}
 						</template>
 					</vxe-column>
-					<vxe-column field="creationTime" title="结束时间" sortable width="160">
+					<vxe-column title="操作" fixed="right" width="90" align="center">
 						<template #default="{ row }">
-							{{ formatDate(row.creationTime, 'YYYY-mm-dd HH:MM:SS') }}
-						</template>
-					</vxe-column>
-					<vxe-column field="restDuration" title="时长(分钟)" width="140">
-						<template #default="{ row }">
-							{{ (row.restDuration / 60).toFixed(2) }}
-						</template>
-					</vxe-column>
-					<vxe-column field="applyStatus" title="审批状态" width="140">
-						<template #default="{ row }">
-							{{ state.restApplyStatus[row.applyStatus].value }}
-						</template>
-					</vxe-column>
-					<vxe-column field="restReason" title="小休原因" min-width="140"></vxe-column>
-					<vxe-column title="操作" fixed="right" width="140" align="center">
-						<template #default="{ row }">
-							<el-button link type="primary" @click="onRecord(row)" v-auth="'system:workflow:record'" title="审批记录" v-if="row.workflowId">
-								审批记录
-							</el-button>
-							<el-button link type="primary" @click="onSubmit(row)" v-auth="'system:workflow:handle'" title="审批" v-if="[0].includes(row.applyStatus)">
+							<el-button link type="primary" @click="onAudit(row)" v-auth="'tels:restApply:audit'" title="审批" v-if="[0].includes(row.auditStatus)">
 								审批
 							</el-button>
 						</template>
@@ -113,24 +108,53 @@
 				:disabled="state.loading"
 			/>
 		</div>
-		<!-- 流程审配 -->
-		<process-audit ref="processAuditRef" @orderProcessSuccess="orderProcessSuccess" />
-		<!-- 流转记录 -->
-		<audit-record ref="AuditRecordRef" />
+		<!-- 更多查询 -->
+		<el-drawer v-model="drawer" title="更多查询" size="500px">
+			<el-form :model="state.queryParams" ref="drawerRuleFormRef" @submit.native.prevent label-width="100px" :disabled="state.loading">
+				<template v-if="state.queryParams.Type === 1">
+					<el-form-item label="审批状态" prop="AuditStatus">
+						<el-select v-model="state.queryParams.AuditStatus" placeholder="请选择审批状态" class="w100" @change="handleQuery" clearable>
+							<el-option v-for="item in state.restApplyStatus" :key="item.key" :label="item.value" :value="item.key" />
+						</el-select>
+					</el-form-item>
+					<el-form-item label="审批人" prop="AuditUserName">
+						<el-input v-model="state.queryParams.AuditUserName" placeholder="审批人" clearable @keyup.enter="handleQuery" />
+					</el-form-item>
+					<el-form-item label="审批时间" prop="spTime">
+						<el-date-picker
+							v-model="state.queryParams.spTime"
+							type="datetimerange"
+							range-separator="至"
+							start-placeholder="开始时间"
+							end-placeholder="结束时间"
+							value-format="YYYY-MM-DD[T]HH:mm:ss"
+							:shortcuts="shortcuts"
+							:default-time="defaultTimeStartEnd"
+							@change="handleQuery"
+						/>
+					</el-form-item>
+				</template>
+			</el-form>
+			<template #footer>
+				<el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
+				<el-button @click="resetQuery(drawerRuleFormRef)" class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
+			</template>
+		</el-drawer>
+		<!-- 审核 -->
+		<rest-audit ref="restAuditRef" @updateList="queryList" />
 	</div>
 </template>
 
-<script lang="tsx" setup name="restApply">
-import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
+<script lang="tsx" setup name="telsRestApply">
+import { computed, defineAsyncComponent, onMounted, reactive, ref } from 'vue';
 import type { FormInstance } from 'element-plus';
 import { formatDate } from '@/utils/formatTime';
-import { baseData, restApplyPaged } from '@/api/tels/restApply';
+import { restBaseData, restApplyExport, restApplyPaged } from '@/api/tels/restApply';
 import { debounce } from '@/utils/tools';
-import { commonEnum, defaultTimeStartEnd, shortcuts } from "@/utils/constants";
-import other from '@/utils/other';
+import { defaultTimeStartEnd, shortcuts } from '@/utils/constants';
+import Other from '@/utils/other';
 // 引入组件
-const AuditRecord = defineAsyncComponent(() => import('@/components/AuditRecord/index.vue')); // 流转记录
-const ProcessAudit = defineAsyncComponent(() => import('@/components/ProcessAudit/index.vue')); // 审批流程
+const RestAudit = defineAsyncComponent(() => import('@/views/tels/restApply/components/Audit.vue')); // 审批
 const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
 
 // 定义变量内容
@@ -138,12 +162,19 @@ const state = reactive<any>({
 	queryParams: {
 		PageIndex: 1, // 当前页码
 		PageSize: 10, // 每页条数
-		KeyWords: null, // 关键字
-		Reason: null, // 小休原因
-		Status: null, // 审批状态
-		time: [], // 申请时间
-		BeginTime: null, // 开始时间
-		EndTime: null, // 结束时间
+		Type: 0, // 默认待审批
+		ApplyUserName: null, // 申请人
+		ReasonId: null, // 小休原因
+		crTime: [], // 申请时间
+		ApplyStartTime: null, // 开始时间
+		ApplyEndTime: null, // 结束时间
+		AuditStatus: null, // 审批状态
+		AuditUserName: null, // 审批人
+		spTime: [], // 审批时间
+		AuditStartTime: null, // 审批开始时间
+		AuditEndTime: null, // 审批结束时间
+		SortRule: null, // 排序规则
+		SortField: null, // 排序字段
 	},
 	loading: false, // 加载状态
 	total: 0, // 总条数
@@ -153,71 +184,95 @@ const state = reactive<any>({
 });
 const ruleFormRef = ref<FormInstance>(); // 表单实例
 /** 搜索按钮操作 节流操作 */
-const handleQuery = debounce(() => {
+const handleQuery = () => {
 	state.queryParams.PageIndex = 1;
 	queryList();
-}, 300);
-const orderProcessSuccess = () => {
-	console.log('审批成功');
-	handleQuery();
 };
 /** 获取用户列表 */
+const requestParams = ref<EmptyObjectType>({});
 const queryList = () => {
 	state.loading = true;
-	let request = other.deepClone(state.queryParams);
-	Reflect.deleteProperty(request, 'time'); // 删除无用的参数
-	restApplyPaged(request)
+	requestParams.value = Other.deepClone(state.queryParams);
+	requestParams.value.ApplyStartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
+	requestParams.value.ApplyEndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
+	Reflect.deleteProperty(requestParams.value, 'crTime'); // 申请时间
+	requestParams.value.AuditStartTime = state.queryParams.spTime === null ? null : state.queryParams.spTime[0];
+	requestParams.value.AuditEndTime = state.queryParams.spTime === null ? null : state.queryParams.spTime[1];
+	Reflect.deleteProperty(requestParams.value, 'spTime'); // 审批时间
+	restApplyPaged(requestParams.value)
 		.then((response: any) => {
 			state.tableData = response?.result.items;
 			state.total = response?.result.total;
+			tableRef.value?.clearCheckboxRow();
+			checkTable.value = [];
 			state.loading = false;
 		})
 		.catch(() => {
 			state.loading = false;
 		});
 };
+// 排序
+const sortChange = (val: any) => {
+	state.queryParams.SortField = val.order ? val.field : null;
+	// 0 升序 1 降序
+	state.queryParams.SortRule = val.order ? (val.order == 'desc' ? 1 : 0) : null;
+	handleQuery();
+};
 /** 重置按钮操作 */
+const drawer = ref(false);
+const drawerRuleFormRef = ref();
 const resetQuery = debounce((formEl: FormInstance | undefined) => {
 	if (!formEl) return;
-	state.queryParams.BeginTime = null;
-	state.queryParams.EndTime = null;
 	formEl.resetFields();
+	ruleFormRef.value?.resetFields();
 	handleQuery();
 }, 300);
-// 办理 下一步
-const processAuditRef = ref<RefType>();
-const onSubmit = debounce((row: any) => {
-	const params = {
-		id: row.workflowId,
-		commonEnum: commonEnum.OrderCirculation,
-		processType: '小休办理',
-		extra: {
-			dialogTitle: '小休办理',
-			inputPlaceholder: '办理意见',
-			annexName: '办理附件',
-		},
-	};
-	processAuditRef.value.openDialog(params);
-}, 1000);
-// 审核记录
-const AuditRecordRef = ref<RefType>();
-const onRecord = (row: any) => {
-	const params = {
-		dialogTitle: '审核记录 (小休申请)',
-		...row,
-	};
-	console.log(params);
-	AuditRecordRef.value.openDialog(params);
+// 审核
+const restAuditRef = ref<RefType>();
+const onAudit = (row: any) => {
+	restAuditRef.value.openDialog([row.id]);
+};
+const checkTable = ref<EmptyArrayType>([]);
+const selectAllChangeEvent = ({ checked }) => {
+	if (tableRef.value) {
+		const records = tableRef.value.getCheckboxRecords();
+		checkTable.value = records;
+		console.log(checked ? '所有勾选事件' : '所有取消事件', records);
+	}
+};
+
+const selectChangeEvent = ({ checked }) => {
+	if (tableRef.value) {
+		const records = tableRef.value.getCheckboxRecords();
+		checkTable.value = records;
+		console.log(checked ? '勾选事件' : '取消事件', records);
+	}
+};
+const isChecked = computed(() => {
+	return !checkTable.value.length;
+});
+// 批量审批
+const onAuditBatch = () => {
+	const ids = checkTable.value.map((row: any) => row.id);
+	restAuditRef.value.openDialog(ids);
 };
 // 获取基础数据
 const baseDataFn = () => {
-	baseData().then((res: any) => {
-		state.restApplyStatus = res.result?.restApplyStatus;
+	restBaseData().then((res: any) => {
+		state.restApplyStatus = res.result?.auditStatus;
+		state.restApplyStatus = state.restApplyStatus.filter((item: any) => {
+			return [1, 2].includes(item.key);
+		});
 		state.restReason = res.result?.restReason;
-		queryList();
 	});
 };
+const toolbarRef = ref<RefType>();
+const tableRef = ref<RefType>();
 onMounted(() => {
+	queryList();
 	baseDataFn();
+	if (tableRef.value && toolbarRef.value) {
+		tableRef.value.connect(toolbarRef.value);
+	}
 });
 </script>