提交 44cc6d0b 编写于 作者: misaka's avatar misaka

delete

上级 cab8cac6
import { Prop, Provide, Emit, Model } from 'vue-property-decorator';
import { Subject, Subscription } from 'rxjs';
import { Watch, MainControlBase } from '@/studio-core';
import ChannelContentService from './channel-content-treegridex-service';
/**
* treegridex部件基类
*
* @export
* @class MainControlBase
* @extends {ChannelContentTreegridexBase}
*/
export class ChannelContentTreegridexBase extends MainControlBase {
/**
* 获取部件类型
*
* @protected
* @type {string}
* @memberof ChannelContentTreegridexBase
*/
protected controlType: string = 'TREEGRIDEX';
/**
* 建构部件服务对象
*
* @type {ChannelContentService}
* @memberof ChannelContentTreegridexBase
*/
public service: ChannelContentService = new ChannelContentService({ $store: this.$store });
/**
* 显示处理提示
*
* @type {boolean}
* @memberof ChannelContent
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--load
*
* @type {string}
* @memberof ChannelContent
*/
@Prop() public loadAction!: string;
/**
* 是否单选
*
* @type {boolean}
* @memberof ChannelContent
*/
@Prop({ default: true }) public isSingleSelect!: boolean;
/**
* 部件样式名
*
* @public
* @type {any[]}
* @memberof ChannelContent
*/
public controlClass: string = "treegridex";
/**
* 数据集合
*
* @public
* @type {any[]}
* @memberof ChannelContent
*/
public items: any[] = [];
/**
* 默认展开节点集合
*
* @memberof ChannelContent
*/
public defExpands: any = [];
/**
* 行节点下标
*
* @memberof ChannelContent
*/
public itemNum: any = {};
/**
* 计数下标
*
* @memberof ChannelContent
*/
public num: number = 0;
/**
* 获取列属性值
*
* @public
* @memberof ChannelContent
*/
public getColumnValue(task: any, field: string) {
if(Object.is(task.id.split(';')[0], 'ChildChannel')) {
return task[field];
}
if(Object.is(task.id.split(';')[0], 'RootChannel')) {
return task[field];
}
if(Object.is(task.id.split(';')[0], 'WEBSITE')) {
return task[field];
}
if(Object.is(task.id.split(';')[0], 'ROOT')) {
return task[field];
}
}
/**
* 获取代码项
*
* @public
* @memberof ChannelContent
*/
public getCodeListItem(codelist: any, val: any) {
for(let i = 0; i < codelist.items.length; i++) {
if(Object.is(codelist.items[i].value, val)) {
return codelist.items[i].text;
}
}
return codelist.emptytext;
}
/**
* 搜索获取日程事件
*
* @param {*} $event 日期信息
* @memberof ChannelContent
*/
public load(task: any = {}, resolve?: any) {
const params: any = {
srfnodeid: task && task.id ? task.id : "#",
srfnodefilter: ''
};
let tempViewParams:any = JSON.parse(JSON.stringify(this.viewparams));
let curNode:any = {};
this.$util.deepObjectMerge(curNode, task);
let tempContext:any = this.computecurNodeContext(curNode);
if(curNode && curNode.srfparentdename) {
Object.assign(tempContext,{ srfparentdename: curNode.srfparentdename });
Object.assign(tempViewParams,{ srfparentdename: curNode.srfparentdename });
}
if(curNode && curNode.srfparentkey) {
Object.assign(tempContext,{ srfparentkey: curNode.srfparentkey });
Object.assign(tempViewParams,{ srfparentkey: curNode.srfparentkey });
}
Object.assign(params,{viewparams:tempViewParams});
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: "错误", desc: response.info });
return;
}
response.data.forEach((item: any) => {
this.itemNum[item.id] = this.num++;
if(!item.collapsed) {
this.defExpands.push(item);
}
})
if(resolve && resolve instanceof Function) {
resolve(response.data);
} else {
this.items = [...response.data];
}
this.$nextTick(() => {
this.expandDefNode();
})
this.$emit("load", this.items);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: "错误", desc: response.info });
});
}
/**
* 加载节点
*
* @memberof TreeTable
*/
public loadTreeNode(tree: any, treeNode: any, resolve: any) {
this.load(tree, resolve);
}
/**
* 计算当前节点的上下文
*
* @param {*} curNode 当前节点
* @memberof ChannelContent
*/
public computecurNodeContext(curNode:any){
let tempContext:any = {};
if(curNode && curNode.data && curNode.data.srfappctx){
tempContext = JSON.parse(JSON.stringify(curNode.data.srfappctx));
}else{
tempContext = JSON.parse(JSON.stringify(this.context));
}
return tempContext;
}
/**
* 节点展开
*
* @param {*} item 当前节点
* @memberof ChannelContent
*/
public itemExpand(item: any) {
}
/**
* 刷新
*
* @memberof ChannelContent
*/
public refresh() {
this.load();
}
/**
* 选中的数据
*
* @returns {any[]}
* @memberof ChannelContent
*/
public selections: any[] = [];
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof ChannelContent
*/
public getDatas(): any[] {
return this.selections;
}
/**
* 获取单项树
*
* @returns {*}
* @memberof ChannelContent
*/
public getData(): any {
return null;
}
/**
* vue 生命周期
*
* @returns
* @memberof ChannelContent
*/
public created() {
this.load();
}
/**
* 设置行Class
*
* @returns
* @memberof ChannelContent
*/
public setRowClass({row, rowIndex}: {row: any, rowIndex: number}) {
return 'treegrid' + this.itemNum[row.id];
}
/**
* 展开默认节点
*
* @returns
* @memberof ChannelContent
*/
public expandDefNode() {
if(this.defExpands.length > 0) {
let item: any = this.defExpands[0];
this.defExpands.splice(0, 1);
let trs: any = this.$el.getElementsByClassName('treegrid' + this.itemNum[item.id]);
if(trs) {
let icons: any = trs[0].getElementsByClassName('el-table__expand-icon');
icons[0].click();
}
}
}
/**
* 选中变化
*
* @returns
* @memberof ChannelContent
*/
public select($event: any) {
if (!$event) {
return;
}
this.selections = [JSON.parse(JSON.stringify($event))];
this.$emit('selectionchange', this.selections);
}
}
\ No newline at end of file
/**
* ChannelContent 部件模型
*
* @export
* @class ChannelContentModel
*/
export default class ChannelContentModel {
/**
* 日历项类型
*
* @returns {any[]}
* @memberof ChannelContentTreegridexMode
*/
public itemType: string = "";
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof ChannelContentTreegridexMode
*/
public getDataItems(): any[] {
let dataItems: any = [
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
{
name: 'style',
},
{
name: 'textColor',
},
{
name: 'itemType',
},
{
name: 'parentId'
},
{
name: 'query',
prop: 'query',
},
];
switch(this.itemType){
case "ChildChannel":
dataItems = [...dataItems,
];
break;
case "RootChannel":
dataItems = [...dataItems,
];
break;
case "WEBSITE":
dataItems = [...dataItems,
];
break;
}
return dataItems;
}
}
\ No newline at end of file
!!!!模版产生代码错误:----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${appde.getCodeName()?lower_case} [in template "TEMPLCODE_zh_CN" at line 299, column 55]
----
\ No newline at end of file
<el-table ref="treegridex"
:data="items"
row-key="id"
border
lazy
height="100%"
:row-class-name="setRowClass"
:load="loadTreeNode.bind(_self)"
:tree-props="{ children: 'children', hasChildren: 'leaf' }"
:select-on-indeterminate="isSingleSelect"
@current-change="select.apply(_self, arguments)"
>
</el-table>
\ No newline at end of file
<template src="./channel-content-treegridex.html"/>
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import { VueLifeCycleProcessing } from '@/studio-core';
import { ChannelContentTreegridexBase } from './channel-content-treegridex-base';
/**
* treegridex部件
*
* @export
* @class ChannelContentTreegridex
* @extends {ChannelContentTreegridexBase}
*/
@Component({
components: {
}
})
@VueLifeCycleProcessing()
export default class ChannelContentTreegridex extends ChannelContentTreegridexBase { }
</script>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册