初始化

This commit is contained in:
砂糖
2025-11-08 10:38:36 +08:00
commit 3beeec7296
1626 changed files with 198488 additions and 0 deletions

View File

@@ -0,0 +1,306 @@
<template>
<div>
<el-dialog
:close-on-click-modal="false"
title="分组管理"
:visible.sync="formVisible"
:append-to-body="true"
custom-class="bs-el-dialog"
destroy-on-close
class="bs-dialog-wrap bs-el-dialog catalog-edit-wrap"
>
<el-form
v-if="formVisible"
ref="dataForm"
label-position="right"
label-width="100px"
class="bs-el-form"
>
<div class="top-search-wrap">
<el-input
v-model="searchKey"
class="bs-el-input"
placeholder="请输入分组名称"
prefix-icon="el-icon-search"
clearable
@clear="reSearch"
@keyup.enter.native="reSearch"
/>
<el-button
type="primary"
@click="reSearch"
>
搜索
</el-button>
<el-button
type="primary"
@click="addCatalog"
>
新增
</el-button>
</div>
<el-table
:key="randomKey"
max-height="400"
class="bs-el-table"
:data="tableList"
>
<el-empty />
<el-table-column
show-overflow-tooltip
label="分组名称"
prop="name"
align="center"
/>
<el-table-column
show-overflow-tooltip
label="排序"
prop="orderNum"
align="center"
/>
<el-table-column
label="操作"
width="150"
align="center"
>
<template slot-scope="scope">
<el-button
type="text"
@click="editCatalog(scope.row)"
>
编辑
</el-button>
<el-button
type="text"
@click="catalogDel(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form>
</el-dialog>
<!-- 新增或编辑目录弹窗 -->
<el-dialog
:title="currentCatalog.code ? '编辑分组' : '新增分组'"
:visible.sync="catalogVisible"
custom-class="bs-el-dialog"
width="30%"
class="bs-dialog-wrap bs-el-dialog"
@close="handleClose"
>
<el-form
ref="form"
:model="currentCatalog"
label-width="80px"
:rules="formRules"
class="bs-el-form"
>
<el-form-item
label="分组名称"
prop="name"
>
<el-input
v-model.trim="currentCatalog.name"
class="bs-el-input"
clearable
/>
</el-form-item>
<el-form-item label="排序">
<el-input-number
v-model="currentCatalog.orderNum"
:min="0"
:max="30000"
controls-position="right"
class="bs-el-input-number"
/>
</el-form-item>
</el-form>
<span
slot="footer"
class="dialog-footer"
>
<el-button
class="bs-el-button-default"
@click="catalogVisible = false"
>
取消
</el-button>
<el-button
type="primary"
@click="addOrEditCatalog"
>
确定
</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import cloneDeep from 'lodash/cloneDeep'
export default {
name: 'CatalogEditForm',
components: {
},
props: {
catalogType: {
type: String,
default: ''
}
},
data () {
// 检验分组名称是否重复
const validateName = (rule, value, callback) => {
this.$dataRoomAxios.post('/bigScreen/type/nameRepeat', {
id: this.currentCatalog.id,
name: value,
type: this.catalogType
}, true).then((r) => {
if (r.data) {
callback(new Error('分组名称已存在'))
} else {
callback()
}
})
}
return {
dataList: [], // 模糊查询时用来给数据备份
tableList: [],
randomKey: '',
searchKey: '', // 分组查询
catalogVisible: false,
currentCatalog: {},
formVisible: false,
formRules: {
name: [
{ required: true, message: '分组名称不能为空', trigger: 'blur' },
{ validator: validateName, trigger: 'blur' }
]
}
}
},
computed: {
},
watch: {
catalogType () {
this.getCatalogList()
}
},
mounted () {
this.getCatalogList()
},
methods: {
reSearch () {
const arr = this.dataList
this.tableList = arr?.filter((item) => item.name?.indexOf(this.searchKey) !== -1)
},
// 获取分组列表
getCatalogList () {
this.$dataRoomAxios.get(`/bigScreen/type/list/${this.catalogType}`)
.then((data) => {
this.tableList = data
this.dataList = data
this.$emit('updateCatalogList', data)
})
.catch(() => { })
},
// 新增编辑目录(点击确定)
addOrEditCatalog () {
this.$refs.form.validate(async (valid) => {
if (!valid) {
return
}
if (!this.currentCatalog.id) {
this.$dataRoomAxios.post('/bigScreen/type/add',
{
...this.currentCatalog,
type: this.catalogType
}).then(data => {
this.catalogVisible = false
this.getCatalogList()
}).catch(() => {
})
} else {
this.$dataRoomAxios.post('/bigScreen/type/update', { ...this.currentCatalog, type: this.catalogType }).then(data => {
this.catalogVisible = false
this.getCatalogList()
}).catch(() => {
})
}
})
},
addCatalog () {
this.currentCatalog = {
name: '',
id: '',
code: '',
orderNum: 0
}
this.catalogVisible = true
},
editCatalog (row) {
this.currentCatalog = cloneDeep(row)
this.catalogVisible = true
},
// 删除目录
catalogDel (catalog) {
this.$confirm('分组删除后,分组下的组件会被归纳至全部中,确定删除该分组?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
customClass: 'bs-el-message-box'
}).then(async () => {
this.$dataRoomAxios.post(`/bigScreen/type/delete/${catalog.id}`).then(() => {
this.$message({
type: 'success',
message: '删除成功'
})
this.getCatalogList()
}).catch(() => {
this.$message({
type: 'error',
message: '删除失败!'
})
})
}).catch()
},
// 关闭分组弹窗
handleClose () {
this.catalogVisible = false
this.$refs.form.clearValidate()
}
}
}
</script>
<style lang="scss" scoped>
@import '../assets/style/bsTheme.scss';
.catalog-edit-wrap{
::v-deep .el-dialog__body{
min-height: 300px !important;
}
.el-input {
width: 200px;
margin-right: 20px;
}
.top-search-wrap {
display: flex;
align-items: center;
justify-content: flex-start;
margin-bottom: 12px;
.el-input {
width: 200px;
margin-right: 20px;
::v-deep .el-input__inner {
background-color: #151A26 !important;
}
}
}
}
</style>

View File

@@ -0,0 +1,717 @@
<template>
<div>
<el-dialog
:close-on-click-modal="false"
:title="title ? '编辑组件' : '新增组件'"
:visible.sync="formVisible"
:append-to-body="true"
class="bs-dialog-wrap bs-el-dialog"
@close="closeAddDialog"
>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataFormRules"
label-position="right"
label-width="100px"
class="bs-el-form"
>
<el-form-item
label="名称"
prop="name"
>
<el-input
v-model="dataForm.name"
autocomplete="off"
placeholder="请输入名称"
clearable
maxlength="30"
class="bs-el-input"
/>
</el-form-item>
<el-form-item
v-if="type === 'bizComponent'&&!title"
label="组件类型"
>
<el-select
v-model="bizType"
class="bs-el-select"
popper-class="bs-el-select"
placeholder="请选择组件类型"
clearable
>
<el-option
v-for="resolutionRatioItem in BizList"
:key="resolutionRatioItem.value"
:label="resolutionRatioItem.label"
:value="resolutionRatioItem.value"
/>
</el-select>
</el-form-item>
<el-form-item
v-if="type === 'component'"
label="推荐分辨率"
>
<el-select
v-model="resolutionRatioValue"
class="bs-el-select"
popper-class="bs-el-select"
placeholder="请选择分辨率"
clearable
>
<el-option
v-for="resolutionRatioItem in resolutionRatioOptions"
:key="resolutionRatioItem.value"
:label="resolutionRatioItem.label"
:value="resolutionRatioItem.value"
/>
</el-select>
</el-form-item>
<el-form-item
v-if="type === 'component'"
label="大屏宽度"
>
<el-input-number
v-model="resolutionRatio.w"
:min="100"
:max="8000"
class="bs-el-input-number"
/>
</el-form-item>
<el-form-item
v-if="type === 'component'"
label="大屏高度"
>
<el-input-number
v-model="resolutionRatio.h"
:min="100"
:max="8000"
class="bs-el-input-number"
/>
</el-form-item>
<el-form-item label="分组">
<div v-if="type === 'component'">
<el-select
v-model="dataForm.parentCode"
class="bs-el-select"
popper-class="bs-el-select"
clearable
filterable
>
<el-option
v-for="catalogItem in catalogList"
:key="catalogItem.id"
:label="catalogItem.name"
:value="catalogItem.code"
/>
</el-select>
</div>
<div v-else>
<el-select
v-model="dataForm.type"
class="bs-el-select"
popper-class="bs-el-select"
clearable
filterable
>
<el-option
v-for="catalogItem in catalogList"
:key="catalogItem.id"
:label="catalogItem.name"
:value="catalogItem.code"
/>
</el-select>
</div>
</el-form-item>
<el-form-item label="排序">
<el-input-number
v-model="dataForm.orderNum"
:min="0"
:max="30000"
controls-position="right"
class="bs-el-input-number"
/>
</el-form-item>
</el-form>
<div
slot="footer"
class="dialog-footer"
>
<el-button
class="bs-el-button-default"
@click="closeAddDialog"
>
取消
</el-button>
<el-button
v-if="title"
type="primary"
:loading="toDesignLoading"
:disabled="toDesignDisabled"
@click="addOrUpdate(true)"
>
设计
</el-button>
<el-button
type="primary"
:loading="sureLoading"
:disabled="sureDisabled"
@click="addOrUpdate(!title)"
>
确定
</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import Icon from 'data-room-ui/assets/images/dataSourceIcon/export'
export default {
name: 'EditForm',
components: {
},
props: {
type: {
type: String,
default: ''
}
},
data () {
return {
bizType: 'native',
resolutionRatioValue: '',
resolutionRatio: {},
catalogList: [],
BizList: [
{
label: 'echarts组件',
value: 'echart'
}, {
label: 'g2Plot组件',
value: 'g2plot'
}, {
label: '基础组件',
value: 'native'
}
],
resolutionRatioOptions: [
{
value: '1024*768',
label: '1024*768'
},
{
value: '1280*720',
label: '1280*720'
},
{
value: '1920*1080',
label: '1920*1080'
},
{
value: '2560*1440',
label: '2560*1440'
},
{
value: '3840*2160',
label: '3840*2160'
},
{
value: '5120*2880',
label: '5120*2880'
},
{
value: '7680*4320',
label: '7680*4320'
}
],
formVisible: false,
title: '', // 弹框标题(新增/编辑)
dataForm: {
id: '',
type: '',
name: '',
icon: '',
code: '',
parentCode: '',
remark: '',
iconColor: '#007aff',
components: '',
style: '',
formType: '',
formConfig: '',
pageTemplateId: ''
},
dataFormRules: {
name: [
{ required: true, message: '名称不能为空', trigger: 'blur' },
// 组件名称判重
// 名称重复自定义校验
{
validator: (rule, value, callback) => {
if (value) {
const reqUrl = {
component: '/bigScreen/design/name/repeat',
bizComponent: '/bigScreen/bizComponent/name/repeat'
}
this.$dataRoomAxios.post(reqUrl[this.type], {
name: value,
type: this.type,
id: this.dataForm.id
}).then((resp) => {
if (resp) {
callback(new Error('名称已存在'))
} else {
callback()
}
})
} else {
callback()
}
},
trigger: ['blur', 'change']
}
]
},
sureLoading: false,
toDesignLoading: false,
sureDisabled: false,
toDesignDisabled: false
}
},
computed: {
},
watch: {
resolutionRatioValue (val) {
if (val) {
this.resolutionRatio.w = val.split('*')[0]
this.resolutionRatio.h = val.split('*')[1]
} else {
this.resolutionRatio.w = this.type === 'component' ? 1024 : 1920
this.resolutionRatio.h = this.type === 'component' ? 768 : 1080
}
}
},
mounted () {
this.initResolution()
},
methods: {
initResolution () {
this.resolutionRatioValue = this.type === 'component' ? '1024*768' : '1920*1080'
if (this.type === 'component') {
this.resolutionRatio = {
w: 1024,
h: 768
}
} else {
this.resolutionRatio = {
w: 1920,
h: 1080
}
}
},
// 关闭弹窗时
closeAddDialog () {
this.formVisible = false
this.$refs.dataForm.resetFields()
this.bizType = 'native'
},
// 初始化
init (nodeData, parentCode) {
if (this.type === 'component') {
this.comInit(nodeData, parentCode)
} else {
this.bizInit(nodeData, parentCode)
}
},
bizInit (nodeData, parentCode) {
this.title = ''
const code = nodeData ? nodeData.code : ''
this.formVisible = true
this.$nextTick(() => {
this.$dataRoomAxios.get('/bigScreen/type/list/bizComponentCatalog').then((resp) => {
this.catalogList = resp
})
if (code) {
this.$dataRoomAxios.get(`/bigScreen/bizComponent/info/${code}`).then((resp) => {
this.$set(this, 'title', resp.name)
this.$set(this.dataForm, 'name', resp.name)
this.$set(this.dataForm, 'code', resp.code)
this.$set(this.dataForm, 'orderNum', nodeData.orderNum)
this.$set(this.dataForm, 'type', resp.type)
this.$set(this.dataForm, 'id', resp.id)
this.$set(this.dataForm, 'parentCode', resp.parentCode)
})
} else {
this.$set(this.dataForm, 'name', '')
this.$set(this.dataForm, 'code', '')
this.$set(this.dataForm, 'type', parentCode)
this.$set(this.dataForm, 'orderNum', 0)
this.$set(this.dataForm, 'id', '')
this.$set(this.dataForm, 'parentCode', parentCode)
}
})
},
comInit (nodeData, parentCode) {
this.title = ''
const code = nodeData ? nodeData.code : ''
this.formVisible = true
this.$nextTick(() => {
this.$dataRoomAxios.get('/bigScreen/type/list/componentCatalog').then((resp) => {
this.catalogList = resp
})
if (code) {
this.$dataRoomAxios.get(`/bigScreen/design/info/code/${code}`).then((resp) => {
this.$set(this, 'title', resp.name)
this.$set(this.dataForm, 'name', resp.name)
this.$set(this.dataForm, 'chartList', resp.chartList)
this.$set(this.dataForm, 'code', resp.code)
this.$set(this.dataForm, 'icon', resp.icon)
this.$set(this.dataForm, 'iconColor', resp.iconColor)
this.$set(this.dataForm, 'id', resp.id)
this.$set(this.dataForm, 'parentCode', resp.parentCode === '0' ? '' : resp.parentCode)
this.$set(this.dataForm, 'remark', resp.remark)
this.$set(this.dataForm, 'style', resp.style)
this.$set(this.dataForm, 'type', resp.type)
this.$set(this.dataForm, 'orderNum', nodeData.orderNum)
this.$set(this.dataForm, 'pageTemplateId', resp?.pageTemplateId)
this.$set(this.dataForm, 'pageConfig', resp?.pageConfig)
this.$set(this.dataForm, 'parentCode', resp?.parentCode)
const { w, h } = resp.pageConfig
this.resolutionRatio.w = w
this.resolutionRatio.h = h
this.resolutionRatioValue = `${w}*${h}`
})
} else {
this.$set(this.dataForm, 'name', '')
this.$set(this.dataForm, 'chartList', [])
this.$set(this.dataForm, 'code', '')
this.$set(this.dataForm, 'icon', Icon.getNameList()[0])
this.$set(this.dataForm, 'iconColor', '#007aff')
this.$set(this.dataForm, 'id', '')
this.$set(this.dataForm, 'parentCode', parentCode)
this.$set(this.dataForm, 'remark', '')
this.$set(this.dataForm, 'style', '')
this.$set(this.dataForm, 'type', this.type)
this.$set(this.dataForm, 'orderNum', 0)
this.$set(this.dataForm, 'pageTemplateId', '')
this.$set(this.dataForm, 'pageConfig', {
w: this.type === 'component' ? 1024 : 1920,
h: this.type === 'component' ? 768 : 1080,
bgColor: '#151a26',
opacity: 100,
customTheme: 'dark',
bg: null,
lightBgColor: '#f5f7fa',
lightBg: null,
fitMode: 'auto'
})
this.resolutionRatio.w = this.type === 'component' ? 1024 : 1920
this.resolutionRatio.h = this.type === 'component' ? 768 : 1080
}
})
},
// 点击确定时
addOrUpdate (isToDesign = false) {
if (this.type === 'component') {
this.addOrUpdateBigScreen(isToDesign)
} else {
this.addOrUpdateBizComponent(isToDesign)
}
},
// 业务组件 新增/编辑
addOrUpdateBizComponent (isToDesign) {
this.$refs.dataForm.validate(async (valid) => {
if (!valid) {
return
}
const addOrUpdateHandel = !this.dataForm.code
? (form) => this.$dataRoomAxios.post('/bigScreen/bizComponent/add', form)
: (form) => this.$dataRoomAxios.post('/bigScreen/bizComponent/update', form)
const form = {
className: 'com.gccloud.dataroom.core.module.manage.dto.DataRoomPageDTO',
id: this.dataForm.id,
code: this.dataForm.code,
name: this.dataForm.name,
type: this.dataForm.type,
orderNum: this.dataForm.orderNum
}
if (isToDesign) {
this.toDesignLoading = true
this.sureDisabled = true
} else {
this.sureLoading = true
this.toDesignDisabled = true
}
addOrUpdateHandel(form)
.then((code) => {
this.formVisible = false
const message = this.dataForm.code ? '更新成功' : '新增成功'
this.$message.success(message)
this.$emit('refreshData', form, this.dataForm.id)
if (isToDesign) {
this.toDesignLoading = false
this.sureDisabled = false
form.code = code || this.dataForm.code
this.toDesign({ ...form })
} else {
this.sureLoading = false
this.toDesignDisabled = false
}
})
.catch(() => {
this.sureLoading = false
this.toDesignLoading = false
this.sureDisabled = false
this.toDesignDisabled = false
})
})
},
// 自定义组件 新增/编辑
addOrUpdateBigScreen (isToDesign) {
this.$refs.dataForm.validate(async (valid) => {
if (!valid) {
return
}
const addOrUpdateHandel = !this.dataForm.code
? (form) => this.$dataRoomAxios.post('/bigScreen/design/add', form)
: (form) => this.$dataRoomAxios.post('/bigScreen/design/update', form)
const form = {
className: 'com.gccloud.dataroom.core.module.manage.dto.DataRoomPageDTO',
chartList: this.dataForm.chartList,
code: this.dataForm.code,
icon: this.dataForm.icon,
iconColor: this.dataForm.iconColor,
id: this.dataForm.id,
name: this.dataForm.name,
parentCode: this.dataForm.parentCode,
remark: this.dataForm.remark,
style: this.dataForm.style,
orderNum: this.dataForm.orderNum,
pageConfig: { ...this.dataForm.pageConfig, w: this.resolutionRatio.w, h: this.resolutionRatio.h },
pageTemplateId: this.dataForm.pageTemplateId,
type: this.type || 'component'
}
if (isToDesign) {
this.toDesignLoading = true
this.sureDisabled = true
} else {
this.sureLoading = true
this.toDesignDisabled = true
}
addOrUpdateHandel(form)
.then((code) => {
this.formVisible = false
const message = this.dataForm.code ? '更新成功' : '新增成功'
this.$message.success(message)
this.$emit('refreshData', form, this.dataForm.id)
if (isToDesign) {
this.toDesignLoading = false
this.sureDisabled = false
form.code = code || this.dataForm.code
this.toDesign({ ...form })
} else {
this.sureLoading = false
this.toDesignDisabled = false
}
})
.catch(() => {
this.sureLoading = false
this.toDesignLoading = false
this.sureDisabled = false
this.toDesignDisabled = false
})
})
},
// 跳转设计态
toDesign (form) {
const path = this.type === 'component' ? (window.BS_CONFIG?.routers?.designUrl || '/big-screen/design') : 'big-screen-biz-component-design'
// const { href: bigScreenHref } = this.type === 'bizComponent' ? this.$router.resolve({
// path,
// query: {
// code: form.code,
// type: this.bizType
// }
// }) : this.$router.resolve({
// path,
// query: {
// code: form.code
// }
// })
// window.open(bigScreenHref, '_self')
if (this.type === 'bizComponent') {
this.$router.push({
path,
query: {
code: form.code,
type: this.bizType
}
})
} else {
this.$router.push({
path,
query: {
code: form.code
}
})
}
}
}
}
</script>
<style lang="scss" scoped>
@import '../assets/style/bsTheme.scss';
.el-scrollbar {
height: 300px;
overflow-x: hidden;
::v-deep .el-scrollbar__view {
overflow-x: hidden;
}
}
.color-picker {
display: flex;
align-items: center;
}
.icon-svg {
width: 25px;
height: 25px;
}
.color-select {
width: 350px;
display: flex;
margin-top: 5px;
align-items: center;
justify-content: space-between;
div {
width: 20px;
height: 20px;
cursor: pointer;
position: relative;
}
::v-deep .el-color-picker__trigger {
top: 0;
right: 0;
width: 21px;
height: 21px;
padding: 0;
}
.el-icon-check {
font-size: 20px;
color: #ffffff;
position: absolute;
}
}
.icon-list {
margin-top: 15px;
padding: 5px;
border-radius: 5px;
border: 1px solid #e8e8e8;
.el-button--mini {
min-width: 37px;
padding: 5px !important;
border: 1px solid transparent !important;
&:hover {
background-color: rgba(217, 217, 217, 0.3);
}
}
}
.icon-uploader {
width: 60px;
height: 60px;
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.icon-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 60px;
height: 60px;
line-height: 60px;
text-align: center;
}
.icon {
width: 60px;
height: 60px;
display: block;
}
.default-layout-box {
display: flex;
flex-wrap: wrap;
.default-layout-item {
cursor: pointer;
margin: 9px;
display: flex;
flex-direction: column;
align-items: center;
.component-name {
font-size: 12px;
}
.sampleImg {
margin: 0 auto;
width: 102px;
height: 73px;
display: block;
}
.img_dispaly {
margin: 0 auto;
text-align: center;
width: 100px;
height: 70px;
line-height: 70px;
background-color: #D7D7D7;
color: #999;
}
.demonstration {
text-align: center;
}
}
.default-layout-item:hover {
cursor: pointer;
}
::v-deep .el-radio__label {
display: none;
}
}
/*滚动条样式*/
::v-deep ::-webkit-scrollbar {
width: 6px;
border-radius: 4px;
height: 4px;
}
::v-deep ::-webkit-scrollbar-thumb {
background: #dddddd !important;
border-radius: 10px;
}
.catalog-cascader {
width: 100% !important;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

View File

@@ -0,0 +1,691 @@
<template>
<div class="big-screen-list-wrap">
<div class="internal-box">
<div class="top-search-wrap">
<el-select
v-if="catalogInfo !== 'system'"
v-model="catalogCode"
class="bs-el-select"
popper-class="bs-el-select"
placeholder="请选择分组"
filterable
clearable
@change="reSearch"
>
<el-option
v-for="item in catalogList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
<el-input
v-model="searchKey"
class="bs-el-input"
placeholder="请输入组件名称"
prefix-icon="el-icon-search"
clearable
@clear="reSearch"
@keyup.enter.native="reSearch"
/>
<el-button
type="primary"
@click="reSearch"
>
搜索
</el-button>
<el-button
v-if="catalogInfo !== 'system'"
type="primary"
@click="catalogManage"
>
分组管理
</el-button>
</div>
<div
v-loading="loading"
class="list-wrap bs-scrollbar"
element-loading-text="加载中"
:style="{
display: gridComputed ? 'grid' : 'flex',
justifyContent: gridComputed ? 'space-around' : 'flex-start'
}"
>
<!-- 第一个是新增大屏卡片 -->
<div
v-if="catalogInfo !== 'system'"
class="big-screen-card-wrap"
:style="{
width: gridComputed ? 'auto' : '290px'
}"
@click="add"
>
<div class="big-screen-card-inner big-screen-card-inner-add">
<div class="add-big-screen-card">
<div class="add-big-screen-card-inner">
<div class="add-big-screen-card-text">
新增组件
</div>
</div>
</div>
</div>
</div>
<!-- 后面遍历 list -->
<div
v-for="screen in list"
:key="screen.id"
class="big-screen-card-wrap"
:style="{
width: gridComputed ? 'auto' : '290px'
}"
>
<div class="big-screen-card-inner">
<div class="screen-card__hover">
<div class="screen-card__hover-box">
<div class="preview">
<div
class="screen-card__oper-label circle"
@click="preview(screen)"
>
<span>预览</span>
</div>
<div
v-if="catalogInfo !== 'system'"
class="circle"
@click="design(screen)"
>
<span>设计</span>
</div>
<div
v-if="catalogInfo !== 'system'"
class="circle"
@click="edit(screen)"
>
<span>编辑</span>
</div>
<div
v-if="catalogInfo !== 'system'"
class="circle"
@click="copy(screen)"
>
<span>复制</span>
</div>
<div
v-if="catalogInfo !== 'system'"
class="circle"
@click="del(screen)"
>
<span>删除</span>
</div>
</div>
</div>
</div>
<div class="big-screen-card-img">
<el-image
:src="catalogInfo !== 'system' ? (getCoverPicture(screen.coverPicture) || require('./images/default.png')) : screen.img "
fit="fill"
style="width: 100%; height: 100%"
>
<div
slot="placeholder"
class="image-slot"
>
加载中···
</div>
<div
slot="error"
class="image-slot"
style="font-size: 20px"
>
<div class="error-img-text">
{{ catalogInfo !== 'system' ? screen.name : screen.title }}
</div>
</div>
</el-image>
</div>
<div class="big-screen-bottom">
<div
class="left-bigscreen-title"
:title="catalogInfo !== 'system' ? screen.name : screen.title"
>
{{ catalogInfo !== 'system' ? screen.name : screen.title }}
</div>
</div>
</div>
</div>
</div>
<div
v-if="catalogInfo !== 'system'"
class="footer-pagination-wrap"
>
<!-- <div class="footer-pagination-wrap-text">
总共 {{ totalCount }} 个项目
</div> -->
<div class="bs-pagination">
<el-pagination
class="bs-el-pagination"
popper-class="bs-el-pagination"
background
layout="total, prev, pager, next, sizes"
:page-size="size"
prev-text="上一页"
next-text="下一页"
:total="totalCount"
:page-sizes="[10, 20, 50, 100]"
:current-page="current"
@current-change="currentChangeHandle"
@size-change="sizeChangeHandle"
/>
</div>
</div>
</div>
<!-- 新增或编辑弹窗 -->
<EditForm
v-if="catalogInfo !== 'system'"
ref="EditForm"
:type="catalogInfo"
@refreshData="reSearch"
/>
<CatalogEditForm
v-if="catalogInfo !== 'system'"
ref="CatalogEditForm"
:catalog-type="catalogType"
@updateCatalogList="updateCatalogList"
/>
</div>
</template>
<script>
import { pageMixins } from 'data-room-ui/js/mixins/page'
import { getFileUrl } from 'data-room-ui/js/utils/file'
import EditForm from './EditForm.vue'
import CatalogEditForm from './CatalogEditForm'
import innerRemoteComponents, { getRemoteComponents } from 'data-room-ui/RemoteComponents/remoteComponentsList'
export default {
name: 'BigScreenList',
mixins: [pageMixins],
props: {
catalogInfo: {
type: String,
default: ''
}
},
components: { EditForm, CatalogEditForm },
data () {
return {
name: '',
catalogVisible: false,
templateLoading: false,
searchKey: '',
list: [],
loading: false,
catalogList: [], // 分组列表
catalogCode: ''
}
},
computed: {
catalogType () {
if (this.catalogInfo === 'component') {
return 'componentCatalog'
} else {
return 'bizComponentCatalog'
}
},
code () {
return ''
},
gridComputed () {
return this.list.length > 2
}
},
watch: {
catalogInfo () {
this.reset()
this.init()
},
catalogCode (value) {
this.reSearch()
}
},
mounted () {
this.init()
},
methods: {
reset () {
this.searchKey = ''
this.current = 1
this.size = 10
this.catalogCode = ''
this.init()
},
init () {
if (this.catalogInfo !== 'system') {
this.getDataList()
this.getCatalogList()
} else {
this.list = []
this.list = [...innerRemoteComponents, ...getRemoteComponents()]
}
},
updateCatalogList (list) {
this.catalogList = list
},
reSearch () {
if (this.catalogInfo !== 'system') {
this.current = 1
this.getDataList()
} else {
const arr = [...innerRemoteComponents, ...getRemoteComponents()]
this.list = arr?.filter((item) => item.title.indexOf(this.searchKey) !== -1)
}
},
catalogManage () {
this.$refs.CatalogEditForm.formVisible = true
},
// 获取分组列表
getCatalogList () {
this.$dataRoomAxios.get(`/bigScreen/type/list/${this.catalogType}`)
.then((data) => {
this.catalogList = data
})
.catch(() => { })
},
getDataList () {
this.loading = true
if (this.catalogInfo === 'component') {
this.$dataRoomAxios.get('/bigScreen/design/page', {
parentCode: this.catalogCode || null,
current: this.current,
size: this.size,
searchKey: this.searchKey,
type: 'component'
})
.then((data) => {
this.list = data.list
this.totalCount = data.totalCount
})
.finally(() => {
this.loading = false
})
} else {
this.$dataRoomAxios.get('/bigScreen/bizComponent/page', {
current: this.current,
size: this.size,
// searchKey: this.searchKey,
name: this.searchKey,
type: this.catalogCode || null
})
.then((data) => {
this.list = data.list
this.totalCount = data.totalCount
})
.finally(() => {
this.loading = false
})
}
},
preview (screen) {
let path = ''
let query = {
code: screen.code
}
if (this.catalogInfo === 'component') {
path = (window.BS_CONFIG?.routers?.previewUrl || '/big-screen/preview')
} else {
path = (window.BS_CONFIG?.routers?.bizComponentPreviewUrl || 'big-screen-biz-component-preview')
}
if (this.catalogInfo === 'system') {
query = {
dirName: screen.customize.vueSysComponentDirName
}
}
const { href } = this.$router.resolve({
path, // 这里写的是要跳转的路由地址
query
})
window.open(href, '_blank')
},
design (screen) {
const path = this.catalogInfo === 'component' ? (window.BS_CONFIG?.routers?.designUrl || '/big-screen/design') : (window.BS_CONFIG?.routers?.bizComponentDesignUrl || 'big-screen-biz-component-design')
// const { href } = this.$router.resolve({
// path,
// query: {
// code: screen.code
// }
// })
// 新窗口打开
// window.open(href, '_self')
this.$router.push({
path,
query: {
code: screen.code
}
})
},
add () {
const page = {
code: '',
type: this.catalogInfo === 'component' ? 'bigScreen' : 'bizComponent'
}
this.$refs.EditForm.init(page, this.catalogCode)
},
edit (screen) {
this.$refs.EditForm.init(screen, this.catalogCode)
},
del (screen) {
this.$confirm('确定删除该组件', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
customClass: 'bs-el-message-box'
})
.then(async () => {
const url = this.catalogInfo === 'component' ? `/bigScreen/design/delete/${screen.code}` : `/bigScreen/bizComponent/delete/${screen.id}`
this.$dataRoomAxios.post(url)
.then(() => {
this.$message({
type: 'success',
message: '删除成功'
})
this.getDataList()
})
.catch(() => {
this.$message({
type: 'error',
message: '删除失败!'
})
})
})
.catch()
},
copy (screen) {
const url = this.catalogInfo === 'component' ? `/bigScreen/design/copy/${screen.code}` : `/bigScreen/bizComponent/copy/${screen.code}`
this.$confirm('确定复制该组件', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
customClass: 'bs-el-message-box'
})
.then(async () => {
this.$dataRoomAxios.post(url)
.then(() => {
this.$message({
type: 'success',
message: '复制成功'
})
this.getDataList()
})
.catch(() => {
this.$message({
type: 'error',
message: '复制失败!'
})
})
})
.catch((e) => {
console.error(e)
})
},
/**
* 获取封面图片,如果是相对路径则拼接上文件访问前缀地址
* @param url
* @returns {*}
*/
getCoverPicture (url) {
return getFileUrl(url)
}
}
}
</script>
<style lang="scss" scoped>
@import '../assets/style/bsTheme.scss';
.big-screen-list-wrap {
.el-select {
display: inline-block !important;
position: relative !important;
width: auto !important;
}
position: relative;
height: 100%;
// padding: 16px;
// margin:0 16px;
margin-left: 16px;
color: #9ea9b2;
background-color: var(--bs-background-2) !important;
.internal-box {
height: calc(100% - 32px);
padding: 16px;
}
.top-search-wrap {
display: flex;
align-items: center;
justify-content: flex-end;
margin-bottom: 12px;
.el-input {
width: 200px;
margin-right: 20px;
::v-deep .el-input__inner {
background-color: var(--bs-background-1) !important;
}
}
.el-select {
margin-right: 20px;
::v-deep .el-input__inner {
background-color: var(--bs-background-1) !important;
}
}
}
.list-wrap {
/* display: grid; */
overflow: auto;
padding-right: 5px;
// 间隙自适应
justify-content: space-around;
// max-height: calc(100vh - 304px);
max-height: calc(100% - 90px);
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
grid-gap: 15px;
padding-bottom: 10px;
// ::v-deep .el-loading-mask {
// display: flex;
// align-items: center;
// justify-content: center;
// height: calc(100vh - 260px) !important;
// z-index: 999;
// top: 50px;
// }
.big-screen-card-wrap {
position: relative;
height: 180px;
cursor: pointer;
&:hover {
.screen-card__hover {
height: 180px;
}
}
.screen-card__hover {
position: absolute;
z-index: 999;
top: 0;
right: 0;
left: 0;
display: flex;
overflow: hidden;
align-items: center;
justify-content: center;
height: 0;
transition: height 0.4s;
background: #00000099;
.screen-card__hover-box {
position: absolute;
width: 100%;
height: 100%;
background: #00000080;
display: flex;
overflow: hidden;
align-items: center;
justify-content: center;
}
.preview {
display: flex;
flex-direction: row;
justify-content: space-evenly;
width: 100%;
cursor: pointer;
color: var(--bs-el-color-primary);
.circle {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
border: 1px solid var(--bs-el-color-primary);
border-radius: 50%;
&:hover {
color: #fff;
background: var(--bs-el-color-primary);
}
span {
font-size: 12px;
}
}
}
}
.big-screen-card-inner {
overflow: hidden;
width: 100%;
height: 100%;
cursor: pointer;
background-color: var(--bs-background-2);
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
color: var(--bs-el-title);
border: 1px solid var(--bs-background-1);
&:hover {
color: var(--bs-el-text);
border: 1px solid var(--bs-el-color-primary);
}
.add-big-screen-card-text {
color: var(--bs-el-color-primary);
font-size: 24px;
}
.big-screen-card-img {
width: 100%;
height: 150px;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
::v-deep .image-slot {
height: 100%;
background-color: var(--bs-background-2);
display: flex;
align-items: center;
justify-content: center;
}
::v-deep .el-image__error {
background-color: #1d1d1d;
}
}
.big-screen-bottom {
display: flex;
align-items: center;
flex-direction: row;
justify-content: space-between;
box-sizing: border-box;
width: 100%;
/*height: 26px;*/
padding: 0 10px;
height: calc(100% - 150px);
color: var(--bs-el-title);
background-color: var(--bs-background-2);
.left-bigscreen-title {
font-size: 14px;
overflow: hidden;
width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
}
.right-bigscreen-time-title {
font-size: 14px;
overflow: hidden;
width: 140px;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.big-screen-card-text {
font-size: 14px;
padding: 10px;
text-align: center;
color: #333;
}
}
.big-screen-card-inner-add {
display: flex;
align-items: center;
justify-content: center;
}
}
}
.el-loading-parent--relative {
position: unset !important;
}
.footer-pagination-wrap {
position: absolute;
bottom: 16px;
right: 16px;
}
.error-img-text {
overflow: hidden;
padding: 0 10px;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
}
}
.bs-pagination {
::v-deep .el-input__inner {
width: 110px !important;
border: none;
background: var(--bs-el-background-1);
}
}
</style>