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

ibizdev提交

上级 a609a30b
......@@ -1104,6 +1104,30 @@ const router = new Router({
},
component: () => import('@pages/uaa/sys-rolegrid-view/sys-rolegrid-view.vue'),
},
{
path: '/wfgroups/:wfgroup?/pickupgridview/:pickupgridview?',
meta: {
caption: 'entities.wfgroup.views.pickupgridview.caption',
parameters: [
{ pathName: 'wfgroups', parameterName: 'wfgroup' },
{ pathName: 'pickupgridview', parameterName: 'pickupgridview' },
],
requireAuth: true,
},
component: () => import('@pages/workflow/wfgroup-pickup-grid-view/wfgroup-pickup-grid-view.vue'),
},
{
path: '/sys_users/:sys_user?/mpickupview/:mpickupview?',
meta: {
caption: 'entities.sys_user.views.mpickupview.caption',
parameters: [
{ pathName: 'sys_users', parameterName: 'sys_user' },
{ pathName: 'mpickupview', parameterName: 'mpickupview' },
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-usermpickup-view/sys-usermpickup-view.vue'),
},
{
path: '/ibzdicts/:ibzdict?/editview/:editview?',
meta: {
......@@ -1453,6 +1477,42 @@ const router = new Router({
},
component: () => import('@pages/dict/ibzdict-item-grid-view/ibzdict-item-grid-view.vue'),
},
{
path: '/wfusers/:wfuser?/mpickupview/:mpickupview?',
meta: {
caption: 'entities.wfuser.views.mpickupview.caption',
parameters: [
{ pathName: 'wfusers', parameterName: 'wfuser' },
{ pathName: 'mpickupview', parameterName: 'mpickupview' },
],
requireAuth: true,
},
component: () => import('@pages/workflow/wfuser-mpickup-view/wfuser-mpickup-view.vue'),
},
{
path: '/sys_permissions/:sys_permission?/mpickupview/:mpickupview?',
meta: {
caption: 'entities.sys_permission.views.mpickupview.caption',
parameters: [
{ pathName: 'sys_permissions', parameterName: 'sys_permission' },
{ pathName: 'mpickupview', parameterName: 'mpickupview' },
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-permissionmpickup-view/sys-permissionmpickup-view.vue'),
},
{
path: '/wfgroups/:wfgroup?/mpickupview/:mpickupview?',
meta: {
caption: 'entities.wfgroup.views.mpickupview.caption',
parameters: [
{ pathName: 'wfgroups', parameterName: 'wfgroup' },
{ pathName: 'mpickupview', parameterName: 'mpickupview' },
],
requireAuth: true,
},
component: () => import('@pages/workflow/wfgroup-mpickup-view/wfgroup-mpickup-view.vue'),
},
{
path: '/ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/editview/:editview?',
meta: {
......@@ -1579,6 +1639,18 @@ const router = new Router({
},
component: () => import('@pages/ou/ibzemployee-option-view/ibzemployee-option-view.vue'),
},
{
path: '/sys_roles/:sys_role?/mpickupview/:mpickupview?',
meta: {
caption: 'entities.sys_role.views.mpickupview.caption',
parameters: [
{ pathName: 'sys_roles', parameterName: 'sys_role' },
{ pathName: 'mpickupview', parameterName: 'mpickupview' },
],
requireAuth: true,
},
component: () => import('@pages/uaa/sys-rolempickup-view/sys-rolempickup-view.vue'),
},
{
path: '/sys_roles/:sys_role?/sys_role_permissions/:sys_role_permission?/editview/:editview?',
meta: {
......
<template>
<div class="view-container dempickupview sys-permissionmpickup-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sys_permissionmpickupview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' :dis-hover="true" :padding="0" :bordered="false">
<div class="content-container pickup-view">
<div class="translate-contant">
<div class="center" :style="{width : !isShowButton ? '100%' : ''}">
<view_pickupviewpanel
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
name="pickupviewpanel"
ref='pickupviewpanel'
@selectionchange="pickupviewpanel_selectionchange($event)"
@activated="pickupviewpanel_activated($event)"
@load="pickupviewpanel_load($event)"
@closeview="closeView($event)">
</view_pickupviewpanel>
</div>
<div v-if="isShowButton" class="translate-buttons">
<div class="buttons">
<i-button type="primary" :title="this.containerModel.view_rightbtn.text"
:disabled="this.containerModel.view_rightbtn.disabled"
@click="onCLickRight">
<i class="el-icon-arrow-right"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_leftbtn.text"
:disabled="this.containerModel.view_leftbtn.disabled"
@click="onCLickLeft">
<i class="el-icon-arrow-left"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_allrightbtn.text"
@click="onCLickAllRight">
<i class="el-icon-d-arrow-right"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_allleftbtn.text"
@click="onCLickAllLeft">
<i class="el-icon-d-arrow-left"></i>
</i-button>
</div>
</div>
<div v-if="isShowButton" class="right">
<div class="mpicker-select">
<div v-for="(item, index) in viewSelections" :key="index" :class="item._select ? 'select' : ''" @click="selectionsClick(item)" @dblclick="selectionsDBLClick(item)">
<span>{{item.srfmajortext}}</span>
</div>
</div>
</div>
</div>
<card v-if="isShowButton" :dis-hover="true" :bordered="false" class="footer">
<row :style="{ textAlign: 'right' }">
<i-button type="primary" :disabled="this.viewSelections.length > 0 ? false : true" @click="onClickOk">{{this.containerModel.view_okbtn.text}}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{this.containerModel.view_cancelbtn.text}}</i-button>
</row>
</card>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import SYS_PERMISSIONService from '@/service/sys-permission/sys-permission-service';
import MPickupViewEngine from '@engine/view/mpickup-view-engine';
@Component({
components: {
},
})
export default class SYS_PERMISSIONMPickupViewBase extends Vue {
/**
* 实体服务对象
*
* @type {SYS_PERMISSIONService}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public appEntityService: SYS_PERMISSIONService = new SYS_PERMISSIONService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public viewtag: string = '86bd4f6d4f771870e10b9717046a1b14';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public model: any = {
srfCaption: 'entities.sys_permission.views.mpickupview.caption',
srfTitle: 'entities.sys_permission.views.mpickupview.title',
srfSubTitle: 'entities.sys_permission.views.mpickupview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SYS_PERMISSIONMPickupViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
if(this.viewparams.selectedData){
this.selectedData = JSON.stringify(this.viewparams.selectedData);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SYS_PERMISSIONMPickupViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
_this.parseViewParam();
_this.engine.load();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public containerModel: any = {
view_pickupviewpanel: { name: 'pickupviewpanel', type: 'PICKUPVIEWPANEL' },
view_okbtn: { name: 'okbtn', type: 'button', text: '确定', disabled: true },
view_cancelbtn: { name: 'cancelbtn', type: 'button', text: '取消', disabled: false },
view_leftbtn: { name: 'leftbtn', type: 'button', text: '左移', disabled: true },
view_rightbtn: { name: 'rightbtn', type: 'button', text: '右移', disabled: true },
view_allleftbtn: { name: 'allleftbtn', type: 'button', text: '全部左移', disabled: true },
view_allrightbtn: { name: 'allrightbtn', type: 'button', text: '全部右移', disabled: true },
};
/**
* 计数器刷新
*
* @memberof SYS_PERMISSIONMPickupViewBase
*/
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 SYS_PERMISSIONMPickupViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public engine: MPickupViewEngine = new MPickupViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
pickupviewpanel: this.$refs.pickupviewpanel,
keyPSDEField: 'sys_permission',
majorPSDEField: 'permissionname',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
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(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof SYS_PERMISSIONMPickupViewBase
*/
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 SYS_PERMISSIONMPickupViewBase
*/
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()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
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
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
if(this.viewparams.selectedData){
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', this.viewparams.selectedData);
this.onCLickRight();
}
}
/**
* pickupviewpanel 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public pickupviewpanel_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', $event);
}
/**
* pickupviewpanel 部件 activated 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public pickupviewpanel_activated($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'activated', $event);
}
/**
* pickupviewpanel 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SYS_PERMISSIONMPickupViewBase
*/
public pickupviewpanel_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SYS_PERMISSIONMPickupViewBase
*/
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 SYS_PERMISSIONMPickupViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SYS_PERMISSIONMPickupViewBase
*/
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);
}
})
}
}
}
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof SYS_PERMISSIONMPickupView
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 选中数据的字符串
*
* @type {string}
* @memberof SYS_PERMISSIONMPickupView
*/
public selectedData: string = "";
/**
* 是否初始化已选中项
*
* @type {any[]}
* @memberof SYS_PERMISSIONMPickupView
*/
public isInitSelected:boolean = false;
/**
* 视图选中数据
*
* @type {any[]}
* @memberof SYS_PERMISSIONMPickupView
*/
public viewSelections:any[] = [];
/**
* 是否单选
*
* @type {boolean}
* @memberof SYS_PERMISSIONMPickupView
*/
public isSingleSelect: boolean = false;
/**
* 选中数据单击
*
* @param {*} item
* @memberof SYS_PERMISSIONMPickupView
*/
public selectionsClick(item:any):void {
item._select = !item._select;
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
}
/**
* 选中树双击
*
* @param {*} item
* @memberof SYS_PERMISSIONMPickupView
*/
public selectionsDBLClick(item:any):void {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(selection.srfkey, item.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 删除右侧全部选中数据
*
* @memberof SYS_PERMISSIONMPickupView
*/
public onCLickLeft():void {
const _selectiions = [...JSON.parse(JSON.stringify(this.viewSelections))];
_selectiions.forEach((item: any) => {
if (!item._select) {
return;
}
const index = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
});
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧选中数据
*
* @memberof SYS_PERMISSIONMPickupView
*/
public onCLickRight():void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
let newSelections:any[] = [];
model.selections.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
newSelections.push(_item);
}else{
newSelections.push(this.viewSelections[index]);
}
});
this.viewSelections = newSelections;
});
}
/**
* 选中数据全部删除
*
* @memberof SYS_PERMISSIONMPickupView
*/
public onCLickAllLeft():void {
this.viewSelections = [];
this.containerModel.view_leftbtn.disabled = true;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧面板所有数据到右侧
*
* @memberof SYS_PERMISSIONMPickupView
*/
public onCLickAllRight():void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
if(model.datas.length>0){
model.datas.forEach((data:any,index:any)=>{
Object.assign(data,{srfmajortext: data['permissionname']});
})
}
model.datas.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
this.viewSelections.push(_item);
}
});
});
}
/**
* 确定
*
* @memberof SYS_PERMISSIONMPickupView
*/
public onClickOk(): void {
this.$emit('viewdataschange', this.viewSelections);
this.$emit('close', null);
}
/**
* 取消
*
* @memberof SYS_PERMISSIONMPickupView
*/
public onClickCancel(): void {
this.$emit('close', null);
}
}
</script>
<style lang='less'>
@import './sys-permissionmpickup-view.less';
</style>
\ No newline at end of file
.sys-permissionmpickup-view{
position: relative;
}
.pickup-view {
>.translate-contant {
flex-grow: 1;
display: flex;
justify-content: flex-end;
height: calc(100% - 64px);
.translate-buttons {
width: 80px;
display: flex;
align-items: center;
text-align: center;
button {
margin-bottom: 5px;
}
}
.left, .right {
width: 300px;
}
.right {
border: 1px solid #e9e9e9;
.mpicker-select {
font-family: helvetica, sans-serif;
font-size: 16px;
text-align: justify;
word-spacing: -3.8pt;
line-height: 1.6;
font-weight: bold;
word-spacing: 10px;
height: 100%;
overflow: auto;
}
.mpicker-select > div {
padding: 3px 10px;
font-size: 14px;
color: rgba(0, 0, 0, 0.85);
font-weight: initial;
cursor: pointer;
min-height: 28px;
border: 1px solid #e9e9e9;
margin: 4px 4px;
transition: all .3s;
}
.mpicker-select > div:hover {
background: #ecf6fd;
}
.mpicker-select > .select{
color: #108ee9;
background: #ecf6fd;
}
}
.center{
width: calc(100% - 380px);
.pickupviewpanel {
width: 100%;
height: 100%;
}
}
}
>.footer {
height: 64px;
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SYS_PERMISSIONMPickupViewBase from './sys-permissionmpickup-view-base.vue';
import view_pickupviewpanel from '@widgets/sys-permission/mpickup-viewpickupviewpanel-pickupviewpanel/mpickup-viewpickupviewpanel-pickupviewpanel.vue';
@Component({
components: {
view_pickupviewpanel,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SYS_PERMISSIONMPickupView extends SYS_PERMISSIONMPickupViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container dempickupview sys-rolempickup-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sys_rolempickupview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' :dis-hover="true" :padding="0" :bordered="false">
<div class="content-container pickup-view">
<div class="translate-contant">
<div class="center" :style="{width : !isShowButton ? '100%' : ''}">
<view_pickupviewpanel
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
name="pickupviewpanel"
ref='pickupviewpanel'
@selectionchange="pickupviewpanel_selectionchange($event)"
@activated="pickupviewpanel_activated($event)"
@load="pickupviewpanel_load($event)"
@closeview="closeView($event)">
</view_pickupviewpanel>
</div>
<div v-if="isShowButton" class="translate-buttons">
<div class="buttons">
<i-button type="primary" :title="this.containerModel.view_rightbtn.text"
:disabled="this.containerModel.view_rightbtn.disabled"
@click="onCLickRight">
<i class="el-icon-arrow-right"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_leftbtn.text"
:disabled="this.containerModel.view_leftbtn.disabled"
@click="onCLickLeft">
<i class="el-icon-arrow-left"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_allrightbtn.text"
@click="onCLickAllRight">
<i class="el-icon-d-arrow-right"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_allleftbtn.text"
@click="onCLickAllLeft">
<i class="el-icon-d-arrow-left"></i>
</i-button>
</div>
</div>
<div v-if="isShowButton" class="right">
<div class="mpicker-select">
<div v-for="(item, index) in viewSelections" :key="index" :class="item._select ? 'select' : ''" @click="selectionsClick(item)" @dblclick="selectionsDBLClick(item)">
<span>{{item.srfmajortext}}</span>
</div>
</div>
</div>
</div>
<card v-if="isShowButton" :dis-hover="true" :bordered="false" class="footer">
<row :style="{ textAlign: 'right' }">
<i-button type="primary" :disabled="this.viewSelections.length > 0 ? false : true" @click="onClickOk">{{this.containerModel.view_okbtn.text}}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{this.containerModel.view_cancelbtn.text}}</i-button>
</row>
</card>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import SYS_ROLEService from '@/service/sys-role/sys-role-service';
import MPickupViewEngine from '@engine/view/mpickup-view-engine';
@Component({
components: {
},
})
export default class SYS_ROLEMPickupViewBase extends Vue {
/**
* 实体服务对象
*
* @type {SYS_ROLEService}
* @memberof SYS_ROLEMPickupViewBase
*/
public appEntityService: SYS_ROLEService = new SYS_ROLEService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SYS_ROLEMPickupViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SYS_ROLEMPickupViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SYS_ROLEMPickupViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SYS_ROLEMPickupViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SYS_ROLEMPickupViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof SYS_ROLEMPickupViewBase
*/
public viewtag: string = 'a1f8d44a9d7be49687062c63434b0f3f';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SYS_ROLEMPickupViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SYS_ROLEMPickupViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SYS_ROLEMPickupViewBase
*/
public model: any = {
srfCaption: 'entities.sys_role.views.mpickupview.caption',
srfTitle: 'entities.sys_role.views.mpickupview.title',
srfSubTitle: 'entities.sys_role.views.mpickupview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SYS_ROLEMPickupViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
if(this.viewparams.selectedData){
this.selectedData = JSON.stringify(this.viewparams.selectedData);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SYS_ROLEMPickupViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
_this.parseViewParam();
_this.engine.load();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof SYS_ROLEMPickupViewBase
*/
public containerModel: any = {
view_pickupviewpanel: { name: 'pickupviewpanel', type: 'PICKUPVIEWPANEL' },
view_okbtn: { name: 'okbtn', type: 'button', text: '确定', disabled: true },
view_cancelbtn: { name: 'cancelbtn', type: 'button', text: '取消', disabled: false },
view_leftbtn: { name: 'leftbtn', type: 'button', text: '左移', disabled: true },
view_rightbtn: { name: 'rightbtn', type: 'button', text: '右移', disabled: true },
view_allleftbtn: { name: 'allleftbtn', type: 'button', text: '全部左移', disabled: true },
view_allrightbtn: { name: 'allrightbtn', type: 'button', text: '全部右移', disabled: true },
};
/**
* 计数器刷新
*
* @memberof SYS_ROLEMPickupViewBase
*/
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 SYS_ROLEMPickupViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof SYS_ROLEMPickupViewBase
*/
public engine: MPickupViewEngine = new MPickupViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof SYS_ROLEMPickupViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
pickupviewpanel: this.$refs.pickupviewpanel,
keyPSDEField: 'sys_role',
majorPSDEField: 'rolename',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof SYS_ROLEMPickupViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SYS_ROLEMPickupViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof SYS_ROLEMPickupViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
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(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof SYS_ROLEMPickupViewBase
*/
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 SYS_ROLEMPickupViewBase
*/
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()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
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
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof SYS_ROLEMPickupViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SYS_ROLEMPickupViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof SYS_ROLEMPickupViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SYS_ROLEMPickupViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SYS_ROLEMPickupViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
if(this.viewparams.selectedData){
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', this.viewparams.selectedData);
this.onCLickRight();
}
}
/**
* pickupviewpanel 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SYS_ROLEMPickupViewBase
*/
public pickupviewpanel_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', $event);
}
/**
* pickupviewpanel 部件 activated 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SYS_ROLEMPickupViewBase
*/
public pickupviewpanel_activated($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'activated', $event);
}
/**
* pickupviewpanel 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SYS_ROLEMPickupViewBase
*/
public pickupviewpanel_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SYS_ROLEMPickupViewBase
*/
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 SYS_ROLEMPickupViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SYS_ROLEMPickupViewBase
*/
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);
}
})
}
}
}
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof SYS_ROLEMPickupView
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 选中数据的字符串
*
* @type {string}
* @memberof SYS_ROLEMPickupView
*/
public selectedData: string = "";
/**
* 是否初始化已选中项
*
* @type {any[]}
* @memberof SYS_ROLEMPickupView
*/
public isInitSelected:boolean = false;
/**
* 视图选中数据
*
* @type {any[]}
* @memberof SYS_ROLEMPickupView
*/
public viewSelections:any[] = [];
/**
* 是否单选
*
* @type {boolean}
* @memberof SYS_ROLEMPickupView
*/
public isSingleSelect: boolean = false;
/**
* 选中数据单击
*
* @param {*} item
* @memberof SYS_ROLEMPickupView
*/
public selectionsClick(item:any):void {
item._select = !item._select;
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
}
/**
* 选中树双击
*
* @param {*} item
* @memberof SYS_ROLEMPickupView
*/
public selectionsDBLClick(item:any):void {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(selection.srfkey, item.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 删除右侧全部选中数据
*
* @memberof SYS_ROLEMPickupView
*/
public onCLickLeft():void {
const _selectiions = [...JSON.parse(JSON.stringify(this.viewSelections))];
_selectiions.forEach((item: any) => {
if (!item._select) {
return;
}
const index = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
});
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧选中数据
*
* @memberof SYS_ROLEMPickupView
*/
public onCLickRight():void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
let newSelections:any[] = [];
model.selections.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
newSelections.push(_item);
}else{
newSelections.push(this.viewSelections[index]);
}
});
this.viewSelections = newSelections;
});
}
/**
* 选中数据全部删除
*
* @memberof SYS_ROLEMPickupView
*/
public onCLickAllLeft():void {
this.viewSelections = [];
this.containerModel.view_leftbtn.disabled = true;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧面板所有数据到右侧
*
* @memberof SYS_ROLEMPickupView
*/
public onCLickAllRight():void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
if(model.datas.length>0){
model.datas.forEach((data:any,index:any)=>{
Object.assign(data,{srfmajortext: data['rolename']});
})
}
model.datas.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
this.viewSelections.push(_item);
}
});
});
}
/**
* 确定
*
* @memberof SYS_ROLEMPickupView
*/
public onClickOk(): void {
this.$emit('viewdataschange', this.viewSelections);
this.$emit('close', null);
}
/**
* 取消
*
* @memberof SYS_ROLEMPickupView
*/
public onClickCancel(): void {
this.$emit('close', null);
}
}
</script>
<style lang='less'>
@import './sys-rolempickup-view.less';
</style>
\ No newline at end of file
.sys-rolempickup-view{
position: relative;
}
.pickup-view {
>.translate-contant {
flex-grow: 1;
display: flex;
justify-content: flex-end;
height: calc(100% - 64px);
.translate-buttons {
width: 80px;
display: flex;
align-items: center;
text-align: center;
button {
margin-bottom: 5px;
}
}
.left, .right {
width: 300px;
}
.right {
border: 1px solid #e9e9e9;
.mpicker-select {
font-family: helvetica, sans-serif;
font-size: 16px;
text-align: justify;
word-spacing: -3.8pt;
line-height: 1.6;
font-weight: bold;
word-spacing: 10px;
height: 100%;
overflow: auto;
}
.mpicker-select > div {
padding: 3px 10px;
font-size: 14px;
color: rgba(0, 0, 0, 0.85);
font-weight: initial;
cursor: pointer;
min-height: 28px;
border: 1px solid #e9e9e9;
margin: 4px 4px;
transition: all .3s;
}
.mpicker-select > div:hover {
background: #ecf6fd;
}
.mpicker-select > .select{
color: #108ee9;
background: #ecf6fd;
}
}
.center{
width: calc(100% - 380px);
.pickupviewpanel {
width: 100%;
height: 100%;
}
}
}
>.footer {
height: 64px;
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SYS_ROLEMPickupViewBase from './sys-rolempickup-view-base.vue';
import view_pickupviewpanel from '@widgets/sys-role/mpickup-viewpickupviewpanel-pickupviewpanel/mpickup-viewpickupviewpanel-pickupviewpanel.vue';
@Component({
components: {
view_pickupviewpanel,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SYS_ROLEMPickupView extends SYS_ROLEMPickupViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container dempickupview sys-usermpickup-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sys_usermpickupview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' :dis-hover="true" :padding="0" :bordered="false">
<div class="content-container pickup-view">
<div class="translate-contant">
<div class="center" :style="{width : !isShowButton ? '100%' : ''}">
<view_pickupviewpanel
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
name="pickupviewpanel"
ref='pickupviewpanel'
@selectionchange="pickupviewpanel_selectionchange($event)"
@activated="pickupviewpanel_activated($event)"
@load="pickupviewpanel_load($event)"
@closeview="closeView($event)">
</view_pickupviewpanel>
</div>
<div v-if="isShowButton" class="translate-buttons">
<div class="buttons">
<i-button type="primary" :title="this.containerModel.view_rightbtn.text"
:disabled="this.containerModel.view_rightbtn.disabled"
@click="onCLickRight">
<i class="el-icon-arrow-right"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_leftbtn.text"
:disabled="this.containerModel.view_leftbtn.disabled"
@click="onCLickLeft">
<i class="el-icon-arrow-left"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_allrightbtn.text"
@click="onCLickAllRight">
<i class="el-icon-d-arrow-right"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_allleftbtn.text"
@click="onCLickAllLeft">
<i class="el-icon-d-arrow-left"></i>
</i-button>
</div>
</div>
<div v-if="isShowButton" class="right">
<div class="mpicker-select">
<div v-for="(item, index) in viewSelections" :key="index" :class="item._select ? 'select' : ''" @click="selectionsClick(item)" @dblclick="selectionsDBLClick(item)">
<span>{{item.srfmajortext}}</span>
</div>
</div>
</div>
</div>
<card v-if="isShowButton" :dis-hover="true" :bordered="false" class="footer">
<row :style="{ textAlign: 'right' }">
<i-button type="primary" :disabled="this.viewSelections.length > 0 ? false : true" @click="onClickOk">{{this.containerModel.view_okbtn.text}}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{this.containerModel.view_cancelbtn.text}}</i-button>
</row>
</card>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import SYS_USERService from '@/service/sys-user/sys-user-service';
import MPickupViewEngine from '@engine/view/mpickup-view-engine';
@Component({
components: {
},
})
export default class SYS_USERMPickupViewBase extends Vue {
/**
* 实体服务对象
*
* @type {SYS_USERService}
* @memberof SYS_USERMPickupViewBase
*/
public appEntityService: SYS_USERService = new SYS_USERService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SYS_USERMPickupViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof SYS_USERMPickupViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof SYS_USERMPickupViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof SYS_USERMPickupViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof SYS_USERMPickupViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof SYS_USERMPickupViewBase
*/
public viewtag: string = '1f8cf7e78d6d88588d1d568d1866cc77';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof SYS_USERMPickupViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof SYS_USERMPickupViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof SYS_USERMPickupViewBase
*/
public model: any = {
srfCaption: 'entities.sys_user.views.mpickupview.caption',
srfTitle: 'entities.sys_user.views.mpickupview.title',
srfSubTitle: 'entities.sys_user.views.mpickupview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SYS_USERMPickupViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
if(this.viewparams.selectedData){
this.selectedData = JSON.stringify(this.viewparams.selectedData);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof SYS_USERMPickupViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
_this.parseViewParam();
_this.engine.load();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof SYS_USERMPickupViewBase
*/
public containerModel: any = {
view_pickupviewpanel: { name: 'pickupviewpanel', type: 'PICKUPVIEWPANEL' },
view_okbtn: { name: 'okbtn', type: 'button', text: '确定', disabled: true },
view_cancelbtn: { name: 'cancelbtn', type: 'button', text: '取消', disabled: false },
view_leftbtn: { name: 'leftbtn', type: 'button', text: '左移', disabled: true },
view_rightbtn: { name: 'rightbtn', type: 'button', text: '右移', disabled: true },
view_allleftbtn: { name: 'allleftbtn', type: 'button', text: '全部左移', disabled: true },
view_allrightbtn: { name: 'allrightbtn', type: 'button', text: '全部右移', disabled: true },
};
/**
* 计数器刷新
*
* @memberof SYS_USERMPickupViewBase
*/
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 SYS_USERMPickupViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof SYS_USERMPickupViewBase
*/
public engine: MPickupViewEngine = new MPickupViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof SYS_USERMPickupViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
pickupviewpanel: this.$refs.pickupviewpanel,
keyPSDEField: 'sys_user',
majorPSDEField: 'personname',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof SYS_USERMPickupViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof SYS_USERMPickupViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof SYS_USERMPickupViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
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(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof SYS_USERMPickupViewBase
*/
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 SYS_USERMPickupViewBase
*/
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()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
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
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof SYS_USERMPickupViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof SYS_USERMPickupViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof SYS_USERMPickupViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof SYS_USERMPickupViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof SYS_USERMPickupViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
if(this.viewparams.selectedData){
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', this.viewparams.selectedData);
this.onCLickRight();
}
}
/**
* pickupviewpanel 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SYS_USERMPickupViewBase
*/
public pickupviewpanel_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', $event);
}
/**
* pickupviewpanel 部件 activated 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SYS_USERMPickupViewBase
*/
public pickupviewpanel_activated($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'activated', $event);
}
/**
* pickupviewpanel 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof SYS_USERMPickupViewBase
*/
public pickupviewpanel_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof SYS_USERMPickupViewBase
*/
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 SYS_USERMPickupViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof SYS_USERMPickupViewBase
*/
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);
}
})
}
}
}
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof SYS_USERMPickupView
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 选中数据的字符串
*
* @type {string}
* @memberof SYS_USERMPickupView
*/
public selectedData: string = "";
/**
* 是否初始化已选中项
*
* @type {any[]}
* @memberof SYS_USERMPickupView
*/
public isInitSelected:boolean = false;
/**
* 视图选中数据
*
* @type {any[]}
* @memberof SYS_USERMPickupView
*/
public viewSelections:any[] = [];
/**
* 是否单选
*
* @type {boolean}
* @memberof SYS_USERMPickupView
*/
public isSingleSelect: boolean = false;
/**
* 选中数据单击
*
* @param {*} item
* @memberof SYS_USERMPickupView
*/
public selectionsClick(item:any):void {
item._select = !item._select;
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
}
/**
* 选中树双击
*
* @param {*} item
* @memberof SYS_USERMPickupView
*/
public selectionsDBLClick(item:any):void {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(selection.srfkey, item.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 删除右侧全部选中数据
*
* @memberof SYS_USERMPickupView
*/
public onCLickLeft():void {
const _selectiions = [...JSON.parse(JSON.stringify(this.viewSelections))];
_selectiions.forEach((item: any) => {
if (!item._select) {
return;
}
const index = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
});
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧选中数据
*
* @memberof SYS_USERMPickupView
*/
public onCLickRight():void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
let newSelections:any[] = [];
model.selections.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
newSelections.push(_item);
}else{
newSelections.push(this.viewSelections[index]);
}
});
this.viewSelections = newSelections;
});
}
/**
* 选中数据全部删除
*
* @memberof SYS_USERMPickupView
*/
public onCLickAllLeft():void {
this.viewSelections = [];
this.containerModel.view_leftbtn.disabled = true;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧面板所有数据到右侧
*
* @memberof SYS_USERMPickupView
*/
public onCLickAllRight():void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
if(model.datas.length>0){
model.datas.forEach((data:any,index:any)=>{
Object.assign(data,{srfmajortext: data['personname']});
})
}
model.datas.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
this.viewSelections.push(_item);
}
});
});
}
/**
* 确定
*
* @memberof SYS_USERMPickupView
*/
public onClickOk(): void {
this.$emit('viewdataschange', this.viewSelections);
this.$emit('close', null);
}
/**
* 取消
*
* @memberof SYS_USERMPickupView
*/
public onClickCancel(): void {
this.$emit('close', null);
}
}
</script>
<style lang='less'>
@import './sys-usermpickup-view.less';
</style>
\ No newline at end of file
.sys-usermpickup-view{
position: relative;
}
.pickup-view {
>.translate-contant {
flex-grow: 1;
display: flex;
justify-content: flex-end;
height: calc(100% - 64px);
.translate-buttons {
width: 80px;
display: flex;
align-items: center;
text-align: center;
button {
margin-bottom: 5px;
}
}
.left, .right {
width: 300px;
}
.right {
border: 1px solid #e9e9e9;
.mpicker-select {
font-family: helvetica, sans-serif;
font-size: 16px;
text-align: justify;
word-spacing: -3.8pt;
line-height: 1.6;
font-weight: bold;
word-spacing: 10px;
height: 100%;
overflow: auto;
}
.mpicker-select > div {
padding: 3px 10px;
font-size: 14px;
color: rgba(0, 0, 0, 0.85);
font-weight: initial;
cursor: pointer;
min-height: 28px;
border: 1px solid #e9e9e9;
margin: 4px 4px;
transition: all .3s;
}
.mpicker-select > div:hover {
background: #ecf6fd;
}
.mpicker-select > .select{
color: #108ee9;
background: #ecf6fd;
}
}
.center{
width: calc(100% - 380px);
.pickupviewpanel {
width: 100%;
height: 100%;
}
}
}
>.footer {
height: 64px;
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SYS_USERMPickupViewBase from './sys-usermpickup-view-base.vue';
import view_pickupviewpanel from '@widgets/sys-user/mpickup-viewpickupviewpanel-pickupviewpanel/mpickup-viewpickupviewpanel-pickupviewpanel.vue';
@Component({
components: {
view_pickupviewpanel,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class SYS_USERMPickupView extends SYS_USERMPickupViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container dempickupview wfgroup-mpickup-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="wfgroupmpickupview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' :dis-hover="true" :padding="0" :bordered="false">
<div class="content-container pickup-view">
<div class="translate-contant">
<div class="center" :style="{width : !isShowButton ? '100%' : ''}">
<view_pickupviewpanel
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
name="pickupviewpanel"
ref='pickupviewpanel'
@selectionchange="pickupviewpanel_selectionchange($event)"
@activated="pickupviewpanel_activated($event)"
@load="pickupviewpanel_load($event)"
@closeview="closeView($event)">
</view_pickupviewpanel>
</div>
<div v-if="isShowButton" class="translate-buttons">
<div class="buttons">
<i-button type="primary" :title="this.containerModel.view_rightbtn.text"
:disabled="this.containerModel.view_rightbtn.disabled"
@click="onCLickRight">
<i class="el-icon-arrow-right"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_leftbtn.text"
:disabled="this.containerModel.view_leftbtn.disabled"
@click="onCLickLeft">
<i class="el-icon-arrow-left"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_allrightbtn.text"
@click="onCLickAllRight">
<i class="el-icon-d-arrow-right"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_allleftbtn.text"
@click="onCLickAllLeft">
<i class="el-icon-d-arrow-left"></i>
</i-button>
</div>
</div>
<div v-if="isShowButton" class="right">
<div class="mpicker-select">
<div v-for="(item, index) in viewSelections" :key="index" :class="item._select ? 'select' : ''" @click="selectionsClick(item)" @dblclick="selectionsDBLClick(item)">
<span>{{item.srfmajortext}}</span>
</div>
</div>
</div>
</div>
<card v-if="isShowButton" :dis-hover="true" :bordered="false" class="footer">
<row :style="{ textAlign: 'right' }">
<i-button type="primary" :disabled="this.viewSelections.length > 0 ? false : true" @click="onClickOk">{{this.containerModel.view_okbtn.text}}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{this.containerModel.view_cancelbtn.text}}</i-button>
</row>
</card>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import WFGroupService from '@/service/wfgroup/wfgroup-service';
import MPickupViewEngine from '@engine/view/mpickup-view-engine';
@Component({
components: {
},
})
export default class WFGroupMPickupViewBase extends Vue {
/**
* 实体服务对象
*
* @type {WFGroupService}
* @memberof WFGroupMPickupViewBase
*/
public appEntityService: WFGroupService = new WFGroupService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof WFGroupMPickupViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof WFGroupMPickupViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof WFGroupMPickupViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof WFGroupMPickupViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof WFGroupMPickupViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof WFGroupMPickupViewBase
*/
public viewtag: string = '90a777962337daaf4cffd846eecb1f0f';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof WFGroupMPickupViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof WFGroupMPickupViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof WFGroupMPickupViewBase
*/
public model: any = {
srfCaption: 'entities.wfgroup.views.mpickupview.caption',
srfTitle: 'entities.wfgroup.views.mpickupview.title',
srfSubTitle: 'entities.wfgroup.views.mpickupview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof WFGroupMPickupViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
if(this.viewparams.selectedData){
this.selectedData = JSON.stringify(this.viewparams.selectedData);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof WFGroupMPickupViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
_this.parseViewParam();
_this.engine.load();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof WFGroupMPickupViewBase
*/
public containerModel: any = {
view_pickupviewpanel: { name: 'pickupviewpanel', type: 'PICKUPVIEWPANEL' },
view_okbtn: { name: 'okbtn', type: 'button', text: '确定', disabled: true },
view_cancelbtn: { name: 'cancelbtn', type: 'button', text: '取消', disabled: false },
view_leftbtn: { name: 'leftbtn', type: 'button', text: '左移', disabled: true },
view_rightbtn: { name: 'rightbtn', type: 'button', text: '右移', disabled: true },
view_allleftbtn: { name: 'allleftbtn', type: 'button', text: '全部左移', disabled: true },
view_allrightbtn: { name: 'allrightbtn', type: 'button', text: '全部右移', disabled: true },
};
/**
* 计数器刷新
*
* @memberof WFGroupMPickupViewBase
*/
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 WFGroupMPickupViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof WFGroupMPickupViewBase
*/
public engine: MPickupViewEngine = new MPickupViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof WFGroupMPickupViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
pickupviewpanel: this.$refs.pickupviewpanel,
keyPSDEField: 'wfgroup',
majorPSDEField: 'name',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof WFGroupMPickupViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof WFGroupMPickupViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof WFGroupMPickupViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
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(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof WFGroupMPickupViewBase
*/
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 WFGroupMPickupViewBase
*/
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()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
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
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof WFGroupMPickupViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof WFGroupMPickupViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof WFGroupMPickupViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof WFGroupMPickupViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof WFGroupMPickupViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
if(this.viewparams.selectedData){
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', this.viewparams.selectedData);
this.onCLickRight();
}
}
/**
* pickupviewpanel 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFGroupMPickupViewBase
*/
public pickupviewpanel_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', $event);
}
/**
* pickupviewpanel 部件 activated 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFGroupMPickupViewBase
*/
public pickupviewpanel_activated($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'activated', $event);
}
/**
* pickupviewpanel 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFGroupMPickupViewBase
*/
public pickupviewpanel_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof WFGroupMPickupViewBase
*/
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 WFGroupMPickupViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof WFGroupMPickupViewBase
*/
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);
}
})
}
}
}
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof WFGroupMPickupView
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 选中数据的字符串
*
* @type {string}
* @memberof WFGroupMPickupView
*/
public selectedData: string = "";
/**
* 是否初始化已选中项
*
* @type {any[]}
* @memberof WFGroupMPickupView
*/
public isInitSelected:boolean = false;
/**
* 视图选中数据
*
* @type {any[]}
* @memberof WFGroupMPickupView
*/
public viewSelections:any[] = [];
/**
* 是否单选
*
* @type {boolean}
* @memberof WFGroupMPickupView
*/
public isSingleSelect: boolean = false;
/**
* 选中数据单击
*
* @param {*} item
* @memberof WFGroupMPickupView
*/
public selectionsClick(item:any):void {
item._select = !item._select;
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
}
/**
* 选中树双击
*
* @param {*} item
* @memberof WFGroupMPickupView
*/
public selectionsDBLClick(item:any):void {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(selection.srfkey, item.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 删除右侧全部选中数据
*
* @memberof WFGroupMPickupView
*/
public onCLickLeft():void {
const _selectiions = [...JSON.parse(JSON.stringify(this.viewSelections))];
_selectiions.forEach((item: any) => {
if (!item._select) {
return;
}
const index = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
});
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧选中数据
*
* @memberof WFGroupMPickupView
*/
public onCLickRight():void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
let newSelections:any[] = [];
model.selections.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
newSelections.push(_item);
}else{
newSelections.push(this.viewSelections[index]);
}
});
this.viewSelections = newSelections;
});
}
/**
* 选中数据全部删除
*
* @memberof WFGroupMPickupView
*/
public onCLickAllLeft():void {
this.viewSelections = [];
this.containerModel.view_leftbtn.disabled = true;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧面板所有数据到右侧
*
* @memberof WFGroupMPickupView
*/
public onCLickAllRight():void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
if(model.datas.length>0){
model.datas.forEach((data:any,index:any)=>{
Object.assign(data,{srfmajortext: data['name']});
})
}
model.datas.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
this.viewSelections.push(_item);
}
});
});
}
/**
* 确定
*
* @memberof WFGroupMPickupView
*/
public onClickOk(): void {
this.$emit('viewdataschange', this.viewSelections);
this.$emit('close', null);
}
/**
* 取消
*
* @memberof WFGroupMPickupView
*/
public onClickCancel(): void {
this.$emit('close', null);
}
}
</script>
<style lang='less'>
@import './wfgroup-mpickup-view.less';
</style>
\ No newline at end of file
.wfgroup-mpickup-view{
position: relative;
}
.pickup-view {
>.translate-contant {
flex-grow: 1;
display: flex;
justify-content: flex-end;
height: calc(100% - 64px);
.translate-buttons {
width: 80px;
display: flex;
align-items: center;
text-align: center;
button {
margin-bottom: 5px;
}
}
.left, .right {
width: 300px;
}
.right {
border: 1px solid #e9e9e9;
.mpicker-select {
font-family: helvetica, sans-serif;
font-size: 16px;
text-align: justify;
word-spacing: -3.8pt;
line-height: 1.6;
font-weight: bold;
word-spacing: 10px;
height: 100%;
overflow: auto;
}
.mpicker-select > div {
padding: 3px 10px;
font-size: 14px;
color: rgba(0, 0, 0, 0.85);
font-weight: initial;
cursor: pointer;
min-height: 28px;
border: 1px solid #e9e9e9;
margin: 4px 4px;
transition: all .3s;
}
.mpicker-select > div:hover {
background: #ecf6fd;
}
.mpicker-select > .select{
color: #108ee9;
background: #ecf6fd;
}
}
.center{
width: calc(100% - 380px);
.pickupviewpanel {
width: 100%;
height: 100%;
}
}
}
>.footer {
height: 64px;
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import WFGroupMPickupViewBase from './wfgroup-mpickup-view-base.vue';
import view_pickupviewpanel from '@widgets/wfgroup/mpickup-viewpickupviewpanel-pickupviewpanel/mpickup-viewpickupviewpanel-pickupviewpanel.vue';
@Component({
components: {
view_pickupviewpanel,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class WFGroupMPickupView extends WFGroupMPickupViewBase {
}
</script>
\ No newline at end of file
<template>
<div class='view-container depickupgridview wfgroup-pickup-grid-view'>
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="wfgrouppickupgridview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' :dis-hover="true" :bordered="false">
<div class='content-container pickup-grid-view'>
<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>
<view_grid
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:showBusyIndicator="true"
updateAction=""
removeAction="Remove"
loaddraftAction=""
loadAction=""
createAction=""
fetchAction="FetchDefault"
name="grid"
ref='grid'
@selectionchange="grid_selectionchange($event)"
@beforeload="grid_beforeload($event)"
@rowdblclick="grid_rowdblclick($event)"
@load="grid_load($event)"
@closeview="closeView($event)">
</view_grid>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import WFGroupService from '@/service/wfgroup/wfgroup-service';
import PickupGridViewEngine from '@engine/view/pickup-grid-view-engine';
@Component({
components: {
},
})
export default class WFGroupPickupGridViewBase extends Vue {
/**
* 实体服务对象
*
* @type {WFGroupService}
* @memberof WFGroupPickupGridViewBase
*/
public appEntityService: WFGroupService = new WFGroupService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof WFGroupPickupGridViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof WFGroupPickupGridViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof WFGroupPickupGridViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof WFGroupPickupGridViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof WFGroupPickupGridViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof WFGroupPickupGridViewBase
*/
public viewtag: string = '17ccd6d8d2bb7cf30158253da129ec1b';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof WFGroupPickupGridViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof WFGroupPickupGridViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof WFGroupPickupGridViewBase
*/
public model: any = {
srfCaption: 'entities.wfgroup.views.pickupgridview.caption',
srfTitle: 'entities.wfgroup.views.pickupgridview.title',
srfSubTitle: 'entities.wfgroup.views.pickupgridview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof WFGroupPickupGridViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof WFGroupPickupGridViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
_this.parseViewParam();
_this.engine.load();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof WFGroupPickupGridViewBase
*/
public containerModel: any = {
view_grid: { name: 'grid', type: 'GRID' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
};
/**
* 计数器刷新
*
* @memberof WFGroupPickupGridViewBase
*/
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 WFGroupPickupGridViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof WFGroupPickupGridViewBase
*/
public engine: PickupGridViewEngine = new PickupGridViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof WFGroupPickupGridViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
grid: this.$refs.grid,
searchform: this.$refs.searchform,
keyPSDEField: 'wfgroup',
majorPSDEField: 'name',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof WFGroupPickupGridViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof WFGroupPickupGridViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof WFGroupPickupGridViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
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(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof WFGroupPickupGridViewBase
*/
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 WFGroupPickupGridViewBase
*/
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()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
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
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof WFGroupPickupGridViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof WFGroupPickupGridViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof WFGroupPickupGridViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof WFGroupPickupGridViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof WFGroupPickupGridViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* grid 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFGroupPickupGridViewBase
*/
public grid_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'selectionchange', $event);
}
/**
* grid 部件 beforeload 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFGroupPickupGridViewBase
*/
public grid_beforeload($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'beforeload', $event);
}
/**
* grid 部件 rowdblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFGroupPickupGridViewBase
*/
public grid_rowdblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'rowdblclick', $event);
}
/**
* grid 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFGroupPickupGridViewBase
*/
public grid_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'load', $event);
}
/**
* searchform 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFGroupPickupGridViewBase
*/
public searchform_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'save', $event);
}
/**
* searchform 部件 search 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFGroupPickupGridViewBase
*/
public searchform_search($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'search', $event);
}
/**
* searchform 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFGroupPickupGridViewBase
*/
public searchform_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof WFGroupPickupGridViewBase
*/
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 WFGroupPickupGridViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof WFGroupPickupGridViewBase
*/
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);
}
})
}
}
}
/**
* 选中数据字符串
*
* @type {string}
* @memberof WFGroupPickupGridView
*/
@Prop() public selectedData?: string;
/**
* 是否单选
*
* @type {boolean}
* @memberof WFGroupPickupGridView
*/
@Prop() public isSingleSelect?: boolean;
/**
* 搜索值
*
* @type {string}
* @memberof WFGroupPickupGridView
*/
public query: string = '';
/**
* 是否展开搜索表单
*
* @type {boolean}
* @memberof WFGroupPickupGridView
*/
public isExpandSearchForm: boolean = true;
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof WFGroupPickupGridView
*/
public gridRowActiveMode: number | 0 | 1 | 2 = 2;
/**
* 快速搜索
*
* @param {*} $event
* @memberof WFGroupPickupGridView
*/
public onSearch($event: any): void {
const refs: any = this.$refs;
if (refs.grid) {
refs.grid.load({});
}
}
}
</script>
<style lang='less'>
@import './wfgroup-pickup-grid-view.less';
</style>
\ No newline at end of file
.wfgroup-pickup-grid-view{
position: relative;
}
.wfgroup-pickup-grid-view{
width:100%;
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import WFGroupPickupGridViewBase from './wfgroup-pickup-grid-view-base.vue';
import view_grid from '@widgets/wfgroup/main-grid/main-grid.vue';
import view_searchform from '@widgets/wfgroup/default-searchform/default-searchform.vue';
@Component({
components: {
view_grid,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class WFGroupPickupGridView extends WFGroupPickupGridViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container dempickupview wfuser-mpickup-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="wfusermpickupview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' :dis-hover="true" :padding="0" :bordered="false">
<div class="content-container pickup-view">
<div class="translate-contant">
<div class="center" :style="{width : !isShowButton ? '100%' : ''}">
<view_pickupviewpanel
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
name="pickupviewpanel"
ref='pickupviewpanel'
@selectionchange="pickupviewpanel_selectionchange($event)"
@activated="pickupviewpanel_activated($event)"
@load="pickupviewpanel_load($event)"
@closeview="closeView($event)">
</view_pickupviewpanel>
</div>
<div v-if="isShowButton" class="translate-buttons">
<div class="buttons">
<i-button type="primary" :title="this.containerModel.view_rightbtn.text"
:disabled="this.containerModel.view_rightbtn.disabled"
@click="onCLickRight">
<i class="el-icon-arrow-right"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_leftbtn.text"
:disabled="this.containerModel.view_leftbtn.disabled"
@click="onCLickLeft">
<i class="el-icon-arrow-left"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_allrightbtn.text"
@click="onCLickAllRight">
<i class="el-icon-d-arrow-right"></i>
</i-button>
<i-button type="primary" :title="this.containerModel.view_allleftbtn.text"
@click="onCLickAllLeft">
<i class="el-icon-d-arrow-left"></i>
</i-button>
</div>
</div>
<div v-if="isShowButton" class="right">
<div class="mpicker-select">
<div v-for="(item, index) in viewSelections" :key="index" :class="item._select ? 'select' : ''" @click="selectionsClick(item)" @dblclick="selectionsDBLClick(item)">
<span>{{item.srfmajortext}}</span>
</div>
</div>
</div>
</div>
<card v-if="isShowButton" :dis-hover="true" :bordered="false" class="footer">
<row :style="{ textAlign: 'right' }">
<i-button type="primary" :disabled="this.viewSelections.length > 0 ? false : true" @click="onClickOk">{{this.containerModel.view_okbtn.text}}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{this.containerModel.view_cancelbtn.text}}</i-button>
</row>
</card>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import WFUserService from '@/service/wfuser/wfuser-service';
import MPickupViewEngine from '@engine/view/mpickup-view-engine';
@Component({
components: {
},
})
export default class WFUserMPickupViewBase extends Vue {
/**
* 实体服务对象
*
* @type {WFUserService}
* @memberof WFUserMPickupViewBase
*/
public appEntityService: WFUserService = new WFUserService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof WFUserMPickupViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof WFUserMPickupViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof WFUserMPickupViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof WFUserMPickupViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof WFUserMPickupViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof WFUserMPickupViewBase
*/
public viewtag: string = '84e5a5b589b434dfdc60a3d0ad087d37';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof WFUserMPickupViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof WFUserMPickupViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof WFUserMPickupViewBase
*/
public model: any = {
srfCaption: 'entities.wfuser.views.mpickupview.caption',
srfTitle: 'entities.wfuser.views.mpickupview.title',
srfSubTitle: 'entities.wfuser.views.mpickupview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof WFUserMPickupViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
if(this.viewparams.selectedData){
this.selectedData = JSON.stringify(this.viewparams.selectedData);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof WFUserMPickupViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
_this.parseViewParam();
_this.engine.load();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof WFUserMPickupViewBase
*/
public containerModel: any = {
view_pickupviewpanel: { name: 'pickupviewpanel', type: 'PICKUPVIEWPANEL' },
view_okbtn: { name: 'okbtn', type: 'button', text: '确定', disabled: true },
view_cancelbtn: { name: 'cancelbtn', type: 'button', text: '取消', disabled: false },
view_leftbtn: { name: 'leftbtn', type: 'button', text: '左移', disabled: true },
view_rightbtn: { name: 'rightbtn', type: 'button', text: '右移', disabled: true },
view_allleftbtn: { name: 'allleftbtn', type: 'button', text: '全部左移', disabled: true },
view_allrightbtn: { name: 'allrightbtn', type: 'button', text: '全部右移', disabled: true },
};
/**
* 计数器刷新
*
* @memberof WFUserMPickupViewBase
*/
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 WFUserMPickupViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof WFUserMPickupViewBase
*/
public engine: MPickupViewEngine = new MPickupViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof WFUserMPickupViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
pickupviewpanel: this.$refs.pickupviewpanel,
keyPSDEField: 'wfuser',
majorPSDEField: 'displayname',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof WFUserMPickupViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof WFUserMPickupViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof WFUserMPickupViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
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(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof WFUserMPickupViewBase
*/
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 WFUserMPickupViewBase
*/
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()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
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
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof WFUserMPickupViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof WFUserMPickupViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof WFUserMPickupViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof WFUserMPickupViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof WFUserMPickupViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
if(this.viewparams.selectedData){
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', this.viewparams.selectedData);
this.onCLickRight();
}
}
/**
* pickupviewpanel 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFUserMPickupViewBase
*/
public pickupviewpanel_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', $event);
}
/**
* pickupviewpanel 部件 activated 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFUserMPickupViewBase
*/
public pickupviewpanel_activated($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'activated', $event);
}
/**
* pickupviewpanel 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof WFUserMPickupViewBase
*/
public pickupviewpanel_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof WFUserMPickupViewBase
*/
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 WFUserMPickupViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof WFUserMPickupViewBase
*/
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);
}
})
}
}
}
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof WFUserMPickupView
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 选中数据的字符串
*
* @type {string}
* @memberof WFUserMPickupView
*/
public selectedData: string = "";
/**
* 是否初始化已选中项
*
* @type {any[]}
* @memberof WFUserMPickupView
*/
public isInitSelected:boolean = false;
/**
* 视图选中数据
*
* @type {any[]}
* @memberof WFUserMPickupView
*/
public viewSelections:any[] = [];
/**
* 是否单选
*
* @type {boolean}
* @memberof WFUserMPickupView
*/
public isSingleSelect: boolean = false;
/**
* 选中数据单击
*
* @param {*} item
* @memberof WFUserMPickupView
*/
public selectionsClick(item:any):void {
item._select = !item._select;
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
}
/**
* 选中树双击
*
* @param {*} item
* @memberof WFUserMPickupView
*/
public selectionsDBLClick(item:any):void {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(selection.srfkey, item.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 删除右侧全部选中数据
*
* @memberof WFUserMPickupView
*/
public onCLickLeft():void {
const _selectiions = [...JSON.parse(JSON.stringify(this.viewSelections))];
_selectiions.forEach((item: any) => {
if (!item._select) {
return;
}
const index = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
});
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧选中数据
*
* @memberof WFUserMPickupView
*/
public onCLickRight():void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
let newSelections:any[] = [];
model.selections.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
newSelections.push(_item);
}else{
newSelections.push(this.viewSelections[index]);
}
});
this.viewSelections = newSelections;
});
}
/**
* 选中数据全部删除
*
* @memberof WFUserMPickupView
*/
public onCLickAllLeft():void {
this.viewSelections = [];
this.containerModel.view_leftbtn.disabled = true;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧面板所有数据到右侧
*
* @memberof WFUserMPickupView
*/
public onCLickAllRight():void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
if(model.datas.length>0){
model.datas.forEach((data:any,index:any)=>{
Object.assign(data,{srfmajortext: data['displayname']});
})
}
model.datas.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
this.viewSelections.push(_item);
}
});
});
}
/**
* 确定
*
* @memberof WFUserMPickupView
*/
public onClickOk(): void {
this.$emit('viewdataschange', this.viewSelections);
this.$emit('close', null);
}
/**
* 取消
*
* @memberof WFUserMPickupView
*/
public onClickCancel(): void {
this.$emit('close', null);
}
}
</script>
<style lang='less'>
@import './wfuser-mpickup-view.less';
</style>
\ No newline at end of file
.wfuser-mpickup-view{
position: relative;
}
.pickup-view {
>.translate-contant {
flex-grow: 1;
display: flex;
justify-content: flex-end;
height: calc(100% - 64px);
.translate-buttons {
width: 80px;
display: flex;
align-items: center;
text-align: center;
button {
margin-bottom: 5px;
}
}
.left, .right {
width: 300px;
}
.right {
border: 1px solid #e9e9e9;
.mpicker-select {
font-family: helvetica, sans-serif;
font-size: 16px;
text-align: justify;
word-spacing: -3.8pt;
line-height: 1.6;
font-weight: bold;
word-spacing: 10px;
height: 100%;
overflow: auto;
}
.mpicker-select > div {
padding: 3px 10px;
font-size: 14px;
color: rgba(0, 0, 0, 0.85);
font-weight: initial;
cursor: pointer;
min-height: 28px;
border: 1px solid #e9e9e9;
margin: 4px 4px;
transition: all .3s;
}
.mpicker-select > div:hover {
background: #ecf6fd;
}
.mpicker-select > .select{
color: #108ee9;
background: #ecf6fd;
}
}
.center{
width: calc(100% - 380px);
.pickupviewpanel {
width: 100%;
height: 100%;
}
}
}
>.footer {
height: 64px;
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import WFUserMPickupViewBase from './wfuser-mpickup-view-base.vue';
import view_pickupviewpanel from '@widgets/wfuser/mpickup-viewpickupviewpanel-pickupviewpanel/mpickup-viewpickupviewpanel-pickupviewpanel.vue';
@Component({
components: {
view_pickupviewpanel,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class WFUserMPickupView extends WFUserMPickupViewBase {
}
</script>
\ No newline at end of file
......@@ -56,6 +56,25 @@ export const viewstate: any = {
'6bd0981f6dd67a59f211b5cf97ac8f30',
],
},
{
viewtag: '17ccd6d8d2bb7cf30158253da129ec1b',
viewmodule: 'workflow',
viewname: 'WFGroupPickupGridView',
viewaction: '',
viewdatachange: false,
refviews: [
],
},
{
viewtag: '1f8cf7e78d6d88588d1d568d1866cc77',
viewmodule: 'uaa',
viewname: 'SYS_USERMPickupView',
viewaction: '',
viewdatachange: false,
refviews: [
'6869875c7409bd1dddd3d0fc62c502db',
],
},
{
viewtag: '2546b76ba07280621632d7965d8878be',
viewmodule: 'dict',
......@@ -220,6 +239,36 @@ export const viewstate: any = {
'3df57007c5cac396f548be7c926b851c',
],
},
{
viewtag: '84e5a5b589b434dfdc60a3d0ad087d37',
viewmodule: 'workflow',
viewname: 'WFUserMPickupView',
viewaction: '',
viewdatachange: false,
refviews: [
'c9c73c8d2e61bd29a304622f3d39b522',
],
},
{
viewtag: '86bd4f6d4f771870e10b9717046a1b14',
viewmodule: 'uaa',
viewname: 'SYS_PERMISSIONMPickupView',
viewaction: '',
viewdatachange: false,
refviews: [
'95d8c933cf4df47634a25d791b3d8564',
],
},
{
viewtag: '90a777962337daaf4cffd846eecb1f0f',
viewmodule: 'workflow',
viewname: 'WFGroupMPickupView',
viewaction: '',
viewdatachange: false,
refviews: [
'17ccd6d8d2bb7cf30158253da129ec1b',
],
},
{
viewtag: '90c0ced2720b85d5e051e7935a93d3c5',
viewmodule: 'ou',
......@@ -272,6 +321,16 @@ export const viewstate: any = {
'ccff36439eacae953f85ff636c9dac74',
],
},
{
viewtag: 'a1f8d44a9d7be49687062c63434b0f3f',
viewmodule: 'uaa',
viewname: 'SYS_ROLEMPickupView',
viewaction: '',
viewdatachange: false,
refviews: [
'7c25865f5864a734477c7cb987632f4f',
],
},
{
viewtag: 'a93a129850b81c3c921aa1911ec9eb8c',
viewmodule: 'uaa',
......
<template>
<div class='pickupviewpanel'>
<component
v-if="inited && view.viewname && !Object.is(view.viewname, '')"
:is="view.viewname"
class="viewcontainer3"
:viewdata="viewdata"
:viewparam="viewparam"
:viewDefaultUsage="false"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
@viewdataschange="onViewDatasChange"
@viewdatasactivated="viewDatasActivated"
@viewload="onViewLoad">
</component>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import SYS_PERMISSIONService from '@/service/sys-permission/sys-permission-service';
import MPickupViewpickupviewpanelService from './mpickup-viewpickupviewpanel-pickupviewpanel-service';
import MPickupViewpickupviewpanelModel from './mpickup-viewpickupviewpanel-pickupviewpanel-model';
@Component({
components: {
}
})
export default class MPickupViewpickupviewpanelBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MPickupViewpickupviewpanel
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof MPickupViewpickupviewpanel
*/
public getControlType(): string {
return 'PICKUPVIEWPANEL'
}
/**
* 建构部件服务对象
*
* @type {MPickupViewpickupviewpanelService}
* @memberof MPickupViewpickupviewpanel
*/
public service: MPickupViewpickupviewpanelService = new MPickupViewpickupviewpanelService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {SYS_PERMISSIONService}
* @memberof MPickupViewpickupviewpanel
*/
public appEntityService: SYS_PERMISSIONService = new SYS_PERMISSIONService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof MPickupViewpickupviewpanel
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof MPickupViewpickupviewpanel
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 选中数据字符串
*
* @type {string}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public selectedData?: string;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof MPickupViewpickupviewpanel
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof MPickupViewpickupviewpanel
*/
public getData(): any {
return {};
}
/**
* 视图名称
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
public view: any = {
viewname: 'sys-permissionpickup-grid-view',
data: {},
}
/**
* 视图数据
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
public viewdata: string = JSON.stringify(this.context);
/**
* 视图参数
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public viewparam: string = JSON.stringify(this.viewparams);
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public isSingleSelect?: boolean;
/**
* 初始化完成
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
public inited: boolean = false;
/**
* 视图数据变化
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public onViewDatasChange($event: any): void {
if($event.length>0){
$event.forEach((item:any,index:any) => {
let srfmajortext = item['permissionname'];
if(srfmajortext){
Object.assign($event[index],{srfmajortext: srfmajortext});
}
});
}
this.$emit('selectionchange', $event);
}
/**
* 视图数据被激活
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public viewDatasActivated($event: any): void {
this.$emit('activated', $event);
}
/**
* 视图加载完成
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public onViewLoad($event: any): void {
this.$emit('load', $event);
}
/**
* vue 生命周期
*
* @memberof MPickupViewpickupviewpanel
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof MPickupViewpickupviewpanel
*/
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.viewdata = JSON.stringify(this.context);
this.viewparam = JSON.stringify(Object.assign(data, this.viewparams));
this.inited = true;
}
});
}
}
/**
* vue 生命周期
*
* @memberof MPickupViewpickupviewpanel
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof MPickupViewpickupviewpanel
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
}
</script>
<style lang='less'>
@import './mpickup-viewpickupviewpanel-pickupviewpanel.less';
</style>
\ No newline at end of file
/**
* MPickupViewpickupviewpanel 部件模型
*
* @export
* @class MPickupViewpickupviewpanelModel
*/
export default class MPickupViewpickupviewpanelModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MPickupViewpickupviewpanelModel
*/
public getDataItems(): any[] {
return [
{
name: 'sys_permission',
prop: 'permissionid',
},
{
name: 'permissionname',
},
{
name: 'pssystemid',
},
{
name: 'permissiontype',
},
{
name: 'enable',
},
{
name: 'createdate',
},
{
name: 'updatedate',
},
{
name: 'pssourcename',
},
{
name: 'pssourcetype',
},
]
}
}
\ No newline at end of file
import { Http } from '@/utils';
import ControlService from '@/widgets/control-service';
/**
* MPickupViewpickupviewpanel 部件服务对象
*
* @export
* @class MPickupViewpickupviewpanelService
*/
export default class MPickupViewpickupviewpanelService extends ControlService {
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import MPickupViewpickupviewpanelBase from './mpickup-viewpickupviewpanel-pickupviewpanel-base.vue';
@Component({
components: {
}
})
export default class MPickupViewpickupviewpanel extends MPickupViewpickupviewpanelBase {
}
</script>
\ No newline at end of file
<template>
<div class='pickupviewpanel'>
<component
v-if="inited && view.viewname && !Object.is(view.viewname, '')"
:is="view.viewname"
class="viewcontainer3"
:viewdata="viewdata"
:viewparam="viewparam"
:viewDefaultUsage="false"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
@viewdataschange="onViewDatasChange"
@viewdatasactivated="viewDatasActivated"
@viewload="onViewLoad">
</component>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import SYS_ROLEService from '@/service/sys-role/sys-role-service';
import MPickupViewpickupviewpanelService from './mpickup-viewpickupviewpanel-pickupviewpanel-service';
import MPickupViewpickupviewpanelModel from './mpickup-viewpickupviewpanel-pickupviewpanel-model';
@Component({
components: {
}
})
export default class MPickupViewpickupviewpanelBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MPickupViewpickupviewpanel
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof MPickupViewpickupviewpanel
*/
public getControlType(): string {
return 'PICKUPVIEWPANEL'
}
/**
* 建构部件服务对象
*
* @type {MPickupViewpickupviewpanelService}
* @memberof MPickupViewpickupviewpanel
*/
public service: MPickupViewpickupviewpanelService = new MPickupViewpickupviewpanelService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {SYS_ROLEService}
* @memberof MPickupViewpickupviewpanel
*/
public appEntityService: SYS_ROLEService = new SYS_ROLEService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof MPickupViewpickupviewpanel
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof MPickupViewpickupviewpanel
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 选中数据字符串
*
* @type {string}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public selectedData?: string;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof MPickupViewpickupviewpanel
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof MPickupViewpickupviewpanel
*/
public getData(): any {
return {};
}
/**
* 视图名称
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
public view: any = {
viewname: 'sys-rolepickup-grid-view',
data: {},
}
/**
* 视图数据
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
public viewdata: string = JSON.stringify(this.context);
/**
* 视图参数
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public viewparam: string = JSON.stringify(this.viewparams);
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public isSingleSelect?: boolean;
/**
* 初始化完成
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
public inited: boolean = false;
/**
* 视图数据变化
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public onViewDatasChange($event: any): void {
if($event.length>0){
$event.forEach((item:any,index:any) => {
let srfmajortext = item['rolename'];
if(srfmajortext){
Object.assign($event[index],{srfmajortext: srfmajortext});
}
});
}
this.$emit('selectionchange', $event);
}
/**
* 视图数据被激活
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public viewDatasActivated($event: any): void {
this.$emit('activated', $event);
}
/**
* 视图加载完成
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public onViewLoad($event: any): void {
this.$emit('load', $event);
}
/**
* vue 生命周期
*
* @memberof MPickupViewpickupviewpanel
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof MPickupViewpickupviewpanel
*/
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.viewdata = JSON.stringify(this.context);
this.viewparam = JSON.stringify(Object.assign(data, this.viewparams));
this.inited = true;
}
});
}
}
/**
* vue 生命周期
*
* @memberof MPickupViewpickupviewpanel
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof MPickupViewpickupviewpanel
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
}
</script>
<style lang='less'>
@import './mpickup-viewpickupviewpanel-pickupviewpanel.less';
</style>
\ No newline at end of file
/**
* MPickupViewpickupviewpanel 部件模型
*
* @export
* @class MPickupViewpickupviewpanelModel
*/
export default class MPickupViewpickupviewpanelModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MPickupViewpickupviewpanelModel
*/
public getDataItems(): any[] {
return [
{
name: 'sys_role',
prop: 'roleid',
},
{
name: 'rolename',
},
{
name: 'memo',
},
{
name: 'createdate',
},
{
name: 'updatedate',
},
]
}
}
\ No newline at end of file
import { Http } from '@/utils';
import ControlService from '@/widgets/control-service';
/**
* MPickupViewpickupviewpanel 部件服务对象
*
* @export
* @class MPickupViewpickupviewpanelService
*/
export default class MPickupViewpickupviewpanelService extends ControlService {
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import MPickupViewpickupviewpanelBase from './mpickup-viewpickupviewpanel-pickupviewpanel-base.vue';
@Component({
components: {
}
})
export default class MPickupViewpickupviewpanel extends MPickupViewpickupviewpanelBase {
}
</script>
\ No newline at end of file
<template>
<div class='pickupviewpanel'>
<component
v-if="inited && view.viewname && !Object.is(view.viewname, '')"
:is="view.viewname"
class="viewcontainer3"
:viewdata="viewdata"
:viewparam="viewparam"
:viewDefaultUsage="false"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
@viewdataschange="onViewDatasChange"
@viewdatasactivated="viewDatasActivated"
@viewload="onViewLoad">
</component>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import SYS_USERService from '@/service/sys-user/sys-user-service';
import MPickupViewpickupviewpanelService from './mpickup-viewpickupviewpanel-pickupviewpanel-service';
import MPickupViewpickupviewpanelModel from './mpickup-viewpickupviewpanel-pickupviewpanel-model';
@Component({
components: {
}
})
export default class MPickupViewpickupviewpanelBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MPickupViewpickupviewpanel
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof MPickupViewpickupviewpanel
*/
public getControlType(): string {
return 'PICKUPVIEWPANEL'
}
/**
* 建构部件服务对象
*
* @type {MPickupViewpickupviewpanelService}
* @memberof MPickupViewpickupviewpanel
*/
public service: MPickupViewpickupviewpanelService = new MPickupViewpickupviewpanelService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {SYS_USERService}
* @memberof MPickupViewpickupviewpanel
*/
public appEntityService: SYS_USERService = new SYS_USERService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof MPickupViewpickupviewpanel
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof MPickupViewpickupviewpanel
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 选中数据字符串
*
* @type {string}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public selectedData?: string;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof MPickupViewpickupviewpanel
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof MPickupViewpickupviewpanel
*/
public getData(): any {
return {};
}
/**
* 视图名称
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
public view: any = {
viewname: 'sys-userpickup-grid-view',
data: {},
}
/**
* 视图数据
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
public viewdata: string = JSON.stringify(this.context);
/**
* 视图参数
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public viewparam: string = JSON.stringify(this.viewparams);
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public isSingleSelect?: boolean;
/**
* 初始化完成
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
public inited: boolean = false;
/**
* 视图数据变化
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public onViewDatasChange($event: any): void {
if($event.length>0){
$event.forEach((item:any,index:any) => {
let srfmajortext = item['personname'];
if(srfmajortext){
Object.assign($event[index],{srfmajortext: srfmajortext});
}
});
}
this.$emit('selectionchange', $event);
}
/**
* 视图数据被激活
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public viewDatasActivated($event: any): void {
this.$emit('activated', $event);
}
/**
* 视图加载完成
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public onViewLoad($event: any): void {
this.$emit('load', $event);
}
/**
* vue 生命周期
*
* @memberof MPickupViewpickupviewpanel
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof MPickupViewpickupviewpanel
*/
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.viewdata = JSON.stringify(this.context);
this.viewparam = JSON.stringify(Object.assign(data, this.viewparams));
this.inited = true;
}
});
}
}
/**
* vue 生命周期
*
* @memberof MPickupViewpickupviewpanel
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof MPickupViewpickupviewpanel
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
}
</script>
<style lang='less'>
@import './mpickup-viewpickupviewpanel-pickupviewpanel.less';
</style>
\ No newline at end of file
/**
* MPickupViewpickupviewpanel 部件模型
*
* @export
* @class MPickupViewpickupviewpanelModel
*/
export default class MPickupViewpickupviewpanelModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MPickupViewpickupviewpanelModel
*/
public getDataItems(): any[] {
return [
{
name: 'sys_user',
prop: 'userid',
},
{
name: 'username',
},
{
name: 'personname',
},
{
name: 'password',
},
]
}
}
\ No newline at end of file
import { Http } from '@/utils';
import ControlService from '@/widgets/control-service';
/**
* MPickupViewpickupviewpanel 部件服务对象
*
* @export
* @class MPickupViewpickupviewpanelService
*/
export default class MPickupViewpickupviewpanelService extends ControlService {
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import MPickupViewpickupviewpanelBase from './mpickup-viewpickupviewpanel-pickupviewpanel-base.vue';
@Component({
components: {
}
})
export default class MPickupViewpickupviewpanel extends MPickupViewpickupviewpanelBase {
}
</script>
\ No newline at end of file
<template>
<div class='pickupviewpanel'>
<component
v-if="inited && view.viewname && !Object.is(view.viewname, '')"
:is="view.viewname"
class="viewcontainer3"
:viewdata="viewdata"
:viewparam="viewparam"
:viewDefaultUsage="false"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
@viewdataschange="onViewDatasChange"
@viewdatasactivated="viewDatasActivated"
@viewload="onViewLoad">
</component>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import WFGroupService from '@/service/wfgroup/wfgroup-service';
import MPickupViewpickupviewpanelService from './mpickup-viewpickupviewpanel-pickupviewpanel-service';
import MPickupViewpickupviewpanelModel from './mpickup-viewpickupviewpanel-pickupviewpanel-model';
@Component({
components: {
}
})
export default class MPickupViewpickupviewpanelBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MPickupViewpickupviewpanel
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof MPickupViewpickupviewpanel
*/
public getControlType(): string {
return 'PICKUPVIEWPANEL'
}
/**
* 建构部件服务对象
*
* @type {MPickupViewpickupviewpanelService}
* @memberof MPickupViewpickupviewpanel
*/
public service: MPickupViewpickupviewpanelService = new MPickupViewpickupviewpanelService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {WFGroupService}
* @memberof MPickupViewpickupviewpanel
*/
public appEntityService: WFGroupService = new WFGroupService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof MPickupViewpickupviewpanel
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof MPickupViewpickupviewpanel
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 选中数据字符串
*
* @type {string}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public selectedData?: string;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof MPickupViewpickupviewpanel
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof MPickupViewpickupviewpanel
*/
public getData(): any {
return {};
}
/**
* 视图名称
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
public view: any = {
viewname: 'wfgroup-pickup-grid-view',
data: {},
}
/**
* 视图数据
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
public viewdata: string = JSON.stringify(this.context);
/**
* 视图参数
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public viewparam: string = JSON.stringify(this.viewparams);
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public isSingleSelect?: boolean;
/**
* 初始化完成
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
public inited: boolean = false;
/**
* 视图数据变化
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public onViewDatasChange($event: any): void {
if($event.length>0){
$event.forEach((item:any,index:any) => {
let srfmajortext = item['name'];
if(srfmajortext){
Object.assign($event[index],{srfmajortext: srfmajortext});
}
});
}
this.$emit('selectionchange', $event);
}
/**
* 视图数据被激活
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public viewDatasActivated($event: any): void {
this.$emit('activated', $event);
}
/**
* 视图加载完成
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public onViewLoad($event: any): void {
this.$emit('load', $event);
}
/**
* vue 生命周期
*
* @memberof MPickupViewpickupviewpanel
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof MPickupViewpickupviewpanel
*/
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.viewdata = JSON.stringify(this.context);
this.viewparam = JSON.stringify(Object.assign(data, this.viewparams));
this.inited = true;
}
});
}
}
/**
* vue 生命周期
*
* @memberof MPickupViewpickupviewpanel
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof MPickupViewpickupviewpanel
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
}
</script>
<style lang='less'>
@import './mpickup-viewpickupviewpanel-pickupviewpanel.less';
</style>
\ No newline at end of file
/**
* MPickupViewpickupviewpanel 部件模型
*
* @export
* @class MPickupViewpickupviewpanelModel
*/
export default class MPickupViewpickupviewpanelModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MPickupViewpickupviewpanelModel
*/
public getDataItems(): any[] {
return [
{
name: 'wfgroup',
prop: 'id',
},
{
name: 'name',
},
{
name: 'groupscope',
},
]
}
}
\ No newline at end of file
import { Http } from '@/utils';
import ControlService from '@/widgets/control-service';
/**
* MPickupViewpickupviewpanel 部件服务对象
*
* @export
* @class MPickupViewpickupviewpanelService
*/
export default class MPickupViewpickupviewpanelService extends ControlService {
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import MPickupViewpickupviewpanelBase from './mpickup-viewpickupviewpanel-pickupviewpanel-base.vue';
@Component({
components: {
}
})
export default class MPickupViewpickupviewpanel extends MPickupViewpickupviewpanelBase {
}
</script>
\ No newline at end of file
<template>
<div class='pickupviewpanel'>
<component
v-if="inited && view.viewname && !Object.is(view.viewname, '')"
:is="view.viewname"
class="viewcontainer3"
:viewdata="viewdata"
:viewparam="viewparam"
:viewDefaultUsage="false"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
@viewdataschange="onViewDatasChange"
@viewdatasactivated="viewDatasActivated"
@viewload="onViewLoad">
</component>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import WFUserService from '@/service/wfuser/wfuser-service';
import MPickupViewpickupviewpanelService from './mpickup-viewpickupviewpanel-pickupviewpanel-service';
import MPickupViewpickupviewpanelModel from './mpickup-viewpickupviewpanel-pickupviewpanel-model';
@Component({
components: {
}
})
export default class MPickupViewpickupviewpanelBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MPickupViewpickupviewpanel
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof MPickupViewpickupviewpanel
*/
public getControlType(): string {
return 'PICKUPVIEWPANEL'
}
/**
* 建构部件服务对象
*
* @type {MPickupViewpickupviewpanelService}
* @memberof MPickupViewpickupviewpanel
*/
public service: MPickupViewpickupviewpanelService = new MPickupViewpickupviewpanelService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {WFUserService}
* @memberof MPickupViewpickupviewpanel
*/
public appEntityService: WFUserService = new WFUserService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof MPickupViewpickupviewpanel
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof MPickupViewpickupviewpanel
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 选中数据字符串
*
* @type {string}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public selectedData?: string;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof MPickupViewpickupviewpanel
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof MPickupViewpickupviewpanel
*/
public getData(): any {
return {};
}
/**
* 视图名称
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
public view: any = {
viewname: 'wfuser-pickup-grid-view',
data: {},
}
/**
* 视图数据
*
* @type {*}
* @memberof MPickupViewpickupviewpanel
*/
public viewdata: string = JSON.stringify(this.context);
/**
* 视图参数
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public viewparam: string = JSON.stringify(this.viewparams);
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
@Prop() public isSingleSelect?: boolean;
/**
* 初始化完成
*
* @type {boolean}
* @memberof MPickupViewpickupviewpanel
*/
public inited: boolean = false;
/**
* 视图数据变化
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public onViewDatasChange($event: any): void {
if($event.length>0){
$event.forEach((item:any,index:any) => {
let srfmajortext = item['displayname'];
if(srfmajortext){
Object.assign($event[index],{srfmajortext: srfmajortext});
}
});
}
this.$emit('selectionchange', $event);
}
/**
* 视图数据被激活
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public viewDatasActivated($event: any): void {
this.$emit('activated', $event);
}
/**
* 视图加载完成
*
* @param {*} $event
* @memberof MPickupViewpickupviewpanel
*/
public onViewLoad($event: any): void {
this.$emit('load', $event);
}
/**
* vue 生命周期
*
* @memberof MPickupViewpickupviewpanel
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof MPickupViewpickupviewpanel
*/
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.viewdata = JSON.stringify(this.context);
this.viewparam = JSON.stringify(Object.assign(data, this.viewparams));
this.inited = true;
}
});
}
}
/**
* vue 生命周期
*
* @memberof MPickupViewpickupviewpanel
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof MPickupViewpickupviewpanel
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
}
</script>
<style lang='less'>
@import './mpickup-viewpickupviewpanel-pickupviewpanel.less';
</style>
\ No newline at end of file
/**
* MPickupViewpickupviewpanel 部件模型
*
* @export
* @class MPickupViewpickupviewpanelModel
*/
export default class MPickupViewpickupviewpanelModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MPickupViewpickupviewpanelModel
*/
public getDataItems(): any[] {
return [
{
name: 'wfuser',
prop: 'id',
},
{
name: 'firstname',
},
{
name: 'displayname',
},
]
}
}
\ No newline at end of file
import { Http } from '@/utils';
import ControlService from '@/widgets/control-service';
/**
* MPickupViewpickupviewpanel 部件服务对象
*
* @export
* @class MPickupViewpickupviewpanelService
*/
export default class MPickupViewpickupviewpanelService extends ControlService {
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import MPickupViewpickupviewpanelBase from './mpickup-viewpickupviewpanel-pickupviewpanel-base.vue';
@Component({
components: {
}
})
export default class MPickupViewpickupviewpanel extends MPickupViewpickupviewpanelBase {
}
</script>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册