提交 734e9d2d 编写于 作者: neko's avatar neko

delete

上级 6434e651
import { Prop, Provide, Emit, Model } from 'vue-property-decorator';
import { Subject, Subscription } from 'rxjs';
import { Watch, MainControlBase } from '@/studio-core';
import AccountService from '@/service/account/account-service';
import GradationService from './gradation-treegridex-service';
import AccountUIService from '@/uiservice/account/account-ui-service';
/**
* treegridex部件基类
*
* @export
* @class MainControlBase
* @extends {GradationTreegridexBase}
*/
export class GradationTreegridexBase extends MainControlBase {
/**
* 建构部件服务对象
*
* @type {GradationService}
* @memberof GradationTreegridexBase
*/
public service: GradationService = new GradationService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {AccountService}
* @memberof GradationTreegridexBase
*/
public appEntityService: AccountService = new AccountService({ $store: this.$store });
/**
* 应用实体名称
*
* @protected
* @type {string}
* @memberof GradationTreegridexBase
*/
protected appDeName: string = 'account';
/**
* childaccount_cm 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof GradationTreegridexBase
*/
public childaccount_cm_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'deuiaction1')) {
this.childaccount_cm_deuiaction1_click(null, 'childaccount_cm', $event2);
}
if (Object.is($event.tag, 'deuiaction3')) {
this.childaccount_cm_deuiaction3_click(null, 'childaccount_cm', $event2);
}
if (Object.is($event.tag, 'deuiaction2')) {
this.childaccount_cm_deuiaction2_click(null, 'childaccount_cm', $event2);
}
}
/**
* rootaccount_cm 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof GradationTreegridexBase
*/
public rootaccount_cm_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'deuiaction1')) {
this.rootaccount_cm_deuiaction1_click(null, 'rootaccount_cm', $event2);
}
if (Object.is($event.tag, 'deuiaction3')) {
this.rootaccount_cm_deuiaction3_click(null, 'rootaccount_cm', $event2);
}
if (Object.is($event.tag, 'deuiaction2')) {
this.rootaccount_cm_deuiaction2_click(null, 'rootaccount_cm', $event2);
}
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public rootaccount_cm_deuiaction1_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this;
if (_this.getDatas && _this.getDatas instanceof Function) {
datas = [..._this.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
const curUIService:AccountUIService = new AccountUIService();
curUIService.Account_OpenMainEditView(datas,contextJO, paramJO, $event, xData,this,"Account");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public rootaccount_cm_deuiaction3_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this;
if (_this.getDatas && _this.getDatas instanceof Function) {
datas = [..._this.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
const curUIService:AccountUIService = new AccountUIService();
curUIService.Account_Inactive(datas,contextJO, paramJO, $event, xData,this,"Account");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public rootaccount_cm_deuiaction2_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this;
if (_this.getDatas && _this.getDatas instanceof Function) {
datas = [..._this.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
const curUIService:AccountUIService = new AccountUIService();
curUIService.Account_Remove(datas,contextJO, paramJO, $event, xData,this,"Account");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public childaccount_cm_deuiaction1_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this;
if (_this.getDatas && _this.getDatas instanceof Function) {
datas = [..._this.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
const curUIService:AccountUIService = new AccountUIService();
curUIService.Account_OpenMainEditView(datas,contextJO, paramJO, $event, xData,this,"Account");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public childaccount_cm_deuiaction3_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this;
if (_this.getDatas && _this.getDatas instanceof Function) {
datas = [..._this.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
const curUIService:AccountUIService = new AccountUIService();
curUIService.Account_Inactive(datas,contextJO, paramJO, $event, xData,this,"Account");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public childaccount_cm_deuiaction2_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this;
if (_this.getDatas && _this.getDatas instanceof Function) {
datas = [..._this.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
const curUIService:AccountUIService = new AccountUIService();
curUIService.Account_Remove(datas,contextJO, paramJO, $event, xData,this,"Account");
}
/**
* 显示处理提示
*
* @type {boolean}
* @memberof Gradation
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--load
*
* @type {string}
* @memberof Gradation
*/
@Prop() public loadAction!: string;
/**
* 是否单选
*
* @type {boolean}
* @memberof Gradation
*/
@Prop({ default: true }) public isSingleSelect!: boolean;
/**
* 部件样式名
*
* @public
* @type {any[]}
* @memberof Gradation
*/
public controlClass: string = "treegridex";
/**
* 数据集合
*
* @public
* @type {any[]}
* @memberof Gradation
*/
public items: any[] = [];
/**
* 默认展开节点集合
*
* @memberof Gradation
*/
public defExpands: any = [];
/**
* 行节点下标
*
* @memberof Gradation
*/
public itemNum: any = {};
/**
* 计数下标
*
* @memberof Gradation
*/
public num: number = 0;
/**
* 获取列属性值
*
* @public
* @memberof Gradation
*/
public getColumnValue(task: any, field: string) {
if(Object.is(task.id.split(';')[0], 'RootAccount')) {
return task[field];
}
if(Object.is(task.id.split(';')[0], 'ChildAccount')) {
return task[field];
}
}
/**
* 获取代码项
*
* @public
* @memberof Gradation
*/
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 Gradation
*/
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 Gradation
*/
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 Gradation
*/
public itemExpand(item: any) {
}
/**
* 刷新
*
* @memberof Gradation
*/
public refresh() {
this.load();
}
/**
* 选中的数据
*
* @returns {any[]}
* @memberof Gradation
*/
public selections: any[] = [];
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof Gradation
*/
public getDatas(): any[] {
return this.selections;
}
/**
* 获取单项树
*
* @returns {*}
* @memberof Gradation
*/
public getData(): any {
return null;
}
/**
* vue 生命周期
*
* @returns
* @memberof Gradation
*/
public created() {
this.load();
}
/**
* 设置行Class
*
* @returns
* @memberof Gradation
*/
public setRowClass({row, rowIndex}: {row: any, rowIndex: number}) {
return 'treegrid' + this.itemNum[row.id];
}
/**
* 展开默认节点
*
* @returns
* @memberof Gradation
*/
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 Gradation
*/
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
/**
* Gradation 部件模型
*
* @export
* @class GradationModel
*/
export default class GradationModel {
/**
* 日历项类型
*
* @returns {any[]}
* @memberof GradationTreegridexMode
*/
public itemType: string = "";
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof GradationTreegridexMode
*/
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 "RootAccount":
dataItems = [...dataItems,
{
name: 'id',
prop: 'accountid'
},
];
break;
case "ChildAccount":
dataItems = [...dataItems,
{
name: 'id',
prop: 'accountid'
},
];
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: ${srfclassname(ctrl.getRootPSDETreeNo... [in template "TEMPLCODE_zh_CN" at line 198, column 28]
----
\ 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-column show-overflow-tooltip prop="accountname" label="客户名称" :width="50" :align="''">
<template v-slot="{ row }">
<span>{{ getColumnValue(row, 'accountname') }}</span>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="telephone1" label="主要电话" :width="100" :align="''">
<template v-slot="{ row }">
<span>{{ getColumnValue(row, 'telephone1') }}</span>
</template>
</el-table-column>
</el-table>
\ No newline at end of file
<template src="./gradation-treegridex.html"/>
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import { VueLifeCycleProcessing } from '@/studio-core';
import { GradationTreegridexBase } from './gradation-treegridex-base';
/**
* treegridex部件
*
* @export
* @class GradationTreegridex
* @extends {GradationTreegridexBase}
*/
@Component({
components: {
}
})
@VueLifeCycleProcessing()
export default class GradationTreegridex extends GradationTreegridexBase { }
</script>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册