fix:需求变更开发
This commit is contained in:
parent
e3f6d57875
commit
f2e9f45bd6
|
@ -11,43 +11,51 @@ export function getMyEas(query) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function getOneEa(id) {
|
export function getOneEa(id) {
|
||||||
return request({
|
return request({
|
||||||
url: `/info/ea/${id}/`,
|
url: `/info/ea/${id}/`,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function updateEa(id, data) {
|
export function updateEa(id, data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/info/ea/${id}/`,
|
url: `/info/ea/${id}/`,
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createEa(data) {
|
export function createEa(data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/info/ea/`,
|
url: `/info/ea/`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function delEa(id) {
|
export function delEa(id) {
|
||||||
return request({
|
return request({
|
||||||
url: `/info/ea/${id}/`,
|
url: `/info/ea/${id}/`,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function exportData(data) {
|
export function exportData(data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/info/ea/filter_by_date/`,
|
url: `/info/ea/filter_by_date/`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function impData(data) {
|
||||||
|
return request({
|
||||||
|
url: `/info/ea/imp/`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ import request from '@/utils/request'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export function getgetMyRcsRcs(query) {
|
export function getgetMyRcs(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/info/qa/',
|
url: '/info/qa/',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
@ -56,3 +56,12 @@ export function getRc_activate() {
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function impData(data) {
|
||||||
|
return request({
|
||||||
|
url: `/info/qa/imp/`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,3 +54,11 @@ export function getRc_activate() {
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function impData(data) {
|
||||||
|
return request({
|
||||||
|
url: `/info/qc/imp/`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -52,3 +52,11 @@ export function getMyRs(query) {
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function impData(data) {
|
||||||
|
return request({
|
||||||
|
url: `/info/ar/imp/`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -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="handleImport('ea')">导入</el-button>
|
||||||
<el-button type="primary" @click="showExportDialog = true">导出</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">
|
||||||
|
@ -46,18 +47,7 @@
|
||||||
<el-input v-model="Content.name" placeholder="姓名"/>
|
<el-input v-model="Content.name" placeholder="姓名"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="评审类型">
|
<el-form-item label="评审类型">
|
||||||
<el-select
|
<el-input v-model="Content.review_types" placeholder="评审类型"/>
|
||||||
v-model="Content.review_types"
|
|
||||||
placeholder="请选择"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in reviewOptions"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.key"
|
|
||||||
:value="item.value"
|
|
||||||
>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="证书有效期" prop="certificate_expiration">
|
<el-form-item label="证书有效期" prop="certificate_expiration">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
|
@ -85,6 +75,42 @@
|
||||||
<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
|
||||||
|
:visible.sync="impDialogVisible"
|
||||||
|
title="导入"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Form"
|
||||||
|
label-width="80px"
|
||||||
|
label-position="right"
|
||||||
|
:rules="rule"
|
||||||
|
>
|
||||||
|
<el-form-item label="下载模板" prop="path">
|
||||||
|
<a :href="downloadUrl">点击下载模板</a>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="导入文件" prop="file">
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
:action="upUrl"
|
||||||
|
:on-success="handleUpSuccess"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
:on-preview="handlePreview"
|
||||||
|
:headers="upHeaders"
|
||||||
|
:file-list="fileList"
|
||||||
|
:limit="1"
|
||||||
|
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip">
|
||||||
|
<el-button size="small" type="primary">上传文件</el-button>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div style="text-align: right">
|
||||||
|
<el-button type="danger" @click="close_dialog">取消</el-button>
|
||||||
|
<el-button type="primary" @click="submitUpload" :disabled="saveLoading">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="选择时间范围"
|
title="选择时间范围"
|
||||||
:visible.sync="showExportDialog"
|
:visible.sync="showExportDialog"
|
||||||
|
@ -120,7 +146,7 @@ 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, exportData } from "@/api/eaduitors";
|
import { getMyEas, delEa, createEa, updateEa, exportData, impData } from "@/api/eaduitors";
|
||||||
import { upUrl, upHeaders } from "@/api/file";
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
import { saveAs } from 'file-saver';
|
import { saveAs } from 'file-saver';
|
||||||
import XLSX from 'xlsx';
|
import XLSX from 'xlsx';
|
||||||
|
@ -156,6 +182,8 @@ export default {
|
||||||
listLoading: false,
|
listLoading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
showExportDialog: false,
|
showExportDialog: false,
|
||||||
|
saveLoading:false,
|
||||||
|
impDialogVisible: false,
|
||||||
exportForm: {
|
exportForm: {
|
||||||
startDate: '', // 开始日期
|
startDate: '', // 开始日期
|
||||||
endDate: '', // 结束日期
|
endDate: '', // 结束日期
|
||||||
|
@ -164,6 +192,9 @@ export default {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
},
|
},
|
||||||
|
impForm:{
|
||||||
|
file:''
|
||||||
|
},
|
||||||
tableData: {
|
tableData: {
|
||||||
count: 0
|
count: 0
|
||||||
},
|
},
|
||||||
|
@ -178,7 +209,6 @@ export default {
|
||||||
{key:'CMA',value:1},
|
{key:'CMA',value:1},
|
||||||
{key:'DICA',value:2}
|
{key:'DICA',value:2}
|
||||||
],
|
],
|
||||||
ac_options:{0:'组织方', 1:'参与方'}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -193,10 +223,33 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
close_dialog(){
|
close_dialog(){
|
||||||
this.impDialogVisible = false;
|
this.impDialogVisible = false;
|
||||||
|
this.fileList = [];
|
||||||
|
this.impForm.file = '';
|
||||||
|
},
|
||||||
|
handleCreate() {
|
||||||
|
this.Content = Object.assign({}, defaultContent);
|
||||||
|
this.dialogType = "new";
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.fileList = []
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs["Form"].clearValidate();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
submitUpload() {
|
submitUpload() {
|
||||||
this.$refs.upload.submit();
|
this.$refs.upload.submit();
|
||||||
this.impDialogVisible = false;
|
this.impDialogVisible = false;
|
||||||
|
this.saveLoading = true;
|
||||||
|
impData(this.impForm).then(res=>{
|
||||||
|
console.log(this.impForm)
|
||||||
|
if(res.code>=200){
|
||||||
|
this.saveLoading = false;
|
||||||
|
this.$message.success("提交成功");
|
||||||
|
this.getList();
|
||||||
|
}else{
|
||||||
|
this.$message.error(res.message);
|
||||||
|
this.saveLoading = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
handleImport(type){
|
handleImport(type){
|
||||||
this.impDialogVisible = true;
|
this.impDialogVisible = true;
|
||||||
|
@ -219,16 +272,14 @@ export default {
|
||||||
window.open(file.value);
|
window.open(file.value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleUpSuccess(res, file) {
|
handleUpSuccess(res, file, fileList) {
|
||||||
this.fileList = [file];
|
console.log(res, file, fileList)
|
||||||
this.form.notification_form = res.data.path
|
this.impForm.file = res.data.path;
|
||||||
console.log(this.form)
|
console.log(this.impForm)
|
||||||
},
|
},
|
||||||
handleRemove_res(file) {
|
handleRemove(file) {
|
||||||
// 实现删除文件结果告知单
|
this.fileList = [];
|
||||||
this.fileList_res = [];
|
this.impForm.file = '';
|
||||||
this.form.result_form = null
|
|
||||||
console.log(this.form)
|
|
||||||
},
|
},
|
||||||
checkPermission,
|
checkPermission,
|
||||||
|
|
||||||
|
@ -236,7 +287,9 @@ export default {
|
||||||
if (!value) return true;
|
if (!value) return true;
|
||||||
return data.label.indexOf(value) !== -1;
|
return data.label.indexOf(value) !== -1;
|
||||||
},
|
},
|
||||||
|
onSubmit(){
|
||||||
|
|
||||||
|
},
|
||||||
getList() {
|
getList() {
|
||||||
this.listLoading = true;
|
this.listLoading = true;
|
||||||
this.tableData.results =[];
|
this.tableData.results =[];
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<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
|
||||||
highlight-current-row>
|
highlight-current-row>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="姓名">
|
<el-table-column label="公司名称">
|
||||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="地址">
|
<el-table-column label="地址">
|
||||||
|
|
|
@ -2,7 +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-button type="primary" @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"
|
<el-table v-loading="listLoading"
|
||||||
|
@ -133,33 +133,7 @@
|
||||||
<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>
|
||||||
|
@ -277,35 +251,36 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
handleExport() {
|
handleExport() {
|
||||||
if (!this.exportForm.startDate || !this.exportForm.endDate) {
|
// if (!this.exportForm.startDate || !this.exportForm.endDate) {
|
||||||
this.$message.error('请选择完整的起止日期!');
|
// this.$message.error('请选择完整的起止日期!');
|
||||||
return;}
|
// return;}
|
||||||
console.log(this.exportForm)
|
console.log(this.exportForm)
|
||||||
exportData(this.exportForm).then((response) => {
|
getMyQi().then((response) => {
|
||||||
if (response.data) {
|
console.log(response);
|
||||||
let filename = '质量活动表.xlsx';
|
if (response.data) {
|
||||||
let tableData = response.data;
|
let filename = '质量活动表.xlsx';
|
||||||
console.log(tableData)
|
let tableData = response.data;
|
||||||
const ws = XLSX.utils.json_to_sheet(tableData.results);
|
console.log(tableData)
|
||||||
const wb = XLSX.utils.book_new();
|
const ws = XLSX.utils.json_to_sheet(tableData.results);
|
||||||
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
const wb = XLSX.utils.book_new();
|
||||||
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
|
||||||
try {
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
||||||
saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
|
try {
|
||||||
} catch (e) { if(typeof console !== 'undefined') console.log(e, wbout); }
|
saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
|
||||||
return;
|
} catch (e) { if(typeof console !== 'undefined') console.log(e, wbout); }
|
||||||
}else {
|
return;
|
||||||
this.$message.error(data.message || '导出失败');
|
}else {
|
||||||
}
|
this.$message.error(data.message || '导出失败');
|
||||||
})
|
}
|
||||||
// this.showExportDialog = false;
|
})
|
||||||
.catch(error => {
|
// this.showExportDialog = false;
|
||||||
this.$message.error('请求失败,请稍后再试');
|
.catch(error => {
|
||||||
console.error(error);
|
this.$message.error('请求失败,请稍后再试');
|
||||||
})
|
console.error(error);
|
||||||
.finally(() => {
|
})
|
||||||
this.handleDialogClose();
|
.finally(() => {
|
||||||
});
|
this.handleDialogClose();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handleDialogClose(){
|
handleDialogClose(){
|
||||||
this.showExportDialog = false;
|
this.showExportDialog = false;
|
||||||
|
@ -341,7 +316,8 @@ export default {
|
||||||
|
|
||||||
}
|
}
|
||||||
this.listLoading = false;
|
this.listLoading = false;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleAddFile() {
|
handleAddFile() {
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
<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">导入</el-button>
|
||||||
<el-button type="primary" @click="showExportDialog = true">导出</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"
|
||||||
:data="tableData.results"
|
:data="tableData.results"
|
||||||
border fit stripe height="500px"
|
border fit stripe
|
||||||
highlight-current-row>
|
highlight-current-row>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="活动名称" prop="name"></el-table-column>
|
<el-table-column label="活动名称" prop="name"></el-table-column>
|
||||||
|
@ -101,19 +102,47 @@
|
||||||
>
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</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
|
||||||
|
:visible.sync="impDialogVisible"
|
||||||
|
title="导入"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Form"
|
||||||
|
label-width="80px"
|
||||||
|
label-position="right"
|
||||||
|
:rules="rule"
|
||||||
|
>
|
||||||
|
<el-form-item label="下载模板" prop="path">
|
||||||
|
<a :href="downloadUrl">点击下载模板</a>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="导入文件" prop="file">
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
:action="upUrl"
|
||||||
|
:on-success="handleUpSuccess"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
:on-preview="handlePreview"
|
||||||
|
:headers="upHeaders"
|
||||||
|
:file-list="fileList"
|
||||||
|
:limit="1"
|
||||||
|
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip">
|
||||||
|
<el-button size="small" type="primary">上传文件</el-button>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div style="text-align: right">
|
||||||
|
<el-button type="danger" @click="close_dialog">取消</el-button>
|
||||||
|
<el-button type="primary" @click="submitUpload" :disabled="saveLoading">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="选择时间范围"
|
title="选择时间范围"
|
||||||
:visible.sync="showExportDialog"
|
:visible.sync="showExportDialog"
|
||||||
|
@ -149,7 +178,7 @@ 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, exportData } from "@/api/qa";
|
import { getRcs, createRc, del_activate, updateRc, getgetMyRcs, exportData, impData } from "@/api/qa";
|
||||||
import { upUrl, upHeaders } from "@/api/file";
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
import { saveAs } from 'file-saver';
|
import { saveAs } from 'file-saver';
|
||||||
import XLSX from 'xlsx';
|
import XLSX from 'xlsx';
|
||||||
|
@ -190,6 +219,12 @@ export default {
|
||||||
listLoading: false,
|
listLoading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
showExportDialog: false,
|
showExportDialog: false,
|
||||||
|
saveLoading:false,
|
||||||
|
impDialogVisible: false,
|
||||||
|
downloadUrl: process.env.VUE_APP_BASE_API,
|
||||||
|
impForm:{
|
||||||
|
file:''
|
||||||
|
},
|
||||||
exportForm: {
|
exportForm: {
|
||||||
startDate: '', // 开始日期
|
startDate: '', // 开始日期
|
||||||
endDate: '', // 结束日期
|
endDate: '', // 结束日期
|
||||||
|
@ -240,10 +275,37 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleImport(){
|
||||||
|
this.impDialogVisible = true;
|
||||||
|
let file_url = '';
|
||||||
|
file_url = "media/default/质量活动-质量相关活动统计表.xlsx";
|
||||||
|
let base_url = this.downloadUrl.substr(0, this.downloadUrl.length - 3);
|
||||||
|
this.downloadUrl = base_url+file_url;
|
||||||
|
},
|
||||||
getTableList(){
|
getTableList(){
|
||||||
this.getList()
|
this.getList()
|
||||||
|
|
||||||
},
|
},
|
||||||
|
close_dialog(){
|
||||||
|
this.impDialogVisible = false;
|
||||||
|
this.fileList = [];
|
||||||
|
this.impForm.file = '';
|
||||||
|
},
|
||||||
|
submitUpload() {
|
||||||
|
this.$refs.upload.submit();
|
||||||
|
this.impDialogVisible = false;
|
||||||
|
this.saveLoading = true;
|
||||||
|
impData(this.impForm).then(res=>{
|
||||||
|
console.log(this.impForm)
|
||||||
|
if(res.code>=200){
|
||||||
|
this.saveLoading = false;
|
||||||
|
this.$message.success("提交成功");
|
||||||
|
this.getList();
|
||||||
|
}else{
|
||||||
|
this.$message.error(res.message);
|
||||||
|
this.saveLoading = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
handleExport() {
|
handleExport() {
|
||||||
if (!this.exportForm.startDate || !this.exportForm.endDate) {
|
if (!this.exportForm.startDate || !this.exportForm.endDate) {
|
||||||
this.$message.error('请选择完整的起止日期!');
|
this.$message.error('请选择完整的起止日期!');
|
||||||
|
@ -289,10 +351,13 @@ export default {
|
||||||
},
|
},
|
||||||
handleUpSuccess(res, file, filelist) {
|
handleUpSuccess(res, file, filelist) {
|
||||||
this.Content.file = res.data.id;
|
this.Content.file = res.data.id;
|
||||||
|
this.impForm.file = res.data.path;
|
||||||
|
|
||||||
},
|
},
|
||||||
handleRemove(file, filelist) {
|
handleRemove(file, filelist) {
|
||||||
this.Content.file = null;
|
this.Content.file = null;
|
||||||
|
this.fileList = [];
|
||||||
|
this.impForm.file = '';
|
||||||
},
|
},
|
||||||
checkPermission,
|
checkPermission,
|
||||||
|
|
||||||
|
@ -305,7 +370,7 @@ export default {
|
||||||
this.listLoading = true;
|
this.listLoading = true;
|
||||||
this.tableData.results =[];
|
this.tableData.results =[];
|
||||||
this.tableData.count =0;
|
this.tableData.count =0;
|
||||||
getMyRcs(this.listQuery).then((response) => {
|
getgetMyRcs(this.listQuery).then((response) => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.tableData = response.data;
|
this.tableData = response.data;
|
||||||
|
|
|
@ -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="handleImport">导入</el-button>
|
||||||
<el-button type="primary" @click="showExportDialog = true">导出</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">
|
||||||
|
@ -78,6 +79,40 @@
|
||||||
<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
|
||||||
|
:visible.sync="impDialogVisible"
|
||||||
|
title="导入"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Form"
|
||||||
|
label-width="80px"
|
||||||
|
label-position="right"
|
||||||
|
:rules="rule"
|
||||||
|
>
|
||||||
|
<el-form-item label="下载模板" prop="path">
|
||||||
|
<a :href="downloadUrl">点击下载模板</a>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="导入文件" prop="file">
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
:action="upUrl"
|
||||||
|
:on-success="handleUpSuccess"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
:on-preview="handlePreview"
|
||||||
|
:headers="upHeaders"
|
||||||
|
:file-list="fileList"
|
||||||
|
:limit="1"
|
||||||
|
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip">
|
||||||
|
<el-button size="small" type="primary">上传文件</el-button>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div style="text-align: right">
|
||||||
|
<el-button type="danger" @click="close_dialog">取消</el-button>
|
||||||
|
<el-button type="primary" @click="submitUpload" :disabled="saveLoading">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="选择时间范围"
|
title="选择时间范围"
|
||||||
:visible.sync="showExportDialog"
|
:visible.sync="showExportDialog"
|
||||||
|
@ -113,7 +148,7 @@ 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, exportData } from "@/api/qc";
|
import { getRcs, createRc, del_commend, updateRc, getMyRcs, exportData, impData } from "@/api/qc";
|
||||||
import { upUrl, upHeaders } from "@/api/file";
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
import { saveAs } from 'file-saver';
|
import { saveAs } from 'file-saver';
|
||||||
import XLSX from 'xlsx';
|
import XLSX from 'xlsx';
|
||||||
|
@ -147,10 +182,16 @@ export default {
|
||||||
listLoading: false,
|
listLoading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
showExportDialog: false,
|
showExportDialog: false,
|
||||||
|
saveLoading:false,
|
||||||
|
impDialogVisible: false,
|
||||||
|
downloadUrl: process.env.VUE_APP_BASE_API,
|
||||||
listQuery: {
|
listQuery: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
},
|
},
|
||||||
|
impForm:{
|
||||||
|
file:''
|
||||||
|
},
|
||||||
tableData: {
|
tableData: {
|
||||||
count: 0
|
count: 0
|
||||||
},
|
},
|
||||||
|
@ -188,6 +229,34 @@ export default {
|
||||||
getTableList() {
|
getTableList() {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
|
handleImport(){
|
||||||
|
this.impDialogVisible = true;
|
||||||
|
let file_url = '';
|
||||||
|
file_url = "media/default/质量表彰-质量相关表彰统计表.xlsx";
|
||||||
|
let base_url = this.downloadUrl.substr(0, this.downloadUrl.length - 3);
|
||||||
|
this.downloadUrl = base_url+file_url;
|
||||||
|
},
|
||||||
|
close_dialog(){
|
||||||
|
this.impDialogVisible = false;
|
||||||
|
this.fileList = [];
|
||||||
|
this.impForm.file = '';
|
||||||
|
},
|
||||||
|
submitUpload() {
|
||||||
|
this.$refs.upload.submit();
|
||||||
|
this.impDialogVisible = false;
|
||||||
|
this.saveLoading = true;
|
||||||
|
impData(this.impForm).then(res=>{
|
||||||
|
console.log(this.impForm)
|
||||||
|
if(res.code>=200){
|
||||||
|
this.saveLoading = false;
|
||||||
|
this.$message.success("提交成功");
|
||||||
|
this.getList();
|
||||||
|
}else{
|
||||||
|
this.$message.error(res.message);
|
||||||
|
this.saveLoading = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
handlePreview(file) {
|
handlePreview(file) {
|
||||||
if ("url" in file) {
|
if ("url" in file) {
|
||||||
window.open(file.url);
|
window.open(file.url);
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
<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="handleImport">导入</el-button>
|
||||||
<el-button type="primary" @click="showExportDialog = true">导出</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
|
||||||
|
@ -124,6 +123,40 @@
|
||||||
<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
|
||||||
|
:visible.sync="impDialogVisible"
|
||||||
|
title="导入"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Form"
|
||||||
|
label-width="80px"
|
||||||
|
label-position="right"
|
||||||
|
:rules="rule"
|
||||||
|
>
|
||||||
|
<el-form-item label="下载模板" prop="path">
|
||||||
|
<a :href="downloadUrl">点击下载模板</a>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="导入文件" prop="file">
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
:action="upUrl"
|
||||||
|
:on-success="handleUpSuccess"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
:on-preview="handlePreview"
|
||||||
|
:headers="upHeaders"
|
||||||
|
:file-list="fileList"
|
||||||
|
:limit="1"
|
||||||
|
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip">
|
||||||
|
<el-button size="small" type="primary">上传文件</el-button>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div style="text-align: right">
|
||||||
|
<el-button type="danger" @click="close_dialog">取消</el-button>
|
||||||
|
<el-button type="primary" @click="submitUpload" :disabled="saveLoading">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="选择时间范围"
|
title="选择时间范围"
|
||||||
:visible.sync="showExportDialog"
|
:visible.sync="showExportDialog"
|
||||||
|
@ -159,7 +192,7 @@ 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, exportData } from "@/api/review";
|
import { createRs, delRs, updateRs, getMyRs, getRs, exportData, impData } from "@/api/review";
|
||||||
import { getMyQi} from "@/api/qualificationInfo";
|
import { getMyQi} from "@/api/qualificationInfo";
|
||||||
import { upUrl, upHeaders } from "@/api/file";
|
import { upUrl, upHeaders } from "@/api/file";
|
||||||
import { saveAs } from 'file-saver';
|
import { saveAs } from 'file-saver';
|
||||||
|
@ -228,6 +261,12 @@ export default {
|
||||||
listLoading: false,
|
listLoading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
showExportDialog: false,
|
showExportDialog: false,
|
||||||
|
saveLoading:false,
|
||||||
|
impDialogVisible: false,
|
||||||
|
downloadUrl: process.env.VUE_APP_BASE_API,
|
||||||
|
impForm:{
|
||||||
|
file:''
|
||||||
|
},
|
||||||
exportForm: {
|
exportForm: {
|
||||||
startDate: '', // 开始日期
|
startDate: '', // 开始日期
|
||||||
endDate: '', // 结束日期
|
endDate: '', // 结束日期
|
||||||
|
@ -266,6 +305,34 @@ export default {
|
||||||
getTableList() {
|
getTableList() {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
|
handleImport(){
|
||||||
|
this.impDialogVisible = true;
|
||||||
|
let file_url = '';
|
||||||
|
file_url = "media/default/评审情况-评审情况统计表.xlsx";
|
||||||
|
let base_url = this.downloadUrl.substr(0, this.downloadUrl.length - 3);
|
||||||
|
this.downloadUrl = base_url+file_url;
|
||||||
|
},
|
||||||
|
close_dialog(){
|
||||||
|
this.impDialogVisible = false;
|
||||||
|
this.fileList = [];
|
||||||
|
this.impForm.file = '';
|
||||||
|
},
|
||||||
|
submitUpload() {
|
||||||
|
this.$refs.upload.submit();
|
||||||
|
this.impDialogVisible = false;
|
||||||
|
this.saveLoading = true;
|
||||||
|
impData(this.impForm).then(res=>{
|
||||||
|
console.log(this.impForm)
|
||||||
|
if(res.code>=200){
|
||||||
|
this.saveLoading = false;
|
||||||
|
this.$message.success("提交成功");
|
||||||
|
this.getList();
|
||||||
|
}else{
|
||||||
|
this.$message.error(res.message);
|
||||||
|
this.saveLoading = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
handlePreview(file) {
|
handlePreview(file) {
|
||||||
if ("url" in file) {
|
if ("url" in file) {
|
||||||
window.open(file.url);
|
window.open(file.url);
|
||||||
|
@ -275,10 +342,12 @@ export default {
|
||||||
},
|
},
|
||||||
handleUpSuccess(res, file, filelist) {
|
handleUpSuccess(res, file, filelist) {
|
||||||
this.Content.file = res.data.id;
|
this.Content.file = res.data.id;
|
||||||
|
this.impForm.file = res.data.path;
|
||||||
},
|
},
|
||||||
handleRemove(file, filelist) {
|
handleRemove(file, filelist) {
|
||||||
this.Content.file = null;
|
this.Content.file = null;
|
||||||
|
this.fileList = [];
|
||||||
|
this.impForm.file = '';
|
||||||
},
|
},
|
||||||
checkPermission,
|
checkPermission,
|
||||||
filterNode(value, data) {
|
filterNode(value, data) {
|
||||||
|
|
|
@ -1365,7 +1365,7 @@
|
||||||
this.saveLoading = true;
|
this.saveLoading = true;
|
||||||
this.impForm.task2do =this.task2do;
|
this.impForm.task2do =this.task2do;
|
||||||
if(this.impType=='rc'){
|
if(this.impType=='rc'){
|
||||||
impRc(this.impForm).then(res=>{
|
imtpRc(this.impForm).then(res=>{
|
||||||
if(res.code>=200){
|
if(res.code>=200){
|
||||||
this.saveLoading = false;
|
this.saveLoading = false;
|
||||||
this.impDialogVisible = false;
|
this.impDialogVisible = false;
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Generated by Django 3.2.12 on 2024-04-22 08:23
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('information', '0027_rename_instance_id_auditlog_instance'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='qualitycommendation',
|
||||||
|
name='awardee_company',
|
||||||
|
field=models.CharField(blank=True, max_length=20, null=True, verbose_name='获奖单位'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='qualitycommendation',
|
||||||
|
name='awardee_people',
|
||||||
|
field=models.CharField(blank=True, max_length=20, null=True, verbose_name='获奖人'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.2.12 on 2024-04-23 03:05
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('information', '0028_auto_20240422_1623'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='qualityactivities',
|
||||||
|
name='roles',
|
||||||
|
field=models.PositiveSmallIntegerField(choices=[(0, '组织方'), (1, '参与方')], max_length=20, verbose_name='参与角色'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.2.12 on 2024-04-23 05:24
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('information', '0029_alter_qualityactivities_roles'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='externalauditors',
|
||||||
|
name='review_types',
|
||||||
|
field=models.CharField(max_length=20, verbose_name='评审类型'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -66,8 +66,8 @@ class QualityCommendation(CommonBDModel):
|
||||||
name = models.CharField(max_length=20, unique=True, verbose_name='项目名称')
|
name = models.CharField(max_length=20, unique=True, verbose_name='项目名称')
|
||||||
commendation_name = models.CharField(max_length=20, verbose_name='表彰名称')
|
commendation_name = models.CharField(max_length=20, verbose_name='表彰名称')
|
||||||
Awards_level = models.CharField(max_length=20, verbose_name='获奖等级')
|
Awards_level = models.CharField(max_length=20, verbose_name='获奖等级')
|
||||||
awardee_company = models.CharField(max_length=20, verbose_name='获奖单位', null=True)
|
awardee_company = models.CharField(max_length=20, verbose_name='获奖单位', null=True, blank=True)
|
||||||
awardee_people = models.CharField(max_length=20, verbose_name='获奖人', null=True)
|
awardee_people = models.CharField(max_length=20, verbose_name='获奖人', null=True, blank=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)
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class QualityCommendation(CommonBDModel):
|
||||||
db_table = 'quality_commendation'
|
db_table = 'quality_commendation'
|
||||||
|
|
||||||
class QualityActivities(CommonBDModel):
|
class QualityActivities(CommonBDModel):
|
||||||
role = ((0,'组织方'),(1,'活动方'))
|
role = ((0,'组织方'),(1,'参与方'))
|
||||||
name = models.CharField(max_length=20, unique=True, verbose_name='活动名称')
|
name = models.CharField(max_length=20, unique=True, verbose_name='活动名称')
|
||||||
roles = models.PositiveSmallIntegerField(max_length=20, choices=role, verbose_name='参与角色')
|
roles = models.PositiveSmallIntegerField(max_length=20, choices=role, verbose_name='参与角色')
|
||||||
collaborators = models.CharField(max_length=20, verbose_name='合作方')
|
collaborators = models.CharField(max_length=20, verbose_name='合作方')
|
||||||
|
@ -110,12 +110,9 @@ class Contact(CommonBDModel):
|
||||||
db_table = 'contact'
|
db_table = 'contact'
|
||||||
|
|
||||||
class ExternalAuditors(CommonBDModel):
|
class ExternalAuditors(CommonBDModel):
|
||||||
review_type = ( (0, 'CNAS'),
|
|
||||||
(1, 'CMA'),
|
|
||||||
(2, 'DICA'))
|
|
||||||
name_company = models.CharField(max_length=20, unique=True, verbose_name='公司名称')
|
name_company = models.CharField(max_length=20, unique=True, verbose_name='公司名称')
|
||||||
name = models.CharField(max_length=20, verbose_name='姓名')
|
name = models.CharField(max_length=20, verbose_name='姓名')
|
||||||
review_types = models.PositiveSmallIntegerField(max_length=20, choices=review_type,verbose_name='评审类型', default=0)
|
review_types = models.CharField(max_length=20, verbose_name='评审类型')
|
||||||
certificate_expiration = models.DateField(verbose_name='证书有效期')
|
certificate_expiration = models.DateField(verbose_name='证书有效期')
|
||||||
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='评审领域')
|
||||||
|
|
|
@ -36,7 +36,7 @@ class ExternalAuditorsSerializer(serializers.ModelSerializer):
|
||||||
class QualificationSerializer(serializers.ModelSerializer):
|
class QualificationSerializer(serializers.ModelSerializer):
|
||||||
class Meta(BaseMeta):
|
class Meta(BaseMeta):
|
||||||
model = Qualification
|
model = Qualification
|
||||||
fields = '__all__'
|
fields = ["id","name","company_name","quali_type","org","org_date","expiration_date","number","scope"]
|
||||||
|
|
||||||
|
|
||||||
class AbilityReviewSerializer(serializers.ModelSerializer):
|
class AbilityReviewSerializer(serializers.ModelSerializer):
|
||||||
|
|
|
@ -16,6 +16,63 @@ from .serializers import *
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
class ImpMixin:
|
||||||
|
def get_queryset(self):
|
||||||
|
mydept = self.request.user.dept
|
||||||
|
qs = super().get_queryset()
|
||||||
|
if has_permission('task2', self.request.user):
|
||||||
|
return qs
|
||||||
|
return qs.filter(belong_dept=mydept)
|
||||||
|
|
||||||
|
def format_date(self, ind, val):
|
||||||
|
new_val = val
|
||||||
|
if isinstance(val, datetime.datetime):
|
||||||
|
new_val = val.date()
|
||||||
|
elif isinstance(val, datetime.date):
|
||||||
|
new_val = val
|
||||||
|
elif isinstance(val, str):
|
||||||
|
try:
|
||||||
|
new_val = datetime.datetime.strptime(val, '%Y-%m-%d').date()
|
||||||
|
except ValueError:
|
||||||
|
raise ParseError(f'第{ind}行, 日期时间格式错误')
|
||||||
|
elif val is None:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raise ParseError(f'第{ind}行, 日期时间格式错误')
|
||||||
|
return new_val
|
||||||
|
|
||||||
|
def get_enum(self, val, atuple, ind):
|
||||||
|
for i in atuple:
|
||||||
|
if i[1] == val:
|
||||||
|
return i[0]
|
||||||
|
raise ParseError('第{}: 请选择固定选项值'.format(ind))
|
||||||
|
|
||||||
|
def F(self, data, sheet, i, etype):
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
def gen_imp_view(self, request, start: int, mySerializer):
|
||||||
|
if 'file' not in request.data:
|
||||||
|
raise ParseError('请提供文件')
|
||||||
|
path = request.data['file']
|
||||||
|
|
||||||
|
if not str(path).endswith('.xlsx'):
|
||||||
|
raise ParseError('请提供xlsx格式文件')
|
||||||
|
fullpath = os.path.join(settings.BASE_DIR, str(path))
|
||||||
|
wb = load_workbook(fullpath,data_only=True)
|
||||||
|
sheet = wb.active
|
||||||
|
# 遍历Excel文件中的数据
|
||||||
|
data_list = self.build_data(sheet, start)
|
||||||
|
serializer = mySerializer(data=data_list, many=True, context={'request': request})
|
||||||
|
if serializer.is_valid():
|
||||||
|
serializer.save(create_by=request.user, belong_dept=request.user.dept)
|
||||||
|
else:
|
||||||
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
|
return Response({'uploaded': 'File uploaded successfully'}, status=status.HTTP_201_CREATED)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CreateUpdateCustomMixin:
|
class CreateUpdateCustomMixin:
|
||||||
"""
|
"""
|
||||||
整合
|
整合
|
||||||
|
@ -30,7 +87,7 @@ class CreateUpdateCustomMixin:
|
||||||
serializer.save(update_by = self.request.user)
|
serializer.save(update_by = self.request.user)
|
||||||
|
|
||||||
|
|
||||||
class AbilityReviewViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
class AbilityReviewViewSet(ImpMixin, RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
||||||
perms_map = {'get': '*', 'post': 'abilityreview',
|
perms_map = {'get': '*', 'post': 'abilityreview',
|
||||||
'put': 'abilityreview', 'delete': 'abilityreview'}
|
'put': 'abilityreview', 'delete': 'abilityreview'}
|
||||||
queryset = AbilityReview.objects.select_related('quali').all()
|
queryset = AbilityReview.objects.select_related('quali').all()
|
||||||
|
@ -85,72 +142,43 @@ class AbilityReviewViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet)
|
||||||
data = {'count':len(serializer.data), 'results':new_data_list}
|
data = {'count':len(serializer.data), 'results':new_data_list}
|
||||||
return Response(data, status = status.HTTP_200_OK)
|
return Response(data, status = status.HTTP_200_OK)
|
||||||
|
|
||||||
|
def build_data(self, sheet, start):
|
||||||
class ImpMixin:
|
data_list = []
|
||||||
def get_queryset(self):
|
for row in sheet.iter_rows(min_row=start, values_only=True): # 假设第一行是表头,从第二行开始读取数据
|
||||||
mydept = self.request.user.dept
|
if row[0] is not None:
|
||||||
qs = super().get_queryset()
|
review_date = row[6].strftime("%Y-%m-%d")
|
||||||
if has_permission('task2', self.request.user):
|
quil_id = Qualification.objects.filter(name=row[2]).first().id
|
||||||
return qs
|
judging_method_dict = {"文审":0, "现场":10}
|
||||||
return qs.filter(belong_dept=mydept)
|
judging_type_dict = {"初次":0, "扩项":10, "变更":20, "复评":30, "迁址":40}
|
||||||
|
serializer_data = {
|
||||||
def format_date(self, ind, val):
|
'name': row[1], # 第一列是名字
|
||||||
new_val = val
|
'quali':quil_id,
|
||||||
if isinstance(val, datetime.datetime):
|
'judging_method':judging_method_dict.get(row[3]),
|
||||||
new_val = val.date()
|
'judging_type':judging_type_dict.get(row[4]),
|
||||||
elif isinstance(val, datetime.date):
|
'add_param':row[5],
|
||||||
new_val = val
|
'review_date':review_date,
|
||||||
elif isinstance(val, str):
|
'now_count':row[7],
|
||||||
try:
|
'add_count':row[8]
|
||||||
new_val = datetime.datetime.strptime(val, '%Y-%m-%d').date()
|
}
|
||||||
except ValueError:
|
data_list.append(serializer_data)
|
||||||
raise ParseError(f'第{ind}行, 日期时间格式错误')
|
return data_list
|
||||||
elif val is None:
|
@action(detail=False, methods=['post'])
|
||||||
pass
|
@transaction.atomic
|
||||||
else:
|
def imp(self, request, *args, **kwargs):
|
||||||
raise ParseError(f'第{ind}行, 日期时间格式错误')
|
"""
|
||||||
return new_val
|
导入数据
|
||||||
|
"""
|
||||||
def get_enum(self, val, atuple, ind):
|
return self.gen_imp_view(request, 2, AbilityReviewSerializer)
|
||||||
for i in atuple:
|
|
||||||
if i[1] == val:
|
|
||||||
return i[0]
|
|
||||||
raise ParseError('第{}: 请选择固定选项值'.format(ind))
|
|
||||||
|
|
||||||
def F(self, data, sheet, i, etype):
|
|
||||||
raise NotImplementedError()
|
|
||||||
|
|
||||||
def gen_imp_view(self, request, start: int, mySerializer, types = None):
|
|
||||||
if 'file' not in request.data:
|
|
||||||
raise ParseError('请提供文件')
|
|
||||||
path = request.data['file']
|
|
||||||
|
|
||||||
if not str(path).endswith('.xlsx'):
|
|
||||||
raise ParseError('请提供xlsx格式文件')
|
|
||||||
fullpath = os.path.join(settings.BASE_DIR, str(path))
|
|
||||||
wb = load_workbook(fullpath,data_only=True)
|
|
||||||
sheet = wb.active
|
|
||||||
# 遍历Excel文件中的数据
|
|
||||||
if types.lower() == "qt":
|
|
||||||
data_list = self.build_qt_data(sheet)
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
serializer = mySerializer(data=data_list, many=True, context={'request': request})
|
|
||||||
if serializer.is_valid():
|
|
||||||
serializer.save()
|
|
||||||
else:
|
|
||||||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
|
||||||
|
|
||||||
return Response({'uploaded': 'File uploaded successfully'}, status=status.HTTP_201_CREATED)
|
|
||||||
|
|
||||||
|
|
||||||
class QualityCommendationViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
|
||||||
|
class QualityCommendationViewSet(ImpMixin, RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
||||||
queryset = QualityCommendation.objects.all()
|
queryset = QualityCommendation.objects.all()
|
||||||
serializer_class = QualityCommendationSerializer
|
serializer_class = QualityCommendationSerializer
|
||||||
|
|
||||||
def build_qt_data(self, sheet):
|
def build_data(self, sheet, start):
|
||||||
data_list = []
|
data_list = []
|
||||||
for row in sheet.iter_rows(min_row=2, values_only=True): # 假设第一行是表头,从第二行开始读取数据
|
for row in sheet.iter_rows(min_row=start, values_only=True): # 假设第一行是表头,从第二行开始读取数据
|
||||||
if row[0] is not None:
|
if row[0] is not None:
|
||||||
awarded_date = row[6].strftime("%Y-%m-%d")
|
awarded_date = row[6].strftime("%Y-%m-%d")
|
||||||
# 判断获奖的是人还是公司
|
# 判断获奖的是人还是公司
|
||||||
|
@ -169,11 +197,19 @@ class QualityCommendationViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelVi
|
||||||
'awardee_people':awardee_people,
|
'awardee_people':awardee_people,
|
||||||
'awarded_by':row[5],
|
'awarded_by':row[5],
|
||||||
'awarded_date':awarded_date,
|
'awarded_date':awarded_date,
|
||||||
'department':department_id,
|
'belong_dept':department_id,
|
||||||
}
|
}
|
||||||
data_list.append(serializer_data)
|
data_list.append(serializer_data)
|
||||||
return data_list
|
return data_list
|
||||||
|
|
||||||
|
@action(detail=False, methods=['post'])
|
||||||
|
@transaction.atomic
|
||||||
|
def imp(self, request, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
导入数据
|
||||||
|
"""
|
||||||
|
return self.gen_imp_view(request, 2, QualityCommendationSerializer)
|
||||||
|
|
||||||
|
|
||||||
#根据日期过滤数据
|
#根据日期过滤数据
|
||||||
@action(detail=False, methods=['post'])
|
@action(detail=False, methods=['post'])
|
||||||
|
@ -202,7 +238,7 @@ class QualityCommendationViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelVi
|
||||||
|
|
||||||
|
|
||||||
# 质量活动
|
# 质量活动
|
||||||
class QualityActivitiesViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
class QualityActivitiesViewSet(ImpMixin, RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
||||||
queryset = QualityActivities.objects.all()
|
queryset = QualityActivities.objects.all()
|
||||||
serializer_class = QualityActivitiesSerializer
|
serializer_class = QualityActivitiesSerializer
|
||||||
|
|
||||||
|
@ -227,7 +263,7 @@ class QualityActivitiesViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelView
|
||||||
"function": "活动中发挥的作用",
|
"function": "活动中发挥的作用",
|
||||||
"earnings":"活动收益(元)"
|
"earnings":"活动收益(元)"
|
||||||
}
|
}
|
||||||
role_map ={0:"组织方", 1:"活动方"}
|
role_map ={0:"组织方", 1:"参与方"}
|
||||||
new_data_list = []
|
new_data_list = []
|
||||||
for i in range(len(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 = {map_key_dict[key] : value for key, value in data_list[i].items() if key in map_key_dict.keys()}
|
||||||
|
@ -236,6 +272,33 @@ class QualityActivitiesViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelView
|
||||||
data = {'count':len(serializer.data), 'results':new_data_list}
|
data = {'count':len(serializer.data), 'results':new_data_list}
|
||||||
return Response(data, status = status.HTTP_200_OK)
|
return Response(data, status = status.HTTP_200_OK)
|
||||||
|
|
||||||
|
def build_data(self, sheet, start):
|
||||||
|
data_list = []
|
||||||
|
for row in sheet.iter_rows(min_row=start, values_only=True): # 假设第一行是表头,从第二行开始读取数据
|
||||||
|
if row[0] is not None:
|
||||||
|
activate_time = row[6].strftime("%Y-%m-%d")
|
||||||
|
role_dict = {"组织方":0, "参与方":1}
|
||||||
|
serializer_data = {
|
||||||
|
'name': row[1], # 第一列是名字
|
||||||
|
'roles':role_dict.get(row[2]),
|
||||||
|
'collaborators':row[3],
|
||||||
|
'orgunits':row[4],
|
||||||
|
'place':row[5],
|
||||||
|
'activate_time':activate_time,
|
||||||
|
'participations':row[7],
|
||||||
|
'function':row[8],
|
||||||
|
'earnings':row[9]
|
||||||
|
}
|
||||||
|
data_list.append(serializer_data)
|
||||||
|
return data_list
|
||||||
|
@action(detail=False, methods=['post'])
|
||||||
|
@transaction.atomic
|
||||||
|
def imp(self, request, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
导入数据
|
||||||
|
"""
|
||||||
|
return self.gen_imp_view(request, 2, QualityActivitiesSerializer)
|
||||||
|
|
||||||
|
|
||||||
class ContactViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
class ContactViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
||||||
queryset = Contact.objects.all()
|
queryset = Contact.objects.all()
|
||||||
|
@ -252,8 +315,35 @@ class ContactViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
||||||
# return qs
|
# return qs
|
||||||
# return qs.filter(belong_dept__in=get_child_queryset2(self.request.user.dept))
|
# return qs.filter(belong_dept__in=get_child_queryset2(self.request.user.dept))
|
||||||
|
|
||||||
|
def build_data(self, sheet, start):
|
||||||
|
data_list = []
|
||||||
|
for row in sheet.iter_rows(min_row=start, values_only=True): # 假设第一行是表头,从第二行开始读取数据
|
||||||
|
if row[0] is not None:
|
||||||
|
activate_time = row[6].strftime("%Y-%m-%d")
|
||||||
|
role_dict = {"组织方":0, "参与方":1}
|
||||||
|
serializer_data = {
|
||||||
|
'name': row[1], # 第一列是名字
|
||||||
|
'roles':role_dict.get(row[2]),
|
||||||
|
'collaborators':row[3],
|
||||||
|
'orgunits':row[4],
|
||||||
|
'place':row[5],
|
||||||
|
'activate_time':activate_time,
|
||||||
|
'participations':row[7],
|
||||||
|
'function':row[8],
|
||||||
|
'earnings':row[9]
|
||||||
|
}
|
||||||
|
data_list.append(serializer_data)
|
||||||
|
return data_list
|
||||||
|
@action(detail=False, methods=['post'])
|
||||||
|
@transaction.atomic
|
||||||
|
def imp(self, request, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
导入数据
|
||||||
|
"""
|
||||||
|
return self.gen_imp_view(request, 2, ContactSerializer)
|
||||||
|
|
||||||
class ExternalAuditorsViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
|
||||||
|
class ExternalAuditorsViewSet(ImpMixin, RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
||||||
queryset = ExternalAuditors.objects.all()
|
queryset = ExternalAuditors.objects.all()
|
||||||
serializer_class = ExternalAuditorsSerializer
|
serializer_class = ExternalAuditorsSerializer
|
||||||
|
|
||||||
|
@ -276,20 +366,75 @@ class ExternalAuditorsViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewS
|
||||||
"remark":"备注",
|
"remark":"备注",
|
||||||
"review_types": "评审类型"
|
"review_types": "评审类型"
|
||||||
}
|
}
|
||||||
role_map ={0:"CNAS", 1:"CMA", 2:"DICA"}
|
|
||||||
new_data_list = []
|
new_data_list = []
|
||||||
for i in range(len(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 = {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)
|
new_data_list.append(new_dict)
|
||||||
data = {'count':len(serializer.data), 'results':new_data_list}
|
data = {'count':len(serializer.data), 'results':new_data_list}
|
||||||
return Response(data, status = status.HTTP_200_OK)
|
return Response(data, status = status.HTTP_200_OK)
|
||||||
|
|
||||||
|
def build_data(self, sheet, start):
|
||||||
|
data_list = []
|
||||||
|
for row in sheet.iter_rows(min_row=start, values_only=True): # 假设第一行是表头,从第二行开始读取数据
|
||||||
|
if row[0] is not None:
|
||||||
|
activate_time = row[4].strftime("%Y-%m-%d")
|
||||||
|
serializer_data = {
|
||||||
|
'name_company': row[1], # 第一列是名字
|
||||||
|
'name':row[2],
|
||||||
|
'review_types':row[3],
|
||||||
|
'certificate_expiration':activate_time,
|
||||||
|
'contact':row[5],
|
||||||
|
'judging_areas':row[6],
|
||||||
|
'remark':row[7],
|
||||||
|
}
|
||||||
|
data_list.append(serializer_data)
|
||||||
|
return data_list
|
||||||
|
@action(detail=False, methods=['post'])
|
||||||
|
@transaction.atomic
|
||||||
|
def imp(self, request, *args, **kwargs):
|
||||||
|
"""
|
||||||
|
导入数据
|
||||||
|
"""
|
||||||
|
return self.gen_imp_view(request, 2, ExternalAuditorsSerializer)
|
||||||
|
|
||||||
class QualificationViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
|
||||||
|
class QualificationViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||||
queryset = Qualification.objects.all()
|
queryset = Qualification.objects.all()
|
||||||
serializer_class = QualificationSerializer
|
serializer_class = QualificationSerializer
|
||||||
|
|
||||||
|
# # 重写更新的方法
|
||||||
|
# def partial_update(self, request, pk=None):
|
||||||
|
# #获取需要更新的实列
|
||||||
|
# instance = self.get_object()
|
||||||
|
# # 数据比较
|
||||||
|
# ignore_fields = ['create_by', 'create_date', 'update_date', 'id']
|
||||||
|
# origin_dict = QualificationSerializer(instance=instance).data
|
||||||
|
# diff = []
|
||||||
|
# for k, v in request.data.items():
|
||||||
|
# if k not in ignore_fields:
|
||||||
|
# origin_value = origin_dict.get(k)
|
||||||
|
# if origin_value != v:
|
||||||
|
# diff.append({'old':origin_value, 'new':v, 'name':k})
|
||||||
|
# serializers = self.get_serializer(instance, data=request.data, partial=True)
|
||||||
|
# serializers.is_valid(raise_exception=True)
|
||||||
|
# self.perform_update(serializers)
|
||||||
|
# if diff:
|
||||||
|
# AuditLog.objects.create(
|
||||||
|
# action='update',
|
||||||
|
# instance=instance,
|
||||||
|
# change_time = datetime.now(),
|
||||||
|
# change_user=request.user,
|
||||||
|
# val_new=serializers.data,
|
||||||
|
# difference=diff
|
||||||
|
# )
|
||||||
|
# return Response(serializers.data, status = status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
|
class QualiChangeViewSet(RbacFilterSet, ModelViewSet):
|
||||||
|
queryset = AuditLog.objects.select_related('instance').all()
|
||||||
|
serializer_class = AuditLogSerializer
|
||||||
|
filterset_fields = ['instance_id']
|
||||||
|
|
||||||
# 重写更新的方法
|
# 重写更新的方法
|
||||||
def partial_update(self, request, pk=None):
|
def partial_update(self, request, pk=None):
|
||||||
#获取需要更新的实列
|
#获取需要更新的实列
|
||||||
|
@ -317,9 +462,3 @@ class QualificationViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet)
|
||||||
)
|
)
|
||||||
return Response(serializers.data, status = status.HTTP_204_NO_CONTENT)
|
return Response(serializers.data, status = status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
class QualiChangeViewSet(RbacFilterSet, ModelViewSet):
|
|
||||||
queryset = AuditLog.objects.select_related('instance').all()
|
|
||||||
serializer_class = AuditLogSerializer
|
|
||||||
filterset_fields = ['instance_id']
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue