feat:edu 证书日期批量修改
This commit is contained in:
parent
6805c0bc41
commit
fb44f66cf4
|
@ -86,3 +86,11 @@ export function createCourse(data) {
|
|||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function batchUpdate(data) {
|
||||
return request({
|
||||
url: '/edu/certificate/batch-update/',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
<el-button type="primary" @click="handleAdd" icon="el-icon-plus">新增</el-button>
|
||||
</div>
|
||||
<el-table :data="tableData" style="width: 100%;margin-top:10px;" border fit v-loading="listLoading"
|
||||
highlight-current-row max-height="600">
|
||||
highlight-current-row max-height="700">
|
||||
<el-table-column type="index" width="50"></el-table-column>
|
||||
<el-table-column align="center" label="名称">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
|
@ -23,7 +23,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.page_size"
|
||||
@pagination="getList" />
|
||||
<el-dialog :visible.sync="dialogVisible" :title="dialogType === 'edit' ? '编辑分类' : '新增分类'">
|
||||
<el-form :model="questioncat" label-width="80px" label-position="right" :rules="rule1" ref="commonForm">
|
||||
|
@ -50,7 +50,7 @@ const defaultObj = {
|
|||
};
|
||||
const listQuery = {
|
||||
page: 1,
|
||||
limit: 20
|
||||
page_size: 20
|
||||
};
|
||||
export default {
|
||||
components: { Pagination },
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
fit
|
||||
v-loading="listLoading"
|
||||
highlight-current-row
|
||||
max-height="600"
|
||||
max-height="700"
|
||||
@sort-change="changeSort"
|
||||
>
|
||||
<el-table-column type="index" width="50"></el-table-column>
|
||||
|
@ -124,7 +124,7 @@
|
|||
v-show="tableData.count>0"
|
||||
:total="tableData.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.limit"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
|
@ -137,7 +137,7 @@
|
|||
|
||||
const listQuery = {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
page_size: 20,
|
||||
search:''
|
||||
};
|
||||
export default {
|
||||
|
@ -229,7 +229,7 @@
|
|||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
page_size: 20,
|
||||
search:'',
|
||||
};
|
||||
this.value = []
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
v-show="tableData.count>0"
|
||||
:total="tableData.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.limit"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<el-dialog :visible.sync="dialogVisible" :title="dialogType==='edit'?'编辑考试':'新增考试'" >
|
||||
|
@ -230,7 +230,7 @@
|
|||
};
|
||||
const listQuery = {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
page_size: 20,
|
||||
search: ""
|
||||
};
|
||||
export default {
|
||||
|
@ -330,7 +330,7 @@
|
|||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
page_size: 20,
|
||||
search: ""
|
||||
};
|
||||
this.getList();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-model="search"
|
||||
v-model="listQuery.search"
|
||||
placeholder="输入题干进行搜索"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
|
@ -51,6 +51,7 @@
|
|||
highlight-current-row
|
||||
max-height="400"
|
||||
ref="table"
|
||||
@sort-change="changeSort"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
|
@ -65,10 +66,10 @@
|
|||
<el-table-column align="left" label="题型">
|
||||
<template slot-scope="scope">{{ scope.row.type }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="难易度">
|
||||
<el-table-column align="left" sortable='custom' label="难易度" prop="level">
|
||||
<template slot-scope="scope">{{ scope.row.level }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建日期">
|
||||
<el-table-column label="创建日期" sortable='custom' prop="create_time">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.create_time }}</span>
|
||||
</template>
|
||||
|
@ -88,7 +89,7 @@
|
|||
v-show="tableData.count>0"
|
||||
:total="tableData.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.limit"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<el-dialog
|
||||
|
@ -124,7 +125,7 @@
|
|||
|
||||
const listQuery = {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
page_size: 20,
|
||||
search:''
|
||||
};
|
||||
export default {
|
||||
|
@ -140,7 +141,6 @@
|
|||
name: ""
|
||||
},
|
||||
listQuery: listQuery,
|
||||
search:"",
|
||||
tableData: {
|
||||
count:0,
|
||||
results:[]
|
||||
|
@ -172,9 +172,9 @@
|
|||
this.getQuestioncatAll();
|
||||
},
|
||||
methods: {
|
||||
getList(query = this.listQuery) {
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getQuestionList(query).then(response => {
|
||||
getQuestionList(this.listQuery).then(response => {
|
||||
if(response.data.results){
|
||||
this.tableData = response.data
|
||||
}
|
||||
|
@ -185,7 +185,14 @@
|
|||
getQuestioncatList().then(response => {
|
||||
this.questioncatData = response.data.results;
|
||||
});
|
||||
|
||||
},
|
||||
changeSort(val) {
|
||||
if (val.order == "ascending") {
|
||||
this.listQuery.ordering = val.prop;
|
||||
} else {
|
||||
this.listQuery.ordering = "-" + val.prop;
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
handleFilter() {
|
||||
if(this.questioncatC.length) {
|
||||
|
@ -197,12 +204,12 @@
|
|||
this.getList();
|
||||
},
|
||||
resetFilter() {
|
||||
this.search = ""
|
||||
this.listQuery = listQuery
|
||||
this.listQuery.search = ''
|
||||
this.getList();
|
||||
},
|
||||
handleSearch() {
|
||||
this.getList({ search: this.search });
|
||||
this.listQuery.page = 1
|
||||
this.getList();
|
||||
},
|
||||
handleDetail(scope) {
|
||||
this.dialogVisible = true
|
||||
|
|
|
@ -75,8 +75,18 @@
|
|||
<el-button type="danger" v-if="checkPermission(['question_batch_delete'])" :disabled="this.selects.length==0" @click="batchDelete()">批量删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table :data="tableData" style="width: 100%;margin-top:10px;" border stripe fit v-loading="listLoading"
|
||||
highlight-current-row max-height="600" @sort-change="changeSort" @selection-change="handleSelectionChange">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%;
|
||||
margin-top:6px;"
|
||||
border
|
||||
stripe
|
||||
fit
|
||||
v-loading="listLoading"
|
||||
highlight-current-row
|
||||
max-height="700"
|
||||
@sort-change="changeSort"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<el-table-column label="题干" sortable="custom" prop="name" width="400px">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
|
@ -112,7 +122,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.page_size"
|
||||
@pagination="getList" />
|
||||
<el-dialog title="题目详情" :visible.sync="dialogVisible" width="30%">
|
||||
<div>{{ question.type }}</div>
|
||||
|
@ -152,7 +162,7 @@ const defaultObj = {
|
|||
};
|
||||
const listQuery = {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
page_size: 20,
|
||||
search: '',
|
||||
questioncat:''
|
||||
};
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<div style="margin-top: 6px">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-if="checkPermission(['certificate'])"
|
||||
>新增证书</el-button>
|
||||
<el-button @click="openBatchEditDialog" type="primary">批量修改</el-button>
|
||||
<!-- <el-popover
|
||||
placement="top"
|
||||
width="160"
|
||||
|
@ -81,13 +82,14 @@
|
|||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="tableList.results"
|
||||
@selection-change="handleSelectionChange"
|
||||
ref="multipleTable"
|
||||
style="width: 100%;"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
max-height="700"
|
||||
ref="filterTable"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
|
@ -299,6 +301,39 @@
|
|||
<el-button @click="dialogVisible = false">关闭</el-button>
|
||||
</div> -->
|
||||
</el-dialog>
|
||||
<el-dialog title="批量修改" :visible.sync="dialogVisible2" width="30%">
|
||||
<el-form
|
||||
:model="batchForm"
|
||||
label-width="160px"
|
||||
label-position="right"
|
||||
:rules="rule"
|
||||
>
|
||||
<el-form-item label="培训开始日期" prop="培训日期">
|
||||
<el-date-picker
|
||||
v-model="batchForm.培训日期"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="培训日期"
|
||||
style="width:100%">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="培训结束日期" prop="培训结束日期">
|
||||
<el-date-picker
|
||||
v-model="batchForm.培训结束日期"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="培训结束日期"
|
||||
style="width:100%">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible2 = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleBatchEdit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<style >
|
||||
|
@ -309,7 +344,7 @@
|
|||
}
|
||||
</style>
|
||||
<script>
|
||||
import {getCertificateList,createCertificate,updateCertificate,impCertificate12,deleteCertificate,getCertificate,getCourseList} from "@/api/edu";
|
||||
import {getCertificateList,createCertificate,updateCertificate,impCertificate12,deleteCertificate,getCertificate,getCourseList, batchUpdate} from "@/api/edu";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import { upUrl, upHeaders } from "@/api/file";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
|
@ -350,6 +385,7 @@ export default {
|
|||
upUrl: upUrl(),
|
||||
delarr: [],
|
||||
srcList:[],
|
||||
selectedItems:[],
|
||||
imgurl:'',
|
||||
groupBy: { sszx: [], glzz: [] },
|
||||
tableList: { count: 0 ,list:[] },
|
||||
|
@ -360,8 +396,13 @@ export default {
|
|||
{ key: "true", display_name: "激活" },
|
||||
{ key: "false", display_name: "禁用" },
|
||||
],
|
||||
batchForm:{
|
||||
培训日期:"",
|
||||
培训结束日期:""
|
||||
},
|
||||
dialogShow:false,
|
||||
dialogVisible: false,
|
||||
dialogVisible2:false,
|
||||
dialogType: "new",
|
||||
popovervisible: false,
|
||||
rule: {
|
||||
|
@ -435,6 +476,34 @@ export default {
|
|||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
handleBatchEdit(){
|
||||
const ids = this.selectedItems.map(item => item.id);
|
||||
const payload = {
|
||||
ids: ids,
|
||||
updates:{
|
||||
培训日期:this.batchForm.培训日期,
|
||||
培训结束日期:this.batchForm.培训结束日期,
|
||||
}
|
||||
};
|
||||
// 发送请求
|
||||
console.log(payload, "payload");
|
||||
batchUpdate(payload).then(response => {
|
||||
if (response.code >= 200){
|
||||
this.$message.success('批量修改成功');
|
||||
this.dialogVisible2 = false;
|
||||
this.getList();
|
||||
}else{
|
||||
this.$message.error('批量修改失败');
|
||||
}
|
||||
});
|
||||
},
|
||||
openBatchEditDialog(){
|
||||
if (this.selectedItems.length === 0){
|
||||
this.$message.warning('请先选择至少一项记录');
|
||||
return;
|
||||
}
|
||||
this.dialogVisible2 = true;
|
||||
},
|
||||
handleEdit(row) {
|
||||
this.form = Object.assign({}, row); // copy obj
|
||||
this.form.字体方案 = this.form.字体方案.toString();
|
||||
|
@ -517,6 +586,9 @@ export default {
|
|||
}
|
||||
this.dialogShow = true;
|
||||
},
|
||||
handleSelectionChange(val){
|
||||
this.selectedItems = val;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -9,6 +9,20 @@
|
|||
</el-header>
|
||||
<el-main style="padding:20px 0;">
|
||||
<el-row class="typesButtons">
|
||||
<el-input
|
||||
v-model="queryParams.search"
|
||||
placeholder="输入视频名搜索"
|
||||
style="width: 400px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleSearch"
|
||||
/>
|
||||
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="resetFilter"
|
||||
>刷新重置</el-button>
|
||||
<div style="width: fit-content;">
|
||||
<el-col class="typeItemWrap" style="width:100px;margin-top: 6px;">
|
||||
<el-link :underline="false" @click="getList">
|
||||
|
@ -87,7 +101,11 @@
|
|||
data() {
|
||||
return {
|
||||
type:null,
|
||||
videoList: "",
|
||||
videoList: [],
|
||||
queryParams:{
|
||||
pageoff:true,
|
||||
search:""
|
||||
},
|
||||
typeOptions: [],
|
||||
hasLowerLevel:false,
|
||||
subTypeOptions:[],
|
||||
|
@ -110,9 +128,10 @@
|
|||
}
|
||||
let bigHeight = document.getElementsByClassName('app-main')[0].clientHeight;
|
||||
let topHeight = document.getElementsByClassName('typesButtons')[0].clientHeight;
|
||||
console.log(topHeight);
|
||||
let headerHeight = document.getElementsByClassName('el-header')[0].clientHeight;
|
||||
// console.log(topHeight);
|
||||
debugger;
|
||||
let domHeight = bigHeight-200-topHeight;
|
||||
let domHeight = bigHeight-topHeight-headerHeight-80;
|
||||
document.getElementById('videoListWrap').style.height = domHeight + 'px';
|
||||
// document.getElementById('videoListWrap').style.paddingTop = topHeight + 'px';
|
||||
},
|
||||
|
@ -121,14 +140,23 @@
|
|||
getList() {
|
||||
this.type = null;
|
||||
this.listLoading = true;
|
||||
getVideoList({pageoff: true}).then((response) => {
|
||||
getVideoList(this.queryParams).then((response) => {
|
||||
if (response.data) {
|
||||
this.videoList = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
handleSearch() {
|
||||
this.getList();
|
||||
},
|
||||
resetFilter() {
|
||||
this.queryParams = {
|
||||
pageoff:true,
|
||||
search: '',
|
||||
};
|
||||
this.getList();
|
||||
},
|
||||
getListtype(a) {
|
||||
this.type = a.id;
|
||||
if(a.children){
|
||||
|
@ -165,7 +193,7 @@
|
|||
getTypeAll() {
|
||||
getDictList({type__code: "data_video",is_used:true}).then((res) => {
|
||||
this.typeOptions = genTree(res.data);
|
||||
console.log(this.typeOptions);
|
||||
// console.log(this.typeOptions);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -286,7 +314,7 @@
|
|||
background-color: #ffffff;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
margin-top: 130px;
|
||||
margin-top: 140px;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -136,3 +136,28 @@ class CertificateViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
|||
make_img_x(obj)
|
||||
print(f"生成---{obj.姓名}---的证书")
|
||||
return Response()
|
||||
|
||||
@action(detail=False, methods=['post'], url_path='batch-update', perms_map={"post": "certificate"})
|
||||
def batch_update(self, request):
|
||||
data = request.data
|
||||
ids = data.get('ids', [])
|
||||
updates = data.get('updates', {})
|
||||
|
||||
if not ids or not updates:
|
||||
raise ParseError("Invalid data")
|
||||
|
||||
# Fetch the objects to update
|
||||
objects = Certificate.objects.filter(id__in=ids)
|
||||
if not objects.exists():
|
||||
raise ParseError("No objects found")
|
||||
|
||||
# Update the objects
|
||||
for obj in objects:
|
||||
# for field, value in updates.items():
|
||||
# setattr(obj, field, value)
|
||||
# obj.save()
|
||||
serializer = CertificateSerializer(obj, data=updates, partial=True)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
serializer.save()
|
||||
|
||||
return Response()
|
Loading…
Reference in New Issue