提交 4aca00bc 编写于 作者: ibizdev's avatar ibizdev

zhouweidong 发布系统代码 [ibz-lite,应用]

上级 cf997cd0
......@@ -129,6 +129,14 @@ export default {
},
},
gridviewtoolbar_toolbar: {
tbitem1_initds: {
caption: "初始化",
tip: "初始化",
},
tbitem2: {
caption: "-",
tip: "",
},
tbitem3: {
caption: "New",
tip: "New",
......
......@@ -128,6 +128,14 @@ export default {
},
},
gridviewtoolbar_toolbar: {
tbitem1_initds: {
caption: "初始化",
tip: "初始化",
},
tbitem2: {
caption: "-",
tip: "",
},
tbitem3: {
caption: "新建",
tip: "新建",
......
......@@ -12,6 +12,14 @@
<i-input v-show="!isExpandSearchForm" v-model="query" search enter-button @on-search="onSearch($event)" class='quick-search-input' style='max-width: 400px;padding-left: 24px' placeholder="数据源名称" />
<div class='pull-right'>
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem1_initds.visabled" :disabled="toolBarModels.tbitem1_initds.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem1_initds' }, $event)">
<i class=''></i>
<span class='caption'>{{$t('entities.dstdatasource.gridviewtoolbar_toolbar.tbitem1_initds.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.dstdatasource.gridviewtoolbar_toolbar.tbitem1_initds.tip')}}</div>
</tooltip>
<span class='seperator'>|</span>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem3.visabled" :disabled="toolBarModels.tbitem3.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem3' }, $event)">
<i class='fa fa-file-text-o'></i>
......@@ -369,6 +377,9 @@ export default class DstDataSourceGridViewBase extends Vue {
* @memberof DstDataSourceGridView
*/
public toolBarModels: any = {
tbitem1_initds: { name: 'tbitem1_initds', actiontarget: 'NONE', caption: '初始化', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'InitDS', target: 'SINGLEKEY' } },
tbitem2: { name: 'tbitem2', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem3: { name: 'tbitem3', actiontarget: 'NONE', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'New', target: '' } },
tbitem4: { name: 'tbitem4', actiontarget: 'NONE', caption: '编辑', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Edit', target: 'SINGLEKEY' } },
......@@ -744,6 +755,9 @@ export default class DstDataSourceGridViewBase extends Vue {
* @memberof DstDataSourceGridViewBase
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem1_initds')) {
this.toolbar_tbitem1_initds_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click(null, '', $event2);
}
......@@ -886,6 +900,35 @@ export default class DstDataSourceGridViewBase extends Vue {
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem1_initds_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.$refs.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
const curUIService:DstDataSourceUIService = new DstDataSourceUIService();
curUIService.DstDataSource_InitDS(datas,contextJO, paramJO, $event, xData,this,"DstDataSource");
}
/**
* 逻辑事件
*
......
......@@ -118,6 +118,70 @@ export default class DstDataSourceUIServiceBase extends UIService {
public initDeMainStateOPPrivsMap(){
}
/**
* 初始化
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async DstDataSource_InitDS(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, { dstdatasource: '%dstdatasource%' });
Object.assign(params, { ds_id: '%dstdatasource%' });
Object.assign(params, { ds_name: '%ds_name%' });
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:DstDataSourceService = new DstDataSourceService();
curService.InitDS(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;
return response;
}).catch((response: any) => {
if (response && response.status && response.data) {
actionContext.$Notice.error({ title: (actionContext.$t('app.commonWords.wrong') as string), desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
actionContext.$Notice.error({ title: (actionContext.$t('app.commonWords.wrong') as string), desc: (actionContext.$t('app.commonWords.sysException') as string) });
return;
}
return response;
});
};
backend();
}
/**
* 获取指定数据的重定向页面
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册