feature<master> feat:新增评审 质量表彰 质量活动 实验室 外审员的导出功能
This commit is contained in:
parent
39699e1a7a
commit
94ef5e3121
|
@ -49,3 +49,12 @@ export function getMyEas(query) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function exportData(data) {
|
||||||
|
return request({
|
||||||
|
url: `/info/ea/filter_by_date/`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
|
@ -55,3 +55,11 @@ export function getRc_activate() {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function exportData(data) {
|
||||||
|
return request({
|
||||||
|
url: `/info/qa/filter_by_date/`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -55,3 +55,12 @@ export function getRc_activate() {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function exportData(data) {
|
||||||
|
return request({
|
||||||
|
url: `/info/qc/filter_by_date/`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -49,3 +49,12 @@ export function getMyRs(query) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function exportData(data) {
|
||||||
|
return request({
|
||||||
|
url: `/info/ar/filter_by_date/`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card class="elHeader">
|
<el-card class="elHeader">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleAddFile">新增</el-button>
|
<el-button type="primary" icon="el-icon-plus" @click="handleAddFile">新增</el-button>
|
||||||
<el-button type="primary" @click="handleImport('ea')">导入</el-button>
|
<el-button type="primary" @click="showExportDialog = true">导出</el-button>
|
||||||
<!-- <el-button type="primary" size="mini" icon="el-icon-plus" @click="handleCreate('oinspect')"></el-button> -->
|
|
||||||
<el-button type="primary" @click="exportTableExcel('oinspect','外部监督检查信息')">导出</el-button>
|
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card style="margin-top: 10px">
|
<el-card style="margin-top: 10px">
|
||||||
<el-table v-loading="listLoading"
|
<el-table v-loading="listLoading"
|
||||||
|
@ -19,11 +17,6 @@
|
||||||
<el-table-column label="联系方式" prop="contact"></el-table-column>
|
<el-table-column label="联系方式" prop="contact"></el-table-column>
|
||||||
<el-table-column label="评审领域" prop="judging_areas"></el-table-column>
|
<el-table-column label="评审领域" prop="judging_areas"></el-table-column>
|
||||||
<el-table-column label="备注" prop="remark"></el-table-column>
|
<el-table-column label="备注" prop="remark"></el-table-column>
|
||||||
<!-- <el-table-column align="center" label="文件下载">
|
|
||||||
<template slot-scope="scope" v-if="scope.row.file_.file">
|
|
||||||
<el-link :href="scope.row.file_.file" type="primary">下载</el-link>
|
|
||||||
</template>
|
|
||||||
</el-table-column> -->
|
|
||||||
<el-table-column align="center" label="操作" width="120px" fixed="right">
|
<el-table-column align="center" label="操作" width="120px" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link :disabled="!checkPermission(['infoCollect_EA'])" type="primary" size="small"
|
<el-link :disabled="!checkPermission(['infoCollect_EA'])" type="primary" size="small"
|
||||||
|
@ -93,39 +86,31 @@
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:visible.sync="impDialogVisible"
|
title="选择时间范围"
|
||||||
title="导入"
|
:visible.sync="showExportDialog"
|
||||||
:close-on-click-modal="false"
|
width="50%"
|
||||||
|
@close="showExportDialog = false"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form :model="exportForm" ref="exportForm" label-width="120px">
|
||||||
ref="Form"
|
<el-form-item label="开始日期">
|
||||||
label-width="80px"
|
<el-date-picker
|
||||||
label-position="right"
|
v-model="exportForm.startDate"
|
||||||
:rules="rule"
|
type="date"
|
||||||
>
|
placeholder="选择开始日期"
|
||||||
<el-form-item label="下载模板" prop="path">
|
></el-date-picker>
|
||||||
<a :href="downloadUrl">点击下载模板</a>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="导入文件" prop="path">
|
<el-form-item label="结束日期">
|
||||||
<el-upload
|
<el-date-picker
|
||||||
ref="upload"
|
v-model="exportForm.endDate"
|
||||||
:action="upUrl"
|
type="date"
|
||||||
:on-success="handleUpSuccess"
|
placeholder="选择结束日期"
|
||||||
:on-remove="handleRemove_res"
|
></el-date-picker>
|
||||||
:on-preview="handlePreview"
|
|
||||||
:headers="upHeaders"
|
|
||||||
:limit="3"
|
|
||||||
:file-list="fileList"
|
|
||||||
accept=".xls,.xlsx"
|
|
||||||
>
|
|
||||||
<el-button slot="trigger" size="small" type="primary">导入</el-button>
|
|
||||||
</el-upload>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align: right">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button @click=close_dialog()>取 消</el-button>
|
<el-button @click="showExportDialog = false">取消</el-button>
|
||||||
<el-button type="primary" @click="submitUpload">确 定</el-button>
|
<el-button type="primary" @click="handleExport">确定</el-button>
|
||||||
</div>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -135,9 +120,10 @@ import Pagination from "@/components/Pagination"; // secondary package based on
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
import { getDictList, getDictTypeList } from "@/api/dict";
|
import { getDictList, getDictTypeList } from "@/api/dict";
|
||||||
import { getMyEas, delEa, createEa, updateEa } from "@/api/eaduitors";
|
import { getMyEas, delEa, createEa, updateEa, exportData } from "@/api/eaduitors";
|
||||||
import { upUrl, upHeaders } from "@/api/file";
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
|
import { saveAs } from 'file-saver';
|
||||||
|
import XLSX from 'xlsx';
|
||||||
const defaultContent = {
|
const defaultContent = {
|
||||||
name_company:"",
|
name_company:"",
|
||||||
name: "",
|
name: "",
|
||||||
|
@ -169,6 +155,11 @@ export default {
|
||||||
typeOptions: [],
|
typeOptions: [],
|
||||||
listLoading: false,
|
listLoading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
|
showExportDialog: false,
|
||||||
|
exportForm: {
|
||||||
|
startDate: '', // 开始日期
|
||||||
|
endDate: '', // 结束日期
|
||||||
|
},
|
||||||
listQuery: {
|
listQuery: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
|
@ -200,22 +191,6 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
//提交表单
|
|
||||||
submitForm(formName) {
|
|
||||||
this.$refs[formName].validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
if (this.dialogType == "new") {
|
|
||||||
this.addData();
|
|
||||||
} else {
|
|
||||||
this.editData();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log("error submit!!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
close_dialog(){
|
close_dialog(){
|
||||||
this.impDialogVisible = false;
|
this.impDialogVisible = false;
|
||||||
},
|
},
|
||||||
|
@ -275,7 +250,42 @@ export default {
|
||||||
this.listLoading = false;
|
this.listLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleExport() {
|
||||||
|
if (!this.exportForm.startDate || !this.exportForm.endDate) {
|
||||||
|
this.$message.error('请选择完整的起止日期!');
|
||||||
|
return;}
|
||||||
|
console.log(this.exportForm)
|
||||||
|
exportData(this.exportForm).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
let filename = '外审员情况表.xlsx';
|
||||||
|
let tableData = response.data;
|
||||||
|
console.log(tableData)
|
||||||
|
const ws = XLSX.utils.json_to_sheet(tableData.results);
|
||||||
|
const wb = XLSX.utils.book_new();
|
||||||
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||||
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||||
|
try {
|
||||||
|
saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
|
||||||
|
} catch (e) { if(typeof console !== 'undefined') console.log(e, wbout); }
|
||||||
|
return;
|
||||||
|
}else {
|
||||||
|
this.$message.error(data.message || '导出失败');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// this.showExportDialog = false;
|
||||||
|
.catch(error => {
|
||||||
|
this.$message.error('请求失败,请稍后再试');
|
||||||
|
console.error(error);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.handleDialogClose();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDialogClose(){
|
||||||
|
this.showExportDialog = false;
|
||||||
|
this.startDate = '';
|
||||||
|
this.endDate = '';
|
||||||
|
},
|
||||||
handleFilter() {
|
handleFilter() {
|
||||||
this.listQuery.page = 1;
|
this.listQuery.page = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
|
@ -352,42 +362,6 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
submitForm(form) {
|
|
||||||
this.$refs.dialogForm.validate(async (valid) => {
|
|
||||||
if (valid) {
|
|
||||||
this.isSaveing = true;
|
|
||||||
try {
|
|
||||||
var res;
|
|
||||||
if (this.type == "add") {
|
|
||||||
createOinspect(this.form).then(res=>{
|
|
||||||
this.isSaveing = false;
|
|
||||||
if(res.code>=200){
|
|
||||||
this.dialogVisible = false;
|
|
||||||
this.$emit("success",this.type);
|
|
||||||
}else{
|
|
||||||
this.$message.warning(res.data.msg);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if (this.type == "edit") {
|
|
||||||
updateOinspect(this.form.id,this.form).then(res=>{
|
|
||||||
this.isSaveing = false;
|
|
||||||
if(res.code>=200){
|
|
||||||
this.dialogVisible = false;
|
|
||||||
this.$emit("success",this.type);
|
|
||||||
}else{
|
|
||||||
this.$message.warning(res.data.msg);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
} catch (err) {
|
|
||||||
//可以处理校验错误
|
|
||||||
this.isSaveing = false;
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onCancel() {
|
onCancel() {
|
||||||
this.$emit("closed");
|
this.$emit("closed");
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card class="elHeader">
|
<el-card class="elHeader">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleAddFile">新增</el-button>
|
<el-button type="primary" icon="el-icon-plus" @click="handleAddFile">新增</el-button>
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="handleExport">导出</el-button>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card style="margin-top: 10px">
|
<el-card style="margin-top: 10px">
|
||||||
<el-table v-loading="listLoading" :data="tableData.results" :hieght="tableHeight" border fit stripe
|
<el-table v-loading="listLoading" :data="tableData.results" :hieght="tableHeight" border fit stripe
|
||||||
|
@ -92,16 +93,6 @@
|
||||||
<el-form-item label="质量负责人邮箱" prop="email_quality">
|
<el-form-item label="质量负责人邮箱" prop="email_quality">
|
||||||
<el-input v-model="Content.email_quality" placeholder="" />
|
<el-input v-model="Content.email_quality" placeholder="" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="" prop="description">
|
|
||||||
<el-input type="textarea" :rows="2" v-model="Content.description" placeholder="评审描述" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="评审文件" prop="file" v-if="dialogVisible">
|
|
||||||
<el-upload ref="upload" :action="upUrl" :on-preview="handlePreview" :on-success="handleUpSuccess"
|
|
||||||
:on-remove="handleRemove" :headers="upHeaders" :file-list="fileList" :limit="1"
|
|
||||||
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf">
|
|
||||||
<el-button size="small" type="primary">上传文件</el-button>
|
|
||||||
</el-upload>
|
|
||||||
</el-form-item> -->
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||||
|
@ -118,6 +109,8 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
import { getDictList, getDictTypeList } from "@/api/dict";
|
import { getDictList, getDictTypeList } from "@/api/dict";
|
||||||
import {createCt, del_contact, updateContact, getCtAll, getCt } from "@/api/contacts";
|
import {createCt, del_contact, updateContact, getCtAll, getCt } from "@/api/contacts";
|
||||||
import { upUrl, upHeaders } from "@/api/file";
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
|
import { saveAs } from 'file-saver';
|
||||||
|
import XLSX from 'xlsx';
|
||||||
const defaultContent = {
|
const defaultContent = {
|
||||||
name: "",
|
name: "",
|
||||||
address: "",
|
address: "",
|
||||||
|
@ -225,7 +218,18 @@ export default {
|
||||||
this.listLoading = false;
|
this.listLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleExport() {
|
||||||
|
let filename = '实验室联系方式表.xlsx';
|
||||||
|
console.log(this.tableData)
|
||||||
|
const ws = XLSX.utils.json_to_sheet(this.tableData.results);
|
||||||
|
const wb = XLSX.utils.book_new();
|
||||||
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||||
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||||
|
try {
|
||||||
|
saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
|
||||||
|
} catch (e) { if(typeof console !== 'undefined') console.log(e, wbout); }
|
||||||
|
return;
|
||||||
|
},
|
||||||
handleFilter() {
|
handleFilter() {
|
||||||
this.listQuery.page = 1;
|
this.listQuery.page = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card class="elHeader">
|
<el-card class="elHeader">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleAddFile">新增</el-button>
|
<el-button type="primary" icon="el-icon-plus" @click="handleAddFile">新增</el-button>
|
||||||
|
<el-button type="primary" @click="showExportDialog = true">导出</el-button>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card style="margin-top: 10px">
|
<el-card style="margin-top: 10px">
|
||||||
<el-table v-loading="listLoading"
|
<el-table v-loading="listLoading"
|
||||||
|
@ -20,7 +21,7 @@
|
||||||
<el-table-column label="活动地点" prop="place"></el-table-column>
|
<el-table-column label="活动地点" prop="place"></el-table-column>
|
||||||
<el-table-column label="活动参与单位数量" prop="participations"></el-table-column>
|
<el-table-column label="活动参与单位数量" prop="participations"></el-table-column>
|
||||||
<el-table-column label="活动中发挥的作用" prop="function"></el-table-column>
|
<el-table-column label="活动中发挥的作用" prop="function"></el-table-column>
|
||||||
<el-table-column label="活动收益" prop="earnings"></el-table-column>
|
<el-table-column label="活动收益(元)" prop="earnings" ></el-table-column>
|
||||||
<!-- <el-table-column align="center" label="文件下载">
|
<!-- <el-table-column align="center" label="文件下载">
|
||||||
<template slot-scope="scope" v-if="scope.row.file_.file">
|
<template slot-scope="scope" v-if="scope.row.file_.file">
|
||||||
<el-link :href="scope.row.file_.file" type="primary">下载</el-link>
|
<el-link :href="scope.row.file_.file" type="primary">下载</el-link>
|
||||||
|
@ -87,7 +88,7 @@
|
||||||
<el-form-item label="活动中发挥的作用" prop="function" >
|
<el-form-item label="活动中发挥的作用" prop="function" >
|
||||||
<el-input v-model="Content.function"></el-input>
|
<el-input v-model="Content.function"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="活动收益" prop="earnings" >
|
<el-form-item label="活动收益(元)" prop="earnings" >
|
||||||
<el-input v-model="Content.earnings"></el-input>
|
<el-input v-model="Content.earnings"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="活动时间" prop="activate_time">
|
<el-form-item label="活动时间" prop="activate_time">
|
||||||
|
@ -113,6 +114,33 @@
|
||||||
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
title="选择时间范围"
|
||||||
|
:visible.sync="showExportDialog"
|
||||||
|
width="50%"
|
||||||
|
@close="showExportDialog = false"
|
||||||
|
>
|
||||||
|
<el-form :model="exportForm" ref="exportForm" label-width="120px">
|
||||||
|
<el-form-item label="开始日期">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="exportForm.startDate"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择开始日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="结束日期">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="exportForm.endDate"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="showExportDialog = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleExport">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -121,8 +149,11 @@ import Pagination from "@/components/Pagination"; // secondary package based on
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
import { getDictList, getDictTypeList } from "@/api/dict";
|
import { getDictList, getDictTypeList } from "@/api/dict";
|
||||||
import { getRcs, createRc, del_activate, updateRc, getMyRcs } from "@/api/qa";
|
import { getRcs, createRc, del_activate, updateRc, getMyRcs, exportData } from "@/api/qa";
|
||||||
import { upUrl, upHeaders } from "@/api/file";
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
|
import { saveAs } from 'file-saver';
|
||||||
|
import XLSX from 'xlsx';
|
||||||
|
|
||||||
|
|
||||||
const defaultContent = {
|
const defaultContent = {
|
||||||
name: "",
|
name: "",
|
||||||
|
@ -158,6 +189,11 @@ export default {
|
||||||
typeOptions: [],
|
typeOptions: [],
|
||||||
listLoading: false,
|
listLoading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
|
showExportDialog: false,
|
||||||
|
exportForm: {
|
||||||
|
startDate: '', // 开始日期
|
||||||
|
endDate: '', // 结束日期
|
||||||
|
},
|
||||||
listQuery: {
|
listQuery: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
|
@ -208,6 +244,42 @@ export default {
|
||||||
this.getList()
|
this.getList()
|
||||||
|
|
||||||
},
|
},
|
||||||
|
handleExport() {
|
||||||
|
if (!this.exportForm.startDate || !this.exportForm.endDate) {
|
||||||
|
this.$message.error('请选择完整的起止日期!');
|
||||||
|
return;}
|
||||||
|
console.log(this.exportForm)
|
||||||
|
exportData(this.exportForm).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
let filename = '质量活动表.xlsx';
|
||||||
|
let tableData = response.data;
|
||||||
|
console.log(tableData)
|
||||||
|
const ws = XLSX.utils.json_to_sheet(tableData.results);
|
||||||
|
const wb = XLSX.utils.book_new();
|
||||||
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||||
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||||
|
try {
|
||||||
|
saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
|
||||||
|
} catch (e) { if(typeof console !== 'undefined') console.log(e, wbout); }
|
||||||
|
return;
|
||||||
|
}else {
|
||||||
|
this.$message.error(data.message || '导出失败');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// this.showExportDialog = false;
|
||||||
|
.catch(error => {
|
||||||
|
this.$message.error('请求失败,请稍后再试');
|
||||||
|
console.error(error);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.handleDialogClose();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDialogClose(){
|
||||||
|
this.showExportDialog = false;
|
||||||
|
this.startDate = '';
|
||||||
|
this.endDate = '';
|
||||||
|
},
|
||||||
handlePreview(file) {
|
handlePreview(file) {
|
||||||
if ("url" in file) {
|
if ("url" in file) {
|
||||||
window.open(file.url);
|
window.open(file.url);
|
||||||
|
@ -289,6 +361,7 @@ export default {
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
async confirm(form) {
|
async confirm(form) {
|
||||||
this.$refs[form].validate((valid) => {
|
this.$refs[form].validate((valid) => {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card class="elHeader">
|
<el-card class="elHeader">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleAddFile">新增</el-button>
|
<el-button type="primary" icon="el-icon-plus" @click="handleAddFile">新增</el-button>
|
||||||
|
<el-button type="primary" @click="showExportDialog = true">导出</el-button>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card style="margin-top: 10px">
|
<el-card style="margin-top: 10px">
|
||||||
<el-table v-loading="listLoading" :data="tableData.results" :hieght="tableHeight" border fit stripe
|
<el-table v-loading="listLoading" :data="tableData.results" :hieght="tableHeight" border fit stripe
|
||||||
|
@ -28,12 +29,6 @@
|
||||||
<el-table-column label="获奖日期">
|
<el-table-column label="获奖日期">
|
||||||
<template slot-scope="scope">{{ scope.row.awarded_date }}</template>
|
<template slot-scope="scope">{{ scope.row.awarded_date }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<!-- <el-table-column align="center" label="文件下载">
|
|
||||||
<template slot-scope="scope" v-if="scope.row.file_.file">
|
|
||||||
<el-link :href="scope.row.file_.file" type="primary">下载</el-link>
|
|
||||||
</template>
|
|
||||||
</el-table-column> -->
|
|
||||||
<el-table-column align="center" label="操作" width="120px" fixed="right">
|
<el-table-column align="center" label="操作" width="120px" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link :disabled="!checkPermission(['infoCollect_QC'])" type="primary" size="small"
|
<el-link :disabled="!checkPermission(['infoCollect_QC'])" type="primary" size="small"
|
||||||
|
@ -77,22 +72,39 @@
|
||||||
style="width:50%"
|
style="width:50%"
|
||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="" prop="description">
|
|
||||||
<el-input type="textarea" :rows="2" v-model="Content.description" placeholder="评审描述" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="评审文件" prop="file" v-if="dialogVisible">
|
|
||||||
<el-upload ref="upload" :action="upUrl" :on-preview="handlePreview" :on-success="handleUpSuccess"
|
|
||||||
:on-remove="handleRemove" :headers="upHeaders" :file-list="fileList" :limit="1"
|
|
||||||
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf">
|
|
||||||
<el-button size="small" type="primary">上传文件</el-button>
|
|
||||||
</el-upload>
|
|
||||||
</el-form-item> -->
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
title="选择时间范围"
|
||||||
|
:visible.sync="showExportDialog"
|
||||||
|
width="50%"
|
||||||
|
@close="showExportDialog = false"
|
||||||
|
>
|
||||||
|
<el-form :model="exportForm" ref="exportForm" label-width="120px">
|
||||||
|
<el-form-item label="开始日期">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="exportForm.startDate"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择开始日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="结束日期">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="exportForm.endDate"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="showExportDialog = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleExport">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -101,8 +113,10 @@ import Pagination from "@/components/Pagination"; // secondary package based on
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
import { getDictList, getDictTypeList } from "@/api/dict";
|
import { getDictList, getDictTypeList } from "@/api/dict";
|
||||||
import { getRcs, createRc, del_commend, updateRc, getMyRcs } from "@/api/qc";
|
import { getRcs, createRc, del_commend, updateRc, getMyRcs, exportData } from "@/api/qc";
|
||||||
import { upUrl, upHeaders } from "@/api/file";
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
|
import { saveAs } from 'file-saver';
|
||||||
|
import XLSX from 'xlsx';
|
||||||
const defaultContent = {
|
const defaultContent = {
|
||||||
name: "",
|
name: "",
|
||||||
commendation_name: "",
|
commendation_name: "",
|
||||||
|
@ -132,6 +146,7 @@ export default {
|
||||||
typeOptions: [],
|
typeOptions: [],
|
||||||
listLoading: false,
|
listLoading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
|
showExportDialog: false,
|
||||||
listQuery: {
|
listQuery: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
|
@ -145,6 +160,10 @@ export default {
|
||||||
},
|
},
|
||||||
filterOrgText: "",
|
filterOrgText: "",
|
||||||
tableHeight: null,
|
tableHeight: null,
|
||||||
|
exportForm: {
|
||||||
|
startDate: '', // 开始日期
|
||||||
|
endDate: '', // 结束日期
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
|
@ -247,6 +266,42 @@ export default {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleExport() {
|
||||||
|
if (!this.exportForm.startDate || !this.exportForm.endDate) {
|
||||||
|
this.$message.error('请选择完整的起止日期!');
|
||||||
|
return;}
|
||||||
|
console.log(this.exportForm)
|
||||||
|
exportData(this.exportForm).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
let filename = '质量表彰表.xlsx';
|
||||||
|
let tableData = response.data;
|
||||||
|
console.log(tableData)
|
||||||
|
const ws = XLSX.utils.json_to_sheet(tableData.results);
|
||||||
|
const wb = XLSX.utils.book_new();
|
||||||
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||||
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||||
|
try {
|
||||||
|
saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
|
||||||
|
} catch (e) { if(typeof console !== 'undefined') console.log(e, wbout); }
|
||||||
|
return;
|
||||||
|
}else {
|
||||||
|
this.$message.error(data.message || '导出失败');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// this.showExportDialog = false;
|
||||||
|
.catch(error => {
|
||||||
|
this.$message.error('请求失败,请稍后再试');
|
||||||
|
console.error(error);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.handleDialogClose();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDialogClose(){
|
||||||
|
this.showExportDialog = false;
|
||||||
|
this.startDate = '';
|
||||||
|
this.endDate = '';
|
||||||
|
},
|
||||||
async confirm(form) {
|
async confirm(form) {
|
||||||
this.$refs[form].validate((valid) => {
|
this.$refs[form].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card class="elHeader">
|
<el-card class="elHeader">
|
||||||
|
<div>
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleAddFile">新增</el-button>
|
<el-button type="primary" icon="el-icon-plus" @click="handleAddFile">新增</el-button>
|
||||||
|
<el-button type="primary" @click="showExportDialog = true">导出</el-button>
|
||||||
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card style="margin-top: 10px">
|
<el-card style="margin-top: 10px">
|
||||||
<el-table v-loading="listLoading" :data="tableData.results" :hieght="tableHeight" border fit stripe
|
<el-table v-loading="listLoading" :data="tableData.results" :hieght="tableHeight" border fit stripe
|
||||||
|
@ -32,11 +35,6 @@
|
||||||
<template slot-scope="scope">{{ scope.row.add_count }}</template>
|
<template slot-scope="scope">{{ scope.row.add_count }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<!-- <el-table-column align="center" label="文件下载">
|
|
||||||
<template slot-scope="scope" v-if="scope.row.file_.file">
|
|
||||||
<el-link :href="scope.row.file_.file" type="primary">下载</el-link>
|
|
||||||
</template>
|
|
||||||
</el-table-column> -->
|
|
||||||
<el-table-column align="center" label="操作" width="120px" fixed="right">
|
<el-table-column align="center" label="操作" width="120px" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link :disabled="!checkPermission(['infoCollect_RS'])" type="primary" size="small"
|
<el-link :disabled="!checkPermission(['infoCollect_RS'])" type="primary" size="small"
|
||||||
|
@ -109,22 +107,39 @@
|
||||||
style="width:50%"
|
style="width:50%"
|
||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="" prop="description">
|
|
||||||
<el-input type="textarea" :rows="2" v-model="Content.description" placeholder="评审描述" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="评审文件" prop="file" v-if="dialogVisible">
|
|
||||||
<el-upload ref="upload" :action="upUrl" :on-preview="handlePreview" :on-success="handleUpSuccess"
|
|
||||||
:on-remove="handleRemove" :headers="upHeaders" :file-list="fileList" :limit="1"
|
|
||||||
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf">
|
|
||||||
<el-button size="small" type="primary">上传文件</el-button>
|
|
||||||
</el-upload>
|
|
||||||
</el-form-item> -->
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
title="选择时间范围"
|
||||||
|
:visible.sync="showExportDialog"
|
||||||
|
width="50%"
|
||||||
|
@close="showExportDialog = false"
|
||||||
|
>
|
||||||
|
<el-form :model="exportForm" ref="exportForm" label-width="120px">
|
||||||
|
<el-form-item label="开始日期">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="exportForm.startDate"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择开始日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="结束日期">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="exportForm.endDate"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="showExportDialog = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleExport">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -133,8 +148,10 @@ import Pagination from "@/components/Pagination"; // secondary package based on
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
import { getDictList, getDictTypeList } from "@/api/dict";
|
import { getDictList, getDictTypeList } from "@/api/dict";
|
||||||
import { createRs, delRs, updateRs, getMyRs, getRs } from "@/api/review";
|
import { createRs, delRs, updateRs, getMyRs, getRs, exportData } from "@/api/review";
|
||||||
import { upUrl, upHeaders } from "@/api/file";
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
|
import { saveAs } from 'file-saver';
|
||||||
|
import XLSX from 'xlsx';
|
||||||
const defaultContent = {
|
const defaultContent = {
|
||||||
name: "",
|
name: "",
|
||||||
qualification_name: "",
|
qualification_name: "",
|
||||||
|
@ -145,6 +162,7 @@ const defaultContent = {
|
||||||
now_count: "",
|
now_count: "",
|
||||||
add_count: ""
|
add_count: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination, Treeselect },
|
components: { Pagination, Treeselect },
|
||||||
data(){
|
data(){
|
||||||
|
@ -181,6 +199,11 @@ export default {
|
||||||
typeOptions: [],
|
typeOptions: [],
|
||||||
listLoading: false,
|
listLoading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
|
showExportDialog: false,
|
||||||
|
exportForm: {
|
||||||
|
startDate: '', // 开始日期
|
||||||
|
endDate: '', // 结束日期
|
||||||
|
},
|
||||||
listQuery: {
|
listQuery: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
|
@ -201,9 +224,6 @@ export default {
|
||||||
filterOrgText(val) {
|
filterOrgText(val) {
|
||||||
this.$refs.tree.filter(val);
|
this.$refs.tree.filter(val);
|
||||||
},
|
},
|
||||||
},
|
|
||||||
created() {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
@ -251,7 +271,42 @@ export default {
|
||||||
this.listLoading = false;
|
this.listLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleExport() {
|
||||||
|
if (!this.exportForm.startDate || !this.exportForm.endDate) {
|
||||||
|
this.$message.error('请选择完整的起止日期!');
|
||||||
|
return;}
|
||||||
|
console.log(this.exportForm)
|
||||||
|
exportData(this.exportForm).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
let filename = '评审情况表.xlsx';
|
||||||
|
let tableData = response.data;
|
||||||
|
console.log(tableData)
|
||||||
|
const ws = XLSX.utils.json_to_sheet(tableData.results);
|
||||||
|
const wb = XLSX.utils.book_new();
|
||||||
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||||
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||||
|
try {
|
||||||
|
saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
|
||||||
|
} catch (e) { if(typeof console !== 'undefined') console.log(e, wbout); }
|
||||||
|
return;
|
||||||
|
}else {
|
||||||
|
this.$message.error(data.message || '导出失败');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// this.showExportDialog = false;
|
||||||
|
.catch(error => {
|
||||||
|
this.$message.error('请求失败,请稍后再试');
|
||||||
|
console.error(error);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.handleDialogClose();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDialogClose(){
|
||||||
|
this.showExportDialog = false;
|
||||||
|
this.startDate = '';
|
||||||
|
this.endDate = '';
|
||||||
|
},
|
||||||
handleFilter() {
|
handleFilter() {
|
||||||
this.listQuery.page = 1;
|
this.listQuery.page = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
# Generated by Django 3.2.12 on 2024-04-07 08:22
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('system', '0023_alter_user_first_name'),
|
||||||
|
('information', '0017_externalauditors_department'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='abilityreview',
|
||||||
|
name='create_date',
|
||||||
|
field=models.DateTimeField(auto_now_add=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='abilityreview',
|
||||||
|
name='update_date',
|
||||||
|
field=models.DateTimeField(auto_now=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='contact',
|
||||||
|
name='create_date',
|
||||||
|
field=models.DateTimeField(auto_now_add=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='contact',
|
||||||
|
name='update_date',
|
||||||
|
field=models.DateTimeField(auto_now=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='externalauditors',
|
||||||
|
name='create_date',
|
||||||
|
field=models.DateTimeField(auto_now_add=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='externalauditors',
|
||||||
|
name='update_date',
|
||||||
|
field=models.DateTimeField(auto_now=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='qualityactivities',
|
||||||
|
name='create_date',
|
||||||
|
field=models.DateTimeField(auto_now_add=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='qualityactivities',
|
||||||
|
name='update_date',
|
||||||
|
field=models.DateTimeField(auto_now=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='qualitycommendation',
|
||||||
|
name='create_date',
|
||||||
|
field=models.DateTimeField(auto_now_add=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='qualitycommendation',
|
||||||
|
name='update_date',
|
||||||
|
field=models.DateTimeField(auto_now=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='externalauditors',
|
||||||
|
name='department',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='system.organization', verbose_name='单位名称'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='externalauditors',
|
||||||
|
name='remark',
|
||||||
|
field=models.CharField(blank=True, max_length=20, null=True, verbose_name='备注'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,5 +1,8 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.utils import timezone
|
||||||
from apps.system.models import Organization
|
from apps.system.models import Organization
|
||||||
|
|
||||||
|
|
||||||
class AbilityReview(models.Model):
|
class AbilityReview(models.Model):
|
||||||
type_method = (
|
type_method = (
|
||||||
(0, '文审'),
|
(0, '文审'),
|
||||||
|
@ -18,7 +21,16 @@ class AbilityReview(models.Model):
|
||||||
review_date = models.DateField(verbose_name='评审日期', null=True)
|
review_date = models.DateField(verbose_name='评审日期', null=True)
|
||||||
now_count = models.IntegerField(default=0, verbose_name='现有场所数量')
|
now_count = models.IntegerField(default=0, verbose_name='现有场所数量')
|
||||||
add_count = models.IntegerField(default=0, verbose_name='新增场所数量')
|
add_count = models.IntegerField(default=0, verbose_name='新增场所数量')
|
||||||
|
create_date = models.DateTimeField(auto_now_add=True, null=True)
|
||||||
|
update_date = models.DateTimeField(auto_now=True, null=True)
|
||||||
department = models.ForeignKey(Organization, on_delete=models.PROTECT, null=True, verbose_name='所属单位')
|
department = models.ForeignKey(Organization, on_delete=models.PROTECT, null=True, verbose_name='所属单位')
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if not self.id:
|
||||||
|
self.create_date = timezone.now()
|
||||||
|
# update_date将自动设置为当前时间,因为auto_now=True
|
||||||
|
super(AbilityReview, self).save(*args, **kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = '评审情况'
|
verbose_name = '评审情况'
|
||||||
db_table = 'ability_review'
|
db_table = 'ability_review'
|
||||||
|
@ -32,8 +44,16 @@ class QualityCommendation(models.Model):
|
||||||
awardee_people = models.CharField(max_length=20, verbose_name='获奖人', null=True)
|
awardee_people = models.CharField(max_length=20, verbose_name='获奖人', null=True)
|
||||||
awarded_by = models.CharField(max_length=20, verbose_name='颁奖单位')
|
awarded_by = models.CharField(max_length=20, verbose_name='颁奖单位')
|
||||||
awarded_date = models.DateField(verbose_name='获奖日期', null=True)
|
awarded_date = models.DateField(verbose_name='获奖日期', null=True)
|
||||||
|
create_date = models.DateTimeField(auto_now_add=True, null=True)
|
||||||
|
update_date = models.DateTimeField(auto_now=True, null=True)
|
||||||
department = models.ForeignKey(Organization, on_delete=models.PROTECT, null=True, verbose_name='所属单位')
|
department = models.ForeignKey(Organization, on_delete=models.PROTECT, null=True, verbose_name='所属单位')
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if not self.id:
|
||||||
|
self.create_date = timezone.now()
|
||||||
|
# update_date将自动设置为当前时间,因为auto_now=True
|
||||||
|
super(QualityCommendation, self).save(*args, **kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = '质量表彰'
|
verbose_name = '质量表彰'
|
||||||
db_table = 'quality_commendation'
|
db_table = 'quality_commendation'
|
||||||
|
@ -49,8 +69,16 @@ class QualityActivities(models.Model):
|
||||||
participations = models.IntegerField(verbose_name='活动参与单位数量', null=True, blank=True)
|
participations = models.IntegerField(verbose_name='活动参与单位数量', null=True, blank=True)
|
||||||
function = models.CharField(max_length=100, verbose_name='活动中发挥的作用', null=True)
|
function = models.CharField(max_length=100, verbose_name='活动中发挥的作用', null=True)
|
||||||
earnings = models.FloatField(verbose_name='活动收益', null=True)
|
earnings = models.FloatField(verbose_name='活动收益', null=True)
|
||||||
|
create_date = models.DateTimeField(auto_now_add=True, null=True)
|
||||||
|
update_date = models.DateTimeField(auto_now=True, null=True)
|
||||||
department = models.ForeignKey(Organization, on_delete=models.PROTECT, null=True, verbose_name='组织单位')
|
department = models.ForeignKey(Organization, on_delete=models.PROTECT, null=True, verbose_name='组织单位')
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if not self.id:
|
||||||
|
self.create_date = timezone.now()
|
||||||
|
# update_date将自动设置为当前时间,因为auto_now=True
|
||||||
|
super(QualityActivities, self).save(*args, **kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = '质量活动'
|
verbose_name = '质量活动'
|
||||||
db_table = 'quality_activities'
|
db_table = 'quality_activities'
|
||||||
|
@ -67,7 +95,16 @@ class Contact(models.Model):
|
||||||
email_technology = models.CharField(max_length=50, verbose_name='技术负责人邮箱', null=True, blank=True)
|
email_technology = models.CharField(max_length=50, verbose_name='技术负责人邮箱', null=True, blank=True)
|
||||||
head_quality = models.CharField(max_length=50, verbose_name='质量负责人')
|
head_quality = models.CharField(max_length=50, verbose_name='质量负责人')
|
||||||
tel_quality = models.CharField(max_length=20, verbose_name='质量负责人电话')
|
tel_quality = models.CharField(max_length=20, verbose_name='质量负责人电话')
|
||||||
|
create_date = models.DateTimeField(auto_now_add=True, null=True)
|
||||||
|
update_date = models.DateTimeField(auto_now=True, null=True)
|
||||||
email_quality = models.CharField(max_length=50, verbose_name='质量负责人邮箱', null=True, blank=True)
|
email_quality = models.CharField(max_length=50, verbose_name='质量负责人邮箱', null=True, blank=True)
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if not self.id:
|
||||||
|
self.create_date = timezone.now()
|
||||||
|
# update_date将自动设置为当前时间,因为auto_now=True
|
||||||
|
super(Contact, self).save(*args, **kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = '实验室联系方式'
|
verbose_name = '实验室联系方式'
|
||||||
db_table = 'contact'
|
db_table = 'contact'
|
||||||
|
@ -83,7 +120,16 @@ class ExternalAuditors(models.Model):
|
||||||
contact = models.CharField(max_length=20, verbose_name='联系方式')
|
contact = models.CharField(max_length=20, verbose_name='联系方式')
|
||||||
judging_areas = models.CharField(max_length=20, verbose_name='评审领域')
|
judging_areas = models.CharField(max_length=20, verbose_name='评审领域')
|
||||||
remark = models.CharField(max_length=20, verbose_name='备注', null=True, blank=True)
|
remark = models.CharField(max_length=20, verbose_name='备注', null=True, blank=True)
|
||||||
|
create_date = models.DateTimeField(auto_now_add=True, null=True)
|
||||||
|
update_date = models.DateTimeField(auto_now=True, null=True)
|
||||||
department = models.ForeignKey(Organization, on_delete=models.PROTECT, null=True, verbose_name='单位名称')
|
department = models.ForeignKey(Organization, on_delete=models.PROTECT, null=True, verbose_name='单位名称')
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if not self.id:
|
||||||
|
self.create_date = timezone.now()
|
||||||
|
# update_date将自动设置为当前时间,因为auto_now=True
|
||||||
|
super(ExternalAuditors, self).save(*args, **kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = '外审员情况'
|
verbose_name = '外审员情况'
|
||||||
db_table = 'externalauditors'
|
db_table = 'externalauditors'
|
||||||
|
|
|
@ -35,3 +35,4 @@ class ExternalAuditorsSerializer(serializers.ModelSerializer):
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,16 +24,6 @@ class AbilityReviewViewSet(ModelViewSet):
|
||||||
queryset = AbilityReview.objects.all()
|
queryset = AbilityReview.objects.all()
|
||||||
serializer_class = AbilityReviewSerializer
|
serializer_class = AbilityReviewSerializer
|
||||||
|
|
||||||
# 查询子以及已经本公司的评审情况
|
|
||||||
@action(detail=False, methods=['get'])
|
|
||||||
def review_info(self, request, *args, **kwargs):
|
|
||||||
father_dept = request.user.dept
|
|
||||||
child_dept = get_child_queryset2(father_dept)
|
|
||||||
query = AbilityReview.objects.filter(department__in=child_dept)
|
|
||||||
serializer = AbilityReviewSerializer(query, many=True)
|
|
||||||
data = {'count':len(serializer.data), 'results':serializer.data}
|
|
||||||
return Response(data, status = status.HTTP_200_OK)
|
|
||||||
|
|
||||||
def create(self, request):
|
def create(self, request):
|
||||||
if Organization.objects.filter(name=request.data['name']).exists():
|
if Organization.objects.filter(name=request.data['name']).exists():
|
||||||
department_id = Organization.objects.filter(name=request.data['name']).first().id
|
department_id = Organization.objects.filter(name=request.data['name']).first().id
|
||||||
|
@ -44,6 +34,52 @@ class AbilityReviewViewSet(ModelViewSet):
|
||||||
return Response(serializer.data, status = status.HTTP_201_CREATED)
|
return Response(serializer.data, status = status.HTTP_201_CREATED)
|
||||||
else:
|
else:
|
||||||
raise ParseError("公司名称不存在")
|
raise ParseError("公司名称不存在")
|
||||||
|
|
||||||
|
# 查询子以及已经本公司的评审情况
|
||||||
|
@action(detail=False, methods=['get'])
|
||||||
|
def review_info(self, request, *args, **kwargs):
|
||||||
|
father_dept = request.user.dept
|
||||||
|
child_dept = get_child_queryset2(father_dept)
|
||||||
|
query = AbilityReview.objects.filter(department__in=child_dept)
|
||||||
|
serializer = AbilityReviewSerializer(query, many=True)
|
||||||
|
data = {'count':len(serializer.data), 'results':serializer.data}
|
||||||
|
return Response(data, status = status.HTTP_200_OK)
|
||||||
|
|
||||||
|
#根据日期过滤数据
|
||||||
|
@action(detail=False, methods=['post'])
|
||||||
|
def filter_by_date(self, request, *args, **kwargs):
|
||||||
|
father_dept = request.user.dept
|
||||||
|
child_dept = get_child_queryset2(father_dept)
|
||||||
|
start_date = request.data['startDate']
|
||||||
|
end_date = request.data['endDate']
|
||||||
|
query = AbilityReview.objects.filter(create_date__range=[start_date, end_date], department__in=child_dept)
|
||||||
|
serializer = AbilityReviewSerializer(query, many=True)
|
||||||
|
data_list = serializer.data
|
||||||
|
# 构造结构化数据
|
||||||
|
map_key_dict = {"name": "公司名称",
|
||||||
|
"qualification_name": "资质名称",
|
||||||
|
"qualification_level": "资质等级",
|
||||||
|
"judging_method": "评审方法",
|
||||||
|
"judging_type": "评审类型",
|
||||||
|
"add_param":"新增参数",
|
||||||
|
"review_date": "评审日期",
|
||||||
|
"now_count":"现有场所数量",
|
||||||
|
"add_count":"新增场所数量",
|
||||||
|
}
|
||||||
|
review_method = {0:"文审", 10:"现场"}
|
||||||
|
juge_type = {0:"初次", 10:"扩项", 20:"变更", 30:"复评",40:"迁址"}
|
||||||
|
|
||||||
|
# 遍历字典,将旧key映射到新key
|
||||||
|
new_data_list = []
|
||||||
|
for i in range(len(data_list)):
|
||||||
|
new_data_dict = {map_key_dict[old_key]: old_value for old_key, old_value in data_list[i].items() if old_key in map_key_dict.keys()}
|
||||||
|
new_data_dict['评审方法'] = review_method[data_list[i]['judging_method']]
|
||||||
|
new_data_dict['评审类型'] = juge_type[data_list[i]['judging_type']]
|
||||||
|
new_data_list.append(new_data_dict)
|
||||||
|
data = {'count':len(serializer.data), 'results':new_data_list}
|
||||||
|
return Response(data, status = status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|
||||||
class ImpMixin:
|
class ImpMixin:
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
mydept = self.request.user.dept
|
mydept = self.request.user.dept
|
||||||
|
@ -161,6 +197,30 @@ class QualityCommendationViewSet(ModelViewSet):
|
||||||
data = {'count':len(serializer.data), 'results':serializer.data}
|
data = {'count':len(serializer.data), 'results':serializer.data}
|
||||||
return Response(data, status = status.HTTP_200_OK)
|
return Response(data, status = status.HTTP_200_OK)
|
||||||
|
|
||||||
|
#根据日期过滤数据
|
||||||
|
@action(detail=False, methods=['post'])
|
||||||
|
def filter_by_date(self, request, *args, **kwargs):
|
||||||
|
father_dept = request.user.dept
|
||||||
|
child_dept = get_child_queryset2(father_dept)
|
||||||
|
start_date = request.data['startDate']
|
||||||
|
end_date = request.data['endDate']
|
||||||
|
query = QualityCommendation.objects.filter(create_date__range=[start_date, end_date], department__in=child_dept)
|
||||||
|
serializer = QualityCommendationSerializer(query, many=True)
|
||||||
|
data_list = serializer.data
|
||||||
|
map_key_dict = {"name": "项目名称",
|
||||||
|
"commendation_name": "表彰名称",
|
||||||
|
"Awards_level": "获奖等级",
|
||||||
|
"awardee_company": "获奖单位",
|
||||||
|
"awardee_people": "获奖人",
|
||||||
|
"awarded_by":"颁奖单位",
|
||||||
|
"review_date": "获奖日期"
|
||||||
|
}
|
||||||
|
new_data_list = []
|
||||||
|
for i in range(len(data_list)):
|
||||||
|
new_data_list.append({map_key_dict[key] : value for key, value in data_list[i].items() if key in map_key_dict.keys()})
|
||||||
|
data = {'count':len(serializer.data), 'results':new_data_list}
|
||||||
|
return Response(data, status = status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|
||||||
# 质量活动
|
# 质量活动
|
||||||
class QualityActivitiesViewSet(ModelViewSet):
|
class QualityActivitiesViewSet(ModelViewSet):
|
||||||
|
@ -187,6 +247,36 @@ class QualityActivitiesViewSet(ModelViewSet):
|
||||||
data = {'count':len(serializer.data), 'results':serializer.data}
|
data = {'count':len(serializer.data), 'results':serializer.data}
|
||||||
return Response(data, status = status.HTTP_200_OK)
|
return Response(data, status = status.HTTP_200_OK)
|
||||||
|
|
||||||
|
#根据日期过滤数据
|
||||||
|
@action(detail=False, methods=['post'])
|
||||||
|
def filter_by_date(self, request, *args, **kwargs):
|
||||||
|
father_dept = request.user.dept
|
||||||
|
child_dept = get_child_queryset2(father_dept)
|
||||||
|
start_date = request.data['startDate']
|
||||||
|
end_date = request.data['endDate']
|
||||||
|
query = QualityActivities.objects.filter(create_date__range=[start_date, end_date], department__in=child_dept)
|
||||||
|
serializer = QualityActivitiesSerializer(query, many=True)
|
||||||
|
data_list = serializer.data
|
||||||
|
map_key_dict = {"name": "活动名称",
|
||||||
|
"roles": "参与角色",
|
||||||
|
"collaborators": "合作方",
|
||||||
|
"orgunits": "组织单位",
|
||||||
|
"place": "活动地点",
|
||||||
|
"activate_time":"活动时间",
|
||||||
|
"participations": "活动参与单位数量",
|
||||||
|
"function": "活动中发挥的作用",
|
||||||
|
"earnings":"活动收益(元)"
|
||||||
|
}
|
||||||
|
role_map ={0:"组织方", 1:"活动方"}
|
||||||
|
new_data_list = []
|
||||||
|
for i in range(len(data_list)):
|
||||||
|
new_dict = {map_key_dict[key] : value for key, value in data_list[i].items() if key in map_key_dict.keys()}
|
||||||
|
new_dict['参与角色'] = role_map[data_list[i]['roles']]
|
||||||
|
new_data_list.append(new_dict)
|
||||||
|
data = {'count':len(serializer.data), 'results':new_data_list}
|
||||||
|
return Response(data, status = status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|
||||||
class ContactViewSet(ModelViewSet):
|
class ContactViewSet(ModelViewSet):
|
||||||
queryset = Contact.objects.all()
|
queryset = Contact.objects.all()
|
||||||
serializer_class = ContactSerializer
|
serializer_class = ContactSerializer
|
||||||
|
@ -215,3 +305,29 @@ class ExternalAuditorsViewSet(ModelViewSet):
|
||||||
data = {'count':len(serializer.data), 'results':serializer.data}
|
data = {'count':len(serializer.data), 'results':serializer.data}
|
||||||
return Response(data, status = status.HTTP_200_OK)
|
return Response(data, status = status.HTTP_200_OK)
|
||||||
|
|
||||||
|
#根据日期过滤数据
|
||||||
|
@action(detail=False, methods=['post'])
|
||||||
|
def filter_by_date(self, request, *args, **kwargs):
|
||||||
|
father_dept = request.user.dept
|
||||||
|
child_dept = get_child_queryset2(father_dept)
|
||||||
|
start_date = request.data['startDate']
|
||||||
|
end_date = request.data['endDate']
|
||||||
|
query = ExternalAuditors.objects.filter(create_date__range=[start_date, end_date], department__in=child_dept)
|
||||||
|
serializer = ExternalAuditorsSerializer(query, many=True)
|
||||||
|
data_list = serializer.data
|
||||||
|
map_key_dict = {"name_company": "公司名称",
|
||||||
|
"name": "姓名",
|
||||||
|
"certificate_expiration": "证书有效期",
|
||||||
|
"contact": "联系方式",
|
||||||
|
"judging_areas": "评审领域",
|
||||||
|
"remark":"备注",
|
||||||
|
"review_types": "评审类型"
|
||||||
|
}
|
||||||
|
role_map ={0:"CNAS", 1:"CMA", 2:"DICA"}
|
||||||
|
new_data_list = []
|
||||||
|
for i in range(len(data_list)):
|
||||||
|
new_dict = {map_key_dict[key] : value for key, value in data_list[i].items() if key in map_key_dict.keys()}
|
||||||
|
new_dict['评审类型'] = role_map[data_list[i]['review_types']]
|
||||||
|
new_data_list.append(new_dict)
|
||||||
|
data = {'count':len(serializer.data), 'results':new_data_list}
|
||||||
|
return Response(data, status = status.HTTP_200_OK)
|
Loading…
Reference in New Issue