提交 5e31f035 编写于 作者: ibizdev's avatar ibizdev

xignzi006 发布系统代码

上级 67986e09
......@@ -49,6 +49,16 @@
"viewtag": "97f41e16790401fccbc7d297a6e37e93",
"memo": "系统自动添加"
},
"websitechannelcontenttreeview": {
"title": "频道内容",
"caption": "频道内容",
"viewtype": "DETREEEXPVIEW",
"viewmodule": "WebSite",
"viewname": "WebSiteChannelContentTreeView",
"viewfilename": "web-site-channel-content-tree-view",
"viewtag": "9b9de8c2724ef66a73380159197e7d72",
"memo": ""
},
"websitechanneleditview": {
"title": "站点频道",
"caption": "站点频道",
......
......@@ -136,7 +136,8 @@ export default class AppFileUpload extends Vue {
if (this.ignorefieldvaluechange) {
return;
}
this.setFiles(newval)
this.getParams();
this.setFiles(newval);
this.dataProcess();
}
......@@ -288,6 +289,7 @@ export default class AppFileUpload extends Vue {
this.formStateEvent = this.formState.subscribe(($event: any) => {
// 表单加载完成
if (Object.is($event.type, 'load')) {
this.getParams();
this.setFiles(this.value);
this.dataProcess();
}
......@@ -303,28 +305,37 @@ export default class AppFileUpload extends Vue {
*/
public mounted() {
this.appData = this.$store.getters.getAppData();
this.getParams();
this.setFiles(this.value);
this.dataProcess();
}
let uploadparams: any = {};
let exportparams: any = {};
/**
*获取上传,导出参数
*
*@memberof AppFileUpload
*/
public getParams(){
let uploadparams: any = JSON.parse(JSON.stringify(this.uploadparams));
let exportparams: any = JSON.parse(JSON.stringify(this.exportparams));
let upload_params: Array<string> = [];
let export_params: Array<string> = [];
let custom_arr: Array<string> = [];
let param:any = this.viewparams;
let context:any = this.context;
let _data:any = JSON.parse(this.data);
if (this.uploadparams && !Object.is(this.uploadparams, '')) {
uploadparams = this.uploadparams;
upload_params = this.$util.computedNavData(_data,param,context,uploadparams);
}
if (this.exportparams && !Object.is(this.exportparams, '')) {
exportparams = this.exportparams;
export_params = this.$util.computedNavData(_data,param,context,exportparams);
}
this.upload_params = [];
this.export_params = [];
for (const item in upload_params) {
this.upload_params.push({
[item]:upload_params[item]
......@@ -335,9 +346,6 @@ export default class AppFileUpload extends Vue {
[item]:export_params[item]
})
}
this.setFiles(this.value);
this.dataProcess();
}
/**
......
......@@ -9,7 +9,7 @@
:filterable="filterable === true ? true : false"
@on-open-change="onClick"
:placeholder="$t('components.dropDownListMpicker.placeholder')">
<i-option v-for="(item, index) in items" :key="index" :value="item.value" :label="item.text">
<i-option v-for="(item, index) in items" :key="index" :value="item.value.toString()" :label="item.text">
<Checkbox :value = "(currentVal.indexOf(item.value))==-1?false:true">
{{Object.is(codelistType,'STATIC') ? $t('codelist.'+tag+'.'+item.value) : item.text}}
</Checkbox>
......
......@@ -7,12 +7,12 @@
<div ref="scrollChild" class="tags-container" :style="{left: styleLeft + 'px'}">
<transition-group name="tags-transition">
<template v-for="(item, index) of appService.navHistory.historyList">
<Tag ref="tagElement" :key="index" :class="isActive(item) ? 'tag-is-active' : ''" :name="index" closable @click.native="changePage(item)" @on-close="onClose(item)">
<Tag ref="tagElement" :key="item.tag + index" :class="isActive(item) ? 'tag-is-active' : ''" :name="index" closable @click.native="changePage(item)" @on-close="onClose(item)">
<div class="tag-text">
<div :title="getCaption(item.meta.caption, item.meta.info)" style="max-width: 300px;">
<div :title="item.title" style="max-width: 300px;">
<i v-if="item.meta.iconCls && !Object.is(item.meta.iconCls, '')" :class="item.meta.iconCls"></i>
<img v-else :src="item.meta.imgPath" class="text-icon" />
&nbsp;{{getCaption(item.meta.caption, item.meta.info)}}
&nbsp;{{item.title}}
</div>
</div>
</Tag>
......@@ -63,10 +63,6 @@ export default class TabPageExp extends Vue {
Vue.prototype.$tabPageExp = this;
}
public getCaption(caption: any, info: any):any {
return info && !Object.is(info, '') ? `${this.$t(caption)} - ${info}` : this.$t(caption);
}
/**
* 向左移动
*
......@@ -107,10 +103,7 @@ export default class TabPageExp extends Vue {
* @memberof TabPageExp
*/
public isActive(item: HistoryItem): boolean {
if (Object.is(item.to.fullPath, this.$route.fullPath)) {
return true;
}
return false;
return this.appService.navHistory.isRouteSame(item.to, this.$route);
}
/**
......@@ -129,14 +122,24 @@ export default class TabPageExp extends Vue {
content: content,
onOk: () => {
this.appService.navHistory.remove(item);
this.gotoPage(item.to);
},
onCancel: () => {
if (this.appService.navHistory.historyList.length > 0) {
if (this.appService.navHistory.isRouteSame(item.to, this.$route)) {
this.$router.back();
}
} else {
this.$router.push('/');
}
}
});
} else {
this.appService.navHistory.remove(item);
this.gotoPage(item.to);
if (this.appService.navHistory.historyList.length > 0) {
if (this.appService.navHistory.isRouteSame(item.to, this.$route)) {
this.$router.back();
}
} else {
this.$router.push('/');
}
}
}
......@@ -170,7 +173,7 @@ export default class TabPageExp extends Vue {
* @memberof TabPageExp
*/
public gotoPage(page?: any) {
if (page) {
if (page && this.appService.navHistory.historyList.length > 0) {
if (Object.is(page.fullPath, this.$route.fullPath)) {
return;
}
......@@ -178,29 +181,13 @@ export default class TabPageExp extends Vue {
} else {
const path: string | null = window.sessionStorage.getItem(Environment.AppName);
if(path) {
this.$router.push({path: path});
this.$router.push({ path: path });
} else {
this.$router.push('/');
}
}
}
/**
* 设置当前页标题
*
* @param {*} caption
* @memberof TabPageExp
*/
public setCurPageCaption(caption: string, title: any, info: string) {
if(this.$route.meta && (!Object.is(this.$route.meta.caption, caption))) {
return;
}
this.appService.navHistory.setCaption({ route: this.$route, caption: title, info: info });
setTimeout(() => {
this.moveToView(this.$route);
}, 1);
}
/**
* 移动至指定页面标签
*
......
......@@ -248,13 +248,12 @@ export default class EditViewEngine extends ViewEngine {
public setTabCaption(info: string): void {
let viewdata: any = this.view.model;
if (viewdata && info && !Object.is(info, '') && this.view.$tabPageExp && (viewdata.srfTitle.indexOf(" - ") === -1)) {
this.view.$tabPageExp.setCurPageCaption(viewdata.srfTitle, viewdata.srfTitle, info);
if(this.view.$route){
this.view.$route.meta.info = info;
}
const title = this.view.model.srfTitle = `${this.view.$t(viewdata.srfTitle)} - ${viewdata.dataInfo}`;
this.view.$emit('viewModelChange', title);
this.view.$appService.navHistory.setCaption({ route: this.view.$route, info: viewdata.dataInfo });
this.view.$appService.navHistory.setCaption({ tag: this.view.viewtag, info: viewdata.dataInfo });
}
}
......
......@@ -22,6 +22,10 @@ export default {
caption: "站点频道",
title: "站点频道",
},
contenttreeview: {
caption: "频道内容",
title: "频道内容",
},
editview: {
caption: "站点频道",
title: "站点频道",
......@@ -143,4 +147,11 @@ export default {
tip: "Copy {0}",
},
},
channeltree_treeview: {
nodes: {
root: "默认根节点",
},
uiactions: {
},
},
};
\ No newline at end of file
......@@ -21,6 +21,10 @@ export default {
caption: "站点频道",
title: "站点频道",
},
contenttreeview: {
caption: "频道内容",
title: "频道内容",
},
editview: {
caption: "站点频道",
title: "站点频道",
......@@ -142,4 +146,11 @@ export default {
tip: "拷贝",
},
},
channeltree_treeview: {
nodes: {
root: "默认根节点",
},
uiactions: {
},
},
};
\ No newline at end of file
......@@ -516,6 +516,95 @@ mock.onGet(new RegExp(/^\/websitechannels\/fetchdefault(\?[\w-./?%&=,]*)*$/)).re
return [status, records ? records : []];
});
// FetchRoot
mock.onGet(new RegExp(/^\/websites\/([a-zA-Z0-9\-\;]{1,35})\/websitechannels\/fetchroot$/)).reply((config: any) => {
console.groupCollapsed("实体:websitechannel 方法: FetchRoot");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['websiteid'];
let tempValue: any = {};
const matchArray:any = new RegExp(/^\/websites\/([a-zA-Z0-9\-\;]{1,35})\/websitechannels\/fetchroot$/).exec(config.url);
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
if (items.length > 0 && paramArray.length > 0) {
paramArray.forEach((paramkey: any) => {
if (tempValue[paramkey] && tempValue[paramkey].indexOf(";") > 0) {
let keysGrounp: Array<any> = tempValue[paramkey].split(new RegExp(/[\;]/));
let tempArray: Array<any> = [];
keysGrounp.forEach((singlekey: any) => {
let _items = items.filter((item: any) => { return item[paramkey] == singlekey });
if(_items.length >0){
tempArray.push(..._items);
}
})
items = tempArray;
} else {
items = items.filter((item: any) => { return item[paramkey] == tempValue[paramkey] });
}
})
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(items);
console.groupEnd();
console.groupEnd();
return [status, items];
});
// FetchRoot
mock.onGet(new RegExp(/^\/websitechannels\/fetchroot$/)).reply((config: any) => {
console.groupCollapsed("实体:websitechannel 方法: FetchRoot");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas);
console.groupEnd();
console.groupEnd();
return [status, mockDatas ? mockDatas : []];
});
// FetchRoot
mock.onGet(new RegExp(/^\/websitechannels\/fetchroot(\?[\w-./?%&=,]*)*$/)).reply((config: any) => {
console.groupCollapsed("实体:websitechannel 方法: FetchRoot");
console.table({url:config.url, method: config.method, data:config.data});
if(config.url.includes('page')){
let url = config.url.split('?')[1];
let params = qs.parse(url);
Object.assign(config, params);
}
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
let total = mockDatas.length;
let records: Array<any> = [];
if(!config.page || !config.size){
records = mockDatas;
}else{
if((config.page-1)*config.size < total){
records = mockDatas.slice(config.page,config.size);
}
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(records ? records : []);
console.groupEnd();
console.groupEnd();
return [status, records ? records : []];
});
// URI参数传递情况未实现
// URI参数传递情况未实现
......
......@@ -47,6 +47,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "WebSiteEditView",
"viewtag": "97f41e16790401fccbc7d297a6e37e93"
},
"websitechannelcontenttreeview": {
"title": "频道内容",
"caption": "频道内容",
"viewtype": "DETREEEXPVIEW",
"viewmodule": "WebSite",
"viewname": "WebSiteChannelContentTreeView",
"viewtag": "9b9de8c2724ef66a73380159197e7d72"
},
"websitechanneleditview": {
"title": "站点频道",
"caption": "站点频道",
......
......@@ -3,9 +3,10 @@ export const PageComponents = {
Vue.component('web-site-grid-view', () => import('@pages/web-site/web-site-grid-view/web-site-grid-view.vue'));
Vue.component('web-site-channel-edit-view', () => import('@pages/web-site/web-site-channel-edit-view/web-site-channel-edit-view.vue'));
Vue.component('web-site-content-grid-view', () => import('@pages/web-site/web-site-content-grid-view/web-site-content-grid-view.vue'));
Vue.component('web-site-channel-content-tree-view', () => import('@pages/web-site/web-site-channel-content-tree-view/web-site-channel-content-tree-view.vue'));
Vue.component('web-site-edit-view', () => import('@pages/web-site/web-site-edit-view/web-site-edit-view.vue'));
Vue.component('web-site-resource-edit-view', () => import('@pages/web-site/web-site-resource-edit-view/web-site-resource-edit-view.vue'));
Vue.component('web-site-content-edit-view', () => import('@pages/web-site/web-site-content-edit-view/web-site-content-edit-view.vue'));
Vue.component('web-site-resource-edit-view', () => import('@pages/web-site/web-site-resource-edit-view/web-site-resource-edit-view.vue'));
Vue.component('web-site-channel-grid-view', () => import('@pages/web-site/web-site-channel-grid-view/web-site-channel-grid-view.vue'));
Vue.component('web-site-resource-grid-view', () => import('@pages/web-site/web-site-resource-grid-view/web-site-resource-grid-view.vue'));
}
......
......@@ -151,47 +151,47 @@ const router = new Router({
component: () => import('@pages/web-site/web-site-content-grid-view/web-site-content-grid-view.vue'),
},
{
path: 'websites/:website?/editview/:editview?',
path: 'websites/:website?/websitechannels/:websitechannel?/contenttreeview/:contenttreeview?',
meta: {
caption: 'entities.website.views.editview.title',
caption: 'entities.websitechannel.views.contenttreeview.title',
info:'',
parameters: [
{ pathName: 'website', parameterName: 'website' },
{ pathName: 'websites', parameterName: 'website' },
{ pathName: 'editview', parameterName: 'editview' },
{ pathName: 'websitechannels', parameterName: 'websitechannel' },
{ pathName: 'contenttreeview', parameterName: 'contenttreeview' },
],
requireAuth: true,
},
component: () => import('@pages/web-site/web-site-edit-view/web-site-edit-view.vue'),
component: () => import('@pages/web-site/web-site-channel-content-tree-view/web-site-channel-content-tree-view.vue'),
},
{
path: 'websites/:website?/websiteresources/:websiteresource?/editview/:editview?',
path: 'websitechannels/:websitechannel?/contenttreeview/:contenttreeview?',
meta: {
caption: 'entities.websiteresource.views.editview.title',
caption: 'entities.websitechannel.views.contenttreeview.title',
info:'',
parameters: [
{ pathName: 'website', parameterName: 'website' },
{ pathName: 'websites', parameterName: 'website' },
{ pathName: 'websiteresources', parameterName: 'websiteresource' },
{ pathName: 'editview', parameterName: 'editview' },
{ pathName: 'websitechannels', parameterName: 'websitechannel' },
{ pathName: 'contenttreeview', parameterName: 'contenttreeview' },
],
requireAuth: true,
},
component: () => import('@pages/web-site/web-site-resource-edit-view/web-site-resource-edit-view.vue'),
component: () => import('@pages/web-site/web-site-channel-content-tree-view/web-site-channel-content-tree-view.vue'),
},
{
path: 'websiteresources/:websiteresource?/editview/:editview?',
path: 'websites/:website?/editview/:editview?',
meta: {
caption: 'entities.websiteresource.views.editview.title',
caption: 'entities.website.views.editview.title',
info:'',
parameters: [
{ pathName: 'website', parameterName: 'website' },
{ pathName: 'websiteresources', parameterName: 'websiteresource' },
{ pathName: 'websites', parameterName: 'website' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/web-site/web-site-resource-edit-view/web-site-resource-edit-view.vue'),
component: () => import('@pages/web-site/web-site-edit-view/web-site-edit-view.vue'),
},
{
path: 'websites/:website?/websitechannels/:websitechannel?/websitecontents/:websitecontent?/editview/:editview?',
......@@ -253,6 +253,35 @@ const router = new Router({
},
component: () => import('@pages/web-site/web-site-content-edit-view/web-site-content-edit-view.vue'),
},
{
path: 'websites/:website?/websiteresources/:websiteresource?/editview/:editview?',
meta: {
caption: 'entities.websiteresource.views.editview.title',
info:'',
parameters: [
{ pathName: 'website', parameterName: 'website' },
{ pathName: 'websites', parameterName: 'website' },
{ pathName: 'websiteresources', parameterName: 'websiteresource' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/web-site/web-site-resource-edit-view/web-site-resource-edit-view.vue'),
},
{
path: 'websiteresources/:websiteresource?/editview/:editview?',
meta: {
caption: 'entities.websiteresource.views.editview.title',
info:'',
parameters: [
{ pathName: 'website', parameterName: 'website' },
{ pathName: 'websiteresources', parameterName: 'websiteresource' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/web-site/web-site-resource-edit-view/web-site-resource-edit-view.vue'),
},
{
path: 'websites/:website?/websitechannels/:websitechannel?/gridview/:gridview?',
meta: {
......
import { Subject } from 'rxjs';
import { TreeExpViewBase } from '@/studio-core';
import WebSiteChannelService from '@/service/web-site-channel/web-site-channel-service';
import TreeExpViewEngine from '@engine/view/tree-exp-view-engine';
/**
* 频道内容视图基类
*
* @export
* @class WebSiteChannelContentTreeViewBase
* @extends {TreeExpViewBase}
*/
export class WebSiteChannelContentTreeViewBase extends TreeExpViewBase {
/**
* 实体服务对象
*
* @type {WebSiteChannelService}
* @memberof WebSiteChannelContentTreeViewBase
*/
protected appEntityService: WebSiteChannelService = new WebSiteChannelService;
/**
* 计数器服务对象集合
*
* @protected
* @type {Array<*>}
* @memberof WebSiteChannelContentTreeViewBase
*/
protected counterServiceArray: Array<any> = [];
/**
* 视图模型数据
*
* @protected
* @type {*}
* @memberof WebSiteChannelContentTreeViewBase
*/
protected model: any = {
srfCaption: 'entities.websitechannel.views.contenttreeview.caption',
srfTitle: 'entities.websitechannel.views.contenttreeview.title',
srfSubTitle: 'entities.websitechannel.views.contenttreeview.subtitle',
dataInfo: ''
}
/**
* 容器模型
*
* @protected
* @type {*}
* @memberof WebSiteChannelContentTreeViewBase
*/
protected containerModel: any = {
view_treeexpbar: { name: 'treeexpbar', type: 'TREEEXPBAR' },
};
/**
* 视图唯一标识
*
* @protected
* @type {string}
* @memberof ViewBase
*/
protected viewtag: string = '9b9de8c2724ef66a73380159197e7d72';
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof WebSiteChannelContentTreeViewBase
*/
public engine: TreeExpViewEngine = new TreeExpViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof WebSiteChannelContentTreeViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
treeexpbar: this.$refs.treeexpbar,
keyPSDEField: 'websitechannel',
majorPSDEField: 'websitechannelname',
isLoadDefault: true,
});
}
/**
* treeexpbar 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WebSiteChannelContentTreeViewBase
*/
public treeexpbar_selectionchange($event: any, $event2?: any): void {
this.engine.onCtrlEvent('treeexpbar', 'selectionchange', $event);
}
/**
* treeexpbar 部件 activated 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WebSiteChannelContentTreeViewBase
*/
public treeexpbar_activated($event: any, $event2?: any): void {
this.engine.onCtrlEvent('treeexpbar', 'activated', $event);
}
/**
* treeexpbar 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WebSiteChannelContentTreeViewBase
*/
public treeexpbar_load($event: any, $event2?: any): void {
this.engine.onCtrlEvent('treeexpbar', 'load', $event);
}
/**
* 打开新建数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof WebSiteChannelContentTreeView
*/
public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
let localContext:any = null;
let localViewParam:any =null;
this.$Notice.warning({ title: '错误', desc: '未指定关系视图' });
}
/**
* 打开编辑数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof WebSiteChannelContentTreeView
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) {
let localContext:any = null;
let localViewParam:any =null;
this.$Notice.warning({ title: '错误', desc: '未指定关系视图' });
}
/**
* 视图唯一标识
*
* @type {string}
* @memberof WebSiteChannelContentTreeView
*/
public viewUID: string = 'web-site-web-site-channel-content-tree-view';
}
\ No newline at end of file
<studio-view-style2 viewName="websitechannelcontenttreeview" viewTitle="频道内容" class='detreeexpview web-site-channel-content-tree-view'>
<template slot='title'>
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</template>
<view_treeexpbar
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:viewUID="viewUID"
:newdata="newdata"
:opendata="opendata"
name="treeexpbar"
ref='treeexpbar'
@selectionchange="treeexpbar_selectionchange($event)"
@activated="treeexpbar_activated($event)"
@load="treeexpbar_load($event)"
@closeview="closeView($event)">
</view_treeexpbar>
</studio-view-style2>
\ No newline at end of file
<template src="./web-site-channel-content-tree-view.html"/>
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import { VueLifeCycleProcessing } from '@/studio-core';
import { WebSiteChannelContentTreeViewBase } from './web-site-channel-content-tree-view-base';
import view_treeexpbar from '@widgets/web-site-channel/content-tree-viewtreeexpbar-treeexpbar/content-tree-viewtreeexpbar-treeexpbar.vue';
/**
* 频道内容视图
*
* @export
* @class WebSiteChannelContentTreeView
* @extends {WebSiteChannelContentTreeViewBase}
*/
@Component({
components: {
view_treeexpbar,
}
})
@VueLifeCycleProcessing()
export default class WebSiteChannelContentTreeView extends WebSiteChannelContentTreeViewBase { }
</script>
......@@ -15,12 +15,6 @@ import view_form from '@widgets/web-site-channel/main-form/main-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$appService.navHistory.setViewTag(vm.viewtag, to);
vm.$appService.navHistory.setViewContext(vm.context, to);
});
}
})
@VueLifeCycleProcessing()
......
......@@ -17,12 +17,6 @@ import view_searchform from '@widgets/web-site-channel/default-searchform/defaul
components: {
view_grid,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$appService.navHistory.setViewTag(vm.viewtag, to);
vm.$appService.navHistory.setViewContext(vm.context, to);
});
}
})
@VueLifeCycleProcessing()
......
......@@ -15,12 +15,6 @@ import view_form from '@widgets/web-site-content/main-form/main-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$appService.navHistory.setViewTag(vm.viewtag, to);
vm.$appService.navHistory.setViewContext(vm.context, to);
});
}
})
@VueLifeCycleProcessing()
......
......@@ -17,12 +17,6 @@ import view_searchform from '@widgets/web-site-content/default-searchform/defaul
components: {
view_grid,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$appService.navHistory.setViewTag(vm.viewtag, to);
vm.$appService.navHistory.setViewContext(vm.context, to);
});
}
})
@VueLifeCycleProcessing()
......
......@@ -15,12 +15,6 @@ import view_form from '@widgets/web-site/main-form/main-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$appService.navHistory.setViewTag(vm.viewtag, to);
vm.$appService.navHistory.setViewContext(vm.context, to);
});
}
})
@VueLifeCycleProcessing()
......
......@@ -17,12 +17,6 @@ import view_searchform from '@widgets/web-site/default-searchform/default-search
components: {
view_grid,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$appService.navHistory.setViewTag(vm.viewtag, to);
vm.$appService.navHistory.setViewContext(vm.context, to);
});
}
})
@VueLifeCycleProcessing()
......
......@@ -15,12 +15,6 @@ import view_form from '@widgets/web-site-resource/main-form/main-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$appService.navHistory.setViewTag(vm.viewtag, to);
vm.$appService.navHistory.setViewContext(vm.context, to);
});
}
})
@VueLifeCycleProcessing()
......
......@@ -17,12 +17,6 @@ import view_searchform from '@widgets/web-site-resource/default-searchform/defau
components: {
view_grid,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$appService.navHistory.setViewTag(vm.viewtag, to);
vm.$appService.navHistory.setViewContext(vm.context, to);
});
}
})
@VueLifeCycleProcessing()
......
......@@ -340,4 +340,22 @@ export default class WebSiteChannelServiceBase extends EntityService {
let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/websitechannels/fetchdefault`,tempData,isloading);
}
/**
* FetchRoot接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WebSiteChannelServiceBase
*/
public async FetchRoot(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.website && true){
let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/websites/${context.website}/websitechannels/fetchroot`,tempData,isloading);
}
let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/websitechannels/fetchroot`,tempData,isloading);
}
}
\ No newline at end of file
......@@ -50,6 +50,16 @@ export const viewstate: any = {
refviews: [
],
},
{
viewtag: '9b9de8c2724ef66a73380159197e7d72',
viewmodule: 'WebSite',
viewname: 'WebSiteChannelContentTreeView',
viewaction: '',
viewdatachange: false,
refviews: [
'd3e1d08292c9d8474b8b6ef7b161b045',
],
},
{
viewtag: 'a7a0d344965e73bc3007248ca2cfdfa9',
viewmodule: 'WebSite',
......@@ -87,7 +97,7 @@ export const viewstate: any = {
viewdatachange: false,
refviews: [
'ae5751b832d4b1fcd33a2195a2425390',
'd3e1d08292c9d8474b8b6ef7b161b045',
'9b9de8c2724ef66a73380159197e7d72',
'217b6c971b8e8981b6ed12189607c795',
'3aae044bf3c4e3a671ad89955fd060a4',
],
......
......@@ -438,7 +438,7 @@
>.translate-contant {
display: flex;
height: calc(100% - 44px);
height: 100%;
width: 100%;
>.center {
......
......@@ -110,4 +110,14 @@ export class UIStateService {
}
}
/**
* 是否为Style2模式
*
* @returns {boolean}
* @memberof UIStateService
*/
public isStyle2(): boolean {
return this.layoutState.styleMode === 'STYLE2';
}
}
\ No newline at end of file
import { Util } from '@/utils';
import qs from 'qs';
import i18n from '@/locale'
import { AppContextStore } from '../app-context-store/AppContextStore';
import { UIStateService } from '../UIStateService';
......@@ -37,6 +38,13 @@ export interface HistoryItem {
* @memberof HistoryItem
*/
context?: any;
/**
* 标题
*
* @type {string}
* @memberof HistoryItem
*/
title?: string;
}
/**
......@@ -89,13 +97,33 @@ export class AppNavHistoryBase {
/**
* Creates an instance of AppNavHistoryBase.
*
* @memberof AppNavHistoryBase
*/
constructor() {
addEventListener('popstate', (event) => {
if (this.uiStateService.layoutState.styleMode === 'STYLE2') {
addEventListener('hashchange', ({ oldURL }) => {
const hash = oldURL.substring(oldURL.indexOf('#') + 1);
const queryIndex = hash.indexOf('?');
const path = queryIndex === -1 ? hash : hash.substring(0, queryIndex);
const queryStr = queryIndex === -1 ? '' : hash.substring(queryIndex + 1);
if (this.isRouteSame({ path, query: !isEmpty(queryStr) ? qs.parse(queryStr) : {} }, this.historyList[this.historyList.length - 1].to)) {
this.pop();
}
});
}
}
/**
* 根据视图标识查找记录
*
* @param {string} tag
* @returns {*}
* @memberof AppNavHistoryBase
*/
public findHistoryByTag(tag: string): any {
return this.historyList.find((item) => (isExistAndNotEmpty(item.tag) && item.tag === tag));
}
/**
* 查找路由缓存
......@@ -106,37 +134,52 @@ export class AppNavHistoryBase {
* @memberof AppNavHistoryBase
*/
public findHistoryIndex(page: any, list: any[] = this.historyList): number {
if (page === undefined || page === null) {
if (!isExist(page)) {
return -1;
}
return list.findIndex((item: any) => {
const to = item.to;
// 基本路径是否一致
if (Object.is(to.path, page.path)) {
// 历史路径是否存在参数
if (this.uiStateService.layoutState.styleMode === 'STYLE2' && to.query) {
let judge: boolean = true;
// 新路径是否存在参数
if (page.query) {
for (const key in page.query) {
return this.isRouteSame(page, item.to);
});;
}
/**
* 新旧路由是否相同
*
* @param {*} newRoute
* @param {*} oldRoute
* @returns {boolean}
* @memberof AppNavHistoryBase
*/
public isRouteSame(newRoute: any, oldRoute: any): boolean {
if (Object.is(newRoute.path, oldRoute.path)) {
return this.isQuerySame(newRoute.query, oldRoute.query);
}
return false;
}
/**
* 判断查询参数是否相同,会排除预定义的忽略参数
*
* @param {*} newQuery 新查询参数
* @param {*} oldQuery 旧查询参数
* @returns {boolean}
* @memberof AppNavHistoryBase
*/
public isQuerySame(newQuery: any, oldQuery: any): boolean {
if (Object.keys(newQuery).length !== Object.keys(oldQuery).length) {
return false;
}
for (const key in newQuery) {
// 忽略的参数略过
if (this.navIgnoreParameters.test(`|${key}|`)) {
continue;
}
if (to.query[key] === undefined || to.query[key] === null) {
judge = false;
}
}
} else {
judge = false;
if (!isExist(oldQuery) || !Object.is(oldQuery[key], newQuery[key])) {
return false;
}
return judge;
}
return true;
}
return false;
});;
}
/**
* 添加视图缓存
......@@ -151,9 +194,10 @@ export class AppNavHistoryBase {
}
this.historyList.push({
to,
meta: Util.deepCopy(to.meta),
meta: JSON.parse(JSON.stringify(to.meta)),
tag: '',
context: {}
context: {},
title: i18n.t(to.meta.caption).toString()
});
}
}
......@@ -184,21 +228,20 @@ export class AppNavHistoryBase {
/**
* 设置指定缓存视图标题
*
* @param {({ route: any, caption: string | null, info: string | null })} { route, caption, info }
* @param {({ tag: string, caption: string | null, info: string | null })} { tag, caption, info }
* @returns {boolean}
* @memberof AppNavHistoryBase
*/
public setCaption({ route, caption, info }: { route: any, caption?: string, info?: string }): boolean {
const i = this.findHistoryIndex(route);
if (i === -1) {
return false;
}
const item = this.historyList[i];
public setCaption({ tag, caption, info }: { tag: string, caption?: string, info?: string }): boolean {
const item: HistoryItem = this.findHistoryByTag(tag);
if (item) {
if (caption) {
item.meta.caption = caption;
}
if (info) {
if (isExistAndNotEmpty(info)) {
item.meta.info = info;
item.title = `${i18n.t(item.meta.caption)} - ${info}`;
}
}
return true;
}
......@@ -217,6 +260,9 @@ export class AppNavHistoryBase {
return false;
}
const item = this.historyList[i];
if (isExistAndNotEmpty(item.tag)) {
return false;
}
item.tag = tag;
return true;
}
......@@ -225,19 +271,18 @@ export class AppNavHistoryBase {
* 设置路由视图上下文
*
* @param {*} context
* @param {*} route
* @param {*} tag
* @returns {boolean}
* @memberof AppNavHistoryBase
*/
public setViewContext(context: any, route: any): boolean {
const i = this.findHistoryIndex(route);
if (i === -1) {
return false;
}
const item = this.historyList[i];
public setViewContext(context: any, tag: any): boolean {
const item = this.findHistoryByTag(tag);
if (item) {
item.context = context;
return true;
}
return false;
}
/**
* 删除其他缓存
......
......@@ -22,4 +22,28 @@ declare global {
*/
clearAll(): void;
}
/**
* 判断对象是否存在,判断是否为undefined或null,避免数值型0误判
*
* @param {*} obj
* @returns {boolean}
*/
function isExist(obj: any): boolean;
/**
* 判断字符串是否为空
*
* @param {string | undefined | null} str
* @returns {boolean}
*/
function isEmpty(str: string | undefined | null): boolean;
/**
* 判断字符串,存在并且不为空
*
* @param {string | undefined | null} str
* @returns {boolean}
*/
function isExistAndNotEmpty(str: string | undefined | null): boolean;
}
\ No newline at end of file
......@@ -13,3 +13,33 @@ Object.defineProperty(Object.prototype, 'clearAll', {
}
}
});
// 扩展window方法 Start
/**
* 判断对象是否为空,避免发生数值0误判
*
* @param obj
*/
window.isExist = function(obj: any) {
return obj !== undefined && obj !== null;
}
/**
* 判断字符串是否为空
*
* @param str
*/
window.isEmpty = function(str: string | undefined | null) {
return Object.is(str, '');
}
/**
* 字符串不为空并且
*
* @param str
*/
window.isExistAndNotEmpty = function(str: string | undefined | null) {
return isExist(str) && !isEmpty(str);
}
// 扩展window方法 End
\ No newline at end of file
......@@ -117,6 +117,13 @@
height: 100%;
}
}
>.studio-view.view-container.show-footer {
>.view-content {
height: calc(100% - 46px);
}
}
}
}
}
\ No newline at end of file
......@@ -292,10 +292,16 @@ export class ViewBase extends Vue {
if (this.viewUsage === 1 || this.viewUsage === 2) {
this.$appService.viewStore.push(this);
}
const secondtag = this.$util.createUUID();
const secondtag = (this as any)._uid;
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
if (this.viewUsage === 1) {
this.$appService.navHistory.setViewTag(this.viewtag, this.$route);
}
this.parseViewParam();
if (this.viewUsage === 1) {
this.$appService.navHistory.setViewContext(this.context, this.viewtag);
}
this.viewCreated();
}
......
......@@ -80,6 +80,7 @@ export default class WebSiteChannelUIServiceBase extends UIService {
*/
public initViewMap(){
this.allViewMap.set('MDATAVIEW:',{viewname:'gridview',srfappde:'websitechannels'});
this.allViewMap.set(':',{viewname:'contenttreeview',srfappde:'websitechannels'});
this.allViewMap.set('EDITVIEW:',{viewname:'editview',srfappde:'websitechannels'});
}
......
......@@ -28,7 +28,7 @@ export class WebSiteBase extends Vue {
judge = false;
console.warn('未指定应用功能');
}
if (judge) {
if (judge && this.$uiState.isStyle2()) {
this.$appService.navHistory.reset();
}
}
......@@ -68,8 +68,8 @@ export class WebSiteBase extends Vue {
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'websitecontents', parameterName: 'websitecontent' },
{ pathName: 'gridview', parameterName: 'gridview' },
{ pathName: 'websitechannels', parameterName: 'websitechannel' },
{ pathName: 'contenttreeview', parameterName: 'contenttreeview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
if(Object.is(this.$route.fullPath,path)){
......
......@@ -150,7 +150,7 @@ export default class WebSiteModel {
textcls: '',
appfunctag: '_5',
appfuncyype: 'APPVIEW',
viewname: 'web-site-content-grid-view',
viewname: 'web-site-channel-content-tree-view',
resourcetag: '',
}
,
......@@ -280,12 +280,12 @@ export default class WebSiteModel {
appfunctag: '_5',
appfuncyype: 'APPVIEW',
openmode: '',
codename: 'websitecontentgridview',
codename: 'websitechannelcontenttreeview',
deResParameters: [],
routepath: '/website/:website?/websitecontents/:websitecontent?/gridview/:gridview?',
routepath: '/website/:website?/websitechannels/:websitechannel?/contenttreeview/:contenttreeview?',
parameters: [
{ pathName: 'websitecontents', parameterName: 'websitecontent' },
{ pathName: 'gridview', parameterName: 'gridview' },
{ pathName: 'websitechannels', parameterName: 'websitechannel' },
{ pathName: 'contenttreeview', parameterName: 'contenttreeview' },
],
},
{
......
import { Prop, Provide, Emit, Model } from 'vue-property-decorator';
import { Subject, Subscription } from 'rxjs';
import { Watch, MainControlBase } from '@/studio-core';
import WebSiteChannelService from '@/service/web-site-channel/web-site-channel-service';
import ChannelTreeService from './channel-tree-treeview-service';
/**
* treeexpbar_tree部件基类
*
* @export
* @class MainControlBase
* @extends {ChannelTreeTreeBase}
*/
export class ChannelTreeTreeBase extends MainControlBase {
/**
* 建构部件服务对象
*
* @type {ChannelTreeService}
* @memberof ChannelTreeTreeBase
*/
public service: ChannelTreeService = new ChannelTreeService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {WebSiteChannelService}
* @memberof ChannelTreeTreeBase
*/
public appEntityService: WebSiteChannelService = new WebSiteChannelService({ $store: this.$store });
/**
* 应用实体名称
*
* @protected
* @type {string}
* @memberof ChannelTreeTreeBase
*/
protected appDeName: string = 'websitechannel';
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof ChannelTree
*/
public getDatas(): any[] {
return [this.currentselectedNode];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof ChannelTree
*/
public getData(): any {
return this.currentselectedNode;
}
/**
* 是否单选
*
* @type {boolean}
* @memberof ChannelTree
*/
@Prop({ default: true }) public isSingleSelect!: boolean;
/**
* 是否默认选中第一条数据
*
* @type {boolean}
* @memberof ChannelTree
*/
@Prop({ default: false }) public isSelectFirstDefault!: boolean;
/**
* 枝干节点是否可用(具有数据能力,可抛出)
*
* @type {string}
* @memberof ChannelTree
*/
@Prop({default:true}) public isBranchAvailable!: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof ChannelTree
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 初始化完成
*
* @type {boolean}
* @memberof ChannelTree
*/
public inited: boolean = false;
/**
* 已选中数据集合
*
* @type {*}
* @memberof ChannelTree
*/
public selectedNodes: any = [];
/**
* 当前选中数据项
*
* @type {*}
* @memberof ChannelTree
*/
public currentselectedNode: any = {};
/**
* 选中数据字符串
*
* @type {string}
* @memberof ChannelTree
*/
@Prop() public selectedData?: string;
/**
* 选中值变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof ChannelTree
*/
@Watch('selectedData')
public onValueChange(newVal: any, oldVal: any) {
this.echoselectedNodes = newVal ? this.isSingleSelect ? JSON.parse(newVal)[0] : JSON.parse(newVal) : [];
this.selectedNodes = [];
if(this.echoselectedNodes.length > 0){
let AllnodesObj = (this.$refs.treeexpbar_tree as any).store.nodesMap;
let AllnodesArray : any[] = [];
for (const key in AllnodesObj) {
if (AllnodesObj.hasOwnProperty(key)) {
AllnodesArray.push(AllnodesObj[key].data);
}
}
this.setDefaultSelection(AllnodesArray);
}
}
/**
* 回显选中数据集合
*
* @type {*}
* @memberof ChannelTree
*/
public echoselectedNodes:any[] = this.selectedData ? ( this.isSingleSelect ? [JSON.parse(this.selectedData)[0]] : JSON.parse(this.selectedData)) : [];
/**
* 部件行为--update
*
* @type {string}
* @memberof ChannelTree
*/
@Prop() public updateAction!: string;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof ChannelTree
*/
@Prop() public fetchAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof ChannelTree
*/
@Prop() public removeAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof ChannelTree
*/
@Prop() public loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof ChannelTree
*/
@Prop() public createAction!: string;
/**
* 过滤属性
*
* @type {string}
* @memberof ChannelTree
*/
public srfnodefilter: string = '';
/**
* 默认输出图标
*
* @type {boolean}
* @memberof ChannelTree
*/
public isOutputIconDefault: boolean = true;
/**
* 数据展开主键
*
* @type {string[]}
* @memberof ChannelTree
*/
@Provide()
public expandedKeys: string[] = [];
/**
* 选中数据变更事件
*
* @public
* @param {*} data
* @param {*} data 当前节点对应传入对象
* @param {*} checkedState 树目前选中状态对象
* @memberof ChannelTree
*/
public onCheck(data: any, checkedState: any) {
// 处理多选数据
if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.$emit('selectionchange', this.selectedNodes);
}
}
/**
* 选中数据变更事件
*
* @public
* @param {*} data 节点对应传入对象
* @param {*} node 节点对应node对象
* @memberof ChannelTree
*/
public selectionChange(data: any, node: any) {
// 禁用项处理
if (data.disabled){
node.isCurrent = false;
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
this.selectedNodes = [this.currentselectedNode];
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
}
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof ChannelTree
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof ChannelTree
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('load', action)) {
this.inited = false;
this.$nextTick(() => {
this.inited = true;
});
}
if (Object.is('filter', action)) {
this.srfnodefilter = data.srfnodefilter;
this.refresh_all();
}
if (Object.is('refresh_parent', action)) {
this.refresh_parent();
}
});
}
}
/**
* 对树节点进行筛选操作
* @memberof OrderTree
*/
public filterNode(value:any, data:any) {
if (!value) return true;
return data.text.indexOf(value) !== -1;
}
/**
* vue 生命周期
*
* @memberof ChannelTree
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof ChannelTree
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
/**
* 刷新数据
*
* @memberof ChannelTree
*/
public refresh_all(): void {
this.inited = false;
this.$nextTick(() => {
this.inited = true;
});
}
/**
* 刷新父节点
*
* @memberof ChannelTree
*/
public refresh_parent(): void {
if (Object.keys(this.currentselectedNode).length === 0) {
return;
}
const tree: any = this.$refs.treeexpbar_tree;
const node: any = tree.getNode(this.currentselectedNode.id);
if (!node || !node.parent) {
return;
}
let curNode:any = {};
const { parent: _parent } = node;
curNode = this.$util.deepObjectMerge(curNode,_parent);
let tempContext:any = {};
if(curNode.data && curNode.data.srfappctx){
Object.assign(tempContext,curNode.data.srfappctx);
}else{
Object.assign(tempContext,this.context);
}
const id: string = _parent.key ? _parent.key : '#';
const param: any = { srfnodeid: id };
this.refresh_node(tempContext,param, true);
}
/**
* 数据加载
*
* @param {*} node
* @memberof ChannelTree
*/
public load(node: any = {}, resolve?: any) {
if (node.data && node.data.children) {
resolve(node.data.children);
return;
}
const params: any = {
srfnodeid: node.data && node.data.id ? node.data.id : "#",
srfnodefilter: this.srfnodefilter
};
let tempViewParams:any = JSON.parse(JSON.stringify(this.viewparams));
let curNode:any = {};
curNode = this.$util.deepObjectMerge(curNode,node);
let tempContext:any = this.computecurNodeContext(curNode);
if(curNode.data && curNode.data.srfparentdename){
Object.assign(tempContext,{srfparentdename:curNode.data.srfparentdename});
Object.assign(tempViewParams,{srfparentdename:curNode.data.srfparentdename});
}
if(curNode.data && curNode.data.srfparentkey){
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
}
Object.assign(params,{viewparams:tempViewParams});
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: "错误", desc: response.info });
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
resolve([..._items]);
let isRoot = Object.is(node.level,0);
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
}).catch((response: any) => {
resolve([]);
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: "错误", desc: response.info });
});
}
/**
* 计算当前节点的上下文
*
* @param {*} curNode 当前节点
* @memberof ChannelTree
*/
public computecurNodeContext(curNode:any){
let tempContext:any = {};
if(curNode && curNode.data && curNode.data.srfappctx){
tempContext = JSON.parse(JSON.stringify(curNode.data.srfappctx));
}else{
tempContext = JSON.parse(JSON.stringify(this.context));
}
return tempContext;
}
/**
* 刷新功能
*
* @param {any[]} args
* @memberof ChannelTree
*/
public refresh(args: any[]): void {
this.refresh_all();
}
/**
* 刷新节点
*
* @public
* @param {*} [curContext] 当前节点上下文
* @param {*} [arg={}] 当前节点附加参数
* @param {boolean} parentnode 是否是刷新父节点
* @memberof ChannelTree
*/
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(this.context)),arg);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '错误', desc: response.info });
return;
}
const _items = [...response.data];
this.formatExpanded(_items);
const tree: any = this.$refs.treeexpbar_tree;
tree.updateKeyChildren(id, _items);
if (parentnode) {
this.currentselectedNode = {};
}
this.setDefaultSelection(_items);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: '错误', desc: response.info });
});
}
/**
* 默认展开节点
*
* @public
* @param {any[]} items
* @returns {any[]}
* @memberof ChannelTree
*/
public formatExpanded(items: any[]): any[] {
const data: any[] = [];
items.forEach((item) => {
if (item.expanded || (item.children && item.children.length > 0)) {
this.expandedKeys.push(item.id);
}
});
return data;
}
/**
* 设置默认选中,回显数项,选中所有子节点
*
* @param {any[]} items 当前节点所有子节点集合
* @param {boolean} isRoot 是否是加载根节点
* @param {boolean} isSelectedAll 是否选中所有子节点
* @memberof MainTree
*/
public setDefaultSelection(items: any[], isRoot: boolean = false, isSelectedAll: boolean = false): void {
if(items.length == 0){
return;
}
let defaultData: any;
// 导航中选中第一条配置的默认选中,没有选中第一条
if(this.isSelectFirstDefault){
if(this.isSingleSelect){
let index = items.findIndex((item: any) => item.selected);
if(index === -1) {
if(isRoot){
index = 0;
}else{
return;
}
}
defaultData = items[index];
this.setTreeNodeHighLight(defaultData);
this.currentselectedNode = JSON.parse(JSON.stringify(defaultData));
if(this.isBranchAvailable || defaultData.leaf){
this.selectedNodes = [this.currentselectedNode];
this.$emit('selectionchange', this.selectedNodes);
}
}
}
// 已选数据的回显
if(this.echoselectedNodes && this.echoselectedNodes.length > 0){
let checkedNodes = items.filter((item:any)=>{
return this.echoselectedNodes.some((val:any)=> {
if(Object.is(item.srfkey,val.srfkey) && Object.is(item.srfmajortext,val.srfmajortext)){
val.used = true;
return true;
}
});
});
if(checkedNodes.length > 0){
this.echoselectedNodes = this.echoselectedNodes.filter((item:any)=> !item.used);
// 父节点选中时,不需要执行这段,会选中所有子节点
if(!isSelectedAll){
if(this.isSingleSelect){
this.setTreeNodeHighLight(checkedNodes[0]);
this.currentselectedNode = JSON.parse(JSON.stringify(checkedNodes[0]));
this.selectedNodes = [this.currentselectedNode];
}else{
this.selectedNodes = this.selectedNodes.concat(checkedNodes);
const tree: any = this.$refs.treeexpbar_tree;
tree.setCheckedNodes(this.selectedNodes);
}
}
}
}
// 父节点选中时,选中所有子节点
if(isSelectedAll){
let leafNodes = items.filter((item:any) => item.leaf);
this.selectedNodes = this.selectedNodes.concat(leafNodes);
this.$emit('selectionchange', this.selectedNodes);
}
}
/**
* 绘制右击菜单
*
* @param {*} node
* @returns
* @memberof ChannelTree
*/
public renderContextMenu(node: any) {
let content;
if (node && node.data) {
const data: any = JSON.parse(JSON.stringify(node.data));
this.currentselectedNode = { ...data };
const tags: string[] = data.id.split(';');
}
return content;
}
/**
* 设置选中高亮
*
* @param {*} data
* @memberof ChannelTree
*/
public setTreeNodeHighLight(data: any): void {
const tree: any = this.$refs.treeexpbar_tree;
tree.setCurrentKey(data.id);
}
/**
* 执行默认界面行为
*
* @param {*} node
* @memberof AppView
*/
public doDefaultAction(node: any) {
if (node && node.data) {
const data: any = node.data;
const tags: string[] = data.id.split(';');
}
this.$emit('nodedblclick', this.selectedNodes);
}
}
\ No newline at end of file
/**
* ChannelTree 部件模型
*
* @export
* @class ChannelTreeModel
*/
export default class ChannelTreeModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof ChannelTreeModel
*/
public getDataItems(): any[] {
return [
{
name: 'websitechannel',
prop: 'websitechannelid',
},
{
name: 'createman',
},
{
name: 'websitechannelname',
},
{
name: 'updatedate',
},
{
name: 'createdate',
},
{
name: 'updateman',
},
{
name: 'websiteid',
},
{
name: 'pwebsitechannelid',
},
{
name: 'pwebsitechannelname',
},
{
name: 'websitename',
},
{
name: 'channeltype',
},
{
name: 'channelcode',
},
{
name: 'sn',
},
{
name: 'memo',
},
{
name: 'validflag',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import WebSiteChannelService from '@/service/web-site-channel/web-site-channel-service';
import ChannelTreeModel from './channel-tree-treeview-model';
import CodeListService from '@service/app/codelist-service';
import i18n from '@/locale';
import WebSiteService from '@service/web-site/web-site-service';
/**
* ChannelTree 部件服务对象
*
* @export
* @class ChannelTreeService
*/
export default class ChannelTreeService extends ControlService {
/**
* 站点频道服务对象
*
* @type {WebSiteChannelService}
* @memberof ChannelTreeService
*/
public appEntityService: WebSiteChannelService = new WebSiteChannelService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof ChannelTreeService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of ChannelTreeService.
*
* @param {*} [opts={}]
* @memberof ChannelTreeService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new ChannelTreeModel();
}
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof ChannelTreeService
*/
public codeListService:CodeListService = new CodeListService({ $store: this.getStore() });
/**
* 网站服务对象
*
* @type {WebSiteService}
* @memberof ChannelTreeService
*/
public websiteService: WebSiteService = new WebSiteService({ $store: this.getStore() });
/**
* 节点分隔符号
*
* @public
* @type {string}
* @memberof ChannelTreeService
*/
public TREENODE_SEPARATOR: string = ';';
/**
* 子频道节点分隔符号
*
* @public
* @type {string}
* @memberof ChannelTreeService
*/
public TREENODE_CHILDCHANNEL: string = 'ChildChannel';
/**
* 站点频道节点分隔符号
*
* @public
* @type {string}
* @memberof ChannelTreeService
*/
public TREENODE_ROOTCHANNEL: string = 'RootChannel';
/**
* 站点节点分隔符号
*
* @public
* @type {string}
* @memberof ChannelTreeService
*/
public TREENODE_WEBSITE: string = 'WEBSITE';
/**
* 默认根节点节点分隔符号
*
* @public
* @type {string}
* @memberof ChannelTreeService
*/
public TREENODE_ROOT: string = 'ROOT';
/**
* 获取节点数据
*
* @param {string} action
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof ChannelTreeService
*/
@Errorlog
public async getNodes(context:any = {},data: any = {}, isloading?: boolean): Promise<any> {
let { srfparentkey, srfcat, srfnodeid, srfnodefilter, query }: { srfparentkey: string, srfcat: string, srfnodeid: string, srfnodefilter: string, query:string } = data;
srfnodefilter = query ? query : srfnodefilter;
let list: any[] = [];
let filter: any = {};
if (!srfnodeid || Object.is(srfnodeid, '#')) {
srfnodeid = this.TREENODE_ROOT;
}
let strTreeNodeId: string = srfnodeid;
let strRealNodeId: string = '';
let bRootSelect: boolean = false;
let strNodeType: string | null = null;
let strRootSelectNode: string = '';
if (Object.is(strTreeNodeId, this.TREENODE_ROOT)) {
strNodeType = this.TREENODE_ROOT;
if (srfparentkey) {
strRealNodeId = srfparentkey;
}
} else {
let nPos = strTreeNodeId.indexOf(this.TREENODE_SEPARATOR);
if (nPos === -1) {
return Promise.reject({ status: 500, data: { title: '失败', message: `树节点${strTreeNodeId}标识无效` } });
}
strNodeType = strTreeNodeId.substring(0, nPos);
strRealNodeId = strTreeNodeId.substring(nPos + 1);
}
Object.assign(filter,
{
srfparentkey: srfparentkey,
srfcat: srfcat,
srfnodefilter: srfnodefilter,
strRealNodeId: strRealNodeId,
srfnodeid: srfnodeid,
strNodeType: strNodeType,
viewparams: JSON.parse(JSON.stringify(data)).viewparams
}
);
// 分解节点标识
let nodeid: string[] = strRealNodeId.split(this.TREENODE_SEPARATOR);
for (let i = 0; i < nodeid.length; i++) {
switch (i) {
case 0:
Object.assign(filter, { nodeid: nodeid[0] });
break;
case 1:
Object.assign(filter, { nodeid2: nodeid[1] });
break;
case 2:
Object.assign(filter, { nodeid3: nodeid[2] });
break;
case 3:
Object.assign(filter, { nodeid4: nodeid[3] });
break;
default:
break;
}
}
if (Object.is(strNodeType, this.TREENODE_CHILDCHANNEL)) {
await this.fillChildchannelNodeChilds(context,filter, list);
return Promise.resolve({ status: 200, data: list });
}
if (Object.is(strNodeType, this.TREENODE_ROOTCHANNEL)) {
await this.fillRootchannelNodeChilds(context,filter, list);
return Promise.resolve({ status: 200, data: list });
}
if (Object.is(strNodeType, this.TREENODE_WEBSITE)) {
await this.fillWebsiteNodeChilds(context,filter, list);
return Promise.resolve({ status: 200, data: list });
}
if (Object.is(strNodeType, this.TREENODE_ROOT)) {
await this.fillRootNodeChilds(context,filter, list);
return Promise.resolve({ status: 200, data: list });
}
return Promise.resolve({ status: 500, data: { title: '失败', message: `树节点${strTreeNodeId}标识无效` } });
}
/**
* 填充 树视图节点[子频道]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof ChannelTreeService
*/
@Errorlog
public fillChildchannelNodes(context:any={},filter: any, list: any[],rsNavContext?:any,rsNavParams?:any,rsParams?:any): Promise<any> {
context = this.handleResNavContext(context,filter,rsNavContext);
filter = this.handleResNavParams(context,filter,rsNavParams,rsParams);
return new Promise((resolve:any,reject:any) =>{
let searchFilter: any = {};
if (Object.is(filter.strNodeType, this.TREENODE_ROOTCHANNEL)) {
Object.assign(searchFilter, { n_pwebsitechannelid_eq: filter.nodeid });
}
Object.assign(searchFilter, { total: false });
let bFirst: boolean = true;
let records: any[] = [];
try {
this.searchChildchannel(context, searchFilter, filter).then((records:any) =>{
if(records && records.length >0){
records.forEach((entity: any) => {
let treeNode: any = {};
// 整理context
let strId: string = entity.websitechannelid;
let strText: string = entity.websitechannelname;
Object.assign(treeNode,{srfparentdename:'WebSiteChannel',srfparentkey:entity.websitechannelid});
let tempContext:any = JSON.parse(JSON.stringify(context));
Object.assign(tempContext,{srfparentdename:'WebSiteChannel',srfparentkey:entity.websitechannelid,websitechannel:strId})
Object.assign(treeNode,{srfappctx:tempContext});
Object.assign(treeNode,{'websitechannel':strId});
Object.assign(treeNode, { srfkey: strId });
Object.assign(treeNode, { text: strText, srfmajortext: strText });
let strNodeId: string = 'ChildChannel';
strNodeId += this.TREENODE_SEPARATOR;
strNodeId += strId;
Object.assign(treeNode, { id: strNodeId });
Object.assign(treeNode, { expanded: filter.isautoexpand });
Object.assign(treeNode, { leaf: true });
Object.assign(treeNode, { curData: entity });
Object.assign(treeNode, { nodeid: treeNode.srfkey });
Object.assign(treeNode, { nodeid2: filter.strRealNodeId });
list.push(treeNode);
resolve(list);
bFirst = false;
});
}else{
resolve(list);
}
});
} catch (error) {
console.error(error);
}
});
}
/**
* 获取查询集合
*
* @public
* @param {any{}} context
* @param {*} searchFilter
* @param {*} filter
* @returns {any[]}
* @memberof TestEnetityDatasService
*/
@Errorlog
public searchChildchannel(context:any={}, searchFilter: any, filter: any): Promise<any> {
return new Promise((resolve:any,reject:any) =>{
if(filter.viewparams){
Object.assign(searchFilter,filter.viewparams);
}
if(!searchFilter.page){
Object.assign(searchFilter,{page:0});
}
if(!searchFilter.size){
Object.assign(searchFilter,{size:1000});
}
if(context && context.srfparentdename){
Object.assign(searchFilter,{srfparentdename:JSON.parse(JSON.stringify(context)).srfparentdename});
}
if(context && context.srfparentkey){
Object.assign(searchFilter,{srfparentkey:JSON.parse(JSON.stringify(context)).srfparentkey});
}
const _appEntityService: any = this.appEntityService;
let list: any[] = [];
if (_appEntityService['FetchDefault'] && _appEntityService['FetchDefault'] instanceof Function) {
const response: Promise<any> = _appEntityService['FetchDefault'](context, searchFilter, false);
response.then((response: any) => {
if (!response.status || response.status !== 200) {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询FetchDefault数据集异常!');
}
const data: any = response.data;
if (Object.keys(data).length > 0) {
list = JSON.parse(JSON.stringify(data));
resolve(list);
} else {
resolve([]);
}
}).catch((response: any) => {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询FetchDefault数据集异常!');
});
}
})
}
/**
* 填充 树视图节点[子频道]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof ChannelTreeService
*/
@Errorlog
public async fillChildchannelNodeChilds(context:any={}, filter: any, list: any[]): Promise<any> {
if (filter.srfnodefilter && !Object.is(filter.srfnodefilter,"")) {
} else {
}
}
/**
* 填充 树视图节点[站点频道]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof ChannelTreeService
*/
@Errorlog
public fillRootchannelNodes(context:any={},filter: any, list: any[],rsNavContext?:any,rsNavParams?:any,rsParams?:any): Promise<any> {
context = this.handleResNavContext(context,filter,rsNavContext);
filter = this.handleResNavParams(context,filter,rsNavParams,rsParams);
return new Promise((resolve:any,reject:any) =>{
let searchFilter: any = {};
if (Object.is(filter.strNodeType, this.TREENODE_WEBSITE)) {
Object.assign(searchFilter, { n_websiteid_eq: filter.nodeid });
}
Object.assign(searchFilter, { total: false });
let bFirst: boolean = true;
let records: any[] = [];
try {
this.searchRootchannel(context, searchFilter, filter).then((records:any) =>{
if(records && records.length >0){
records.forEach((entity: any) => {
let treeNode: any = {};
// 整理context
let strId: string = entity.websitechannelid;
let strText: string = entity.websitechannelname;
Object.assign(treeNode,{srfparentdename:'WebSiteChannel',srfparentkey:entity.websitechannelid});
let tempContext:any = JSON.parse(JSON.stringify(context));
Object.assign(tempContext,{srfparentdename:'WebSiteChannel',srfparentkey:entity.websitechannelid,websitechannel:strId})
Object.assign(treeNode,{srfappctx:tempContext});
Object.assign(treeNode,{'websitechannel':strId});
Object.assign(treeNode, { srfkey: strId });
Object.assign(treeNode, { text: strText, srfmajortext: strText });
let strNodeId: string = 'RootChannel';
strNodeId += this.TREENODE_SEPARATOR;
strNodeId += strId;
Object.assign(treeNode, { id: strNodeId });
Object.assign(treeNode, { expanded: filter.isautoexpand });
Object.assign(treeNode, { leaf: false });
Object.assign(treeNode, { curData: entity });
Object.assign(treeNode, { nodeid: treeNode.srfkey });
Object.assign(treeNode, { nodeid2: filter.strRealNodeId });
list.push(treeNode);
resolve(list);
bFirst = false;
});
}else{
resolve(list);
}
});
} catch (error) {
console.error(error);
}
});
}
/**
* 获取查询集合
*
* @public
* @param {any{}} context
* @param {*} searchFilter
* @param {*} filter
* @returns {any[]}
* @memberof TestEnetityDatasService
*/
@Errorlog
public searchRootchannel(context:any={}, searchFilter: any, filter: any): Promise<any> {
return new Promise((resolve:any,reject:any) =>{
if(filter.viewparams){
Object.assign(searchFilter,filter.viewparams);
}
if(!searchFilter.page){
Object.assign(searchFilter,{page:0});
}
if(!searchFilter.size){
Object.assign(searchFilter,{size:1000});
}
if(context && context.srfparentdename){
Object.assign(searchFilter,{srfparentdename:JSON.parse(JSON.stringify(context)).srfparentdename});
}
if(context && context.srfparentkey){
Object.assign(searchFilter,{srfparentkey:JSON.parse(JSON.stringify(context)).srfparentkey});
}
const _appEntityService: any = this.appEntityService;
let list: any[] = [];
if (_appEntityService['FetchRoot'] && _appEntityService['FetchRoot'] instanceof Function) {
const response: Promise<any> = _appEntityService['FetchRoot'](context, searchFilter, false);
response.then((response: any) => {
if (!response.status || response.status !== 200) {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询FetchRoot数据集异常!');
}
const data: any = response.data;
if (Object.keys(data).length > 0) {
list = JSON.parse(JSON.stringify(data));
resolve(list);
} else {
resolve([]);
}
}).catch((response: any) => {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询FetchRoot数据集异常!');
});
}
})
}
/**
* 填充 树视图节点[站点频道]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof ChannelTreeService
*/
@Errorlog
public async fillRootchannelNodeChilds(context:any={}, filter: any, list: any[]): Promise<any> {
if (filter.srfnodefilter && !Object.is(filter.srfnodefilter,"")) {
// 填充子频道
let ChildchannelRsNavContext:any = {};
let ChildchannelRsNavParams:any = {};
let ChildchannelRsParams:any = {};
await this.fillChildchannelNodes(context, filter, list ,ChildchannelRsNavContext,ChildchannelRsNavParams,ChildchannelRsParams);
} else {
// 填充子频道
let ChildchannelRsNavContext:any = {};
let ChildchannelRsNavParams:any = {};
let ChildchannelRsParams:any = {};
await this.fillChildchannelNodes(context, filter, list ,ChildchannelRsNavContext,ChildchannelRsNavParams,ChildchannelRsParams);
}
}
/**
* 填充 树视图节点[站点]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof ChannelTreeService
*/
@Errorlog
public fillWebsiteNodes(context:any={},filter: any, list: any[],rsNavContext?:any,rsNavParams?:any,rsParams?:any): Promise<any> {
context = this.handleResNavContext(context,filter,rsNavContext);
filter = this.handleResNavParams(context,filter,rsNavParams,rsParams);
return new Promise((resolve:any,reject:any) =>{
let searchFilter: any = {};
Object.assign(searchFilter, { total: false });
let bFirst: boolean = true;
let records: any[] = [];
try {
this.searchWebsite(context, searchFilter, filter).then((records:any) =>{
if(records && records.length >0){
records.forEach((entity: any) => {
let treeNode: any = {};
// 整理context
let strId: string = entity.websiteid;
let strText: string = entity.websitename;
Object.assign(treeNode,{srfparentdename:'WebSite',srfparentkey:entity.websiteid});
let tempContext:any = JSON.parse(JSON.stringify(context));
Object.assign(tempContext,{srfparentdename:'WebSite',srfparentkey:entity.websiteid,website:strId})
Object.assign(treeNode,{srfappctx:tempContext});
Object.assign(treeNode,{'website':strId});
Object.assign(treeNode, { srfkey: strId });
Object.assign(treeNode, { text: strText, srfmajortext: strText });
let strNodeId: string = 'WEBSITE';
strNodeId += this.TREENODE_SEPARATOR;
strNodeId += strId;
Object.assign(treeNode, { id: strNodeId });
Object.assign(treeNode, { expanded: filter.isautoexpand });
Object.assign(treeNode, { leaf: false });
Object.assign(treeNode, { curData: entity });
Object.assign(treeNode, { nodeid: treeNode.srfkey });
Object.assign(treeNode, { nodeid2: filter.strRealNodeId });
list.push(treeNode);
resolve(list);
bFirst = false;
});
}else{
resolve(list);
}
});
} catch (error) {
console.error(error);
}
});
}
/**
* 获取查询集合
*
* @public
* @param {any{}} context
* @param {*} searchFilter
* @param {*} filter
* @returns {any[]}
* @memberof TestEnetityDatasService
*/
@Errorlog
public searchWebsite(context:any={}, searchFilter: any, filter: any): Promise<any> {
return new Promise((resolve:any,reject:any) =>{
if(filter.viewparams){
Object.assign(searchFilter,filter.viewparams);
}
if(!searchFilter.page){
Object.assign(searchFilter,{page:0});
}
if(!searchFilter.size){
Object.assign(searchFilter,{size:1000});
}
if(context && context.srfparentdename){
Object.assign(searchFilter,{srfparentdename:JSON.parse(JSON.stringify(context)).srfparentdename});
}
if(context && context.srfparentkey){
Object.assign(searchFilter,{srfparentkey:JSON.parse(JSON.stringify(context)).srfparentkey});
}
const _appEntityService: any = this.websiteService;
let list: any[] = [];
if (_appEntityService['FetchDefault'] && _appEntityService['FetchDefault'] instanceof Function) {
const response: Promise<any> = _appEntityService['FetchDefault'](context, searchFilter, false);
response.then((response: any) => {
if (!response.status || response.status !== 200) {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询FetchDefault数据集异常!');
}
const data: any = response.data;
if (Object.keys(data).length > 0) {
list = JSON.parse(JSON.stringify(data));
resolve(list);
} else {
resolve([]);
}
}).catch((response: any) => {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询FetchDefault数据集异常!');
});
}
})
}
/**
* 填充 树视图节点[站点]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof ChannelTreeService
*/
@Errorlog
public async fillWebsiteNodeChilds(context:any={}, filter: any, list: any[]): Promise<any> {
if (filter.srfnodefilter && !Object.is(filter.srfnodefilter,"")) {
// 填充站点频道
let RootchannelRsNavContext:any = {};
let RootchannelRsNavParams:any = {};
let RootchannelRsParams:any = {};
await this.fillRootchannelNodes(context, filter, list ,RootchannelRsNavContext,RootchannelRsNavParams,RootchannelRsParams);
} else {
// 填充站点频道
let RootchannelRsNavContext:any = {};
let RootchannelRsNavParams:any = {};
let RootchannelRsParams:any = {};
await this.fillRootchannelNodes(context, filter, list ,RootchannelRsNavContext,RootchannelRsNavParams,RootchannelRsParams);
}
}
/**
* 填充 树视图节点[默认根节点]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof ChannelTreeService
*/
@Errorlog
public fillRootNodes(context:any={},filter: any, list: any[],rsNavContext?:any,rsNavParams?:any,rsParams?:any): Promise<any> {
context = this.handleResNavContext(context,filter,rsNavContext);
filter = this.handleResNavParams(context,filter,rsNavParams,rsParams);
return new Promise((resolve:any,reject:any) =>{
let treeNode: any = {};
Object.assign(treeNode, { text: 'entities.websitechannel.channeltree_treeview.nodes.root' });
Object.assign(treeNode, { isUseLangRes: true });
Object.assign(treeNode,{srfappctx:context});
Object.assign(treeNode, { srfmajortext: treeNode.text });
let strNodeId: string = 'ROOT';
Object.assign(treeNode, { srfkey: 'root' });
strNodeId += this.TREENODE_SEPARATOR;
strNodeId += 'root';
Object.assign(treeNode, { id: strNodeId });
Object.assign(treeNode, { expanded: filter.isAutoexpand });
Object.assign(treeNode, { leaf: true });
Object.assign(treeNode, { nodeid: treeNode.srfkey });
Object.assign(treeNode, { nodeid2: filter.strRealNodeId });
list.push(treeNode);
resolve(list);
});
}
/**
* 填充 树视图节点[默认根节点]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof ChannelTreeService
*/
@Errorlog
public async fillRootNodeChilds(context:any={}, filter: any, list: any[]): Promise<any> {
if (filter.srfnodefilter && !Object.is(filter.srfnodefilter,"")) {
} else {
}
}
/**
* 处理代码表返回数据(树状结构)
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof ChannelTreeService
*/
public handleDataSet(result:Array<any>,context:any,callBack:any){
let list:Array<any> = [];
if(result.length === 0){
return list;
}
result.forEach((codeItem:any) =>{
if(!codeItem.pvalue){
let valueField:string = codeItem.value;
this.setChildCodeItems(valueField,result,codeItem);
list.push(codeItem);
}
})
this.setNodeData(list,context,callBack);
return list;
}
/**
* 处理非根节点数据
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof ChannelTreeService
*/
public setChildCodeItems(pValue:string,result:Array<any>,codeItem:any){
result.forEach((item:any) =>{
if(item.pvalue == pValue){
let valueField:string = item.value;
this.setChildCodeItems(valueField,result,item);
if(!codeItem.children){
codeItem.children = [];
}
codeItem.children.push(item);
}
})
}
/**
* 设置节点UI数据
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof ChannelTreeService
*/
public setNodeData(result:Array<any>,context:any,callBack:any){
result.forEach((item:any) =>{
if(item.children){
item.leaf = false;
this.setNodeData(item.children,context,callBack);
}else{
item.leaf = true;
}
callBack(context,item);
})
}
/**
* 处理节点关系导航上下文
*
* @param context 应用上下文
* @param filter 参数
* @param resNavContext 节点关系导航上下文
*
* @memberof ChannelTreeService
*/
public handleResNavContext(context:any,filter:any,resNavContext:any){
if(resNavContext && Object.keys(resNavContext).length > 0){
let tempContextData:any = JSON.parse(JSON.stringify(context));
let tempViewParams:any = {};
if(filter && filter.viewparams){
tempViewParams = filter.viewparams;
}
Object.keys(resNavContext).forEach((item:any) =>{
let curDataObj:any = resNavContext[item];
this.handleCustomDataLogic(context,tempViewParams,curDataObj,tempContextData,item);
})
return tempContextData;
}else{
return context;
}
}
/**
* 处理关系导航参数
*
* @param context 应用上下文
* @param filter 参数
* @param resNavParams 节点关系导航参数
* @param resParams 节点关系参数
*
* @memberof ChannelTreeService
*/
public handleResNavParams(context:any,filter:any,resNavParams:any,resParams:any){
if((resNavParams && Object.keys(resNavParams).length >0) || (resParams && Object.keys(resParams).length >0)){
let tempViewParamData:any = {};
let tempViewParams:any = {};
if(filter && filter.viewparams){
tempViewParams = filter.viewparams;
tempViewParamData = JSON.parse(JSON.stringify(filter.viewparams));
}
if( Object.keys(resNavParams).length > 0){
Object.keys(resNavParams).forEach((item:any) =>{
let curDataObj:any = resNavParams[item];
this.handleCustomDataLogic(context,tempViewParams,curDataObj,tempViewParamData,item);
})
}
if( Object.keys(resParams).length > 0){
Object.keys(resParams).forEach((item:any) =>{
let curDataObj:any = resParams[item];
tempViewParamData[item.toLowerCase()] = curDataObj.value;
})
}
Object.assign(filter,{viewparams:tempViewParamData});
return filter;
}else{
return filter;
}
}
/**
* 处理自定义节点关系导航数据
*
* @param context 应用上下文
* @param viewparams 参数
* @param curNavData 节点关系导航参数对象
* @param tempData 返回数据
* @param item 节点关系导航参数键值
*
* @memberof ChannelTreeService
*/
public handleCustomDataLogic(context:any,viewparams:any,curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
}
\ No newline at end of file
<div class="design-tree-container">
<context-menu-container>
<el-tree
v-if="inited"
ref="treeexpbar_tree"
class="design-tree"
node-key="id"
lazy
:show-checkbox="!isSingleSelect"
:check-on-click-node="!isSingleSelect"
:default-expanded-keys="expandedKeys"
:props="{
label: 'text',
isLeaf: 'leaf',
children: 'children'
}"
:load="load.bind(_self)"
:highlight-current="true"
:expand-on-click-node="false"
@check="onCheck.apply(_self, arguments)"
@current-change="selectionChange.apply(_self, arguments)"
:filter-node-method="filterNode"
>
<template slot-scope="{ node, data }">
<context-menu :contextMenuStyle="{width: '100%'}" :data="node" :renderContent="renderContextMenu.bind(_self)">
<tooltip transfer style="width: 100%;" max-width="2000" placement="right">
<div class="tree-node" @dblclick="doDefaultAction(node)">
<span class="icon">
<i v-if=" data.iconcls && !Object.is(data.iconcls, '')" :class="data.iconcls"></i>
<img v-else-if="data.icon && !Object.is(data.icon, '')" :src="data.icon" />
<icon v-else-if="isOutputIconDefault" type="ios-paper-outline"></icon>&nbsp;
</span>
<span class="text">
<span v-if="data.html" v-html="data.html"></span>
<span v-else>{{ data.isUseLangRes ? $t(data.text) : data.text }}</span>
</span>
</div>
<template slot="content">
<span v-if="data.html" v-html="data.html"></span>
<span v-else>{{ data.isUseLangRes ? $t(data.text) : data.text }}</span>
</template>
</tooltip>
</context-menu>
</template>
</el-tree>
</context-menu-container>
</div>
\ No newline at end of file
<template src="./channel-tree-treeview.html"/>
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import { VueLifeCycleProcessing } from '@/studio-core';
import { ChannelTreeTreeBase } from './channel-tree-treeview-base';
/**
* treeexpbar_tree部件
*
* @export
* @class ChannelTreeTree
* @extends {ChannelTreeTreeBase}
*/
@Component({
components: {
}
})
@VueLifeCycleProcessing()
export default class ChannelTreeTree extends ChannelTreeTreeBase { }
</script>
import { Prop, Provide, Emit, Model } from 'vue-property-decorator';
import { Subject, Subscription } from 'rxjs';
import { Watch, MainControlBase } from '@/studio-core';
import WebSiteChannelService from '@/service/web-site-channel/web-site-channel-service';
import ContentTreeViewtreeexpbarService from './content-tree-viewtreeexpbar-treeexpbar-service';
/**
* treeexpbar部件基类
*
* @export
* @class MainControlBase
* @extends {ContentTreeViewtreeexpbarTreeExpBarBase}
*/
export class ContentTreeViewtreeexpbarTreeExpBarBase extends MainControlBase {
/**
* 建构部件服务对象
*
* @type {ContentTreeViewtreeexpbarService}
* @memberof ContentTreeViewtreeexpbarTreeExpBarBase
*/
public service: ContentTreeViewtreeexpbarService = new ContentTreeViewtreeexpbarService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {WebSiteChannelService}
* @memberof ContentTreeViewtreeexpbarTreeExpBarBase
*/
public appEntityService: WebSiteChannelService = new WebSiteChannelService({ $store: this.$store });
/**
* 应用实体名称
*
* @protected
* @type {string}
* @memberof ContentTreeViewtreeexpbarTreeExpBarBase
*/
protected appDeName: string = 'websitechannel';
/**
* treeexpbar_tree 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ContentTreeViewtreeexpbarTreeExpBarBase
*/
public treeexpbar_tree_selectionchange($event: any, $event2?: any) {
this.treeexpbar_selectionchange($event, 'treeexpbar_tree', $event2);
}
/**
* treeexpbar_tree 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ContentTreeViewtreeexpbarTreeExpBarBase
*/
public treeexpbar_tree_load($event: any, $event2?: any) {
this.treeexpbar_load($event, 'treeexpbar_tree', $event2);
}
/**
* 打开新建数据视图
*
* @type {any}
* @memberof ContentTreeViewtreeexpbarBase
*/
@Prop() public newdata: any;
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof ContentTreeViewtreeexpbarBase
*/
@Prop() public opendata: any;
/**
* 视图唯一标识
*
* @type {boolean}
* @memberof ContentTreeViewtreeexpbarBase
*/
@Prop() public viewUID!:string;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof ContentTreeViewtreeexpbarBase
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof ContentTreeViewtreeexpbarBase
*/
public getData(): any {
return {};
}
/**
* 选中数据
*
* @type {*}
* @memberof ContentTreeViewtreeexpbarBase
*/
public selection: any = {};
/**
* 控件宽度
*
* @type {number}
* @memberof ContentTreeViewtreeexpbarBase
*/
public ctrlWidth:number = 250;
/**
* 过滤值
*
* @type {string}
* @memberof ContentTreeViewtreeexpbarBase
*/
public srfnodefilter: string = '';
/**
* 刷新标识
*
* @public
* @type {number}
* @memberof ContentTreeViewtreeexpbarBase
*/
public counter:number = 0;
/**
* 是否加载默认关联视图
*
* @public
* @type {boolean}
* @memberof ContentTreeViewtreeexpbarBase
*/
public istLoadDefaultRefView: boolean = false;
/**
* 分割宽度
*
* @type {number}
* @memberof ContentTreeViewtreeexpbarBase
*/
public split: number = 0.15;
/**
* split值变化事件
*
* @memberof ContentTreeViewtreeexpbarBase
*/
public onSplitChange() {
if(this.split){
this.$store.commit("setViewSplit",{viewUID:this.viewUID,viewSplit:this.split});
}
}
/**
* 获取关系项视图
*
* @param {*} [arg={}]
* @returns {*}
* @memberof ContentTreeViewtreeexpbarBase
*/
public getExpItemView(arg: any = {}): any {
let expmode = arg.nodetype.toUpperCase();
if (!expmode) {
expmode = '';
}
if (Object.is(expmode, 'ROOTCHANNEL')) {
return {
viewname: 'web-site-content-grid-view',
parentdata: {"srfparentdefname":"WEBSITECHANNELID","srfparentdename":"WEBSITECHANNEL","srfparentmode":"DER1N_WEBSITECONTENT_WEBSITECHANNEL_WEBSITECHANNELID"},
deKeyField:'websitecontent'
};
}
if (Object.is(expmode, 'CHILDCHANNEL')) {
return {
viewname: 'web-site-content-grid-view',
parentdata: {"srfparentdefname":"WEBSITECHANNELID","srfparentdename":"WEBSITECHANNEL","srfparentmode":"DER1N_WEBSITECONTENT_WEBSITECHANNEL_WEBSITECHANNELID"},
deKeyField:'websitecontent'
};
}
if (Object.is(expmode, 'WEBSITE')) {
return {
viewname: 'web-site-content-grid-view',
parentdata: {"srfparentdefname":"WEBSITEID","srfparentdename":"WEBSITE","srfparentmode":"DER1N_WEBSITECONTENT_WEBSITE_WEBSITEID"},
deKeyField:'websitecontent'
};
}
return null;
}
/**
* 树导航选中
*
* @param {any []} args
* @param {string} [tag]
* @param {*} [$event2]
* @returns {void}
* @memberof ContentTreeViewtreeexpbarBase
*/
public treeexpbar_selectionchange(args: any [], tag?: string, $event2?: any): void {
if (args.length === 0) {
return ;
}
const arg:any = args[0];
if (!arg.id) {
return;
}
const nodetype = arg.id.split(';')[0];
const refview = this.getExpItemView({ nodetype: nodetype });
if (!refview) {
return;
}
let tempViewparam:any = {};
let tempContext:any ={};
if(arg && arg.navfilter){
this.counter += 1;
Object.defineProperty(tempViewparam, arg.navfilter, {
value : arg.srfkey,
writable : true,
enumerable : true,
configurable : true
})
Object.assign(tempContext,{srfcounter:this.counter});
}
Object.assign(tempContext,JSON.parse(JSON.stringify(this.context)));
if(arg.srfappctx){
Object.assign(tempContext,JSON.parse(JSON.stringify(arg.srfappctx)));
}
// 计算导航上下文
if(arg && arg.navigateContext && Object.keys(arg.navigateContext).length >0){
let tempData:any = arg.curData?JSON.parse(JSON.stringify(arg.curData)):{};
Object.assign(tempData,arg);
let _context = this.$util.computedNavData(tempData,tempContext,tempViewparam,arg.navigateContext);
Object.assign(tempContext,_context);
}
if(arg.srfparentdename){
Object.assign(tempContext,{srfparentdename:arg.srfparentdename});
}
if(arg.srfparentkey){
Object.assign(tempContext,{srfparentkey:arg.srfparentkey});
}
// 计算导航参数
if(arg && arg.navigateParams && Object.keys(arg.navigateParams).length >0){
let tempData:any = arg.curData?JSON.parse(JSON.stringify(arg.curData)):{};
Object.assign(tempData,arg);
let _params = this.$util.computedNavData(tempData,tempContext,tempViewparam,arg.navigateParams);
Object.assign(tempViewparam,_params);
this.counter += 1;
Object.assign(tempContext,{srfcounter:this.counter});
}
this.selection = {};
Object.assign(this.selection, { view: { viewname: refview.viewname } });
Object.assign(this.selection,{'viewparam':tempViewparam,'context':tempContext});
this.$emit('selectionchange',args);
this.$forceUpdate();
}
/**
* 树加载完成
*
* @param {any[]} args
* @param {string} [tag]
* @param {*} [$event2]
* @returns {void}
* @memberof ContentTreeViewtreeexpbarBase
*/
public treeexpbar_load(args: any[], tag?: string, $event2?: any): void {
this.$emit('load',args);
}
/**
* 执行搜索
*
* @memberof ContentTreeViewtreeexpbarBase
*/
public onSearch(): void {
if (!this.viewState) {
return;
}
this.istLoadDefaultRefView = false;
this.viewState.next({ tag: 'treeexpbar_tree', action: 'filter', data: { srfnodefilter: this.srfnodefilter } });
}
/**
* vue 声明周期
*
* @memberof @memberof ContentTreeViewtreeexpbarBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof ContentTreeViewtreeexpbarBase
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
this.istLoadDefaultRefView = false;
this.viewState.next({ tag: 'treeexpbar_tree', action: action, data: data });
});
}
}
/**
* Vue声明周期(组件渲染完毕)
*
* @memberof ContentTreeViewtreeexpbarBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof ContentTreeViewtreeexpbarBase
*/
public afterMounted(){
if(this.$store.getters.getViewSplit(this.viewUID)){
this.split = this.$store.getters.getViewSplit(this.viewUID);
}else{
let containerWidth:number = (document.getElementById("contenttreeviewtreeexpbar") as any).offsetWidth;
if(this.ctrlWidth){
this.split = this.ctrlWidth/containerWidth;
}
this.$store.commit("setViewSplit",{viewUID:this.viewUID,viewSplit:this.split});
}
}
/**
* vue 生命周期
*
* @memberof ContentTreeViewtreeexpbarBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof ContentTreeViewtreeexpbarBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
/**
* 视图数据变化
*
* @param {*} $event
* @memberof ContentTreeViewtreeexpbarBase
*/
public onViewDatasChange($event: any): void {
this.$emit('selectionchange', $event);
}
/**
* 视图数据被激活
*
* @param {*} $event
* @memberof ContentTreeViewtreeexpbarBase
*/
public viewDatasActivated($event: any): void {
this.$emit('activated', $event);
}
/**
* 视图数据加载完成
*
* @param {*} $event
* @memberof ContentTreeViewtreeexpbarBase
*/
public onViewLoad($event: any): void {
this.$emit('load', $event);
}
}
\ No newline at end of file
/**
* ContentTreeViewtreeexpbar 部件模型
*
* @export
* @class ContentTreeViewtreeexpbarModel
*/
export default class ContentTreeViewtreeexpbarModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof ContentTreeViewtreeexpbarModel
*/
public getDataItems(): any[] {
return [
{
name: 'websitechannel',
prop: 'websitechannelid',
},
{
name: 'createman',
},
{
name: 'websitechannelname',
},
{
name: 'updatedate',
},
{
name: 'createdate',
},
{
name: 'updateman',
},
{
name: 'websiteid',
},
{
name: 'pwebsitechannelid',
},
{
name: 'pwebsitechannelname',
},
{
name: 'websitename',
},
{
name: 'channeltype',
},
{
name: 'channelcode',
},
{
name: 'sn',
},
{
name: 'memo',
},
{
name: 'validflag',
},
]
}
}
\ No newline at end of file
import { Http } from '@/utils';
import ControlService from '@/widgets/control-service';
/**
* ContentTreeViewtreeexpbar 部件服务对象
*
* @export
* @class ContentTreeViewtreeexpbarService
*/
export default class ContentTreeViewtreeexpbarService extends ControlService {
}
\ No newline at end of file
<split id="contenttreeviewtreeexpbar" class='app-tree-exp-bar' v-model="split" mode="horizontal" @on-move-end="onSplitChange.apply(_self, arguments)">
<div class="app-tree-exp-bar-left show-title-bar" slot='left'>
<div class='tree-exp-bar-header'>
<div class="tree-exp-bar-title">频道内容</div>
</div>
<div class='tree-exp-content'>
<view_treeexpbar_tree
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:showBusyIndicator="true"
updateAction='Update'
removeAction='Remove'
loadAction='Get'
createAction='Create'
:isSelectFirstDefault="true"
:isBranchAvailable="true"
name="treeexpbar_tree"
ref='treeexpbar_tree'
@selectionchange="treeexpbar_tree_selectionchange($event)"
@load="treeexpbar_tree_load($event)"
@closeview="closeView($event)">
</view_treeexpbar_tree>
</div>
</div>
<div class="app-tree-exp-bar-right" slot='right'>
<component
v-if="selection.view && !Object.is(this.selection.view.viewname, '')"
:is="selection.view.viewname"
class="viewcontainer2"
:viewDefaultUsage="false"
:viewdata="JSON.stringify(selection.context)"
:viewparam="JSON.stringify(selection.viewparam)"
@viewdataschange="onViewDatasChange.apply(_self, arguments)"
@viewdatasactivated="viewDatasActivated.apply(_self, arguments)"
@viewload="onViewLoad.apply(_self, arguments)">
</component>
</div>
</split>
<template src="./content-tree-viewtreeexpbar-treeexpbar.html"/>
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import { VueLifeCycleProcessing } from '@/studio-core';
import { ContentTreeViewtreeexpbarTreeExpBarBase } from './content-tree-viewtreeexpbar-treeexpbar-base';
import view_treeexpbar_tree from '@widgets/web-site-channel/channel-tree-treeview/channel-tree-treeview.vue';
/**
* treeexpbar部件
*
* @export
* @class ContentTreeViewtreeexpbarTreeExpBar
* @extends {ContentTreeViewtreeexpbarTreeExpBarBase}
*/
@Component({
components: {
view_treeexpbar_tree,
}
})
@VueLifeCycleProcessing()
export default class ContentTreeViewtreeexpbarTreeExpBar extends ContentTreeViewtreeexpbarTreeExpBarBase { }
</script>
......@@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSONObject;
public interface WebSiteChannelMapper extends BaseMapper<WebSiteChannel>{
Page<WebSiteChannel> searchDefault(IPage page, @Param("srf") WebSiteChannelSearchContext context, @Param("ew") Wrapper<WebSiteChannel> wrapper) ;
Page<WebSiteChannel> searchRoot(IPage page, @Param("srf") WebSiteChannelSearchContext context, @Param("ew") Wrapper<WebSiteChannel> wrapper) ;
@Override
WebSiteChannel selectById(Serializable id);
@Override
......
......@@ -37,6 +37,7 @@ public interface IWebSiteChannelService extends IService<WebSiteChannel>{
boolean save(WebSiteChannel et) ;
void saveBatch(List<WebSiteChannel> list) ;
Page<WebSiteChannel> searchDefault(WebSiteChannelSearchContext context) ;
Page<WebSiteChannel> searchRoot(WebSiteChannelSearchContext context) ;
List<WebSiteChannel> selectByPwebsitechannelid(String websitechannelid) ;
void removeByPwebsitechannelid(String websitechannelid) ;
List<WebSiteChannel> selectByWebsiteid(String websiteid) ;
......
......@@ -186,6 +186,15 @@ public class WebSiteChannelServiceImpl extends ServiceImpl<WebSiteChannelMapper,
return new PageImpl<WebSiteChannel>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
/**
* 查询集合 Root
*/
@Override
public Page<WebSiteChannel> searchRoot(WebSiteChannelSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<WebSiteChannel> pages=baseMapper.searchRoot(context.getPages(),context,context.getSelectCond());
return new PageImpl<WebSiteChannel>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
/**
......
......@@ -2760,7 +2760,7 @@
<!--输出实体[CONTACT]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-contact-298-37">
<changeSet author="a_LAB01_e85d8801c" id="tab-contact-300-37">
<createTable tableName="CONTACT">
<column name="ADDRESS1_FREIGHTTERMSCODE" remarks="" type="VARCHAR(30)">
</column>
......@@ -6456,7 +6456,7 @@
<!--输出实体[OPPORTUNITY]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-opportunity-145-77">
<changeSet author="a_LAB01_e85d8801c" id="tab-opportunity-146-77">
<createTable tableName="OPPORTUNITY">
<column name="DECISIONMAKER" remarks="" type="INT">
</column>
......@@ -10879,7 +10879,7 @@
<!--输出实体[WEBSITECHANNEL]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-websitechannel-41-129">
<changeSet author="a_LAB01_e85d8801c" id="tab-websitechannel-43-129">
<createTable tableName="WEBSITECHANNEL">
<column name="WEBSITECHANNELID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WEBSITECHANNEL_WEBSITECHANN"/>
......@@ -11170,25 +11170,25 @@
<addForeignKeyConstraint baseColumnNames="BUSINESSUNITID" baseTableName="CONSTRAINTBASEDGROUP" constraintName="DER1N_CONSTRAINTBASEDGROUP__BU" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="BUSINESSUNITID" referencedTableName="BUSINESSUNIT" validate="true"/>
</changeSet>
<!--输出实体[CONTACT]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-298-194">
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-300-194">
<addForeignKeyConstraint baseColumnNames="CUSTOMERID" baseTableName="CONTACT" constraintName="DER1N_CONTACT_ACCOUNT_CUSTOMER" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ACCOUNTID" referencedTableName="ACCOUNT" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-298-195">
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-300-195">
<addForeignKeyConstraint baseColumnNames="PREFERREDEQUIPMENTID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__EQUIPMENT__PREF" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="EQUIPMENTID" referencedTableName="EQUIPMENT" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-298-196">
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-300-196">
<addForeignKeyConstraint baseColumnNames="ORIGINATINGLEADID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__LEAD__ORIGINATI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="LEADID" referencedTableName="LEAD" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-298-197">
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-300-197">
<addForeignKeyConstraint baseColumnNames="DEFAULTPRICELEVELID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__PRICELEVEL__DEF" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="PRICELEVELID" referencedTableName="PRICELEVEL" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-298-198">
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-300-198">
<addForeignKeyConstraint baseColumnNames="PREFERREDSERVICEID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__SERVICE__PREFER" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SERVICEID" referencedTableName="SERVICE" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-298-199">
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-300-199">
<addForeignKeyConstraint baseColumnNames="SLAID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__SLA__SLAID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SLAID" referencedTableName="SLA" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-298-200">
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-300-200">
<addForeignKeyConstraint baseColumnNames="TRANSACTIONCURRENCYID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__TRANSACTIONCURR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/>
</changeSet>
<!--输出实体[CONTRACT]外键关系 -->
......@@ -11513,25 +11513,25 @@
<addForeignKeyConstraint baseColumnNames="TRANSACTIONCURRENCYID" baseTableName="MONTHLYFISCALCALENDAR" constraintName="DER1N_MONTHLYFISCALCALENDAR__T" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/>
</changeSet>
<!--输出实体[OPPORTUNITY]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-145-310">
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-146-310">
<addForeignKeyConstraint baseColumnNames="PARENTACCOUNTID" baseTableName="OPPORTUNITY" constraintName="DER1N_OPPORTUNITY__ACCOUNT__PA" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ACCOUNTID" referencedTableName="ACCOUNT" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-145-311">
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-146-311">
<addForeignKeyConstraint baseColumnNames="CAMPAIGNID" baseTableName="OPPORTUNITY" constraintName="DER1N_OPPORTUNITY__CAMPAIGN__C" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="CAMPAIGNID" referencedTableName="CAMPAIGN" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-145-312">
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-146-312">
<addForeignKeyConstraint baseColumnNames="PARENTCONTACTID" baseTableName="OPPORTUNITY" constraintName="DER1N_OPPORTUNITY__CONTACT__PA" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="CONTACTID" referencedTableName="CONTACT" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-145-313">
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-146-313">
<addForeignKeyConstraint baseColumnNames="ORIGINATINGLEADID" baseTableName="OPPORTUNITY" constraintName="DER1N_OPPORTUNITY__LEAD__ORIGI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="LEADID" referencedTableName="LEAD" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-145-314">
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-146-314">
<addForeignKeyConstraint baseColumnNames="PRICELEVELID" baseTableName="OPPORTUNITY" constraintName="DER1N_OPPORTUNITY__PRICELEVEL_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="PRICELEVELID" referencedTableName="PRICELEVEL" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-145-315">
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-146-315">
<addForeignKeyConstraint baseColumnNames="SLAID" baseTableName="OPPORTUNITY" constraintName="DER1N_OPPORTUNITY__SLA__SLAID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SLAID" referencedTableName="SLA" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-145-316">
<changeSet author="a_LAB01_e85d8801c" id="fk-opportunity-146-316">
<addForeignKeyConstraint baseColumnNames="TRANSACTIONCURRENCYID" baseTableName="OPPORTUNITY" constraintName="DER1N_OPPORTUNITY__TRANSACTION" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/>
</changeSet>
<!--输出实体[OPPORTUNITYCLOSE]外键关系 -->
......@@ -11904,10 +11904,10 @@
<!--输出实体[UOMSCHEDULE]外键关系 -->
<!--输出实体[WEBSITE]外键关系 -->
<!--输出实体[WEBSITECHANNEL]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-websitechannel-41-427">
<changeSet author="a_LAB01_e85d8801c" id="fk-websitechannel-43-427">
<addForeignKeyConstraint baseColumnNames="PWEBSITECHANNELID" baseTableName="WEBSITECHANNEL" constraintName="DER1N_WEBSITECHANNEL_WEBSITECH" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="WEBSITECHANNELID" referencedTableName="WEBSITECHANNEL" validate="true"/>
</changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-websitechannel-41-428">
<changeSet author="a_LAB01_e85d8801c" id="fk-websitechannel-43-428">
<addForeignKeyConstraint baseColumnNames="WEBSITEID" baseTableName="WEBSITECHANNEL" constraintName="DER1N_WEBSITECHANNEL_WEBSITE_W" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="WEBSITEID" referencedTableName="WEBSITE" validate="true"/>
</changeSet>
<!--输出实体[WEBSITECONTENT]外键关系 -->
......
......@@ -45,11 +45,26 @@
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<!--数据集合[Root]-->
<select id="searchRoot" parameterType="cn.ibizlab.businesscentral.core.website.filter.WebSiteChannelSearchContext" resultMap="WebSiteChannelResultMap">
select t1.* from (
<include refid="Root" />
)t1
<where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<!--数据查询[Default]-->
<sql id="Default" databaseId="mysql">
<![CDATA[ SELECT t1.`CHANNELCODE`, t1.`CHANNELTYPE`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`MEMO`, t1.`PWEBSITECHANNELID`, t11.`WEBSITECHANNELNAME` AS `PWEBSITECHANNELNAME`, t1.`SN`, t1.`UPDATEDATE`, t1.`UPDATEMAN`, t1.`VALIDFLAG`, t1.`WEBSITECHANNELID`, t1.`WEBSITECHANNELNAME`, t1.`WEBSITEID`, t21.`WEBSITENAME` FROM `WEBSITECHANNEL` t1 LEFT JOIN WEBSITECHANNEL t11 ON t1.PWEBSITECHANNELID = t11.WEBSITECHANNELID LEFT JOIN WEBSITE t21 ON t1.WEBSITEID = t21.WEBSITEID
]]>
</sql>
<!--数据查询[Root]-->
<sql id="Root" databaseId="mysql">
<![CDATA[ SELECT t1.`CHANNELCODE`, t1.`CHANNELTYPE`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`MEMO`, t1.`PWEBSITECHANNELID`, t11.`WEBSITECHANNELNAME` AS `PWEBSITECHANNELNAME`, t1.`SN`, t1.`UPDATEDATE`, t1.`UPDATEMAN`, t1.`VALIDFLAG`, t1.`WEBSITECHANNELID`, t1.`WEBSITECHANNELNAME`, t1.`WEBSITEID`, t21.`WEBSITENAME` FROM `WEBSITECHANNEL` t1 LEFT JOIN WEBSITECHANNEL t11 ON t1.PWEBSITECHANNELID = t11.WEBSITECHANNELID LEFT JOIN WEBSITE t21 ON t1.WEBSITEID = t21.WEBSITEID
WHERE ( t1.`PWEBSITECHANNELID` IS NULL )
]]>
</sql>
<!--数据查询[View]-->
<sql id="View" databaseId="mysql">
<![CDATA[ SELECT t1.`CHANNELCODE`, t1.`CHANNELTYPE`, t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`MEMO`, t1.`PWEBSITECHANNELID`, t11.`WEBSITECHANNELNAME` AS `PWEBSITECHANNELNAME`, t1.`SN`, t1.`UPDATEDATE`, t1.`UPDATEMAN`, t1.`VALIDFLAG`, t1.`WEBSITECHANNELID`, t1.`WEBSITECHANNELNAME`, t1.`WEBSITEID`, t21.`WEBSITENAME` FROM `WEBSITECHANNEL` t1 LEFT JOIN WEBSITECHANNEL t11 ON t1.PWEBSITECHANNELID = t11.WEBSITECHANNELID LEFT JOIN WEBSITE t21 ON t1.WEBSITEID = t21.WEBSITEID
......
......@@ -447,7 +447,7 @@
"dename":"WebSiteChannel",
"delogicname":"站点频道",
"sysmoudle":{"id":"WEBSITE","name":"WebSite"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"dedataset":[{"id":"Default" , "name":"DEFAULT"},{"id":"Root" , "name":"Root"}],
"deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}, {"id":"createman","name":"创建人"}]
}
......
......@@ -160,6 +160,27 @@ public class WebSiteChannelResource {
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(websitechannelMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-WebSiteChannel-searchRoot-all') and hasPermission(#context,'iBizBusinessCentral-WebSiteChannel-Get')")
@ApiOperation(value = "获取Root", tags = {"站点频道" } ,notes = "获取Root")
@RequestMapping(method= RequestMethod.GET , value="/websitechannels/fetchroot")
public ResponseEntity<List<WebSiteChannelDTO>> fetchRoot(WebSiteChannelSearchContext context) {
Page<WebSiteChannel> domains = websitechannelService.searchRoot(context) ;
List<WebSiteChannelDTO> list = websitechannelMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-WebSiteChannel-searchRoot-all') and hasPermission(#context,'iBizBusinessCentral-WebSiteChannel-Get')")
@ApiOperation(value = "查询Root", tags = {"站点频道" } ,notes = "查询Root")
@RequestMapping(method= RequestMethod.POST , value="/websitechannels/searchroot")
public ResponseEntity<Page<WebSiteChannelDTO>> searchRoot(@RequestBody WebSiteChannelSearchContext context) {
Page<WebSiteChannel> domains = websitechannelService.searchRoot(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(websitechannelMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
@PreAuthorize("hasPermission(this.websitechannelMapping.toDomain(#websitechanneldto),'iBizBusinessCentral-WebSiteChannel-Create')")
@ApiOperation(value = "根据站点建立站点频道", tags = {"站点频道" }, notes = "根据站点建立站点频道")
@RequestMapping(method = RequestMethod.POST, value = "/websites/{website_id}/websitechannels")
......@@ -293,5 +314,28 @@ public class WebSiteChannelResource {
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(websitechannelMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-WebSiteChannel-searchRoot-all') and hasPermission(#context,'iBizBusinessCentral-WebSiteChannel-Get')")
@ApiOperation(value = "根据站点获取Root", tags = {"站点频道" } ,notes = "根据站点获取Root")
@RequestMapping(method= RequestMethod.GET , value="/websites/{website_id}/websitechannels/fetchroot")
public ResponseEntity<List<WebSiteChannelDTO>> fetchWebSiteChannelRootByWebSite(@PathVariable("website_id") String website_id,WebSiteChannelSearchContext context) {
context.setN_websiteid_eq(website_id);
Page<WebSiteChannel> domains = websitechannelService.searchRoot(context) ;
List<WebSiteChannelDTO> list = websitechannelMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-WebSiteChannel-searchRoot-all') and hasPermission(#context,'iBizBusinessCentral-WebSiteChannel-Get')")
@ApiOperation(value = "根据站点查询Root", tags = {"站点频道" } ,notes = "根据站点查询Root")
@RequestMapping(method= RequestMethod.POST , value="/websites/{website_id}/websitechannels/searchroot")
public ResponseEntity<Page<WebSiteChannelDTO>> searchWebSiteChannelRootByWebSite(@PathVariable("website_id") String website_id, @RequestBody WebSiteChannelSearchContext context) {
context.setN_websiteid_eq(website_id);
Page<WebSiteChannel> domains = websitechannelService.searchRoot(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(websitechannelMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册