Compare commits

..

No commits in common. "e95fe4f759e4795fa13535edbb2579858840b162" and "3eadd103e6f68df9a2cea25725226264e1a1ee23" have entirely different histories.

2 changed files with 34 additions and 50 deletions

View File

@ -48,10 +48,7 @@ export function importVehicleModelTraining(data) {
return request({
url: '/admin/vehicleModelTraining/import',
method: 'post',
data,
headers: {
'Content-Type': 'multipart/form-data'
}
data
})
}

View File

@ -19,16 +19,15 @@
<el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-position="top">
<div class="applyFormContainer">
<el-form-item prop="employeeNumber">
<el-upload class="upload-demo" drag action="#" :http-request="requestDocUpload"
:file-list="docUploadList" :before-upload="beforeDocUpload"
:on-remove="removeDocUpload">
<el-upload class="upload-demo" drag
action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" multiple>
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">
将文件拖曳至此区域 <em>点击上传</em>
</div>
<div class="el-upload__text">
支持扩展名.xlsx
</div>
支持扩展名rar.zip.doc.docx.pdf.jpg...
</div>
</el-upload>
</el-form-item>
</div>
@ -37,7 +36,8 @@
</div>
<div class="submitTool">
<el-button class="cancelApplyBtn" @click="handleCancel">取消</el-button>
<el-button class="cancelApplyBtn" @click="handleCancel">取消</el-button>
<el-button class="submitApplyBtn" @click="handleSubmit">提交</el-button>
</div>
</div>
@ -46,7 +46,6 @@
import { reactive } from 'vue'
import { useRouter } from 'vue-router'
import { UploadFilled } from '@element-plus/icons-vue'
import { importVehicleModelTraining } from "@/api/qualification/vehicleTrain"
const router = useRouter()
const levelList = ref([
@ -61,49 +60,36 @@ const data = reactive({
},
})
const { ruleForm, rules } = toRefs(data)
const docUploadList = ref([])
//
const requestDocUpload = (options) => {
const { file } = options
var formData = new FormData();
formData.append('file', file);
importVehicleModelTraining(formData).then(res => {
if (res.code == 200) {
router.push({
path: '/qualification/vehicleTrain'
})
} else {
proxy.$modal.msgError(res.msg);
}
})
}
//
const beforeDocUpload = (file) => {
const type = [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
];
const isXlsx = type.includes(file.type);
//
if (!isXlsx) {
proxy.$modal.msgError("文件格式错误,请上传.xlsx后缀的文件。");
return false;
}
}
//
const removeDocUpload = (file, fileList) => {
docUploadList.value = docUploadList.value.filter(
item => item.name != file.name
);
}
const handleCancel = () => {
proxy.resetForm("ruleFormRef")
router.push({
path: '/qualification/vehicleTrain'
})
}
}
const handleSubmit = () => {
proxy.$refs["ruleFormRef"].validate(valid => {
if (valid) {
router.push({
path: '/qualification/vehicleTrain'
})
// if (form.value.roleId != undefined) {
// form.value.menuIds = getMenuAllCheckedKeys()
// updateRole(form.value).then(response => {
// proxy.$modal.msgSuccess("")
// open.value = false
// getList()
// })
// } else {
// form.value.menuIds = getMenuAllCheckedKeys()
// addRole(form.value).then(response => {
// proxy.$modal.msgSuccess("")
// open.value = false
// getList()
// })
// }
}
})
}
</script>
<style lang='scss'>
.app-main {
@ -272,8 +258,9 @@ const handleCancel = () => {
background: #0090ff05;
padding: 140px 450px !important;
}
.el-form-item__error {
font-size: 16px;
}
</style>