大屏应用位置整合
This commit is contained in:
@@ -1,34 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<ai-list v-if="!isShowDetail">
|
<section class="AppDesigner">
|
||||||
<template slot="title">
|
<component :is="currentPage" v-bind="$props"/>
|
||||||
<ai-title title="大屏列表" :isShowBottomBorder="false" :instance="instance"></ai-title>
|
</section>
|
||||||
</template>
|
|
||||||
<template slot="tabs">
|
|
||||||
<el-tabs v-model="currIndex">
|
|
||||||
<el-tab-pane v-for="(tab,i) in tabs" :key="i" :label="tab.label">
|
|
||||||
<component :urlPrefix="urlPrefix" :areaId="areaId" :ref="tab.name" v-if="currIndex == i" :is="tab.comp" @change="onChange" lazy :instance="instance"
|
|
||||||
:dict="dict" :permissions="permissions"/>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
</template>
|
|
||||||
</ai-list>
|
|
||||||
<Add v-else-if="componentName === 'Add'" :urlPrefix="urlPrefix" :areaId="areaId" :params="params" :instance="instance" :dict="dict" :permissions="permissions"
|
|
||||||
@change="onChange"></Add>
|
|
||||||
<SourceData v-else-if="componentName === 'SourceData'" :urlPrefix="urlPrefix" :params="params" :instance="instance" :dict="dict" :permissions="permissions"
|
|
||||||
@change="onChange"></SourceData>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import List from './components/List.vue'
|
import List from './components/List.vue'
|
||||||
import Add from './components/Add'
|
import Add from './components/Add'
|
||||||
import SourceData from './components/SourceData'
|
import SourceData from './components/SourceData'
|
||||||
|
import Preview from "./components/preview";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AppDesigner',
|
name: 'AppDesigner',
|
||||||
label: '大屏设计',
|
label: '大屏设计',
|
||||||
|
components: {Preview, List, Add, SourceData},
|
||||||
components: {List, Add, SourceData},
|
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
instance: Function,
|
instance: Function,
|
||||||
dict: Object,
|
dict: Object,
|
||||||
@@ -40,6 +25,12 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
currentPage() {
|
||||||
|
const {hash} = this.$route
|
||||||
|
return hash == "#sourceData" ? SourceData :
|
||||||
|
hash == "#add" ? Add :
|
||||||
|
hash == "#preview" ? Preview : List
|
||||||
|
},
|
||||||
tabs() {
|
tabs() {
|
||||||
return [
|
return [
|
||||||
{label: '大屏列表', name: 'FormList', comp: List, permission: ''}
|
{label: '大屏列表', name: 'FormList', comp: List, permission: ''}
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<ai-detail>
|
<ai-detail>
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
<ai-title :title="id ? '编辑项目' : '添加项目'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
|
<ai-title :title="id ? '编辑项目' : '添加项目'" isShowBack isShowBottomBorder @onBackClick="cancel"/>
|
||||||
</ai-title>
|
|
||||||
</template>
|
</template>
|
||||||
<template slot="content">
|
<template slot="content">
|
||||||
<el-form ref="form" :model="form" label-width="110px" label-position="right">
|
<el-form ref="form" :model="form" label-width="110px" label-position="right">
|
||||||
@@ -64,14 +63,6 @@
|
|||||||
:theme="config.theme"
|
:theme="config.theme"
|
||||||
@close="isShowLayout = false">
|
@close="isShowLayout = false">
|
||||||
</Layout>
|
</Layout>
|
||||||
<ai-dv-wrapper :views="[{label: '返回'}]" :theme="config.theme" @change="screenId = false" v-if="screenId" :title="form.name">
|
|
||||||
<ai-dv-background
|
|
||||||
:theme="config.theme"
|
|
||||||
v-if="config.length || config.theme === '1'"
|
|
||||||
:src="config.theme === '1' ? 'https://cdn.cunwuyun.cn/dvcp/dv/img/dj-bg.png' : config.backgroundImage[0].url">
|
|
||||||
</ai-dv-background>
|
|
||||||
<app-gigscreen-viewer :urlPrefix="urlPrefix" :instance="instance" :dict="dict" :id="screenId"/>
|
|
||||||
</ai-dv-wrapper>
|
|
||||||
<ai-dialog :visible.sync="dialog" title="定制大屏" @closed="custom={}" @onConfirm="handleCustomizedDV">
|
<ai-dialog :visible.sync="dialog" title="定制大屏" @closed="custom={}" @onConfirm="handleCustomizedDV">
|
||||||
<el-form ref="CustomDVFrom" size="small" :model="custom" :rules="rules" label-width="80px">
|
<el-form ref="CustomDVFrom" size="small" :model="custom" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="大屏标题" prop="title">
|
<el-form-item label="大屏标题" prop="title">
|
||||||
@@ -103,7 +94,6 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
instance: Function,
|
instance: Function,
|
||||||
dict: Object,
|
dict: Object,
|
||||||
params: Object,
|
|
||||||
urlPrefix: String
|
urlPrefix: String
|
||||||
},
|
},
|
||||||
inject: {
|
inject: {
|
||||||
@@ -145,24 +135,18 @@ export default {
|
|||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.dict.load('customizedDVs')
|
this.dict.load('customizedDVs')
|
||||||
if (this.params && this.params.id) {
|
this.getInfo()
|
||||||
this.id = this.params.id
|
|
||||||
this.getInfo(this.params.id)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getInfo(id) {
|
getInfo() {
|
||||||
|
let {id} = this.$route.query
|
||||||
this.instance.post(`${this.urlPrefix}/appdiylargescreen/queryLargeScreenProjectDetailById?id=${id}`).then(res => {
|
this.instance.post(`${this.urlPrefix}/appdiylargescreen/queryLargeScreenProjectDetailById?id=${id}`).then(res => {
|
||||||
if (res.code === 0) {
|
if (res?.data) {
|
||||||
this.form = {
|
this.form = {
|
||||||
...res.data
|
...res.data
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.data.relationLsIds) {
|
if (res.data.relationLsIds) {
|
||||||
this.tableData = res.data.lsList.map(v => {
|
this.tableData = res.data.lsList.map(v => {
|
||||||
let conf = JSON.parse(v.config || '') || {}
|
let conf = JSON.parse(v.config || '') || {}
|
||||||
@@ -195,14 +179,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
toViewer(id) {
|
toViewer(id) {
|
||||||
this.instance.post(`${this.urlPrefix}/appdiylargescreen/queryLargeScreenDetailById?id=${id}`).then(res => {
|
this.$router.push({query: {id}, hash: "#preview"})
|
||||||
if (res.data) {
|
|
||||||
this.config = JSON.parse(res.data.config).dashboard
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.screenId = id
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onChange(e) {
|
onChange(e) {
|
||||||
const ids = this.tableData.map(v => v.id)
|
const ids = this.tableData.map(v => v.id)
|
||||||
if (ids.indexOf(e.id) < 0) {
|
if (ids.indexOf(e.id) < 0) {
|
||||||
@@ -260,7 +238,7 @@ export default {
|
|||||||
|
|
||||||
this.home && this.home.refreshDvOptions && this.home.refreshDvOptions()
|
this.home && this.home.refreshDvOptions && this.home.refreshDvOptions()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.cancel(true)
|
this.cancel()
|
||||||
}, 600)
|
}, 600)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -268,11 +246,8 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel(isRefresh) {
|
cancel() {
|
||||||
this.$emit('change', {
|
this.$router.push({})
|
||||||
type: 'list',
|
|
||||||
isRefresh: !!isRefresh
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleCustomizedDV() {
|
handleCustomizedDV() {
|
||||||
|
|||||||
@@ -1,38 +1,39 @@
|
|||||||
<template>
|
<template>
|
||||||
<ai-list class="form-list" isTabs style="width: 100%">
|
<ai-list>
|
||||||
|
<ai-title slot="title" title="大屏列表" isShowBottomBorder/>
|
||||||
<template slot="content">
|
<template slot="content">
|
||||||
<ai-search-bar>
|
<ai-search-bar>
|
||||||
<template #left>
|
<template #left>
|
||||||
<ai-select
|
<ai-select
|
||||||
v-model="search.status"
|
v-model="search.status"
|
||||||
@change="search.current = 1, getList()"
|
@change="search.current = 1, getList()"
|
||||||
placeholder="发布状态"
|
placeholder="发布状态"
|
||||||
:selectList="dict.getDict('cwpStatus')">
|
:selectList="dict.getDict('cwpStatus')">
|
||||||
</ai-select>
|
</ai-select>
|
||||||
<el-button type="primary" @click="toEdit('')">添加大屏</el-button>
|
<el-button type="primary" @click="toEdit('')">添加大屏</el-button>
|
||||||
<el-button type="primary" @click="toAddData">数据源管理</el-button>
|
<el-button type="primary" @click="toAddData">数据源管理</el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #right>
|
<template #right>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="search.name"
|
v-model="search.name"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="请输入模板名称或创建人"
|
placeholder="请输入模板名称或创建人"
|
||||||
clearable
|
clearable
|
||||||
v-throttle="() => {search.current = 1, getList()}"
|
v-throttle="() => {search.current = 1, getList()}"
|
||||||
@clear="search.current = 1, search.title = '', getList()"
|
@clear="search.current = 1, search.title = '', getList()"
|
||||||
suffix-icon="iconfont iconSearch">
|
suffix-icon="iconfont iconSearch">
|
||||||
</el-input>
|
</el-input>
|
||||||
</template>
|
</template>
|
||||||
</ai-search-bar>
|
</ai-search-bar>
|
||||||
<ai-table
|
<ai-table
|
||||||
:tableData="tableData"
|
:tableData="tableData"
|
||||||
:col-configs="colConfigs"
|
:col-configs="colConfigs"
|
||||||
:total="total"
|
:total="total"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
style="margin-top: 6px;"
|
style="margin-top: 6px;"
|
||||||
:current.sync="search.current"
|
:current.sync="search.current"
|
||||||
:size.sync="search.size"
|
:size.sync="search.size"
|
||||||
@getList="getList">
|
@getList="getList">
|
||||||
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
|
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
|
||||||
<template slot-scope="{ row }">
|
<template slot-scope="{ row }">
|
||||||
<div class="table-options">
|
<div class="table-options">
|
||||||
@@ -43,11 +44,11 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</ai-table>
|
</ai-table>
|
||||||
<ai-dialog
|
<ai-dialog
|
||||||
:visible.sync="isShowAdd"
|
:visible.sync="isShowAdd"
|
||||||
width="780px"
|
width="780px"
|
||||||
title="复制大屏"
|
title="复制大屏"
|
||||||
@close="onClose"
|
@close="onClose"
|
||||||
@onConfirm="onConfirm">
|
@onConfirm="onConfirm">
|
||||||
<el-form ref="form" :model="form" label-width="110px" label-position="right">
|
<el-form ref="form" :model="form" label-width="110px" label-position="right">
|
||||||
<div class="ai-form" :model="form" label-width="110px" label-position="right">
|
<div class="ai-form" :model="form" label-width="110px" label-position="right">
|
||||||
<el-form-item label="名称" prop="name" style="width: 100%;" :rules="[{ required: true, message: '请输入名称', trigger: 'blur' }]">
|
<el-form-item label="名称" prop="name" style="width: 100%;" :rules="[{ required: true, message: '请输入名称', trigger: 'blur' }]">
|
||||||
@@ -61,118 +62,106 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'FormList',
|
name: 'FormList',
|
||||||
props: {
|
props: {
|
||||||
instance: Function,
|
instance: Function,
|
||||||
dict: Object,
|
dict: Object,
|
||||||
areaId: String,
|
areaId: String,
|
||||||
urlPrefix: String
|
urlPrefix: String
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
search: {
|
||||||
|
current: 1,
|
||||||
|
status: '',
|
||||||
|
size: 10,
|
||||||
|
name: ''
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
name: ''
|
||||||
|
},
|
||||||
|
id: '',
|
||||||
|
isShowAdd: false,
|
||||||
|
colConfigs: [
|
||||||
|
{prop: 'name', label: '模板名称'},
|
||||||
|
{prop: 'createUserName', align: 'center', label: '创建人'},
|
||||||
|
{prop: 'description', align: 'center', label: '描述'},
|
||||||
|
{prop: 'status', align: 'center', label: '状态', formart: v => this.dict.getLabel('cwpStatus', v)},
|
||||||
|
{prop: 'createTime', align: 'center', label: '创建时间'}
|
||||||
|
],
|
||||||
|
tableData: [],
|
||||||
|
total: 0,
|
||||||
|
loading: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
|
||||||
|
this.dict.load('cwpStatus').then(() => {
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.loading = true
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
copy(id) {
|
||||||
|
this.id = id
|
||||||
|
this.isShowAdd = true
|
||||||
},
|
},
|
||||||
|
|
||||||
data () {
|
onClose() {
|
||||||
return {
|
this.id = ''
|
||||||
search: {
|
this.form.name = ''
|
||||||
current: 1,
|
|
||||||
status: '',
|
|
||||||
size: 10,
|
|
||||||
name: ''
|
|
||||||
},
|
|
||||||
form: {
|
|
||||||
name: ''
|
|
||||||
},
|
|
||||||
id: '',
|
|
||||||
isShowAdd: false,
|
|
||||||
colConfigs: [
|
|
||||||
{ prop: 'name', label: '模板名称' },
|
|
||||||
{ prop: 'createUserName', align: 'center', label: '创建人' },
|
|
||||||
{ prop: 'description', align: 'center', label: '描述' },
|
|
||||||
{ prop: 'status', align: 'center', label: '状态', formart: v => this.dict.getLabel('cwpStatus', v) },
|
|
||||||
{ prop: 'createTime', align: 'center', label: '创建时间' }
|
|
||||||
],
|
|
||||||
tableData: [],
|
|
||||||
total: 0,
|
|
||||||
loading: false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
created () {
|
onConfirm() {
|
||||||
|
this.$refs.form.validate((valid) => {
|
||||||
this.dict.load('cwpStatus').then(() => {
|
if (valid) {
|
||||||
this.getList()
|
this.instance.post(`${this.urlPrefix}/appdiylargescreen/copyLargeScreenProject`, null, {
|
||||||
|
params: {
|
||||||
|
...this.form,
|
||||||
|
id: this.id
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$message.success('复制成功')
|
||||||
|
this.isShowAdd = false
|
||||||
|
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted () {
|
getList() {
|
||||||
this.loading = true
|
this.instance.post(`${this.urlPrefix}/appdiylargescreen/allLargeScreenProjectByPage`, null, {
|
||||||
},
|
params: {
|
||||||
|
...this.search
|
||||||
methods: {
|
}
|
||||||
copy (id) {
|
}).then(res => {
|
||||||
this.id = id
|
if (res.code == 0) {
|
||||||
this.isShowAdd = true
|
this.tableData = res.data.records
|
||||||
},
|
this.total = res.data.total
|
||||||
|
|
||||||
onClose () {
|
|
||||||
this.id = ''
|
|
||||||
this.form.name = ''
|
|
||||||
},
|
|
||||||
|
|
||||||
onConfirm () {
|
|
||||||
this.$refs.form.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
this.instance.post(`${this.urlPrefix}/appdiylargescreen/copyLargeScreenProject`, null, {
|
|
||||||
params: {
|
|
||||||
...this.form,
|
|
||||||
id: this.id
|
|
||||||
}
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code === 0) {
|
|
||||||
this.$message.success('复制成功')
|
|
||||||
this.isShowAdd = false
|
|
||||||
|
|
||||||
this.getList()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
getList () {
|
|
||||||
this.instance.post(`${this.urlPrefix}/appdiylargescreen/allLargeScreenProjectByPage`, null, {
|
|
||||||
params: {
|
|
||||||
...this.search
|
|
||||||
}
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
this.tableData = res.data.records
|
|
||||||
this.total = res.data.total
|
|
||||||
this.loading = false
|
|
||||||
} else {
|
|
||||||
this.loading = false
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
} else {
|
||||||
},
|
this.loading = false
|
||||||
|
}
|
||||||
toEdit (id) {
|
}).catch(() => {
|
||||||
this.$emit('change', {
|
this.loading = false
|
||||||
type: 'add',
|
})
|
||||||
params: {
|
},
|
||||||
id: id || ''
|
toEdit(id) {
|
||||||
}
|
this.$router.push({hash: "#add", query: {id}})
|
||||||
})
|
},
|
||||||
},
|
toAddData() {
|
||||||
|
this.$router.push({hash: "#sourceData"})
|
||||||
toAddData () {
|
|
||||||
this.$emit('change', {
|
|
||||||
type: 'SourceData'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<ai-detail>
|
<ai-detail>
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
<ai-title title="数据源" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
|
<ai-title title="数据源" isShowBack isShowBottomBorder @onBackClick="cancel">
|
||||||
</ai-title>
|
</ai-title>
|
||||||
</template>
|
</template>
|
||||||
<template slot="content">
|
<template slot="content">
|
||||||
@@ -13,25 +13,25 @@
|
|||||||
<ai-search-bar class="search-bar">
|
<ai-search-bar class="search-bar">
|
||||||
<template slot="right">
|
<template slot="right">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="search.name"
|
v-model="search.name"
|
||||||
size="small"
|
size="small"
|
||||||
v-throttle="() => {search.current = 1, getList()}"
|
v-throttle="() => {search.current = 1, getList()}"
|
||||||
placeholder="请输入名字"
|
placeholder="请输入名字"
|
||||||
clearable
|
clearable
|
||||||
@clear="search.current = 1, search.name = '', getList()"
|
@clear="search.current = 1, search.name = '', getList()"
|
||||||
suffix-icon="iconfont iconSearch">
|
suffix-icon="iconfont iconSearch">
|
||||||
</el-input>
|
</el-input>
|
||||||
</template>
|
</template>
|
||||||
</ai-search-bar>
|
</ai-search-bar>
|
||||||
<ai-table
|
<ai-table
|
||||||
:tableData="tableData"
|
:tableData="tableData"
|
||||||
:col-configs="colConfigs"
|
:col-configs="colConfigs"
|
||||||
:total="total"
|
:total="total"
|
||||||
style="margin-top: 6px;"
|
style="margin-top: 6px;"
|
||||||
:border="true"
|
:border="true"
|
||||||
:current.sync="search.current"
|
:current.sync="search.current"
|
||||||
:size.sync="search.size"
|
:size.sync="search.size"
|
||||||
@getList="getList">
|
@getList="getList">
|
||||||
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
|
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
|
||||||
<template slot-scope="{ row }">
|
<template slot-scope="{ row }">
|
||||||
<div class="table-options">
|
<div class="table-options">
|
||||||
@@ -44,18 +44,18 @@
|
|||||||
</template>
|
</template>
|
||||||
</ai-card>
|
</ai-card>
|
||||||
<ai-dialog
|
<ai-dialog
|
||||||
:visible.sync="isShow"
|
:visible.sync="isShow"
|
||||||
width="920px"
|
width="920px"
|
||||||
title="数据源"
|
title="数据源"
|
||||||
@close="onClose"
|
@close="onClose"
|
||||||
@onConfirm="onConfirm">
|
@onConfirm="onConfirm">
|
||||||
<el-form ref="form" :model="form" label-width="110px" label-position="right">
|
<el-form ref="form" :model="form" label-width="110px" label-position="right">
|
||||||
<div class="ai-form">
|
<div class="ai-form">
|
||||||
<el-form-item label="数据源描述" style="width: 100%;" prop="description" :rules="[{ required: true, message: '请输入数据源描述', trigger: 'blur' }]">
|
<el-form-item label="数据源描述" style="width: 100%;" prop="description" :rules="[{ required: true, message: '请输入数据源描述', trigger: 'blur' }]">
|
||||||
<el-input
|
<el-input
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="请输入数据源描述"
|
placeholder="请输入数据源描述"
|
||||||
v-model="form.description">
|
v-model="form.description">
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="类型" style="width: 100%;" prop="dataRange" :rules="[{ required: true, message: '请选择数据范围', trigger: 'change' }]">
|
<el-form-item label="类型" style="width: 100%;" prop="dataRange" :rules="[{ required: true, message: '请选择数据范围', trigger: 'change' }]">
|
||||||
@@ -64,56 +64,61 @@
|
|||||||
<el-radio label="1">SQL</el-radio>
|
<el-radio label="1">SQL</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.type === '1'" label="sql语句" style="width: 100%;" prop="description" :rules="[{ required: true, message: '请输入sql语句', trigger: 'blur' }]">
|
<el-form-item v-if="form.type === '1'" label="sql语句" style="width: 100%;" prop="description"
|
||||||
|
:rules="[{ required: true, message: '请输入sql语句', trigger: 'blur' }]">
|
||||||
<el-input
|
<el-input
|
||||||
:rows="8"
|
:rows="8"
|
||||||
size="small"
|
size="small"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
placeholder="请输入数据源描述"
|
placeholder="请输入数据源描述"
|
||||||
v-model="form.sqlContent">
|
v-model="form.sqlContent">
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.type === '0'" label="村微应用" style="width: 100%;" prop="appId" :rules="[{ required: true, message: '请选择村微应用', trigger: 'change' }]">
|
<el-form-item v-if="form.type === '0'" label="村微应用" style="width: 100%;" prop="appId"
|
||||||
|
:rules="[{ required: true, message: '请选择村微应用', trigger: 'change' }]">
|
||||||
<el-select size="small" style="width: 100%;" v-model="form.appId" placeholder="请选择村微应用" @change="onAppChange">
|
<el-select size="small" style="width: 100%;" v-model="form.appId" placeholder="请选择村微应用" @change="onAppChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in appList"
|
v-for="item in appList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.appName"
|
:label="item.appName"
|
||||||
:value="item.id">
|
:value="item.id">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.type === '0'" label="数据范围" style="width: 100%;" prop="dataRange" :rules="[{ required: true, message: '请选择数据范围', trigger: 'change' }]">
|
<el-form-item v-if="form.type === '0'" label="数据范围" style="width: 100%;" prop="dataRange"
|
||||||
|
:rules="[{ required: true, message: '请选择数据范围', trigger: 'change' }]">
|
||||||
<el-radio-group v-model="form.dataRange">
|
<el-radio-group v-model="form.dataRange">
|
||||||
<el-radio label="0">全部</el-radio>
|
<el-radio label="0">全部</el-radio>
|
||||||
<el-radio label="1">自定义条数</el-radio>
|
<el-radio label="1">自定义条数</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据条数" style="width: 100%;" v-if="form.dataRange === '1' && form.type === '0'" prop="count" :rules="[{ required: true, message: '请输入数据条数', trigger: 'blur' }]">
|
<el-form-item label="数据条数" style="width: 100%;" v-if="form.dataRange === '1' && form.type === '0'" prop="count"
|
||||||
|
:rules="[{ required: true, message: '请输入数据条数', trigger: 'blur' }]">
|
||||||
<el-input
|
<el-input
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="请输入数据条数"
|
placeholder="请输入数据条数"
|
||||||
v-model="form.count">
|
v-model="form.count">
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div v-if="form.type === '0'">
|
<div v-if="form.type === '0'">
|
||||||
<el-form-item :label="'统计项' + index" style="width: 100%;" v-for="(item, index) in form.statisticsConfigs" :key="'statisticsConfigs' + index">
|
<el-form-item :label="'统计项' + index" style="width: 100%;" v-for="(item, index) in form.statisticsConfigs" :key="'statisticsConfigs' + index">
|
||||||
<div class="form-flex">
|
<div class="form-flex">
|
||||||
<div>
|
<div>
|
||||||
<el-select size="small" style="width: 160px;" v-model="item.fieldName" @change="e => onChooseField('statisticsConfigs', e, index)" placeholder="请选择" clearable>
|
<el-select size="small" style="width: 160px;" v-model="item.fieldName" @change="e => onChooseField('statisticsConfigs', e, index)"
|
||||||
|
placeholder="请选择" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(item, index) in filedList"
|
v-for="(item, index) in filedList"
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="item.fieldCnName"
|
:label="item.fieldCnName"
|
||||||
:value="item.fieldName">
|
:value="item.fieldName">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-select size="small" style="margin: 0 10px; width: 160px;" v-model="item.calcType" placeholder="请选择" clearable>
|
<el-select size="small" style="margin: 0 10px; width: 160px;" v-model="item.calcType" placeholder="请选择" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dict.getDict('diyLargeScreenDatasourceCalcType2')"
|
v-for="item in dict.getDict('diyLargeScreenDatasourceCalcType2')"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.dictName"
|
:label="item.dictName"
|
||||||
:value="item.dictValue">
|
:value="item.dictValue">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-input size="small" style="width: 165px;" placeholder="请输入别名" v-model="item.alias"></el-input>
|
<el-input size="small" style="width: 165px;" placeholder="请输入别名" v-model="item.alias"></el-input>
|
||||||
@@ -131,10 +136,10 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-select size="small" style="width: 160px;" v-model="item.fieldName" placeholder="请选择" clearable>
|
<el-select size="small" style="width: 160px;" v-model="item.fieldName" placeholder="请选择" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in filedList"
|
v-for="item in filedList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.fieldCnName"
|
:label="item.fieldCnName"
|
||||||
:value="item.fieldName">
|
:value="item.fieldName">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
@@ -151,18 +156,18 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-select size="small" style="width: 160px;" v-model="item.fieldName" placeholder="请选择" clearable>
|
<el-select size="small" style="width: 160px;" v-model="item.fieldName" placeholder="请选择" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in filedList"
|
v-for="item in filedList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.fieldCnName"
|
:label="item.fieldCnName"
|
||||||
:value="item.fieldName">
|
:value="item.fieldName">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-select size="small" style="width: 160px; margin-left: 10px;" v-model="item.orderType" placeholder="请选择" clearable>
|
<el-select size="small" style="width: 160px; margin-left: 10px;" v-model="item.orderType" placeholder="请选择" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in orderTypeDict"
|
v-for="item in orderTypeDict"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
@@ -181,277 +186,274 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'SourceData',
|
name: 'SourceData',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
instance: Function,
|
instance: Function,
|
||||||
dict: Object,
|
dict: Object,
|
||||||
params: Object,
|
params: Object,
|
||||||
urlPrefix: String
|
urlPrefix: String
|
||||||
},
|
},
|
||||||
|
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
isShow: false,
|
isShow: false,
|
||||||
search: {
|
search: {
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
name: ''
|
name: ''
|
||||||
|
},
|
||||||
|
total: 0,
|
||||||
|
colConfigs: [
|
||||||
|
{prop: 'appName', label: '应用名'},
|
||||||
|
{prop: 'appTableName', align: 'center', label: '表名'},
|
||||||
|
{prop: 'description', align: 'center', label: '描述'},
|
||||||
|
{prop: 'type', align: 'center', label: '类型', formart: v => v === '0' ? '村微应用' : 'sql语句'},
|
||||||
|
{prop: 'createUserName', align: 'center', label: '创建人'},
|
||||||
|
{prop: 'createTime', align: 'center', label: '创建时间'}
|
||||||
|
],
|
||||||
|
tableData: [],
|
||||||
|
filedList: [],
|
||||||
|
appList: [],
|
||||||
|
form: {
|
||||||
|
orderType: 'asc',
|
||||||
|
dataRange: '0',
|
||||||
|
type: '0',
|
||||||
|
sqlContent: '',
|
||||||
|
appId: '',
|
||||||
|
description: '',
|
||||||
|
appName: '',
|
||||||
|
appTableName: '',
|
||||||
|
count: '100',
|
||||||
|
statisticsConfigs: [{
|
||||||
|
alias: '',
|
||||||
|
calcType: '',
|
||||||
|
dictCode: '',
|
||||||
|
fieldCnName: '',
|
||||||
|
fieldName: ''
|
||||||
|
}],
|
||||||
|
orderConfigs: [{
|
||||||
|
alias: '',
|
||||||
|
calcType: '',
|
||||||
|
dictCode: '',
|
||||||
|
fieldCnName: '',
|
||||||
|
fieldName: ''
|
||||||
|
}],
|
||||||
|
groupConfigs: [{
|
||||||
|
alias: '',
|
||||||
|
calcType: '',
|
||||||
|
dictCode: '',
|
||||||
|
fieldCnName: '',
|
||||||
|
fieldName: ''
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
id: '',
|
||||||
|
orderTypeDict: [
|
||||||
|
{
|
||||||
|
value: 'asc',
|
||||||
|
label: '升序'
|
||||||
},
|
},
|
||||||
total: 0,
|
{
|
||||||
colConfigs: [
|
value: 'desc',
|
||||||
{ prop: 'appName', label: '应用名' },
|
label: '降序'
|
||||||
{ prop: 'appTableName', align: 'center', label: '表名' },
|
}
|
||||||
{ prop: 'description', align: 'center', label: '描述' },
|
]
|
||||||
{ prop: 'type', align: 'center', label: '类型', formart: v => v === '0' ? '村微应用' : 'sql语句' },
|
}
|
||||||
{ prop: 'createUserName', align: 'center', label: '创建人' },
|
},
|
||||||
{ prop: 'createTime', align: 'center', label: '创建时间' }
|
|
||||||
],
|
created() {
|
||||||
tableData: [],
|
this.dict.load(['diyLargeScreenDatasourceCalcType2']).then(() => {
|
||||||
filedList: [],
|
this.getList()
|
||||||
appList: [],
|
this.getAppList()
|
||||||
form: {
|
})
|
||||||
orderType: 'asc',
|
},
|
||||||
dataRange: '0',
|
|
||||||
type: '0',
|
methods: {
|
||||||
sqlContent: '',
|
getInfo(id) {
|
||||||
appId: '',
|
this.instance.post(`${this.urlPrefix}/wxcp/wxuser/queryDetailById?id=${id}`).then(res => {
|
||||||
description: '',
|
if (res.code === 0) {
|
||||||
appName: '',
|
this.form = {
|
||||||
appTableName: '',
|
...res.data
|
||||||
count: '100',
|
|
||||||
statisticsConfigs: [{
|
|
||||||
alias: '',
|
|
||||||
calcType: '',
|
|
||||||
dictCode: '',
|
|
||||||
fieldCnName: '',
|
|
||||||
fieldName: ''
|
|
||||||
}],
|
|
||||||
orderConfigs: [{
|
|
||||||
alias: '',
|
|
||||||
calcType: '',
|
|
||||||
dictCode: '',
|
|
||||||
fieldCnName: '',
|
|
||||||
fieldName: ''
|
|
||||||
}],
|
|
||||||
groupConfigs: [{
|
|
||||||
alias: '',
|
|
||||||
calcType: '',
|
|
||||||
dictCode: '',
|
|
||||||
fieldCnName: '',
|
|
||||||
fieldName: ''
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
id: '',
|
|
||||||
orderTypeDict: [
|
|
||||||
{
|
|
||||||
value: 'asc',
|
|
||||||
label: '升序'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'desc',
|
|
||||||
label: '降序'
|
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
created () {
|
|
||||||
this.dict.load(['diyLargeScreenDatasourceCalcType2']).then(() => {
|
|
||||||
this.getList()
|
|
||||||
this.getAppList()
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
onChooseField(type, fieldName, index) {
|
||||||
getInfo (id) {
|
const dictCode = this.filedList.filter(v => v.fieldName === fieldName)[0].dictCode
|
||||||
this.instance.post(`${this.urlPrefix}/wxcp/wxuser/queryDetailById?id=${id}`).then(res => {
|
this.$set(this.form[type][index], 'dictCode', dictCode)
|
||||||
if (res.code === 0) {
|
},
|
||||||
this.form = {
|
|
||||||
...res.data
|
add(type) {
|
||||||
}
|
this.form[type].push({
|
||||||
|
alias: '',
|
||||||
|
calcType: '',
|
||||||
|
dictCode: '',
|
||||||
|
fieldCnName: '',
|
||||||
|
fieldName: ''
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
removeConfig(type, index) {
|
||||||
|
this.form[type].splice(index, 1)
|
||||||
|
},
|
||||||
|
|
||||||
|
toEdit(e) {
|
||||||
|
this.id = e.id
|
||||||
|
this.instance.post(`${this.urlPrefix}/appdiylargescreen/queryDatasourceDetailById?id=${e.id}`).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.form = {
|
||||||
|
...res.data
|
||||||
}
|
}
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
onChooseField (type, fieldName, index) {
|
this.form.dataRange = this.form.dataRange === '0' ? '0' : '1'
|
||||||
const dictCode = this.filedList.filter(v => v.fieldName === fieldName)[0].dictCode
|
this.form.count = res.data.dataRange
|
||||||
this.$set(this.form[type][index], 'dictCode', dictCode)
|
this.filedList = this.appList.filter(v => v.id === res.data.appId).length && this.appList.filter(v => v.id === res.data.appId)[0].fields.map(item => {
|
||||||
},
|
let value = []
|
||||||
|
res.data.configs.forEach(v => {
|
||||||
add (type) {
|
if (v.fieldName === item.fieldName) {
|
||||||
this.form[type].push({
|
value.push(v.calcType)
|
||||||
alias: '',
|
|
||||||
calcType: '',
|
|
||||||
dictCode: '',
|
|
||||||
fieldCnName: '',
|
|
||||||
fieldName: ''
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
removeConfig (type, index) {
|
|
||||||
this.form[type].splice(index, 1)
|
|
||||||
},
|
|
||||||
|
|
||||||
toEdit (e) {
|
|
||||||
this.id = e.id
|
|
||||||
this.instance.post(`${this.urlPrefix}/appdiylargescreen/queryDatasourceDetailById?id=${e.id}`).then(res => {
|
|
||||||
if (res.code === 0) {
|
|
||||||
this.form = {
|
|
||||||
...res.data
|
|
||||||
}
|
|
||||||
|
|
||||||
this.form.dataRange = this.form.dataRange === '0' ? '0' : '1'
|
|
||||||
this.form.count = res.data.dataRange
|
|
||||||
this.filedList = this.appList.filter(v => v.id === res.data.appId).length && this.appList.filter(v => v.id === res.data.appId)[0].fields.map(item => {
|
|
||||||
let value = []
|
|
||||||
res.data.configs.forEach(v => {
|
|
||||||
if (v.fieldName === item.fieldName) {
|
|
||||||
value.push(v.calcType)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
|
||||||
...item,
|
|
||||||
value
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.isShow = true
|
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.isShow = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
remove(id) {
|
||||||
|
this.$confirm('确定删除该数据?').then(() => {
|
||||||
|
this.instance.post(`${this.urlPrefix}/appquestionnairetemplate/delete?id=${id}`).then(res => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
this.$message.success('删除成功!')
|
||||||
|
this.getList()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getList() {
|
||||||
|
this.instance.post(`${this.urlPrefix}/appdiylargescreen/allDatasourceByPage`, null, {
|
||||||
|
params: {
|
||||||
|
...this.search
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code == 0) {
|
||||||
|
this.tableData = res.data.records
|
||||||
|
this.total = res.data.total
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getAppList() {
|
||||||
|
this.instance.post(`${this.urlPrefix}/appdiylargescreen/allDatasourceApp`).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.appList = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
onClose() {
|
||||||
|
this.id = ''
|
||||||
|
this.form.orderType = 'asc'
|
||||||
|
this.form.dataRange = 0
|
||||||
|
this.form.appId = ''
|
||||||
|
this.form.description = ''
|
||||||
|
this.form.appName = ''
|
||||||
|
this.form.appTableName = ''
|
||||||
|
this.form.count = 100
|
||||||
|
},
|
||||||
|
|
||||||
|
onAppChange(e) {
|
||||||
|
const value = this.appList.filter(v => v.id === e)[0]
|
||||||
|
this.form.appTableName = value.appTableName
|
||||||
|
this.form.appName = value.appName
|
||||||
|
this.form.statisticsConfigs = [{
|
||||||
|
alias: '',
|
||||||
|
calcType: '',
|
||||||
|
dictCode: '',
|
||||||
|
fieldCnName: '',
|
||||||
|
fieldName: ''
|
||||||
|
}]
|
||||||
|
this.form.orderConfigs = [{
|
||||||
|
alias: '',
|
||||||
|
calcType: '',
|
||||||
|
dictCode: '',
|
||||||
|
fieldCnName: '',
|
||||||
|
fieldName: ''
|
||||||
|
}]
|
||||||
|
this.form.groupConfigs = [{
|
||||||
|
alias: '',
|
||||||
|
calcType: '',
|
||||||
|
dictCode: '',
|
||||||
|
fieldCnName: '',
|
||||||
|
fieldName: ''
|
||||||
|
}]
|
||||||
|
this.filedList = value.fields.map(v => {
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
value: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
onConfirm() {
|
||||||
|
this.$refs.form.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
let configs = []
|
||||||
|
|
||||||
|
if (this.filedList.length) {
|
||||||
|
this.filedList.forEach(item => {
|
||||||
|
if (item.value.length) {
|
||||||
|
item.value.forEach(v => {
|
||||||
|
configs.push({
|
||||||
|
alias: item.fieldCnName,
|
||||||
|
calcType: v,
|
||||||
|
fieldCnName: item.fieldCnName,
|
||||||
|
fieldName: item.fieldName,
|
||||||
|
dictCode: item.dictCode,
|
||||||
|
orderType: this.orderType
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.instance.post(`${this.urlPrefix}/appdiylargescreen/addOrUpdateDatasource`, {
|
||||||
|
...this.form,
|
||||||
|
configs,
|
||||||
|
id: this.id ? this.id : '',
|
||||||
|
dataRange: this.form.dataRange === '0' ? 0 : this.form.count
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$message.success(this.id ? '编辑成功' : '添加成功')
|
||||||
|
this.search.current = 1
|
||||||
|
this.isShow = false
|
||||||
|
|
||||||
remove (id) {
|
|
||||||
this.$confirm('确定删除该数据?').then(() => {
|
|
||||||
this.instance.post(`${this.urlPrefix}/appquestionnairetemplate/delete?id=${id}`).then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
this.$message.success('删除成功!')
|
|
||||||
this.getList()
|
this.getList()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
},
|
})
|
||||||
|
},
|
||||||
|
|
||||||
getList () {
|
cancel() {
|
||||||
this.instance.post(`${this.urlPrefix}/appdiylargescreen/allDatasourceByPage`, null, {
|
this.$router.push({})
|
||||||
params: {
|
|
||||||
...this.search
|
|
||||||
}
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
this.tableData = res.data.records
|
|
||||||
this.total = res.data.total
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
getAppList () {
|
|
||||||
this.instance.post(`${this.urlPrefix}/appdiylargescreen/allDatasourceApp`).then(res => {
|
|
||||||
if (res.code === 0) {
|
|
||||||
this.appList = res.data
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
onClose () {
|
|
||||||
this.id = ''
|
|
||||||
this.form.orderType = 'asc'
|
|
||||||
this.form.dataRange = 0
|
|
||||||
this.form.appId = ''
|
|
||||||
this.form.description = ''
|
|
||||||
this.form.appName = ''
|
|
||||||
this.form.appTableName = ''
|
|
||||||
this.form.count = 100
|
|
||||||
},
|
|
||||||
|
|
||||||
onAppChange (e) {
|
|
||||||
const value = this.appList.filter(v => v.id === e)[0]
|
|
||||||
this.form.appTableName = value.appTableName
|
|
||||||
this.form.appName = value.appName
|
|
||||||
this.form.statisticsConfigs = [{
|
|
||||||
alias: '',
|
|
||||||
calcType: '',
|
|
||||||
dictCode: '',
|
|
||||||
fieldCnName: '',
|
|
||||||
fieldName: ''
|
|
||||||
}]
|
|
||||||
this.form.orderConfigs = [{
|
|
||||||
alias: '',
|
|
||||||
calcType: '',
|
|
||||||
dictCode: '',
|
|
||||||
fieldCnName: '',
|
|
||||||
fieldName: ''
|
|
||||||
}]
|
|
||||||
this.form.groupConfigs = [{
|
|
||||||
alias: '',
|
|
||||||
calcType: '',
|
|
||||||
dictCode: '',
|
|
||||||
fieldCnName: '',
|
|
||||||
fieldName: ''
|
|
||||||
}]
|
|
||||||
this.filedList = value.fields.map(v => {
|
|
||||||
return {
|
|
||||||
...v,
|
|
||||||
value: ''
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
onConfirm () {
|
|
||||||
this.$refs.form.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
let configs = []
|
|
||||||
|
|
||||||
if (this.filedList.length) {
|
|
||||||
this.filedList.forEach(item => {
|
|
||||||
if (item.value.length) {
|
|
||||||
item.value.forEach(v => {
|
|
||||||
configs.push({
|
|
||||||
alias: item.fieldCnName,
|
|
||||||
calcType: v,
|
|
||||||
fieldCnName: item.fieldCnName,
|
|
||||||
fieldName: item.fieldName,
|
|
||||||
dictCode: item.dictCode,
|
|
||||||
orderType: this.orderType
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.instance.post(`${this.urlPrefix}/appdiylargescreen/addOrUpdateDatasource`, {
|
|
||||||
...this.form,
|
|
||||||
configs,
|
|
||||||
id: this.id ? this.id : '',
|
|
||||||
dataRange: this.form.dataRange === '0' ? 0 : this.form.count
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code === 0) {
|
|
||||||
this.$message.success(this.id ? '编辑成功' : '添加成功')
|
|
||||||
this.search.current = 1
|
|
||||||
this.isShow = false
|
|
||||||
|
|
||||||
this.getList()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
cancel (isRefresh) {
|
|
||||||
this.$emit('change', {
|
|
||||||
type: 'list',
|
|
||||||
isRefresh: !!isRefresh
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.form-flex {
|
.form-flex {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
58
packages/bigscreen/designer/components/preview.vue
Normal file
58
packages/bigscreen/designer/components/preview.vue
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<template>
|
||||||
|
<section class="preview">
|
||||||
|
<ai-dv-wrapper :views="[{label: '返回'}]" :theme="config.theme" @change="$router.back()" v-if="screenId" :title="info.name">
|
||||||
|
<ai-dv-background
|
||||||
|
:theme="config.theme"
|
||||||
|
v-if="config.length || config.theme === '1'"
|
||||||
|
:src="config.theme === '1' ? 'https://cdn.cunwuyun.cn/dvcp/dv/img/dj-bg.png' : config.backgroundImage[0].url">
|
||||||
|
</ai-dv-background>
|
||||||
|
<app-gigscreen-viewer :urlPrefix="urlPrefix" :instance="instance" :dict="dict" :id="screenId"/>
|
||||||
|
</ai-dv-wrapper>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import AppGigscreenViewer from "../../viewer/AppGigscreenViewer";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "preview",
|
||||||
|
components: {AppGigscreenViewer},
|
||||||
|
props: {
|
||||||
|
instance: Function,
|
||||||
|
dict: Object,
|
||||||
|
permissions: Function,
|
||||||
|
urlPrefix: {
|
||||||
|
type: String,
|
||||||
|
default: '/app'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
screenId: v => v.$route.query.id
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
info: {},
|
||||||
|
config: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getDvData() {
|
||||||
|
let {id} = this.$route.query
|
||||||
|
this.instance.post(`${this.urlPrefix}/appdiylargescreen/queryLargeScreenDetailById?id=${id}`).then(res => {
|
||||||
|
if (res?.data) {
|
||||||
|
this.info = res.data
|
||||||
|
this.config = JSON.parse(res.data.config).dashboard
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getDvData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.preview {
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user