提交 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>
<el-dialog
:visible="visible"
width="60%"
width="40%"
style="height: 98%"
:before-close="handleClose"
top="5vh"
......@@ -9,7 +9,7 @@
>
<div class="title" slot="title">
<div class="divider"></div>
<span class="label">{{ getDialogTitle }}</span>
<span class="label"> 上传文件</span>
<span class="tips">
<i class="el-icon-info"></i
>提示:上传过程中请勿关闭此弹窗或刷新页面等操作
......@@ -29,13 +29,13 @@
:disabled="isDisabledTitle"
></el-input>
</el-form-item>
<el-form-item label="上传文件">
<el-form-item label="文件">
<el-upload
ref="upload"
class="upload-area"
name="zipFile"
:accept="fileType"
:action="importZipUrl"
:action="uploadUrl"
:headers="headers"
:on-success="handleSuccess"
:on-change="handleChange"
......@@ -114,22 +114,18 @@ import { getToken } from "@/utils/auth";
export default {
name: "UploadDialog",
props: {
//biz_cultural_relic——文物,biz_exhibition——展览,还需考虑其他的类型
bizType: {
type: String,
default: "biz_cultural_relic",
},
flowId: {
type: String,
default: "", //流程id
},
title: {
type: String,
default: "", //标题,重传时会带过来
},
fileType: {
type: String,
default: ".zip", //‘.zip为压缩文件,.jpg,.png,.jpeg’为图片
// 抠图上传的对象(包含上传的文件类型、标题)
options: {
type: Object,
default: () => ({
recordsTitle: "", //上传时的记录标题,非必填
bizType: "", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填
uploadUrl: "", //上传的地址,必填
flowId: "", //流程ID,重传时需要,非必填
compressFlag: "", //上传方式:0-单个图片文件;1-zip文件。抠图时需要,非必填
uploadFileKey: "", //formData中文件的key
uploadTitleKey: "", //formData中标题的key
}),
},
},
computed: {
......@@ -138,20 +134,20 @@ export default {
return (size / 1024 / 1024).toFixed(2) + "M"; //1M=1024Kb=1024*1024byte
};
},
importZipUrl() {
if (!this.bizType) {
uploadUrl() {
if (!this.options) {
return;
}
return process.env.VUE_APP_BASE_API + "/bizImport/importZip";
return this.options.uploadUrl;
},
getDialogTitle() {
switch (this.bizType) {
case "biz_cultural_relic":
return "批量上传文物";
case "biz_exhibition":
return "批量上传展览";
default:
return "上传文件";
fileType() {
if (!this.options) {
return;
}
if (this.options.compressFlag == 0) {
return ".jpg,.png,jpeg";
} else {
return ".zip";
}
},
},
......@@ -190,9 +186,15 @@ export default {
};
},
watch: {
title(value) {
this.form.uploadTitle = value;
this.isDisabledTitle = true;
options: {
handler(value) {
if (value.recordsTitle) {
this.form.uploadTitle = value.recordsTitle;
this.isDisabledTitle = true;
}
},
deep: true,
immediate: true,
},
},
......@@ -210,7 +212,6 @@ export default {
} else {
this.fileList = this.$refs.upload.uploadFiles;
}
console.log("this.fileList", this.fileList);
// return
for (let i = 0; i < this.fileList.length; i++) {
this.uploadSelf(this.fileList[i].raw, i); //弹窗显示的时候,就根据文件队列的数量调用上传接口
......@@ -225,7 +226,31 @@ export default {
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) {
const loading = this.$loading({
......@@ -234,14 +259,7 @@ export default {
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
});
let formData = new FormData();
formData.append("type", this.bizType);
formData.append("zipFile", file);
formData.append("flowTitle", this.form.uploadTitle);
if (this.flowId) {
formData.append("flowId", this.flowId);
}
const formData = this.getFormData(file);
importZip(
formData,
(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 = [
name: 'Matting',
component: () => import('@/views/matting/index'),
meta: {
title: '在线抠图',
title: '智能抠图',
icon: 'scissors'
}
},
......
......@@ -8,8 +8,8 @@ export function addRouter(menus) {
if (isProduct) {
return addServerRouter(menus) //使用后端路由
} else {
// return addServerRouter(menus) //使用后端路由
return addLocalRouter()//使用前端路由
return addServerRouter(menus) //使用后端路由
// return addLocalRouter()//使用前端路由
}
}
......
......@@ -667,4 +667,4 @@ export default {
margin: 20px 0;
}
</style>
@/utils/bizTransform@/utils/bizUploadFunctions
\ No newline at end of file
@/utils/bizTransform@/utils/bizUploadFunctions
......@@ -120,7 +120,11 @@
</div>
<InfoEditDialog ref="InfoEditDialog" :form="form" @refresh="loadData" />
<UploadDialog ref="UploadDialog" @update="loadData" />
<UploadDialog
ref="UploadDialog"
@update="loadData"
:options="multiUploadOptions"
/>
<ImportRecordDialog
:visible="importRecordVisible"
......@@ -157,6 +161,7 @@ import {
getRCDetailByIdTemp,
getRCDetailById,
deleteCultralRelic,
deleteCultralRelicTemp,
editCulturalRelic,
} from "@/api/culturalRelic";
import InfoEditDialog from "./components/InfoEditDialog";
......@@ -166,6 +171,7 @@ import PreviewDialog from "./components/PreviewDialog";
import View3dDialog from "./components/View3dDialog";
import { rules } from "./configs/validateRules";
import boutiqueTool from "@/utils/boutique";
import { downloadFile } from "@/utils/file";
export default {
components: {
InfoEditDialog,
......@@ -203,6 +209,12 @@ export default {
operates,
tabActive: "unPassed",
previewInfo: {},
searchParams: {}, //记录SearchForm中的搜索条件
//批量上传的参数
multiUploadOptions: {
bizType: "biz_cultural_relic", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填
uploadUrl: process.env.VUE_APP_BASE_API + "/bizImport/importZip", //上传的地址,必填
},
};
},
watch: {
......@@ -243,6 +255,8 @@ export default {
},
methods: {
async search(form) {
// 记录搜索的参数
this.searchParams = form;
this.resetPage();
this.loadData(form);
},
......@@ -250,7 +264,9 @@ export default {
resetPage() {
this.getCurrentList().current = 1;
},
// 重置
reset() {
this.searchParams = {};
this.loadData();
},
// 加载表格数据
......@@ -259,7 +275,6 @@ export default {
var params = {
page: current,
limit: size,
...form,
};
if (!params.level) {
delete params.level;
......@@ -267,6 +282,10 @@ export default {
if (params.status == "") {
delete params.status;
}
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
const currentRequest = this.getCurrentRequest();
const res = await currentRequest(params);
if (res.code == 0) {
......@@ -342,7 +361,6 @@ export default {
case "multiAdd":
this.multiAdd();
break;
case "downloadTemplate":
this.handleDownloadTemplate();
break;
......@@ -381,6 +399,14 @@ export default {
return currentRequest;
},
getCurrentDeleteRequest() {
const currentRequest =
this.tabActive == "passed"
? deleteCultralRelic
: deleteCultralRelicTemp;
return currentRequest;
},
async edit(row) {
const { crId } = row;
let detailRes = await getRCDetailByIdTemp({ crId });
......@@ -390,7 +416,8 @@ export default {
}
},
async deleteRow(row) {
let deleteRes = await deleteCultralRelic([row.crId]);
const request = this.getCurrentDeleteRequest();
let deleteRes = await request([row.crId]);
if (deleteRes.code == 0) {
this.$message.success("删除成功!");
this.loadData();
......@@ -405,13 +432,9 @@ export default {
//下载批量导入模板
handleDownloadTemplate() {
this.loading = true;
let a = document.createElement("a");
a.href = "/files/zip/crImportTemplate.zip";
a.download = "文物导入模板及操作说明.zip";
a.style.display = "none";
document.body.appendChild(a);
a.click();
a.remove();
const href = "/files/zip/crImportTemplate.zip";
const dowmloadName = "文物导入模板及操作说明.zip";
downloadFile(href, dowmloadName);
this.loading = false;
},
......@@ -421,7 +444,6 @@ export default {
},
// 预览图片
handelPreviewImages(images) {
// debugger
this.imgViewerVisible = true;
this.imgList = [images];
},
......
......@@ -123,7 +123,6 @@ export default {
return (Number(fileSize) / 1024 / 1024).toFixed(2) + "M";
};
},
isToday(time) {
return (time) => {
if (time) {
......@@ -145,10 +144,6 @@ export default {
current: 1,
total: 0,
},
searchForm: {
name: "",
status: "",
},
searchConfig: [
{
prop: "createTime",
......
......@@ -400,6 +400,11 @@ export default {
type: Array,
default: () => [],
},
// 流程id,重传时需要
flowId: {
type: String,
default: "",
},
},
computed: {
...mapGetters(["userInfo", "dicts"]),
......
......@@ -270,6 +270,10 @@ const submit = (submitFlag, $el) => {
...formUploaded,
exhibitionUnits: unitsUploaded,
};
// 重传时需要加入flowId
if ($el.flowId) {
params.flowId = $el.flowId;
}
// 删除一些需要删除的字段
needDelete.forEach(key => {
delete params[key]
......@@ -286,7 +290,6 @@ const submit = (submitFlag, $el) => {
$el.submitLoading = false;
$el.$message.success("提交成功!");
$el.visible = false;
// TODO:删除文件
handleDeleteFiles(removedIds)
}, 1000);
}
......
......@@ -135,7 +135,7 @@
/>
<UploadDialog
ref="UploadDialog"
bizType="biz_exhibition"
:options="multiUploadOptions"
@update="loadData"
/>
......@@ -231,7 +231,6 @@ export default {
displayTypes: {},
currentPageIds: [], //当前的id数组,用于给详情页切换用
multiUploadVisible: false, //控制批量上传弹窗显示
importRecordVisible: false, //上传记录
filesList: [], //上传当中的文件队列
uploadCount: 0, //处于上传中的文件数量,当等于fileList的时候就关闭弹窗,请求完毕一个就++
cancelUploadArr: [], //保存每个文件上传接口对应的取消请求的函数[fn,fn,fn...]
......@@ -241,6 +240,12 @@ export default {
unPassedTitle,
operates,
curPreview: {}, //当前预览的对象
searchParams: {}, //记录SearchForm中的搜索条件
//批量上传的参数
multiUploadOptions: {
bizType: "biz_exhibition", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填
uploadUrl: process.env.VUE_APP_BASE_API + "/bizImport/importZip", //上传的地址,必填
},
};
},
computed: {
......@@ -331,12 +336,27 @@ export default {
this.tabActive == "passed" ? getListPer : getListPerTemp;
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) {
// 记录搜索的参数
this.searchParams = form;
this.resetPage();
this.loadData(form);
},
reset() {
this.searchParams = {};
this.loadData();
},
......@@ -346,19 +366,22 @@ export default {
var params = {
page: this.list.current,
limit: this.list.size,
...form,
};
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
const currentRequest = this.getCurrentRequest();
const res = await currentRequest(params);
if (res.code == 0) {
this.setList(res.data);
}
},
// 操作
handleOperation(value, row) {
switch (value.type) {
case "add":
this.openDialog("InfoEditDialog");
this.$appCommon.openDialog(this, "InfoEditDialog");
case "view":
this.handleView(row);
break;
......@@ -369,19 +392,16 @@ export default {
this.handleDelete(row);
break;
case "multiAdd":
this.openDialog("UploadDialog");
this.$appCommon.openDialog(this, "UploadDialog");
break;
case "downloadTemplate":
this.handleDownloadTemplate();
break;
case "viewImportRecord":
this.importRecordVisible = true;
this.$appCommon.openDialog(this, "ImportRecordDialog");
break;
}
},
openDialog(refName) {
this.$refs[refName].visible = true;
},
// 预览展览
async handleView(row) {
......@@ -396,19 +416,13 @@ export default {
});
if (res.data) {
this.curPreview = res.data;
this.openDialog("PreviewDialog");
this.$appCommon.openDialog(this, "PreviewDialog");
} else {
this.$message.error("暂无数据!");
}
}
},
getCurrentPreviewRequest() {
const currentRequest =
this.tabActive == "passed" ? getDisplayById : getDisplayByIdTemp;
return currentRequest;
},
// 编辑展览
async handleEdit(row) {
let editRes = await getDisplayByIdTemp({
......@@ -420,13 +434,8 @@ export default {
// 删除展览
async handleDelete(row) {
let request;
if (this.tabActive == "unPassed") {
request = deleteDisplayTemp;
} else {
request = deleteDisplay;
}
let deleteRes = await request([row.exhibitionId]);
const request = this.getCurrentDeleteRequest();
const deleteRes = await request([row.exhibitionId]);
if (deleteRes.code === 0) {
this.loadData();
this.$message.success("删除成功!");
......
......@@ -58,12 +58,12 @@
ref="displayInfo"
:form="resubmitDisplayInfo"
@refresh="loadData"
:flowId="currentFlowId"
/>
<UploadDialog
ref="UploadDialog"
@update="loadData"
:title="currentFlowTitle"
:flowId="currentFlowId"
:options="resubmitOptions"
/>
</div>
</template>
......@@ -108,7 +108,7 @@ export default {
current: 1,
total: 0,
},
searchParams: "",
searchParams: {}, //记录SearchForm中的搜索条件
searchConfig: [
{
prop: "title",
......@@ -167,7 +167,12 @@ export default {
resubmitDisplayInfo: {}, //重传的手动添加的展览信息
resubmitCrMulti: {}, //重传的批量导入的文物信息
resubmitDisplayMulti: {}, //重传的整量导入的展览信息
currentFlowTitle: "", //当前重传的流程的title
resubmitOptions: {
recordsTitle: "", //上传时的记录标题,非必填
bizType: "", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填
uploadUrl: process.env.VUE_APP_BASE_API + "/bizImport/importZip", //上传的地址,必填
flowId: "", //流程ID,重传时需要,非必填
},
};
},
computed: {
......@@ -189,33 +194,47 @@ export default {
},
},
async created() {
await this.$store.dispatch("dict/getDictList", ["displayType"]);
this.loadData();
},
methods: {
// 搜索
async search(form) {
// 记录搜索的参数
this.searchParams = form;
// 重置分页到第一页
this.resetPage();
this.loadData(form);
},
// 重置
reset() {
this.searchParams = {};
this.loadData();
},
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
// 加载数据
async loadData(form) {
this.loading = true;
const params = {
let params = {
page: this.list.current,
limit: this.list.size,
...form,
};
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
let res = await getFlowListPagePer(params);
if (res.code == 0) {
this.list = res.data;
}
this.loading = false;
},
// 表格操作
handleOperation(value, row) {
const { type } = value;
const { type, id } = value;
this.currentFlowId = id;
if (type == "view" || type == "approval") {
this.viewOrApproval(type, row);
} else {
......@@ -239,27 +258,28 @@ export default {
async resubmit(row) {
const { addWay, sourceType, id, title } = row;
const isManual = addWay == "手动添加";
this.currentFlowId = id;
this.resubmitOptions.flowId = id;
switch (sourceType) {
case "文物":
if (isManual) {
const data = await this.getSourceDetail(this.currentFlowId);
const data = await this.getSourceDetail(id);
this.resubmitCrInfo = data;
this.openResubmitDialog("CrInfo");
this.$appCommon.openDialog(this, "CrInfo");
} else {
this.currentFlowTitle = title;
this.openResubmitDialog("UploadDialog");
this.resubmitOptions.recordsTitle = title;
this.resubmitOptions.bizType = "biz_cultural_relic";
this.$appCommon.openDialog(this, "UploadDialog");
}
break;
case "展览展示":
if (isManual) {
const data = await this.getSourceDetail(this.currentFlowId);
const data = await this.getSourceDetail(id);
this.resubmitDisplayInfo = data;
this.openResubmitDialog("DisplayInfo");
this.resubmitOptions.bizType = "biz_exhibition";
this.$appCommon.openDialog(this, "DisplayInfo");
} else {
this.currentFlowTitle = title;
this.openResubmitDialog("UploadDialog");
this.resubmitOptions.recordsTitle = title;
this.$appCommon.openDialog(this, "UploadDialog");
}
break;
}
......@@ -283,16 +303,6 @@ export default {
});
},
// 打开文物编辑重传弹窗
openResubmitDialog(name) {
this.$refs[name].visible = true;
},
// 关闭文物编辑重传弹窗
closeResubmitDialog(name) {
this.$refs[name].visible = false;
},
// 多选
handleSelectionChange(val) {
this.multipleSelection = val;
......
......@@ -65,7 +65,7 @@ import { title, operates, operations } from "./config";
import { editLiterature, deleteLt } from "@/api/literature";
import InfoEditDialog from "./components/InfoEditDialog";
import { downloadFile, previewFile, downloadBlob } from "@/utils/file";
import { mapActions } from "vuex";
export default {
components: {
InfoEditDialog,
......@@ -119,6 +119,7 @@ export default {
remark: "", //备注
},
loading: false,
searchParams: {},
};
},
......@@ -146,89 +147,102 @@ export default {
this.loadData();
},
methods: {
...mapActions("dict", ["getLtList"]),
// 搜索
async search(form) {
this.loading = true;
var params = {
page: this.list.current,
limit: this.list.size,
...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;
// 记录搜索的参数
this.searchParams = form;
// 重置分页到第一页
this.resetPage();
this.loadData(form);
},
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
// 重置
reset() {
this.searchParams = {};
this.loadData();
},
// 加载表格数据
async loadData() {
// 加载表格数据
async loadData(form) {
this.loading = true;
var params = {
page: this.list.current,
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) {
this.list = res.data;
}
this.loading = false;
},
async handleOperation(value, row) {
handleOperation(value, row) {
switch (value.type) {
case "add":
this.drawerVisible = true;
break;
case "view":
if (row.files && row.files.length > 0 && row.files[0].url) {
previewFile(row.files[0].url, row.name);
} else {
let m = this.$message.info("暂无文献附件!");
setTimeout(() => {
m.close();
}, 1500);
}
this.view(row);
break;
case "download":
if (row.files && row.files.length > 0 && row.files[0].url) {
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);
}
this.download(row);
break;
case "edit":
this.form = row;
this.drawerVisible = true;
break;
case "delete":
let deleteRes = await deleteLt([row.literatureId]);
if (deleteRes.code == 0) {
this.$message.success("删除成功!");
this.loadData();
}
this.handleDelete();
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) {
const callback = this.loadData;
this.$bizCommon.changeStatus(row, editLiterature, callback);
......
......@@ -153,6 +153,7 @@ export default {
},
],
loading: false,
searchParams: {},
};
},
......@@ -177,41 +178,35 @@ export default {
this.loadData();
},
methods: {
// 搜索
async search(form) {
this.loading = true;
this.list.current = 1;
var params = {
page: this.list.current,
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;
// 记录搜索的参数
this.searchParams = form;
this.resetPage();
this.loadData(form);
},
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
// 重置
reset() {
this.searchParams = {};
this.loadData();
},
// 加载表格数据
async loadData() {
// 加载表格数据
async loadData(form) {
this.loading = true;
var params = {
page: this.list.current,
limit: this.list.size,
};
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
let res = await getLogList(params);
if (res.code == 0) {
this.list = res.data;
......@@ -246,6 +241,6 @@ export default {
}
::v-deep .el-form-item {
margin-bottom: 20px;
margin-bottom: 20px !important;
}
</style>
......@@ -8,14 +8,6 @@
/>
<div class="tools">
<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">
<PermissionButton
button
......@@ -27,10 +19,8 @@
上传<i class="el-icon-arrow-down el-icon--right"></i>
</PermissionButton>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command=".jpg,.jpeg,.png"
>上传图片</el-dropdown-item
>
<el-dropdown-item command=".zip">上传压缩包</el-dropdown-item>
<el-dropdown-item :command="TYPE_IMG">上传图片</el-dropdown-item>
<el-dropdown-item :command="TYPE_ZIP">上传压缩包</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
......@@ -72,9 +62,8 @@
</el-pagination>
<UploadDialog
ref="UploadDialog"
bizType="biz_matting"
@update="loadData"
:fileType="currentUploadType"
:options="uploadOptions"
/>
<PreviewDialog ref="PreviewDialog" :detail="currentPreviewItem" />
</div>
......@@ -92,6 +81,7 @@ import { operates, operations, tableTitle, searchConfig } from "./configs/list";
import { records } from "./mock";
import UploadDialog from "@/components/UploadDialog";
import PreviewDialog from "./components/PreviewDialog";
import { getMattingList } from "@/api/matting";
export default {
components: {
UploadDialog,
......@@ -100,7 +90,7 @@ export default {
data() {
return {
list: {
records,
records: [],
size: 10,
current: 1,
total: 0,
......@@ -115,6 +105,16 @@ export default {
tableTitle,
currentUploadType: ".zip", //当前上传的文件类型
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() {
......@@ -122,6 +122,7 @@ export default {
},
methods: {
async search(form) {
this.searchParams = form;
this.resetPage();
this.loadData(form);
},
......@@ -130,23 +131,27 @@ export default {
this.list.current = 1;
},
reset() {
this.searchParams = {};
this.loadData();
},
// 加载表格数据
async loadData(form) {
// const { current, size } = this.list;
// var params = {
// page: current,
// limit: size,
// ...form,
// };
// const res = await currentRequest(params);
// if (res.code == 0) {
// this.setList(res.data);
// }
const { current, size } = this.list;
var params = {
page: current,
limit: size,
};
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
const res = await getMattingList(params);
if (res.code == 0) {
this.list = res.data;
}
},
handleCommand(type) {
this.currentUploadType = type;
this.uploadOptions.compressFlag = type;
this.openDialog("UploadDialog");
},
......
......@@ -98,10 +98,6 @@ export default {
current: 1,
total: 0,
},
searchForm: {
name: "",
status: "",
},
searchConfig: [
{
prop: "title",
......@@ -137,6 +133,7 @@ export default {
orgTreeData: [],
imgViewerVisible: false,
imgList: [],
searchParams: {}, //记录SearchForm中的搜索条件
};
},
computed: {
......@@ -165,31 +162,33 @@ export default {
},
methods: {
async search(form) {
var params = {
page: this.list.current,
limit: this.list.size,
...form,
};
if (params.status == "") {
delete params.status;
}
let res = await getCcProduct(params);
if (res.code == 0) {
this.list = res.data;
}
// 记录搜索的参数
this.searchParams = form;
this.resetPage();
this.loadData(form);
},
reset() {
this.searchParams = {};
this.loadData();
},
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
// 加载表格数据
async loadData() {
async loadData(form) {
this.loading = true;
var params = {
page: this.list.current,
limit: this.list.size,
};
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
let res = await getCcProduct(params);
if (res.code == 0) {
this.list = res.data;
......
......@@ -122,6 +122,7 @@ export default {
dataScopeForm: {}, //编辑数据权限的表单
dataEditDialog: false, //编辑数据的对话框
loading: false,
searchParams: {}, //记录SearchForm中的搜索条件
};
},
......@@ -150,33 +151,32 @@ export default {
this.loadData();
},
methods: {
// 搜索
async search(form) {
this.loading = true;
var params = {
page: this.list.current,
limit: this.list.size,
...form,
};
if (params.status == "") {
delete params.status;
}
const res = await getRoleList(params);
if (res.code == 0) {
this.list = res.data;
}
this.loading = false;
// 记录搜索的参数
this.searchParams = form;
this.resetPage();
this.loadData(form);
},
// 重置
reset() {
this.searchParams = {};
this.loadData();
},
// 加载表格数据
async loadData() {
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
// 加载表格数据
async loadData(form) {
var params = {
page: this.list.current,
limit: this.list.size,
};
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
const res = await getRoleList(params);
if (res.code == 0) {
this.list = res.data;
......@@ -192,10 +192,7 @@ export default {
};
break;
case "edit":
const { id } = row;
let res = await getRoleById(id);
this.form = res.data;
this.drawerVisible = true;
this.edit();
break;
case "delete":
let deleteRes = await deleteRole(row.id);
......@@ -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) {
const callback = this.loadData;
this.$bizCommon.changeStatus(row, upadateRole, callback);
......
......@@ -170,6 +170,7 @@ export default {
currentRoleData: {},
currentId: null,
loading: false,
searchParams: {},
};
},
mounted() {
......@@ -186,33 +187,37 @@ export default {
}
},
// 加载表格数据
async loadData() {
async loadData(form) {
this.loading = true;
var params = {
page: this.list.current,
limit: this.list.size,
deptNo: this.currentDeptNo,
};
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
const res = await getUserList(params);
if (res.code == 0) {
this.list = res.data;
}
this.loading = false;
},
// 搜索
async search(form) {
var params = {
page: this.list.current,
limit: this.list.size,
deptNo: this.currentDeptNo,
...form,
};
const res = await getUserList(params);
if (res.code == 0) {
this.list = res.data;
}
// 记录搜索的参数
this.searchParams = form;
this.resetPage();
this.loadData(form);
},
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
// 重置
reset() {
this.searchParams = {};
this.loadData();
},
......
......@@ -133,6 +133,7 @@ export default {
orgTreeData: [],
imgViewerVisible: false,
imgList: [],
searchParams: {},
};
},
computed: {
......@@ -161,34 +162,33 @@ export default {
},
methods: {
async search(form) {
this.loading = true;
var params = {
page: this.list.current,
limit: this.list.size,
...form,
};
if (params.status == "") {
delete params.status;
}
let res = await getVirtualListPer(params);
if (res.code == 0) {
this.list = res.data;
}
this.loading = false;
// 记录搜索的参数
this.searchParams = form;
this.resetPage();
this.loadData(form);
},
// 重置
reset() {
this.searchParams = {};
this.loadData();
},
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
// 加载表格数据
async loadData() {
async loadData(form) {
this.loading = true;
var params = {
page: this.list.current,
limit: this.list.size,
};
const queryParams = form || this.searchParams;
if (Object.keys(queryParams)) {
params = { ...params, ...queryParams };
}
let res = await getVirtualListPer(params);
if (res.code == 0) {
this.list = res.data;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论