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

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

上级 43520a61
......@@ -197,6 +197,8 @@ export default {
menuitem82: "远程聚合",
menuitem83: "列表",
menuitem84: "列表内置功能",
menuitem85: "列表自动分组",
menuitem86: "代码表分组",
menuitem14: "树视图",
menuitem60: "静态节点",
menuitem61: "动态节点(代码表)",
......
......@@ -197,6 +197,8 @@ export default {
menuitem82: "远程聚合",
menuitem83: "列表",
menuitem84: "列表内置功能",
menuitem85: "列表自动分组",
menuitem86: "代码表分组",
menuitem14: "树视图",
menuitem60: "静态节点",
menuitem61: "动态节点(代码表)",
......
......@@ -213,12 +213,9 @@ export default {
uiactions: {
},
},
lnternalfunclist_list: {
groupbycodelistlist_list: {
nodata:"",
uiactions: {
new: "New",
edit: "Edit",
remove: "Remove",
},
},
list_list: {
......@@ -226,9 +223,12 @@ export default {
uiactions: {
},
},
groupbycodelistlist_list: {
lnternalfunclist_list: {
nodata:"",
uiactions: {
new: "New",
edit: "Edit",
remove: "Remove",
},
},
dataview_dataview: {
......@@ -330,6 +330,8 @@ export default {
},
usr4gridviewtoolbar_toolbar: {
},
groupbycodelistlistviewtoolbar_toolbar: {
},
newdefaultvaluegridviewtoolbar_toolbar: {
tbitem3: {
caption: "New",
......@@ -396,6 +398,8 @@ export default {
tip: "数据导入",
},
},
autogrouplistviewtoolbar_toolbar: {
},
updatedefaultgridviewtoolbar_toolbar: {
tbitem3: {
caption: "New",
......@@ -630,10 +634,6 @@ export default {
},
usr3gridviewtoolbar_toolbar: {
},
autogrouplistviewtoolbar_toolbar: {
},
dataviewtoolbar_toolbar: {
},
groupbycodelistlistviewtoolbar_toolbar: {
},
};
\ No newline at end of file
......@@ -212,12 +212,9 @@ export default {
uiactions: {
},
},
lnternalfunclist_list: {
groupbycodelistlist_list: {
nodata:"",
uiactions: {
new: "新建",
edit: "编辑",
remove: "批量删除",
},
},
list_list: {
......@@ -225,9 +222,12 @@ export default {
uiactions: {
},
},
groupbycodelistlist_list: {
lnternalfunclist_list: {
nodata:"",
uiactions: {
new: "新建",
edit: "编辑",
remove: "批量删除",
},
},
dataview_dataview: {
......@@ -329,6 +329,8 @@ export default {
},
usr4gridviewtoolbar_toolbar: {
},
groupbycodelistlistviewtoolbar_toolbar: {
},
newdefaultvaluegridviewtoolbar_toolbar: {
tbitem3: {
caption: "新建",
......@@ -395,6 +397,8 @@ export default {
tip: "数据导入",
},
},
autogrouplistviewtoolbar_toolbar: {
},
updatedefaultgridviewtoolbar_toolbar: {
tbitem3: {
caption: "新建",
......@@ -629,10 +633,6 @@ export default {
},
usr3gridviewtoolbar_toolbar: {
},
autogrouplistviewtoolbar_toolbar: {
},
dataviewtoolbar_toolbar: {
},
groupbycodelistlistviewtoolbar_toolbar: {
},
};
\ No newline at end of file
......@@ -627,6 +627,42 @@ mock.onGet('v7/main-menuappmenu').reply((config: any) => {
textcls: '',
appfunctag: 'AppFunc11',
resourcetag: '',
},
{
id: '9B66B71B-5CD9-4EA5-9558-9202918B9ED7',
name: 'menuitem85',
text: '列表自动分组',
type: 'MENUITEM',
counterid: '',
tooltip: '列表自动分组',
expanded: false,
separator: false,
hidden: false,
hidesidebar: false,
opendefault: false,
iconcls: '',
icon: '',
textcls: '',
appfunctag: 'AppFunc12',
resourcetag: '',
},
{
id: '89B74788-65AF-4B98-8E75-2343653D1DA2',
name: 'menuitem86',
text: '代码表分组',
type: 'MENUITEM',
counterid: '',
tooltip: '代码表分组',
expanded: false,
separator: false,
hidden: false,
hidesidebar: false,
opendefault: false,
iconcls: '',
icon: '',
textcls: '',
appfunctag: 'AppFunc13',
resourcetag: '',
},
],
},
......
<template>
<div class='view-container delistview ibizbookauto-group-list-view'>
<app-studioaction :viewTitle="$t(model.srfCaption)" viewName="ibizbookautogrouplistview"></app-studioaction>
<card class='view-card ' :bordered="false" :dis-hover="true" >
<div slot='title' class="header-container">
<span class='caption-info'>{{$t(model.srfCaption)}}</span>
</div>
<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;' />
<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 IBIZBOOKService from '@/service/ibizbook/ibizbook-service';
import IBIZBOOKAuthService from '@/authservice/ibizbook/ibizbook-auth-service';
import ListViewEngine from '@engine/view/list-view-engine';
import IBIZBOOKUIService from '@/uiservice/ibizbook/ibizbook-ui-service';
import CodeListService from "@/codelist/codelist-service";
@Component({
components: {
},
})
export default class IBIZBOOKAutoGroupListViewBase extends Vue {
/**
* 实体服务对象
*
* @type {IBIZBOOKService}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public appEntityService: IBIZBOOKService = new IBIZBOOKService;
/**
* 实体UI服务对象
*
* @type IBIZBOOKUIService
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public appUIService: IBIZBOOKUIService = new IBIZBOOKUIService(this.$store);
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public viewtag: string = '2b42718d8fb3b4c9a01651222304445a';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public model: any = {
srfCaption: 'entities.ibizbook.views.autogrouplistview.caption',
srfTitle: 'entities.ibizbook.views.autogrouplistview.title',
srfSubTitle: 'entities.ibizbook.views.autogrouplistview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBIZBOOKAutoGroupListViewBase
*/
@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 IBIZBOOKAutoGroupListViewBase
*/
@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 IBIZBOOKAutoGroupListViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_list: { name: 'list', type: 'LIST' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
};
/**
* 视图刷新
*
* @param {*} args
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public refresh(args?: any): void {
const refs: any = this.$refs;
if (refs && refs.list) {
refs.list.refresh();
}
}
/**
* 计数器刷新
*
* @memberof IBIZBOOKAutoGroupListViewBase
*/
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 IBIZBOOKAutoGroupListViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof IBIZBOOKAutoGroupListView
*/
public toolBarModels: any = {
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public engine: ListViewEngine = new ListViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof IBIZBOOKAutoGroupListViewBase
*/
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: 'ibizbook',
majorPSDEField: 'ibizbookname',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 门户部件状态对象
*
* @type {*}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
@Prop() public portletState?: any;
/**
* 门户部件状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public portletStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public viewCacheData:any;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 解析视图参数
*
* @public
* @memberof IBIZBOOKAutoGroupListViewBase
*/
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,{'ibizbook':inputvalue});
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof IBIZBOOKAutoGroupListViewBase
*/
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 IBIZBOOKAutoGroupListViewBase
*/
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 IBIZBOOKAutoGroupListViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'ibizbookauto-group-list-view',tag:this.viewtag,srfkey:isNew ? null : this.context.ibizbook,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'ibizbookauto-group-list-view',tag:this.viewtag,srfkey:this.context.ibizbook,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof IBIZBOOKAutoGroupListViewBase
*/
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,'ibizbookauto-group-list-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,'IBIZBOOKAutoGroupListView')){
return;
}
if(Object.is(res.action,'refresh') && _this.refresh && _this.refresh instanceof Function){
_this.refresh();
}
})
}
}
/**
* 销毁之前
*
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* list 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public list_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'selectionchange', $event);
}
/**
* list 部件 beforeload 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public list_beforeload($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'beforeload', $event);
}
/**
* list 部件 rowdblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public list_rowdblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'rowdblclick', $event);
}
/**
* list 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public list_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'remove', $event);
}
/**
* list 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public list_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'load', $event);
}
/**
* searchform 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public searchform_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'save', $event);
}
/**
* searchform 部件 search 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKAutoGroupListViewBase
*/
public searchform_search($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'search', $event);
}
/**
* searchform 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKAutoGroupListViewBase
*/
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 IBIZBOOKAutoGroupListView
*/
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.ibizbook;
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ 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 IBIZBOOKAutoGroupListView
*/
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: 'ibizbooks', parameterName: 'ibizbook' },
{ 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 IBIZBOOKAutoGroupListViewBase
*/
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 IBIZBOOKAutoGroupListViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBIZBOOKAutoGroupListViewBase
*/
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 IBIZBOOKAutoGroupListView
*/
public query: string = '';
/**
* 是否展开搜索表单
*
* @type {boolean}
* @memberof IBIZBOOKAutoGroupListView
*/
public isExpandSearchForm: boolean = false;
/**
* 快速搜索
*
* @param {*} $event
* @memberof IBIZBOOKAutoGroupListView
*/
public onSearch($event: any): void {
const refs: any = this.$refs;
if (refs.list) {
refs.list.load({});
}
}
}
</script>
<style lang='less'>
@import './ibizbookauto-group-list-view.less';
</style>
\ No newline at end of file
.ibizbookauto-group-list-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 IBIZBOOKAutoGroupListViewBase from './ibizbookauto-group-list-view-base.vue';
import view_list from '@widgets/ibizbook/list-list/list-list.vue';
import view_searchform from '@widgets/ibizbook/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 IBIZBOOKAutoGroupListView extends IBIZBOOKAutoGroupListViewBase {
}
</script>
\ No newline at end of file
<template>
<div class='view-container delistview ibizbookgroup-by-codelist-list-view'>
<app-studioaction :viewTitle="$t(model.srfCaption)" viewName="ibizbookgroupbycodelistlistview"></app-studioaction>
<card class='view-card ' :bordered="false" :dis-hover="true" >
<div slot='title' class="header-container">
<span class='caption-info'>{{$t(model.srfCaption)}}</span>
</div>
<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;' />
<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 IBIZBOOKService from '@/service/ibizbook/ibizbook-service';
import IBIZBOOKAuthService from '@/authservice/ibizbook/ibizbook-auth-service';
import ListViewEngine from '@engine/view/list-view-engine';
import IBIZBOOKUIService from '@/uiservice/ibizbook/ibizbook-ui-service';
import CodeListService from "@/codelist/codelist-service";
@Component({
components: {
},
})
export default class IBIZBOOKGroupByCodelistListViewBase extends Vue {
/**
* 实体服务对象
*
* @type {IBIZBOOKService}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public appEntityService: IBIZBOOKService = new IBIZBOOKService;
/**
* 实体UI服务对象
*
* @type IBIZBOOKUIService
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public appUIService: IBIZBOOKUIService = new IBIZBOOKUIService(this.$store);
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public viewtag: string = 'edca8ee67304eb78c02bbfb9e4cb11bb';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public model: any = {
srfCaption: 'entities.ibizbook.views.groupbycodelistlistview.caption',
srfTitle: 'entities.ibizbook.views.groupbycodelistlistview.title',
srfSubTitle: 'entities.ibizbook.views.groupbycodelistlistview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
@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 IBIZBOOKGroupByCodelistListViewBase
*/
@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 IBIZBOOKGroupByCodelistListViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_list: { name: 'list', type: 'LIST' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
};
/**
* 视图刷新
*
* @param {*} args
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public refresh(args?: any): void {
const refs: any = this.$refs;
if (refs && refs.list) {
refs.list.refresh();
}
}
/**
* 计数器刷新
*
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
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 IBIZBOOKGroupByCodelistListViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof IBIZBOOKGroupByCodelistListView
*/
public toolBarModels: any = {
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public engine: ListViewEngine = new ListViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
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: 'ibizbook',
majorPSDEField: 'ibizbookname',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 门户部件状态对象
*
* @type {*}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
@Prop() public portletState?: any;
/**
* 门户部件状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public portletStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public viewCacheData:any;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 解析视图参数
*
* @public
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
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,{'ibizbook':inputvalue});
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
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 IBIZBOOKGroupByCodelistListViewBase
*/
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 IBIZBOOKGroupByCodelistListViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'ibizbookgroup-by-codelist-list-view',tag:this.viewtag,srfkey:isNew ? null : this.context.ibizbook,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'ibizbookgroup-by-codelist-list-view',tag:this.viewtag,srfkey:this.context.ibizbook,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
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,'ibizbookgroup-by-codelist-list-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,'IBIZBOOKGroupByCodelistListView')){
return;
}
if(Object.is(res.action,'refresh') && _this.refresh && _this.refresh instanceof Function){
_this.refresh();
}
})
}
}
/**
* 销毁之前
*
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* list 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public list_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'selectionchange', $event);
}
/**
* list 部件 beforeload 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public list_beforeload($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'beforeload', $event);
}
/**
* list 部件 rowdblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public list_rowdblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'rowdblclick', $event);
}
/**
* list 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public list_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'remove', $event);
}
/**
* list 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public list_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('list', 'load', $event);
}
/**
* searchform 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public searchform_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'save', $event);
}
/**
* searchform 部件 search 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
public searchform_search($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'search', $event);
}
/**
* searchform 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
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 IBIZBOOKGroupByCodelistListView
*/
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.ibizbook;
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ 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 IBIZBOOKGroupByCodelistListView
*/
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: 'ibizbooks', parameterName: 'ibizbook' },
{ 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 IBIZBOOKGroupByCodelistListViewBase
*/
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 IBIZBOOKGroupByCodelistListViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBIZBOOKGroupByCodelistListViewBase
*/
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 IBIZBOOKGroupByCodelistListView
*/
public query: string = '';
/**
* 是否展开搜索表单
*
* @type {boolean}
* @memberof IBIZBOOKGroupByCodelistListView
*/
public isExpandSearchForm: boolean = false;
/**
* 快速搜索
*
* @param {*} $event
* @memberof IBIZBOOKGroupByCodelistListView
*/
public onSearch($event: any): void {
const refs: any = this.$refs;
if (refs.list) {
refs.list.load({});
}
}
}
</script>
<style lang='less'>
@import './ibizbookgroup-by-codelist-list-view.less';
</style>
\ No newline at end of file
.ibizbookgroup-by-codelist-list-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 IBIZBOOKGroupByCodelistListViewBase from './ibizbookgroup-by-codelist-list-view-base.vue';
import view_list from '@widgets/ibizbook/group-by-codelist-list-list/group-by-codelist-list-list.vue';
import view_searchform from '@widgets/ibizbook/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 IBIZBOOKGroupByCodelistListView extends IBIZBOOKGroupByCodelistListViewBase {
}
</script>
\ No newline at end of file
......@@ -21,8 +21,8 @@ export const PageComponents = {
Vue.component('ibizuniproduct-pickup-grid-view', () => import('@pages/sample/ibizuniproduct-pickup-grid-view/ibizuniproduct-pickup-grid-view.vue'));
Vue.component('ibizorder-odsp-wfexp-view', () => import('@pages/sample/ibizorder-odsp-wfexp-view/ibizorder-odsp-wfexp-view.vue'));
Vue.component('ibizorder-detail-sgrid-view', () => import('@pages/sample/ibizorder-detail-sgrid-view/ibizorder-detail-sgrid-view.vue'));
Vue.component('ibizorder-pickup-view', () => import('@pages/sample/ibizorder-pickup-view/ibizorder-pickup-view.vue'));
Vue.component('ibizsoftware-suit-edit-view', () => import('@pages/sample/ibizsoftware-suit-edit-view/ibizsoftware-suit-edit-view.vue'));
Vue.component('ibizorder-pickup-view', () => import('@pages/sample/ibizorder-pickup-view/ibizorder-pickup-view.vue'));
Vue.component('ibizorder-sf4-grid-view', () => import('@pages/sample/ibizorder-sf4-grid-view/ibizorder-sf4-grid-view.vue'));
Vue.component('ibizsample0003-grid-view', () => import('@pages/sample/ibizsample0003-grid-view/ibizsample0003-grid-view.vue'));
Vue.component('ibizsample0003-sf4-edit-view', () => import('@pages/sample/ibizsample0003-sf4-edit-view/ibizsample0003-sf4-edit-view.vue'));
......@@ -50,8 +50,8 @@ export const PageComponents = {
Vue.component('ibizorder-edit-view', () => import('@pages/sample/ibizorder-edit-view/ibizorder-edit-view.vue'));
Vue.component('ibizorder-odsp-d-wfgrid-view', () => import('@pages/sample/ibizorder-odsp-d-wfgrid-view/ibizorder-odsp-d-wfgrid-view.vue'));
Vue.component('ibizorder-detail-grid-view', () => import('@pages/sample/ibizorder-detail-grid-view/ibizorder-detail-grid-view.vue'));
Vue.component('ibizorder-s2-edit-view', () => import('@pages/sample/ibizorder-s2-edit-view/ibizorder-s2-edit-view.vue'));
Vue.component('ibizorder-sf2-edit-view', () => import('@pages/sample/ibizorder-sf2-edit-view/ibizorder-sf2-edit-view.vue'));
Vue.component('ibizorder-s2-edit-view', () => import('@pages/sample/ibizorder-s2-edit-view/ibizorder-s2-edit-view.vue'));
Vue.component('ibizorder-sf4-edit-view', () => import('@pages/sample/ibizorder-sf4-edit-view/ibizorder-sf4-edit-view.vue'));
Vue.component('ibizorder-sf1-edit-view', () => import('@pages/sample/ibizorder-sf1-edit-view/ibizorder-sf1-edit-view.vue'));
Vue.component('ibizsample0013-pickup-view', () => import('@pages/sample/ibizsample0013-pickup-view/ibizsample0013-pickup-view.vue'));
......@@ -114,10 +114,12 @@ export const PageComponents = {
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('ibizsample0001-sf5-edit-view', () => import('@pages/sample/ibizsample0001-sf5-edit-view/ibizsample0001-sf5-edit-view.vue'));
Vue.component('ibizbookgroup-by-codelist-list-view', () => import('@pages/sample/ibizbookgroup-by-codelist-list-view/ibizbookgroup-by-codelist-list-view.vue'));
Vue.component('ibizorder-radar-chart-view', () => import('@pages/sample/ibizorder-radar-chart-view/ibizorder-radar-chart-view.vue'));
Vue.component('ibizbookupdate-default-grid-view', () => import('@pages/sample/ibizbookupdate-default-grid-view/ibizbookupdate-default-grid-view.vue'));
Vue.component('ibizsample0003-stab-exp-view', () => import('@pages/sample/ibizsample0003-stab-exp-view/ibizsample0003-stab-exp-view.vue'));
Vue.component('ibizsample0017-pickup-grid-view', () => import('@pages/sample/ibizsample0017-pickup-grid-view/ibizsample0017-pickup-grid-view.vue'));
Vue.component('ibizbookauto-group-list-view', () => import('@pages/sample/ibizbookauto-group-list-view/ibizbookauto-group-list-view.vue'));
Vue.component('ibizsample0013-pickup-grid-view', () => import('@pages/sample/ibizsample0013-pickup-grid-view/ibizsample0013-pickup-grid-view.vue'));
Vue.component('ibizsample0003-sf5-edit-view', () => import('@pages/sample/ibizsample0003-sf5-edit-view/ibizsample0003-sf5-edit-view.vue'));
Vue.component('ibizuniproduct-grid-view9', () => import('@pages/sample/ibizuniproduct-grid-view9/ibizuniproduct-grid-view9.vue'));
......
......@@ -375,32 +375,32 @@ const router = new Router({
component: () => import('@pages/sample/ibizorder-detail-sgrid-view/ibizorder-detail-sgrid-view.vue'),
},
{
path: 'ibizorders/:ibizorder?/pickupview/:pickupview?',
path: 'ibizsoftwaresuits/:ibizsoftwaresuit?/editview/:editview?',
meta: {
caption: 'entities.ibizorder.views.pickupview.caption',
caption: 'entities.ibizsoftwaresuit.views.editview.caption',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibizorders', parameterName: 'ibizorder' },
{ pathName: 'pickupview', parameterName: 'pickupview' },
{ pathName: 'ibizsoftwaresuits', parameterName: 'ibizsoftwaresuit' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizorder-pickup-view/ibizorder-pickup-view.vue'),
component: () => import('@pages/sample/ibizsoftware-suit-edit-view/ibizsoftware-suit-edit-view.vue'),
},
{
path: 'ibizsoftwaresuits/:ibizsoftwaresuit?/editview/:editview?',
path: 'ibizorders/:ibizorder?/pickupview/:pickupview?',
meta: {
caption: 'entities.ibizsoftwaresuit.views.editview.caption',
caption: 'entities.ibizorder.views.pickupview.caption',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibizsoftwaresuits', parameterName: 'ibizsoftwaresuit' },
{ pathName: 'editview', parameterName: 'editview' },
{ pathName: 'ibizorders', parameterName: 'ibizorder' },
{ pathName: 'pickupview', parameterName: 'pickupview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizsoftware-suit-edit-view/ibizsoftware-suit-edit-view.vue'),
component: () => import('@pages/sample/ibizorder-pickup-view/ibizorder-pickup-view.vue'),
},
{
path: 'ibizorders/:ibizorder?/sf4gridview/:sf4gridview?',
......@@ -781,32 +781,32 @@ const router = new Router({
component: () => import('@pages/sample/ibizorder-detail-grid-view/ibizorder-detail-grid-view.vue'),
},
{
path: 'ibizorders/:ibizorder?/s2editview/:s2editview?',
path: 'ibizorders/:ibizorder?/sf2editview/:sf2editview?',
meta: {
caption: 'entities.ibizorder.views.s2editview.caption',
caption: 'entities.ibizorder.views.sf2editview.caption',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibizorders', parameterName: 'ibizorder' },
{ pathName: 's2editview', parameterName: 's2editview' },
{ pathName: 'sf2editview', parameterName: 'sf2editview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizorder-s2-edit-view/ibizorder-s2-edit-view.vue'),
component: () => import('@pages/sample/ibizorder-sf2-edit-view/ibizorder-sf2-edit-view.vue'),
},
{
path: 'ibizorders/:ibizorder?/sf2editview/:sf2editview?',
path: 'ibizorders/:ibizorder?/s2editview/:s2editview?',
meta: {
caption: 'entities.ibizorder.views.sf2editview.caption',
caption: 'entities.ibizorder.views.s2editview.caption',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibizorders', parameterName: 'ibizorder' },
{ pathName: 'sf2editview', parameterName: 'sf2editview' },
{ pathName: 's2editview', parameterName: 's2editview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizorder-sf2-edit-view/ibizorder-sf2-edit-view.vue'),
component: () => import('@pages/sample/ibizorder-s2-edit-view/ibizorder-s2-edit-view.vue'),
},
{
path: 'ibizorders/:ibizorder?/sf4editview/:sf4editview?',
......@@ -1691,6 +1691,20 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizsample0001-sf5-edit-view/ibizsample0001-sf5-edit-view.vue'),
},
{
path: 'ibizbooks/:ibizbook?/groupbycodelistlistview/:groupbycodelistlistview?',
meta: {
caption: 'entities.ibizbook.views.groupbycodelistlistview.caption',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'groupbycodelistlistview', parameterName: 'groupbycodelistlistview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizbookgroup-by-codelist-list-view/ibizbookgroup-by-codelist-list-view.vue'),
},
{
path: 'ibizorders/:ibizorder?/radarchartview/:radarchartview?',
meta: {
......@@ -1747,6 +1761,20 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizsample0017-pickup-grid-view/ibizsample0017-pickup-grid-view.vue'),
},
{
path: 'ibizbooks/:ibizbook?/autogrouplistview/:autogrouplistview?',
meta: {
caption: 'entities.ibizbook.views.autogrouplistview.caption',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'autogrouplistview', parameterName: 'autogrouplistview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizbookauto-group-list-view/ibizbookauto-group-list-view.vue'),
},
{
path: 'ibizsample0013s/:ibizsample0013?/pickupgridview/:pickupgridview?',
meta: {
......@@ -2094,6 +2122,19 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizsample0003-pickup-view/ibizsample0003-pickup-view.vue'),
},
{
path: '/ibizbooks/:ibizbook?/autogrouplistview/:autogrouplistview?',
meta: {
caption: 'entities.ibizbook.views.autogrouplistview.caption',
info:'',
parameters: [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'autogrouplistview', parameterName: 'autogrouplistview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizbookauto-group-list-view/ibizbookauto-group-list-view.vue'),
},
{
path: '/ibizorders/:ibizorder?/f13editview/:f13editview?',
meta: {
......@@ -3370,6 +3411,19 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizuniproduct-pickup-view/ibizuniproduct-pickup-view.vue'),
},
{
path: '/ibizbooks/:ibizbook?/groupbycodelistlistview/:groupbycodelistlistview?',
meta: {
caption: 'entities.ibizbook.views.groupbycodelistlistview.caption',
info:'',
parameters: [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'groupbycodelistlistview', parameterName: 'groupbycodelistlistview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizbookgroup-by-codelist-list-view/ibizbookgroup-by-codelist-list-view.vue'),
},
{
path: '/ibizhardwares/:ibizhardware?/indexpickupdataview/:indexpickupdataview?',
meta: {
......
......@@ -197,8 +197,8 @@ export const viewstate: any = {
'94e6694a65d9cacb171b6e0b581216ba',
'8a4ccafa81445d49488874a8c7575932',
'3bbf72a3e5b59fed0dee362a9b1384a8',
'f73da4cb47a88d3fe5b92716e0137741',
'fdb8ed39fbfea00f65416b9aaebd64e7',
'f73da4cb47a88d3fe5b92716e0137741',
'b7c0a73eb248d41eb750bbf095fa5505',
'd99f9680b535dcf3ad0d0f853a8b89d9',
'dd8d7ffe00cabb07784f30f66a5b34da',
......@@ -213,12 +213,14 @@ export const viewstate: any = {
'b8ae19200ec9d4e8e588bc31e3f9bcb4',
'b1256beac1e95915b675893c61559b59',
'09663b7a4e3dce70524d1b64e02b5e2d',
'edca8ee67304eb78c02bbfb9e4cb11bb',
'491c2bc6eab0ad313d4b6f06f6a396f5',
'e53fed4d0b4dd614057f426b02115b41',
'836bdb4063978b55fedd6a180d60c323',
'e54ae8e27a53b3425ac78a229a163bd5',
'369a14f21cbff0d0fe23831aecfca7ba',
'00a0716a2029a7fe79fe03b6f74c7c90',
'2b42718d8fb3b4c9a01651222304445a',
'a894de140705ecab2f39797d2922a3ce',
'e57dd501c75c6933363fa245edcadbbd',
'ea604a66caf499c70c9002a917dd1694',
......@@ -274,6 +276,16 @@ export const viewstate: any = {
'5b01a962455b84e1830e5e2f397ff9e8',
],
},
{
viewtag: '2b42718d8fb3b4c9a01651222304445a',
viewmodule: 'Sample',
viewname: 'IBIZBOOKAutoGroupListView',
viewaction: '',
viewdatachange: false,
refviews: [
'b3429ecc4d89a02bc5f5279f1bd7f620',
],
},
{
viewtag: '2cd3a77cbd2aad4551b7a6a009419d52',
viewmodule: 'Sample',
......@@ -1239,6 +1251,16 @@ export const viewstate: any = {
'80c9ae9ed04e7107ed9fc93734a447d1',
],
},
{
viewtag: 'edca8ee67304eb78c02bbfb9e4cb11bb',
viewmodule: 'Sample',
viewname: 'IBIZBOOKGroupByCodelistListView',
viewaction: '',
viewdatachange: false,
refviews: [
'b3429ecc4d89a02bc5f5279f1bd7f620',
],
},
{
viewtag: 'ef58fa6d7d250a60a7907ed895681ea1',
viewmodule: 'Sample',
......
......@@ -611,6 +611,9 @@ export default class MainMenuBase extends Vue implements ControlInterface {
case 'Auto243':
this.clickAuto243(item);
return;
case 'AppFunc13':
this.clickAppFunc13(item);
return;
case 'AppFunc5':
this.clickAppFunc5(item);
return;
......@@ -620,12 +623,12 @@ export default class MainMenuBase extends Vue implements ControlInterface {
case 'Auto319':
this.clickAuto319(item);
return;
case 'AppFunc3':
this.clickAppFunc3(item);
return;
case 'Auto408':
this.clickAuto408(item);
return;
case 'AppFunc3':
this.clickAppFunc3(item);
return;
case 'Auto235':
this.clickAuto235(item);
return;
......@@ -650,6 +653,9 @@ export default class MainMenuBase extends Vue implements ControlInterface {
case 'Auto145':
this.clickAuto145(item);
return;
case 'AppFunc12':
this.clickAppFunc12(item);
return;
case 'Auto338':
this.clickAuto338(item);
return;
......@@ -1438,6 +1444,29 @@ export default class MainMenuBase extends Vue implements ControlInterface {
})
}
/**
* 图书列表(代码表分组)
*
* @param {*} [item={}]
* @memberof MainMenu
*/
public clickAppFunc13(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'groupbycodelistlistview', parameterName: 'groupbycodelistlistview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
if(Object.is(this.$route.fullPath,path)){
return;
}
this.$nextTick(function(){
this.$router.push(path);
})
}
/**
* 图书表格视图-更新默认值
*
......@@ -1508,18 +1537,18 @@ export default class MainMenuBase extends Vue implements ControlInterface {
}
/**
* 图书实体行编辑表格
* 单选
*
* @param {*} [item={}]
* @memberof MainMenu
*/
public clickAppFunc3(item: any = {}) {
public clickAuto408(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'roweditgridview', parameterName: 'roweditgridview' },
{ pathName: 'ibizsample0003s', parameterName: 'ibizsample0003' },
{ pathName: 'sf1editview', parameterName: 'sf1editview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
if(Object.is(this.$route.fullPath,path)){
......@@ -1531,18 +1560,18 @@ export default class MainMenuBase extends Vue implements ControlInterface {
}
/**
* 单选
* 图书实体行编辑表格
*
* @param {*} [item={}]
* @memberof MainMenu
*/
public clickAuto408(item: any = {}) {
public clickAppFunc3(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizsample0003s', parameterName: 'ibizsample0003' },
{ pathName: 'sf1editview', parameterName: 'sf1editview' },
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'roweditgridview', parameterName: 'roweditgridview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
if(Object.is(this.$route.fullPath,path)){
......@@ -1737,6 +1766,29 @@ export default class MainMenuBase extends Vue implements ControlInterface {
})
}
/**
* 图书列表(自动分组)
*
* @param {*} [item={}]
* @memberof MainMenu
*/
public clickAppFunc12(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'autogrouplistview', parameterName: 'autogrouplistview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
if(Object.is(this.$route.fullPath,path)){
return;
}
this.$nextTick(function(){
this.$router.push(path);
})
}
/**
* 属性类型
*
......
......@@ -665,6 +665,44 @@ export default class MainMenuModel {
appfunctag: 'AppFunc11',
resourcetag: '',
authtag:'Web-MainMenu-menuitem84',
},
{
id: '9B66B71B-5CD9-4EA5-9558-9202918B9ED7',
name: 'menuitem85',
text: '列表自动分组',
type: 'MENUITEM',
counterid: '',
tooltip: '列表自动分组',
expanded: false,
separator: false,
hidden: false,
hidesidebar: false,
opendefault: false,
iconcls: '',
icon: '',
textcls: '',
appfunctag: 'AppFunc12',
resourcetag: '',
authtag:'Web-MainMenu-menuitem85',
},
{
id: '89B74788-65AF-4B98-8E75-2343653D1DA2',
name: 'menuitem86',
text: '代码表分组',
type: 'MENUITEM',
counterid: '',
tooltip: '代码表分组',
expanded: false,
separator: false,
hidden: false,
hidesidebar: false,
opendefault: false,
iconcls: '',
icon: '',
textcls: '',
appfunctag: 'AppFunc13',
resourcetag: '',
authtag:'Web-MainMenu-menuitem86',
},
],
},
......
<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.ibizbook.groupbycodelistlist_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.ibizbook.groupbycodelistlist_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 IBIZBOOKService from '@/service/ibizbook/ibizbook-service';
import GroupByCodelistListService from './group-by-codelist-list-list-service';
import IBIZBOOKUIService from '@/uiservice/ibizbook/ibizbook-ui-service';
import CodeListService from "@/codelist/codelist-service";
@Component({
components: {
}
})
export default class GroupByCodelistListBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof GroupByCodelistListBase
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof GroupByCodelistListBase
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof GroupByCodelistListBase
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof GroupByCodelistListBase
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof GroupByCodelistListBase
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof GroupByCodelistListBase
*/
public getControlType(): string {
return 'LIST'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof GroupByCodelistListBase
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {GroupByCodelistListService}
* @memberof GroupByCodelistListBase
*/
public service: GroupByCodelistListService = new GroupByCodelistListService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBIZBOOKService}
* @memberof GroupByCodelistListBase
*/
public appEntityService: IBIZBOOKService = new IBIZBOOKService({ $store: this.$store });
/**
* 转化数据
*
* @param {any} args
* @memberof GroupByCodelistListBase
*/
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 GroupByCodelistListBase
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof GroupByCodelistListBase
*/
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();
}
})
}
}
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof GroupByCodelistListBase
*/
public getDatas(): any[] {
return this.selections;
}
/**
* 获取单项树
*
* @returns {*}
* @memberof GroupByCodelistListBase
*/
public getData(): any {
return null;
}
/**
* 是否默认选中第一条数据
*
* @type {boolean}
* @memberof GroupByCodelistListBase
*/
@Prop({ default: false }) public isSelectFirstDefault!: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof GroupByCodelistListBase
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--create
*
* @type {string}
* @memberof GroupByCodelistListBase
*/
@Prop() public createAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof GroupByCodelistListBase
*/
@Prop() public removeAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof GroupByCodelistListBase
*/
@Prop() public updateAction!: string;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof GroupByCodelistListBase
*/
@Prop() public fetchAction!: string;
/**
* 打开新建数据视图
*
* @type {any}
* @memberof GroupByCodelistListBase
*/
@Prop() public newdata: any;
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof GroupByCodelistListBase
*/
@Prop() public opendata: any;
/**
* this引用
*
* @type {number}
* @memberof GroupByCodelistListBase
*/
public thisRef: any = this;
/**
* 分组属性
*
* @type {string}
* @memberof GroupByCodelistListBase
*/
public groupField: string = "type";
/**
* 分组数据
*
* @type {Array<any>}
* @memberof GroupByCodelistListBase
*/
public groupData: Array<any> = [];
/**
* 分组模式
*
* @type {string}
* @memberof GroupByCodelistListBase
*/
public groupMode: string = "CODELIST";
/**
* 分组方法
*
* @memberof GroupByCodelistListBase
*/
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 {CodeListService}
* @memberof GroupByCodelistListBase
*/
public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 分组代码表标识
*
* @type {string}
* @memberof GroupByCodelistListBase
*/
public tag: string = "BookType";
/**
* 分组代码表类型
*
* @type {string}
* @memberof GroupByCodelistListBase
*/
public codelistType: string = "STATIC";
/**
* 根据分组代码表绘制分组列表
*
* @memberof GroupByCodelistListBase
*/
public async drawCodelistGroup(){
let groups: Array<any> = [];
let groupTree:Array<any> = [];
let data:Array<any> = [...this.items];
// 动态代码表
if (Object.is(this.codelistType, "DYNAMIC")) {
groups = await this.codeListService.getItems(this.tag);
// 静态代码表
} else if(Object.is(this.codelistType, "STATIC")){
groups = this.$store.getters.getCodeListItems(this.tag);
}
if(groups.length == 0){
console.warn("分组数据无效");
}
groups.forEach((group: any,i: number)=>{
let children:Array<any> = [];
data.forEach((item: any,j: number)=>{
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 = 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 GroupByCodelistListBase
*/
public curPage: number = 1;
/**
* 数据
*
* @type {any[]}
* @memberof GroupByCodelistListBase
*/
public items: any[] = [];
/**
* 是否支持分页
*
* @type {boolean}
* @memberof GroupByCodelistListBase
*/
public isEnablePagingBar: boolean = true;
/**
* 分页条数
*
* @type {number}
* @memberof GroupByCodelistListBase
*/
public limit: number = 1000;
/**
* 总条数
*
* @type {number}
* @memberof GroupByCodelistListBase
*/
public totalRecord: number = 0;
/**
* 加载的数据是否附加在items之后
*
* @type {boolean}
* @memberof GroupByCodelistListBase
*/
public isAddBehind:boolean = false;
/**
* 是否有滚动条
*
* @type {boolean}
* @memberof GroupByCodelistListBase
*/
public isScrollBar: boolean = false;
/**
* 排序方向
*
* @type {string}
* @memberof GroupByCodelistListBase
*/
public sortDir:string = '';
/**
* 排序字段
*
* @type {string}
* @memberof GroupByCodelistListBase
*/
public sortField: string = '';
/**
* 选中数组
* @type {Array<any>}
* @memberof GroupByCodelistListBase
*/
public selections: Array<any> = [];
/**
* 应用状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof GroupByCodelistListBase
*/
public appStateEvent: Subscription | undefined;
/**
* Vue声明周期,组件挂载完毕
*
* @memberof GroupByCodelistListBase
*/
public mounted () {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof GroupByCodelistListBase
*/
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 GroupByCodelistListBase
*/
public created() {
this.afterCreated()
}
/**
* 执行created后的逻辑
*
* @memberof GroupByCodelistListBase
*/
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,"IBIZBOOK")){
return;
}
if(Object.is(action,'appRefresh')){
this.refresh([data]);
}
})
}
}
/**
* vue 生命周期
*
* @memberof GroupByCodelistListBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof GroupByCodelistListBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
}
/**
* 加载更多
*
* @memberof GroupByCodelistListBase
*/
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 GroupByCodelistListBase
*/
public load(opt: any = {}): void {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKGroupByCodelistListView' + (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 GroupByCodelistListBase
*/
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 GroupByCodelistListBase
*/
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 GroupByCodelistListBase
*/
public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKGroupByCodelistListView' + (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,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: 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 GroupByCodelistListBase
*/
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: 'IBIZBOOKGroupByCodelistListView' + (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: 'IBIZBOOKGroupByCodelistListView' + (this.$t('app.list.notConfig.updateAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
if(item.ibizbook){
Object.assign(this.context,{ibizbook:item.ibizbook});
}
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 GroupByCodelistListBase
*/
public onPanelDataChange(item:any,$event:any) {
Object.assign(item, $event, {rowDataState:'update'});
}
/**
* 选择数据
* @memberof GroupByCodelistListBase
*
*/
public handleClick(args: any) {
this.clearSelection();
args.isselected = !args.isselected;
this.selectchange();
}
/**
* 双击数据
* @memberof GroupByCodelistListBase
*
*/
public handleDblClick(args: any) {
this.$emit('rowdblclick', args);
}
/**
* 触发事件
* @memberof GroupByCodelistListBase
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
this.$emit('selectionchange', this.selections);
}
/**
* 清除当前所有选中状态
*
* @memberof GroupByCodelistListBase
*/
public clearSelection(){
this.items.map((item: any) => {
Object.assign(item, { isselected: false });
});
}
/**
* 操作栏模型数据
*
* @type {*}
* @memberof GroupByCodelistListBase
*/
public ActionModel:any ={
};
/**
* 操作列界面行为
*
* @param {*} data
* @param {*} tag
* @param {*} $event
* @memberof GroupByCodelistListBase
*/
public uiAction(data: any, tag: any, $event: any) {
$event.stopPropagation();
}
}
</script>
<style lang='less'>
@import './group-by-codelist-list-list.less';
</style>
\ No newline at end of file
/**
* GroupByCodelistList 部件模型
*
* @export
* @class GroupByCodelistListModel
*/
export default class GroupByCodelistListModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof GroupByCodelistListListMode
*/
public getDataItems(): any[] {
return [
{
name: 'type',
},
{
name: 'booknumber',
},
{
name: 'author',
},
{
name: 'price',
},
{
name: 'ibizbookname',
},
{
name: 'press',
},
{
name: 'ibizbookid',
},
{
name: 'srfkey',
prop: 'ibizbookid',
dataType: 'GUID',
},
{
name: 'srfmajortext',
prop: 'ibizbookname',
dataType: 'TEXT',
},
{
name: 'ibizbook',
prop: 'ibizbookid',
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 IBIZBOOKService from '@/service/ibizbook/ibizbook-service';
import GroupByCodelistListModel from './group-by-codelist-list-list-model';
/**
* GroupByCodelistList 部件服务对象
*
* @export
* @class GroupByCodelistListService
*/
export default class GroupByCodelistListService extends ControlService {
/**
* 图书服务对象
*
* @type {IBIZBOOKService}
* @memberof GroupByCodelistListService
*/
public appEntityService: IBIZBOOKService = new IBIZBOOKService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof GroupByCodelistListService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of GroupByCodelistListService.
*
* @param {*} [opts={}]
* @memberof GroupByCodelistListService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new GroupByCodelistListModel();
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof GroupByCodelistListService
*/
@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 GroupByCodelistListService
*/
@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 GroupByCodelistListService
*/
@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 GroupByCodelistListService
*/
@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;
}
.app-list-item {
line-height: 34px;
border-radius:5px;
padding: 6px;
margin: 6px;
box-shadow: 0px 0px 2px 1px rgb(209, 208, 208);
background: #f7f7fa;
min-height: 24px;
display: flex;
justify-content: space-between;
align-items: center;
}
.app-list-item.isSelect {
background: #ecf5ff;
border-left: 5px solid #2d8cf0;
box-shadow: 0px 0px 3px 1px #82bff7;
}
.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 GroupByCodelistListBase from './group-by-codelist-list-list-base.vue';
@Component({
components: {
}
})
export default class GroupByCodelistList extends GroupByCodelistListBase {
}
</script>
\ No newline at end of file
<template>
<div :class="['app-list',this.items.length > 0 ? '' : 'app-list-empty' ]">
<div v-if="items.length > 0">
<div v-for = "item in items" :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>
<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.ibizbook.list_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 IBIZBOOKService from '@/service/ibizbook/ibizbook-service';
import ListService from './list-list-service';
import IBIZBOOKUIService from '@/uiservice/ibizbook/ibizbook-ui-service';
import CodeListService from "@/codelist/codelist-service";
@Component({
components: {
}
})
export default class ListBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof ListBase
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof ListBase
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof ListBase
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof ListBase
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof ListBase
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof ListBase
*/
public getControlType(): string {
return 'LIST'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof ListBase
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {ListService}
* @memberof ListBase
*/
public service: ListService = new ListService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBIZBOOKService}
* @memberof ListBase
*/
public appEntityService: IBIZBOOKService = new IBIZBOOKService({ $store: this.$store });
/**
* 转化数据
*
* @param {any} args
* @memberof ListBase
*/
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 ListBase
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof ListBase
*/
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();
}
})
}
}
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof ListBase
*/
public getDatas(): any[] {
return this.selections;
}
/**
* 获取单项树
*
* @returns {*}
* @memberof ListBase
*/
public getData(): any {
return null;
}
/**
* 是否默认选中第一条数据
*
* @type {boolean}
* @memberof ListBase
*/
@Prop({ default: false }) public isSelectFirstDefault!: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof ListBase
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--create
*
* @type {string}
* @memberof ListBase
*/
@Prop() public createAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof ListBase
*/
@Prop() public removeAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof ListBase
*/
@Prop() public updateAction!: string;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof ListBase
*/
@Prop() public fetchAction!: string;
/**
* 打开新建数据视图
*
* @type {any}
* @memberof ListBase
*/
@Prop() public newdata: any;
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof ListBase
*/
@Prop() public opendata: any;
/**
* this引用
*
* @type {number}
* @memberof ListBase
*/
public thisRef: any = this;
/**
* 当前页
*
* @type {number}
* @memberof ListBase
*/
public curPage: number = 1;
/**
* 数据
*
* @type {any[]}
* @memberof ListBase
*/
public items: any[] = [];
/**
* 是否支持分页
*
* @type {boolean}
* @memberof ListBase
*/
public isEnablePagingBar: boolean = true;
/**
* 分页条数
*
* @type {number}
* @memberof ListBase
*/
public limit: number = 1000;
/**
* 总条数
*
* @type {number}
* @memberof ListBase
*/
public totalRecord: number = 0;
/**
* 加载的数据是否附加在items之后
*
* @type {boolean}
* @memberof ListBase
*/
public isAddBehind:boolean = false;
/**
* 是否有滚动条
*
* @type {boolean}
* @memberof ListBase
*/
public isScrollBar: boolean = false;
/**
* 排序方向
*
* @type {string}
* @memberof ListBase
*/
public sortDir:string = '';
/**
* 排序字段
*
* @type {string}
* @memberof ListBase
*/
public sortField: string = '';
/**
* 选中数组
* @type {Array<any>}
* @memberof ListBase
*/
public selections: Array<any> = [];
/**
* 应用状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof ListBase
*/
public appStateEvent: Subscription | undefined;
/**
* Vue声明周期,组件挂载完毕
*
* @memberof ListBase
*/
public mounted () {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof ListBase
*/
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 ListBase
*/
public created() {
this.afterCreated()
}
/**
* 执行created后的逻辑
*
* @memberof ListBase
*/
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,"IBIZBOOK")){
return;
}
if(Object.is(action,'appRefresh')){
this.refresh([data]);
}
})
}
}
/**
* vue 生命周期
*
* @memberof ListBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof ListBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
}
/**
* 加载更多
*
* @memberof ListBase
*/
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 ListBase
*/
public load(opt: any = {}): void {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKAutoGroupListView' + (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]);
}
}
}, (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 ListBase
*/
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 ListBase
*/
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 ListBase
*/
public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKAutoGroupListView' + (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,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: 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);
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 ListBase
*/
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: 'IBIZBOOKAutoGroupListView' + (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: 'IBIZBOOKAutoGroupListView' + (this.$t('app.list.notConfig.updateAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
if(item.ibizbook){
Object.assign(this.context,{ibizbook:item.ibizbook});
}
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 ListBase
*/
public onPanelDataChange(item:any,$event:any) {
Object.assign(item, $event, {rowDataState:'update'});
}
/**
* 选择数据
* @memberof ListBase
*
*/
public handleClick(args: any) {
this.clearSelection();
args.isselected = !args.isselected;
this.selectchange();
}
/**
* 双击数据
* @memberof ListBase
*
*/
public handleDblClick(args: any) {
this.$emit('rowdblclick', args);
}
/**
* 触发事件
* @memberof ListBase
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
this.$emit('selectionchange', this.selections);
}
/**
* 清除当前所有选中状态
*
* @memberof ListBase
*/
public clearSelection(){
this.items.map((item: any) => {
Object.assign(item, { isselected: false });
});
}
/**
* 操作栏模型数据
*
* @type {*}
* @memberof ListBase
*/
public ActionModel:any ={
};
/**
* 操作列界面行为
*
* @param {*} data
* @param {*} tag
* @param {*} $event
* @memberof ListBase
*/
public uiAction(data: any, tag: any, $event: any) {
$event.stopPropagation();
}
}
</script>
<style lang='less'>
@import './list-list.less';
</style>
\ No newline at end of file
/**
* List 部件模型
*
* @export
* @class ListModel
*/
export default class ListModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof ListListMode
*/
public getDataItems(): any[] {
return [
{
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 IBIZBOOKService from '@/service/ibizbook/ibizbook-service';
import ListModel from './list-list-model';
/**
* List 部件服务对象
*
* @export
* @class ListService
*/
export default class ListService extends ControlService {
/**
* 图书服务对象
*
* @type {IBIZBOOKService}
* @memberof ListService
*/
public appEntityService: IBIZBOOKService = new IBIZBOOKService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof ListService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of ListService.
*
* @param {*} [opts={}]
* @memberof ListService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new ListModel();
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof ListService
*/
@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 ListService
*/
@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 ListService
*/
@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 ListService
*/
@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;
}
.app-list-item {
line-height: 34px;
border-radius:5px;
padding: 6px;
margin: 6px;
box-shadow: 0px 0px 2px 1px rgb(209, 208, 208);
background: #f7f7fa;
min-height: 24px;
display: flex;
justify-content: space-between;
align-items: center;
}
.app-list-item.isSelect {
background: #ecf5ff;
border-left: 5px solid #2d8cf0;
box-shadow: 0px 0px 3px 1px #82bff7;
}
.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 ListBase from './list-list-base.vue';
@Component({
components: {
}
})
export default class List extends ListBase {
}
</script>
\ No newline at end of file
......@@ -302,7 +302,7 @@
{
"appid":"Web",
"appname":"演示应用",
"appmenu":[{"menuid":"MainMenu", "menuname":"MainMenu", "menuitem":[{ "id":"menuitem1" , "name":"工作台" },{ "id":"menuitem3" , "name":"控件" , "items":[{ "id":"menuitem6" , "name":"默认数据类型" },{ "id":"menuitem7" , "name":"默认编辑器类型" },{ "id":"menuitem15" , "name":"基础表单项" },{ "id":"menuitem72" , "name":"编辑器扩展" }]},{ "id":"menuitem4" , "name":"部件" , "items":[{ "id":"menuitem12" , "name":"编辑表单" , "items":[{ "id":"menuitem47" , "name":"默认值" },{ "id":"menuitem48" , "name":"输入提示" },{ "id":"menuitem49" , "name":"辅助输入" },{ "id":"menuitem50" , "name":"自动填充" },{ "id":"menuitem51" , "name":"超链接" },{ "id":"menuitem52" , "name":"值重置" },{ "id":"menuitem55" , "name":"动态显示" },{ "id":"menuitem53" , "name":"动态启用" },{ "id":"menuitem54" , "name":"动态空输入" },{ "id":"menuitem56" , "name":"表单项更新" }]},{ "id":"menuitem16" , "name":"搜索表单" },{ "id":"menuitem13" , "name":"表格" , "items":[{ "id":"menuitem57" , "name":"禁用排序" },{ "id":"menuitem59" , "name":"行操作" },{ "id":"menuitem58" , "name":"行编辑" },{ "id":"menuitem73" , "name":"表格内置功能" },{ "id":"menuitem74" , "name":"表格行编辑" },{ "id":"menuitem75" , "name":"新建默认值" },{ "id":"menuitem76" , "name":"更新默认值" },{ "id":"menuitem77" , "name":"表格值规则" },{ "id":"menuitem78" , "name":"自动分组" },{ "id":"menuitem80" , "name":"代码表分组" },{ "id":"menuitem81" , "name":"当前页聚合" },{ "id":"menuitem82" , "name":"远程聚合" }]},{ "id":"menuitem83" , "name":"列表" , "items":[{ "id":"menuitem84" , "name":"列表内置功能" }]},{ "id":"menuitem14" , "name":"树视图" , "items":[{ "id":"menuitem60" , "name":"静态节点" },{ "id":"menuitem61" , "name":"动态节点(代码表)" },{ "id":"menuitem62" , "name":"动态节点(实体)" },{ "id":"menuitem63" , "name":"右键操作" },{ "id":"menuitem64" , "name":"动态参数过滤" }]},{ "id":"menuitem37" , "name":"图表" , "items":[{ "id":"menuitem38" , "name":"柱状图" },{ "id":"menuitem39" , "name":"折线图" },{ "id":"menuitem40" , "name":"饼图" },{ "id":"menuitem41" , "name":"区域图" },{ "id":"menuitem42" , "name":"雷达图" },{ "id":"menuitem43" , "name":"仪表盘" },{ "id":"menuitem44" , "name":"K线图" }]},{ "id":"menuitem17" , "name":"向导" },{ "id":"menuitem18" , "name":"界面行为" , "items":[{ "id":"menuitem65" , "name":"前端界面行为" },{ "id":"menuitem66" , "name":"后台界面行为" }]}]},{ "id":"menuitem5" , "name":"视图" , "items":[{ "id":"menuitem9" , "name":"列表视图" , "items":[{ "id":"menuitem19" , "name":"常规表格视图" },{ "id":"menuitem21" , "name":"左右表格视图" },{ "id":"menuitem20" , "name":"嵌入表格视图" }]},{ "id":"menuitem8" , "name":"编辑视图" , "items":[{ "id":"menuitem22" , "name":"常规编辑视图" },{ "id":"menuitem23" , "name":"左右编辑视图" },{ "id":"menuitem24" , "name":"分页编辑视图" },{ "id":"menuitem25" , "name":"嵌入编辑视图" }]},{ "id":"menuitem26" , "name":"选择视图" , "items":[{ "id":"menuitem27" , "name":"单选视图" },{ "id":"menuitem28" , "name":"多选视图" },{ "id":"menuitem29" , "name":"树形选择视图" },{ "id":"menuitem30" , "name":"左右单选视图" },{ "id":"menuitem31" , "name":"左右多选视图" }]},{ "id":"menuitem10" , "name":"导航视图" , "items":[{ "id":"menuitem32" , "name":"常规导航视图" },{ "id":"menuitem33" , "name":"分页导航视图" },{ "id":"menuitem34" , "name":"嵌入导航视图" }]},{ "id":"menuitem11" , "name":"其他视图" , "items":[{ "id":"menuitem35" , "name":"图表视图" },{ "id":"menuitem36" , "name":"报表视图" }]},{ "id":"menuitem79" , "name":"表格视图" }]},{ "id":"menuitem69" , "name":"工作流" },{ "id":"menuitem2" , "name":"更多" , "items":[{ "id":"menuitem46" , "name":"数据导出导入" },{ "id":"menuitem45" , "name":"数据打印" },{ "id":"menuitem67" , "name":"索引实体" },{ "id":"menuitem68" , "name":"继承实体" },{ "id":"menuitem70" , "name":"主状态" },{ "id":"menuitem71" , "name":"多表单" }]}] }]
"appmenu":[{"menuid":"MainMenu", "menuname":"MainMenu", "menuitem":[{ "id":"menuitem1" , "name":"工作台" },{ "id":"menuitem3" , "name":"控件" , "items":[{ "id":"menuitem6" , "name":"默认数据类型" },{ "id":"menuitem7" , "name":"默认编辑器类型" },{ "id":"menuitem15" , "name":"基础表单项" },{ "id":"menuitem72" , "name":"编辑器扩展" }]},{ "id":"menuitem4" , "name":"部件" , "items":[{ "id":"menuitem12" , "name":"编辑表单" , "items":[{ "id":"menuitem47" , "name":"默认值" },{ "id":"menuitem48" , "name":"输入提示" },{ "id":"menuitem49" , "name":"辅助输入" },{ "id":"menuitem50" , "name":"自动填充" },{ "id":"menuitem51" , "name":"超链接" },{ "id":"menuitem52" , "name":"值重置" },{ "id":"menuitem55" , "name":"动态显示" },{ "id":"menuitem53" , "name":"动态启用" },{ "id":"menuitem54" , "name":"动态空输入" },{ "id":"menuitem56" , "name":"表单项更新" }]},{ "id":"menuitem16" , "name":"搜索表单" },{ "id":"menuitem13" , "name":"表格" , "items":[{ "id":"menuitem57" , "name":"禁用排序" },{ "id":"menuitem59" , "name":"行操作" },{ "id":"menuitem58" , "name":"行编辑" },{ "id":"menuitem73" , "name":"表格内置功能" },{ "id":"menuitem74" , "name":"表格行编辑" },{ "id":"menuitem75" , "name":"新建默认值" },{ "id":"menuitem76" , "name":"更新默认值" },{ "id":"menuitem77" , "name":"表格值规则" },{ "id":"menuitem78" , "name":"自动分组" },{ "id":"menuitem80" , "name":"代码表分组" },{ "id":"menuitem81" , "name":"当前页聚合" },{ "id":"menuitem82" , "name":"远程聚合" }]},{ "id":"menuitem83" , "name":"列表" , "items":[{ "id":"menuitem84" , "name":"列表内置功能" },{ "id":"menuitem85" , "name":"列表自动分组" },{ "id":"menuitem86" , "name":"代码表分组" }]},{ "id":"menuitem14" , "name":"树视图" , "items":[{ "id":"menuitem60" , "name":"静态节点" },{ "id":"menuitem61" , "name":"动态节点(代码表)" },{ "id":"menuitem62" , "name":"动态节点(实体)" },{ "id":"menuitem63" , "name":"右键操作" },{ "id":"menuitem64" , "name":"动态参数过滤" }]},{ "id":"menuitem37" , "name":"图表" , "items":[{ "id":"menuitem38" , "name":"柱状图" },{ "id":"menuitem39" , "name":"折线图" },{ "id":"menuitem40" , "name":"饼图" },{ "id":"menuitem41" , "name":"区域图" },{ "id":"menuitem42" , "name":"雷达图" },{ "id":"menuitem43" , "name":"仪表盘" },{ "id":"menuitem44" , "name":"K线图" }]},{ "id":"menuitem17" , "name":"向导" },{ "id":"menuitem18" , "name":"界面行为" , "items":[{ "id":"menuitem65" , "name":"前端界面行为" },{ "id":"menuitem66" , "name":"后台界面行为" }]}]},{ "id":"menuitem5" , "name":"视图" , "items":[{ "id":"menuitem9" , "name":"列表视图" , "items":[{ "id":"menuitem19" , "name":"常规表格视图" },{ "id":"menuitem21" , "name":"左右表格视图" },{ "id":"menuitem20" , "name":"嵌入表格视图" }]},{ "id":"menuitem8" , "name":"编辑视图" , "items":[{ "id":"menuitem22" , "name":"常规编辑视图" },{ "id":"menuitem23" , "name":"左右编辑视图" },{ "id":"menuitem24" , "name":"分页编辑视图" },{ "id":"menuitem25" , "name":"嵌入编辑视图" }]},{ "id":"menuitem26" , "name":"选择视图" , "items":[{ "id":"menuitem27" , "name":"单选视图" },{ "id":"menuitem28" , "name":"多选视图" },{ "id":"menuitem29" , "name":"树形选择视图" },{ "id":"menuitem30" , "name":"左右单选视图" },{ "id":"menuitem31" , "name":"左右多选视图" }]},{ "id":"menuitem10" , "name":"导航视图" , "items":[{ "id":"menuitem32" , "name":"常规导航视图" },{ "id":"menuitem33" , "name":"分页导航视图" },{ "id":"menuitem34" , "name":"嵌入导航视图" }]},{ "id":"menuitem11" , "name":"其他视图" , "items":[{ "id":"menuitem35" , "name":"图表视图" },{ "id":"menuitem36" , "name":"报表视图" }]},{ "id":"menuitem79" , "name":"表格视图" }]},{ "id":"menuitem69" , "name":"工作流" },{ "id":"menuitem2" , "name":"更多" , "items":[{ "id":"menuitem46" , "name":"数据导出导入" },{ "id":"menuitem45" , "name":"数据打印" },{ "id":"menuitem67" , "name":"索引实体" },{ "id":"menuitem68" , "name":"继承实体" },{ "id":"menuitem70" , "name":"主状态" },{ "id":"menuitem71" , "name":"多表单" }]}] }]
}
]
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册