提交 fcaeffdb authored 作者: 龙菲's avatar 龙菲

对接智能抠图接口;修复table搜索的问题

上级 d759cf82
import request from '@/utils/request'
// 上传图片抠图
export function mattingImage(data) {
return request({
url: '/bizMattingRecords/mattingImage',
method: 'post',
data
})
}
// 获取抠图记录分页
export function getMattingList(data) {
return request({
url: '/bizMattingRecords/listByPage',
method: 'post',
data
})
}
// 查询抠图记录详情
export function getMattingDetail(params) {
return request({
url: '/bizMattingRecords/detail',
method: 'get',
params
})
}
// 删除抠图记录
export function deleteMattingRecord(data) {
return request({
url: '/bizMattingRecords/delete',
method: 'delete',
data
})
}
// 删除抠图的图片
export function deleteMattingImage(data) {
return request({
url: '/bizMattingImages/delete',
method: 'delete',
data
})
}
// 获取抠图的图片分页
export function getMattingImagesPage(data) {
return request({
url: '/bizMattingImages/listByPage',
method: 'delete',
data
})
}
// 通过上传记录Id集合下载抠图文件列表
export function downFileByMattingIds(data) {
return request({
url: '/bizMattingRecords/downFileByMattingIds',
method: 'post',
data
})
}
// 通过fileIds下载去背景图片
export function downFileByFileIds(data) {
return request({
url: '/bizMattingImages/downLoad',
method: 'post',
data
})
}
<template> <template>
<el-dialog <el-dialog
:visible="visible" :visible="visible"
width="60%" width="40%"
style="height: 98%" style="height: 98%"
:before-close="handleClose" :before-close="handleClose"
top="5vh" top="5vh"
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
> >
<div class="title" slot="title"> <div class="title" slot="title">
<div class="divider"></div> <div class="divider"></div>
<span class="label">{{ getDialogTitle }}</span> <span class="label"> 上传文件</span>
<span class="tips"> <span class="tips">
<i class="el-icon-info"></i <i class="el-icon-info"></i
>提示:上传过程中请勿关闭此弹窗或刷新页面等操作 >提示:上传过程中请勿关闭此弹窗或刷新页面等操作
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
:disabled="isDisabledTitle" :disabled="isDisabledTitle"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="上传文件"> <el-form-item label="文件">
<el-upload <el-upload
ref="upload" ref="upload"
class="upload-area" class="upload-area"
name="zipFile" name="zipFile"
:accept="fileType" :accept="fileType"
:action="importZipUrl" :action="uploadUrl"
:headers="headers" :headers="headers"
:on-success="handleSuccess" :on-success="handleSuccess"
:on-change="handleChange" :on-change="handleChange"
...@@ -114,22 +114,18 @@ import { getToken } from "@/utils/auth"; ...@@ -114,22 +114,18 @@ import { getToken } from "@/utils/auth";
export default { export default {
name: "UploadDialog", name: "UploadDialog",
props: { props: {
//biz_cultural_relic——文物,biz_exhibition——展览,还需考虑其他的类型 // 抠图上传的对象(包含上传的文件类型、标题)
bizType: { options: {
type: String, type: Object,
default: "biz_cultural_relic", default: () => ({
}, recordsTitle: "", //上传时的记录标题,非必填
flowId: { bizType: "", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填
type: String, uploadUrl: "", //上传的地址,必填
default: "", //流程id flowId: "", //流程ID,重传时需要,非必填
}, compressFlag: "", //上传方式:0-单个图片文件;1-zip文件。抠图时需要,非必填
title: { uploadFileKey: "", //formData中文件的key
type: String, uploadTitleKey: "", //formData中标题的key
default: "", //标题,重传时会带过来 }),
},
fileType: {
type: String,
default: ".zip", //‘.zip为压缩文件,.jpg,.png,.jpeg’为图片
}, },
}, },
computed: { computed: {
...@@ -138,20 +134,20 @@ export default { ...@@ -138,20 +134,20 @@ export default {
return (size / 1024 / 1024).toFixed(2) + "M"; //1M=1024Kb=1024*1024byte return (size / 1024 / 1024).toFixed(2) + "M"; //1M=1024Kb=1024*1024byte
}; };
}, },
importZipUrl() { uploadUrl() {
if (!this.bizType) { if (!this.options) {
return; return;
} }
return process.env.VUE_APP_BASE_API + "/bizImport/importZip"; return this.options.uploadUrl;
}, },
getDialogTitle() { fileType() {
switch (this.bizType) { if (!this.options) {
case "biz_cultural_relic": return;
return "批量上传文物"; }
case "biz_exhibition": if (this.options.compressFlag == 0) {
return "批量上传展览"; return ".jpg,.png,jpeg";
default: } else {
return "上传文件"; return ".zip";
} }
}, },
}, },
...@@ -190,9 +186,15 @@ export default { ...@@ -190,9 +186,15 @@ export default {
}; };
}, },
watch: { watch: {
title(value) { options: {
this.form.uploadTitle = value; handler(value) {
this.isDisabledTitle = true; if (value.recordsTitle) {
this.form.uploadTitle = value.recordsTitle;
this.isDisabledTitle = true;
}
},
deep: true,
immediate: true,
}, },
}, },
...@@ -210,7 +212,6 @@ export default { ...@@ -210,7 +212,6 @@ export default {
} else { } else {
this.fileList = this.$refs.upload.uploadFiles; this.fileList = this.$refs.upload.uploadFiles;
} }
console.log("this.fileList", this.fileList);
// return // return
for (let i = 0; i < this.fileList.length; i++) { for (let i = 0; i < this.fileList.length; i++) {
this.uploadSelf(this.fileList[i].raw, i); //弹窗显示的时候,就根据文件队列的数量调用上传接口 this.uploadSelf(this.fileList[i].raw, i); //弹窗显示的时候,就根据文件队列的数量调用上传接口
...@@ -225,7 +226,31 @@ export default { ...@@ -225,7 +226,31 @@ export default {
fileList.splice(1, 1); fileList.splice(1, 1);
} }
}, },
// 获取上传的表单
getFormData(file) {
let formData = new FormData();
const { bizType, flowId, compressFlag, uploadFileKey, uploadTitleKey } =
this.options;
const { uploadTitle } = this.form;
// 业务类型,文物和展览批量上传时需要
if (bizType) {
formData.append("type", bizType);
}
// 上传方式:0-单个图片文件;1-zip文件,抠图上传时需要
if (compressFlag == "0" || compressFlag == "1") {
formData.append("compressFlag", compressFlag);
}
// 流程Id
if (flowId) {
formData.append("flowId", flowId);
}
//文件上传的key
const fileKey = uploadFileKey || "zipFile";
const titleKey = uploadTitleKey || "flowTitle";
formData.append(fileKey, file);
formData.append(titleKey, uploadTitle);
return formData;
},
// 上传函数实现逻辑 // 上传函数实现逻辑
uploadSelf(file, index) { uploadSelf(file, index) {
const loading = this.$loading({ const loading = this.$loading({
...@@ -234,14 +259,7 @@ export default { ...@@ -234,14 +259,7 @@ export default {
spinner: "el-icon-loading", spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)", background: "rgba(0, 0, 0, 0.7)",
}); });
let formData = new FormData(); const formData = this.getFormData(file);
formData.append("type", this.bizType);
formData.append("zipFile", file);
formData.append("flowTitle", this.form.uploadTitle);
if (this.flowId) {
formData.append("flowId", this.flowId);
}
importZip( importZip(
formData, formData,
(progressEvent) => this.uploadUnderWayCallback(progressEvent, index), (progressEvent) => this.uploadUnderWayCallback(progressEvent, index),
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1698388464699" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2313" xmlns:xlink="http://www.w3.org/1999/xlink" width="80" height="80"><path d="M628.207818 934.314264c1.4239 0.063995 2.783804 0.191986 4.215703 0.191987h321.841339c37.685347-0.039997 68.235195-29.413929 68.267193-65.675376V151.185405c-0.031998-36.253447-30.581847-65.627379-68.267193-65.667376H632.423521c-1.431899 0-2.823801 0.127991-4.215703 0.191986V0.036048L0.036048 80.686369v859.187504l628.17177 82.730175v-88.289784z m0-810.838908c1.391902-0.191986 2.783804-0.415971 4.215703-0.41597h321.841339c16.142863 0 29.269939 12.623111 29.269939 28.158017v717.653469c-0.023998 15.534906-13.119076 28.134019-29.269939 28.150018H632.423521c-1.431899 0-2.823801-0.223984-4.215703-0.41597V123.475356zM242.115003 606.049378l-149.757456-3.679741V578.955286l90.393636-133.374609v-1.183917l-82.122218 1.311908v-36.07746l140.022141-3.519752v26.110161L149.593517 566.076192v1.151919l92.521486 1.407901v37.421365z m75.346695 1.84787l-46.580721-1.151919V405.375508l46.580721-1.151919v203.673659z m178.027465-93.049449c-17.342779 15.374917-42.820985 22.078445-72.15492 21.886459-5.615605 0.031998-11.21521-0.319977-16.774819-1.047926v74.41876l-47.972622-1.183916V405.951467c14.814957-2.815802 35.781481-5.175636 65.739371-5.943582 30.701838-0.767946 52.860278 4.311696 67.835224 15.302923 14.454982 10.447264 24.254292 27.998029 24.254292 48.892557s-7.407478 38.661278-20.894529 50.644434h-0.031997zM426.885993 435.605379c-6.847518-0.079994-13.679037 0.663953-20.326569 2.199845v61.451673c4.183705 0.927935 9.335343 1.215914 16.47884 1.215915 26.406141-0.031998 42.876981-12.911091 42.876981-34.509571 0-19.398634-14.175002-30.741835-38.997254-30.325864l-0.031998-0.031998z m318.753556-296.507123h76.506613v30.357863h-76.506613v-30.357863z m-76.538611 45.436801h76.506613v30.39786h-76.506613v-30.39786z m76.538611 49.724499h76.506613v30.38986h-76.506613V234.259556z m0 95.993241h76.506613v30.349863h-76.506613V330.252797z m-76.538611-48.764566h76.506613v30.357862h-76.506613v-30.357862z m75.770665 376.485491c20.094585 0 39.365228-7.679459 53.572228-21.358496 14.207-13.663038 22.182438-32.205732 22.174439-51.532372l-13.983016-122.095403c0-40.261165-19.934596-72.890868-61.795648-72.890868-41.853053 0-61.755652 32.629703-61.755652 72.890868l-14.015013 122.095403c-0.007999 19.334639 7.967439 37.877333 22.182438 51.548371 14.214999 13.679037 33.493642 21.350497 53.596226 21.342497h0.023998z m-25.078234-133.990566h50.156469v101.936823h-50.156469V523.999155z" p-id="2314"></path></svg>
\ No newline at end of file
...@@ -142,7 +142,7 @@ export const staticRouter = [ ...@@ -142,7 +142,7 @@ export const staticRouter = [
name: 'Matting', name: 'Matting',
component: () => import('@/views/matting/index'), component: () => import('@/views/matting/index'),
meta: { meta: {
title: '在线抠图', title: '智能抠图',
icon: 'scissors' icon: 'scissors'
} }
}, },
......
...@@ -8,8 +8,8 @@ export function addRouter(menus) { ...@@ -8,8 +8,8 @@ export function addRouter(menus) {
if (isProduct) { if (isProduct) {
return addServerRouter(menus) //使用后端路由 return addServerRouter(menus) //使用后端路由
} else { } else {
// return addServerRouter(menus) //使用后端路由 return addServerRouter(menus) //使用后端路由
return addLocalRouter()//使用前端路由 // return addLocalRouter()//使用前端路由
} }
} }
......
...@@ -667,4 +667,4 @@ export default { ...@@ -667,4 +667,4 @@ export default {
margin: 20px 0; margin: 20px 0;
} }
</style> </style>
@/utils/bizTransform@/utils/bizUploadFunctions @/utils/bizTransform@/utils/bizUploadFunctions
\ No newline at end of file
...@@ -120,7 +120,11 @@ ...@@ -120,7 +120,11 @@
</div> </div>
<InfoEditDialog ref="InfoEditDialog" :form="form" @refresh="loadData" /> <InfoEditDialog ref="InfoEditDialog" :form="form" @refresh="loadData" />
<UploadDialog ref="UploadDialog" @update="loadData" /> <UploadDialog
ref="UploadDialog"
@update="loadData"
:options="multiUploadOptions"
/>
<ImportRecordDialog <ImportRecordDialog
:visible="importRecordVisible" :visible="importRecordVisible"
...@@ -157,6 +161,7 @@ import { ...@@ -157,6 +161,7 @@ import {
getRCDetailByIdTemp, getRCDetailByIdTemp,
getRCDetailById, getRCDetailById,
deleteCultralRelic, deleteCultralRelic,
deleteCultralRelicTemp,
editCulturalRelic, editCulturalRelic,
} from "@/api/culturalRelic"; } from "@/api/culturalRelic";
import InfoEditDialog from "./components/InfoEditDialog"; import InfoEditDialog from "./components/InfoEditDialog";
...@@ -166,6 +171,7 @@ import PreviewDialog from "./components/PreviewDialog"; ...@@ -166,6 +171,7 @@ import PreviewDialog from "./components/PreviewDialog";
import View3dDialog from "./components/View3dDialog"; import View3dDialog from "./components/View3dDialog";
import { rules } from "./configs/validateRules"; import { rules } from "./configs/validateRules";
import boutiqueTool from "@/utils/boutique"; import boutiqueTool from "@/utils/boutique";
import { downloadFile } from "@/utils/file";
export default { export default {
components: { components: {
InfoEditDialog, InfoEditDialog,
...@@ -203,6 +209,12 @@ export default { ...@@ -203,6 +209,12 @@ export default {
operates, operates,
tabActive: "unPassed", tabActive: "unPassed",
previewInfo: {}, previewInfo: {},
searchParams: {}, //记录SearchForm中的搜索条件
//批量上传的参数
multiUploadOptions: {
bizType: "biz_cultural_relic", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填
uploadUrl: process.env.VUE_APP_BASE_API + "/bizImport/importZip", //上传的地址,必填
},
}; };
}, },
watch: { watch: {
...@@ -243,6 +255,8 @@ export default { ...@@ -243,6 +255,8 @@ export default {
}, },
methods: { methods: {
async search(form) { async search(form) {
// 记录搜索的参数
this.searchParams = form;
this.resetPage(); this.resetPage();
this.loadData(form); this.loadData(form);
}, },
...@@ -250,7 +264,9 @@ export default { ...@@ -250,7 +264,9 @@ export default {
resetPage() { resetPage() {
this.getCurrentList().current = 1; this.getCurrentList().current = 1;
}, },
// 重置
reset() { reset() {
this.searchParams = {};
this.loadData(); this.loadData();
}, },
// 加载表格数据 // 加载表格数据
...@@ -259,7 +275,6 @@ export default { ...@@ -259,7 +275,6 @@ export default {
var params = { var params = {
page: current, page: current,
limit: size, limit: size,
...form,
}; };
if (!params.level) { if (!params.level) {
delete params.level; delete params.level;
...@@ -267,6 +282,10 @@ export default { ...@@ -267,6 +282,10 @@ export default {
if (params.status == "") { if (params.status == "") {
delete params.status; delete params.status;
} }
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
const currentRequest = this.getCurrentRequest(); const currentRequest = this.getCurrentRequest();
const res = await currentRequest(params); const res = await currentRequest(params);
if (res.code == 0) { if (res.code == 0) {
...@@ -342,7 +361,6 @@ export default { ...@@ -342,7 +361,6 @@ export default {
case "multiAdd": case "multiAdd":
this.multiAdd(); this.multiAdd();
break; break;
case "downloadTemplate": case "downloadTemplate":
this.handleDownloadTemplate(); this.handleDownloadTemplate();
break; break;
...@@ -381,6 +399,14 @@ export default { ...@@ -381,6 +399,14 @@ export default {
return currentRequest; return currentRequest;
}, },
getCurrentDeleteRequest() {
const currentRequest =
this.tabActive == "passed"
? deleteCultralRelic
: deleteCultralRelicTemp;
return currentRequest;
},
async edit(row) { async edit(row) {
const { crId } = row; const { crId } = row;
let detailRes = await getRCDetailByIdTemp({ crId }); let detailRes = await getRCDetailByIdTemp({ crId });
...@@ -390,7 +416,8 @@ export default { ...@@ -390,7 +416,8 @@ export default {
} }
}, },
async deleteRow(row) { async deleteRow(row) {
let deleteRes = await deleteCultralRelic([row.crId]); const request = this.getCurrentDeleteRequest();
let deleteRes = await request([row.crId]);
if (deleteRes.code == 0) { if (deleteRes.code == 0) {
this.$message.success("删除成功!"); this.$message.success("删除成功!");
this.loadData(); this.loadData();
...@@ -405,13 +432,9 @@ export default { ...@@ -405,13 +432,9 @@ export default {
//下载批量导入模板 //下载批量导入模板
handleDownloadTemplate() { handleDownloadTemplate() {
this.loading = true; this.loading = true;
let a = document.createElement("a"); const href = "/files/zip/crImportTemplate.zip";
a.href = "/files/zip/crImportTemplate.zip"; const dowmloadName = "文物导入模板及操作说明.zip";
a.download = "文物导入模板及操作说明.zip"; downloadFile(href, dowmloadName);
a.style.display = "none";
document.body.appendChild(a);
a.click();
a.remove();
this.loading = false; this.loading = false;
}, },
...@@ -421,7 +444,6 @@ export default { ...@@ -421,7 +444,6 @@ export default {
}, },
// 预览图片 // 预览图片
handelPreviewImages(images) { handelPreviewImages(images) {
// debugger
this.imgViewerVisible = true; this.imgViewerVisible = true;
this.imgList = [images]; this.imgList = [images];
}, },
......
...@@ -123,7 +123,6 @@ export default { ...@@ -123,7 +123,6 @@ export default {
return (Number(fileSize) / 1024 / 1024).toFixed(2) + "M"; return (Number(fileSize) / 1024 / 1024).toFixed(2) + "M";
}; };
}, },
isToday(time) { isToday(time) {
return (time) => { return (time) => {
if (time) { if (time) {
...@@ -145,10 +144,6 @@ export default { ...@@ -145,10 +144,6 @@ export default {
current: 1, current: 1,
total: 0, total: 0,
}, },
searchForm: {
name: "",
status: "",
},
searchConfig: [ searchConfig: [
{ {
prop: "createTime", prop: "createTime",
......
...@@ -400,6 +400,11 @@ export default { ...@@ -400,6 +400,11 @@ export default {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
// 流程id,重传时需要
flowId: {
type: String,
default: "",
},
}, },
computed: { computed: {
...mapGetters(["userInfo", "dicts"]), ...mapGetters(["userInfo", "dicts"]),
......
...@@ -270,6 +270,10 @@ const submit = (submitFlag, $el) => { ...@@ -270,6 +270,10 @@ const submit = (submitFlag, $el) => {
...formUploaded, ...formUploaded,
exhibitionUnits: unitsUploaded, exhibitionUnits: unitsUploaded,
}; };
// 重传时需要加入flowId
if ($el.flowId) {
params.flowId = $el.flowId;
}
// 删除一些需要删除的字段 // 删除一些需要删除的字段
needDelete.forEach(key => { needDelete.forEach(key => {
delete params[key] delete params[key]
...@@ -286,7 +290,6 @@ const submit = (submitFlag, $el) => { ...@@ -286,7 +290,6 @@ const submit = (submitFlag, $el) => {
$el.submitLoading = false; $el.submitLoading = false;
$el.$message.success("提交成功!"); $el.$message.success("提交成功!");
$el.visible = false; $el.visible = false;
// TODO:删除文件
handleDeleteFiles(removedIds) handleDeleteFiles(removedIds)
}, 1000); }, 1000);
} }
......
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
/> />
<UploadDialog <UploadDialog
ref="UploadDialog" ref="UploadDialog"
bizType="biz_exhibition" :options="multiUploadOptions"
@update="loadData" @update="loadData"
/> />
...@@ -231,7 +231,6 @@ export default { ...@@ -231,7 +231,6 @@ export default {
displayTypes: {}, displayTypes: {},
currentPageIds: [], //当前的id数组,用于给详情页切换用 currentPageIds: [], //当前的id数组,用于给详情页切换用
multiUploadVisible: false, //控制批量上传弹窗显示 multiUploadVisible: false, //控制批量上传弹窗显示
importRecordVisible: false, //上传记录
filesList: [], //上传当中的文件队列 filesList: [], //上传当中的文件队列
uploadCount: 0, //处于上传中的文件数量,当等于fileList的时候就关闭弹窗,请求完毕一个就++ uploadCount: 0, //处于上传中的文件数量,当等于fileList的时候就关闭弹窗,请求完毕一个就++
cancelUploadArr: [], //保存每个文件上传接口对应的取消请求的函数[fn,fn,fn...] cancelUploadArr: [], //保存每个文件上传接口对应的取消请求的函数[fn,fn,fn...]
...@@ -241,6 +240,12 @@ export default { ...@@ -241,6 +240,12 @@ export default {
unPassedTitle, unPassedTitle,
operates, operates,
curPreview: {}, //当前预览的对象 curPreview: {}, //当前预览的对象
searchParams: {}, //记录SearchForm中的搜索条件
//批量上传的参数
multiUploadOptions: {
bizType: "biz_exhibition", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填
uploadUrl: process.env.VUE_APP_BASE_API + "/bizImport/importZip", //上传的地址,必填
},
}; };
}, },
computed: { computed: {
...@@ -331,12 +336,27 @@ export default { ...@@ -331,12 +336,27 @@ export default {
this.tabActive == "passed" ? getListPer : getListPerTemp; this.tabActive == "passed" ? getListPer : getListPerTemp;
return currentRequest; return currentRequest;
}, },
// 获取当前预览请求
getCurrentPreviewRequest() {
const currentRequest =
this.tabActive == "passed" ? getDisplayById : getDisplayByIdTemp;
return currentRequest;
},
// 获取当前删除请求
getCurrentDeleteRequest() {
const currentRequest =
this.tabActive == "passed" ? deleteDisplay : deleteDisplayTemp;
return currentRequest;
},
async search(form) { async search(form) {
// 记录搜索的参数
this.searchParams = form;
this.resetPage(); this.resetPage();
this.loadData(form); this.loadData(form);
}, },
reset() { reset() {
this.searchParams = {};
this.loadData(); this.loadData();
}, },
...@@ -346,19 +366,22 @@ export default { ...@@ -346,19 +366,22 @@ export default {
var params = { var params = {
page: this.list.current, page: this.list.current,
limit: this.list.size, limit: this.list.size,
...form,
}; };
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
const currentRequest = this.getCurrentRequest(); const currentRequest = this.getCurrentRequest();
const res = await currentRequest(params); const res = await currentRequest(params);
if (res.code == 0) { if (res.code == 0) {
this.setList(res.data); this.setList(res.data);
} }
}, },
// 操作
handleOperation(value, row) { handleOperation(value, row) {
switch (value.type) { switch (value.type) {
case "add": case "add":
this.openDialog("InfoEditDialog"); this.$appCommon.openDialog(this, "InfoEditDialog");
case "view": case "view":
this.handleView(row); this.handleView(row);
break; break;
...@@ -369,19 +392,16 @@ export default { ...@@ -369,19 +392,16 @@ export default {
this.handleDelete(row); this.handleDelete(row);
break; break;
case "multiAdd": case "multiAdd":
this.openDialog("UploadDialog"); this.$appCommon.openDialog(this, "UploadDialog");
break; break;
case "downloadTemplate": case "downloadTemplate":
this.handleDownloadTemplate(); this.handleDownloadTemplate();
break; break;
case "viewImportRecord": case "viewImportRecord":
this.importRecordVisible = true; this.$appCommon.openDialog(this, "ImportRecordDialog");
break; break;
} }
}, },
openDialog(refName) {
this.$refs[refName].visible = true;
},
// 预览展览 // 预览展览
async handleView(row) { async handleView(row) {
...@@ -396,19 +416,13 @@ export default { ...@@ -396,19 +416,13 @@ export default {
}); });
if (res.data) { if (res.data) {
this.curPreview = res.data; this.curPreview = res.data;
this.openDialog("PreviewDialog"); this.$appCommon.openDialog(this, "PreviewDialog");
} else { } else {
this.$message.error("暂无数据!"); this.$message.error("暂无数据!");
} }
} }
}, },
getCurrentPreviewRequest() {
const currentRequest =
this.tabActive == "passed" ? getDisplayById : getDisplayByIdTemp;
return currentRequest;
},
// 编辑展览 // 编辑展览
async handleEdit(row) { async handleEdit(row) {
let editRes = await getDisplayByIdTemp({ let editRes = await getDisplayByIdTemp({
...@@ -420,13 +434,8 @@ export default { ...@@ -420,13 +434,8 @@ export default {
// 删除展览 // 删除展览
async handleDelete(row) { async handleDelete(row) {
let request; const request = this.getCurrentDeleteRequest();
if (this.tabActive == "unPassed") { const deleteRes = await request([row.exhibitionId]);
request = deleteDisplayTemp;
} else {
request = deleteDisplay;
}
let deleteRes = await request([row.exhibitionId]);
if (deleteRes.code === 0) { if (deleteRes.code === 0) {
this.loadData(); this.loadData();
this.$message.success("删除成功!"); this.$message.success("删除成功!");
......
...@@ -58,12 +58,12 @@ ...@@ -58,12 +58,12 @@
ref="displayInfo" ref="displayInfo"
:form="resubmitDisplayInfo" :form="resubmitDisplayInfo"
@refresh="loadData" @refresh="loadData"
:flowId="currentFlowId"
/> />
<UploadDialog <UploadDialog
ref="UploadDialog" ref="UploadDialog"
@update="loadData" @update="loadData"
:title="currentFlowTitle" :options="resubmitOptions"
:flowId="currentFlowId"
/> />
</div> </div>
</template> </template>
...@@ -108,7 +108,7 @@ export default { ...@@ -108,7 +108,7 @@ export default {
current: 1, current: 1,
total: 0, total: 0,
}, },
searchParams: "", searchParams: {}, //记录SearchForm中的搜索条件
searchConfig: [ searchConfig: [
{ {
prop: "title", prop: "title",
...@@ -167,7 +167,12 @@ export default { ...@@ -167,7 +167,12 @@ export default {
resubmitDisplayInfo: {}, //重传的手动添加的展览信息 resubmitDisplayInfo: {}, //重传的手动添加的展览信息
resubmitCrMulti: {}, //重传的批量导入的文物信息 resubmitCrMulti: {}, //重传的批量导入的文物信息
resubmitDisplayMulti: {}, //重传的整量导入的展览信息 resubmitDisplayMulti: {}, //重传的整量导入的展览信息
currentFlowTitle: "", //当前重传的流程的title resubmitOptions: {
recordsTitle: "", //上传时的记录标题,非必填
bizType: "", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填
uploadUrl: process.env.VUE_APP_BASE_API + "/bizImport/importZip", //上传的地址,必填
flowId: "", //流程ID,重传时需要,非必填
},
}; };
}, },
computed: { computed: {
...@@ -189,33 +194,47 @@ export default { ...@@ -189,33 +194,47 @@ export default {
}, },
}, },
async created() { async created() {
await this.$store.dispatch("dict/getDictList", ["displayType"]);
this.loadData(); this.loadData();
}, },
methods: { methods: {
// 搜索
async search(form) { async search(form) {
// 记录搜索的参数
this.searchParams = form; this.searchParams = form;
// 重置分页到第一页
this.resetPage();
this.loadData(form); this.loadData(form);
}, },
// 重置
reset() { reset() {
this.searchParams = {};
this.loadData(); this.loadData();
}, },
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
// 加载数据
async loadData(form) { async loadData(form) {
this.loading = true; this.loading = true;
const params = { let params = {
page: this.list.current, page: this.list.current,
limit: this.list.size, limit: this.list.size,
...form,
}; };
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
let res = await getFlowListPagePer(params); let res = await getFlowListPagePer(params);
if (res.code == 0) { if (res.code == 0) {
this.list = res.data; this.list = res.data;
} }
this.loading = false; this.loading = false;
}, },
// 表格操作
handleOperation(value, row) { handleOperation(value, row) {
const { type } = value; const { type, id } = value;
this.currentFlowId = id;
if (type == "view" || type == "approval") { if (type == "view" || type == "approval") {
this.viewOrApproval(type, row); this.viewOrApproval(type, row);
} else { } else {
...@@ -239,27 +258,28 @@ export default { ...@@ -239,27 +258,28 @@ export default {
async resubmit(row) { async resubmit(row) {
const { addWay, sourceType, id, title } = row; const { addWay, sourceType, id, title } = row;
const isManual = addWay == "手动添加"; const isManual = addWay == "手动添加";
this.currentFlowId = id; this.resubmitOptions.flowId = id;
switch (sourceType) { switch (sourceType) {
case "文物": case "文物":
if (isManual) { if (isManual) {
const data = await this.getSourceDetail(this.currentFlowId); const data = await this.getSourceDetail(id);
this.resubmitCrInfo = data; this.resubmitCrInfo = data;
this.openResubmitDialog("CrInfo"); this.$appCommon.openDialog(this, "CrInfo");
} else { } else {
this.currentFlowTitle = title; this.resubmitOptions.recordsTitle = title;
this.openResubmitDialog("UploadDialog"); this.resubmitOptions.bizType = "biz_cultural_relic";
this.$appCommon.openDialog(this, "UploadDialog");
} }
break; break;
case "展览展示": case "展览展示":
if (isManual) { if (isManual) {
const data = await this.getSourceDetail(this.currentFlowId); const data = await this.getSourceDetail(id);
this.resubmitDisplayInfo = data; this.resubmitDisplayInfo = data;
this.openResubmitDialog("DisplayInfo"); this.resubmitOptions.bizType = "biz_exhibition";
this.$appCommon.openDialog(this, "DisplayInfo");
} else { } else {
this.currentFlowTitle = title; this.resubmitOptions.recordsTitle = title;
this.openResubmitDialog("UploadDialog"); this.$appCommon.openDialog(this, "UploadDialog");
} }
break; break;
} }
...@@ -283,16 +303,6 @@ export default { ...@@ -283,16 +303,6 @@ export default {
}); });
}, },
// 打开文物编辑重传弹窗
openResubmitDialog(name) {
this.$refs[name].visible = true;
},
// 关闭文物编辑重传弹窗
closeResubmitDialog(name) {
this.$refs[name].visible = false;
},
// 多选 // 多选
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
......
...@@ -65,7 +65,7 @@ import { title, operates, operations } from "./config"; ...@@ -65,7 +65,7 @@ import { title, operates, operations } from "./config";
import { editLiterature, deleteLt } from "@/api/literature"; import { editLiterature, deleteLt } from "@/api/literature";
import InfoEditDialog from "./components/InfoEditDialog"; import InfoEditDialog from "./components/InfoEditDialog";
import { downloadFile, previewFile, downloadBlob } from "@/utils/file"; import { downloadFile, previewFile, downloadBlob } from "@/utils/file";
import { mapActions } from "vuex";
export default { export default {
components: { components: {
InfoEditDialog, InfoEditDialog,
...@@ -119,6 +119,7 @@ export default { ...@@ -119,6 +119,7 @@ export default {
remark: "", //备注 remark: "", //备注
}, },
loading: false, loading: false,
searchParams: {},
}; };
}, },
...@@ -146,89 +147,102 @@ export default { ...@@ -146,89 +147,102 @@ export default {
this.loadData(); this.loadData();
}, },
methods: { methods: {
...mapActions("dict", ["getLtList"]),
// 搜索
async search(form) { async search(form) {
this.loading = true; // 记录搜索的参数
var params = { this.searchParams = form;
page: this.list.current, // 重置分页到第一页
limit: this.list.size, this.resetPage();
...form, this.loadData(form);
};
if (params.status == "") {
delete params.status;
}
const res = await this.$store.dispatch("dict/getLtList", params);
if (res.code == 0) {
this.list = res.data;
}
this.loading = false;
}, },
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
// 重置
reset() { reset() {
this.searchParams = {};
this.loadData(); this.loadData();
}, },
// 加载表格数据
// 加载表格数据 async loadData(form) {
async loadData() {
this.loading = true; this.loading = true;
var params = { var params = {
page: this.list.current, page: this.list.current,
limit: this.list.size, limit: this.list.size,
}; };
const res = await this.$store.dispatch("dict/getLtList", params); const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
const res = await this.getLtList(params);
if (res.code == 0) { if (res.code == 0) {
this.list = res.data; this.list = res.data;
} }
this.loading = false; this.loading = false;
}, },
async handleOperation(value, row) { handleOperation(value, row) {
switch (value.type) { switch (value.type) {
case "add": case "add":
this.drawerVisible = true; this.drawerVisible = true;
break; break;
case "view": case "view":
if (row.files && row.files.length > 0 && row.files[0].url) { this.view(row);
previewFile(row.files[0].url, row.name);
} else {
let m = this.$message.info("暂无文献附件!");
setTimeout(() => {
m.close();
}, 1500);
}
break; break;
case "download": case "download":
if (row.files && row.files.length > 0 && row.files[0].url) { this.download(row);
let start = this.$message.info("正在准备下载...");
let url = "/files" + row.files[0].url.split("files")[1];
downloadBlob(url, row.name, "pdf")
.then((res) => {
start.close();
this.$message.success("下载成功!");
})
.catch((err) => {
start.close();
this.$message.error("下载失败:" + err);
});
} else {
let m = this.$message.info("暂无文献!");
setTimeout(() => {
m.close();
}, 1500);
}
break; break;
case "edit": case "edit":
this.form = row; this.form = row;
this.drawerVisible = true; this.drawerVisible = true;
break; break;
case "delete": case "delete":
let deleteRes = await deleteLt([row.literatureId]); this.handleDelete();
if (deleteRes.code == 0) {
this.$message.success("删除成功!");
this.loadData();
}
break; break;
} }
}, },
// 预览
view(row) {
const { files } = row;
const hasFileUrl = files.length > 0 && files[0].url;
if (!hasFileUrl) {
this.$message.info("暂无文献附件!");
return;
} else {
previewFile(row.files[0].url, row.name);
}
},
// 下载
download(row) {
const { files } = row;
const hasFileUrl = files.length > 0 && files[0].url;
if (!hasFileUrl) {
this.$message.error("暂无文献!");
return;
} else {
let msg = this.$message.info("正在准备下载...");
let url = "/files" + files[0].url.split("files")[1];
const { name } = row;
downloadBlob(url, name, "pdf")
.then((res) => {
msg.close();
this.$message.success("下载成功!");
})
.catch((err) => {
msg.close();
this.$message.error("下载失败:" + err);
});
}
},
// 删除
async handleDelete(row) {
let deleteRes = await deleteLt([row.literatureId]);
if (deleteRes.code == 0) {
this.$message.success("删除成功!");
this.loadData();
}
},
async handleChangeStatus(row) { async handleChangeStatus(row) {
const callback = this.loadData; const callback = this.loadData;
this.$bizCommon.changeStatus(row, editLiterature, callback); this.$bizCommon.changeStatus(row, editLiterature, callback);
......
...@@ -153,6 +153,7 @@ export default { ...@@ -153,6 +153,7 @@ export default {
}, },
], ],
loading: false, loading: false,
searchParams: {},
}; };
}, },
...@@ -177,41 +178,35 @@ export default { ...@@ -177,41 +178,35 @@ export default {
this.loadData(); this.loadData();
}, },
methods: { methods: {
// 搜索
async search(form) { async search(form) {
this.loading = true; // 记录搜索的参数
this.list.current = 1; this.searchParams = form;
var params = { this.resetPage();
page: this.list.current, this.loadData(form);
limit: this.list.size,
...form,
};
if (params.createTime && params.createTime.length > 0) {
params.startTime = params.createTime[0];
params.endTime = params.createTime[1];
}
if (params.createTime) {
delete params.createTime;
}
let res = await getLogList(params);
if (res.code == 0) {
this.list = res.data;
}
this.loading = false;
}, },
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
// 重置
reset() { reset() {
this.searchParams = {};
this.loadData(); this.loadData();
}, },
// 加载表格数据 // 加载表格数据
async loadData() { async loadData(form) {
this.loading = true; this.loading = true;
var params = { var params = {
page: this.list.current, page: this.list.current,
limit: this.list.size, limit: this.list.size,
}; };
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
let res = await getLogList(params); let res = await getLogList(params);
if (res.code == 0) { if (res.code == 0) {
this.list = res.data; this.list = res.data;
...@@ -246,6 +241,6 @@ export default { ...@@ -246,6 +241,6 @@ export default {
} }
::v-deep .el-form-item { ::v-deep .el-form-item {
margin-bottom: 20px; margin-bottom: 20px !important;
} }
</style> </style>
...@@ -8,14 +8,6 @@ ...@@ -8,14 +8,6 @@
/> />
<div class="tools"> <div class="tools">
<div class="tools-item"> <div class="tools-item">
<!-- <el-button
size="mini"
type="primary"
@click.native="handleOperation({ type: 'add' })"
icon="el-icon-upload2"
>
上传</el-button
> -->
<el-dropdown @command="handleCommand"> <el-dropdown @command="handleCommand">
<PermissionButton <PermissionButton
button button
...@@ -27,10 +19,8 @@ ...@@ -27,10 +19,8 @@
上传<i class="el-icon-arrow-down el-icon--right"></i> 上传<i class="el-icon-arrow-down el-icon--right"></i>
</PermissionButton> </PermissionButton>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command=".jpg,.jpeg,.png" <el-dropdown-item :command="TYPE_IMG">上传图片</el-dropdown-item>
>上传图片</el-dropdown-item <el-dropdown-item :command="TYPE_ZIP">上传压缩包</el-dropdown-item>
>
<el-dropdown-item command=".zip">上传压缩包</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
...@@ -72,9 +62,8 @@ ...@@ -72,9 +62,8 @@
</el-pagination> </el-pagination>
<UploadDialog <UploadDialog
ref="UploadDialog" ref="UploadDialog"
bizType="biz_matting"
@update="loadData" @update="loadData"
:fileType="currentUploadType" :options="uploadOptions"
/> />
<PreviewDialog ref="PreviewDialog" :detail="currentPreviewItem" /> <PreviewDialog ref="PreviewDialog" :detail="currentPreviewItem" />
</div> </div>
...@@ -92,6 +81,7 @@ import { operates, operations, tableTitle, searchConfig } from "./configs/list"; ...@@ -92,6 +81,7 @@ import { operates, operations, tableTitle, searchConfig } from "./configs/list";
import { records } from "./mock"; import { records } from "./mock";
import UploadDialog from "@/components/UploadDialog"; import UploadDialog from "@/components/UploadDialog";
import PreviewDialog from "./components/PreviewDialog"; import PreviewDialog from "./components/PreviewDialog";
import { getMattingList } from "@/api/matting";
export default { export default {
components: { components: {
UploadDialog, UploadDialog,
...@@ -100,7 +90,7 @@ export default { ...@@ -100,7 +90,7 @@ export default {
data() { data() {
return { return {
list: { list: {
records, records: [],
size: 10, size: 10,
current: 1, current: 1,
total: 0, total: 0,
...@@ -115,6 +105,16 @@ export default { ...@@ -115,6 +105,16 @@ export default {
tableTitle, tableTitle,
currentUploadType: ".zip", //当前上传的文件类型 currentUploadType: ".zip", //当前上传的文件类型
currentPreviewItem: {}, //当前点击的表格项目 currentPreviewItem: {}, //当前点击的表格项目
TYPE_IMG: "0", //单个图片文件
TYPE_ZIP: "1", //zip文件
uploadOptions: {
uploadUrl:
process.env.VUE_APP_BASE_API + "/bizMattingRecords/mattingImage", //上传的地址,必填
compressFlag: "0", //上传方式:0-单个图片文件;1-zip文件。抠图时需要,非必填
uploadFileKey: "file",
uploadTitleKey: "title",
},
searchParams: {},
}; };
}, },
async created() { async created() {
...@@ -122,6 +122,7 @@ export default { ...@@ -122,6 +122,7 @@ export default {
}, },
methods: { methods: {
async search(form) { async search(form) {
this.searchParams = form;
this.resetPage(); this.resetPage();
this.loadData(form); this.loadData(form);
}, },
...@@ -130,23 +131,27 @@ export default { ...@@ -130,23 +131,27 @@ export default {
this.list.current = 1; this.list.current = 1;
}, },
reset() { reset() {
this.searchParams = {};
this.loadData(); this.loadData();
}, },
// 加载表格数据 // 加载表格数据
async loadData(form) { async loadData(form) {
// const { current, size } = this.list; const { current, size } = this.list;
// var params = { var params = {
// page: current, page: current,
// limit: size, limit: size,
// ...form, };
// }; const queryParams = form || this.searchParams;
// const res = await currentRequest(params); if (Object.keys(queryParams)) {
// if (res.code == 0) { params = { ...params, ...queryParams };
// this.setList(res.data); }
// } const res = await getMattingList(params);
if (res.code == 0) {
this.list = res.data;
}
}, },
handleCommand(type) { handleCommand(type) {
this.currentUploadType = type; this.uploadOptions.compressFlag = type;
this.openDialog("UploadDialog"); this.openDialog("UploadDialog");
}, },
......
...@@ -98,10 +98,6 @@ export default { ...@@ -98,10 +98,6 @@ export default {
current: 1, current: 1,
total: 0, total: 0,
}, },
searchForm: {
name: "",
status: "",
},
searchConfig: [ searchConfig: [
{ {
prop: "title", prop: "title",
...@@ -137,6 +133,7 @@ export default { ...@@ -137,6 +133,7 @@ export default {
orgTreeData: [], orgTreeData: [],
imgViewerVisible: false, imgViewerVisible: false,
imgList: [], imgList: [],
searchParams: {}, //记录SearchForm中的搜索条件
}; };
}, },
computed: { computed: {
...@@ -165,31 +162,33 @@ export default { ...@@ -165,31 +162,33 @@ export default {
}, },
methods: { methods: {
async search(form) { async search(form) {
var params = { // 记录搜索的参数
page: this.list.current, this.searchParams = form;
limit: this.list.size, this.resetPage();
...form, this.loadData(form);
};
if (params.status == "") {
delete params.status;
}
let res = await getCcProduct(params);
if (res.code == 0) {
this.list = res.data;
}
}, },
reset() { reset() {
this.searchParams = {};
this.loadData(); this.loadData();
}, },
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
// 加载表格数据 // 加载表格数据
async loadData() { async loadData(form) {
this.loading = true; this.loading = true;
var params = { var params = {
page: this.list.current, page: this.list.current,
limit: this.list.size, limit: this.list.size,
}; };
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
let res = await getCcProduct(params); let res = await getCcProduct(params);
if (res.code == 0) { if (res.code == 0) {
this.list = res.data; this.list = res.data;
......
...@@ -122,6 +122,7 @@ export default { ...@@ -122,6 +122,7 @@ export default {
dataScopeForm: {}, //编辑数据权限的表单 dataScopeForm: {}, //编辑数据权限的表单
dataEditDialog: false, //编辑数据的对话框 dataEditDialog: false, //编辑数据的对话框
loading: false, loading: false,
searchParams: {}, //记录SearchForm中的搜索条件
}; };
}, },
...@@ -150,33 +151,32 @@ export default { ...@@ -150,33 +151,32 @@ export default {
this.loadData(); this.loadData();
}, },
methods: { methods: {
// 搜索
async search(form) { async search(form) {
this.loading = true; // 记录搜索的参数
var params = { this.searchParams = form;
page: this.list.current, this.resetPage();
limit: this.list.size, this.loadData(form);
...form,
};
if (params.status == "") {
delete params.status;
}
const res = await getRoleList(params);
if (res.code == 0) {
this.list = res.data;
}
this.loading = false;
}, },
// 重置
reset() { reset() {
this.searchParams = {};
this.loadData(); this.loadData();
}, },
// 清除分页到初始状态
// 加载表格数据 resetPage() {
async loadData() { this.list.current = 1;
},
// 加载表格数据
async loadData(form) {
var params = { var params = {
page: this.list.current, page: this.list.current,
limit: this.list.size, limit: this.list.size,
}; };
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
const res = await getRoleList(params); const res = await getRoleList(params);
if (res.code == 0) { if (res.code == 0) {
this.list = res.data; this.list = res.data;
...@@ -192,10 +192,7 @@ export default { ...@@ -192,10 +192,7 @@ export default {
}; };
break; break;
case "edit": case "edit":
const { id } = row; this.edit();
let res = await getRoleById(id);
this.form = res.data;
this.drawerVisible = true;
break; break;
case "delete": case "delete":
let deleteRes = await deleteRole(row.id); let deleteRes = await deleteRole(row.id);
...@@ -211,6 +208,12 @@ export default { ...@@ -211,6 +208,12 @@ export default {
} }
}, },
async edit(row) {
const { id } = row;
let res = await getRoleById(id);
this.form = res.data;
this.drawerVisible = true;
},
async handleChangeStatus(row) { async handleChangeStatus(row) {
const callback = this.loadData; const callback = this.loadData;
this.$bizCommon.changeStatus(row, upadateRole, callback); this.$bizCommon.changeStatus(row, upadateRole, callback);
......
...@@ -170,6 +170,7 @@ export default { ...@@ -170,6 +170,7 @@ export default {
currentRoleData: {}, currentRoleData: {},
currentId: null, currentId: null,
loading: false, loading: false,
searchParams: {},
}; };
}, },
mounted() { mounted() {
...@@ -186,33 +187,37 @@ export default { ...@@ -186,33 +187,37 @@ export default {
} }
}, },
// 加载表格数据 // 加载表格数据
async loadData() { async loadData(form) {
this.loading = true; this.loading = true;
var params = { var params = {
page: this.list.current, page: this.list.current,
limit: this.list.size, limit: this.list.size,
deptNo: this.currentDeptNo, deptNo: this.currentDeptNo,
}; };
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
const res = await getUserList(params); const res = await getUserList(params);
if (res.code == 0) { if (res.code == 0) {
this.list = res.data; this.list = res.data;
} }
this.loading = false; this.loading = false;
}, },
// 搜索
async search(form) { async search(form) {
var params = { // 记录搜索的参数
page: this.list.current, this.searchParams = form;
limit: this.list.size, this.resetPage();
deptNo: this.currentDeptNo, this.loadData(form);
...form, },
}; // 清除分页到初始状态
const res = await getUserList(params); resetPage() {
if (res.code == 0) { this.list.current = 1;
this.list = res.data;
}
}, },
// 重置
reset() { reset() {
this.searchParams = {};
this.loadData(); this.loadData();
}, },
......
...@@ -133,6 +133,7 @@ export default { ...@@ -133,6 +133,7 @@ export default {
orgTreeData: [], orgTreeData: [],
imgViewerVisible: false, imgViewerVisible: false,
imgList: [], imgList: [],
searchParams: {},
}; };
}, },
computed: { computed: {
...@@ -161,34 +162,33 @@ export default { ...@@ -161,34 +162,33 @@ export default {
}, },
methods: { methods: {
async search(form) { async search(form) {
this.loading = true; // 记录搜索的参数
var params = { this.searchParams = form;
page: this.list.current, this.resetPage();
limit: this.list.size, this.loadData(form);
...form,
};
if (params.status == "") {
delete params.status;
}
let res = await getVirtualListPer(params);
if (res.code == 0) {
this.list = res.data;
}
this.loading = false;
}, },
// 重置
reset() { reset() {
this.searchParams = {};
this.loadData(); this.loadData();
}, },
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
// 加载表格数据 // 加载表格数据
async loadData() { async loadData(form) {
this.loading = true; this.loading = true;
var params = { var params = {
page: this.list.current, page: this.list.current,
limit: this.list.size, limit: this.list.size,
}; };
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
let res = await getVirtualListPer(params); let res = await getVirtualListPer(params);
if (res.code == 0) { if (res.code == 0) {
this.list = res.data; this.list = res.data;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论