yyuap-template
Version:
template project which is based on tinper
159 lines (150 loc) • 3.99 kB
JavaScript
import uiTemplate from "../src/startCreate/uiTemplate";
const url = "http://ms.pub-dev.caep";
let tempOption = {
orgunit:{
nexuskey: "orgunit",
funcnode: "org",
url,
templateComponentName: "orgunit",
hideButton: true,
afterInit:()=>{
},
onCancel:(params)=>{
params.doCancel();
},
// 删除行的回调方法
onDelete:(rowData)=>{
console.log(rowData);
},
// 当输入控件的值发生改变时回调此方法来进行一些关联性的赋值操作
handleComponentCallback:(params)=>{
console.log(params);
}
},
adminorg:{
nexuskey: "func_adminorg",
funcnode: "org",
url,
templateComponentName: "adminorg",
hideButton: true,
afterInit:()=>{
},
onCancel:(params)=>{
params.doCancel();
},
// 删除行的回调方法
onDelete:(rowData)=>{
console.log(rowData);
},
// 当输入控件的值发生改变时回调此方法来进行一些关联性的赋值操作
handleComponentCallback:(params)=>{
console.log(params);
}
},
financeorg:{
nexuskey: "func_financeorg",
funcnode: "org",
url,
templateComponentName: "financeorg",
hideButton: true,
afterInit:()=>{
},
onCancel:(params)=>{
params.doCancel();
},
// 删除行的回调方法
onDelete:(rowData)=>{
console.log(rowData);
},
// 当输入控件的值发生改变时回调此方法来进行一些关联性的赋值操作
handleComponentCallback:(params)=>{
console.log(params);
}
}
}
export let getTemplate = (otion) => {
if(!otion.id){
console.log("otion 设置中没有id属性");
return;
}
let newOption = tempOption[otion.id];
Object.assign(newOption,otion)
let _templates = null;
// otion.afterInit = ()=>{
// // editFlag?_templates.setFormEdit():_templates.setFormNotEdit();
// }
_templates = new uiTemplate(newOption);
_templates.startCreate();
return _templates;
};
/**
export let getUiTemplate = code => {
let option = {};
Object.assign(option,tempOption);
switch (code) {
case "orgunit":
option.onSave = (params)=>{
if (this.saveOrgData(params)) {
params.doSave();
if (this.props.create) {
history.push({
pathname: "/main/tree",
editFlag: false
});
}
}
}
break;
case "adminorg":
option.templateComponentName = "adminorg";
option.nexuskey = "func_adminorg";
option.funcnode = "org";
option.onSave = (params)=>{
params.doSave();
}
break;
case "financeorg":
option.templateComponentName = "financeorg";
option.nexuskey = "func_financeorg";
option.funcnode = "org";
option.onSave = (params)=>{
params.doSave();
}
break;
}
let obj ={};
obj["template"] = getTemplate(option);
return obj;
};
*/
// getAdminTemplate = () => {
// let { editFlag } = this.state;
// let self = this;
// this.templates["adminorg"].template = new uiTemplate({
// url: "http://workbench.yyuap.com",
// templateComponentName: "adminorg",
// nexuskey: "func_adminorg",
// funcnode: "org",
// hideButton: true,
// afterInit: function() {},
// // 保存的回调方法
// onSave: function(params) {
// console.log(params);
// params.doSave();
// },
// // 取消的回调方法
// onCancel: function(params) {
// params.doCancel();
// },
// // 删除行的回调方法
// onDelete: function(rowData) {
// // TODO 编写业务逻辑执行删除操作
// console.log(rowData);
// },
// // 当输入控件的值发生改变时回调此方法来进行一些关联性的赋值操作
// handleComponentCallback: function(params) {
// console.log(params);
// }
// });
// this.templates["adminorg"].template.startCreate();
// };