fix:信息收集分页问题

This commit is contained in:
zty 2024-07-08 19:11:08 +08:00
parent 619c2ea989
commit d52107058a
12 changed files with 31 additions and 232 deletions

File diff suppressed because one or more lines are too long

View File

@ -45,4 +45,11 @@ export function createYr(data) {
method: 'post', method: 'post',
data data
}) })
}
export function delYr(id) {
return request({
url: `/info/pdf/${id}/`,
method: 'delete'
})
} }

View File

@ -292,8 +292,6 @@ export default {
}, },
getList() { getList() {
this.listLoading = true; this.listLoading = true;
this.tableData.results =[];
this.tableData.count =0;
getMyEas(this.listQuery).then((response) => { getMyEas(this.listQuery).then((response) => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {

View File

@ -1,210 +0,0 @@
<template>
<div class="app-container">
<el-card class="elHeader">
<el-button type="primary" icon="el-icon-plus" @click="handleAddFile">新增</el-button>
</el-card>
<el-card style="margin-top: 10px">
<el-table v-loading="listLoading" :data="tableData.results" :hieght="tableHeight" border fit stripe
highlight-current-row>
<el-table-column type="index" width="50" />
<el-table-column label="文件名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="文件描述">
<template slot-scope="scope">{{ scope.row.description }}</template>
</el-table-column>
<el-table-column label="文件格式">
<template slot-scope="scope">{{ scope.row.file_.mime }}</template>
</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">
<template slot-scope="scope">
<el-link :disabled="!checkPermission(['infoCollect_RS'])" type="primary" size="small"
@click="handleEdit(scope)">编辑</el-link>
<el-divider direction="vertical"
v-if="checkPermission(['infoCollect_RS']) && checkPermission(['infoCollect_RS'])"></el-divider>
<el-link :disabled="!checkPermission(['infoCollect_RS'])" type="danger" size="small"
@click="handleDelete(scope)">删除</el-link>
</template>
</el-table-column>
</el-table>
<pagination v-show="tableData.count > 0" :total="tableData.count" :page.sync="listQuery.page"
:limit.sync="listQuery.page_size" @pagination="getTableList" />
</el-card>
<el-dialog :visible.sync="dialogVisible" :title="dialogType === 'edit' ? '编辑评审' : '新增评审'">
<el-form ref="Form" :model="Content" label-width="80px" label-position="right" :rules="rule">
<el-form-item label="评审名称" prop="name">
<el-input v-model="Content.name" placeholder="评审名称" />
</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>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { getDictList, getDictTypeList } from "@/api/dict";
import { upUrl, upHeaders } from "@/api/file";
const defaultContent = {
name: "",
description: "",
file: null
};
export default {
components: { Pagination, Treeselect },
data() {
return {
upHeaders: upHeaders(),
upUrl: upUrl(),
fileList: [],
Content: defaultContent,
typeOptions: [],
listLoading: false,
dialogVisible: false,
listQuery: {
page: 1,
page_size: 20,
},
tableData: {
count: 0
},
dialogType: "new",
rule: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
},
filterOrgText: "",
tableHeight: null,
};
},
computed: {},
watch: {
filterOrgText(val) {
this.$refs.tree.filter(val);
},
},
created() {
},
mounted() {
let that = this;
let height1 = document.getElementsByClassName('app-main')[0].clientHeight;
let height2 = document.getElementsByClassName('elHeader')[0].clientHeight;
that.tableHeight = height1 - height2 - 70;
console.log(that.tableHeight)
that.getList();
},
methods: {
getTableList() {
this.getList();
},
handlePreview(file) {
if ("url" in file) {
window.open(file.url);
} else {
window.open(file.response.data.path);
}
},
handleUpSuccess(res, file, filelist) {
this.Content.file = res.data.id;
},
handleRemove(file, filelist) {
this.Content.file = null;
},
checkPermission,
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
getList() {
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
handleAddFile() {
this.Content = Object.assign({}, defaultContent);
this.dialogType = "new";
this.dialogVisible = true;
this.fileList = []
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.Content = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
if (this.Content.file) {
this.fileList = [
{
name: this.Content.file_.name,
url: this.Content.file,
},
];
}
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
// await deleteDoc(scope.row.id);
// this.getList();
// this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
console.log(this.Content)
} else {
}
} else {
return false;
}
});
},
},
};
</script>
<style></style>

View File

@ -58,7 +58,7 @@
</el-card> </el-card>
<el-dialog :visible.sync="dialogVisible" :title="dialogType === 'edit' ? '编辑' : '新增'"> <el-dialog :visible.sync="dialogVisible" :title="dialogType === 'edit' ? '编辑' : '新增'">
<el-form ref="Form" :model="Content" label-width="80px" label-position="right" :rules="rule"> <el-form ref="Form" :model="Content" label-width="80px" label-position="right" :rules="rule">
<el-form-item label="姓名" prop="name"> <el-form-item label="公司名称" prop="name">
<el-input v-model="Content.name" placeholder="" /> <el-input v-model="Content.name" placeholder="" />
</el-form-item> </el-form-item>
<el-form-item label="地址" prop="address"> <el-form-item label="地址" prop="address">
@ -279,8 +279,6 @@ export default {
getList() { getList() {
this.listLoading = true; this.listLoading = true;
this.tableData.results =[];
this.tableData.count =0;
getCtAll(this.listQuery).then((response) => { getCtAll(this.listQuery).then((response) => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {

View File

@ -310,8 +310,6 @@ export default {
getList() { getList() {
this.listLoading = true; this.listLoading = true;
this.tableData.results =[];
this.tableData.count =0;
getMyQi(this.listQuery).then((response) => { getMyQi(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
this.tableData = response.data; this.tableData = response.data;

View File

@ -304,8 +304,6 @@ export default {
getList() { getList() {
this.listLoading = true; this.listLoading = true;
this.tableData.results =[];
this.tableData.count =0;
getAllQi(this.listQuery).then((response) => { getAllQi(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
this.tableData = response.data; this.tableData = response.data;

View File

@ -401,8 +401,6 @@ export default {
getList() { getList() {
this.listLoading = true; this.listLoading = true;
this.tableData.results =[];
this.tableData.count =0;
getgetMyRcs(this.listQuery).then((response) => { getgetMyRcs(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
this.tableData = response.data; this.tableData = response.data;

View File

@ -308,8 +308,6 @@ export default {
getList() { getList() {
this.listLoading = true; this.listLoading = true;
this.tableData.results =[];
this.tableData.count =0;
getMyRcs(this.listQuery).then((response) => { getMyRcs(this.listQuery).then((response) => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {

View File

@ -356,8 +356,6 @@ export default {
}, },
getList() { getList() {
this.listLoading = true; this.listLoading = true;
this.tableData.results =[];
this.tableData.count =0;
getMyRs(this.listQuery).then((response) => { getMyRs(this.listQuery).then((response) => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {

View File

@ -11,12 +11,15 @@
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="PDF-名称" prop="pdf_name"></el-table-column> <el-table-column label="PDF-名称" prop="pdf_name"></el-table-column>
<el-table-column label="EXCEL-名称" prop="excel_name"></el-table-column> <el-table-column label="EXCEL-名称" prop="excel_name"></el-table-column>
<el-table-column label="单位名称" prop="dep"></el-table-column>
<el-table-column label="年度" prop="annual"></el-table-column> <el-table-column label="年度" prop="annual"></el-table-column>
<el-table-column label="创建时间" prop="create_time"></el-table-column> <el-table-column label="创建时间" prop="create_time"></el-table-column>
<el-table-column label="状态" prop="status"></el-table-column> <el-table-column label="状态" prop="status"></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 type="primary" @click="handleDownload(scope)">下载</el-link> <el-link type="primary" @click="handleDownload(scope)">下载</el-link>
<el-divider direction="vertical"></el-divider>
<el-link v-if="checkPermission(['yearReportDel'])" type="danger" @click="handleDelete(scope)">删除</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -71,7 +74,7 @@ import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
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 { parsePDF, pdfAll, getpdf } from "@/api/report"; import { parsePDF, pdfAll, getpdf, delYr } from "@/api/report";
import { upUrl, upHeaders } from "@/api/file"; import { upUrl, upHeaders } from "@/api/file";
@ -129,6 +132,23 @@ export default {
this.getList() this.getList()
}, },
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await delYr(scope.row.id).then(() => {
this.getList();
this.$message.success("成功");
})
})
.catch((err) => {
console.error(err);
});
},
submitUpload() { submitUpload() {
this.$refs.upload.submit(); this.$refs.upload.submit();
this.impDialogVisible = false; this.impDialogVisible = false;
@ -151,8 +171,6 @@ export default {
}, },
getList() { getList() {
this.listLoading = true; this.listLoading = true;
this.tableData.results =[];
this.tableData.count =0;
pdfAll(this.listQuery).then((response) => { pdfAll(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
this.tableData = response.data; this.tableData = response.data;

View File

@ -132,8 +132,6 @@ export default {
}, },
getList() { getList() {
this.listLoading = true; this.listLoading = true;
this.tableData.results =[];
this.tableData.count =0;
yrAll(this.listQuery).then((response) => { yrAll(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
this.tableData = response.data; this.tableData = response.data;