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

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

上级 56c71f08
......@@ -374,10 +374,8 @@ export default {
srfdeid: "",
srfsourcekey: "",
ibizbookid: "图书标识",
type: "图书类型",
lendouttime: "借出日期",
returntime: "归还日期",
borrower: "借阅人",
author: "图书作者",
formitem: "表格选择视图",
formitem1: "数据选择视图",
formitem2: "多选数据选择",
......@@ -1504,18 +1502,18 @@ export default {
},
haspanellistviewtoolbar_toolbar: {
},
booktypeselect_treeview: {
tree_treeview: {
nodata:"",
nodes: {
ibizbooktype: "图书类型",
root: "默认根节点",
},
uiactions: {
},
},
tree_treeview: {
booktypeselect_treeview: {
nodata:"",
nodes: {
ibizbooktype: "图书类型",
root: "默认根节点",
},
uiactions: {
},
......
......@@ -373,10 +373,8 @@ export default {
srfdeid: "",
srfsourcekey: "",
ibizbookid: "图书标识",
type: "图书类型",
lendouttime: "借出日期",
returntime: "归还日期",
borrower: "借阅人",
author: "图书作者",
formitem: "表格选择视图",
formitem1: "数据选择视图",
formitem2: "多选数据选择",
......@@ -1503,18 +1501,18 @@ export default {
},
haspanellistviewtoolbar_toolbar: {
},
booktypeselect_treeview: {
tree_treeview: {
nodata:"",
nodes: {
ibizbooktype: "图书类型",
root: "默认根节点",
},
uiactions: {
},
},
tree_treeview: {
booktypeselect_treeview: {
nodata:"",
nodes: {
ibizbooktype: "图书类型",
root: "默认根节点",
},
uiactions: {
},
......
<template>
<div class='view-container depickuptreeview ibizcustomer-pickup-tree-view'>
<app-studioaction :viewTitle="$t(model.srfCaption)" viewName="ibizcustomerpickuptreeview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' :dis-hover="true" :bordered="false">
<div class='content-container'>
<div class="search-contant">
<i-input search @on-change="($event) => { this.srfnodefilter = $event.target.value; }" @on-search="onSearch" placeholder="客户名称" class='pull-left'/>
</div>
<div class="tree-contant">
<view_tree
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:showBusyIndicator="true"
updateAction='Update'
removeAction='Remove'
loadAction='Get'
createAction='Create'
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
@nodedblclick="tree_nodedblclick($event)"
name="tree"
ref='tree'
@selectionchange="tree_selectionchange($event)"
@load="tree_load($event)"
@closeview="closeView($event)">
</view_tree>
</div>
</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 IBIZCustomerService from '@/service/ibizcustomer/ibizcustomer-service';
import IBIZCustomerAuthService from '@/authservice/ibizcustomer/ibizcustomer-auth-service';
import PickupTreeViewEngine from '@engine/view/pickup-tree-view-engine';
import IBIZCustomerUIService from '@/uiservice/ibizcustomer/ibizcustomer-ui-service';
@Component({
components: {
},
})
export default class IBIZCustomerPickupTreeViewBase extends Vue {
/**
* 实体服务对象
*
* @type {IBIZCustomerService}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public appEntityService: IBIZCustomerService = new IBIZCustomerService;
/**
* 实体UI服务对象
*
* @type IBIZCustomerUIService
* @memberof IBIZCustomerPickupTreeViewBase
*/
public appUIService: IBIZCustomerUIService = new IBIZCustomerUIService(this.$store);
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof IBIZCustomerPickupTreeViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof IBIZCustomerPickupTreeViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof IBIZCustomerPickupTreeViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof IBIZCustomerPickupTreeViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof IBIZCustomerPickupTreeViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public viewtag: string = '2a63c4595d7b116f63e0960a2365bbfa';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public model: any = {
srfCaption: 'entities.ibizcustomer.views.pickuptreeview.caption',
srfTitle: 'entities.ibizcustomer.views.pickuptreeview.title',
srfSubTitle: 'entities.ibizcustomer.views.pickuptreeview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBIZCustomerPickupTreeViewBase
*/
@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 IBIZCustomerPickupTreeViewBase
*/
@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 IBIZCustomerPickupTreeViewBase
*/
public containerModel: any = {
view_tree: { name: 'tree', type: 'TREEVIEW' },
};
/**
* 视图刷新
*
* @param {*} args
* @memberof IBIZCustomerPickupTreeViewBase
*/
public refresh(args?: any): void {
const refs: any = this.$refs;
if (refs && refs.tree) {
refs.tree.refresh();
}
}
/**
* 计数器刷新
*
* @memberof IBIZCustomerPickupTreeViewBase
*/
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 IBIZCustomerPickupTreeViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public engine: PickupTreeViewEngine = new PickupTreeViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof IBIZCustomerPickupTreeViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
tree: this.$refs.tree,
keyPSDEField: 'ibizcustomer',
majorPSDEField: 'ibizcustomername',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public navDataService = NavDataService.getInstance(this.$store);
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 门户部件状态对象
*
* @type {*}
* @memberof IBIZCustomerPickupTreeViewBase
*/
@Prop() public portletState?: any;
/**
* 门户部件状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public portletStateEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public viewCacheData:any;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 解析视图参数
*
* @public
* @memberof IBIZCustomerPickupTreeViewBase
*/
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,{'ibizcustomer':inputvalue});
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof IBIZCustomerPickupTreeViewBase
*/
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 IBIZCustomerPickupTreeViewBase
*/
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 IBIZCustomerPickupTreeViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'ibizcustomer-pickup-tree-view',tag:this.viewtag,srfkey:isNew ? null : this.context.ibizcustomer,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof IBIZCustomerPickupTreeViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'ibizcustomer-pickup-tree-view',tag:this.viewtag,srfkey:this.context.ibizcustomer,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof IBIZCustomerPickupTreeViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof IBIZCustomerPickupTreeViewBase
*/
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,'ibizcustomer-pickup-tree-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,'IBIZCustomerPickupTreeView')){
return;
}
if(Object.is(res.action,'refresh') && _this.refresh && _this.refresh instanceof Function){
_this.refresh();
}
})
}
}
/**
* 销毁之前
*
* @memberof IBIZCustomerPickupTreeViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IBIZCustomerPickupTreeViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof IBIZCustomerPickupTreeViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* tree 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZCustomerPickupTreeViewBase
*/
public tree_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('tree', 'selectionchange', $event);
}
/**
* tree 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZCustomerPickupTreeViewBase
*/
public tree_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('tree', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof IBIZCustomerPickupTreeViewBase
*/
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 IBIZCustomerPickupTreeViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBIZCustomerPickupTreeViewBase
*/
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 IBIZCustomerPickupTreeViewBase
*/
@Prop() public selectedData?: string;
/**
* 是否单选
*
* @type {boolean}
* @memberof IBIZCustomerPickupTreeViewBase
*/
@Prop() public isSingleSelect?: boolean;
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof IBIZCustomerPickupTreeViewBase
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 节点过滤值
*
* @type {string}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public srfnodefilter: string = '';
/**
* 快速搜索
*
* @returns {void}
* @memberof IBIZCustomerPickupTreeViewBase
*/
public onSearch(): void {
if (!this.viewState) {
return;
}
this.viewState.next({ tag: 'tree', action: 'filter', data: { srfnodefilter: this.srfnodefilter } });
}
/**
* tree 部件 nodedblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZCustomerPickupTreeViewBase
*/
public tree_nodedblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('tree', 'nodedblclick', $event);
}
}
</script>
<style lang='less'>
@import './ibizcustomer-pickup-tree-view.less';
</style>
\ No newline at end of file
.ibizcustomer-pickup-tree-view{
position: relative;
}
.search-contant {
height: 40px;
.ivu-input-wrapper {
max-width: 400px;
padding-top: 6px;
}
}
.tree-contant {
height: calc(100% - 40px);
margin: 0px 0px 16px 0;
overflow: auto;
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import IBIZCustomerPickupTreeViewBase from './ibizcustomer-pickup-tree-view-base.vue';
import view_tree from '@widgets/ibizcustomer/usr-treeview/usr-treeview.vue';
@Component({
components: {
view_tree,
},
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 IBIZCustomerPickupTreeView extends IBIZCustomerPickupTreeViewBase {
}
</script>
\ No newline at end of file
......@@ -131,10 +131,10 @@ export const PageComponents = {
Vue.component('ibizhardware-grid-view9', () => import('@pages/sample/ibizhardware-grid-view9/ibizhardware-grid-view9.vue'));
Vue.component('ibizorder-sf3-edit-view', () => import('@pages/sample/ibizorder-sf3-edit-view/ibizorder-sf3-edit-view.vue'));
Vue.component('ibizorder-f13-edit-view', () => import('@pages/sample/ibizorder-f13-edit-view/ibizorder-f13-edit-view.vue'));
Vue.component('ibizcustomer-pickup-tree-view', () => import('@pages/sample/ibizcustomer-pickup-tree-view/ibizcustomer-pickup-tree-view.vue'));
Vue.component('ibizorder-detail-f6-edit-view', () => import('@pages/sample/ibizorder-detail-f6-edit-view/ibizorder-detail-f6-edit-view.vue'));
Vue.component('ibizbookusr4-grid-view', () => import('@pages/sample/ibizbookusr4-grid-view/ibizbookusr4-grid-view.vue'));
Vue.component('ibizbookusr2-medit-view9', () => import('@pages/sample/ibizbookusr2-medit-view9/ibizbookusr2-medit-view9.vue'));
Vue.component('ibizbookpickup-tree-view', () => import('@pages/sample/ibizbookpickup-tree-view/ibizbookpickup-tree-view.vue'));
Vue.component('ibizorder-sedit-view3', () => import('@pages/sample/ibizorder-sedit-view3/ibizorder-sedit-view3.vue'));
Vue.component('ibizorder-odsp-d10-wfgrid-view', () => import('@pages/sample/ibizorder-odsp-d10-wfgrid-view/ibizorder-odsp-d10-wfgrid-view.vue'));
Vue.component('ibizbookinternal-func-grid-view', () => import('@pages/sample/ibizbookinternal-func-grid-view/ibizbookinternal-func-grid-view.vue'));
......
......@@ -2094,6 +2094,20 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizorder-f13-edit-view/ibizorder-f13-edit-view.vue'),
},
{
path: 'ibizcustomers/:ibizcustomer?/pickuptreeview/:pickuptreeview?',
meta: {
caption: 'entities.ibizcustomer.views.pickuptreeview.caption',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibizcustomers', parameterName: 'ibizcustomer' },
{ pathName: 'pickuptreeview', parameterName: 'pickuptreeview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizcustomer-pickup-tree-view/ibizcustomer-pickup-tree-view.vue'),
},
{
path: 'ibizorders/:ibizorder?/ibizorderdetails/:ibizorderdetail?/f6editview/:f6editview?',
meta: {
......@@ -2151,20 +2165,6 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizbookusr2-medit-view9/ibizbookusr2-medit-view9.vue'),
},
{
path: 'ibizbooks/:ibizbook?/pickuptreeview/:pickuptreeview?',
meta: {
caption: 'entities.ibizbook.views.pickuptreeview.caption',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'pickuptreeview', parameterName: 'pickuptreeview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizbookpickup-tree-view/ibizbookpickup-tree-view.vue'),
},
{
path: 'ibizorders/:ibizorder?/seditview3/:seditview3?',
meta: {
......@@ -3152,6 +3152,19 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizorder-f19-edit-view/ibizorder-f19-edit-view.vue'),
},
{
path: '/ibizcustomers/:ibizcustomer?/pickuptreeview/:pickuptreeview?',
meta: {
caption: 'entities.ibizcustomer.views.pickuptreeview.caption',
info:'',
parameters: [
{ pathName: 'ibizcustomers', parameterName: 'ibizcustomer' },
{ pathName: 'pickuptreeview', parameterName: 'pickuptreeview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizcustomer-pickup-tree-view/ibizcustomer-pickup-tree-view.vue'),
},
{
path: '/ibizsample0003s/:ibizsample0003?/pickupview/:pickupview?',
meta: {
......@@ -4498,19 +4511,6 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizbookedit-view/ibizbookedit-view.vue'),
},
{
path: '/ibizbooks/:ibizbook?/pickuptreeview/:pickuptreeview?',
meta: {
caption: 'entities.ibizbook.views.pickuptreeview.caption',
info:'',
parameters: [
{ pathName: 'ibizbooks', parameterName: 'ibizbook' },
{ pathName: 'pickuptreeview', parameterName: 'pickuptreeview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizbookpickup-tree-view/ibizbookpickup-tree-view.vue'),
},
{
path: '/ibizorders/:ibizorder?/ibizorderdetails/:ibizorderdetail?/sgridview9/:sgridview9?',
meta: {
......
......@@ -375,6 +375,15 @@ export const viewstate: any = {
'2640aa1ca02649c8831b43023d449945',
],
},
{
viewtag: '2a63c4595d7b116f63e0960a2365bbfa',
viewmodule: 'Sample',
viewname: 'IBIZCustomerPickupTreeView',
viewaction: '',
viewdatachange: false,
refviews: [
],
},
{
viewtag: '2acfa7c67cff5b1f6fc0d46f6a1c06bf',
viewmodule: 'Sample',
......@@ -525,7 +534,7 @@ export const viewstate: any = {
viewdatachange: false,
refviews: [
'f7ce60a7707de1ef9f926b3f9d5d6954',
'b3a27af7c6e3cea3b600057793da2bd1',
'2a63c4595d7b116f63e0960a2365bbfa',
'81e92e837f6fa81fed5b6beaa75f6bbd',
'460fc1d5b6f2e2012b281df34d929f3b',
],
......@@ -1351,15 +1360,6 @@ export const viewstate: any = {
refviews: [
],
},
{
viewtag: 'b3a27af7c6e3cea3b600057793da2bd1',
viewmodule: 'Sample',
viewname: 'IBIZBOOKPickupTreeView',
viewaction: '',
viewdatachange: false,
refviews: [
],
},
{
viewtag: 'b4db5cb272d2da535285852bc436e9de',
viewmodule: 'Sample',
......
......@@ -5,8 +5,22 @@
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group :uiService="appUIService" :data="transformData(data)" :manageContainerStatus="detailsModel.group1.manageContainerStatus" :isManageContainer="detailsModel.group1.isManageContainer" @managecontainerclick="manageContainerClick('group1')" layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibizbook.interfuncform_2_form.details.group1')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.type.visible" :style="{}" :sm="{ span: 12, offset: 0 }" :md="{ span: 12, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='type' :itemRules="this.rules().type" class='' :caption="$t('entities.ibizbook.interfuncform_2_form.details.type')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.type.error" :isEmptyCaption="false" labelPos="LEFT">
<i-col v-show="detailsModel.borrower.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='borrower' :itemRules="this.rules().borrower" class='' :caption="$t('entities.ibizbook.interfuncform_2_form.details.borrower')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.borrower.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.borrower"
@enter="onEnter($event)"
unit=""
:disabled="detailsModel.borrower.disabled"
type='text'
style="">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.author.visible" :style="{}" :lg="{ span: 24, offset: 0 }" :xl="{ span: 6, offset: 0 }">
<app-form-item name='author' :itemRules="this.rules().author" class='' :caption="$t('entities.ibizbook.interfuncform_2_form.details.author')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.author.error" :isEmptyCaption="false" labelPos="LEFT">
<app-picker
:formState="formState"
......@@ -15,12 +29,12 @@
:viewparams="viewparams"
:localContext ='{ }'
:localParam ='{ }'
:disabled="detailsModel.type.disabled"
name='type'
:disabled="detailsModel.author.disabled"
name='author'
valueitem=''
:value="data.type"
:value="data.author"
editortype="pickup-no-ac"
:pickupView="{ viewname: 'ibizbookpickup-tree-view', title: $t('entities.ibizbook.views.pickuptreeview.title'), deResParameters: [], parameters: [{ pathName: 'ibizbooks', parameterName: 'ibizbook' }, { pathName: 'pickuptreeview', parameterName: 'pickuptreeview' } ], width: 800, height: 800, placement:'' }"
:pickupView="{ viewname: 'ibizcustomer-pickup-tree-view', title: $t('entities.ibizcustomer.views.pickuptreeview.title'), deResParameters: [], parameters: [{ pathName: 'ibizcustomers', parameterName: 'ibizcustomer' }, { pathName: 'pickuptreeview', parameterName: 'pickuptreeview' } ], width: 800, height: 800, placement:'' }"
style=""
@formitemvaluechange="onFormItemValueChange">
</app-picker>
......@@ -28,35 +42,7 @@
</app-form-item>
</i-col>
<i-col v-show="detailsModel.lendouttime.visible" :style="{}" :sm="{ span: 12, offset: 0 }" :md="{ span: 12, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='lendouttime' :itemRules="this.rules().lendouttime" class='' :caption="$t('entities.ibizbook.interfuncform_2_form.details.lendouttime')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.lendouttime.error" :isEmptyCaption="false" labelPos="LEFT">
<date-picker type="date" :transfer="true" format="yyyy-MM-dd" :value="data.lendouttime" :disabled="detailsModel.lendouttime.disabled" style="min-width: 150px; width:100px;" @on-change="(val1, val2) => { this.data.lendouttime = val1 }"></date-picker>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.returntime.visible" :style="{}" :sm="{ span: 12, offset: 0 }" :md="{ span: 12, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='returntime' :itemRules="this.rules().returntime" class='' :caption="$t('entities.ibizbook.interfuncform_2_form.details.returntime')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.returntime.error" :isEmptyCaption="false" labelPos="LEFT">
<date-picker type="date" :transfer="true" format="yyyy-MM-dd" :value="data.returntime" :disabled="detailsModel.returntime.disabled" style="min-width: 150px; width:100px;" @on-change="(val1, val2) => { this.data.returntime = val1 }"></date-picker>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.borrower.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='borrower' :itemRules="this.rules().borrower" class='' :caption="$t('entities.ibizbook.interfuncform_2_form.details.borrower')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.borrower.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.borrower"
@enter="onEnter($event)"
unit=""
:disabled="detailsModel.borrower.disabled"
type='text'
style="">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.formitem.visible" :style="{}" :lg="{ span: 24, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<i-col v-show="detailsModel.formitem.visible" :style="{}" :lg="{ span: 24, offset: 0 }" :xl="{ span: 6, offset: 0 }">
<app-form-item name='formitem' :itemRules="this.rules().formitem" class='' :caption="$t('entities.ibizbook.interfuncform_2_form.details.formitem')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.formitem.error" :isEmptyCaption="false" labelPos="LEFT">
<app-picker
......@@ -79,7 +65,7 @@
</app-form-item>
</i-col>
<i-col v-show="detailsModel.formitem1.visible" :style="{}" :lg="{ span: 24, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<i-col v-show="detailsModel.formitem1.visible" :style="{}" :lg="{ span: 24, offset: 0 }" :xl="{ span: 6, offset: 0 }">
<app-form-item name='formitem1' :itemRules="this.rules().formitem1" class='' :caption="$t('entities.ibizbook.interfuncform_2_form.details.formitem1')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.formitem1.error" :isEmptyCaption="false" labelPos="LEFT">
<app-picker
......@@ -102,7 +88,7 @@
</app-form-item>
</i-col>
<i-col v-show="detailsModel.formitem2.visible" :style="{}" :lg="{ span: 24, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<i-col v-show="detailsModel.formitem2.visible" :style="{}" :lg="{ span: 24, offset: 0 }" :xl="{ span: 6, offset: 0 }">
<app-form-item name='formitem2' :itemRules="this.rules().formitem2" class='' :caption="$t('entities.ibizbook.interfuncform_2_form.details.formitem2')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.formitem2.error" :isEmptyCaption="false" labelPos="LEFT">
<app-mpicker
......@@ -526,10 +512,8 @@ export default class InterFuncForm_2Base extends Vue implements ControlInterface
srfdeid: null,
srfsourcekey: null,
ibizbookid: null,
type: null,
lendouttime: null,
returntime: null,
borrower: null,
author: null,
formitem: null,
formitem1: null,
formitem2: null,
......@@ -584,22 +568,14 @@ export default class InterFuncForm_2Base extends Vue implements ControlInterface
*/
public rules() :any {
return {
type: [
{ required: this.detailsModel.type.required, type: 'string', message: '图书类型 值不能为空', trigger: 'change' },
{ required: this.detailsModel.type.required, type: 'string', message: '图书类型 值不能为空', trigger: 'blur' },
],
lendouttime: [
{ required: this.detailsModel.lendouttime.required, type: 'string', message: '借出日期 值不能为空', trigger: 'change' },
{ required: this.detailsModel.lendouttime.required, type: 'string', message: '借出日期 值不能为空', trigger: 'blur' },
],
returntime: [
{ required: this.detailsModel.returntime.required, type: 'string', message: '归还日期 值不能为空', trigger: 'change' },
{ required: this.detailsModel.returntime.required, type: 'string', message: '归还日期 值不能为空', trigger: 'blur' },
],
borrower: [
{ required: this.detailsModel.borrower.required, type: 'string', message: '借阅人 值不能为空', trigger: 'change' },
{ required: this.detailsModel.borrower.required, type: 'string', message: '借阅人 值不能为空', trigger: 'blur' },
],
author: [
{ required: this.detailsModel.author.required, type: 'string', message: '图书作者 值不能为空', trigger: 'change' },
{ required: this.detailsModel.author.required, type: 'string', message: '图书作者 值不能为空', trigger: 'blur' },
],
formitem: [
{ required: this.detailsModel.formitem.required, type: 'string', message: '表格选择视图 值不能为空', trigger: 'change' },
{ required: this.detailsModel.formitem.required, type: 'string', message: '表格选择视图 值不能为空', trigger: 'blur' },
......@@ -738,14 +714,10 @@ export default class InterFuncForm_2Base extends Vue implements ControlInterface
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
ibizbookid: new FormItemModel({ caption: '图书标识', detailType: 'FORMITEM', name: 'ibizbookid', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
type: new FormItemModel({ caption: '图书类型', detailType: 'FORMITEM', name: 'type', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
lendouttime: new FormItemModel({ caption: '借出日期', detailType: 'FORMITEM', name: 'lendouttime', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:true, disabled: false, enableCond: 3 })
,
returntime: new FormItemModel({ caption: '归还日期', detailType: 'FORMITEM', name: 'returntime', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:true, disabled: false, enableCond: 3 })
,
borrower: new FormItemModel({ caption: '借阅人', detailType: 'FORMITEM', name: 'borrower', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
author: new FormItemModel({ caption: '图书作者', detailType: 'FORMITEM', name: 'author', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
formitem: new FormItemModel({ caption: '表格选择视图', detailType: 'FORMITEM', name: 'formitem', visible: true, isShowCaption: true, form: this, isControlledContent: false , required:false, disabled: false, enableCond: 3 })
,
......@@ -864,51 +836,27 @@ export default class InterFuncForm_2Base extends Vue implements ControlInterface
}
/**
* 监控表单属性 type 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncForm_2Base
*/
@Watch('data.type')
onTypeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'type', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 lendouttime 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncForm_2Base
*/
@Watch('data.lendouttime')
onLendouttimeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'lendouttime', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 returntime 值
* 监控表单属性 borrower 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncForm_2Base
*/
@Watch('data.returntime')
onReturntimeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'returntime', newVal: newVal, oldVal: oldVal });
@Watch('data.borrower')
onBorrowerChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'borrower', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 borrower 值
* 监控表单属性 author 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof InterFuncForm_2Base
*/
@Watch('data.borrower')
onBorrowerChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'borrower', newVal: newVal, oldVal: oldVal });
@Watch('data.author')
onAuthorChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'author', newVal: newVal, oldVal: oldVal });
}
/**
......@@ -1017,8 +965,6 @@ export default class InterFuncForm_2Base extends Vue implements ControlInterface
}
/**
......
......@@ -61,23 +61,13 @@ export default class InterFuncForm_2Model {
dataType: 'GUID',
},
{
name: 'type',
prop: 'type',
name: 'borrower',
prop: 'borrower',
dataType: 'TEXT',
},
{
name: 'lendouttime',
prop: 'lendouttime',
dataType: 'DATE',
},
{
name: 'returntime',
prop: 'returntime',
dataType: 'DATE',
},
{
name: 'borrower',
prop: 'borrower',
name: 'author',
prop: 'author',
dataType: 'TEXT',
},
{
......
<template>
<div class="design-tree-container">
<context-menu-container>
<el-tree
v-if="inited"
ref="tree"
class="design-tree"
node-key="id"
lazy
:show-checkbox="!isSingleSelect"
:check-on-click-node="!isSingleSelect"
:default-expanded-keys="expandedKeys"
:props="{
label: 'text',
isLeaf: 'leaf',
children: 'children'
}"
:load="load"
:highlight-current="true"
:expand-on-click-node="false"
@check="onCheck"
@current-change="selectionChange"
:filter-node-method="filterNode"
:empty-text="$t('entities.ibizcustomer.usr_treeview.nodata')"
>
<template slot-scope="{ node, data }">
<context-menu :ref='data.id' :isBlocked="true" :contextMenuStyle="{width: '100%'}" :data="node" :renderContent="renderContextMenu" @showContext="showContext(data,$event)">
<tooltip transfer style="width: 100%;" max-width="2000" placement="right">
<div class="tree-node" @dblclick="doDefaultAction(node)">
<span class="icon">
<i v-if=" data.iconcls && !Object.is(data.iconcls, '')" :class="data.iconcls"></i>
<img v-else-if="data.icon && !Object.is(data.icon, '')" :src="data.icon" />
<icon v-else-if="isOutputIconDefault" type="ios-paper-outline"></icon>&nbsp;
</span>
<span class="text">
<span v-if="data.html" v-html="data.html"></span>
<span v-else>{{ data.isUseLangRes ? $t(data.text) : data.text }}</span>
</span>
</div>
<template slot="content">
<span v-if="data.html" v-html="data.html"></span>
<span v-else>{{ data.isUseLangRes ? $t(data.text) : data.text }}</span>
</template>
</tooltip>
</context-menu>
</template>
</el-tree>
</context-menu-container>
</div>
</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 IBIZCustomerService from '@/service/ibizcustomer/ibizcustomer-service';
import UsrService from './usr-treeview-service';
import IBIZCustomerUIService from '@/uiservice/ibizcustomer/ibizcustomer-ui-service';
import { Environment } from '@/environments/environment';
import UIService from '@/uiservice/ui-service';
@Component({
components: {
}
})
export default class UsrBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof UsrBase
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof UsrBase
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof UsrBase
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof UsrBase
*/
@Prop() public viewparams!: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof UsrBase
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof UsrBase
*/
public getControlType(): string {
return 'TREEVIEW'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof UsrBase
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {UsrService}
* @memberof UsrBase
*/
public service: UsrService = new UsrService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBIZCustomerService}
* @memberof UsrBase
*/
public appEntityService: IBIZCustomerService = new IBIZCustomerService({ $store: this.$store });
/**
* 转化数据
*
* @param {any} args
* @memberof UsrBase
*/
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 UsrBase
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof UsrBase
*/
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 UsrBase
*/
public getDatas(): any[] {
return [this.currentselectedNode];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof UsrBase
*/
public getData(): any {
return this.currentselectedNode;
}
/**
* 是否单选
*
* @type {boolean}
* @memberof UsrBase
*/
@Prop({ default: true }) public isSingleSelect!: boolean;
/**
* 是否默认选中第一条数据
*
* @type {boolean}
* @memberof UsrBase
*/
@Prop({ default: false }) public isSelectFirstDefault!: boolean;
/**
* 枝干节点是否可用(具有数据能力,可抛出)
*
* @type {string}
* @memberof UsrBase
*/
@Prop({default:true}) public isBranchAvailable!: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof UsrBase
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 初始化完成
*
* @type {boolean}
* @memberof UsrBase
*/
public inited: boolean = false;
/**
* 已选中数据集合
*
* @type {*}
* @memberof UsrBase
*/
public selectedNodes: any = [];
/**
* 当前选中数据项
*
* @type {*}
* @memberof UsrBase
*/
public currentselectedNode: any = {};
/**
* 选中数据字符串
*
* @type {string}
* @memberof UsrBase
*/
@Prop() public selectedData!: string;
/**
* 选中值变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof UsrBase
*/
@Watch('selectedData')
public onValueChange(newVal: any, oldVal: any) {
this.echoselectedNodes = newVal ? this.isSingleSelect ? [JSON.parse(newVal)[0]] : JSON.parse(newVal) : [];
this.selectedNodes = [];
if(this.echoselectedNodes.length > 0){
let AllnodesObj = (this.$refs.treeexpbar_tree as any).store.nodesMap;
let AllnodesArray : any[] = [];
for (const key in AllnodesObj) {
if (AllnodesObj.hasOwnProperty(key)) {
AllnodesArray.push(AllnodesObj[key].data);
}
}
this.setDefaultSelection(AllnodesArray);
}
}
/**
* 回显选中数据集合
*
* @type {*}
* @memberof UsrBase
*/
public echoselectedNodes:any[] = this.selectedData ? ( this.isSingleSelect ? [JSON.parse(this.selectedData)[0]] : JSON.parse(this.selectedData)) : [];
/**
* 部件行为--update
*
* @type {string}
* @memberof UsrBase
*/
@Prop() public updateAction!: string;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof UsrBase
*/
@Prop() public fetchAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof UsrBase
*/
@Prop() public removeAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof UsrBase
*/
@Prop() public loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof UsrBase
*/
@Prop() public createAction!: string;
/**
* 过滤属性
*
* @type {string}
* @memberof UsrBase
*/
public srfnodefilter: string = '';
/**
* 默认输出图标
*
* @type {boolean}
* @memberof UsrBase
*/
public isOutputIconDefault: boolean = true;
/**
* 数据展开主键
*
* @type {string[]}
* @memberof UsrBase
*/
@Provide()
public expandedKeys: string[] = [];
/**
* 应用状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof UsrBase
*/
public appStateEvent: Subscription | undefined;
/**
* 树节点上下文菜单集合
*
* @type {string[]}
* @memberof UsrBase
*/
public actionModel: any = {
}
/**
* 备份树节点上下文菜单
*
* @type any
* @memberof MainTreeBase
*/
public copyActionModel:any;
/**
* 选中数据变更事件
*
* @public
* @param {*} data
* @param {*} data 当前节点对应传入对象
* @param {*} checkedState 树目前选中状态对象
* @memberof UsrBase
*/
public onCheck(data: any, checkedState: any) {
// 处理多选数据
if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.$emit('selectionchange', this.selectedNodes);
}
}
/**
* 选中数据变更事件
*
* @public
* @param {*} data 节点对应传入对象
* @param {*} node 节点对应node对象
* @memberof UsrBase
*/
public selectionChange(data: any, node: any) {
// 禁用项处理
if (data.disabled){
node.isCurrent = false;
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
this.selectedNodes = [this.currentselectedNode];
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
}
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof UsrBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof UsrBase
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('load', action)) {
this.inited = false;
this.$nextTick(() => {
this.inited = true;
});
}
if (Object.is('filter', action)) {
this.srfnodefilter = data.srfnodefilter;
this.refresh_all();
}
if (Object.is('refresh_parent', action)) {
this.refresh_parent();
}
if (Object.is('refresh_current', action)) {
this.refresh_current();
}
});
}
if(AppCenterService && AppCenterService.getMessageCenter()){
this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{
if(!Object.is(name,"IBIZCustomer")){
return;
}
if(Object.is(action,'appRefresh')){
this.refresh([data]);
}
})
}
}
/**
* 对树节点进行筛选操作
* @memberof OrderTree
*/
public filterNode(value:any, data:any) {
if (!value) return true;
return data.text.indexOf(value) !== -1;
}
/**
* vue 生命周期
*
* @memberof UsrBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof UsrBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
}
/**
* 刷新数据
*
* @memberof UsrBase
*/
public refresh_all(): void {
this.inited = false;
this.$nextTick(() => {
this.inited = true;
});
}
/**
* 刷新当前节点
*
* @memberof UsrBase
*/
public refresh_current(): void {
if (Object.keys(this.currentselectedNode).length === 0) {
return;
}
const tree: any = this.$refs.tree;
const node: any = tree.getNode(this.currentselectedNode.id);
if (!node || !node.parent) {
return;
}
let curNode:any = {};
curNode = Util.deepObjectMerge(curNode,node);
let tempContext:any = {};
if(curNode.data && curNode.data.srfappctx){
Object.assign(tempContext,curNode.data.srfappctx);
}else{
Object.assign(tempContext,this.context);
}
const id: string = node.key ? node.key : '#';
const param: any = { srfnodeid: id };
this.refresh_node(tempContext,param, false);
}
/**
* 刷新父节点
*
* @memberof UsrBase
*/
public refresh_parent(): void {
if (Object.keys(this.currentselectedNode).length === 0) {
return;
}
const tree: any = this.$refs.tree;
const node: any = tree.getNode(this.currentselectedNode.id);
if (!node || !node.parent) {
return;
}
let curNode:any = {};
const { parent: _parent } = node;
curNode = Util.deepObjectMerge(curNode,_parent);
let tempContext:any = {};
if(curNode.data && curNode.data.srfappctx){
Object.assign(tempContext,curNode.data.srfappctx);
}else{
Object.assign(tempContext,this.context);
}
const id: string = _parent.key ? _parent.key : '#';
const param: any = { srfnodeid: id };
this.refresh_node(tempContext,param, true);
}
/**
* 数据加载
*
* @param {*} node
* @memberof UsrBase
*/
public load(node: any = {}, resolve?: any) {
if (node.data && node.data.children) {
resolve(node.data.children);
return;
}
const params: any = {
srfnodeid: node.data && node.data.id ? node.data.id : "#",
srfnodefilter: this.srfnodefilter
};
let tempViewParams:any = JSON.parse(JSON.stringify(this.viewparams));
let curNode:any = {};
curNode = Util.deepObjectMerge(curNode,node);
let tempContext:any = this.computecurNodeContext(curNode);
if(curNode.data && curNode.data.srfparentdename){
Object.assign(tempContext,{srfparentdename:curNode.data.srfparentdename});
Object.assign(tempViewParams,{srfparentdename:curNode.data.srfparentdename});
}
if(curNode.data && curNode.data.srfparentkey){
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
}
Object.assign(params,{viewparams:tempViewParams});
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
resolve([..._items]);
let isRoot = Object.is(node.level,0);
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
}).catch((response: any) => {
resolve([]);
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
}
/**
* 计算当前节点的上下文
*
* @param {*} curNode 当前节点
* @memberof UsrBase
*/
public computecurNodeContext(curNode:any){
let tempContext:any = {};
if(curNode && curNode.data && curNode.data.srfappctx){
tempContext = JSON.parse(JSON.stringify(curNode.data.srfappctx));
}else{
tempContext = JSON.parse(JSON.stringify(this.context));
}
return tempContext;
}
/**
* 刷新功能
*
* @param {any} args
* @memberof UsrBase
*/
public refresh(args?: any): void {
this.refresh_all();
}
/**
* 刷新节点
*
* @public
* @param {*} [curContext] 当前节点上下文
* @param {*} [arg={}] 当前节点附加参数
* @param {boolean} parentnode 是否是刷新父节点
* @memberof UsrBase
*/
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(this.context)),arg);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return;
}
const _items = [...response.data];
this.formatExpanded(_items);
const tree: any = this.$refs.tree;
tree.updateKeyChildren(id, _items);
if (parentnode) {
this.currentselectedNode = {};
}
this.$forceUpdate();
this.setDefaultSelection(_items);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
}
/**
* 默认展开节点
*
* @public
* @param {any[]} items
* @returns {any[]}
* @memberof UsrBase
*/
public formatExpanded(items: any[]): any[] {
const data: any[] = [];
items.forEach((item) => {
if (item.expanded || (item.children && item.children.length > 0)) {
this.expandedKeys.push(item.id);
}
});
return data;
}
/**
* 设置默认选中,回显数项,选中所有子节点
*
* @param {any[]} items 当前节点所有子节点集合
* @param {boolean} isRoot 是否是加载根节点
* @param {boolean} isSelectedAll 是否选中所有子节点
* @memberof UsrBase
*/
public setDefaultSelection(items: any[], isRoot: boolean = false, isSelectedAll: boolean = false): void {
if(items.length == 0){
return;
}
let defaultData: any;
//在导航视图中,如已有选中数据,则右侧展开已选中数据的视图,如无选中数据则默认选中第一条
if(this.isSelectFirstDefault){
if(this.isSingleSelect){
let index: number = -1;
if(this.selectedNodes && this.selectedNodes.length > 0){
this.selectedNodes.forEach((select: any) => {
index = items.findIndex((item: any) => Object.is(select.srfkey,item.srfkey));
});
}
if(index === -1) {
if(isRoot){
index = 0;
}else{
return;
}
}
defaultData = items[index];
this.setTreeNodeHighLight(defaultData);
this.currentselectedNode = JSON.parse(JSON.stringify(defaultData));
if(this.isBranchAvailable || defaultData.leaf){
this.selectedNodes = [this.currentselectedNode];
this.$emit('selectionchange', this.selectedNodes);
}
}
}
// 已选数据的回显
if(this.echoselectedNodes && this.echoselectedNodes.length > 0){
let checkedNodes = items.filter((item:any)=>{
return this.echoselectedNodes.some((val:any)=> {
if(Object.is(item.srfkey,val.srfkey) && Object.is(item.srfmajortext,val.srfmajortext)){
val.used = true;
this.selectedNodes.push(val);
this.$emit('selectionchange', this.selectedNodes);
return true;
}
});
});
if(checkedNodes.length > 0){
this.echoselectedNodes = this.echoselectedNodes.filter((item:any)=> !item.used);
// 父节点选中时,不需要执行这段,会选中所有子节点
if(!isSelectedAll){
if(this.isSingleSelect){
this.setTreeNodeHighLight(checkedNodes[0]);
this.currentselectedNode = JSON.parse(JSON.stringify(checkedNodes[0]));
this.selectedNodes = [this.currentselectedNode];
}else{
this.selectedNodes = this.selectedNodes.concat(checkedNodes);
const tree: any = this.$refs.treeexpbar_tree;
tree.setCheckedNodes(this.selectedNodes);
}
}
}
}
// 父节点选中时,选中所有子节点
if(isSelectedAll){
let leafNodes = items.filter((item:any) => item.leaf);
this.selectedNodes = this.selectedNodes.concat(leafNodes);
this.$emit('selectionchange', this.selectedNodes);
}
}
/**
* 绘制右击菜单
*
* @param {*} node
* @returns
* @memberof UsrBase
*/
public renderContextMenu(node: any) {
let content;
if (node && node.data) {
const data: any = JSON.parse(JSON.stringify(node.data));
this.currentselectedNode = { ...data };
const tags: string[] = data.id.split(';');
let copyActionModel:any =Util.deepCopy(this.actionModel);
}
return content;
}
/**
* 显示上下文菜单
*
* @param data 节点数据
* @param event 事件源
* @memberof UsrBase
*/
public showContext(data:any,event:any){
let _this:any = this;
this.copyActionModel = {};
const tags: string[] = data.id.split(';');
Object.values(this.actionModel).forEach((item:any) =>{
if(Object.is(item.nodeOwner,tags[0])){
this.copyActionModel[item.name] = item;
}
})
if(Object.keys(this.copyActionModel).length === 0){
return;
}
this.computeNodeState(data,data.nodeType,data.appEntityName).then((result:any) => {
let flag:boolean = false;
if(Object.values(result).length>0){
flag =Object.values(result).some((item:any) =>{
return item.visabled === true;
})
}
if(flag){
(_this.$refs[data.id] as any).showContextMenu(event.clientX, event.clientY);
}
});
}
/**
* 计算节点右键权限
*
* @param {*} node 节点数据
* @param {*} nodeType 节点类型
* @param {*} appEntityName 应用实体名称
* @returns
* @memberof UsrBase
*/
public async computeNodeState(node:any,nodeType:string,appEntityName:string) {
if(Object.is(nodeType,"STATIC")){
return this.copyActionModel;
}
let service:any = await this.appEntityService.getService(appEntityName);
if(this.copyActionModel && Object.keys(this.copyActionModel).length > 0) {
if(service['Get'] && service['Get'] instanceof Function){
let tempContext:any = Util.deepCopy(this.context);
tempContext[appEntityName] = node.srfkey;
let targetData = await service.Get(tempContext,{}, false);
let uiservice:any = await new UIService().getService(appEntityName);
let result: any[] = ViewTool.calcActionItemAuthState(targetData.data,this.copyActionModel,uiservice);
return this.copyActionModel;
}else{
console.warn("获取数据异常");
return this.copyActionModel;
}
}
}
/**
* 设置选中高亮
*
* @param {*} data
* @memberof UsrBase
*/
public setTreeNodeHighLight(data: any): void {
const tree: any = this.$refs.tree;
tree.setCurrentKey(data.id);
}
/**
* 执行默认界面行为
*
* @param {*} node
* @memberof UsrBase
*/
public doDefaultAction(node: any) {
if (node && node.data) {
const data: any = node.data;
const tags: string[] = data.id.split(';');
}
this.$emit('nodedblclick', this.selectedNodes);
}
}
</script>
<style lang='less'>
@import './usr-treeview.less';
</style>
\ No newline at end of file
/**
* Usr 部件模型
*
* @export
* @class UsrModel
*/
export default class UsrModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof UsrModel
*/
public getDataItems(): any[] {
return [
{
name: 'createman',
},
{
name: 'sn',
},
{
name: 'updatedate',
},
{
name: 'createdate',
},
{
name: 'customeruid',
},
{
name: 'ibizcustomer',
prop: 'ibizcustomerid',
},
{
name: 'address',
},
{
name: 'ibizcustomername',
},
{
name: 'updateman',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import IBIZCustomerService from '@/service/ibizcustomer/ibizcustomer-service';
import UsrModel from './usr-treeview-model';
import CodeListService from "@/codelist/codelist-service";
import i18n from '@/locale';
/**
* Usr 部件服务对象
*
* @export
* @class UsrService
*/
export default class UsrService extends ControlService {
/**
* 客户服务对象
*
* @type {IBIZCustomerService}
* @memberof UsrService
*/
public appEntityService: IBIZCustomerService = new IBIZCustomerService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof UsrService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of UsrService.
*
* @param {*} [opts={}]
* @memberof UsrService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new UsrModel();
}
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof UsrService
*/
public codeListService:CodeListService = new CodeListService({ $store: this.getStore() });
/**
* 节点分隔符号
*
* @public
* @type {string}
* @memberof UsrService
*/
public TREENODE_SEPARATOR: string = ';';
/**
* 默认根节点节点分隔符号
*
* @public
* @type {string}
* @memberof UsrService
*/
public TREENODE_ROOT: string = 'ROOT';
/**
* 客户数据节点分隔符号
*
* @public
* @type {string}
* @memberof UsrService
*/
public TREENODE_PERSONDATA: string = 'persondata';
/**
* 客户名称节点分隔符号
*
* @public
* @type {string}
* @memberof UsrService
*/
public TREENODE_PERSONNAME: string = 'personname';
/**
* 获取节点数据
*
* @param {string} action
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof UsrService
*/
@Errorlog
public async getNodes(context:any = {},data: any = {}, isloading?: boolean): Promise<any> {
let { srfparentkey, srfcat, srfnodeid, srfnodefilter, query }: { srfparentkey: string, srfcat: string, srfnodeid: string, srfnodefilter: string, query:string } = data;
srfnodefilter = query ? query : srfnodefilter;
let list: any[] = [];
let filter: any = {};
if (!srfnodeid || Object.is(srfnodeid, '#')) {
srfnodeid = this.TREENODE_ROOT;
}
let strTreeNodeId: string = srfnodeid;
let strRealNodeId: string = '';
let bRootSelect: boolean = false;
let strNodeType: string | null = null;
let strRootSelectNode: string = '';
if (Object.is(strTreeNodeId, this.TREENODE_ROOT)) {
strNodeType = this.TREENODE_ROOT;
if (srfparentkey) {
strRealNodeId = srfparentkey;
}
} else {
let nPos = strTreeNodeId.indexOf(this.TREENODE_SEPARATOR);
if (nPos === -1) {
return Promise.reject({ status: 500, data: { title: '失败', message: `树节点${strTreeNodeId}标识无效` } });
}
strNodeType = strTreeNodeId.substring(0, nPos);
strRealNodeId = strTreeNodeId.substring(nPos + 1);
}
Object.assign(filter,
{
srfparentkey: srfparentkey,
srfcat: srfcat,
srfnodefilter: srfnodefilter,
strRealNodeId: strRealNodeId,
srfnodeid: srfnodeid,
strNodeType: strNodeType,
viewparams: JSON.parse(JSON.stringify(data)).viewparams
}
);
// 分解节点标识
let nodeid: string[] = strRealNodeId.split(this.TREENODE_SEPARATOR);
for (let i = 0; i < nodeid.length; i++) {
switch (i) {
case 0:
Object.assign(filter, { nodeid: nodeid[0] });
break;
case 1:
Object.assign(filter, { nodeid2: nodeid[1] });
break;
case 2:
Object.assign(filter, { nodeid3: nodeid[2] });
break;
case 3:
Object.assign(filter, { nodeid4: nodeid[3] });
break;
default:
break;
}
}
if (Object.is(strNodeType, this.TREENODE_ROOT)) {
await this.fillRootNodeChilds(context,filter, list);
return Promise.resolve({ status: 200, data: list });
}
if (Object.is(strNodeType, this.TREENODE_PERSONDATA)) {
await this.fillPersondataNodeChilds(context,filter, list);
return Promise.resolve({ status: 200, data: list });
}
if (Object.is(strNodeType, this.TREENODE_PERSONNAME)) {
await this.fillPersonnameNodeChilds(context,filter, list);
return Promise.resolve({ status: 200, data: list });
}
return Promise.resolve({ status: 500, data: { title: '失败', message: `树节点${strTreeNodeId}标识无效` } });
}
/**
* 填充 树视图节点[默认根节点]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof UsrService
*/
@Errorlog
public fillRootNodes(context:any={},filter: any, list: any[],rsNavContext?:any,rsNavParams?:any,rsParams?:any): Promise<any> {
context = this.handleResNavContext(context,filter,rsNavContext);
filter = this.handleResNavParams(context,filter,rsNavParams,rsParams);
return new Promise((resolve:any,reject:any) =>{
let treeNode: any = {};
Object.assign(treeNode, { text: i18n.t('entities.ibizcustomer.usr_treeview.nodes.root') });
Object.assign(treeNode, { isUseLangRes: true });
Object.assign(treeNode,{srfappctx:context});
Object.assign(treeNode, { srfmajortext: treeNode.text });
let strNodeId: string = 'ROOT';
Object.assign(treeNode, { srfkey: 'root' });
strNodeId += this.TREENODE_SEPARATOR;
strNodeId += 'root';
Object.assign(treeNode, { id: strNodeId });
Object.assign(treeNode, { expanded: filter.isAutoexpand });
Object.assign(treeNode, { leaf: false });
Object.assign(treeNode, { nodeid: treeNode.srfkey });
Object.assign(treeNode, { nodeid2: filter.strRealNodeId });
Object.assign(treeNode, { nodeType: "STATIC" });
list.push(treeNode);
resolve(list);
});
}
/**
* 填充 树视图节点[默认根节点]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof UsrService
*/
@Errorlog
public async fillRootNodeChilds(context:any={}, filter: any, list: any[]): Promise<any> {
if (filter.srfnodefilter && !Object.is(filter.srfnodefilter,"")) {
// 填充客户名称
let PersonnameRsNavContext:any = {};
let PersonnameRsNavParams:any = {};
let PersonnameRsParams:any = {};
await this.fillPersonnameNodes(context, filter, list ,PersonnameRsNavContext,PersonnameRsNavParams,PersonnameRsParams);
} else {
// 填充客户名称
let PersonnameRsNavContext:any = {};
let PersonnameRsNavParams:any = {};
let PersonnameRsParams:any = {};
await this.fillPersonnameNodes(context, filter, list ,PersonnameRsNavContext,PersonnameRsNavParams,PersonnameRsParams);
}
}
/**
* 填充 树视图节点[客户数据]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof UsrService
*/
@Errorlog
public fillPersondataNodes(context:any={},filter: any, list: any[],rsNavContext?:any,rsNavParams?:any,rsParams?:any): Promise<any> {
context = this.handleResNavContext(context,filter,rsNavContext);
filter = this.handleResNavParams(context,filter,rsNavParams,rsParams);
return new Promise((resolve:any,reject:any) =>{
let searchFilter: any = {};
Object.assign(searchFilter, { total: false });
let bFirst: boolean = true;
let records: any[] = [];
try {
this.searchPersondata(context, searchFilter, filter).then((records:any) =>{
if(records && records.length >0){
records.forEach((entity: any) => {
let treeNode: any = {};
// 整理context
let strId: string = entity.ibizcustomerid;
let strText: string = entity.ibizcustomername;
Object.assign(treeNode,{srfparentdename:'IBIZCustomer',srfparentkey:entity.ibizcustomerid});
let tempContext:any = JSON.parse(JSON.stringify(context));
Object.assign(tempContext,{srfparentdename:'IBIZCustomer',srfparentkey:entity.ibizcustomerid,ibizcustomer:strId})
Object.assign(treeNode,{srfappctx:tempContext});
Object.assign(treeNode,{'ibizcustomer':strId});
Object.assign(treeNode, { srfkey: strId });
Object.assign(treeNode, { text: strText, srfmajortext: strText });
let strNodeId: string = 'persondata';
strNodeId += this.TREENODE_SEPARATOR;
strNodeId += strId;
Object.assign(treeNode, { id: strNodeId });
Object.assign(treeNode, { expanded: filter.isautoexpand });
Object.assign(treeNode, { leaf: true });
Object.assign(treeNode, { curData: entity });
Object.assign(treeNode, { nodeid: treeNode.srfkey });
Object.assign(treeNode, { nodeid2: filter.strRealNodeId });
Object.assign(treeNode, { nodeType: "DE",appEntityName:"ibizcustomer" });
list.push(treeNode);
resolve(list);
bFirst = false;
});
}else{
resolve(list);
}
});
} catch (error) {
console.error(error);
}
});
}
/**
* 获取查询集合
*
* @public
* @param {any{}} context
* @param {*} searchFilter
* @param {*} filter
* @returns {any[]}
* @memberof TestEnetityDatasService
*/
@Errorlog
public searchPersondata(context:any={}, searchFilter: any, filter: any): Promise<any> {
return new Promise((resolve:any,reject:any) =>{
if(filter.viewparams){
Object.assign(searchFilter,filter.viewparams);
}
if(!searchFilter.page){
Object.assign(searchFilter,{page:0});
}
if(!searchFilter.size){
Object.assign(searchFilter,{size:1000});
}
if(context && context.srfparentdename){
Object.assign(searchFilter,{srfparentdename:JSON.parse(JSON.stringify(context)).srfparentdename});
}
if(context && context.srfparentkey){
Object.assign(searchFilter,{srfparentkey:JSON.parse(JSON.stringify(context)).srfparentkey});
}
const _appEntityService: any = this.appEntityService;
let list: any[] = [];
if (_appEntityService['FetchDefault'] && _appEntityService['FetchDefault'] instanceof Function) {
const response: Promise<any> = _appEntityService['FetchDefault'](context, searchFilter, false);
response.then((response: any) => {
if (!response.status || response.status !== 200) {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询FetchDefault数据集异常!');
}
const data: any = response.data;
if (Object.keys(data).length > 0) {
list = JSON.parse(JSON.stringify(data));
resolve(list);
} else {
resolve([]);
}
}).catch((response: any) => {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询FetchDefault数据集异常!');
});
}
})
}
/**
* 填充 树视图节点[客户数据]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof UsrService
*/
@Errorlog
public async fillPersondataNodeChilds(context:any={}, filter: any, list: any[]): Promise<any> {
if (filter.srfnodefilter && !Object.is(filter.srfnodefilter,"")) {
} else {
}
}
/**
* 填充 树视图节点[客户名称]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof UsrService
*/
@Errorlog
public fillPersonnameNodes(context:any={},filter: any, list: any[],rsNavContext?:any,rsNavParams?:any,rsParams?:any): Promise<any> {
context = this.handleResNavContext(context,filter,rsNavContext);
filter = this.handleResNavParams(context,filter,rsNavParams,rsParams);
return new Promise((resolve:any,reject:any) =>{
let treeNode: any = {};
Object.assign(treeNode, { text: i18n.t('entities.ibizcustomer.usr_treeview.nodes.personname') });
Object.assign(treeNode, { isUseLangRes: true });
Object.assign(treeNode,{srfappctx:context});
Object.assign(treeNode, { srfmajortext: treeNode.text });
let strNodeId: string = 'personname';
// 没有指定节点值,直接使用父节点值
Object.assign(treeNode, { srfkey: filter.strRealNodeId });
strNodeId += this.TREENODE_SEPARATOR;
strNodeId += filter.strRealNodeId;
Object.assign(treeNode, { id: strNodeId });
Object.assign(treeNode, { expanded: filter.isAutoexpand });
Object.assign(treeNode, { leaf: false });
Object.assign(treeNode, { nodeid: treeNode.srfkey });
Object.assign(treeNode, { nodeid2: filter.strRealNodeId });
Object.assign(treeNode, { nodeType: "STATIC" });
list.push(treeNode);
resolve(list);
});
}
/**
* 填充 树视图节点[客户名称]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof UsrService
*/
@Errorlog
public async fillPersonnameNodeChilds(context:any={}, filter: any, list: any[]): Promise<any> {
if (filter.srfnodefilter && !Object.is(filter.srfnodefilter,"")) {
// 填充客户数据
let PersondataRsNavContext:any = {};
let PersondataRsNavParams:any = {};
let PersondataRsParams:any = {};
await this.fillPersondataNodes(context, filter, list ,PersondataRsNavContext,PersondataRsNavParams,PersondataRsParams);
} else {
// 填充客户数据
let PersondataRsNavContext:any = {};
let PersondataRsNavParams:any = {};
let PersondataRsParams:any = {};
await this.fillPersondataNodes(context, filter, list ,PersondataRsNavContext,PersondataRsNavParams,PersondataRsParams);
}
}
/**
* 处理代码表返回数据(树状结构)
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof UsrService
*/
public handleDataSet(result:Array<any>,context:any,callBack:any){
let list:Array<any> = [];
if(result.length === 0){
return list;
}
result.forEach((codeItem:any) =>{
if(!codeItem.pvalue){
let valueField:string = codeItem.value;
this.setChildCodeItems(valueField,result,codeItem);
list.push(codeItem);
}
})
this.setNodeData(list,context,callBack);
return list;
}
/**
* 处理非根节点数据
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof UsrService
*/
public setChildCodeItems(pValue:string,result:Array<any>,codeItem:any){
result.forEach((item:any) =>{
if(item.pvalue == pValue){
let valueField:string = item.value;
this.setChildCodeItems(valueField,result,item);
if(!codeItem.children){
codeItem.children = [];
}
codeItem.children.push(item);
}
})
}
/**
* 设置节点UI数据
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof UsrService
*/
public setNodeData(result:Array<any>,context:any,callBack:any){
result.forEach((item:any) =>{
if(item.children){
item.leaf = false;
this.setNodeData(item.children,context,callBack);
}else{
item.leaf = true;
}
callBack(context,item);
})
}
/**
* 处理节点关系导航上下文
*
* @param context 应用上下文
* @param filter 参数
* @param resNavContext 节点关系导航上下文
*
* @memberof UsrService
*/
public handleResNavContext(context:any,filter:any,resNavContext:any){
if(resNavContext && Object.keys(resNavContext).length > 0){
let tempContextData:any = JSON.parse(JSON.stringify(context));
let tempViewParams:any = {};
if(filter && filter.viewparams){
tempViewParams = filter.viewparams;
}
Object.keys(resNavContext).forEach((item:any) =>{
let curDataObj:any = resNavContext[item];
this.handleCustomDataLogic(context,tempViewParams,curDataObj,tempContextData,item);
})
return tempContextData;
}else{
return context;
}
}
/**
* 处理关系导航参数
*
* @param context 应用上下文
* @param filter 参数
* @param resNavParams 节点关系导航参数
* @param resParams 节点关系参数
*
* @memberof UsrService
*/
public handleResNavParams(context:any,filter:any,resNavParams:any,resParams:any){
if((resNavParams && Object.keys(resNavParams).length >0) || (resParams && Object.keys(resParams).length >0)){
let tempViewParamData:any = {};
let tempViewParams:any = {};
if(filter && filter.viewparams){
tempViewParams = filter.viewparams;
tempViewParamData = JSON.parse(JSON.stringify(filter.viewparams));
}
if( Object.keys(resNavParams).length > 0){
Object.keys(resNavParams).forEach((item:any) =>{
let curDataObj:any = resNavParams[item];
this.handleCustomDataLogic(context,tempViewParams,curDataObj,tempViewParamData,item);
})
}
if( Object.keys(resParams).length > 0){
Object.keys(resParams).forEach((item:any) =>{
let curDataObj:any = resParams[item];
tempViewParamData[item.toLowerCase()] = curDataObj.value;
})
}
Object.assign(filter,{viewparams:tempViewParamData});
return filter;
}else{
return filter;
}
}
/**
* 处理自定义节点关系导航数据
*
* @param context 应用上下文
* @param viewparams 参数
* @param curNavData 节点关系导航参数对象
* @param tempData 返回数据
* @param item 节点关系导航参数键值
*
* @memberof UsrService
*/
public handleCustomDataLogic(context:any,viewparams:any,curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(context[(curNavData.value).toLowerCase()] != null){
Object.defineProperty(tempData, item.toLowerCase(), {
value: context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(viewparams[(curNavData.value).toLowerCase()] != null){
Object.defineProperty(tempData, item.toLowerCase(), {
value: viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
}
\ No newline at end of file
.tree-right-menu {
.ivu-divider-horizontal {
width: 100%;
min-width: 100%;
margin: 0 auto;
}
.ivu-dropdown-item {
position: relative;
padding-left: 32px;
> i {
position: absolute;
left: 16px;
top: 10px;
}
.ivu-icon-ios-arrow-forward {
left: initial;
right: 4px;
}
}
.ivu-dropdown {
.ivu-select-dropdown {
margin: 0;
}
}
}
.el-tree .context-menu-component .tree-node{
width: calc(100% - 15px);
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
.icon{
padding-right: 10px;
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import UsrBase from './usr-treeview-base.vue';
@Component({
components: {
}
})
export default class Usr extends UsrBase {
}
</script>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册