模板导入

This commit is contained in:
shijing 2024-01-03 11:15:09 +08:00
parent c3afb22541
commit 977ce4d2a3
3 changed files with 55 additions and 17 deletions

File diff suppressed because one or more lines are too long

View File

@ -29,6 +29,13 @@ export function createCertificate(data) {
data data
}) })
} }
export function impCertificate12(data) {
return request({
url: '/edu/certificate/imp_202312/',
method: 'post',
data
})
}
export function deleteCertificate(id) { export function deleteCertificate(id) {
return request({ return request({
url: `/edu/certificate/${id}/`, url: `/edu/certificate/${id}/`,

View File

@ -23,13 +23,38 @@
<div style="margin-top: 6px"> <div style="margin-top: 6px">
<el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-if="checkPermission(['certificate'])" <el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-if="checkPermission(['certificate'])"
>新增证书</el-button> >新增证书</el-button>
<!-- <el-popover
placement="top"
width="160"
v-if="checkPermission(['certificate'])"
v-model="popovervisible"
>
<p>导入09证书</p>
<div style="text-align: left; margin: 0">
<el-upload
:action="upUrl"
:on-success="handleUploadSuccess"
accept=".xlsx"
:headers="upHeaders"
:show-file-list="false"
>
<el-button
size="small"
type="primary"
@click="popovervisible = false"
>上传导入</el-button
>
</el-upload>
</div>
<el-button slot="reference">导入09证书</el-button>
</el-popover> -->
<el-popover <el-popover
placement="top" placement="top"
width="160" width="160"
v-if="checkPermission(['certificate'])" v-if="checkPermission(['certificate'])"
v-model="popovervisible" v-model="popovervisible"
> >
<p>导入证书</p> <p>导入证书(202312)</p>
<div style="text-align: left; margin: 0"> <div style="text-align: left; margin: 0">
<el-upload <el-upload
:action="upUrl" :action="upUrl"
@ -48,6 +73,7 @@
</div> </div>
<el-button slot="reference">导入证书</el-button> <el-button slot="reference">导入证书</el-button>
</el-popover> </el-popover>
<el-link href="/media/cert/template/cert-202312.xlsx" target="_blank" type="primary">202312模板</el-link>
</div> </div>
</el-card> </el-card>
<el-card style="margin-top: 10px"> <el-card style="margin-top: 10px">
@ -66,7 +92,6 @@
type="selection" type="selection"
width="55"> width="55">
</el-table-column> </el-table-column>
<!-- <el-table-column type="index" width="50" /> -->
<el-table-column label="证书方案" prop="证书方案"> <el-table-column label="证书方案" prop="证书方案">
</el-table-column> </el-table-column>
<el-table-column label="所属单位" prop="所属单位" v-if="listQuery.证书方案=='202309'"> <el-table-column label="所属单位" prop="所属单位" v-if="listQuery.证书方案=='202309'">
@ -131,7 +156,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="证书方案"> <el-form-item label="证书方案">
<el-select style="width: 100%" v-model="form.证书方案" placeholder="证书方案"> <el-select style="width: 100%" v-model="form.证书方案" placeholder="证书方案" :disabled="dialogType=='edit'">
<el-option v-for="item in planOption" :key="item" :label="item" :value="item"></el-option> <el-option v-for="item in planOption" :key="item" :label="item" :value="item"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -273,7 +298,7 @@
} }
</style> </style>
<script> <script>
import {getCertificateList,createCertificate,updateCertificate,impCertificate,deleteCertificate,getCertificate,getCourseList} from "@/api/edu"; import {getCertificateList,createCertificate,updateCertificate,impCertificate12,deleteCertificate,getCertificate,getCourseList} from "@/api/edu";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { upUrl, upHeaders } from "@/api/file"; import { upUrl, upHeaders } from "@/api/file";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
@ -346,7 +371,7 @@ export default {
handleUploadSuccess(res, file) { handleUploadSuccess(res, file) {
const loading = this.openLoading(); const loading = this.openLoading();
let data = { path: res.data.path }; let data = { path: res.data.path };
impCertificate(data) impCertificate12(data)
.then((res) => { .then((res) => {
this.$message({ this.$message({
message: "导入成功", message: "导入成功",
@ -420,16 +445,22 @@ export default {
}); });
}, },
async confirm(form) { async confirm(form) {
this.$refs[form].validate((valid) => { let that = this;
that.$refs[form].validate((valid) => {
if (valid) { if (valid) {
this.form.字体方案 = parseInt(this.form.字体方案); that.form.字体方案 = parseInt(that.form.字体方案);
const isEdit = this.dialogType === "edit"; const isEdit = that.dialogType === "edit";
if(that.listQuery.证书方案=='202312'){}else{
that.form.发证日期=null;
that.form.培训日期=null;
that.form.培训结束日期=null;
}
if (isEdit) { if (isEdit) {
updateCertificate(this.form.id, this.form).then((res) => { updateCertificate(that.form.id, that.form).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getList(); that.getList();
this.dialogVisible = false; that.dialogVisible = false;
this.$notify({ that.$notify({
title: "成功", title: "成功",
message: "编辑成功", message: "编辑成功",
type: "success", type: "success",
@ -438,11 +469,11 @@ export default {
} }
}); });
} else { } else {
createCertificate(this.form).then((res) => { createCertificate(that.form).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getList(); that.getList();
this.dialogVisible = false; that.dialogVisible = false;
this.$notify({ that.$notify({
title: "成功", title: "成功",
message: "新增成功", message: "新增成功",
type: "success", type: "success",