feat:迟到、早退人员bug
This commit is contained in:
1 parent
aa6b586fba
commit
0a64c701d7
5 files changed
+78
-36
No files matched your search
@@ -1,19 +1,10 @@
|
||||
<!-- excel 导入组件 -->
|
||||
<template>
|
||||
<el-dialog :title="prop.title" v-model="state.upload.open" :close-on-click-modal="false" draggable>
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
:limit="1"
|
||||
accept=".xlsx, .xls"
|
||||
:headers="headers"
|
||||
:action="baseURL + other.adaptationUrl(url)"
|
||||
:disabled="state.upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress"
|
||||
:on-success="handleFileSuccess"
|
||||
:on-error="handleFileError"
|
||||
:auto-upload="false"
|
||||
drag
|
||||
>
|
||||
<el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="headers"
|
||||
:action="baseURL + other.adaptationUrl(url)" :disabled="state.upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :on-error="handleFileError"
|
||||
:auto-upload="false" drag>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">
|
||||
{{ $t('excel.operationNotice') }}
|
||||
@@ -23,8 +14,7 @@
|
||||
<div class="el-upload__tip text-center">
|
||||
<span>{{ $t('excel.fileFormat') }}</span>
|
||||
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
|
||||
@click="downExcelTemp" v-if="tempUrl"
|
||||
>{{ $t('excel.downloadTemplate') }}
|
||||
@click="downExcelTemp" v-if="tempUrl">{{ $t('excel.downloadTemplate') }}
|
||||
</el-link>
|
||||
</div>
|
||||
</template>
|
||||
@@ -49,11 +39,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="upload-excel">
|
||||
import {useMessage} from '/@/hooks/message';
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
import other from '/@/utils/other';
|
||||
import {Session} from '/@/utils/storage';
|
||||
import { Session } from '/@/utils/storage';
|
||||
|
||||
const emit = defineEmits(['sizeChange', 'refreshDataList']);
|
||||
const emit = defineEmits(['sizeChange', 'refreshDataList', 'downExcelTemp']);
|
||||
const prop = defineProps({
|
||||
url: {
|
||||
type: String,
|
||||
@@ -85,11 +75,15 @@ const state = reactive({
|
||||
* 下载模板文件
|
||||
*/
|
||||
const downExcelTemp = async () => {
|
||||
try {
|
||||
await other.downBlobFile(other.adaptationUrl(prop.tempUrl), {}, 'temp.xlsx');
|
||||
} catch (error) {
|
||||
useMessage().error('模板下载失败,请先维护模板文件');
|
||||
if (prop.tempUrl) {
|
||||
try {
|
||||
await other.downBlobFile(other.adaptationUrl(prop.tempUrl), {}, 'temp.xlsx');
|
||||
} catch (error) {
|
||||
useMessage().error('模板下载失败,请先维护模板文件');
|
||||
}
|
||||
return
|
||||
}
|
||||
emit("downExcelTemp")
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,13 +1,27 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="100px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="类型" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入类型" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item style="width: 400px;" label="类型" prop="bizType">
|
||||
<dict-select v-model="form.bizType" :options="sys_duty_type" placeholder="请选择类型" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col v-if="form.bizType == '2'" :span="24" class="mb20">
|
||||
<el-form-item label="是否为主副班" prop="mainAndSub">
|
||||
<el-radio-group v-model="form.mainAndSub">
|
||||
<el-radio v-for="(v, i) in yes_no_type" :key="i" :label="v.value" border>
|
||||
{{ v.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="唯一编号" prop="uniqueCode">
|
||||
@@ -53,6 +67,8 @@ const emit = defineEmits(['refresh']);
|
||||
|
||||
import * as sysDutyTypeApi from "/@/api/sys/sysDutyType";
|
||||
|
||||
const { sys_duty_type, yes_no_type } = useDict("sys_duty_type", "yes_no_type")
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
@@ -65,6 +81,7 @@ const form = reactive({
|
||||
name: '',
|
||||
uniqueCode: '',
|
||||
bizType: '',
|
||||
mainAndSub: '',
|
||||
sort: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
<el-form-item style="width: 250px;" label="唯一编号" prop="uniqueCode">
|
||||
<el-input v-model="state.queryForm.uniqueCode" placeholder="请输入唯一编号" />
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 250px;" label="类型" prop="bizType">
|
||||
<dict-select v-model="state.queryForm.bizType" :options="sys_duty_type" placeholder="请选择类型" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="getDataList">
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="排班时间" prop="time">
|
||||
<el-date-picker v-model="form.time" type="daterange" placeholder="请选择排班时间" />
|
||||
<el-date-picker v-model="form.time" type="daterange" value-format="YYYY-MM-DD" placeholder="请选择排班时间" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
@@ -97,14 +97,18 @@ const onSubmit = async () => {
|
||||
|
||||
|
||||
// 初始化表单数据
|
||||
const getsysDutyData = (id: string) => {
|
||||
const getsysDutyData = async (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
sysDutyApi.getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
try {
|
||||
const { data } = await sysDutyApi.getObj(id)
|
||||
if (data) data.time = [data.startTime, data.endTime]
|
||||
Object.assign(form, data)
|
||||
} catch (error) {
|
||||
console.log("|初始化表单数据|意外的错误:", error);
|
||||
} finally {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
|
||||
@@ -39,16 +39,22 @@
|
||||
<el-table-column label="排班时间">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.startTime }}</span>
|
||||
<span>-</span>
|
||||
<span> 到 </span>
|
||||
<span>{{ row.endTime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="{ row }">
|
||||
<el-button icon="UploadFilled" text type="primary" @click="importDutyItem(row)">
|
||||
导入
|
||||
</el-button>
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'admin_sysDuty_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'admin_sysDuty_del'"
|
||||
@click="handleDelete([row.id])">删除</el-button>
|
||||
@click="formDialogRef.openDialog(row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'admin_sysDuty_del'" @click="handleDelete([row.id])">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -58,6 +64,10 @@
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
<!-- 导入 -->
|
||||
<upload-excel ref="excelUploadRef" title="基地周值班表导入" temp-url="" url="/admin/user/import"
|
||||
@refreshDataList="getDataList" @downExcelTemp="downExcelTemp" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -65,6 +75,8 @@
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import * as sysDutyApi from "/@/api/sys/sysDuty";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import other from '/@/utils/other';
|
||||
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
|
||||
// 引入组件
|
||||
@@ -73,6 +85,7 @@ const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const excelUploadRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
@@ -115,6 +128,18 @@ const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
const importDutyItem = (row: any) => {
|
||||
excelUploadRef.value.show()
|
||||
}
|
||||
|
||||
const downExcelTemp = async () => {
|
||||
try {
|
||||
await other.downBlobFile(other.adaptationUrl(""), {}, 'temp.xlsx');
|
||||
} catch (error) {
|
||||
useMessage().error("模板下载失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
@@ -122,7 +147,6 @@ const handleDelete = async (ids: string[]) => {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await sysDutyApi.delObjs(ids);
|
||||
getDataList();
|
||||
|
||||
Reference in new issue
Block a user