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

ShineKOT 发布系统代码 [后台服务,演示应用]

上级 61fa6e2e
<template>
<div class='view-container delistview ibizappeditorlist-view'>
<app-studioaction :viewTitle="$t(model.srfCaption)" viewName="ibizappeditorlistview"></app-studioaction>
<card class='view-card view-no-caption ' :bordered="false" :dis-hover="true" >
<div class='view-top-messages'>
</div>
<div class='content-container'>
<div style="margin-bottom:6px;">
<i-input v-show="!isExpandSearchForm" v-model="query" search enter-button @on-search="onSearch($event)" class='pull-left' placeholder="编辑器名称" style='max-width: 400px;margin-top:6px;padding-left: 24px' />
<div class='pull-right'>
<div class='toolbar-container'>
</div>
</div>
</div>
<view_searchform
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:showBusyIndicator="true"
v-show="isExpandSearchForm"
loaddraftAction="FilterGetDraft"
loadAction="FilterGet"
name="searchform"
ref='searchform'
@save="searchform_save($event)"
@search="searchform_search($event)"
@load="searchform_load($event)"
@closeview="closeView($event)">
</view_searchform>
<div class='view-body-messages'>
</div>
<view_list
:viewState="viewState"
:viewparams="viewparams"
:context="context"
createAction="Create"
removeAction="Remove"
updateAction="Update"
fetchAction="FetchDefault"
:showBusyIndicator="true"
:newdata="newdata"
:opendata="opendata"
name="list"
ref='list'
@selectionchange="list_selectionchange($event)"
@beforeload="list_beforeload($event)"
@rowdblclick="list_rowdblclick($event)"
@remove="list_remove($event)"
@load="list_load($event)"
@closeview="closeView($event)">
</view_list>
</div>
<div class='view-bottom-messages'>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import IBIZAPPEDITORService from '@/service/ibizappeditor/ibizappeditor-service';
import IBIZAPPEDITORAuthService from '@/authservice/ibizappeditor/ibizappeditor-auth-service';
import ListViewEngine from '@engine/view/list-view-engine';
import IBIZAPPEDITORUIService from '@/uiservice/ibizappeditor/ibizappeditor-ui-service';
import CodeListService from "@/codelist/codelist-service";
@Component({
components: {
},
})
export default class IBIZAPPEDITORListViewBase extends Vue {
/**
* 实体服务对象
*
* @type {IBIZAPPEDITORService}
* @memberof IBIZAPPEDITORListViewBase
*/
public appEntityService: IBIZAPPEDITORService = new IBIZAPPEDITORService;
/**
* 实体UI服务对象
*
* @type IBIZAPPEDITORUIService
* @memberof IBIZAPPEDITORListViewBase
*/
public appUIService: IBIZAPPEDITORUIService = new IBIZAPPEDITORUIService(this.$store);
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof IBIZAPPEDITORListViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof IBIZAPPEDITORListViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof IBIZAPPEDITORListViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof IBIZAPPEDITORListViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof IBIZAPPEDITORListViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof IBIZAPPEDITORListViewBase
*/
public viewtag: string = '92ba569083866d7476dbada9f26b0371';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof IBIZAPPEDITORListViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof IBIZAPPEDITORListViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof IBIZAPPEDITORListViewBase
*/
public model: any = {
srfCaption: 'entities.ibizappeditor.views.listview.caption',
srfTitle: 'entities.ibizappeditor.views.listview.title',
srfSubTitle: 'entities.ibizappeditor.views.listview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBIZAPPEDITORListViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBIZAPPEDITORListViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
} else if(!Object.is(newVal, oldVal) && _this.refresh && _this.refresh instanceof Function) {
_this.refresh();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof IBIZAPPEDITORListViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_list: { name: 'list', type: 'LIST' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
};
/**
* 视图刷新
*
* @param {*} args
* @memberof IBIZAPPEDITORListViewBase
*/
public refresh(args?: any): void {
const refs: any = this.$refs;
if (refs && refs.list) {
refs.list.refresh();
}
}
/**
* 计数器刷新
*
* @memberof IBIZAPPEDITORListViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof IBIZAPPEDITORListViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof IBIZAPPEDITORListView
*/
public toolBarModels: any = {
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof IBIZAPPEDITORListViewBase
*/
public engine: ListViewEngine = new ListViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof IBIZAPPEDITORListViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
list: this.$refs.list,
opendata: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => {
this.opendata(args,fullargs, params, $event, xData);
},
newdata: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => {
this.newdata(args,fullargs, params, $event, xData);
},
searchform: this.$refs.searchform,
keyPSDEField: 'ibizappeditor',
majorPSDEField: 'ibizappeditorname',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof IBIZAPPEDITORListViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZAPPEDITORListViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 门户部件状态对象
*
* @type {*}
* @memberof IBIZAPPEDITORListViewBase
*/
@Prop() public portletState?: any;
/**
* 门户部件状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZAPPEDITORListViewBase
*/
public portletStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof IBIZAPPEDITORListViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof IBIZAPPEDITORListViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof IBIZAPPEDITORListViewBase
*/
public viewCacheData:any;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof IBIZAPPEDITORListViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 解析视图参数
*
* @public
* @memberof IBIZAPPEDITORListViewBase
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
if(typeof this.viewdata == 'string') {
Object.assign(this.context, JSON.parse(this.viewdata));
}
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'ibizappeditor':inputvalue});
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof IBIZAPPEDITORListViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof IBIZAPPEDITORListViewBase
*/
public handleCustomDataLogic(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(this.context[(curNavData.value).toLowerCase()] != null){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()] != null){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof IBIZAPPEDITORListViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'ibizappeditorlist-view',tag:this.viewtag,srfkey:isNew ? null : this.context.ibizappeditor,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof IBIZAPPEDITORListViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'ibizappeditorlist-view',tag:this.viewtag,srfkey:this.context.ibizappeditor,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof IBIZAPPEDITORListViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof IBIZAPPEDITORListViewBase
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'ibizappeditorlist-view')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
if(_this.portletState){
_this.portletStateEvent = _this.portletState.subscribe((res:any) =>{
if(!Object.is(res.name,'IBIZAPPEDITORListView')){
return;
}
if(Object.is(res.action,'refresh') && _this.refresh && _this.refresh instanceof Function){
_this.refresh();
}
})
}
}
/**
* 销毁之前
*
* @memberof IBIZAPPEDITORListViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IBIZAPPEDITORListViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof IBIZAPPEDITORListViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* list 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZAPPEDITORListViewBase
*/
public list_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'selectionchange', $event);
}
/**
* list 部件 beforeload 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZAPPEDITORListViewBase
*/
public list_beforeload($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'beforeload', $event);
}
/**
* list 部件 rowdblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZAPPEDITORListViewBase
*/
public list_rowdblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'rowdblclick', $event);
}
/**
* list 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZAPPEDITORListViewBase
*/
public list_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'remove', $event);
}
/**
* list 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZAPPEDITORListViewBase
*/
public list_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'load', $event);
}
/**
* searchform 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZAPPEDITORListViewBase
*/
public searchform_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'save', $event);
}
/**
* searchform 部件 search 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZAPPEDITORListViewBase
*/
public searchform_search($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'search', $event);
}
/**
* searchform 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZAPPEDITORListViewBase
*/
public searchform_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'load', $event);
}
/**
* 打开新建数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof IBIZAPPEDITORListView
*/
public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
if(args[0].srfsourcekey){
data.srfsourcekey = args[0].srfsourcekey;
}
let tempContext = JSON.parse(JSON.stringify(this.context));
delete tempContext.ibizappeditor;
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizappeditors', parameterName: 'ibizappeditor' },
{ pathName: 'editview', parameterName: 'editview' },
];
const _this: any = this;
const openIndexViewTab = (data: any) => {
const _data: any = { w: (new Date().getTime()) };
Object.assign(_data, data);
const routePath = this.$viewTool.buildUpRoutePath(this.$route, tempContext, deResParameters, parameters, args, _data);
this.$router.push(routePath);
}
openIndexViewTab(data);
}
/**
* 打开编辑数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof IBIZAPPEDITORListView
*/
public opendata(args: any[],fullargs?:any,params?: any, $event?: any, xData?: any) {
if(!this.viewDefaultUsage){
if(Object.is(this.navModel,"route")){
this.initNavDataWithRoute(this.viewCacheData, false, true);
}else{
this.initNavDataWithTab(this.viewCacheData, false, true);
}
}
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
let tempContext = JSON.parse(JSON.stringify(this.context));
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizappeditors', parameterName: 'ibizappeditor' },
{ pathName: 'editview', parameterName: 'editview' },
];
const _this: any = this;
if(fullargs && fullargs.copymode){
Object.assign(data,{copymode:true});
}
const openIndexViewTab = (data: any) => {
const routePath = this.$viewTool.buildUpRoutePath(this.$route, tempContext, deResParameters, parameters, args, data);
this.$router.push(routePath);
}
openIndexViewTab(data);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof IBIZAPPEDITORListViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof IBIZAPPEDITORListViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBIZAPPEDITORListViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
}
// 销毁计数器定时器
if(this.counterServiceArray && this.counterServiceArray.length >0){
this.counterServiceArray.forEach((item:any) =>{
if(item.destroyCounter && item.destroyCounter instanceof Function){
item.destroyCounter();
}
})
}
if(this.portletStateEvent){
this.portletStateEvent.unsubscribe();
}
}
/**
* 搜索值
*
* @type {string}
* @memberof IBIZAPPEDITORListView
*/
public query: string = '';
/**
* 是否展开搜索表单
*
* @type {boolean}
* @memberof IBIZAPPEDITORListView
*/
public isExpandSearchForm: boolean = false;
/**
* 快速搜索
*
* @param {*} $event
* @memberof IBIZAPPEDITORListView
*/
public onSearch($event: any): void {
const refs: any = this.$refs;
if (refs.list) {
refs.list.load({});
}
}
}
</script>
<style lang='less'>
@import './ibizappeditorlist-view.less';
</style>
\ No newline at end of file
.ibizappeditorlist-view{
position: relative;
}
.toolbar-container {
button {
margin: 6px 0px 4px 4px;
.caption {
margin-left: 4px;
}
}
.seperator {
color: #dcdee2;
margin: 0 0px 0 4px;
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import IBIZAPPEDITORListViewBase from './ibizappeditorlist-view-base.vue';
import view_list from '@widgets/ibizappeditor/editor-list-list/editor-list-list.vue';
import view_searchform from '@widgets/ibizappeditor/default-searchform/default-searchform.vue';
@Component({
components: {
view_list,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class IBIZAPPEDITORListView extends IBIZAPPEDITORListViewBase {
}
</script>
\ No newline at end of file
......@@ -168,6 +168,7 @@ export const PageComponents = {
Vue.component('ibizsample0002-mpickup-view', () => import('@pages/sample/ibizsample0002-mpickup-view/ibizsample0002-mpickup-view.vue'));
Vue.component('ibizorder-sf7-edit-view', () => import('@pages/sample/ibizorder-sf7-edit-view/ibizorder-sf7-edit-view.vue'));
Vue.component('ibizbookedit-view', () => import('@pages/sample/ibizbookedit-view/ibizbookedit-view.vue'));
Vue.component('ibizappeditorlist-view', () => import('@pages/sample/ibizappeditorlist-view/ibizappeditorlist-view.vue'));
Vue.component('ibizappctrllist-view', () => import('@pages/sample/ibizappctrllist-view/ibizappctrllist-view.vue'));
Vue.component('ibizorder-detail-list-view', () => import('@pages/sample/ibizorder-detail-list-view/ibizorder-detail-list-view.vue'));
Vue.component('ibizsample0001-sf5-edit-view', () => import('@pages/sample/ibizsample0001-sf5-edit-view/ibizsample0001-sf5-edit-view.vue'));
......
......@@ -2641,6 +2641,20 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizbookedit-view/ibizbookedit-view.vue'),
},
{
path: 'ibizappeditors/:ibizappeditor?/listview/:listview?',
meta: {
caption: 'entities.ibizappeditor.views.listview.caption',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibizappeditors', parameterName: 'ibizappeditor' },
{ pathName: 'listview', parameterName: 'listview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizappeditorlist-view/ibizappeditorlist-view.vue'),
},
{
path: 'ibizappctrls/:ibizappctrl?/listview/:listview?',
meta: {
......@@ -4394,6 +4408,19 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizcustomer-usr2-mpickup-view/ibizcustomer-usr2-mpickup-view.vue'),
},
{
path: '/ibizappeditors/:ibizappeditor?/listview/:listview?',
meta: {
caption: 'entities.ibizappeditor.views.listview.caption',
info:'',
parameters: [
{ pathName: 'ibizappeditors', parameterName: 'ibizappeditor' },
{ pathName: 'listview', parameterName: 'listview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizappeditorlist-view/ibizappeditorlist-view.vue'),
},
{
path: '/ibizorders/:ibizorder?/usr2calendarexpview/:usr2calendarexpview?',
meta: {
......
......@@ -1128,6 +1128,16 @@ export const viewstate: any = {
'2a63c4595d7b116f63e0960a2365bbfa',
],
},
{
viewtag: '92ba569083866d7476dbada9f26b0371',
viewmodule: 'Sample',
viewname: 'IBIZAPPEDITORListView',
viewaction: '',
viewdatachange: false,
refviews: [
'9b24ceb5c508921a22b320af81f4afe9',
],
},
{
viewtag: '92cca69539c77ba96bfc384fc570bfa7',
viewmodule: 'Sample',
......@@ -2018,6 +2028,7 @@ export const viewstate: any = {
viewaction: '',
viewdatachange: false,
refviews: [
'92ba569083866d7476dbada9f26b0371',
'2b2bef1d622cb082cc17c12afe3ed894',
'fb7a06e43dfa51aaa792146e7df29357',
],
......
......@@ -68,22 +68,6 @@
</span>
</card>
</i-col>
<i-col :md="{ span: 24, offset: 0 }">
<card class="portlet-card custom-card" :bordered="false" dis-hover :padding="10">
<span>
<view_db_sysportlet4
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:height="400"
:width="0"
name="db_sysportlet4"
ref='db_sysportlet4'
@closeview="closeView($event)">
</view_db_sysportlet4>
</span>
</card>
</i-col>
<i-col :md="{ span: 24, offset: 0 }" :lg="{ span: 12, offset: 0 }">
<card class="portlet-card custom-card" :bordered="false" dis-hover :padding="10">
<span>
......@@ -148,6 +132,38 @@
</span>
</card>
</i-col>
<i-col :md="{ span: 24, offset: 0 }" :lg="{ span: 12, offset: 0 }">
<card class="portlet-card custom-card" :bordered="false" dis-hover :padding="10">
<span>
<view_db_sysportlet4
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:height="400"
:width="0"
name="db_sysportlet4"
ref='db_sysportlet4'
@closeview="closeView($event)">
</view_db_sysportlet4>
</span>
</card>
</i-col>
<i-col :md="{ span: 24, offset: 0 }" :lg="{ span: 12, offset: 0 }">
<card class="portlet-card custom-card" :bordered="false" dis-hover :padding="10">
<span>
<view_db_sysportlet9
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:height="400"
:width="0"
name="db_sysportlet9"
ref='db_sysportlet9'
@closeview="closeView($event)">
</view_db_sysportlet9>
</span>
</card>
</i-col>
</row>
<row v-if="isHasCustomized" style="width: 100%;min-height: calc(100% - 40px);">
<div class="portlet-container" style="position: relative;width:100%;">
......
......@@ -7,6 +7,7 @@ import view_db_rawitem1 from '@widgets/app/db-rawitem1-portlet/db-rawitem1-portl
import view_db_sysportlet3 from '@widgets/ibizappctrl/ctrl-chart-portlet/ctrl-chart-portlet.vue';
import view_db_sysportlet2 from '@widgets/ibizappview/view-chart-portlet/view-chart-portlet.vue';
import view_db_sysportlet1 from '@widgets/ibizappview/app-view-list-portlet/app-view-list-portlet.vue';
import view_db_sysportlet9 from '@widgets/ibizappeditor/app-editor-list-view-portlet/app-editor-list-view-portlet.vue';
import view_db_sysportlet8 from '@widgets/ibizappctrl/app-ctrl-list-view-portlet/app-ctrl-list-view-portlet.vue';
import view_db_sysportlet7 from '@widgets/ibizappeditor/app-editor-amount-portlet/app-editor-amount-portlet.vue';
import view_db_sysportlet6 from '@widgets/ibizappctrl/app-ctrl-amount-portlet/app-ctrl-amount-portlet.vue';
......@@ -20,6 +21,7 @@ import view_db_sysportlet6 from '@widgets/ibizappctrl/app-ctrl-amount-portlet/ap
view_db_sysportlet3,
view_db_sysportlet2,
view_db_sysportlet1,
view_db_sysportlet9,
view_db_sysportlet8,
view_db_sysportlet7,
view_db_sysportlet6,
......
<template>
<div class='portlet app-editor-list-view ' :style="{'height': isAdaptiveSize ? 'calc(100% - 16px)' : getHeight,}">
<p class='portlet-title'>
<span>
编辑器列表
</span>
</p>
<el-divider class="divider"></el-divider>
<div class="portlet-with-title">
<ibizappeditorlist-view :portletState="viewState" :viewdata="JSON.stringify(context)" :viewDefaultUsage="false" ></ibizappeditorlist-view>
</div>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model,Inject } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util, ViewTool } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import IBIZAPPEDITORService from '@/service/ibizappeditor/ibizappeditor-service';
import AppEditorListViewService from './app-editor-list-view-portlet-service';
import IBIZAPPEDITORUIService from '@/uiservice/ibizappeditor/ibizappeditor-ui-service';
import UIService from '@/uiservice/ui-service';
import { Environment } from '@/environments/environment';
@Component({
components: {
}
})
export default class IBIZAPPEDITORAppEditorListViewBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof AppEditorListViewBase
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof AppEditorListViewBase
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof AppEditorListViewBase
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof AppEditorListViewBase
*/
@Prop() public viewparams!: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof AppEditorListViewBase
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof AppEditorListViewBase
*/
public getControlType(): string {
return 'PORTLET'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof AppEditorListViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {AppEditorListViewService}
* @memberof AppEditorListViewBase
*/
public service: AppEditorListViewService = new AppEditorListViewService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBIZAPPEDITORService}
* @memberof AppEditorListViewBase
*/
public appEntityService: IBIZAPPEDITORService = new IBIZAPPEDITORService({ $store: this.$store });
/**
* 界面UI服务对象
*
* @type {IBIZAPPEDITORUIService}
* @memberof AppEditorListViewBase
*/
public appUIService:IBIZAPPEDITORUIService = new IBIZAPPEDITORUIService(this.$store);
/**
* 关闭视图
*
* @param {any} args
* @memberof AppEditorListViewBase
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof AppEditorListViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 长度
*
* @type {number}
* @memberof AppEditorListViewBase
*/
@Prop() public height?: number;
/**
* 宽度
*
* @type {number}
* @memberof AppEditorListViewBase
*/
@Prop() public width?: number;
/**
* 门户部件类型
*
* @type {number}
* @memberof AppEditorListViewBase
*/
public portletType: string = 'view';
/**
* 视图默认使用
*
* @type {string}
* @memberof AppEditorListViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 界面行为模型数据
*
* @memberof AppEditorListViewBase
*/
public uiactionModel: any = {
}
/**
* 是否自适应大小
*
* @returns {boolean}
* @memberof AppEditorListViewBase
*/
@Prop({default: false})public isAdaptiveSize!: boolean;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof AppEditorListViewBase
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof AppEditorListViewBase
*/
public getData(): any {
return {};
}
/**
* 获取高度
*
* @returns {any[]}
* @memberof AppEditorListViewBase
*/
get getHeight(){
if(!this.$util.isEmpty(this.height) && !this.$util.isNumberNaN(this.height)){
if(this.height == 0){
return 'auto';
}else{
return this.height+'px';
}
}else{
return '400px';
}
}
/**
* 刷新
*
* @memberof AppEditorListViewBase
*/
public refresh(args?: any) {
this.viewState.next({ tag: 'IBIZAPPEDITORListView', action: 'refresh', data: args });
}
/**
* vue 生命周期
*
* @memberof AppEditorListViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof AppEditorListViewBase
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if(Object.is(tag, "all-portlet") && Object.is(action,'loadmodel')){
this.calcUIActionAuthState(data);
}
if (!Object.is(tag, this.name)) {
return;
}
const refs: any = this.$refs;
Object.keys(refs).forEach((_name: string) => {
this.viewState.next({ tag: _name, action: action, data: data });
});
});
}
}
/**
* vue 生命周期
*
* @memberof AppEditorListViewBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof AppEditorListViewBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
/**
* 计算界面行为权限
*
* @memberof AppEditorListViewBase
*/
public calcUIActionAuthState(data:any = {}) {
// 如果是操作栏,不计算权限
if(this.portletType && Object.is('actionbar', this.portletType)) {
return;
}
let _this: any = this;
let uiservice: any = _this.appUIService ? _this.appUIService : new UIService(_this.$store);
if(_this.uiactionModel){
ViewTool.calcActionItemAuthState(data,_this.uiactionModel,uiservice);
}
}
}
</script>
<style lang='less'>
@import './app-editor-list-view-portlet.less';
</style>
/**
* AppEditorListView 部件模型
*
* @export
* @class AppEditorListViewModel
*/
export default class AppEditorListViewModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof AppEditorListViewModel
*/
public getDataItems(): any[] {
return [
{
name: 'createman',
},
{
name: 'updatedate',
},
{
name: 'createdate',
},
{
name: 'ibizappeditorname',
},
{
name: 'updateman',
},
{
name: 'ibizappeditor',
prop: 'ibizappeditorid',
},
{
name: 'ibizappeditortype',
},
{
name: 'rditordescription',
},
{
name: 'documentaddress',
},
{
name: 'amount',
},
]
}
}
import { Http } from '@/utils';
import ControlService from '@/widgets/control-service';
/**
* AppEditorListView 部件服务对象
*
* @export
* @class AppEditorListViewService
*/
export default class AppEditorListViewService extends ControlService {
}
// this is less
.portlet{
height: 100%;
width: 100%;
> .portlet-title{
padding: 14px 16px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
height: 52px;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
justify-content: space-between;
width:100%;
line-height: 22px;
font-size: 16px;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #304265;
font-weight: 600;
i{
margin-right: 5px;
}
>.portlet-action{
margin-left: 12px;
font-size: 14px;
>a{
padding: 6px;
}
}
}
> .divider {
margin: 0px 0px 11px 0px;
}
> .portlet-with-title{
width:100%;
height:calc(100% - 58px);
overflow:auto;
padding:0px 12px;
}
> .portlet-without-title{
width:100%;
height:100%;
overflow:auto;
padding:0px 12px;
}
.app-charts{
height: 100%!important;
}
.toolbar-container {
button{
margin: 6px 0px 4px 16px;
}
.ivu-badge{
.ivu-badge-count{
top: 0;
}
}
}
}
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import IBIZAPPEDITORAppEditorListViewBase from './app-editor-list-view-portlet-base.vue';
@Component({
components: {
}
})
export default class IBIZAPPEDITORAppEditorListView extends IBIZAPPEDITORAppEditorListViewBase {
}
</script>
......@@ -590,7 +590,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORGridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -626,7 +626,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORGridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
return;
}
const arg: any = { ...opt } ;
......
<template>
<div :class="['app-list',this.items.length > 0 ? '' : 'app-list-empty' ]">
<div v-if="items.length > 0">
<el-collapse>
<el-collapse-item v-for="(group,index) in groupData" :key="index">
<template slot="title">
<div style="margin: 0 0 0 12px;"><b>{{group.group}}</b></div>
</template>
<div v-if="group.children.length > 0" style="margin: 0 0 0 32px;">
<div v-for="item in group.children" :key="item.srfkey" :class="['app-list-item', {'isSelect': item.isselected === true ? true : false}]" @click="handleClick(item)" @dblclick="handleDblClick(item)">
<div class="app-list-item-content">{{item.srfmajortext}}</div>
<div calss="app-list-item-action">
<template v-for="(action,index) in Object.keys(ActionModel)">
<a :key="index" style="display: inline-block;margin: 0 12px;" @click="uiAction(item, action, $event)">
<i :class="ActionModel[action].icon" style="margin-right:2px;"></i>
<span>{{ActionModel[action].caption}}</span>
</a>
</template>
</div>
</div>
</div>
<div v-else style="text-align: center;">
{{ $t('entities.ibizappeditor.editorlist_list.nodata') }}
</div>
</el-collapse-item>
</el-collapse>
<template v-if="isScrollBar">
<div v-if="totalRecord>items.length" class="loadmore">{{ this.$t('app.commonWords.loadmore') }}</div>
<div v-else class="loadmore">{{ this.$t('app.commonWords.nomore') }}</div>
</template>
</div>
<div v-else>
{{ $t('entities.ibizappeditor.editorlist_list.nodata') }}
</div>
<el-backtop target=".content-container .app-list"></el-backtop>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model,Inject } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util,ViewTool } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import AppCenterService from "@service/app/app-center-service";
import IBIZAPPEDITORService from '@/service/ibizappeditor/ibizappeditor-service';
import EditorListService from './editor-list-list-service';
import IBIZAPPEDITORUIService from '@/uiservice/ibizappeditor/ibizappeditor-ui-service';
import CodeListService from "@/codelist/codelist-service";
@Component({
components: {
}
})
export default class EditorListBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof EditorListBase
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof EditorListBase
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof EditorListBase
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof EditorListBase
*/
@Prop() public viewparams!: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof EditorListBase
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof EditorListBase
*/
public getControlType(): string {
return 'LIST'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof EditorListBase
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {EditorListService}
* @memberof EditorListBase
*/
public service: EditorListService = new EditorListService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBIZAPPEDITORService}
* @memberof EditorListBase
*/
public appEntityService: IBIZAPPEDITORService = new IBIZAPPEDITORService({ $store: this.$store });
/**
* 转化数据
*
* @param {any} args
* @memberof EditorListBase
*/
public transformData(args: any) {
let _this: any = this;
if(_this.service && _this.service.handleRequestData instanceof Function && _this.service.handleRequestData('transform',_this.context,args)){
return _this.service.handleRequestData('transform',_this.context,args)['data'];
}
}
/**
* 关闭视图
*
* @param {any} args
* @memberof EditorListBase
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof EditorListBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof EditorListBase
*/
public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof EditorListBase
*/
public getDatas(): any[] {
return this.selections;
}
/**
* 获取单项树
*
* @returns {*}
* @memberof EditorListBase
*/
public getData(): any {
return null;
}
/**
* 是否默认选中第一条数据
*
* @type {boolean}
* @memberof EditorListBase
*/
@Prop({ default: false }) public isSelectFirstDefault!: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof EditorListBase
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--create
*
* @type {string}
* @memberof EditorListBase
*/
@Prop() public createAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof EditorListBase
*/
@Prop() public removeAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof EditorListBase
*/
@Prop() public updateAction!: string;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof EditorListBase
*/
@Prop() public fetchAction!: string;
/**
* 打开新建数据视图
*
* @type {any}
* @memberof EditorListBase
*/
@Prop() public newdata: any;
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof EditorListBase
*/
@Prop() public opendata: any;
/**
* this引用
*
* @type {number}
* @memberof EditorListBase
*/
public thisRef: any = this;
/**
* 分组属性
*
* @type {string}
* @memberof EditorListBase
*/
public groupField: string = "ibizappeditortype";
/**
* 分组属性代码表
*
* @type {string}
* @memberof EditorListBase
*/
public groupFieldCodelist: any = {type: 'STATIC',tag: 'AppEditorType'};
/**
* 分组数据
*
* @type {Array<any>}
* @memberof EditorListBase
*/
public groupData: Array<any> = [];
/**
* 分组模式
*
* @type {string}
* @memberof EditorListBase
*/
public groupMode: string = "CODELIST";
/**
* 分组方法
*
* @memberof EditorListBase
*/
public group(){
let _this:any = this;
if(_this.drawGroup && _this.drawGroup instanceof Function && Object.is(_this.groupMode,"AUTO")){
_this.drawGroup();
}else if(_this.drawCodelistGroup && _this.drawCodelistGroup instanceof Function && Object.is(_this.groupMode,"CODELIST")){
_this.drawCodelistGroup();
}
}
/**
* 分组代码表
*
* @type {string}
* @memberof EditorListBase
*/
public groupCodelist: any = {type:'STATIC',tag:'AppEditorType'};
/**
* 根据分组代码表绘制分组列表
*
* @memberof EditorListBase
*/
public async drawCodelistGroup(){
let groups: Array<any> = [];
let fields: Array<any> = [];
let groupTree:Array<any> = [];
let data:Array<any> = [...this.items];
if(Object.keys(this.groupCodelist).length > 0){
let groupCodelist: any = await this.codeListService.getDataItems(this.groupCodelist);
groups = Util.deepCopy(groupCodelist);
}
if(Object.keys(this.groupFieldCodelist).length > 0){
let fieldCodelist: any = await this.codeListService.getDataItems(this.groupFieldCodelist);
fields = Util.deepCopy(fieldCodelist);
}
if(groups.length == 0){
console.warn("分组数据无效");
}
groups.forEach((group: any,i: number)=>{
let children:Array<any> = [];
data.forEach((item: any,j: number)=>{
if(fields && fields.length > 0){
const arr:Array<any> = fields.filter((field:any)=>{return field.value == item[this.groupField]});
if(arr && arr.length>0 && Object.is(group.label,arr[0].label)) {
children.push(item);
}
}else if(Object.is(group.label,item[this.groupField])){
children.push(item);
}
});
const tree: any ={
group: group.label,
children: children
}
groupTree.push(tree);
});
let child:Array<any> = [];
data.forEach((item: any)=>{
let i: number = 0;
if(fields && fields.length > 0){
const arr:Array<any> = fields.filter((field:any)=>{return field.value == item[this.groupField]});
if(arr && arr.length>0) {
i = groups.findIndex((group: any)=>Object.is(group.label,arr[0].label));
}
}else{
i = groups.findIndex((group: any)=>Object.is(group.label,item[this.groupField]));
}
if(i < 0){
child.push(item);
}
})
const Tree: any = {
group: this.$t('app.commonWords.other'),
children: child
}
if(child && child.length > 0){
groupTree.push(Tree);
}
this.groupData = [...groupTree];
}
/**
* 当前页
*
* @type {number}
* @memberof EditorListBase
*/
public curPage: number = 1;
/**
* 数据
*
* @type {any[]}
* @memberof EditorListBase
*/
public items: any[] = [];
/**
* 是否支持分页
*
* @type {boolean}
* @memberof EditorListBase
*/
public isEnablePagingBar: boolean = true;
/**
* 分页条数
*
* @type {number}
* @memberof EditorListBase
*/
public limit: number = 1000;
/**
* 总条数
*
* @type {number}
* @memberof EditorListBase
*/
public totalRecord: number = 0;
/**
* 加载的数据是否附加在items之后
*
* @type {boolean}
* @memberof EditorListBase
*/
public isAddBehind:boolean = false;
/**
* 是否有滚动条
*
* @type {boolean}
* @memberof EditorListBase
*/
public isScrollBar: boolean = false;
/**
* 排序方向
*
* @type {string}
* @memberof EditorListBase
*/
public sortDir:string = '';
/**
* 排序字段
*
* @type {string}
* @memberof EditorListBase
*/
public sortField: string = '';
/**
* 选中数组
* @type {Array<any>}
* @memberof EditorListBase
*/
public selections: Array<any> = [];
/**
* 应用状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof EditorListBase
*/
public appStateEvent: Subscription | undefined;
/**
* Vue声明周期,组件挂载完毕
*
* @memberof EditorListBase
*/
public mounted () {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof EditorListBase
*/
public afterMounted () {
const loadMoreCallBack:any = this.throttle(this.loadMore,3000);
this.$el.addEventListener('scroll', ()=> {
if(this.$el.scrollHeight > this.$el.clientHeight) {
this.isScrollBar = true;
} else {
this.isScrollBar = false;
}
if( this.$el.scrollTop + this.$el.clientHeight >= this.$el.scrollHeight) {
loadMoreCallBack();
}
})
}
/**
* Vue声明周期,组件创建完毕
*
* @memberof EditorListBase
*/
public created() {
this.afterCreated()
}
/**
* 执行created后的逻辑
*
* @memberof EditorListBase
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(this.name, tag)) {
return;
}
if (Object.is(action,'load')) {
this.curPage = 1;
this.items = [];
this.load(data);
}
if (Object.is(action,'refresh')) {
this.refresh(data);
}
});
}
if(AppCenterService && AppCenterService.getMessageCenter()){
this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{
if(!Object.is(name,"IBIZAPPEDITOR")){
return;
}
if(Object.is(action,'appRefresh')){
this.refresh([data]);
}
})
}
}
/**
* vue 生命周期
*
* @memberof EditorListBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof EditorListBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
}
/**
* 加载更多
*
* @memberof EditorListBase
*/
public loadMore(){
if(this.totalRecord>this.items.length){
this.curPage = ++this.curPage;
this.isAddBehind = true;
this.load({});
}
}
/**
* 刷新
*
* @param {*} [args={}]
* @memberof Main
*/
public refresh(args?: any) {
this.isAddBehind = true;
this.load(args);
}
/**
* 列表数据加载
*
* @public
* @param {*} [arg={}]
* @memberof EditorListBase
*/
public load(opt: any = {}): void {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
}
const arg: any = {...opt};
const page: any = {};
if (this.isEnablePagingBar) {
Object.assign(page, { page: this.curPage-1, size: this.limit });
}
// 设置排序
if (!Object.is(this.sortDir, '') && !Object.is(this.sortField, '')) {
const sort: string = this.sortField+","+this.sortDir;
Object.assign(page, { sort: sort });
}
Object.assign(arg, page);
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.errorMessage });
}
return;
}
const data: any = response.data;
if(!this.isAddBehind){
this.items = [];
}
if (data && data.length > 0) {
let datas = JSON.parse(JSON.stringify(data));
datas.map((item: any) => {
Object.assign(item, { isselected: false });
});
this.totalRecord = response.total;
this.items.push(...datas);
this.items = this.arrayNonRepeatfy(this.items);
}
this.isAddBehind = false;
this.$emit('load', this.items);
//在导航视图中,如已有选中数据,则右侧展开已选中数据的视图,如无选中数据则默认选中第一条
if(this.isSelectFirstDefault){
if(this.selections && this.selections.length > 0){
this.selections.forEach((select: any)=>{
const index = this.items.findIndex((item:any) => Object.is(item.srfkey,select.srfkey));
if(index != -1){
this.handleClick(this.items[index]);
}
})
}else{
this.handleClick(this.items[0]);
}
}
this.group();
}, (response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.errorMessage });
});
}
/**
* 列表数据去重
*
* @param {Array<any>} [arr]
* @returns {void}
* @memberof EditorListBase
*/
public arrayNonRepeatfy(arr:Array<any>) {
let map = new Map();
let array = new Array();
for (let i = 0; i < arr.length; i++) {
map .set(arr[i].srfkey, arr[i]);
}
map.forEach((value:any, key:string, map:any) => {
array.push(value);
});
return array ;
}
/**
* 节流
*
* @param {Array<any>} [arr]
* @returns {void}
* @memberof EditorListBase
*/
public throttle(fn:any, wait:number){
let time = 0;
return () =>{
let now = Date.now()
let args = arguments;
if(now - time > wait){
fn.apply(this, args)
time = now;
}
}
}
/**
* 删除
*
* @param {any[]} datas
* @returns {Promise<any>}
* @memberof EditorListBase
*/
public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.list.notConfig.removeAction') as string) });
return;
}
if (datas.length === 0) {
return;
}
let dataInfo = '';
datas.forEach((record: any, index: number) => {
let srfmajortext = record.srfmajortext;
if (index < 5) {
if (!Object.is(dataInfo, '')) {
dataInfo += '、';
}
dataInfo += srfmajortext;
} else {
return false;
}
});
if (datas.length < 5) {
dataInfo = dataInfo + ' 共' + datas.length + '条数据';
} else {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizappeditor: keys.join(';') }),Object.assign({ ibizappeditor: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
this.group();
return true;
}
});
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
this.$Modal.confirm({
title: (this.$t('app.commonWords.warning') as string),
content: (this.$t('app.list.confirmDel') as string) + ' ' + dataInfo + ',' + (this.$t('app.list.notRecoverable') as string) ,
onOk: () => {
removeData();
},
onCancel: () => { }
});
return removeData;
}
/**
* 保存
*
* @param {*} $event
* @returns {Promise<any>}
* @memberof EditorListBase
*/
public async save(args: any[], params?: any, $event?: any, xData?: any){
let _this = this;
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.list.notConfig.createAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
successItems.push(JSON.parse(JSON.stringify(response.data)));
}
}else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){
this.$Notice.error({ title: (this.$t('app.commonWords.warning') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.list.notConfig.updateAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
if(item.ibizappeditor){
Object.assign(this.context,{ibizappeditor:item.ibizappeditor});
}
let response = await this.service.add(this.updateAction,JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
successItems.push(JSON.parse(JSON.stringify(response.data)));
}
}
} catch (error) {
errorItems.push(JSON.parse(JSON.stringify(item)));
errorMessage.push(error);
}
}
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
});
}
return successItems;
}
/**
* 面板数据变化处理事件
* @param {any} item 当前列数据
* @param {any} $event 面板事件数据
*
* @memberof EditorListBase
*/
public onPanelDataChange(item:any,$event:any) {
Object.assign(item, $event, {rowDataState:'update'});
}
/**
* 选择数据
* @memberof EditorListBase
*
*/
public handleClick(args: any) {
// this.clearSelection();
args.isselected = !args.isselected;
this.selectchange();
}
/**
* 双击数据
* @memberof EditorListBase
*
*/
public handleDblClick(args: any) {
this.$emit('rowdblclick', args);
}
/**
* 触发事件
* @memberof EditorListBase
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
this.$emit('selectionchange', this.selections);
}
/**
* 清除当前所有选中状态
*
* @memberof EditorListBase
*/
public clearSelection(){
this.items.map((item: any) => {
Object.assign(item, { isselected: false });
});
}
/**
* 操作栏模型数据
*
* @type {*}
* @memberof EditorListBase
*/
public ActionModel:any ={
};
/**
* 操作列界面行为
*
* @param {*} data
* @param {*} tag
* @param {*} $event
* @memberof EditorListBase
*/
public uiAction(data: any, tag: any, $event: any) {
$event.stopPropagation();
}
}
</script>
<style lang='less'>
@import './editor-list-list.less';
</style>
\ No newline at end of file
/**
* EditorList 部件模型
*
* @export
* @class EditorListModel
*/
export default class EditorListModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof EditorListListMode
*/
public getDataItems(): any[] {
return [
{
name: 'srfmajortext',
prop: 'ibizappeditorname',
dataType: 'TEXT',
},
{
name: 'srfdescription',
prop: 'rditordescription',
dataType: 'TEXT',
},
{
name: 'srfkey',
prop: 'ibizappeditorid',
dataType: 'GUID',
},
{
name: 'ibizappeditor',
prop: 'ibizappeditorid',
dataType: 'FONTKEY',
},
{
name:'size',
prop:'size'
},
{
name:'query',
prop:'query'
},
{
name:'sort',
prop:'sort'
},
{
name:'page',
prop:'page'
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import IBIZAPPEDITORService from '@/service/ibizappeditor/ibizappeditor-service';
import EditorListModel from './editor-list-list-model';
/**
* EditorList 部件服务对象
*
* @export
* @class EditorListService
*/
export default class EditorListService extends ControlService {
/**
* 编辑器服务对象
*
* @type {IBIZAPPEDITORService}
* @memberof EditorListService
*/
public appEntityService: IBIZAPPEDITORService = new IBIZAPPEDITORService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof EditorListService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of EditorListService.
*
* @param {*} [opts={}]
* @memberof EditorListService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new EditorListModel();
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EditorListService
*/
@Errorlog
public search(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.FetchDefault(Context,Data, isloading);
}
result.then(async (response) => {
await this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EditorListService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.remove(Context,Data , isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EditorListService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EditorListService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data,isloading);
}else{
result =_appEntityService.Update(Context,Data,isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
}
\ No newline at end of file
// this is less
.app-list {
height:100%;
flex-grow: 1;
overflow-y: auto;
.el-collapse-item__header.is-active{
color: #409eff;
background-color: #ecf5ff;
}
.el-collapse{
.el-collapse-item{
.el-collapse-item__wrap{
.el-collapse-item__content{
padding: 10px 0 10px 0;
}
}
}
}
.app-list-item {
line-height: 34px;
padding: 12px 6px;
min-height: 24px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #f0f0f0;
.app-list-item-content {
width: 70%;
display: flex;
align-items: center;
.item-icon {
width: 40px;
height: 40px;
margin-right: 14px;
img {
width: 40px;
height: 40px;
border-radius: 50%;
}
}
.item-content-text {
display: flex;
flex-direction: column;
.item-text {
font-size: 18px;
font-weight: bold;
}
.item-subtext {
color: #8c8c8c;
}
}
}
.app-list-item-date {
position: relative;
color: #8c8c8c;
}
}
.app-list-item.isSelect {
background: #ecf5ff;
border-radius: 2px;
border-color: rgb(197, 197, 197);
}
.app-list-item:hover {
background: #ecf5ff;
}
.loadmore {
text-align: center;
padding: 10px;
text-decoration: underline;
color: #82bff7;
cursor: default;
}
}
.app-list-empty {
height:100%;
color: #909399;
display: flex;
justify-content: center;
align-items: center;
}
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import EditorListBase from './editor-list-list-base.vue';
@Component({
components: {
}
})
export default class EditorList extends EditorListBase {
}
</script>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册