|
@@ -1,22 +1,52 @@
|
|
|
<template>
|
|
|
<!-- 添加或修改菜单对话框 -->
|
|
|
- <el-dialog title="工资导入" v-model="visible" width="680px" append-to-body draggable>
|
|
|
- <el-form ref="menuRef" :model="form" size="small" :rules="rules" label-width="100px">
|
|
|
+ <el-dialog
|
|
|
+ title="工资导入"
|
|
|
+ v-model="visible"
|
|
|
+ width="680px"
|
|
|
+ append-to-body
|
|
|
+ draggable
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ ref="menuRef"
|
|
|
+ :model="form"
|
|
|
+ size="small"
|
|
|
+ :rules="rules"
|
|
|
+ label-width="100px"
|
|
|
+ >
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="选择导入月份" prop="year">
|
|
|
- <el-date-picker v-model="currentMonth" type="month" format="YYYY年MM月" style="width: 150px" :clearable="false"
|
|
|
- value-format="YYYY-MM-01" :disabled-date="disabledDateHandler" @change="monthChangeHandler" />
|
|
|
+ <el-date-picker
|
|
|
+ v-model="currentMonth"
|
|
|
+ type="month"
|
|
|
+ format="YYYY年MM月"
|
|
|
+ style="width: 150px"
|
|
|
+ :clearable="false"
|
|
|
+ value-format="YYYY-MM-01"
|
|
|
+ :disabled-date="disabledDateHandler"
|
|
|
+ @change="monthChangeHandler"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="上传">
|
|
|
- <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
|
|
- :action="upload.url + `?year=${year}&month=${month}`" :fileList="fileList"
|
|
|
- :before-upload="handleBeforeUpload" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress"
|
|
|
- :on-success="handleFileSuccess" :auto-upload="false" drag>
|
|
|
+ <el-upload
|
|
|
+ ref="uploadRef"
|
|
|
+ :limit="1"
|
|
|
+ accept=".xlsx, .xls"
|
|
|
+ :headers="upload.headers"
|
|
|
+ :action="upload.url + `?year=${year}&month=${month}`"
|
|
|
+ :fileList="fileList"
|
|
|
+ :before-upload="handleBeforeUpload"
|
|
|
+ :disabled="upload.isUploading"
|
|
|
+ :on-progress="handleFileUploadProgress"
|
|
|
+ :on-success="handleFileSuccess"
|
|
|
+ :auto-upload="false"
|
|
|
+ drag
|
|
|
+ >
|
|
|
<el-icon class="el-icon--upload">
|
|
|
<upload-filled />
|
|
|
</el-icon>
|
|
@@ -25,9 +55,16 @@
|
|
|
</div>
|
|
|
<template #tip>
|
|
|
<div class="el-upload__tip text-center">
|
|
|
- <span>仅允许导入xls、xlsx格式文件。文件大小限制为<50Mb</span>
|
|
|
- <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
|
|
|
- @click="importTemplate">下载模板</el-link>
|
|
|
+ <span
|
|
|
+ >仅允许导入xls、xlsx格式文件。文件大小限制为<50Mb</span
|
|
|
+ >
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ style="font-size: 12px; vertical-align: baseline"
|
|
|
+ @click="importTemplate"
|
|
|
+ >下载模板</el-link
|
|
|
+ >
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-upload>
|
|
@@ -37,8 +74,14 @@
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="Finished"
|
|
|
+ size="small"
|
|
|
+ @click="submitForm"
|
|
|
+ >确 定</el-button
|
|
|
+ >
|
|
|
+ <el-button icon="Close" size="small" @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
@@ -56,7 +99,7 @@ const { proxy } = getCurrentInstance();
|
|
|
const props = defineProps({
|
|
|
getList: {
|
|
|
type: Function,
|
|
|
- default: () => { },
|
|
|
+ default: () => {},
|
|
|
},
|
|
|
});
|
|
|
const { getList } = toRefs(props);
|
|
@@ -130,7 +173,7 @@ function handleBeforeUpload(file) {
|
|
|
console.log(file);
|
|
|
if (
|
|
|
file.type !==
|
|
|
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" &&
|
|
|
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" &&
|
|
|
file.type !== "application/vnd.ms-excel"
|
|
|
) {
|
|
|
proxy.$modal.msgError("请选择excel文件");
|
|
@@ -150,8 +193,8 @@ const handleFileSuccess = (response, file, fileList) => {
|
|
|
proxy.$refs["uploadRef"].handleRemove(file);
|
|
|
proxy.$alert(
|
|
|
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
- response.msg +
|
|
|
- "</div>",
|
|
|
+ response.msg +
|
|
|
+ "</div>",
|
|
|
"导入结果",
|
|
|
{ dangerouslyUseHTMLString: true }
|
|
|
);
|