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

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

上级 96d55cfe
......@@ -9,7 +9,6 @@
empty-text="暂无数据"
:highlight-current-row="true"
@selection-change="handleSelectionChange"
@current-change="handleCurrentChange"
v-bind="$attrs"
>
<el-table-column v-if="needExpand" type="expand">
......@@ -18,7 +17,12 @@
<slot name="expand" :scope="scope.$index"></slot>
</template>
</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>
<el-table-column
......@@ -109,42 +113,51 @@
export default {
name: "TablePage",
props: {
// 表格数据
data: {
type: Array,
default: () => [],
},
// 表头项
tableTitle: {
type: Array,
default: () => [],
},
// 操作项
operates: {
type: Object,
default: () => ({}),
},
hasSelection: {
type: Boolean,
default: false,
},
// 是否需要多选框
hasMultiSelection: {
type: Boolean,
default: false,
},
// 是否需要展开
needExpand: {
type: Boolean,
default: false,
},
// 获取多选中的可被选择项目
selectableFuction: {
type: Function,
},
},
// 继承所有父组件的内容
inheritAttrs: true,
methods: {
// 多选操作
handleSelectionChange(val) {
if (this.hasMultiSelection) {
this.$emit("handleSelectionChange", val);
}
},
handleCurrentChange(val) {
if (this.hasSelection) {
this.$emit("handleCurrentChange", val);
// 获取多选中的可被选择项目,true则可被选择
getSelectableData(row, rowIndex) {
if (this.selectableFuction) {
return this.selectableFuction(row, rowIndex);
} else {
return true;
}
},
},
......
......@@ -20,6 +20,20 @@ const bizCommon = {
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
\ No newline at end of file
import perms from './perms'
// 文物分页的配置
export const passedTitle = [{
prop: "name",
......@@ -38,12 +39,12 @@ export const passedTitle = [{
// columnAlign: 'center',
// },
{
prop: "deptName",
label: "馆藏单位",
columnAlign: 'center',
showOverFlowToolTip: true,
},
// {
// prop: "deptName",
// label: "馆藏单位",
// columnAlign: 'center',
// showOverFlowToolTip: true,
// },
// {
// prop: "regionName",
// label: "所属地",
......@@ -101,18 +102,18 @@ export const passedTitle = [{
columnAlign: 'center', sortable: true
},
{
prop: "sourceWay",
label: "来源方式",
columnAlign: 'center',
showOverFlowToolTip: true,
},
// {
// prop: "sourceWay",
// label: "来源方式",
// columnAlign: 'center',
// showOverFlowToolTip: true,
// },
{
prop: "remark",
label: "备注",
columnAlign: 'center',
},
// {
// prop: "remark",
// label: "备注",
// columnAlign: 'center',
// },
// directory 文件夹
......@@ -232,12 +233,6 @@ export const unPassedTitle = [{
label: "审核状态",
columnAlign: 'center',
},
{
prop: "checkRemark",
label: "审核意见",
columnAlign: 'center',
showOverFlowToolTip: true,
},
{
prop: "remark",
label: "备注",
......@@ -255,36 +250,45 @@ export const operates = {
label: "操作",
titleAlign: "center",
columnAlign: "center",
width: "260px",
width: "240px",
}
// 预览按钮
export const previewButton = {
type: 'view',
title: '详情',
perms: 'bizCulturalRelic:list'
perms: perms.detail
}
// 编辑按钮
export const editButton = {
type: 'edit',
title: '编辑',
perms: 'bizCulturalRelic:update'
perms: perms.update
}
// 编辑禁用按钮
// 删除禁用按钮
export const deleteDisabledButton = {
type: 'delete',
title: '删除',
perms: perms.delete,
disabled: true
}
// 更新禁用按钮
export const editDisabledButton = {
type: 'edit',
title: '编辑',
perms: 'bizCulturalRelic:update',
perms: perms.update,
disabled: true
}
// 编辑按钮
// 删除按钮
export const deleteButton = {
type: 'delete',
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 @@
/>
<div class="tools">
<div class="tools-item">
<el-button
<PermissionButton
button
size="mini"
type="primary"
@click.native="handleOperation({ type: 'downloadTemplate' })"
icon="el-icon-download"
:disabled="loading"
:perms="perms.add"
style="margin-right: 16px"
>
下载导入模板</el-button
下载导入模板</PermissionButton
>
<el-button
<PermissionButton
button
size="mini"
type="primary"
@click.native="handleOperation({ type: 'viewImportRecord' })"
icon="el-icon-document"
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 class="tools-item">
<el-button
<PermissionButton
button
size="mini"
type="primary"
@click.native="handleOperation({ type: 'add' })"
icon="el-icon-plus"
:perms="perms.add"
style="margin-right: 16px"
>
添加</el-button
添加</PermissionButton
>
<el-button
<PermissionButton
button
:perms="perms.add"
size="mini"
type="success"
@click.native="handleOperation({ type: 'multiAdd' })"
icon="el-icon-upload"
>
批量导入</el-button
批量导入</PermissionButton
>
</div>
</div>
......@@ -56,6 +80,9 @@
:data="getCurrentList().records"
:tableTitle="getTitle"
:operates="operates"
:selectableFuction="selectableFuction"
hasMultiSelection
@handleSelectionChange="handleSelectionChange"
>
<template v-slot:sourceWay="{ scope }">
<DictText
......@@ -88,12 +115,7 @@
<img
:src="$getFullUrl(scope.faceImagePressUrl || scope.faceImageUrl)"
alt="暂无图片"
style="
cursor: pointer;
width: 80px;
height: 80px;
object-fit: contain;
"
style="cursor: pointer; height: 50px; object-fit: contain"
@click="handelPreviewImages(scope.faceImageUrl)"
/>
</template>
......@@ -153,8 +175,10 @@ import {
editButton,
deleteButton,
editDisabledButton,
deleteDisabledButton,
searchConfig,
} from "./configs/list";
import perms from "./configs/perms";
import {
getCulturalRelicListPerTemp,
getCulturalRelicListPer,
......@@ -182,6 +206,7 @@ export default {
},
data() {
return {
perms, //权限code,很重要
// (存放两份数据的目的是为了防止切换的时候分页被重置)
//最终表
list: {
......@@ -215,6 +240,7 @@ export default {
bizType: "biz_cultural_relic", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填
uploadUrl: process.env.VUE_APP_BASE_API + "/bizImport/importZip", //上传的地址,必填
},
multipleSelection: [], //批量选择的数组
};
},
watch: {
......@@ -222,6 +248,7 @@ export default {
tabActive(value) {
this.resetPage();
this.loadData();
this.multipleSelection = [];
},
},
computed: {
......@@ -239,16 +266,24 @@ export default {
},
getOperations(row) {
return (row) => {
const { checkStatus, batchNum } = row;
const isApprovaling = checkStatus == 0;
const isMultiAdd = batchNum && batchNum > 0;
if (this.tabActive == "passed") {
return [previewButton, deleteButton];
} else if (row.checkStatus == 0) {
// 审核中的禁用编辑
} else if (isApprovaling) {
// 审核中的禁用编辑和删除
return [previewButton, editDisabledButton, deleteDisabledButton];
} else if (isMultiAdd) {
return [previewButton, editDisabledButton, deleteButton];
} else {
return [previewButton, editButton, deleteButton];
}
};
},
isMultiDisabled() {
return this.multipleSelection.length === 0;
},
},
async created() {
this.loadData();
......@@ -319,33 +354,8 @@ export default {
async handleOperation(value, row) {
switch (value.type) {
case "add":
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;
this.add(row);
break;
case "view":
this.view(row);
break;
......@@ -367,8 +377,55 @@ export default {
case "viewImportRecord":
this.viewImport();
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) {
if (!row) {
return;
......
import perms from "./perms";
export const searchConfig = [
{
prop: "title",
......@@ -269,21 +270,21 @@ export const operates = {
export const previewButton = {
type: 'view',
title: '预览',
perms: 'bizCulturalRelic:list'
perms: perms.list
}
// 编辑按钮
export const editButton = {
type: 'edit',
title: '编辑',
perms: 'bizCulturalRelic:update'
perms: perms.update
}
// 编辑禁用按钮
export const editDisabledButton = {
type: 'edit',
title: '编辑',
perms: 'bizCulturalRelic:update',
perms: perms.update,
disabled: true
}
......@@ -291,38 +292,5 @@ export const editDisabledButton = {
export const deleteButton = {
type: 'delete',
title: '删除',
perms: 'bizCulturalRelic:delete'
}
// // 临时表
// 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'
// },
// ];
perms: perms.delete
}
\ No newline at end of file
// 权限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 @@
</div>
<div class="tools">
<div class="tools-item">
<el-button
<PermissionButton
button
:disabled="loading"
size="mini"
type="primary"
@click.native="handleOperation({ type: 'downloadTemplate' })"
icon="el-icon-download"
:perms="perms.add"
style="margin-right: 16px"
>
下载导入模板</el-button
下载导入模板</PermissionButton
>
<el-button
<PermissionButton
button
type="primary"
size="mini"
@click.native="handleOperation({ type: 'viewImportRecord' })"
icon="el-icon-document"
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 class="tools-item">
......@@ -33,7 +53,8 @@
size="mini"
@click.native="handleOperation({ type: 'add' })"
icon="el-icon-plus"
style="margin-right: 10px"
:perms="perms.add"
style="margin-right: 16px"
>添加</PermissionButton
>
<PermissionButton
......@@ -43,6 +64,8 @@
size="mini"
@click.native="handleOperation({ type: 'multiAdd' })"
icon="el-icon-upload"
:perms="perms.add"
style="margin-right: 16px"
>整量导入</PermissionButton
>
</div>
......@@ -56,6 +79,9 @@
:data="getCurrentList().records"
:tableTitle="getTitle"
:operates="operates"
hasMultiSelection
:selectableFuction="selectableFuction"
@handleSelectionChange="handleSelectionChange"
>
<template v-slot:status="{ scope }">
<el-popconfirm
......@@ -177,6 +203,7 @@ import { getToken } from "@/utils/auth";
import { importZip } from "@/utils/file";
import boutiqueTool from "@/utils/boutique";
import { searchConfig } from "./configs/list";
import perms from "./configs/perms";
export default {
components: {
InfoEditDialog,
......@@ -187,6 +214,7 @@ export default {
},
data() {
return {
perms,
// (存放两份数据的目的是为了防止切换的时候分页被重置)
//最终表
list: {
......@@ -246,6 +274,7 @@ export default {
bizType: "biz_exhibition", //业务类型,文物、展览等biz_cultural_relic——文物,biz_exhibition——展览,如果是文物和展览批量上传必填,抠图不用填
uploadUrl: process.env.VUE_APP_BASE_API + "/bizImport/importZip", //上传的地址,必填
},
multipleSelection: [],
};
},
computed: {
......@@ -283,6 +312,9 @@ export default {
getTitle() {
return this.tabActive == "passed" ? this.passedTitle : this.unPassedTitle;
},
isMultiDisabled() {
return this.multipleSelection.length === 0;
},
},
async created() {
......@@ -309,6 +341,7 @@ export default {
tabActive(value) {
this.resetPage();
this.loadData();
this.multipleSelection = [];
},
},
methods: {
......@@ -400,8 +433,28 @@ export default {
case "viewImportRecord":
this.$appCommon.openDialog(this, "ImportRecordDialog");
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) {
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论