提交 0ee58f30 编写于 作者: ibizdev's avatar ibizdev

xignzi006 发布系统代码

上级 30db453a
......@@ -765,7 +765,29 @@ export default {
tip: "关闭",
},
},
gridviewtoolbar_toolbar: {
treegridexviewtoolbar_toolbar: {
deuiaction1: {
caption: "New",
tip: "New",
},
tbitem2: {
caption: "-",
tip: "",
},
tbitem4: {
caption: "Edit",
tip: "Edit {0}",
},
tbitem7: {
caption: "-",
tip: "",
},
tbitem8: {
caption: "Remove",
tip: "Remove {0}",
},
},
usablegridviewtoolbar_toolbar: {
tbitem1_openquickcreateview: {
caption: "新建",
tip: "新建",
......@@ -802,34 +824,20 @@ export default {
caption: "-",
tip: "",
},
tbitem19: {
caption: "Filter",
tip: "Filter",
},
},
treegridexviewtoolbar_toolbar: {
deuiaction1: {
caption: "New",
tip: "New",
},
tbitem2: {
caption: "-",
tip: "",
},
tbitem4: {
caption: "Edit",
tip: "Edit {0}",
tbitem14_inactive: {
caption: "停用",
tip: "停用",
},
tbitem7: {
tbitem15: {
caption: "-",
tip: "",
},
tbitem8: {
caption: "Remove",
tip: "Remove {0}",
tbitem19: {
caption: "Filter",
tip: "Filter",
},
},
usablegridviewtoolbar_toolbar: {
stopgridviewtoolbar_toolbar: {
tbitem1_openquickcreateview: {
caption: "新建",
tip: "新建",
......@@ -866,9 +874,9 @@ export default {
caption: "-",
tip: "",
},
tbitem14_inactive: {
caption: "停用",
tip: "停用",
tbitem14_active: {
caption: "激活",
tip: "激活",
},
tbitem15: {
caption: "-",
......@@ -879,7 +887,7 @@ export default {
tip: "Filter",
},
},
stopgridviewtoolbar_toolbar: {
gridviewtoolbar_toolbar: {
tbitem1_openquickcreateview: {
caption: "新建",
tip: "新建",
......@@ -916,14 +924,6 @@ export default {
caption: "-",
tip: "",
},
tbitem14_active: {
caption: "激活",
tip: "激活",
},
tbitem15: {
caption: "-",
tip: "",
},
tbitem19: {
caption: "Filter",
tip: "Filter",
......@@ -931,11 +931,9 @@ export default {
},
gradation_treeview: {
nodes: {
root: "默认根节点",
},
uiactions: {
account_openmaineditview: "编辑",
account_inactive: "停用",
account_remove: "删除",
},
},
};
\ No newline at end of file
......@@ -764,7 +764,29 @@ export default {
tip: "关闭",
},
},
gridviewtoolbar_toolbar: {
treegridexviewtoolbar_toolbar: {
deuiaction1: {
caption: "新建",
tip: "新建",
},
tbitem2: {
caption: "-",
tip: "",
},
tbitem4: {
caption: "编辑",
tip: "编辑",
},
tbitem7: {
caption: "-",
tip: "",
},
tbitem8: {
caption: "删除",
tip: "删除",
},
},
usablegridviewtoolbar_toolbar: {
tbitem1_openquickcreateview: {
caption: "新建",
tip: "新建",
......@@ -801,34 +823,20 @@ export default {
caption: "-",
tip: "",
},
tbitem19: {
caption: "过滤",
tip: "过滤",
},
},
treegridexviewtoolbar_toolbar: {
deuiaction1: {
caption: "新建",
tip: "新建",
},
tbitem2: {
caption: "-",
tip: "",
},
tbitem4: {
caption: "编辑",
tip: "编辑",
tbitem14_inactive: {
caption: "停用",
tip: "停用",
},
tbitem7: {
tbitem15: {
caption: "-",
tip: "",
},
tbitem8: {
caption: "删除",
tip: "删除",
tbitem19: {
caption: "过滤",
tip: "过滤",
},
},
usablegridviewtoolbar_toolbar: {
stopgridviewtoolbar_toolbar: {
tbitem1_openquickcreateview: {
caption: "新建",
tip: "新建",
......@@ -865,9 +873,9 @@ export default {
caption: "-",
tip: "",
},
tbitem14_inactive: {
caption: "停用",
tip: "停用",
tbitem14_active: {
caption: "激活",
tip: "激活",
},
tbitem15: {
caption: "-",
......@@ -878,7 +886,7 @@ export default {
tip: "过滤",
},
},
stopgridviewtoolbar_toolbar: {
gridviewtoolbar_toolbar: {
tbitem1_openquickcreateview: {
caption: "新建",
tip: "新建",
......@@ -915,14 +923,6 @@ export default {
caption: "-",
tip: "",
},
tbitem14_active: {
caption: "激活",
tip: "激活",
},
tbitem15: {
caption: "-",
tip: "",
},
tbitem19: {
caption: "过滤",
tip: "过滤",
......@@ -930,18 +930,13 @@ export default {
},
gradation_treeview: {
nodes: {
root: "默认根节点",
},
uiactions: {
account_openmaineditview: "编辑",
account_inactive: "停用",
account_remove: "删除",
},
},
gradation_treegridex: {
uiactions: {
account_openmaineditview: "编辑",
account_inactive: "停用",
account_remove: "删除",
},
},
};
\ No newline at end of file
......@@ -382,135 +382,6 @@ export default class AccountUIServiceBase extends UIService {
backend();
}
/**
* 编辑
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async Account_OpenMainEditView(args: any[], context:any = {} ,params: any={}, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let data: any = {};
let parentContext:any = {};
let parentViewParam:any = {};
const _this: any = actionContext;
const _args: any[] = Util.deepCopy(args);
const actionTarget: string | null = 'SINGLEKEY';
Object.assign(context, { account: '%account%' });
Object.assign(params, { accountid: '%account%' });
Object.assign(params, { accountname: '%accountname%' });
if(_this.context){
parentContext = _this.context;
}
if(_this.viewparams){
parentViewParam = _this.viewparams;
}
context = UIActionTool.handleContextParam(actionTarget,_args,parentContext,parentViewParam,context);
data = UIActionTool.handleActionParam(actionTarget,_args,parentContext,parentViewParam,params);
context = Object.assign({},actionContext.context,context);
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
Object.assign(data,parentObj);
Object.assign(context,parentObj);
let deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'accounts', parameterName: 'account' },
{ pathName: 'editview', parameterName: 'editview' },
];
const openIndexViewTab = (data: any) => {
const routePath = actionContext.$viewTool.buildUpRoutePath(actionContext.$route, context, deResParameters, parameters, _args, data);
actionContext.$router.push(routePath);
if (xData && xData.refresh && xData.refresh instanceof Function) {
xData.refresh(args);
}
return null;
}
openIndexViewTab(data);
}
/**
* 删除
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async Account_Remove(args: any[],context:any = {}, params:any = {}, $event?: any, xData?: any,actionContext?: any,srfParentDeName?:string){
let confirmResult:boolean = await new Promise((resolve: any, reject: any) => {
actionContext.$Modal.confirm({
title: '警告',
content: '确认删除?',
onOk: () => {resolve(true);},
onCancel: () => {resolve(false);}
});
});
if(!confirmResult){
return;
}
let data: any = {};
let parentContext:any = {};
let parentViewParam:any = {};
const _this: any = actionContext;
const _args: any[] = Util.deepCopy(args);
const actionTarget: string | null = 'SINGLEKEY';
Object.assign(context, { account: '%account%' });
Object.assign(params, { accountid: '%account%' });
Object.assign(params, { accountname: '%accountname%' });
if(_this.context){
parentContext = _this.context;
}
if(_this.viewparams){
parentViewParam = _this.viewparams;
}
context = UIActionTool.handleContextParam(actionTarget,_args,parentContext,parentViewParam,context);
data = UIActionTool.handleActionParam(actionTarget,_args,parentContext,parentViewParam,params);
context = Object.assign({},actionContext.context,context);
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
Object.assign(data,parentObj);
Object.assign(context,parentObj);
// 直接调实体服务需要转换的数据
if(context && context.srfsessionid){
context.srfsessionkey = context.srfsessionid;
delete context.srfsessionid;
}
const backend = () => {
const curService:AccountService = new AccountService();
curService.Remove(context,data, true).then((response: any) => {
if (!response || response.status !== 200) {
actionContext.$Notice.error({ title: '错误', desc: response.message });
return;
}
actionContext.$Notice.success({ title: '成功', desc: '删除成功' });
const _this: any = actionContext;
if (xData && xData.refresh && xData.refresh instanceof Function) {
xData.refresh(args);
}
return response;
}).catch((response: any) => {
if (!response || !response.status || !response.data) {
actionContext.$Notice.error({ title: '错误', desc: '系统异常!' });
return;
}
if (response.status === 401) {
return;
}
return response;
});
};
backend();
}
/**
* 编辑
*
......
......@@ -3,7 +3,6 @@ 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';
/**
......@@ -49,218 +48,6 @@ export class GradationTreegridexBase extends MainControlBase {
*/
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");
}
/**
* 显示处理提示
*
......@@ -331,6 +118,9 @@ export class GradationTreegridexBase extends MainControlBase {
* @memberof Gradation
*/
public getColumnValue(task: any, field: string) {
if(Object.is(task.id.split(';')[0], 'ROOT')) {
return task[field];
}
if(Object.is(task.id.split(';')[0], 'RootAccount')) {
return task[field];
}
......
......@@ -52,10 +52,6 @@ export default class GradationModel {
name: 'id',
prop: 'accountid'
},
{
name: 'telephone1',
prop: 'telephone1'
},
{
name: 'accountname',
prop: 'accountname'
......@@ -72,10 +68,6 @@ export default class GradationModel {
name: 'accountname',
prop: 'accountname'
},
{
name: 'telephone1',
prop: 'telephone1'
},
];
break;
}
......
!!!!模版产生代码错误:----
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
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import AccountService from '@/service/account/account-service';
import GradationModel from './gradation-treegridex-model';
import CodeListService from '@service/app/codelist-service';
import i18n from '@/locale';
/**
* Gradation 部件服务对象
*
* @export
* @class GradationService
*/
export default class GradationService extends ControlService {
/**
* 客户服务对象
*
* @type {AccountService}
* @memberof GradationService
*/
public appEntityService: AccountService = new AccountService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof GradationService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of GradationService.
*
* @param {*} [opts={}]
* @memberof GradationService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new GradationModel();
}
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof GradationService
*/
public codeListService:CodeListService = new CodeListService({ $store: this.getStore() });
/**
* 节点分隔符号
*
* @public
* @type {string}
* @memberof GradationService
*/
public TREENODE_SEPARATOR: string = ';';
/**
* 默认根节点节点分隔符号
*
* @public
* @type {string}
* @memberof GradationService
*/
public TREENODE_ROOT: string = 'ROOT';
/**
* RootAccount节点分隔符号
*
* @public
* @type {string}
* @memberof GradationService
*/
public TREENODE_ROOTACCOUNT: string = 'RootAccount';
/**
* ChildAccount节点分隔符号
*
* @public
* @type {string}
* @memberof GradationService
*/
public TREENODE_CHILDACCOUNT: string = 'ChildAccount';
/**
* 商品类别节点分隔符号
*
* @public
* @type {*}
* @memberof GradationService
*/
public dataModel: any = {
ROOT: {
},
RootAccount: {
accountname: {
prop: 'accountname',
default: null
},
},
ChildAccount: {
accountname: {
prop: 'accountname',
default: null
},
},
}
/**
* 获取节点数据
*
* @param {string} action
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof GradationService
*/
@Errorlog
public async getNodes(context:any = {},data: any = {}, isloading?: boolean): Promise<any> {
let { srfparentkey, srfcat, srfnodeid, srfnodefilter, query }: { srfparentkey: string, srfcat: string, srfnodeid: string, srfnodefilter: string, query:string } = data;
srfnodefilter = query ? query : srfnodefilter;
let list: any[] = [];
let filter: any = {};
let srfotherkey: string = '';
if (!srfnodeid || Object.is(srfnodeid, '#')) {
srfnodeid = this.TREENODE_ROOT;
} else {
srfotherkey = srfnodeid;
srfnodeid = srfnodeid.split('_#_')[0];
}
let strTreeNodeId: string = srfnodeid;
let strRealNodeId: string = '';
let bRootSelect: boolean = false;
let strNodeType: string | null = null;
let strRootSelectNode: string = '';
if (Object.is(strTreeNodeId, this.TREENODE_ROOT)) {
strNodeType = this.TREENODE_ROOT;
if (srfparentkey) {
strRealNodeId = srfparentkey;
}
} else {
let nPos = strTreeNodeId.indexOf(this.TREENODE_SEPARATOR);
if (nPos === -1) {
return Promise.reject({ status: 500, data: { title: '失败', message: `树节点${strTreeNodeId}标识无效` } });
}
strNodeType = strTreeNodeId.substring(0, nPos);
strRealNodeId = strTreeNodeId.substring(nPos + 1);
}
Object.assign(filter,
{
srfparentkey: srfparentkey,
srfcat: srfcat,
srfnodefilter: srfnodefilter,
strRealNodeId: strRealNodeId,
srfnodeid: srfnodeid,
srfotherkey: srfotherkey,
strNodeType: strNodeType,
viewparams: JSON.parse(JSON.stringify(data)).viewparams
}
);
// 分解节点标识
let nodeid: string[] = strRealNodeId.split(this.TREENODE_SEPARATOR);
for (let i = 0; i < nodeid.length; i++) {
switch (i) {
case 0:
Object.assign(filter, { nodeid: nodeid[0] });
break;
case 1:
Object.assign(filter, { nodeid2: nodeid[1] });
break;
case 2:
Object.assign(filter, { nodeid3: nodeid[2] });
break;
case 3:
Object.assign(filter, { nodeid4: nodeid[3] });
break;
default:
break;
}
}
if (Object.is(strNodeType, this.TREENODE_ROOT)) {
await this.fillRootNodeChilds(context,filter, list);
return Promise.resolve({ status: 200, data: list });
}
if (Object.is(strNodeType, this.TREENODE_ROOTACCOUNT)) {
await this.fillRootaccountNodeChilds(context,filter, list);
return Promise.resolve({ status: 200, data: list });
}
if (Object.is(strNodeType, this.TREENODE_CHILDACCOUNT)) {
await this.fillChildaccountNodeChilds(context,filter, list);
return Promise.resolve({ status: 200, data: list });
}
return Promise.resolve({ status: 500, data: { title: '失败', message: `树节点${strTreeNodeId}标识无效` } });
}
/**
* 填充 树视图节点[默认根节点]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof GradationService
*/
@Errorlog
public fillRootNodes(context:any={},filter: any, list: any[],rsNavContext?:any,rsNavParams?:any,rsParams?:any): Promise<any> {
context = this.handleResNavContext(context,filter,rsNavContext);
filter = this.handleResNavParams(context,filter,rsNavParams,rsParams);
return new Promise((resolve:any,reject:any) =>{
let treeNode: any = {};
Object.assign(treeNode, { text: 'entities.account.gradation_treegridex.nodes.root' });
Object.assign(treeNode, { isUseLangRes: true });
Object.assign(treeNode,{srfappctx:context});
Object.assign(treeNode, { srfmajortext: treeNode.text });
let strNodeId: string = 'ROOT';
Object.assign(treeNode, { srfkey: 'root' });
strNodeId += this.TREENODE_SEPARATOR;
strNodeId += 'root';
Object.assign(treeNode, { id: strNodeId + '_#_' + filter.srfnodeid });
Object.assign(treeNode, { collapsed: true });
Object.assign(treeNode, { leaf: false });
Object.assign(treeNode, { navparams: '{}' });
Object.assign(treeNode, { nodeid: treeNode.srfkey });
Object.assign(treeNode, { nodeid2: filter.strRealNodeId });
if(!Object.is(filter.srfnodeid, this.TREENODE_ROOT)) {
Object.assign(treeNode, { parentId: filter.srfotherkey });
}
list.push(treeNode);
resolve(list);
});
}
/**
* 填充 树视图节点[默认根节点]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof GradationService
*/
@Errorlog
public async fillRootNodeChilds(context:any={}, filter: any, list: any[]): Promise<any> {
if (filter.srfnodefilter && !Object.is(filter.srfnodefilter,"")) {
// 填充RootAccount
let RootaccountRsNavContext:any = {};
let RootaccountRsNavParams:any = {};
let RootaccountRsParams:any = {};
await this.fillRootaccountNodes(context, filter, list ,RootaccountRsNavContext,RootaccountRsNavParams,RootaccountRsParams);
} else {
// 填充RootAccount
let RootaccountRsNavContext:any = {};
let RootaccountRsNavParams:any = {};
let RootaccountRsParams:any = {};
await this.fillRootaccountNodes(context, filter, list ,RootaccountRsNavContext,RootaccountRsNavParams,RootaccountRsParams);
}
}
/**
* 填充 树视图节点[RootAccount]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof GradationService
*/
@Errorlog
public fillRootaccountNodes(context:any={},filter: any, list: any[],rsNavContext?:any,rsNavParams?:any,rsParams?:any): Promise<any> {
context = this.handleResNavContext(context,filter,rsNavContext);
filter = this.handleResNavParams(context,filter,rsNavParams,rsParams);
return new Promise((resolve:any,reject:any) =>{
let searchFilter: any = {};
Object.assign(searchFilter, { total: false });
let bFirst: boolean = true;
let records: any[] = [];
try {
this.searchRootaccount(context, searchFilter, filter).then((records:any) =>{
if(records && records.length >0){
records.forEach((entity: any) => {
let treeNode: any = {};
// 整理context
let strId: string = entity.accountid;
let strText: string = entity.accountname;
Object.assign(treeNode,{srfparentdename:'Account',srfparentkey:entity.accountid});
let tempContext:any = JSON.parse(JSON.stringify(context));
Object.assign(tempContext,{srfparentdename:'Account',srfparentkey:entity.accountid,account:strId})
Object.assign(treeNode,{srfappctx:tempContext});
Object.assign(treeNode,{'account':strId});
Object.assign(treeNode, { srfkey: strId });
Object.assign(treeNode, { text: strText, srfmajortext: strText });
let strNodeId: string = 'RootAccount';
strNodeId += this.TREENODE_SEPARATOR;
strNodeId += strId;
Object.assign(treeNode, { id: strNodeId + '_#_' + filter.srfnodeid });
Object.assign(treeNode, { collapsed: true });
Object.assign(treeNode, { leaf: false });
Object.assign(treeNode, { navparams: '{}' });
Object.assign(treeNode, { nodeid: treeNode.srfkey });
Object.assign(treeNode, { nodeid2: filter.strRealNodeId });
if(!Object.is(filter.srfnodeid, this.TREENODE_ROOT)) {
Object.assign(treeNode, { parentId: filter.srfotherkey });
}
for(let key in this.dataModel.RootAccount) {
let item = this.dataModel.RootAccount[key];
let propVal: any = entity[item.prop];
try {
let def: any = JSON.parse(item.default);
propVal = propVal != null ? propVal : def.value;
if (def.hasOwnProperty('bkcolor')) {
Object.assign(treeNode.style, { base: { fill: def.bkcolor, stroke: def.bkcolor }});
}
if (def.hasOwnProperty('color')) {
Object.assign(treeNode.style, { text: { color: def.color }});
}
} catch(e) {
propVal = propVal != null ? propVal : item.default
}
treeNode[key] = propVal
}
list.push(treeNode);
resolve(list);
bFirst = false;
});
}else{
resolve(list);
}
});
} catch (error) {
console.error(error);
}
});
}
/**
* 获取查询集合
*
* @public
* @param {any{}} context
* @param {*} searchFilter
* @param {*} filter
* @returns {any[]}
* @memberof TestEnetityDatasService
*/
@Errorlog
public searchRootaccount(context:any={}, searchFilter: any, filter: any): Promise<any> {
return new Promise((resolve:any,reject:any) =>{
if(filter.viewparams){
Object.assign(searchFilter,filter.viewparams);
}
if(!searchFilter.page){
Object.assign(searchFilter,{page:0});
}
if(!searchFilter.size){
Object.assign(searchFilter,{size:1000});
}
if(context && context.srfparentdename){
Object.assign(searchFilter,{srfparentdename:JSON.parse(JSON.stringify(context)).srfparentdename});
}
if(context && context.srfparentkey){
Object.assign(searchFilter,{srfparentkey:JSON.parse(JSON.stringify(context)).srfparentkey});
}
const _appEntityService: any = this.appEntityService;
let list: any[] = [];
if (_appEntityService['FetchRoot'] && _appEntityService['FetchRoot'] instanceof Function) {
const response: Promise<any> = _appEntityService['FetchRoot'](context, searchFilter, false);
response.then((response: any) => {
if (!response.status || response.status !== 200) {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询FetchRoot数据集异常!');
}
const data: any = response.data;
if (Object.keys(data).length > 0) {
list = JSON.parse(JSON.stringify(data));
resolve(list);
} else {
resolve([]);
}
}).catch((response: any) => {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询FetchRoot数据集异常!');
});
}
})
}
/**
* 填充 树视图节点[RootAccount]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof GradationService
*/
@Errorlog
public async fillRootaccountNodeChilds(context:any={}, filter: any, list: any[]): Promise<any> {
if (filter.srfnodefilter && !Object.is(filter.srfnodefilter,"")) {
} else {
}
}
/**
* 填充 树视图节点[ChildAccount]
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @param {*} rsNavContext
* @param {*} rsNavParams
* @param {*} rsParams
* @returns {Promise<any>}
* @memberof GradationService
*/
@Errorlog
public fillChildaccountNodes(context:any={},filter: any, list: any[],rsNavContext?:any,rsNavParams?:any,rsParams?:any): Promise<any> {
context = this.handleResNavContext(context,filter,rsNavContext);
filter = this.handleResNavParams(context,filter,rsNavParams,rsParams);
return new Promise((resolve:any,reject:any) =>{
let searchFilter: any = {};
Object.assign(searchFilter, { total: false });
let bFirst: boolean = true;
let records: any[] = [];
try {
this.searchChildaccount(context, searchFilter, filter).then((records:any) =>{
if(records && records.length >0){
records.forEach((entity: any) => {
let treeNode: any = {};
// 整理context
let strId: string = entity.accountid;
let strText: string = entity.accountname;
Object.assign(treeNode,{srfparentdename:'Account',srfparentkey:entity.accountid});
let tempContext:any = JSON.parse(JSON.stringify(context));
Object.assign(tempContext,{srfparentdename:'Account',srfparentkey:entity.accountid,account:strId})
Object.assign(treeNode,{srfappctx:tempContext});
Object.assign(treeNode,{'account':strId});
Object.assign(treeNode, { srfkey: strId });
Object.assign(treeNode, { text: strText, srfmajortext: strText });
let strNodeId: string = 'ChildAccount';
strNodeId += this.TREENODE_SEPARATOR;
strNodeId += strId;
Object.assign(treeNode, { id: strNodeId + '_#_' + filter.srfnodeid });
Object.assign(treeNode, { collapsed: true });
Object.assign(treeNode, { leaf: false });
Object.assign(treeNode, { navparams: '{}' });
Object.assign(treeNode, { nodeid: treeNode.srfkey });
Object.assign(treeNode, { nodeid2: filter.strRealNodeId });
if(!Object.is(filter.srfnodeid, this.TREENODE_ROOT)) {
Object.assign(treeNode, { parentId: filter.srfotherkey });
}
for(let key in this.dataModel.ChildAccount) {
let item = this.dataModel.ChildAccount[key];
let propVal: any = entity[item.prop];
try {
let def: any = JSON.parse(item.default);
propVal = propVal != null ? propVal : def.value;
if (def.hasOwnProperty('bkcolor')) {
Object.assign(treeNode.style, { base: { fill: def.bkcolor, stroke: def.bkcolor }});
}
if (def.hasOwnProperty('color')) {
Object.assign(treeNode.style, { text: { color: def.color }});
}
} catch(e) {
propVal = propVal != null ? propVal : item.default
}
treeNode[key] = propVal
}
list.push(treeNode);
resolve(list);
bFirst = false;
});
}else{
resolve(list);
}
});
} catch (error) {
console.error(error);
}
});
}
/**
* 获取查询集合
*
* @public
* @param {any{}} context
* @param {*} searchFilter
* @param {*} filter
* @returns {any[]}
* @memberof TestEnetityDatasService
*/
@Errorlog
public searchChildaccount(context:any={}, searchFilter: any, filter: any): Promise<any> {
return new Promise((resolve:any,reject:any) =>{
if(filter.viewparams){
Object.assign(searchFilter,filter.viewparams);
}
if(!searchFilter.page){
Object.assign(searchFilter,{page:0});
}
if(!searchFilter.size){
Object.assign(searchFilter,{size:1000});
}
if(context && context.srfparentdename){
Object.assign(searchFilter,{srfparentdename:JSON.parse(JSON.stringify(context)).srfparentdename});
}
if(context && context.srfparentkey){
Object.assign(searchFilter,{srfparentkey:JSON.parse(JSON.stringify(context)).srfparentkey});
}
const _appEntityService: any = this.appEntityService;
let list: any[] = [];
if (_appEntityService['FetchDefault'] && _appEntityService['FetchDefault'] instanceof Function) {
const response: Promise<any> = _appEntityService['FetchDefault'](context, searchFilter, false);
response.then((response: any) => {
if (!response.status || response.status !== 200) {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询FetchDefault数据集异常!');
}
const data: any = response.data;
if (Object.keys(data).length > 0) {
list = JSON.parse(JSON.stringify(data));
resolve(list);
} else {
resolve([]);
}
}).catch((response: any) => {
resolve([]);
console.log(JSON.stringify(context));
console.error('查询FetchDefault数据集异常!');
});
}
})
}
/**
* 填充 树视图节点[ChildAccount]子节点
*
* @public
* @param {any{}} context
* @param {*} filter
* @param {any[]} list
* @returns {Promise<any>}
* @memberof GradationService
*/
@Errorlog
public async fillChildaccountNodeChilds(context:any={}, filter: any, list: any[]): Promise<any> {
if (filter.srfnodefilter && !Object.is(filter.srfnodefilter,"")) {
} else {
}
}
/**
* 处理代码表返回数据(树状结构)
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof GradationService
*/
public handleDataSet(result:Array<any>,context:any,callBack:any){
let list:Array<any> = [];
if(result.length === 0){
return list;
}
result.forEach((codeItem:any) =>{
if(!codeItem.pvalue){
let valueField:string = codeItem.value;
this.setChildCodeItems(valueField,result,codeItem);
list.push(codeItem);
}
})
this.setNodeData(list,context,callBack);
return list;
}
/**
* 处理非根节点数据
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof GradationService
*/
public setChildCodeItems(pValue:string,result:Array<any>,codeItem:any){
result.forEach((item:any) =>{
if(item.pvalue == pValue){
let valueField:string = item.value;
this.setChildCodeItems(valueField,result,item);
if(!codeItem.children){
codeItem.children = [];
}
codeItem.children.push(item);
}
})
}
/**
* 设置节点UI数据
*
* @param result 返回数组
* @param context 应用上下文
* @param callBack 回调
* @memberof GradationService
*/
public setNodeData(result:Array<any>,context:any,callBack:any){
result.forEach((item:any) =>{
if(item.children){
item.leaf = false;
this.setNodeData(item.children,context,callBack);
}else{
item.leaf = true;
}
callBack(context,item);
})
}
/**
* 处理节点关系导航上下文
*
* @param context 应用上下文
* @param filter 参数
* @param resNavContext 节点关系导航上下文
*
* @memberof GradationService
*/
public handleResNavContext(context:any,filter:any,resNavContext:any){
if(resNavContext && Object.keys(resNavContext).length > 0){
let tempContextData:any = JSON.parse(JSON.stringify(context));
let tempViewParams:any = {};
if(filter && filter.viewparams){
tempViewParams = filter.viewparams;
}
Object.keys(resNavContext).forEach((item:any) =>{
let curDataObj:any = resNavContext[item];
this.handleCustomDataLogic(context,tempViewParams,curDataObj,tempContextData,item);
})
return tempContextData;
}else{
return context;
}
}
/**
* 处理关系导航参数
*
* @param context 应用上下文
* @param filter 参数
* @param resNavParams 节点关系导航参数
* @param resParams 节点关系参数
*
* @memberof GradationService
*/
public handleResNavParams(context:any,filter:any,resNavParams:any,resParams:any){
if((resNavParams && Object.keys(resNavParams).length >0) || (resParams && Object.keys(resParams).length >0)){
let tempViewParamData:any = {};
let tempViewParams:any = {};
if(filter && filter.viewparams){
tempViewParams = filter.viewparams;
tempViewParamData = JSON.parse(JSON.stringify(filter.viewparams));
}
if( Object.keys(resNavParams).length > 0){
Object.keys(resNavParams).forEach((item:any) =>{
let curDataObj:any = resNavParams[item];
this.handleCustomDataLogic(context,tempViewParams,curDataObj,tempViewParamData,item);
})
}
if( Object.keys(resParams).length > 0){
Object.keys(resParams).forEach((item:any) =>{
let curDataObj:any = resParams[item];
tempViewParamData[item.toLowerCase()] = curDataObj.value;
})
}
Object.assign(filter,{viewparams:tempViewParamData});
return filter;
}else{
return filter;
}
}
/**
* 处理自定义节点关系导航数据
*
* @param context 应用上下文
* @param viewparams 参数
* @param curNavData 节点关系导航参数对象
* @param tempData 返回数据
* @param item 节点关系导航参数键值
*
* @memberof GradationService
*/
public handleCustomDataLogic(context:any,viewparams:any,curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
}
\ No newline at end of file
......@@ -10,14 +10,9 @@
:select-on-indeterminate="isSingleSelect"
@current-change="select.apply(_self, arguments)"
>
<el-table-column show-overflow-tooltip prop="accountname" label="客户名称" :width="50" :align="''">
<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
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册