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

文物和展览增加批量操作;文物修改批量导入且待审核的为不可编辑

上级 96d55cfe
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
empty-text="暂无数据" empty-text="暂无数据"
:highlight-current-row="true" :highlight-current-row="true"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
@current-change="handleCurrentChange"
v-bind="$attrs" v-bind="$attrs"
> >
<el-table-column v-if="needExpand" type="expand"> <el-table-column v-if="needExpand" type="expand">
...@@ -18,7 +17,12 @@ ...@@ -18,7 +17,12 @@
<slot name="expand" :scope="scope.$index"></slot> <slot name="expand" :scope="scope.$index"></slot>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="hasMultiSelection" type="selection" width="55" /> <el-table-column
v-if="hasMultiSelection"
:selectable="getSelectableData"
type="selection"
width="55"
/>
<el-table-column type="index" width="50" label="序号" align="center"> <el-table-column type="index" width="50" label="序号" align="center">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
...@@ -109,42 +113,51 @@ ...@@ -109,42 +113,51 @@
export default { export default {
name: "TablePage", name: "TablePage",
props: { props: {
// 表格数据
data: { data: {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
// 表头项
tableTitle: { tableTitle: {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
// 操作项
operates: { operates: {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
}, },
hasSelection: { // 是否需要多选框
type: Boolean,
default: false,
},
hasMultiSelection: { hasMultiSelection: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
// 是否需要展开
needExpand: { needExpand: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
// 获取多选中的可被选择项目
selectableFuction: {
type: Function,
},
}, },
// 继承所有父组件的内容 // 继承所有父组件的内容
inheritAttrs: true, inheritAttrs: true,
methods: { methods: {
// 多选操作
handleSelectionChange(val) { handleSelectionChange(val) {
if (this.hasMultiSelection) { if (this.hasMultiSelection) {
this.$emit("handleSelectionChange", val); this.$emit("handleSelectionChange", val);
} }
}, },
handleCurrentChange(val) { // 获取多选中的可被选择项目,true则可被选择
if (this.hasSelection) { getSelectableData(row, rowIndex) {
this.$emit("handleCurrentChange", val); if (this.selectableFuction) {
return this.selectableFuction(row, rowIndex);
} else {
return true;
} }
}, },
}, },
......
...@@ -20,6 +20,20 @@ const bizCommon = { ...@@ -20,6 +20,20 @@ const bizCommon = {
callback() callback()
} }
}, },
/**
* 业务中的批量删除
* @param {Promise} request 删除的请求
* @param {Array} ids 删除的id集合
* @param {Function} callback 回调函数,一般是loaddata
*/
async multiDelete(request, ids, callback) {
const params = ids
const res = await request(params)
if (res.code == 0) {
Message.success('删除成功!')
callback()
}
},
} }
export default bizCommon export default bizCommon
\ No newline at end of file
import perms from './perms'
// 文物分页的配置 // 文物分页的配置
export const passedTitle = [{ export const passedTitle = [{
prop: "name", prop: "name",
...@@ -38,12 +39,12 @@ export const passedTitle = [{ ...@@ -38,12 +39,12 @@ export const passedTitle = [{
// columnAlign: 'center', // columnAlign: 'center',
// }, // },
{ // {
prop: "deptName", // prop: "deptName",
label: "馆藏单位", // label: "馆藏单位",
columnAlign: 'center', // columnAlign: 'center',
showOverFlowToolTip: true, // showOverFlowToolTip: true,
}, // },
// { // {
// prop: "regionName", // prop: "regionName",
// label: "所属地", // label: "所属地",
...@@ -101,18 +102,18 @@ export const passedTitle = [{ ...@@ -101,18 +102,18 @@ export const passedTitle = [{
columnAlign: 'center', sortable: true columnAlign: 'center', sortable: true
}, },
{ // {
prop: "sourceWay", // prop: "sourceWay",
label: "来源方式", // label: "来源方式",
columnAlign: 'center', // columnAlign: 'center',
showOverFlowToolTip: true, // showOverFlowToolTip: true,
}, // },
{ // {
prop: "remark", // prop: "remark",
label: "备注", // label: "备注",
columnAlign: 'center', // columnAlign: 'center',
}, // },
// directory 文件夹 // directory 文件夹
...@@ -232,12 +233,6 @@ export const unPassedTitle = [{ ...@@ -232,12 +233,6 @@ export const unPassedTitle = [{
label: "审核状态", label: "审核状态",
columnAlign: 'center', columnAlign: 'center',
}, },
{
prop: "checkRemark",
label: "审核意见",
columnAlign: 'center',
showOverFlowToolTip: true,
},
{ {
prop: "remark", prop: "remark",
label: "备注", label: "备注",
...@@ -255,36 +250,45 @@ export const operates = { ...@@ -255,36 +250,45 @@ export const operates = {
label: "操作", label: "操作",
titleAlign: "center", titleAlign: "center",
columnAlign: "center", columnAlign: "center",
width: "260px", width: "240px",
} }
// 预览按钮 // 预览按钮
export const previewButton = { export const previewButton = {
type: 'view', type: 'view',
title: '详情', title: '详情',
perms: 'bizCulturalRelic:list' perms: perms.detail
} }
// 编辑按钮 // 编辑按钮
export const editButton = { export const editButton = {
type: 'edit', type: 'edit',
title: '编辑', title: '编辑',
perms: 'bizCulturalRelic:update' perms: perms.update
} }
// 编辑禁用按钮 // 删除禁用按钮
export const deleteDisabledButton = {
type: 'delete',
title: '删除',
perms: perms.delete,
disabled: true
}
// 更新禁用按钮
export const editDisabledButton = { export const editDisabledButton = {
type: 'edit', type: 'edit',
title: '编辑', title: '编辑',
perms: 'bizCulturalRelic:update', perms: perms.update,
disabled: true disabled: true
} }
// 编辑按钮 // 删除按钮
export const deleteButton = { export const deleteButton = {
type: 'delete', type: 'delete',
title: '删除', title: '删除',
perms: 'bizCulturalRelic:delete' perms: perms.delete
} }
......
// 权限code 请勿删除!!!
const perms = {
add: 'bizCulturalRelic:add',
update: 'bizCulturalRelic:update',
delete: 'bizCulturalRelic:delete',
list: 'bizCulturalRelic:list',
detail: 'bizCulturalRelic:detail',
}
export default perms
\ No newline at end of file
...@@ -8,42 +8,66 @@ ...@@ -8,42 +8,66 @@
/> />
<div class="tools"> <div class="tools">
<div class="tools-item"> <div class="tools-item">
<el-button <PermissionButton
button
size="mini" size="mini"
type="primary" type="primary"
@click.native="handleOperation({ type: 'downloadTemplate' })" @click.native="handleOperation({ type: 'downloadTemplate' })"
icon="el-icon-download" icon="el-icon-download"
:disabled="loading" :disabled="loading"
:perms="perms.add"
style="margin-right: 16px"
> >
下载导入模板</el-button 下载导入模板</PermissionButton
> >
<el-button <PermissionButton
button
size="mini" size="mini"
type="primary" type="primary"
@click.native="handleOperation({ type: 'viewImportRecord' })" @click.native="handleOperation({ type: 'viewImportRecord' })"
icon="el-icon-document" icon="el-icon-document"
plain plain
:perms="perms.add"
style="margin-right: 16px"
> >
查看导入记录</el-button 查看导入记录</PermissionButton
>
<PermissionButton
button
size="mini"
type="danger"
@click.native="handleOperation({ type: 'multiDelete' })"
icon="el-icon-delete"
plain
:perms="perms.delete"
:disabled="isMultiDisabled"
>
批量删除</PermissionButton
> >
</div> </div>
<div class="tools-item"> <div class="tools-item">
<el-button <PermissionButton
button
size="mini" size="mini"
type="primary" type="primary"
@click.native="handleOperation({ type: 'add' })" @click.native="handleOperation({ type: 'add' })"
icon="el-icon-plus" icon="el-icon-plus"
:perms="perms.add"
style="margin-right: 16px"
> >
添加</el-button 添加</PermissionButton
> >
<el-button <PermissionButton
button
:perms="perms.add"
size="mini" size="mini"
type="success" type="success"
@click.native="handleOperation({ type: 'multiAdd' })" @click.native="handleOperation({ type: 'multiAdd' })"
icon="el-icon-upload" icon="el-icon-upload"
> >
批量导入</el-button 批量导入</PermissionButton
> >
</div> </div>
</div> </div>
...@@ -56,6 +80,9 @@ ...@@ -56,6 +80,9 @@
:data="getCurrentList().records" :data="getCurrentList().records"
:tableTitle="getTitle" :tableTitle="getTitle"
:operates="operates" :operates="operates"
:selectableFuction="selectableFuction"
hasMultiSelection
@handleSelectionChange="handleSelectionChange"
> >
<template v-slot:sourceWay="{ scope }"> <template v-slot:sourceWay="{ scope }">
<DictText <DictText
...@@ -88,12 +115,7 @@ ...@@ -88,12 +115,7 @@
<img <img
:src="$getFullUrl(scope.faceImagePressUrl || scope.faceImageUrl)" :src="$getFullUrl(scope.faceImagePressUrl || scope.faceImageUrl)"
alt="暂无图片" alt="暂无图片"
style=" style="cursor: pointer; height: 50px; object-fit: contain"
cursor: pointer;
width: 80px;
height: 80px;
object-fit: contain;
"
@click="handelPreviewImages(scope.faceImageUrl)" @click="handelPreviewImages(scope.faceImageUrl)"
/> />
</template> </template>
...@@ -153,8 +175,10 @@ import { ...@@ -153,8 +175,10 @@ import {
editButton, editButton,
deleteButton, deleteButton,
editDisabledButton, editDisabledButton,
deleteDisabledButton,
searchConfig, searchConfig,
} from "./configs/list"; } from "./configs/list";
import perms from "./configs/perms";
import { import {
getCulturalRelicListPerTemp, getCulturalRelicListPerTemp,
getCulturalRelicListPer, getCulturalRelicListPer,
...@@ -182,6 +206,7 @@ export default { ...@@ -182,6 +206,7 @@ export default {
}, },
data() { data() {
return { return {
perms, //权限code,很重要
// (存放两份数据的目的是为了防止切换的时候分页被重置) // (存放两份数据的目的是为了防止切换的时候分页被重置)
//最终表 //最终表
list: { list: {
...@@ -215,6 +240,7 @@ export default { ...@@ -215,6 +240,7 @@ export default {
bizType: "biz_cultural_relic", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填 bizType: "biz_cultural_relic", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填
uploadUrl: process.env.VUE_APP_BASE_API + "/bizImport/importZip", //上传的地址,必填 uploadUrl: process.env.VUE_APP_BASE_API + "/bizImport/importZip", //上传的地址,必填
}, },
multipleSelection: [], //批量选择的数组
}; };
}, },
watch: { watch: {
...@@ -222,6 +248,7 @@ export default { ...@@ -222,6 +248,7 @@ export default {
tabActive(value) { tabActive(value) {
this.resetPage(); this.resetPage();
this.loadData(); this.loadData();
this.multipleSelection = [];
}, },
}, },
computed: { computed: {
...@@ -239,16 +266,24 @@ export default { ...@@ -239,16 +266,24 @@ export default {
}, },
getOperations(row) { getOperations(row) {
return (row) => { return (row) => {
const { checkStatus, batchNum } = row;
const isApprovaling = checkStatus == 0;
const isMultiAdd = batchNum && batchNum > 0;
if (this.tabActive == "passed") { if (this.tabActive == "passed") {
return [previewButton, deleteButton]; return [previewButton, deleteButton];
} else if (row.checkStatus == 0) { } else if (isApprovaling) {
// 审核中的禁用编辑 // 审核中的禁用编辑和删除
return [previewButton, editDisabledButton, deleteDisabledButton];
} else if (isMultiAdd) {
return [previewButton, editDisabledButton, deleteButton]; return [previewButton, editDisabledButton, deleteButton];
} else { } else {
return [previewButton, editButton, deleteButton]; return [previewButton, editButton, deleteButton];
} }
}; };
}, },
isMultiDisabled() {
return this.multipleSelection.length === 0;
},
}, },
async created() { async created() {
this.loadData(); this.loadData();
...@@ -319,33 +354,8 @@ export default { ...@@ -319,33 +354,8 @@ export default {
async handleOperation(value, row) { async handleOperation(value, row) {
switch (value.type) { switch (value.type) {
case "add": case "add":
this.form = { this.add(row);
name: "", //名称
type: "", //类别(字典值)
level: "", //文物级别(字典值)
textureType: "", //质地(字典值)
detailSize: "", // 具体尺寸
years: "", //年代
num: 1, //数量
deptId: "", //收藏馆id——新增传当前用户的deptId
intro: "", //馆藏介绍
literature: "", //关联文献。id1,id2,id3
// directory:'',// 文件夹(字母或者数字命名)
// regionCode:'',//所属地(分号分隔的编号)——传当前用户的regionCode
sourceWay: "", //来源方式
sayExplain: "", //讲解词文件。文件id
status: 1, //上下架状态(0-下架,1-上架)
// flag3d:'',//是否有3D图片(字典值:1-有;0-无)
themeWord: "", //主题词
url3d: "", //3durl链接
remark: "", //备注
audios: "", //音频文件(文件id)
images: "", //图片文件(文件id,多个以逗号隔开)
videos: "", //视频文件(文件id)
};
this.$refs.InfoEditDialog.visible = true;
break; break;
case "view": case "view":
this.view(row); this.view(row);
break; break;
...@@ -367,8 +377,55 @@ export default { ...@@ -367,8 +377,55 @@ export default {
case "viewImportRecord": case "viewImportRecord":
this.viewImport(); this.viewImport();
break; break;
case "multiDelete":
this.multiDelete();
break;
} }
}, },
add(row) {
this.form = {
name: "", //名称
type: "", //类别(字典值)
level: "", //文物级别(字典值)
textureType: "", //质地(字典值)
detailSize: "", // 具体尺寸
years: "", //年代
num: 1, //数量
deptId: "", //收藏馆id——新增传当前用户的deptId
intro: "", //馆藏介绍
literature: "", //关联文献。id1,id2,id3
// directory:'',// 文件夹(字母或者数字命名)
// regionCode:'',//所属地(分号分隔的编号)——传当前用户的regionCode
sourceWay: "", //来源方式
sayExplain: "", //讲解词文件。文件id
status: 1, //上下架状态(0-下架,1-上架)
// flag3d:'',//是否有3D图片(字典值:1-有;0-无)
themeWord: "", //主题词
url3d: "", //3durl链接
remark: "", //备注
audios: "", //音频文件(文件id)
images: "", //图片文件(文件id,多个以逗号隔开)
videos: "", //视频文件(文件id)
};
this.$refs.InfoEditDialog.visible = true;
},
// 获取多选中的可被选择项目,true则可被选择
selectableFuction(row, rowIndex) {
// 除了审核中的,其他状态都可以删除
const isApproval = 0;
if (row.checkStatus !== isApproval) {
return true;
}
},
// 批量删除
multiDelete() {
const ids = this.multipleSelection.map((item) => {
return item.crId;
});
const request = this.getCurrentDeleteRequest();
const callback = this.loadData;
this.$bizCommon.multiDelete(request, ids, callback);
},
async view(row) { async view(row) {
if (!row) { if (!row) {
return; return;
......
import perms from "./perms";
export const searchConfig = [ export const searchConfig = [
{ {
prop: "title", prop: "title",
...@@ -269,21 +270,21 @@ export const operates = { ...@@ -269,21 +270,21 @@ export const operates = {
export const previewButton = { export const previewButton = {
type: 'view', type: 'view',
title: '预览', title: '预览',
perms: 'bizCulturalRelic:list' perms: perms.list
} }
// 编辑按钮 // 编辑按钮
export const editButton = { export const editButton = {
type: 'edit', type: 'edit',
title: '编辑', title: '编辑',
perms: 'bizCulturalRelic:update' perms: perms.update
} }
// 编辑禁用按钮 // 编辑禁用按钮
export const editDisabledButton = { export const editDisabledButton = {
type: 'edit', type: 'edit',
title: '编辑', title: '编辑',
perms: 'bizCulturalRelic:update', perms: perms.update,
disabled: true disabled: true
} }
...@@ -291,38 +292,5 @@ export const editDisabledButton = { ...@@ -291,38 +292,5 @@ export const editDisabledButton = {
export const deleteButton = { export const deleteButton = {
type: 'delete', type: 'delete',
title: '删除', title: '删除',
perms: 'bizCulturalRelic:delete' perms: perms.delete
} }
\ No newline at end of file
// // 临时表
// export const operationsTemp = [
// // {
// // type: "view",
// // title: "预览",
// // perms: "bizExhibition:list"
// // },
// {
// type: "edit",
// title: "编辑",
// perms: 'bizExhibition:update'
// },
// {
// type: "delete",
// title: "删除",
// perms: 'bizExhibition:delete'
// },
// ];
// // 最终表
// export const operations = [
// // {
// // type: "edit",
// // title: "编辑",
// // perms: 'bizExhibition:update'
// // },
// {
// type: "delete",
// title: "删除",
// perms: 'bizExhibition:delete'
// },
// ];
// 权限code 请勿删除!!!
const perms = {
add: 'bizExhibition:add',
update: 'bizExhibition:update',
delete: 'bizExhibition:delete',
list: 'bizExhibition:list',
}
export default perms
\ No newline at end of file
...@@ -5,24 +5,44 @@ ...@@ -5,24 +5,44 @@
</div> </div>
<div class="tools"> <div class="tools">
<div class="tools-item"> <div class="tools-item">
<el-button <PermissionButton
button
:disabled="loading" :disabled="loading"
size="mini" size="mini"
type="primary" type="primary"
@click.native="handleOperation({ type: 'downloadTemplate' })" @click.native="handleOperation({ type: 'downloadTemplate' })"
icon="el-icon-download" icon="el-icon-download"
:perms="perms.add"
style="margin-right: 16px"
> >
下载导入模板</el-button 下载导入模板</PermissionButton
> >
<el-button <PermissionButton
button
type="primary" type="primary"
size="mini" size="mini"
@click.native="handleOperation({ type: 'viewImportRecord' })" @click.native="handleOperation({ type: 'viewImportRecord' })"
icon="el-icon-document" icon="el-icon-document"
plain plain
:perms="perms.add"
style="margin-right: 16px"
>
查看导入记录</PermissionButton
> >
查看导入记录</el-button
<PermissionButton
button
type="danger"
size="mini"
@click.native="handleOperation({ type: 'multiDelete' })"
icon="el-icon-delete"
plain
:perms="perms.delete"
style="margin-right: 16px"
:disabled="isMultiDisabled"
>
批量删除</PermissionButton
> >
</div> </div>
<div class="tools-item"> <div class="tools-item">
...@@ -33,7 +53,8 @@ ...@@ -33,7 +53,8 @@
size="mini" size="mini"
@click.native="handleOperation({ type: 'add' })" @click.native="handleOperation({ type: 'add' })"
icon="el-icon-plus" icon="el-icon-plus"
style="margin-right: 10px" :perms="perms.add"
style="margin-right: 16px"
>添加</PermissionButton >添加</PermissionButton
> >
<PermissionButton <PermissionButton
...@@ -43,6 +64,8 @@ ...@@ -43,6 +64,8 @@
size="mini" size="mini"
@click.native="handleOperation({ type: 'multiAdd' })" @click.native="handleOperation({ type: 'multiAdd' })"
icon="el-icon-upload" icon="el-icon-upload"
:perms="perms.add"
style="margin-right: 16px"
>整量导入</PermissionButton >整量导入</PermissionButton
> >
</div> </div>
...@@ -56,6 +79,9 @@ ...@@ -56,6 +79,9 @@
:data="getCurrentList().records" :data="getCurrentList().records"
:tableTitle="getTitle" :tableTitle="getTitle"
:operates="operates" :operates="operates"
hasMultiSelection
:selectableFuction="selectableFuction"
@handleSelectionChange="handleSelectionChange"
> >
<template v-slot:status="{ scope }"> <template v-slot:status="{ scope }">
<el-popconfirm <el-popconfirm
...@@ -177,6 +203,7 @@ import { getToken } from "@/utils/auth"; ...@@ -177,6 +203,7 @@ import { getToken } from "@/utils/auth";
import { importZip } from "@/utils/file"; import { importZip } from "@/utils/file";
import boutiqueTool from "@/utils/boutique"; import boutiqueTool from "@/utils/boutique";
import { searchConfig } from "./configs/list"; import { searchConfig } from "./configs/list";
import perms from "./configs/perms";
export default { export default {
components: { components: {
InfoEditDialog, InfoEditDialog,
...@@ -187,6 +214,7 @@ export default { ...@@ -187,6 +214,7 @@ export default {
}, },
data() { data() {
return { return {
perms,
// (存放两份数据的目的是为了防止切换的时候分页被重置) // (存放两份数据的目的是为了防止切换的时候分页被重置)
//最终表 //最终表
list: { list: {
...@@ -246,6 +274,7 @@ export default { ...@@ -246,6 +274,7 @@ export default {
bizType: "biz_exhibition", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填 bizType: "biz_exhibition", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填
uploadUrl: process.env.VUE_APP_BASE_API + "/bizImport/importZip", //上传的地址,必填 uploadUrl: process.env.VUE_APP_BASE_API + "/bizImport/importZip", //上传的地址,必填
}, },
multipleSelection: [],
}; };
}, },
computed: { computed: {
...@@ -283,6 +312,9 @@ export default { ...@@ -283,6 +312,9 @@ export default {
getTitle() { getTitle() {
return this.tabActive == "passed" ? this.passedTitle : this.unPassedTitle; return this.tabActive == "passed" ? this.passedTitle : this.unPassedTitle;
}, },
isMultiDisabled() {
return this.multipleSelection.length === 0;
},
}, },
async created() { async created() {
...@@ -309,6 +341,7 @@ export default { ...@@ -309,6 +341,7 @@ export default {
tabActive(value) { tabActive(value) {
this.resetPage(); this.resetPage();
this.loadData(); this.loadData();
this.multipleSelection = [];
}, },
}, },
methods: { methods: {
...@@ -400,8 +433,28 @@ export default { ...@@ -400,8 +433,28 @@ export default {
case "viewImportRecord": case "viewImportRecord":
this.$appCommon.openDialog(this, "ImportRecordDialog"); this.$appCommon.openDialog(this, "ImportRecordDialog");
break; break;
case "multiDelete":
this.multiDelete();
break;
}
},
// 获取多选中的可被选择项目,true则可被选择
selectableFuction(row, rowIndex) {
// 除了审核中的,其他状态都可以删除
const isApproval = 0;
if (row.checkStatus !== isApproval) {
return true;
} }
}, },
// 批量删除
multiDelete() {
const ids = this.multipleSelection.map((item) => {
return item.exhibitionId;
});
const request = this.getCurrentDeleteRequest();
const callback = this.loadData;
this.$bizCommon.multiDelete(request, ids, callback);
},
// 预览展览 // 预览展览
async handleView(row) { async handleView(row) {
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论