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

优化代码

上级 38ec8a91
...@@ -69,11 +69,11 @@ export function getDisplayById(params) { ...@@ -69,11 +69,11 @@ export function getDisplayById(params) {
} }
// 修改展览(临时表) // 修改展览(临时表)
export function getDisplayByIdTemp(data) { export function getDisplayByIdTemp(params) {
return request({ return request({
url: '/bizExhibitionTemp/detailById', url: '/bizExhibitionTemp/detailById',
method: 'post', method: 'get',
data params
}) })
} }
......
...@@ -40,39 +40,3 @@ export function deleteLt(data) { ...@@ -40,39 +40,3 @@ export function deleteLt(data) {
}) })
} }
// 文创产品api
// 获取文创列表
export function getCcProduct(data) {
return request({
url: '/bizCcProducts/listByPagePer',
method: 'post',
data
})
}
// 新增文创
export function addCcProduct(data) {
return request({
url: '/bizCcProducts/add',
method: 'post',
data
})
}
// 更新文创
export function updateCcProduct(data) {
return request({
url: '/bizCcProducts/update',
method: 'put',
data
})
}
// 删除文创
export function deleteCcProduct(data) {
return request({
url: '/bizCcProducts/delete',
method: 'delete',
data
})
}
// 文创产品api
import request from '@/utils/request'
// 获取文创列表
export function getCcProduct(data) {
return request({
url: '/bizCcProducts/listByPagePer',
method: 'post',
data
})
}
// 新增文创
export function addCcProduct(data) {
return request({
url: '/bizCcProducts/add',
method: 'post',
data
})
}
// 更新文创
export function updateCcProduct(data) {
return request({
url: '/bizCcProducts/update',
method: 'put',
data
})
}
// 删除文创
export function deleteCcProduct(data) {
return request({
url: '/bizCcProducts/delete',
method: 'delete',
data
})
}
...@@ -135,7 +135,7 @@ export function getUserOwnRolesV1(id) { ...@@ -135,7 +135,7 @@ export function getUserOwnRolesV1(id) {
// 更新用户角色信息 // 更新用户角色信息
export function updateUserOwnRoles(id,data) { export function updateUserOwnRoles(id, data) {
return request({ return request({
url: `sys/user/roles/${id}`, url: `sys/user/roles/${id}`,
method: 'put', method: 'put',
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
fixed="right" fixed="right"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<slot name="operates" :scope="scope"></slot> <slot name="operates" :scope="scope.row"></slot>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
ref="upload" ref="upload"
class="upload-area" class="upload-area"
name="zipFile" name="zipFile"
accept=".zip" :accept="fileType"
:action="importZipUrl" :action="importZipUrl"
:headers="headers" :headers="headers"
:on-success="handleSuccess" :on-success="handleSuccess"
...@@ -44,8 +44,9 @@ ...@@ -44,8 +44,9 @@
> >
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text"> <div class="el-upload__text">
将文件拖到此处,或<em>点击上传</em>, 将文件拖到此处,或<em>点击上传</em>, 只能上传{{
只能上传zip文件,一次只能传一个文件 fileType
}}文件,一次只能传一个文件
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
...@@ -113,9 +114,10 @@ import { getToken } from "@/utils/auth"; ...@@ -113,9 +114,10 @@ import { getToken } from "@/utils/auth";
export default { export default {
name: "UploadDialog", name: "UploadDialog",
props: { props: {
//biz_cultural_relic——文物,biz_exhibition——展览,还需考虑其他的类型
bizType: { bizType: {
type: String, type: String,
default: "biz_cultural_relic", //biz_cultural_relic——文物,biz_exhibition——展览 default: "biz_cultural_relic",
}, },
flowId: { flowId: {
type: String, type: String,
...@@ -125,6 +127,10 @@ export default { ...@@ -125,6 +127,10 @@ export default {
type: String, type: String,
default: "", //标题,重传时会带过来 default: "", //标题,重传时会带过来
}, },
fileType: {
type: String,
default: ".zip", //‘.zip为压缩文件,.jpg,.png,.jpeg’为图片
},
}, },
computed: { computed: {
getSize(size) { getSize(size) {
...@@ -139,9 +145,14 @@ export default { ...@@ -139,9 +145,14 @@ export default {
return process.env.VUE_APP_BASE_API + "/bizImport/importZip"; return process.env.VUE_APP_BASE_API + "/bizImport/importZip";
}, },
getDialogTitle() { getDialogTitle() {
return this.bizType == "biz_cultural_relic" switch (this.bizType) {
? "批量上传文物" case "biz_cultural_relic":
: "整量上传展览"; return "批量上传文物";
case "biz_exhibition":
return "批量上传展览";
default:
return "上传文件";
}
}, },
}, },
data() { data() {
......
...@@ -5,10 +5,11 @@ ...@@ -5,10 +5,11 @@
// 本文件已经导出为全局变量,直接this.$constantsTool.getLabelByValue即可使用 // 本文件已经导出为全局变量,直接this.$constantsTool.getLabelByValue即可使用
import { checkStatus } from "./approval" import { checkStatus } from "./approval"
import { themeType } from "./display" import { themeType } from "./display"
import { mattingStatus } from "./matting"
const constantsTool = { const constantsTool = {
allList: { checkStatus, themeType }, allList: { checkStatus, themeType, mattingStatus },
// 获取label // 获取label
getLabelByValue(dictName, value) { getLabelByValue(dictName, value) {
const list = constantsTool.allList[dictName] const list = constantsTool.allList[dictName]
...@@ -26,7 +27,6 @@ const constantsTool = { ...@@ -26,7 +27,6 @@ const constantsTool = {
// 获取value // 获取value
getValueByLabel(dictName, label) { getValueByLabel(dictName, label) {
const list = constantsTool.allList[dictName] const list = constantsTool.allList[dictName]
if (!list) { if (!list) {
return '' return ''
......
// 关于抠图的常量
export const mattingStatus = [
{
value: 0,
label: '处理中',
tagType: 'primary',
},
{
value: 1,
label: '已成功',
tagType: 'success',
},
{
value: -1,
label: '抠图失败',
tagType: 'danger',
}
]
<?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="1698024688998" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2480" xmlns:xlink="http://www.w3.org/1999/xlink" width="80" height="80"><path d="M946 337.4c-2.3-8.6-11.1-13.7-19.7-11.3l-324.9 87.1 87-324.9c1.1-4.1 0.5-8.5-1.6-12.2s-5.6-6.4-9.7-7.5c-31-8.3-63.8-4.5-92.5 10.7-28 14.8-48.2 38.9-55.4 65.9l-74.8 279c-16.3-30.2-40.6-55.5-71.1-73.1-43.3-25-93.8-31.7-142.1-18.7l-82.7 22.2c-31.7 8.5-58.3 28.9-74.7 57.3-16.4 28.5-20.8 61.6-12.3 93.4L102 619c8.4 31.2 35.8 49.9 69.6 49.9 8.3 0 17.1-1.1 26-3.5l207.2-55.5-55.5 207.2c-12 44.9 7.5 85.1 46.4 95.5l113.7 30.5c10.6 2.8 21.4 4.2 32 4.2 21.3 0 42.4-5.6 61.3-16.5 28.5-16.4 48.8-43 57.3-74.7l22.2-82.7c22.9-85.3-17.3-172.9-91.9-213.2l279-74.8c57.8-15.6 93.7-84.7 76.7-148zM560.2 153.5c5-18.5 19.3-35.2 39.4-45.9 16.6-8.8 35.1-12.6 53.3-10.9l-87.3 325.9-83.5 22.4 78.1-291.5z m-18.7 421.4c82.6 22.1 131.8 107.4 109.7 190L629 847.6c-6.3 23.5-21.3 43.1-42.4 55.2-21 12.2-45.5 15.4-69 9.1L404 881.4c-21.6-5.8-31.2-28.4-23.7-56.2l60.3-225.1 98.2-26.3c0.8 0.5 1.7 0.9 2.7 1.1zM861 454.3l-671.7 180c-27.8 7.4-50.4-2.1-56.2-23.7l-30.5-113.7c-6.3-23.5-3.1-48 9.1-69 12.1-21 31.8-36.1 55.2-42.4l82.7-22.2c13.4-3.6 26.9-5.3 40.4-5.3 26.9 0 53.4 7 77.3 20.8 35.9 20.7 61.6 54.2 72.3 94.2 1.1 4.1 3.8 7.6 7.5 9.7s8.1 2.7 12.2 1.6l458.6-122.9c4 44.4-24.2 84.1-56.9 92.9z" p-id="2481"></path><path d="M398.3 484.1c-5.8-21.7-17.9-41-34.8-55.7-6.7-5.8-16.8-5.1-22.6 1.6-5.8 6.7-5.1 16.8 1.6 22.6 12.1 10.5 20.7 24.2 24.8 39.7l4.2 15.5L195.7 555 175 477.5c-1.1-4.1-0.5-8.4 1.6-12.2 2.1-3.7 5.6-6.4 9.7-7.5l82.7-22.2c8.6-2.3 13.6-11.1 11.3-19.7-2.3-8.6-11.1-13.7-19.7-11.3L178 426.8c-12.4 3.3-22.8 11.3-29.2 22.4s-8.1 24.1-4.8 36.5l24.9 93c1.9 7.2 8.4 11.9 15.5 11.9 1.4 0 2.8-0.2 4.2-0.6l206.7-55.4c4.1-1.1 7.6-3.8 9.7-7.5s2.7-8.1 1.6-12.2l-8.3-30.8zM424.4 826c-1.1 4.1-0.5 8.5 1.6 12.2s5.6 6.4 9.7 7.5l93 24.9c4.2 1.1 8.3 1.6 12.4 1.6 21.3 0 40.8-14.2 46.5-35.7l22.2-82.7c7.8-28.9 3.8-59.2-11.3-85.2-15-26-39.2-44.6-68.2-52.4l-31-8.3c-4.1-1.1-8.5-0.5-12.2 1.6s-6.4 5.6-7.5 9.7l-16.4 61.2c-2.3 8.6 2.8 17.4 11.3 19.7 8.6 2.3 17.4-2.8 19.7-11.3l12.2-45.7 15.5 4.2c20.7 5.5 38 18.8 48.7 37.4 10.7 18.6 13.6 40.2 8.1 60.9l-22.2 82.7c-2.3 8.6-11.1 13.6-19.7 11.3l-77.5-20.8 14-52.3c2.3-8.6-2.8-17.4-11.3-19.7s-17.4 2.8-19.7 11.3L424.4 826z" p-id="2482"></path></svg>
\ No newline at end of file
<?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="1698024696081" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2632" xmlns:xlink="http://www.w3.org/1999/xlink" width="80" height="80"><path d="M944.140673 718.412117 621.322359 452.362738c17.037025-37.017078 26.009374-77.727269 26.009374-118.662587 0-156.206668-127.07007-283.313577-283.313577-283.313577-28.04473 0-55.711859 3.996011-82.250282 12.062733l-30.853705 9.348925 175.299515 175.355797c7.463995 7.388271 11.496845 17.265222 11.496845 27.819602s-4.03285 20.430308-11.496845 27.894304l-92.992951 93.030813c-14.815427 14.776542-40.879036 14.852266-55.712883 0L102.189915 220.615607l-9.329483 30.758538c-8.066723 26.612101-12.156878 54.281277-12.156878 82.324984 0 156.131967 127.10691 283.239899 283.314601 283.239899 41.011043 0 81.684394-8.894577 118.662587-25.934672L623.357715 763.344468c0.678452 2.712785 1.811252 5.276167 3.618411 7.537673 1.88493 2.411933 4.297886 4.222161 6.935969 5.429663l113.687272 139.242298c14.175861 16.512069 34.529421 26.086122 55.789631 26.086122 19.525706 0 38.035268-7.841595 52.169173-21.937638l93.02979-93.030813c14.927991-14.927991 22.691815-34.45472 21.86396-54.958706C969.696722 751.207034 960.462406 732.358757 944.140673 718.412117M921.297408 799.380196l-93.030813 93.030813c-14.399965 14.32424-38.373982 13.269211-51.076282-1.658779l-53.714366-65.739237 64.685231-52.16815c8.329712-6.710842 9.572006-18.922978 2.938935-27.215852-6.710842-8.292873-18.847254-9.574053-27.140127-2.939959l-64.910359 52.393277-28.271904-34.6778 58.126862-46.89403c8.292873-6.708795 9.612938-18.845207 2.865257-27.139104-6.634094-8.367575-18.810415-9.650801-27.102265-2.939959l-58.31208 47.043433L492.783845 542.377868l-13.94664 7.388271c-35.132148 18.771529-74.786287 28.572756-114.818025 28.572756-134.947482 0-244.714468-109.692285-244.714468-244.639766 0-12.966313 0.998747-25.7822 2.996241-38.44766l127.917368 127.935788c29.345352 29.40061 80.930217 29.40061 110.295012 0l92.992951-93.030813c14.737656-14.70184 22.806425-34.302247 22.806425-55.184857 0-20.806885-8.068769-40.48404-22.806425-55.110155L325.607334 91.925642c12.664438-1.960655 25.51921-2.940982 38.410821-2.940982 134.947482 0 244.714468 109.691261 244.714468 244.713444 0 39.957037-9.874905 79.687924-28.572756 114.742301l-7.388271 13.947663L919.336754 747.9652c7.728008 6.634094 12.215206 15.60542 12.552897 25.25622C932.30409 782.870174 928.497391 792.145421 921.297408 799.380196" p-id="2633"></path></svg>
\ No newline at end of file
...@@ -58,15 +58,10 @@ router.afterEach((to, from) => { ...@@ -58,15 +58,10 @@ router.afterEach((to, from) => {
function gotoRouter(to, next) { function gotoRouter(to, next) {
getMenu() // 获取动态路由的方法 getMenu() // 获取动态路由的方法
.then(res => { .then(res => {
// console.log(res.data.menus);
const { menus, allMenus } = res.data const { menus, allMenus } = res.data
store.dispatch("user/setAllMenus", allMenus); store.dispatch("user/setAllMenus", allMenus);
const asyncRouter = addRouter(menus); // 进行递归解析 const asyncRouter = addRouter(menus); // 进行递归解析
return asyncRouter; return asyncRouter;
//TODO:前端暂时写死
// const asyncRouter = addRouter(); // 进行递归解析
// return asyncRouter;
}) })
.then(asyncRouter => { .then(asyncRouter => {
// 后置添加404页面,防止刷新404 // 后置添加404页面,防止刷新404
......
# 路由表说明
生产环境下路由表应该由后台返回,在开发环境中如果想要切换本地菜单进行测试,配置步骤如下
1. 在src/utils/addRouter.js中addRouter方法从使用后端路由切换为使用前端路由即可
```javascript
// addServerRouter为使用后端路由
// addLocalRouter为使用前端路由
// 添加路由
export function addRouter(menus) {
const isProduct = process.env.NODE_ENV === 'production'
// 生产环境必须使用后端路由,其他环境根据情况自由选择
if (isProduct) {
return addServerRouter(menus)
} else {
// return addServerRouter(menus)
return addLocalRouter()
}
}
```
...@@ -65,143 +65,9 @@ export const constantRoutes = [{ ...@@ -65,143 +65,9 @@ export const constantRoutes = [{
}] }]
}, },
// 404 page must be placed at the end !!!
// {
// path: '*',
// redirect: '/404',
// hidden: true
// }
] ]
/**
* 需要动态添加的路由(此处仅做记录,保证与后端保持同步)
*/
export const asyncRouterMap = [
{
path: '/business',
component: Layout,
name: 'Business',
hidden: false,
meta: {
title: '业务管理',
icon: 'yewu'
},
redirect: '/culturalRelic',
children: [{
path: 'culturalRelic',
name: 'CulturalRelic',
component: () => import('@/views/culturalRelic/index'),
meta: {
title: '文物管理',
icon: 'culturalRelic'
},
},
{
path: 'display',
name: 'Display',
component: () => import('@/views/display/index'),
meta: {
title: '展览管理',
icon: 'display'
}
},
// {
// path: 'boutique',
// name: 'Boutique',
// component: () => import('@/views/boutique/index'),
// meta: {
// title: '精品展管理',
// icon: 'boutique'
// }
// },
{
path: 'museum',
name: 'Museum',
component: () => import('@/views/museum/index'),
meta: {
title: '博物馆管理',
icon: 'museum'
}
},
{
path: 'virtual',
name: 'Virtual',
component: () => import('@/views/virtual/index'),
meta: {
title: '虚拟展厅',
icon: 'virtual'
}
},
{
path: 'literature',
name: 'Literature',
component: () => import('@/views/literature/index'),
meta: {
title: '文献管理',
icon: 'literature'
}
},
{
path: 'product',
name: 'Product',
component: () => import('@/views/product/index'),
meta: {
title: '文创产品管理',
icon: 'product'
}
},
{
path: 'displayApproval',
name: 'DisplayApproval',
component: () => import('@/views/displayApproval/index.vue'),
meta: {
title: '展览审批',
icon: 'approval'
}
},
]
},
{
path: '/system',
component: Layout,
name: 'System',
hidden: false,
meta: {
title: '系统管理',
icon: 'xitong'
},
redirect: '/user',
children: [{
path: 'user',
name: 'User',
component: () => import('@/views/user/index'),
meta: {
title: '用户管理',
icon: 'user2'
}
},
{
path: 'role',
name: 'Role',
component: () => import('@/views/role/index'),
meta: {
title: '角色管理',
icon: 'role'
}
},
{
path: 'log',
name: 'Log',
component: () => import('@/views/log/index'),
meta: {
title: '日志管理',
icon: 'log'
}
},
]
},
]
const createRouter = () => new Router({ const createRouter = () => new Router({
// mode: 'history', // require service support // mode: 'history', // require service support
......
/**
* 需要动态添加的路由(此处仅做记录,保证与后端保持同步)
*/
import Layout from '@/layout'
export const staticRouter = [
{
path: '/business',
component: Layout,
name: 'Business',
hidden: false,
meta: {
title: '业务管理',
icon: 'yewu'
},
redirect: '/culturalRelic',
children: [{
path: 'culturalRelic',
name: 'CulturalRelic',
component: () => import('@/views/culturalRelic/index'),
meta: {
title: '文物管理',
icon: 'culturalRelic'
},
},
{
path: 'display',
name: 'Display',
component: () => import('@/views/display/index'),
meta: {
title: '展览管理',
icon: 'display'
}
},
// {
// path: 'boutique',
// name: 'Boutique',
// component: () => import('@/views/boutique/index'),
// meta: {
// title: '精品展管理',
// icon: 'boutique'
// }
// },
{
path: 'museum',
name: 'Museum',
component: () => import('@/views/museum/index'),
meta: {
title: '博物馆管理',
icon: 'museum'
}
},
{
path: 'virtual',
name: 'Virtual',
component: () => import('@/views/virtual/index'),
meta: {
title: '虚拟展厅',
icon: 'virtual'
}
},
{
path: 'literature',
name: 'Literature',
component: () => import('@/views/literature/index'),
meta: {
title: '文献管理',
icon: 'literature'
}
},
{
path: 'product',
name: 'Product',
component: () => import('@/views/product/index'),
meta: {
title: '文创产品管理',
icon: 'product'
}
},
{
path: 'displayApproval',
name: 'DisplayApproval',
component: () => import('@/views/displayApproval/index.vue'),
meta: {
title: '展览审批',
icon: 'approval'
}
},
]
},
{
path: '/system',
component: Layout,
name: 'System',
hidden: false,
meta: {
title: '系统管理',
icon: 'xitong'
},
redirect: '/user',
children: [{
path: 'user',
name: 'User',
component: () => import('@/views/user/index'),
meta: {
title: '用户管理',
icon: 'user2'
}
},
{
path: 'role',
name: 'Role',
component: () => import('@/views/role/index'),
meta: {
title: '角色管理',
icon: 'role'
}
},
{
path: 'log',
name: 'Log',
component: () => import('@/views/log/index'),
meta: {
title: '日志管理',
icon: 'log'
}
},
]
},
{
path: '/tools',
component: Layout,
name: 'Tools',
hidden: false,
meta: {
title: '实用工具',
icon: 'tool'
},
redirect: '/matting',
children: [{
path: 'matting',
name: 'Matting',
component: () => import('@/views/matting/index'),
meta: {
title: '在线抠图',
icon: 'scissors'
}
},
]
},
]
import Layout from '@/layout'
import { staticRouter } from '@/router/staticRouter'
// 添加路由
export function addRouter(menus) {
const isProduct = process.env.NODE_ENV === 'production'
// 生产环境必须使用后端路由,其他环境根据情况自由选择
if (isProduct) {
return addServerRouter(menus) //使用后端路由
} else {
// return addServerRouter(menus) //使用后端路由
return addLocalRouter()//使用前端路由
}
}
/** /**
* 生成路由 * 使用后端数据生成路由
* @param {Array} routerlist 格式化路由 * @param {Array} routerlist 格式化路由
* @returns * @returns
*/ */
export function addRouter(routerlist) { export function addServerRouter(routerlist) {
const router = [] const router = []
try { try {
routerlist.forEach(e => { routerlist.forEach(e => {
...@@ -42,126 +57,8 @@ export function addRouter(routerlist) { ...@@ -42,126 +57,8 @@ export function addRouter(routerlist) {
} }
/** /**
* 前端测试使用,暂时写死 * 使用前端本地数据生成路由
*/ */
// export function addRouter() { export function addLocalRouter() {
return staticRouter
// const asyncRouterMap = [ }
// { \ No newline at end of file
// path: '/business',
// component: Layout,
// name: 'Business',
// hidden: false,
// meta: {
// title: '业务管理',
// icon: 'yewu'
// },
// redirect: '/culturalRelic',
// children: [{
// path: 'culturalRelic',
// name: 'CulturalRelic',
// component: () => import('@/views/culturalRelic/index'),
// meta: {
// title: '文物管理',
// icon: 'culturalRelic'
// },
// },
// {
// path: 'display',
// name: 'Display',
// component: () => import('@/views/display/index'),
// meta: {
// title: '展览管理',
// icon: 'display'
// }
// },
// {
// path: 'museum',
// name: 'Museum',
// component: () => import('@/views/museum/index'),
// meta: {
// title: '博物馆管理',
// icon: 'museum'
// }
// },
// {
// path: 'virtual',
// name: 'Virtual',
// component: () => import('@/views/virtual/index'),
// meta: {
// title: '虚拟展厅',
// icon: 'virtual'
// }
// },
// {
// path: 'literature',
// name: 'Literature',
// component: () => import('@/views/literature/index'),
// meta: {
// title: '文献管理',
// icon: 'literature'
// }
// },
// {
// path: 'product',
// name: 'Product',
// component: () => import('@/views/product/index'),
// meta: {
// title: '文创产品管理',
// icon: 'product'
// }
// },
// {
// path: 'displayApproval',
// name: 'DisplayApproval',
// component: () => import('@/views/displayApproval/index.vue'),
// meta: {
// title: '展览审批',
// icon: 'approval'
// }
// },
// ]
// },
// {
// path: '/system',
// component: Layout,
// name: 'System',
// hidden: false,
// meta: {
// title: '系统管理',
// icon: 'xitong'
// },
// redirect: '/user',
// children: [{
// path: 'user',
// name: 'User',
// component: () => import('@/views/user/index'),
// meta: {
// title: '用户管理',
// icon: 'user2'
// }
// },
// {
// path: 'role',
// name: 'Role',
// component: () => import('@/views/role/index'),
// meta: {
// title: '角色管理',
// icon: 'role'
// }
// },
// {
// path: 'log',
// name: 'Log',
// component: () => import('@/views/log/index'),
// meta: {
// title: '日志管理',
// icon: 'log'
// }
// },
// ]
// },
// ]
// return asyncRouterMap
// }
\ No newline at end of file
// 本文件用于提取一些通用的业务层面的公共方法 // 本文件用于提取一些通用的业务层面的公共方法
import { Message } from "element-ui";
import store from '@/store'
const bizCommon = { const bizCommon = {
/**
* 业务中的上下架,展览、文物、虚拟展厅、文创、博物馆、用户、角色等
* @param {Object} row
* @param {Promise} request
* @param {Function} callback
*/
async changeStatus(row, request, callback) {
const { status } = row;
let newStatus = status == "0" ? "1" : "0";
const params = {
...row,
status: newStatus,
};
let res = await request(params);
if (res.code == 0) {
Message.success("修改成功!");
callback()
}
},
}
} export default bizCommon
\ No newline at end of file \ No newline at end of file
...@@ -6,8 +6,10 @@ import { ...@@ -6,8 +6,10 @@ import {
import { file } from '@/utils/file' import { file } from '@/utils/file'
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import constantsTool from '@/contants/index' import constantsTool from '@/contants/index'
import bizCommon from '@/utils/bizCommon'
Vue.prototype.$getFullUrl = getFullUrl //获取文件的完整链接 Vue.prototype.$getFullUrl = getFullUrl //获取文件的完整链接
Vue.prototype.$echarts = echarts //Echarts Vue.prototype.$echarts = echarts //Echarts
Vue.prototype.$file = file //文件操作 Vue.prototype.$file = file //文件操作
Vue.prototype.$constantsTool = constantsTool //前端定义的常量操作 Vue.prototype.$constantsTool = constantsTool //前端定义的常量操作
\ No newline at end of file Vue.prototype.$bizCommon = bizCommon //前端定义的常量操作
\ No newline at end of file
...@@ -13,7 +13,7 @@ const service = axios.create({ ...@@ -13,7 +13,7 @@ const service = axios.create({
// baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url // baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests // withCredentials: true, // send cookies when cross-domain requests
baseURL: process.env.VUE_APP_BASE_API, baseURL: process.env.VUE_APP_BASE_API,
timeout: 10*1000, timeout: 10 * 1000,
}) })
// request interceptor // request interceptor
service.interceptors.request.use( service.interceptors.request.use(
...@@ -49,9 +49,7 @@ service.interceptors.response.use( ...@@ -49,9 +49,7 @@ service.interceptors.response.use(
*/ */
response => { response => {
const res = response.data const res = response.data
// console.log('响应拦截res--------',response);
if (response.config.url.indexOf('sys/getVerify') != -1) { if (response.config.url.indexOf('sys/getVerify') != -1) {
// debugger
return res return res
} }
// debugger // debugger
......
...@@ -57,46 +57,36 @@ ...@@ -57,46 +57,36 @@
:tableTitle="getTitle" :tableTitle="getTitle"
:operates="operates" :operates="operates"
> >
<template v-slot:sourceWay="data"> <template v-slot:sourceWay="{ scope }">
<DictText <DictText
name="culturalRelicSourceWay" name="culturalRelicSourceWay"
:dictValue="data.scope.sourceWay" :dictValue="scope.sourceWay"
/> />
</template> </template>
<template v-slot:status="data"> <template v-slot:status="{ scope }">
<el-popconfirm <el-popconfirm
:title="getStatusTitle(data.scope.status)" :title="getStatusTitle(scope.status)"
@confirm="handleChangeStatus(data.scope)" @confirm="handleChangeStatus(scope)"
> >
<el-switch <el-switch
slot="reference" slot="reference"
:value="Boolean(Number(data.scope.status))" :value="Boolean(Number(scope.status))"
></el-switch> ></el-switch>
</el-popconfirm> </el-popconfirm>
</template> </template>
<template v-slot:checkStatus="data"> <template v-slot:checkStatus="{ scope }">
<el-tag <el-tag
:type=" :type="
$constantsTool.getTagTypeByValue( $constantsTool.getTagTypeByValue('checkStatus', scope.checkStatus)
'checkStatus',
data.scope.checkStatus
)
" "
>{{ >{{
$constantsTool.getLabelByValue( $constantsTool.getLabelByValue("checkStatus", scope.checkStatus)
"checkStatus",
data.scope.checkStatus
)
}}</el-tag }}</el-tag
> >
</template> </template>
<template v-slot:faceImageUrl="data"> <template v-slot:faceImageUrl="{ scope }">
<img <img
:src=" :src="$getFullUrl(scope.faceImagePressUrl || scope.faceImageUrl)"
$getFullUrl(
data.scope.faceImagePressUrl || data.scope.faceImageUrl
)
"
alt="暂无图片" alt="暂无图片"
style=" style="
cursor: pointer; cursor: pointer;
...@@ -104,13 +94,13 @@ ...@@ -104,13 +94,13 @@
height: 80px; height: 80px;
object-fit: contain; object-fit: contain;
" "
@click="handelPreviewImages(data.scope.faceImageUrl)" @click="handelPreviewImages(scope.faceImageUrl)"
/> />
</template> </template>
<template v-slot:operates="scope"> <template v-slot:operates="{ scope }">
<TableOperation <TableOperation
:operations="getOperations(scope.scope.row)" :operations="getOperations(scope)"
:rawData="scope.scope.row" :rawData="scope"
@handleOperation="handleOperation" @handleOperation="handleOperation"
></TableOperation> ></TableOperation>
</template> </template>
...@@ -390,17 +380,8 @@ export default { ...@@ -390,17 +380,8 @@ export default {
this.imgList = [images]; this.imgList = [images];
}, },
async handleChangeStatus(row) { async handleChangeStatus(row) {
const { status } = row; const callback = this.loadData;
let newStatus = status === "0" ? "1" : "0"; this.$bizCommon.changeStatus(row, editCulturalRelic, callback);
const params = {
...row,
status: newStatus,
};
let res = await editCulturalRelic(params);
if (res.code == 0) {
this.loadData();
this.$message.success("修改成功!");
}
}, },
// 多选 // 多选
handleSelectionChange(val) { handleSelectionChange(val) {
......
...@@ -375,6 +375,7 @@ import { pageSelectUrl, upLoadAddress } from "../configs/urls"; ...@@ -375,6 +375,7 @@ import { pageSelectUrl, upLoadAddress } from "../configs/urls";
import transformData from "@/utils/transformData"; import transformData from "@/utils/transformData";
import fileUploadFunctions from "@/utils/fileUploadFuctions"; import fileUploadFunctions from "@/utils/fileUploadFuctions";
import unitsFunctions from "./units"; import unitsFunctions from "./units";
import submit from "./submit";
const { const {
faceImageToClient, faceImageToClient,
literatureIdArrToStr, literatureIdArrToStr,
...@@ -510,8 +511,9 @@ export default { ...@@ -510,8 +511,9 @@ export default {
if (value) { if (value) {
this.dialogForm = JSON.parse(JSON.stringify(value)); this.dialogForm = JSON.parse(JSON.stringify(value));
if (!this.dialogForm.exhibitionId) { if (!this.dialogForm.exhibitionId) {
this.dialogForm.deptId = this.userInfo.deptId; const { deptId, regionCode } = this.userInfo;
this.dialogForm.regionCode = this.userInfo.regionCode; this.dialogForm.deptId = deptId;
this.dialogForm.regionCode = regionCode;
} else { } else {
this.currentId = this.dialogForm.exhibitionId; this.currentId = this.dialogForm.exhibitionId;
} }
...@@ -737,208 +739,249 @@ export default { ...@@ -737,208 +739,249 @@ export default {
} }
}, },
handleSubmit(submitFlag) { handleSubmit(submitFlag) {
// this.loading = true; submit(submitFlag, this);
this.$refs.form.validate(async (valid) => { },
if (valid) { // handleSubmit(submitFlag) {
this.submitLoading = true; // // this.loading = true;
var that = this; // this.$refs.form.validate(async (valid) => {
let formData = new FormData(); // if (valid) {
// 已存在的文件的对象 // this.submitLoading = true;
let successFilesObj = []; // let that = this;
// 需要被删除的文件Id // let formData = new FormData();
let deleteFileArr = []; // // 已存在的文件的对象
// 添加布展本身的媒体文件至formData // let successFilesObj = [];
const mediaKeys = ["faceImage", "images", "videos", "audios"]; // // 需要被删除的文件Id
let newFiles = {}; //key:字段名或者单元id名, value:不同媒体或单元已经存在的文件id数组 // let deleteFileArr = [];
mediaKeys.map((media) => { // // 添加布展本身的媒体文件至formData
let files = [...this.$refs[media].getFiles()]; // const mediaKeys = ["faceImage", "images", "videos", "audios"];
let fileIds = []; //不同媒体或单元已经存在的文件id数组 // let newFiles = {}; //key:字段名或者单元id名, value:不同媒体或单元已经存在的文件id数组
files.map((f) => { // mediaKeys.map((media) => {
if (f.status && f.status == "ready") { // let files = getMediaFile(this, media);
formData.append(media, f.raw); // let fileIds = []; //不同媒体或单元已经存在的文件id数组
} else { // files.map((f) => {
if (successFilesObj[media]) { // if (isFileRaw(f)) {
successFilesObj[media].push(f); // // 添加文件到表单中
} else { // formData.append(media, f.raw);
successFilesObj[media] = [f]; // } else {
} // // 如果成功
fileIds.push(f.fileId); // if (successFilesObj[media]) {
} // successFilesObj[media].push(f);
}); // } else {
// successFilesObj[media] = [f];
// }
// fileIds.push(f.fileId);
// }
// });
newFiles[media] = fileIds; // newFiles[media] = fileIds;
}); // });
mediaKeys.map((media) => { // mediaKeys.map((media) => {
if (this.dialogForm[media]) { // if (this.dialogForm[media]) {
let oldFileIdArr = this.dialogForm[media].split(","); // let oldFileIdArr = this.dialogForm[media].split(",");
oldFileIdArr.map((oldId) => { // oldFileIdArr.map((oldId) => {
if (newFiles[media].indexOf(oldId) == -1) { // if (newFiles[media].indexOf(oldId) == -1) {
deleteFileArr.push(oldId); // deleteFileArr.push(oldId);
} // }
}); // });
} // }
}); // });
let unitIds = []; // let unitIds = [];
let unitData = [...this.$refs["exhibitionUnits"].getUnitData()]; // let unitData = [...this.$refs["exhibitionUnits"].getUnitData()];
// 批量添加image进入formdata // // 批量添加image进入formdata
let newfileIdsArr = []; //不同媒体或单元已经存在的文件id数组 // let newfileIdsArr = []; //不同媒体或单元已经存在的文件id数组
let oldFileIdsArr = []; //旧的ids集合 // let oldFileIdsArr = []; //旧的ids集合
addUnitImgToFormData(unitData); // addUnitImgToFormData(unitData);
function addUnitImgToFormData(arr) { // function addUnitImgToFormData(arr) {
if (arr.length > 0) { // if (arr.length > 0) {
arr.map((item) => { // arr.map((item) => {
if (item.imagesVo && item.imagesVo.length > 0) { // if (item.imagesVo && item.imagesVo.length > 0) {
let imageFiles = item.imagesVo; // let imageFiles = item.imagesVo;
let unitOldIds = item.images.split(","); // let unitOldIds = item.images.split(",");
oldFileIdsArr = oldFileIdsArr.concat(unitOldIds); // oldFileIdsArr = oldFileIdsArr.concat(unitOldIds);
imageFiles.map((imgFile) => { // imageFiles.map((imgFile) => {
if (imgFile.status && imgFile.status == "ready") { // if (imgFile.status && imgFile.status == "ready") {
formData.append(`unit-images-${item.euId}`, imgFile.raw); // formData.append(`unit-images-${item.euId}`, imgFile.raw);
} else { // } else {
if (successFilesObj[`unit-images-${item.euId}`]) { // if (successFilesObj[`unit-images-${item.euId}`]) {
successFilesObj[`unit-images-${item.euId}`].push( // successFilesObj[`unit-images-${item.euId}`].push(
imgFile // imgFile
); // );
} else { // } else {
successFilesObj[`unit-images-${item.euId}`] = [imgFile]; // successFilesObj[`unit-images-${item.euId}`] = [imgFile];
} // }
newfileIdsArr.push(imgFile.fileId); // newfileIdsArr.push(imgFile.fileId);
} // }
}); // });
} // }
if (item.children) { // if (item.children) {
addUnitImgToFormData(item.children); // addUnitImgToFormData(item.children);
} // }
}); // });
} // }
} // }
oldFileIdsArr.map((oldfileId) => { // oldFileIdsArr.map((oldfileId) => {
// 如果旧的id在新的id集合中找不到,则代表该文件被删除 // // 如果旧的id在新的id集合中找不到,则代表该文件被删除
if (newfileIdsArr.indexOf(oldfileId) == -1) { // if (newfileIdsArr.indexOf(oldfileId) == -1) {
deleteFileArr.push(oldfileId); // deleteFileArr.push(oldfileId);
} // }
}); // });
// 上传所有媒体文件 // // 上传所有媒体文件
let filesObj = {}; // let filesObj = {};
var formDataArr = Array.from(formData.entries(), ([key, prop]) => ({ // // formData有长度时再进行上传
[key]: { // if (isFormDataHasData(formData)) {
ContentLength: typeof prop === "string" ? prop.length : prop.size, // this.loadingText = "正在上传文件...请耐心等待";
}, // let upLoadRes = await uploadV1(formData);
})); // if (upLoadRes.code == 0) {
// upLoadRes.data.map((resFile) => {
// if (filesObj[resFile.fileKey]) {
// filesObj[resFile.fileKey].push(resFile.fileId);
// } else {
// filesObj[resFile.fileKey] = [resFile.fileId];
// }
// });
// }
// }
// // 1、回填之前先获取已存在的文件
// for (const key in successFilesObj) {
// // 如果文件id中含有已上传成功的某个key,如images,则将已上传成功的images推入文件id集合
// if (filesObj[key]) {
// successFilesObj[key].map((sf) => {
// filesObj[key].push(sf.fileId);
// });
// } else {
// let ids = [];
// successFilesObj[key].map((sf) => {
// ids.push(sf.fileId);
// });
// filesObj[key] = ids;
// }
// }
// // 2、回填布展自带的媒体文件
// const dialogFormSuccess = this.getSuccessedDialogForm(
// mediaKeys,
// this.dialogForm,
// filesObj
// );
// // 3、回填布展单元媒体文件,修改关联文物为Str,和显示隐藏控制器
// const unitDataSuccess = this.getSuccessedUnit(unitData, filesObj);
// const params = {
// ...dialogFormSuccess,
// exhibitionUnits: unitDataSuccess,
// };
// params.literature = getLtStrByArr(this.literatureIdArr); //文献
// params.status = getStatusNumByBool(this.dialogForm.status);
// params.crIds = that.crIds.join(",");
// params.bvIds = that.vrIds.join(",");
// params.displayCharacter = 1; //传布展
// params.submitFlag = submitFlag;
// return;
// addOrUpdateDisplayTemp(params)
// .then((res) => {
// if (res.code == 0) {
// setTimeout(() => {
// that.$emit("refresh");
// that.reload();
// that.submitLoading = false;
// that.$message.success("提交成功!");
// that.visible = false;
// }, 1000);
// }
// })
// .catch((err) => {
// that.submitLoading = false;
// });
// }
// });
// },
// formData有长度时再进行上传 getLtStrByArr(arr) {
if (formDataArr.length > 0) { if (arr.length == 0) {
this.loadingText = "正在上传文件...请耐心等待"; return "";
let upLoadRes = await uploadV1(formData); }
if (upLoadRes.code == 0) { return arr.join(",");
upLoadRes.data.map((resFile) => { },
if (filesObj[resFile.fileKey]) {
filesObj[resFile.fileKey].push(resFile.fileId);
} else {
filesObj[resFile.fileKey] = [resFile.fileId];
}
});
}
}
// 1、回填之前先获取已存在的文件
for (const key in successFilesObj) {
// 如果文件id中含有已上传成功的某个key,如images,则将已上传成功的images推入文件id集合
if (filesObj[key]) {
successFilesObj[key].map((sf) => {
filesObj[key].push(sf.fileId);
});
} else {
let ids = [];
successFilesObj[key].map((sf) => {
ids.push(sf.fileId);
});
filesObj[key] = ids;
}
}
// 2、回填布展自带的媒体文件
mediaKeys.forEach((media) => {
if (filesObj[media]) {
this.dialogForm[media] = filesObj[media].join(",");
} else {
this.dialogForm[media] = "";
}
});
// 3、回填布展单元媒体文件,修改关联文物为Str,和显示隐藏控制器
backFillUnit(unitData);
function backFillUnit(arr) {
if (arr.length > 0) {
arr.map((unit) => {
// 如果进行了文件上传
if (Object.keys(filesObj).length > 0) {
for (const key in filesObj) {
let type = key.split("-")[1];
let euId = key.split("-")[2];
if (euId == unit.euId) {
switch (type) {
case "images":
unit.images = filesObj[key].join(",");
break;
case "videos":
unit.videos = filesObj[key].join(",");
break;
}
}
}
}
let crIdArr = JSON.parse(JSON.stringify(unit.crIds));
if (crIdArr) { getStatusNumByBool(bool) {
if (crIdArr instanceof Array) { if (!bool instanceof Boolean) {
unit.crIds = crIdArr.join(","); return;
} else if (crIdArr instanceof String) { }
unit.crIds = [crIdArr]; return bool ? 1 : 0;
} },
} else {
unit.crIds = ""; /**
} * @param {Array} mediaKeys 媒体keys
* @param {Object} dialogForm 表单对象
* @param {Object} filesObj 文件对象们
* @returns {Array} 回填上传的文件之后的布展单元
*/
getSuccessedDialogForm(mediaKeys, form, filesObj) {
const newForm = JSON.parse(JSON.stringify(form));
mediaKeys.forEach((media) => {
if (filesObj[media]) {
newForm[media] = filesObj[media].join(",");
} else {
newForm[media] = "";
}
});
return newForm;
},
var deleteArr = ["euId"]; /**
deleteArr.forEach((i) => { * @param {Array} unitData 回填上传的文件之前的布展单元
if (unit[i]) { * @param {Object} filesObj 文件对象们
delete unit[i]; * @returns {Array} 回填上传的文件之后的布展单元
*/
getSuccessedUnit(unitData, filesObj) {
const newData = JSON.parse(JSON.stringify(unitData)); //不改变输入的数据
backFillUnit(newData);
return newData;
function backFillUnit(arr) {
if (arr.length > 0) {
arr.forEach((unit) => {
// 如果进行了文件上传
if (Object.keys(filesObj).length > 0) {
for (const key in filesObj) {
let type = key.split("-")[1];
let euId = key.split("-")[2];
if (euId == unit.euId) {
switch (type) {
case "images":
unit.images = filesObj[key].join(",");
break;
case "videos":
unit.videos = filesObj[key].join(",");
break;
} }
});
if (unit.children) {
backFillUnit(unit.children);
} }
}); }
} }
} let crIdArr = JSON.parse(JSON.stringify(unit.crIds));
const params = {
...this.dialogForm, if (crIdArr) {
exhibitionUnits: unitData, if (crIdArr instanceof Array) {
}; unit.crIds = crIdArr.join(",");
params.literature = this.literatureIdArr.join(","); } else if (crIdArr instanceof String) {
params.status = this.dialogForm.status ? 1 : 0; unit.crIds = [crIdArr];
params.crIds = this.crIds.join(","); }
params.bvIds = this.vrIds.join(","); } else {
params.displayCharacter = 1; //传布展 unit.crIds = "";
params.submitFlag = submitFlag; }
addOrUpdateDisplayTemp(params)
.then((res) => { var deleteArr = ["euId"];
if (res.code == 0) { deleteArr.forEach((i) => {
setTimeout(() => { if (unit[i]) {
this.$emit("refresh"); delete unit[i];
this.reload();
this.submitLoading = false;
this.$message.success("提交成功!");
this.visible = false;
}, 1000);
} }
})
.catch((err) => {
this.submitLoading = false;
}); });
if (unit.children) {
backFillUnit(unit.children);
}
});
} }
}); }
}, },
// 清空编辑组件中的所有值 // 清空编辑组件中的所有值
reload() { reload() {
...@@ -1037,8 +1080,8 @@ export default { ...@@ -1037,8 +1080,8 @@ export default {
} }
.btn { .btn {
width: 80px; width: 60px;
height: 80px; height: 60px;
border: 2px solid #fff; border: 2px solid #fff;
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;
...@@ -1049,7 +1092,7 @@ export default { ...@@ -1049,7 +1092,7 @@ export default {
cursor: pointer; cursor: pointer;
i { i {
font-size: 50px; font-size: 40px;
color: #fff; color: #fff;
} }
} }
......
// 单独写上传的处理函数
/**
*
* @param {Boolean} submitFlag 上传的类别,是仅保存还是
* @param {*} $el
*/
const submit = (submitFlag, $el) => {
// this.loading = true;
this.$refs.form.validate(async (valid) => {
if (valid) {
params.literature = getLtStrByArr(this.literatureIdArr); //文献
params.status = getStatusNumByBool(this.dialogForm.status);
params.crIds = that.crIds.join(",");
params.bvIds = that.vrIds.join(",");
params.displayCharacter = 1; //传布展
params.submitFlag = submitFlag;
return;
addOrUpdateDisplayTemp(params)
.then((res) => {
if (res.code == 0) {
setTimeout(() => {
that.$emit("refresh");
that.reload();
that.submitLoading = false;
that.$message.success("提交成功!");
that.visible = false;
}, 1000);
}
})
.catch((err) => {
that.submitLoading = false;
});
}
});
}
export default submit
\ No newline at end of file
...@@ -57,61 +57,47 @@ ...@@ -57,61 +57,47 @@
:tableTitle="getTitle" :tableTitle="getTitle"
:operates="operates" :operates="operates"
> >
<template v-slot:status="data"> <template v-slot:status="{ scope }">
<el-popconfirm <el-popconfirm
:title="getStatusTitle(data.scope.status)" :title="getStatusTitle(scope.status)"
@confirm="handleChangeStatus(data.scope)" @confirm="handleChangeStatus(scope)"
> >
<el-switch <el-switch
slot="reference" slot="reference"
:value="Boolean(Number(data.scope.status))" :value="Boolean(Number(scope.status))"
></el-switch> ></el-switch>
</el-popconfirm> </el-popconfirm>
</template> </template>
<template v-slot:displayType="data"> <template v-slot:displayType="{ scope }">
{{ dicts.displayType[data.scope.type] }} {{ dicts.displayType[scope.type] }}
</template> </template>
<template v-slot:checkStatus="data"> <template v-slot:checkStatus="{ scope }">
<el-tag <el-tag
:type=" :type="
$constantsTool.getTagTypeByValue( $constantsTool.getTagTypeByValue('checkStatus', scope.checkStatus)
'checkStatus',
data.scope.checkStatus
)
" "
>{{ >{{
$constantsTool.getLabelByValue( $constantsTool.getLabelByValue("checkStatus", scope.checkStatus)
"checkStatus",
data.scope.checkStatus
)
}}</el-tag }}</el-tag
> >
</template> </template>
<template v-slot:faceImageUrl="data"> <template v-slot:faceImageUrl="{ scope }">
<img <img
:src=" :src="$getFullUrl(scope.faceImagePressUrl || scope.faceImageUrl)"
$getFullUrl(
data.scope.faceImagePressUrl || data.scope.faceImageUrl
)
"
alt="暂无图片" alt="暂无图片"
v-if=" v-if="$getFullUrl(scope.faceImagePressUrl || scope.faceImageUrl)"
$getFullUrl(
data.scope.faceImagePressUrl || data.scope.faceImageUrl
)
"
style="cursor: pointer" style="cursor: pointer"
width="100px" width="100px"
@click="handelPreviewImages(data.scope.faceImageUrl)" @click="handelPreviewImages(scope.faceImageUrl)"
/> />
</template> </template>
<template v-slot:themeType="data"> <template v-slot:themeType="{ scope }">
{{ themeTypeCode(data.scope.themeType) }} {{ themeTypeCode(scope.themeType) }}
</template> </template>
<template v-slot:operates="scope"> <template v-slot:operates="{ scope }">
<TableOperation <TableOperation
:operations="getOperations(scope.scope.row)" :operations="getOperations(scope)"
:rawData="scope.scope.row" :rawData="scope"
@handleOperation="handleOperation" @handleOperation="handleOperation"
> >
</TableOperation> </TableOperation>
...@@ -557,17 +543,8 @@ export default { ...@@ -557,17 +543,8 @@ export default {
this.$refs.InfoEditDialog.submitLoading = false; this.$refs.InfoEditDialog.submitLoading = false;
}, },
async handleChangeStatus(row) { async handleChangeStatus(row) {
const { status } = row; const callback = this.loadData;
let newStatus = status === "0" ? "1" : "0"; this.$bizCommon.changeStatus(row, editDisplay, callback);
const params = {
...row,
status: newStatus,
};
let res = await editDisplay(params);
if (res.code == 0) {
this.loadData();
this.$message.success("修改成功!");
}
}, },
// 多选 // 多选
handleSelectionChange(val) { handleSelectionChange(val) {
......
<template>
<div class="base-info">
<el-form :model="displayDetail" class="basic-info" ref="form" size="mini">
<el-row :gutter="50">
<el-col :span="10">
<el-form-item label="展览标题" :label-width="formLabelWidth">
<el-input
disabled
v-model="displayDetail.title"
autocomplete="off"
placeholder="无"
clearable
></el-input>
</el-form-item>
<el-form-item label="展览介绍" :label-width="formLabelWidth">
<div
v-if="displayDetail.intro.length > 0"
class="intro"
v-html="displayDetail.intro"
></div>
<div v-else class="intro">暂无</div>
</el-form-item>
<el-form-item label="展览单位" :label-width="formLabelWidth">
<el-cascader
disabled
style="width: 100%"
v-model="displayDetail.deptId"
:options="orgTreeData"
:props="optionProps"
placeholder="无"
clearable
>
</el-cascader>
</el-form-item>
<el-form-item label="展览地区" :label-width="formLabelWidth">
<el-cascader
disabled
class="years item"
style="width: 100%"
v-model="displayDetail.regionCode"
:options="regionTree"
:props="culturalRegionProps"
placeholder="无"
filterable
clearable
>
</el-cascader>
</el-form-item>
<el-form-item label="展览类型" :label-width="formLabelWidth">
<el-select
disabled
v-model="displayDetail.type"
placeholder="无"
style="width: 100%"
clearable
>
<el-option
v-for="(value, key) in dicts.displayType"
:key="key"
:label="value"
:value="key"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="展览性质"
:label-width="formLabelWidth"
style="display: none"
>
<el-select
disabled
v-model="displayDetail.displayCharacter"
placeholder="无"
style="width: 100%"
clearable
>
<el-option
v-for="(value, key) in dicts.displayCharacter"
:key="key"
:label="value"
:value="key"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="模板主题" :label-width="formLabelWidth">
<el-select
disabled
v-model="displayDetail.themeType"
placeholder="无"
style="width: 100%"
clearable
>
<el-option
v-for="item in themeTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="关键词" :label-width="formLabelWidth">
<el-input
disabled
v-model="displayDetail.keyword"
autocomplete="off"
placeholder="无"
clearable
></el-input>
</el-form-item>
<el-form-item label="展览文物" :label-width="formLabelWidth">
<el-select
disabled
v-model="crIds"
multiple
filterable
remote
reserve-keyword
placeholder="无"
style="width: 100%"
clearable
>
<el-option
v-for="item in crList"
:key="item.crId"
:label="item.name"
:value="item.crId"
>
</el-option>
</el-select>
<!-- <PageSelect
ref="PageSelect"
label="name"
value="crId"
:select.sync="value"
:url="pageSelectUrl"
filter-key="name"
/> -->
</el-form-item>
<el-form-item label="关联文献" :label-width="formLabelWidth">
<el-select
disabled
v-model="literatureValues"
multiple
filterable
remote
reserve-keyword
placeholder="无"
style="width: 100%"
ref="literatureSelect"
clearable
>
<el-option
v-for="item in literatureList"
:key="item.literatureId"
:label="item.name"
:value="item.literatureId"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="关联虚拟展厅" :label-width="formLabelWidth">
<el-select
disabled
v-model="vrIds"
multiple
filterable
remote
reserve-keyword
placeholder="无"
style="width: 100%"
ref="virtualSelect"
clearable
>
<el-option
v-for="item in vrList"
:key="item.bvId"
:label="item.name"
:value="item.bvId"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="是否上架" :label-width="formLabelWidth">
<el-switch v-model="displayDetail.status" disabled> </el-switch>
</el-form-item>
<el-form-item label="备注" :label-width="formLabelWidth">
<el-input
disabled
type="textarea"
placeholder="无"
v-model="displayDetail.remark"
maxlength="100"
show-word-limit
clearable
>
</el-input>
</el-form-item>
</el-col>
<el-col :span="14">
<el-form-item label="展览封面" :label-width="formLabelWidth">
<div v-if="displayDetail.faceImagePressUrl" class="img-container">
<ManualUploader
:fileLimit="1"
listType="picture-card"
:fileType="['png', 'jpeg', 'jpg']"
:files="faceImage"
ref="faceImage"
onlyRead
/>
</div>
<div v-else></div>
</el-form-item>
<el-form-item label="展览图片" :label-width="formLabelWidth">
<div class="images-group" v-if="displayDetail.imagesVo.length > 0">
<ManualUploader
:files="images"
:fileLimit="20"
:fileSize="50"
listType="picture-card"
:fileType="['png', 'jpeg', 'jpg']"
ref="images"
onlyRead
/>
</div>
<div v-else></div>
</el-form-item>
<el-form-item label="展览音频" :label-width="formLabelWidth">
<div class="images-group" v-if="displayDetail.audiosVo.length > 0">
<ManualUploader
:files="audios"
:fileLimit="1"
:fileSize="50"
:fileType="['mp3']"
listType="card"
ref="audios"
onlyRead
/>
</div>
<div v-else></div>
</el-form-item>
<el-form-item label="展览视频" :label-width="formLabelWidth">
<div class="images-group" v-if="displayDetail.videosVo.length > 0">
<ManualUploader
:files="videos"
:fileLimit="6"
:fileSize="500"
:fileType="['mp4']"
listType="card"
ref="videos"
onlyRead
/>
</div>
<div v-else></div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-form-item label="展览单元" :label-width="formLabelWidth">
<ExhibitionUnit
:exhibitionUnits="displayDetail.exhibitionUnits"
:isDisableEvent="true"
ref="exhibitionUnits"
/>
</el-form-item>
</el-row>
</el-form>
</div>
</template>
<script>
import { themeTypeOptions } from "@/views/display/contants";
import ExhibitionUnit from "@/views/display/components/ExhibitionUnit.vue";
export default {
name: "BaseInfo",
components: {
ExhibitionUnit,
},
props: {
displayDetail: {
type: Object,
default: () => ({}),
},
dicts: {
type: Object,
default: () => ({}),
},
},
computed: {
themeTypeOptions() {
return themeTypeOptions;
},
},
watch: {
displayDetail: {
handler: function (value) {
if (Object.keys(value).length == 0) {
return;
}
// 回填媒体资源
if (
this.displayDetail.faceImageUrl ||
this.displayDetail.faceImagePressUrl
) {
this.faceImage = [
{
name: "",
url: this.displayDetail.faceImageUrl || "",
pressUrl:
this.displayDetail.faceImagePressUrl ||
this.displayDetail.faceImageUrl ||
"",
fileId: this.displayDetail.faceImage || "",
},
];
} else {
this.faceImage = [];
}
this.images = this.displayDetail.imagesVo || [];
this.videos = this.displayDetail.videosVo || [];
this.audios = this.displayDetail.audiosVo || [];
// 回填状态
this.displayDetail.status = Boolean(Number(this.displayDetail.status));
// 回填文献
this.literatureValues = [];
if (
this.displayDetail.literatureVo &&
this.displayDetail.literatureVo.length > 0
) {
this.literatureList = this.displayDetail.literatureVo;
this.displayDetail.literatureVo.forEach((lt) => {
if (this.literatureValues) {
this.literatureValues.push(lt.literatureId);
}
});
}
// 回填文物
this.crIds = [];
if (
this.displayDetail.culturalRelicVo &&
this.displayDetail.culturalRelicVo.length > 0
) {
this.crList = this.displayDetail.culturalRelicVo;
this.displayDetail.culturalRelicVo.forEach((cr) => {
if (this.crIds) {
this.crIds.push(cr.crId);
}
});
}
// 回填虚拟展厅
this.vrIds = [];
if (
this.displayDetail.virtualVo &&
this.displayDetail.virtualVo.length > 0
) {
this.vrList = this.displayDetail.virtualVo;
this.displayDetail.virtualVo.forEach((vr) => {
if (this.vrIds) {
this.vrIds.push(vr.bvId);
}
});
}
},
deep: true,
immediate: true,
},
},
data() {
return {
formLabelWidth: "100px",
orgTreeData: [],
regionTree: [],
optionProps: {
value: "id",
label: "name",
children: "children",
checkStrictly: true,
},
culturalRegionProps: {
value: "code",
label: "name",
children: "children",
checkStrictly: true,
},
faceImage: [],
images: [],
videos: [],
audios: [],
literatureList: [], //文献列表
literatureValues: [], //选中的文献列表
crList: [], //文物列表
crIds: [], //选中的文物列表
vrList: [], //虚拟展厅列表
vrIds: [],
};
},
async created() {
await this.$store.dispatch("dict/getDictList", [
"displayType",
"displayCharacter",
]);
this.$store.dispatch("org/getMuseumTreeData", false).then((res) => {
// this.orgTreeData = res[0].children; //去掉根节点的文旅厅
this.orgTreeData = res;
});
this.loadRegionTree();
},
methods: {
loadRegionTree() {
let parentId = "";
this.$store.dispatch("org/getSysRegionTreeData", parentId).then((res) => {
this.regionTree = res;
loopTree(this.regionTree);
function loopTree(arr) {
if (arr && arr.length > 0) {
arr.forEach((item) => {
if (item.children && item.children.length == 0) {
delete item.children;
} else {
loopTree(item.children);
}
});
}
}
});
},
},
};
</script>
<style lang="scss" scoped>
.img-container {
background-color: #fbfdff;
border: 1px dashed #c0ccda;
border-radius: 6px;
box-sizing: border-box;
width: 148px;
height: 148px;
cursor: pointer;
margin-right: 2px;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.images-group {
// width: 450px;
// display: flex;
// flex-wrap: wrap;
// padding-top: 10px;
}
.intro {
background-color: #f5f7fa;
border: 1px solid #e4e7ed;
color: #c0c4cc;
padding: 0 10px;
border-radius: 4px;
}
.base-info {
overflow-x: hidden;
}
</style>
<template>
<el-dialog
:visible.sync="dialogVisible"
width="80%"
:before-close="handleClose"
top="5vh"
lock-scroll
>
<div class="title" slot="title">
<div class="divider"></div>
<div class="label">{{ title }}</div>
</div>
<div class="dialog-content">
<el-tabs v-model="activeName" v-loading="dialogLoading">
<!-- <el-tab-pane label="基本信息" name="info">
<div class="container">
<BaseInfo :displayDetail="displayDetail" :dicts="dicts" />
</div>
</el-tab-pane> -->
<el-tab-pane label="效果预览" name="page" v-if="!isBoutique">
<div
class="container"
v-if="dicts && Object.keys(displayDetail).length > 0"
>
<NavBar />
<NormalStyle
v-if="displayDetail.themeType == '1'"
:displayDetail="displayDetail"
:dicts="dicts"
/>
<ChStyle
v-if="displayDetail.themeType == '2'"
:displayDetail="displayDetail"
:dicts="dicts"
/>
<RedStyle
v-if="displayDetail.themeType == '3'"
:displayDetail="displayDetail"
:dicts="dicts"
/>
<Footer />
</div>
</el-tab-pane>
<el-tab-pane label="审批历史记录" name="history">
<div class="container">
<el-steps :active="displayDetail.historyChecks.length">
<el-step
v-for="(item, index) in displayDetail.historyChecks"
:title="getStepTitle(item)"
:key="index"
:icon="getStepIcon(item)"
>
<div slot="description">
<div class="name">{{ item.createName }}</div>
<div class="time">{{ item.createTime }}</div>
<div class="desc">{{ item.remark }}</div>
</div>
</el-step>
</el-steps>
</div>
</el-tab-pane>
</el-tabs>
<div class="dialog-footer">
<span v-if="displayDetail.checkStatus == 0">
<el-button
size="mini"
@click.native="handleCancel"
style="margin-right: 6px"
>取消</el-button
>
<el-popover
placement="top-end"
width="400"
trigger="manual"
v-model="popoverVisible"
>
<div>
<el-form
size="mini"
:model="dialogForm"
prop="remark"
:rules="rules"
ref="form"
>
<el-form-item label="驳回意见" prop="remark">
<el-input
type="textarea"
placeholder="驳回意见"
v-model="dialogForm.remark"
size="mini"
:rows="4"
>
</el-input>
<el-button
size="mini"
type="primary"
style="float: right; margin-top: 16px"
@click.native="handleCheck(-2)"
>确定</el-button
>
</el-form-item>
</el-form>
</div>
<el-button
size="mini"
slot="reference"
type="danger"
icon="el-icon-close"
@click.native="handleShowPopover"
>驳回</el-button
>
</el-popover>
<el-button
size="mini"
style="margin-left: 6px"
type="primary"
icon="el-icon-check"
@click.native="handleCheck(1)"
>同意</el-button
>
</span>
<span v-else>
<el-button size="mini" type="primary" @click.native="handleClose">关闭</el-button>
</span>
</div>
</div>
</el-dialog>
</template>
<script>
import NormalStyle from "@/views/display/components/templates/NormalStyle.vue";
// import NormalStyle from "./components/NormalStyle.vue";
import ChStyle from "@/views/display/components/templates/ChStyle.vue";
import RedStyle from "@/views/display/components/templates/RedStyle.vue";
import BaseInfo from "./BaseInfo";
import { mapGetters } from "vuex";
import { postCheck } from "@/api/display";
import NavBar from "@/components/NavBar";
import Footer from "@/components/Footer";
import { titles } from "@/utils/boutiqueTitles";
export default {
name: "PreviewDialog",
components: {
NormalStyle,
ChStyle,
RedStyle,
BaseInfo,
NavBar,
Footer,
},
props: {
visible: {
type: Boolean,
default: false,
},
displayDetail: {
type: Object,
default: () => ({}),
},
loading: {
type: Boolean,
default: false,
},
},
computed: {
...mapGetters(["dicts"]),
title() {
return "审批——" + this.displayDetail.title;
},
getStepTitle(item) {
return (item) => {
switch (item.checkStatus) {
case 0:
return "发起审核";
case 1:
return "审核通过";
case -2:
return "驳回";
}
};
},
getStepIcon(item) {
return (item) => {
switch (item.checkStatus) {
case 0:
return "el-icon-s-promotion";
case 1:
return "el-icon-s-claim";
case -2:
return "el-icon-circle-close";
}
};
},
isBoutique() {
this.activeName = titles.includes(this.displayDetail.title)
? "history"
: "page";
return titles.includes(this.displayDetail.title);
},
},
watch: {
visible: {
handler: function (value) {
this.dialogVisible = value;
},
immediate: true,
deep: true,
},
loading(value) {
this.dialogLoading = value;
},
},
data() {
return {
dialogVisible: false,
dialogForm: {
remark: "", //驳回意见
},
activeName: "page",
historyChecks: [],
dialogLoading: false,
rules: {
remark: [
{
required: true,
message: "请输入驳回意见",
trigger: "blur",
},
],
},
popoverVisible: false,
};
},
async mounted() {
await this.$store.dispatch("dict/getDictList", [
"displayType",
"displayCharacter",
]);
},
methods: {
handleClose(done) {
this.$emit("handleClose");
this.activeName = titles.includes(this.displayDetail.title)
? "history"
: "page";
},
async handleCheck(checkStatus) {
if (checkStatus == -2) {
this.$refs.form.validate(async (valid) => {
if (valid) {
this.dialogLoading = true;
const params = {
sourceId: this.displayDetail.exhibitionId,
checkStatus,
remark: this.dialogForm.remark,
sourceType: "biz_exhibition",
sourceName: this.displayDetail.title,
};
let res = await postCheck(params);
if (res.code == 0) {
this.$message.success("操作成功!");
this.handleClose();
this.$emit("refresh");
this.$refs.form.resetFields();
}
this.dialogLoading = false;
this.popoverVisible = false;
}
});
} else {
this.dialogLoading = true;
const params = {
sourceId: this.displayDetail.exhibitionId,
checkStatus,
remark: this.dialogForm.remark,
sourceType: "biz_exhibition",
sourceName: this.displayDetail.title,
};
let res = await postCheck(params);
if (res.code == 0) {
this.$message.success("操作成功!");
this.handleClose();
this.$emit("refresh");
this.$refs.form.resetFields();
}
this.dialogLoading = false;
this.popoverVisible = false;
}
},
handleShowPopover() {
this.popoverVisible = true;
},
handleCancel() {
this.handleClose();
this.$emit("refresh");
this.$refs.form.resetFields();
this.popoverVisible = false;
this.dialogLoading = false;
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .el-step.is-horizontal {
max-width: 300px !important;
}
.title {
display: flex;
margin-bottom: 16px;
.divider {
width: 8px;
border-left: 4px solid #409eff;
margin-right: 8px;
}
.label {
font-weight: bold;
}
}
.dialog-content {
padding: 0 32px;
.container {
border: 1px dashed #409eff;
height: calc(64vh);
overflow: auto;
padding: 46px;
.desc {
color: #666 !important;
}
.name {
color: #333 !important;
}
.time {
color: #999 !important;
}
}
}
::v-deep .el-dialog__wrapper {
overflow: hidden !important;
}
::v-deep .el-step__title {
color: #333;
font-weight: bold;
}
// ::v-deep .el-dialog__body {
// position: relative;
// }
.dialog-footer {
display: flex;
justify-content: flex-end;
margin-top: 40px;
// position: absolute;
// width:100%;
bottom: 0;
position: sticky;
// height: 100px;
}
// ::v-deep .el-dialog__footer {
// position: sticky !important;
// }
.video-container {
background-color: #000;
display: flex;
justify-content: center;
}
.el-dialog__body {
padding: 0 20px 30px 20px;
}
</style>
export const displayTabletitle = [{
prop: "title",
label: "标题",
columnAlign: 'center',
showOverFlowToolTip: true,
},
// {
// prop: "keyword",
// label: "关键词",
// columnAlign: 'center',
// showOverFlowToolTip: true,
// },
{
prop: "deptName",
label: "展览单位",
columnAlign: 'center',
showOverFlowToolTip: true,
},
{
prop: "type",
label: "展览类型",
columnAlign: 'center',
isDisplayType: true,
showOverFlowToolTip: true,
},
{
prop: "faceImageUrl",
label: "封面",
columnAlign: 'center',
isFaceImage: true,
width: 130
},
{
prop: "checkStatus",
label: "状态",
columnAlign: 'center',
},
{
prop: "checkRemark",
label: "备注",
columnAlign: 'center',
showOverFlowToolTip: true,
},
]
export const operates = {
operate: true,
label: "操作",
width: "260px",
minwidth: "220px",
titleAlign: "center",
columnAlign: "center",
}
export const approvalOperations = [{
type: 'approval',
title: '审批'
}
]
export const viewOperations = [{
type: 'view',
title: '查看详情'
}
]
export const crTabletitle = [{
prop: "name",
label: "名称",
columnAlign: 'center',
showOverFlowToolTip: true,
},
// {
// prop: "level",
// label: "文物级别",
// columnAlign: 'center',
// },
// {
// prop: "detailSize",
// label: "尺寸",
// columnAlign: 'center',
// },
// {
// prop: "textureType",
// label: "质地",
// columnAlign: 'center',
// },
// {
// prop: "type",
// label: "类别",
// width: 100,
// columnAlign: 'center',
// isCulturalRelicType:true
// },
// {
// prop: "createId",
// label: "创建人",
// columnAlign: 'center',
// },
// {
// prop: "createTime",
// label: "创建时间",
// columnAlign: 'center',
// },
{
prop: "deptName",
label: "馆藏单位",
columnAlign: 'center',
showOverFlowToolTip: true,
},
{
prop: "regionName",
label: "所属地",
columnAlign: 'center',
showOverFlowToolTip: true,
},
// {
// prop: "intro",
// label: "馆藏介绍",
// columnAlign: 'center',
// showOverFlowToolTip: true,
// width: 120,
// },
{
prop: "themeWord",
label: "主题词",
columnAlign: 'center',
showOverFlowToolTip: true,
},
{
prop: "faceImageUrl",
label: "封面",
columnAlign: 'center',
isFaceImage: true,
},
{
prop: "status",
label: "上下架状态",
width: 100,
columnAlign: 'center',
isStatus: true
},
{
prop: "num",
label: "数量",
columnAlign: 'center',
},
{
prop: "sourceWay",
label: "来源方式",
columnAlign: 'center',
showOverFlowToolTip: true,
},
{
prop: "remark",
label: "备注",
columnAlign: 'center',
},
// directory 文件夹
// flag3d 是否有3d图片
// updateId 更新人
]
export const importOperates = {
operate: true,
label: "操作",
width: "220px",
minwidth: "220px",
titleAlign: "center",
columnAlign: "center",
}
export const importOperations = [{
type: 'delete',
title: '删除记录及文物'
},]
\ No newline at end of file
<template>
<div class="app-container">
<div class="top-bar">
<SearchBar :config="searchConfig" @search="search" @reset="reset" />
<!-- <el-button
type="primary"
@click.native="handleOperation({ type: 'add' })"
icon="el-icon-plus"
>
发布</el-button
>
</div> -->
</div>
<el-tabs v-model="activeName" type="border-card" ref="tabs">
<el-tab-pane
:label="item.label"
:name="item.name"
v-for="(item, tabIndex) in tabs"
:key="tabIndex"
>
<TablePage
:data="dataList[tabIndex].records"
:tableTitle="tableTitle"
:operates="tableOperates"
v-loading="loading"
>
<template v-slot:checkStatus="data">
<!-- {{ data.scope.checkStatus }} -->
<el-tag type="primary" v-if="data.scope.checkStatus == 0">
待审核
</el-tag>
<el-tag type="success" v-if="data.scope.checkStatus == 1">
已通过
</el-tag>
<el-tag type="danger" v-if="data.scope.checkStatus == -2">
已驳回
</el-tag>
</template>
<template v-slot:displayType="data">
{{ dicts.displayType[data.scope.type] }}
</template>
<template v-slot:faceImageUrl="data">
<img
:src="
$getFullUrl(
data.scope.faceImagePressUrl || data.scope.faceImageUrl
)
"
alt="暂无图片"
v-if="
$getFullUrl(
data.scope.faceImagePressUrl || data.scope.faceImageUrl
)
"
style="cursor: pointer"
width="100px"
@click="handelPreviewImages(data.scope.faceImageUrl)"
/>
</template>
<template v-slot:operates="scope">
<TableOperation
:operations="tableOperations"
:rawData="scope.scope.row"
@handleOperation="handleOperation"
>
</TableOperation>
</template>
</TablePage>
<el-pagination
style="margin: 16px 0"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="Number(dataList[currentTabIndex].current)"
:page-sizes="[10, 20, 50, 100]"
:page-size="Number(dataList[currentTabIndex].size)"
layout="total, sizes, prev, pager, next, jumper"
:total="Number(dataList[currentTabIndex].total)"
class="pagination"
>
</el-pagination>
</el-tab-pane>
</el-tabs>
<PreviewDisplayDialog
v-if="Object.keys(curPreviewObj).length > 0"
:visible="previewDialogVisible"
:displayDetail="curPreviewObj"
:loading="previewLoading"
@handleClose="handleClosePreviewDialog"
@refresh="loadData"
/>
<el-image-viewer
v-if="imgViewerVisible"
:on-close="closeImgViewer"
:url-list="imgList"
/>
</div>
</template>
<script>
import PreviewDisplayDialog from "./components/PreviewDisplayDialog.vue";
import {
displayTabletitle,
operates,
approvalOperations,
viewOperations,
} from "./config";
import { getListPer, getDisplayCheckById } from "@/api/display";
import { mapGetters } from "vuex";
export default {
components: {
PreviewDisplayDialog,
},
data() {
let that = this;
return {
dataList: [
{
record: [],
size: 10,
current: 1,
total: 0,
},
{
record: [],
size: 10,
current: 1,
total: 0,
},
{
record: [],
size: 10,
current: 1,
total: 0,
},
],
searchConfig: [
{
prop: "title",
type: "input",
label: "展览名称",
},
],
loading: false,
imgViewerVisible: false,
previewDialogVisible: false,
curPreviewObj: {}, //当前预览的对象
currentPageIds: [], //当前的id数组,用于给详情页切换用
tabs: [
{
name: "0",
label: "待审核",
},
{
name: "1",
label: "已通过",
},
{
name: "-2",
label: "已驳回",
},
],
activeName: "0",
currentTabIndex: 0,
dialogLoading: false,
};
},
computed: {
...mapGetters(["dicts"]),
tableTitle() {
return displayTabletitle;
},
tableOperates() {
return operates;
},
tableOperations() {
if (this.activeName == "0") {
return approvalOperations;
} else {
return viewOperations;
}
},
},
watch: {
activeName(value) {
this.currentTabIndex = Number(Math.abs(value)); //当前索引正好对应状态的绝对值
this.loadData();
},
},
async created() {
await this.$store.dispatch("dict/getDictList", ["displayType"]);
this.loadData();
},
methods: {
async search(form) {
var params = {
page: 1,
limit: this.dataList[this.currentTabIndex].size,
...form,
};
if (params.status == "") {
delete params.status;
}
let res = await getListPer(params);
if (res.code == 0) {
this.$set(this.dataList, this.currentTabIndex, res.data);
// this.dataList[this.currentTabIndex] = res.data
// this.currentPageIds = this.dataList[this.currentTabIndex].records.map((item) => {
// return item.exhibitionId;
// });
}
},
reset() {
this.loadData();
},
// 加载表格数据
async loadData() {
this.loading = true;
var params = {
page: this.dataList[this.currentTabIndex].current,
limit: this.dataList[this.currentTabIndex].size,
checkStatus: Number(this.activeName),
};
let res = await getListPer(params);
if (res.code == 0) {
this.$set(this.dataList, this.currentTabIndex, res.data);
// this.currentPageIds = this.dataList[this.currentTabIndex].records.map((item) => {
// return item.exhibitionId;
// });
}
this.loading = false;
},
async handleOperation(value, row) {
console.log(value, row);
// debugger
if (value.type == "approval" || value.type == "view") {
this.previewLoading = true;
if (row) {
this.previewDialogVisible = true;
let res = await getDisplayCheckById({
exhibitionId: row.exhibitionId,
});
this.curPreviewObj = res.data;
this.previewLoading = false;
}
}
},
// 多选
handleSelectionChange(val) {
this.multipleSelection = val;
},
// 改变页容量
handleSizeChange(value) {
this.dataList[this.currentTabIndex].size = value;
this.loadData();
},
// 改变当前显示页
handleCurrentChange(value) {
this.dataList[this.currentTabIndex].current = value;
this.loadData();
},
// 关闭Dialog
handleClose() {
this.editDialogVisible = false;
this.form = {
status: 1,
faceImage: "", // 封面(图片1张)
images: "", //展览图片
videos: "", //展览视频
audios: "", //展览音频
exhibitionUnits: [], //布展单元
};
},
// 关闭预览图片
closeImgViewer() {
this.imgViewerVisible = false;
},
// 预览图片
handelPreviewImages(images) {
this.imgViewerVisible = true;
this.imgList = [images];
},
handleClosePreviewDialog() {
this.previewDialogVisible = false;
},
},
};
</script>
<style lang="scss" scoped>
.top-bar {
display: flex;
justify-content: space-between;
flex-direction: column;
height: 68px;
}
.tools {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 14px;
.tools-item {
display: flex;
&:last-child {
justify-content: flex-end;
}
}
}
</style>
<template>
<el-dialog
:visible.sync="dialogVisible"
width="80%"
:before-close="handleClose"
top="5vh"
lock-scroll
>
<div class="title" slot="title">
<div class="divider"></div>
<div class="label">{{ title }}</div>
</div>
<div class="dialog-content">
<el-tabs v-model="activeName" v-loading="dialogLoading">
<!-- <el-tab-pane label="基本信息" name="info">
<div class="container">
<BaseInfo :displayDetail="displayDetail" :dicts="dicts" />
</div>
</el-tab-pane> -->
<el-tab-pane label="效果预览" name="page" v-if="!isBoutique">
<div
class="container"
v-if="dicts && Object.keys(displayDetail).length > 0"
>
<NavBar />
<NormalStyle
v-if="displayDetail.themeType == '1'"
:displayDetail="displayDetail"
:dicts="dicts"
/>
<ChStyle
v-if="displayDetail.themeType == '2'"
:displayDetail="displayDetail"
:dicts="dicts"
/>
<RedStyle
v-if="displayDetail.themeType == '3'"
:displayDetail="displayDetail"
:dicts="dicts"
/>
<Footer />
</div>
</el-tab-pane>
<el-tab-pane label="审批历史记录" name="history">
<div class="container">
<el-steps :active="displayDetail.historyChecks.length">
<el-step
v-for="(item, index) in displayDetail.historyChecks"
:title="getStepTitle(item)"
:key="index"
:icon="getStepIcon(item)"
>
<div slot="description">
<div class="name">{{ item.createName }}</div>
<div class="time">{{ item.createTime }}</div>
<div class="desc">{{ item.remark }}</div>
</div>
</el-step>
</el-steps>
</div>
</el-tab-pane>
</el-tabs>
<div class="dialog-footer">
<span v-if="displayDetail.checkStatus == 0">
<el-button
size="mini"
@click.native="handleCancel"
style="margin-right: 6px"
>取消</el-button
>
<el-popover
placement="top-end"
width="400"
trigger="manual"
v-model="popoverVisible"
>
<div>
<el-form
size="mini"
:model="dialogForm"
prop="remark"
:rules="rules"
ref="form"
>
<el-form-item label="驳回意见" prop="remark">
<el-input
type="textarea"
placeholder="驳回意见"
v-model="dialogForm.remark"
size="mini"
:rows="4"
>
</el-input>
<el-button
size="mini"
type="primary"
style="float: right; margin-top: 16px"
@click.native="handleCheck(-2)"
>确定</el-button
>
</el-form-item>
</el-form>
</div>
<el-button
size="mini"
slot="reference"
type="danger"
icon="el-icon-close"
@click.native="handleShowPopover"
>驳回</el-button
>
</el-popover>
<el-button
size="mini"
style="margin-left: 6px"
type="primary"
icon="el-icon-check"
@click.native="handleCheck(1)"
>同意</el-button
>
</span>
<span v-else>
<el-button size="mini" type="primary" @click.native="handleClose">关闭</el-button>
</span>
</div>
</div>
</el-dialog>
</template>
<script>
import NormalStyle from "@/views/display/components/templates/NormalStyle.vue";
// import NormalStyle from "./components/NormalStyle.vue";
import ChStyle from "@/views/display/components/templates/ChStyle.vue";
import RedStyle from "@/views/display/components/templates/RedStyle.vue";
import BaseInfo from "./BaseInfo";
import { mapGetters } from "vuex";
import { postCheck } from "@/api/display";
import NavBar from "@/components/NavBar";
import Footer from "@/components/Footer";
import { titles } from "@/utils/boutiqueTitles";
export default {
name: "PreviewDialog",
components: {
NormalStyle,
ChStyle,
RedStyle,
BaseInfo,
NavBar,
Footer,
},
props: {
visible: {
type: Boolean,
default: false,
},
displayDetail: {
type: Object,
default: () => ({}),
},
loading: {
type: Boolean,
default: false,
},
},
computed: {
...mapGetters(["dicts"]),
title() {
return "审批——" + this.displayDetail.title;
},
getStepTitle(item) {
return (item) => {
switch (item.checkStatus) {
case 0:
return "发起审核";
case 1:
return "审核通过";
case -2:
return "驳回";
}
};
},
getStepIcon(item) {
return (item) => {
switch (item.checkStatus) {
case 0:
return "el-icon-s-promotion";
case 1:
return "el-icon-s-claim";
case -2:
return "el-icon-circle-close";
}
};
},
isBoutique() {
this.activeName = titles.includes(this.displayDetail.title)
? "history"
: "page";
return titles.includes(this.displayDetail.title);
},
},
watch: {
visible: {
handler: function (value) {
this.dialogVisible = value;
},
immediate: true,
deep: true,
},
loading(value) {
this.dialogLoading = value;
},
},
data() {
return {
dialogVisible: false,
dialogForm: {
remark: "", //驳回意见
},
activeName: "page",
historyChecks: [],
dialogLoading: false,
rules: {
remark: [
{
required: true,
message: "请输入驳回意见",
trigger: "blur",
},
],
},
popoverVisible: false,
};
},
async mounted() {
await this.$store.dispatch("dict/getDictList", [
"displayType",
"displayCharacter",
]);
},
methods: {
handleClose(done) {
this.$emit("handleClose");
this.activeName = titles.includes(this.displayDetail.title)
? "history"
: "page";
},
async handleCheck(checkStatus) {
if (checkStatus == -2) {
this.$refs.form.validate(async (valid) => {
if (valid) {
this.dialogLoading = true;
const params = {
sourceId: this.displayDetail.exhibitionId,
checkStatus,
remark: this.dialogForm.remark,
sourceType: "biz_exhibition",
sourceName: this.displayDetail.title,
};
let res = await postCheck(params);
if (res.code == 0) {
this.$message.success("操作成功!");
this.handleClose();
this.$emit("refresh");
this.$refs.form.resetFields();
}
this.dialogLoading = false;
this.popoverVisible = false;
}
});
} else {
this.dialogLoading = true;
const params = {
sourceId: this.displayDetail.exhibitionId,
checkStatus,
remark: this.dialogForm.remark,
sourceType: "biz_exhibition",
sourceName: this.displayDetail.title,
};
let res = await postCheck(params);
if (res.code == 0) {
this.$message.success("操作成功!");
this.handleClose();
this.$emit("refresh");
this.$refs.form.resetFields();
}
this.dialogLoading = false;
this.popoverVisible = false;
}
},
handleShowPopover() {
this.popoverVisible = true;
},
handleCancel() {
this.handleClose();
this.$emit("refresh");
this.$refs.form.resetFields();
this.popoverVisible = false;
this.dialogLoading = false;
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .el-step.is-horizontal {
max-width: 300px !important;
}
.title {
display: flex;
margin-bottom: 16px;
.divider {
width: 8px;
border-left: 4px solid #409eff;
margin-right: 8px;
}
.label {
font-weight: bold;
}
}
.dialog-content {
padding: 0 32px;
.container {
border: 1px dashed #409eff;
height: calc(64vh);
overflow: auto;
padding: 46px;
.desc {
color: #666 !important;
}
.name {
color: #333 !important;
}
.time {
color: #999 !important;
}
}
}
::v-deep .el-dialog__wrapper {
overflow: hidden !important;
}
::v-deep .el-step__title {
color: #333;
font-weight: bold;
}
// ::v-deep .el-dialog__body {
// position: relative;
// }
.dialog-footer {
display: flex;
justify-content: flex-end;
margin-top: 40px;
// position: absolute;
// width:100%;
bottom: 0;
position: sticky;
// height: 100px;
}
// ::v-deep .el-dialog__footer {
// position: sticky !important;
// }
.video-container {
background-color: #000;
display: flex;
justify-content: center;
}
.el-dialog__body {
padding: 0 20px 30px 20px;
}
</style>
...@@ -293,9 +293,14 @@ export const approvleTableTitle = [ ...@@ -293,9 +293,14 @@ export const approvleTableTitle = [
label: "创建人", label: "创建人",
columnAlign: 'center', columnAlign: 'center',
}, },
// {
// prop: "createTime",
// label: "创建时间",
// columnAlign: 'center',
// },
{ {
prop: "createTime", prop: "updateTime",
label: "创建时间", label: "更新时间",
columnAlign: 'center', columnAlign: 'center',
}, },
{ {
......
...@@ -9,26 +9,20 @@ ...@@ -9,26 +9,20 @@
:operates="operates" :operates="operates"
v-loading="loading" v-loading="loading"
> >
<template v-slot:checkStatus="data"> <template v-slot:checkStatus="{ scope }">
<el-tag <el-tag
:type=" :type="
$constantsTool.getTagTypeByValue( $constantsTool.getTagTypeByValue('checkStatus', scope.checkStatus)
'checkStatus',
data.scope.checkStatus
)
" "
>{{ >{{
$constantsTool.getLabelByValue( $constantsTool.getLabelByValue("checkStatus", scope.checkStatus)
"checkStatus",
data.scope.checkStatus
)
}}</el-tag }}</el-tag
> >
</template> </template>
<template v-slot:operates="scope"> <template v-slot:operates="{ scope }">
<TableOperation <TableOperation
:operations="getOperation(scope.scope.row)" :operations="getOperation(scope)"
:rawData="scope.scope.row" :rawData="scope"
@handleOperation="handleOperation" @handleOperation="handleOperation"
> >
</TableOperation> </TableOperation>
...@@ -306,13 +300,13 @@ export default { ...@@ -306,13 +300,13 @@ export default {
// 改变页容量 // 改变页容量
handleSizeChange(value) { handleSizeChange(value) {
this.list[this.currentTabIndex].size = value; this.list.size = value;
this.loadData(); this.loadData();
}, },
// 改变当前显示页 // 改变当前显示页
handleCurrentChange(value) { handleCurrentChange(value) {
this.list[this.currentTabIndex].current = value; this.list.current = value;
this.loadData(); this.loadData();
}, },
// 关闭预览图片 // 关闭预览图片
......
...@@ -19,22 +19,22 @@ ...@@ -19,22 +19,22 @@
:operates="tableOperates" :operates="tableOperates"
v-loading="loading" v-loading="loading"
> >
<template v-slot:status="data"> <template v-slot:status="{ scope }">
<el-popconfirm <el-popconfirm
:title="getStatusTitle(data.scope.status)" :title="getStatusTitle(scope.status)"
@confirm="handleChangeStatus(data.scope)" @confirm="handleChangeStatus(scope)"
> >
<el-switch <el-switch
slot="reference" slot="reference"
:value="Boolean(Number(data.scope.status))" :value="Boolean(Number(scope.status))"
></el-switch> ></el-switch>
</el-popconfirm> </el-popconfirm>
</template> </template>
<template v-slot:operates="scope"> <template v-slot:operates="{ scope }">
<TableOperation <TableOperation
:operations="tableOperations" :operations="tableOperations"
:rawData="scope.scope.row" :rawData="row"
@handleOperation="handleOperation" @handleOperation="handleOperation"
> >
</TableOperation> </TableOperation>
...@@ -230,18 +230,8 @@ export default { ...@@ -230,18 +230,8 @@ export default {
}, },
async handleChangeStatus(row) { async handleChangeStatus(row) {
console.log("status", row); const callback = this.loadData;
const { status } = row; this.$bizCommon.changeStatus(row, editLiterature, callback);
let newStatus = status === "0" ? "1" : "0";
const params = {
...row,
status: newStatus,
};
let res = await editLiterature(params);
if (res.code == 0) {
this.loadData();
this.$message.success("修改成功!");
}
}, },
// 改变页容量 // 改变页容量
......
<template>
<el-dialog
:visible.sync="visible"
top="3vh"
:before-close="handleClose"
lock-scroll
width="65vw"
>
<div class="title" slot="title">
<div class="divider"></div>
<div class="label">抠图详情</div>
</div>
<div class="dialog-content"></div>
</el-dialog>
</template>
<script>
export default {
name: "PreviewDialog",
components: {},
props: {
detail: {
type: Object,
default: () => ({}),
},
},
computed: {},
data() {
return {
visible: false,
};
},
methods: {
handleClose(done) {
this.visible = false;
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .el-tabs__content {
max-height: 64vh;
overflow: auto;
}
</style>
// 文物分页的配置
export const tableTitle = [{
prop: "title",
label: "上传标题",
columnAlign: 'center',
showOverFlowToolTip: true,
},
{
prop: "name",
label: "上传文件(包)名",
columnAlign: 'center',
showOverFlowToolTip: true,
},
{
prop: "deptName",
label: "单位",
columnAlign: 'center',
isFaceImage: true,
},
{
prop: "status",
label: "状态",
width: 100,
columnAlign: 'center',
isStatus: true
},
{
prop: "createTime",
label: "创建时间",
columnAlign: 'center',
},
{
prop: "createName",
label: "创建人",
columnAlign: 'center',
showOverFlowToolTip: true,
},
{
prop: "remark",
label: "备注",
columnAlign: 'center',
},
]
export const operates = {
operate: true,
label: "操作",
titleAlign: "center",
columnAlign: "center",
width: "280px",
}
export const operations = [
{
type: 'view',
title: '查看详情',
perms: 'bizCulturalRelic:list',//暂时使用展览的列表
},
{
type: 'download',
title: '下载',
perms: 'bizCulturalRelic:list',//暂时使用展览的列表
},
{
type: 'delete',
title: '删除',
perms: 'bizCulturalRelic:delete',//暂时使用展览的列表
},
]
// 搜索配置
export const searchConfig = [
{
prop: "name",
type: "input",
label: "标题",
},
{
prop: "status",
type: "select",
label: "状态",
selectOptions: [
{
label: "已完成",
value: "1",
},
{
label: "处理中",
value: "0",
},
{
label: "已失败",
value: "-1",
}
],
},
]
<template>
<div class="app-container" v-loading="loading">
<SearchBar
:config="searchConfig"
@search="search"
@reset="reset"
class="search-bar"
/>
<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
perms="bizCulturalRelic:add"
type="primary"
size="mini"
icon="el-icon-upload2"
>
上传<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-menu>
</el-dropdown>
</div>
</div>
<div class="list">
<TablePage
:data="list.records"
:tableTitle="tableTitle"
:operates="operates"
>
<template v-slot:status="{ scope }">
<el-tag
:type="
$constantsTool.getTagTypeByValue('mattingStatus', scope.status)
"
>
{{ $constantsTool.getLabelByValue("mattingStatus", scope.status) }}
</el-tag>
</template>
<template v-slot:operates="{ scope }">
<TableOperation
:operations="operations"
:rawData="scope"
@handleOperation="handleOperation"
></TableOperation>
</template>
</TablePage>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="Number(list.current)"
:page-sizes="[10, 20, 40, 50]"
:page-size="Number(list.size)"
layout="total, sizes, prev, pager, next, jumper"
:total="Number(list.total)"
class="pagination"
>
</el-pagination>
<UploadDialog
ref="UploadDialog"
bizType="biz_matting"
@update="loadData"
:fileType="currentUploadType"
/>
<PreviewDialog ref="PreviewDialog" :detail="currentPreviewItem" />
</div>
<el-image-viewer
v-if="imgViewerVisible"
:on-close="closeImgViewer"
:url-list="imgList"
/>
</div>
</template>
<script>
import { operates, operations, tableTitle, searchConfig } from "./configs/list";
import { records } from "./mock";
import UploadDialog from "@/components/UploadDialog";
import PreviewDialog from "./components/PreviewDialog";
export default {
components: {
UploadDialog,
PreviewDialog,
},
data() {
return {
list: {
records,
size: 10,
current: 1,
total: 0,
},
searchConfig,
loading: false,
imgViewerVisible: false,
importRecordVisible: false, //上传记录
imgList: [],
operates,
operations,
tableTitle,
currentUploadType: ".zip", //当前上传的文件类型
currentPreviewItem: {}, //当前点击的表格项目
};
},
async created() {
// this.loadData();
},
methods: {
async search(form) {
this.resetPage();
this.loadData(form);
},
// 清除分页到初始状态
resetPage() {
this.list.current = 1;
},
reset() {
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);
// }
},
handleCommand(type) {
this.currentUploadType = type;
this.openDialog("UploadDialog");
},
openDialog(refName) {
this.$refs[refName].visible = true;
},
async handleOperation(value, row) {
switch (value.type) {
case "view":
console.log("view");
this.currentPreviewItem = row;
break;
case "download":
console.log("download");
break;
case "delete":
console.log("delete");
break;
}
},
// 关闭预览图片
closeImgViewer() {
this.imgViewerVisible = false;
},
// 预览图片
handelPreviewImages(images) {
this.imgViewerVisible = true;
this.imgList = [images];
},
// 多选
handleSelectionChange(val) {
this.multipleSelection = val;
},
// 改变页容量
handleSizeChange(value) {
this.list.size = value;
this.loadData();
},
// 改变当前显示页
handleCurrentChange(value) {
this.list.current = value;
this.loadData();
},
// 关闭导入记录弹窗
handleImportRecordClose() {
this.importRecordVisible = false;
},
},
};
</script>
<style lang="scss" scoped>
.app-container {
display: flex;
flex-direction: column;
}
.search-bar {
margin-bottom: 16px;
}
.tools {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 14px;
.tools-item {
display: flex;
&:last-child {
justify-content: flex-end;
}
}
.upload-button {
margin: 0 10px;
}
}
.pagination {
margin: 16px;
display: flex;
justify-content: right;
}
</style>
// status 0-待处理 1-已处理 2-处理失败
export const records = [
{
title: "图片抠图",
name: "img.png",
deptName: "贵州省文旅厅",
status: 0,
createTime: "2023-10-23 14:13:00",
createName: "admin",
},
{
title: "批量图片抠图",
name: "imgs.zip",
deptName: "贵州省文旅厅",
status: 1,
createTime: "2023-10-23 14:14:00",
createName: "admin",
},
{
title: "批量图片抠图2",
name: "imgs.zip",
deptName: "贵州省文旅厅",
status: -1,
createTime: "2023-10-23 13:14:00",
createName: "admin",
},
]
\ No newline at end of file
...@@ -282,21 +282,8 @@ export default { ...@@ -282,21 +282,8 @@ export default {
} }
}, },
async handleChangeStatus(row) { async handleChangeStatus(row) {
// debugger const callback = this.loadData;
this.$bizCommon.changeStatus(row, editMuseum, callback);
const { status } = row;
let newStatus = status ? "0" : "1";
const params = {
...row,
status: newStatus,
};
// console.log(params);
// return
let res = await editMuseum(params);
if (res.code == 0) {
this.loadData(true);
this.$message.success("修改成功!");
}
}, },
// 多选 // 多选
handleSelectionChange(val) { handleSelectionChange(val) {
......
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
:operates="tableOperates" :operates="tableOperates"
v-loading="loading" v-loading="loading"
> >
<template v-slot:images="data"> <template v-slot:images="{ scope }">
<img <img
:src="$getFullUrl(data.scope.imagesVo[0].pressUrl)" :src="$getFullUrl(scope.imagesVo[0].pressUrl)"
alt="暂无图片" alt="暂无图片"
v-if="data.scope.imagesVo.length > 0" v-if="scope.imagesVo.length > 0"
style=" style="
cursor: pointer; cursor: pointer;
height: 100px; height: 100px;
...@@ -31,27 +31,25 @@ ...@@ -31,27 +31,25 @@
object-fit: contain; object-fit: contain;
" "
width="100px" width="100px"
@click=" @click="handelPreviewImages($getFullUrl(scope.imagesVo[0].pressUrl))"
handelPreviewImages($getFullUrl(data.scope.imagesVo[0].pressUrl))
"
/> />
</template> </template>
<template v-slot:status="data"> <template v-slot:status="{ scope }">
<el-popconfirm <el-popconfirm
:title="getStatusTitle(data.scope.status)" :title="getStatusTitle(scope.status)"
@confirm="handleChangeStatus(data.scope)" @confirm="handleChangeStatus(scope)"
> >
<el-switch <el-switch
slot="reference" slot="reference"
:value="Boolean(Number(data.scope.status))" :value="Boolean(Number(scope.status))"
></el-switch> ></el-switch>
</el-popconfirm> </el-popconfirm>
</template> </template>
<template v-slot:operates="scope"> <template v-slot:operates="{ scope }">
<TableOperation <TableOperation
:operations="tableOperations" :operations="tableOperations"
:rawData="scope.scope.row" :rawData="scope"
@handleOperation="handleOperation" @handleOperation="handleOperation"
> >
</TableOperation> </TableOperation>
...@@ -85,7 +83,7 @@ ...@@ -85,7 +83,7 @@
<script> <script>
import { title, operates, operations } from "./config"; import { title, operates, operations } from "./config";
import { getCcProduct, deleteCcProduct } from "@/api/literature"; import { getCcProduct, deleteCcProduct, updateCcProduct } from "@/api/product";
import InfoEditDialog from "./components/InfoEditDialog"; import InfoEditDialog from "./components/InfoEditDialog";
export default { export default {
...@@ -235,20 +233,10 @@ export default { ...@@ -235,20 +233,10 @@ export default {
this.imgList = [images]; this.imgList = [images];
} }
}, },
// 修改状态
async handleChangeStatus(row) { async handleChangeStatus(row) {
console.log("status", row); const callback = this.loadData;
const { status } = row; this.$bizCommon.changeStatus(row, updateCcProduct, callback);
let newStatus = status === "0" ? "1" : "0";
const params = {
...row,
status: newStatus,
};
// let res = await editVirtual(params);
// if (res.code == 0) {
// this.loadData();
// this.$message.success("修改成功!");
// }
}, },
// 多选 // 多选
handleSelectionChange(val) { handleSelectionChange(val) {
......
...@@ -19,22 +19,22 @@ ...@@ -19,22 +19,22 @@
:operates="tableOperates" :operates="tableOperates"
v-loading="loading" v-loading="loading"
> >
<template v-slot:status="data"> <template v-slot:status="{ scope }">
<el-popconfirm <el-popconfirm
:title="getStatusTitle(data.scope.status)" :title="getStatusTitle(scope.status)"
@confirm="handleChangeStatus(data.scope)" @confirm="handleChangeStatus(scope)"
> >
<el-switch <el-switch
slot="reference" slot="reference"
:value="Boolean(Number(data.scope.status))" :value="Boolean(Number(scope.status))"
></el-switch> ></el-switch>
</el-popconfirm> </el-popconfirm>
</template> </template>
<template v-slot:operates="scope"> <template v-slot:operates="{ scope }">
<TableOperation <TableOperation
:operations="tableOperations" :operations="tableOperations"
:rawData="scope.scope.row" :rawData="scope"
@handleOperation="handleOperation" @handleOperation="handleOperation"
></TableOperation> ></TableOperation>
</template> </template>
...@@ -212,17 +212,8 @@ export default { ...@@ -212,17 +212,8 @@ export default {
}, },
async handleChangeStatus(row) { async handleChangeStatus(row) {
const { status } = row; const callback = this.loadData;
let newStatus = status === "0" ? "1" : "0"; this.$bizCommon.changeStatus(row, upadateRole, callback);
const params = {
...row,
status: newStatus,
};
let res = await upadateRole(params);
if (res.code == 0) {
this.loadData();
this.$message.success("修改成功!");
}
}, },
// 改变页容量 // 改变页容量
......
...@@ -33,22 +33,22 @@ ...@@ -33,22 +33,22 @@
:operates="tableOperates" :operates="tableOperates"
v-loading="loading" v-loading="loading"
> >
<template v-slot:status="data"> <template v-slot:status="{ scope }">
<el-popconfirm <el-popconfirm
:title="getStatusTitle(data.scope.status)" :title="getStatusTitle(scope.status)"
@confirm="handleChangeStatus(data.scope)" @confirm="handleChangeStatus(scope)"
> >
<el-switch <el-switch
slot="reference" slot="reference"
:value="Boolean(Number(data.scope.status))" :value="Boolean(Number(scope.status))"
></el-switch> ></el-switch>
</el-popconfirm> </el-popconfirm>
</template> </template>
<template v-slot:operates="scope"> <template v-slot:operates="{ scope }">
<TableOperation <TableOperation
:operations="tableOperations" :operations="tableOperations"
:rawData="scope.scope.row" :rawData="scope"
@handleOperation="handleOperation" @handleOperation="handleOperation"
> >
</TableOperation> </TableOperation>
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
:form="form" :form="form"
:orgTreeData="treeData" :orgTreeData="treeData"
@handleClose="handleClose" @handleClose="handleClose"
@refresh="loadListData" @refresh="loadData"
/> />
<EditRole <EditRole
:visible="editRoleVisible" :visible="editRoleVisible"
...@@ -96,6 +96,7 @@ import { ...@@ -96,6 +96,7 @@ import {
deleteUser, deleteUser,
getUserOwnRoles, getUserOwnRoles,
getUserOwnRolesV1, getUserOwnRolesV1,
upadateUser,
} from "@/api/user"; } from "@/api/user";
import InfoEditDialog from "./components/InfoEditDialog.vue"; import InfoEditDialog from "./components/InfoEditDialog.vue";
import EditRole from "./components/EditRole.vue"; import EditRole from "./components/EditRole.vue";
...@@ -181,11 +182,11 @@ export default { ...@@ -181,11 +182,11 @@ export default {
if (res.code == 0) { if (res.code == 0) {
this.treeData = res.data[0].children; //去除默认顶级部门 this.treeData = res.data[0].children; //去除默认顶级部门
this.currentDeptNo = this.treeData[0].deptNo; this.currentDeptNo = this.treeData[0].deptNo;
this.loadListData(); this.loadData();
} }
}, },
// 加载表格数据 // 加载表格数据
async loadListData() { async loadData() {
this.loading = true; this.loading = true;
var params = { var params = {
page: this.list.current, page: this.list.current,
...@@ -212,28 +213,27 @@ export default { ...@@ -212,28 +213,27 @@ export default {
} }
}, },
reset() { reset() {
this.loadListData(); this.loadData();
}, },
handleNodeClick(e) { handleNodeClick(e) {
const { deptNo } = e; const { deptNo } = e;
this.currentDeptNo = deptNo; this.currentDeptNo = deptNo;
this.loadListData(); this.loadData();
}, },
// 改变页容量 // 改变页容量
handleSizeChange(value) { handleSizeChange(value) {
this.list.size = value; this.list.size = value;
this.loadListData(); this.loadData();
}, },
// 改变当前显示页 // 改变当前显示页
handleCurrentChange(value) { handleCurrentChange(value) {
this.list.current = value; this.list.current = value;
this.loadListData(); this.loadData();
}, },
async handleOperation(value, row) { async handleOperation(value, row) {
console.log("handleOperation", value, row);
switch (value.type) { switch (value.type) {
case "add": case "add":
this.dialogVisible = true; this.dialogVisible = true;
...@@ -246,7 +246,7 @@ export default { ...@@ -246,7 +246,7 @@ export default {
let deleteRes = await deleteUser([row.id]); let deleteRes = await deleteUser([row.id]);
if (deleteRes.code == 0) { if (deleteRes.code == 0) {
this.$message.success("删除成功!"); this.$message.success("删除成功!");
this.loadListData(); this.loadData();
} }
break; break;
case "editRole": case "editRole":
...@@ -263,6 +263,11 @@ export default { ...@@ -263,6 +263,11 @@ export default {
} }
}, },
handleChangeStatus(row) {
const callback = this.loadData;
this.$bizCommon.changeStatus(row, upadateUser, callback);
},
handleClose() { handleClose() {
this.dialogVisible = false; this.dialogVisible = false;
this.form = { this.form = {
......
...@@ -19,32 +19,32 @@ ...@@ -19,32 +19,32 @@
:operates="tableOperates" :operates="tableOperates"
v-loading="loading" v-loading="loading"
> >
<template v-slot:faceImageUrl="data"> <template v-slot:faceImageUrl="{ scope }">
<img <img
:src="data.scope.faceImageUrl" :src="scope.faceImageUrl"
alt="暂无图片" alt="暂无图片"
v-if="data.scope.faceImageUrl" v-if="scope.faceImageUrl"
style="cursor: pointer" style="cursor: pointer"
width="100px" width="100px"
@click="handelPreviewImages(data.scope.faceImageUrl)" @click="handelPreviewImages(scope.faceImageUrl)"
/> />
</template> </template>
<template v-slot:status="data"> <template v-slot:status="{ scope }">
<el-popconfirm <el-popconfirm
:title="getStatusTitle(data.scope.status)" :title="getStatusTitle(scope.status)"
@confirm="handleChangeStatus(data.scope)" @confirm="handleChangeStatus(scope)"
> >
<el-switch <el-switch
slot="reference" slot="reference"
:value="Boolean(Number(data.scope.status))" :value="Boolean(Number(scope.status))"
></el-switch> ></el-switch>
</el-popconfirm> </el-popconfirm>
</template> </template>
<template v-slot:operates="scope"> <template v-slot:operates="{ scope }">
<TableOperation <TableOperation
:operations="tableOperations" :operations="tableOperations"
:rawData="scope.scope.row" :rawData="scope"
@handleOperation="handleOperation" @handleOperation="handleOperation"
> >
</TableOperation> </TableOperation>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论