提交 16e59262 编写于 作者: U unknown

表单上加导入

上级 c7f4b500
......@@ -14,7 +14,12 @@
<td class="editTableValue"><input type="text" name="description" value="text{$.description}" class="editTableInput"/></td>
</tr>
</table>
<div style="height:24px; text-align: center; line-height: 24px; background-color: #EEE; border-top: 1px solid #999;">{{$.lp.outerSideModuleId}}</div>
<div style="height:24px; text-align: center; line-height: 24px; background-color: #EEE; border-top: 1px solid #999;position: relative;">
{{$.lp.outerSideModuleId}}
<div class="MWFHelp" style="position: absolute;height: 16px;width: 16px;top:4px;right:4px;background: url('../x_component_process_FormDesigner/$Main/default/formtoolbar/question.png')">
{{$.lp.datatemplateOuterNote}}
</div>
</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitleWithoutWith" width="80px">{{$.lp.addButtonId}}:</td>
......@@ -41,7 +46,12 @@
</td>
</tr>
</table>
<div style="height:24px; text-align: center; line-height: 24px; background-color: #EEE; border-top: 1px solid #999;">{{$.lp.innerSideModuleId}}</div>
<div style="height:24px; text-align: center; line-height: 24px; background-color: #EEE; border-top: 1px solid #999;position: relative;">
{{$.lp.innerSideModuleId}}
<div class="MWFHelp" style="position: absolute;height: 16px;width: 16px;top:4px;right:4px;background: url('../x_component_process_FormDesigner/$Main/default/formtoolbar/question.png')">
{{$.lp.datatemplateInnerNote}}
</div>
</div>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
<tr>
<td class="editTableTitleWithoutWith" width="80px">{{$.lp.addButtonId}}:</td>
......
......@@ -24,6 +24,24 @@
<td class="editTableTitle">{{$.lp.importModel}}:</td>
<td class="editTableValue"><div class="MWFQueryImportModelSelect" name="queryImportModel"></div></td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.downloadTempalte}}:</td>
<td class="editTableValue">
<input name="allowDownloadTempalte" type="radio" value="true" text{($.allowDownloadTempalte)!==false?'checked':''}
onclick="if (this.checked){ $('text{$.pid}downloadTempalteFieldIdTr').setStyle('display', '')}" />{{$.lp.enable}}
<input name="allowDownloadTempalte" type="radio" value="false" text{($.allowDownloadTempalte)===false?'checked':''}
onclick="if (this.checked){ $('text{$.pid}downloadTempalteFieldIdTr').setStyle('display', 'none')}" />{{$.lp.disable}}
</td>
</tr>
<tr id="text{$.pid}downloadTempalteFieldIdTr" style="display: text{($.allowDownloadTempalte!==false)?'':'none'};">
<td class="editTableTitle">{{$.lp.downloadTempalteId}}:</td>
<td class="editTableValue" style="position: relative;">
<input type="text" name="downloadTempalteFieldId" value="text{$.downloadTempalteFieldId}" class="editTableInputNoWidth" style="width:60%;margin-right: 16px;"/>
<div class="MWFHelp" style="position: absolute;height: 16px;width: 16px;top:4px;right:4px;background: url('../x_component_process_FormDesigner/$Main/default/formtoolbar/question.png')">
{{$.lp.downloadTempalteIdNote}}
</div>
</td>
</tr>
</table>
</div>
</div>
......
......@@ -14,6 +14,14 @@
"code": "",
"html": ""
},
"postLoad": {
"code": "",
"html": ""
},
"afterLoad": {
"code": "",
"html": ""
},
"beforeImport": {
"code": "",
"html": ""
......
......@@ -918,7 +918,12 @@ MWF.xApplication.process.FormDesigner.LP = {
"2. If there are multiple data templates, \"./fieldId\" means components at the same level as the current data template, \"../fieldId\" means components at the same level as the previous data template, and so on .<br/>" +
"3. If there is a multi-layer data template, you can also use \"datatemplateId.*.datatemplateId2.*.fieldId\" to indicate the full-level path. datatemplateId indicates the id of the first-level data template, and datatemplateId2 indicates the id of the second-level. ",
"datatemplateInnerNote": "Note: Regardless of single-layer or multi-layer data template, directly fill in the component ID.",
"importModel": "Import Model"
"importModel": "Import Model",
"enable": "enable",
"disable": "disable",
"downloadTempalte": "Download Template",
"downloadTempalteId": "Download template component ID",
"downloadTempalteIdNote": "You can create a component on the form and fill in the component ID here. The system will bind the click event of the download template to the node of the component."
},
"actionBar": {
"close":"Close",
......
......@@ -922,7 +922,12 @@ MWF.xApplication.process.FormDesigner.LP = {
"2、如果有多层数据模板,\"./fieldId\"表示和当前数据模板同层次的组件,\"../fieldId\"表示和上一层数据模板同层次的组件,以此类推。<br/>" +
"3、如果有多层数据模板,也可通过\"datatemplateId.*.datatemplateId2.*.fieldId\"来表示全层次路径。datatemplateId表示第一层数据模板的id,datatemplateId2表示第二层的id。",
"datatemplateInnerNote": "注: 不管单层还是多层数据模板,直接填写组件的标识。",
"importModel": "导入模型"
"importModel": "导入模型",
"enable": "启用",
"disable": "禁用",
"downloadTempalte": "下载模板",
"downloadTempalteId": "下载模板组件标识",
"downloadTempalteIdNote": "您可以在表单上创建一个组件,并在这里填写上组件标识,系统会在该组件的节点(node)绑定下载模板的click事件。"
},
"actionBar": {
"close":"关闭",
......
......@@ -471,6 +471,46 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
},
focus: function(){
this.node.focus();
},
_getModuleByPath: function( path ){
/*
注: 系统的数据中允许多层路径,id上通过..来区分层次:
1、单层或者是最外层,填"fieldId",表示表单上的直接组件。
2、如果有多层数据模板,"./fieldId"表示和当前组件id同层次的组件,"../fieldId"表示和上一层组件同层次的组件,以此类推。
3、如果有多层数据模板,也可通过"datatemplateId.*.datatemplateId2.*.fieldId"来表示全层次路径。datatemplateId表示第一层数据模板的id,datatemplateId2表示第二层的id。
*/
if(!path)return;
var idList = this.json.id.split("..");
if( path.contains("*") ){ //允许path中包含*,替代当前path的层次
var paths = path.split(".");
for( var i=0; i<paths.length; i++ ){
if( paths[i].contains("*") && idList[i] ){
var key = paths[i].replace("*", idList[i]);
key = this.form.Macro.exec("return "+key, this);
paths[i] = (key||"").toString();
}
}
path = paths.join("..");
}else if( path.contains("./") ){
var lastName = path.substring(path.indexOf("./")+2, path.length);
var level = (path.substring(0, path.indexOf("./"))+".").split(".").length-1; // /前面有几个.
var idList_copy = Array.clone(idList);
if( idList_copy.length > level*2 ){
for( var i=0; i<level; i++ ){
idList_copy.pop();
if( i > 0)idList_copy.pop();
}
path = idList_copy.join("..")+".."+lastName;
}else{
idList_copy[idList_copy.length-1] = lastName;
path = idList_copy.join("..")
}
}
return this.form.all[path];
}
});
......@@ -238,41 +238,12 @@ MWF.xApplication.process.Xform.Datatemplate = MWF.APPDatatemplate = new Class(
this.node.set(this.json.properties);
},
_getOuterActionModules: function( idList ){ //判断不在数据模板中,但是在表单内的Id
var dtIds = this.json.id.split("..");
var list = [];
idList.each( function (id) {
if(!id)return;
if( id.contains("*") ){ //允许id中包含*,替代当前id的层次
var ids = id.split(".");
for( var i=0; i<ids.length; i++ ){
if( ids[i].contains("*") && dtIds[i] ){
var key = ids[i].replace("*", dtIds[i]);
key = this.form.Macro.exec("return "+key, this);
ids[i] = key.toString();
}
}
id = ids.join("..");
}else if( id.contains("./") ){
debugger;
var lastName = id.substring(id.indexOf("./")+2, id.length);
var level = (id.substring(0, id.indexOf("./"))+".").split(".").length-1; // /前面有几个.
var dtIds_copy = Array.clone(dtIds);
if( dtIds_copy.length > level*2 ){
for( var i=0; i<level; i++ ){
dtIds_copy.pop();
if( i > 0)dtIds_copy.pop();
}
id = dtIds_copy.join("..")+".."+lastName;
}else{
dtIds_copy[dtIds_copy.length-1] = lastName;
id = dtIds_copy.join("..")
}
}
var module = this._getModuleByPath(id);
var tId = id.split("..").getLast();
if( !this.templateJson.hasOwnProperty(tId) && this.form.all[id] ){
list.push( this.form.all[id] );
if( !this.templateJson.hasOwnProperty(tId) && module ){
list.push( module );
}
}.bind(this));
return list;
......
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
MWF.xDesktop.requireApp("process.Xform", "Button", null, false);
/** @class Importer 导入数据组件。
* @example
* //可以在脚本中获取该组件
* //方法1:
* var importer = this.form.get("fieldId"); //获取组件
* //方法2
* var importer = this.target; //在组件本身的脚本中获取
* @extends MWF.xApplication.process.Xform.Importer
* @o2category FormComponents
* @o2range {Process|CMS}
* @hideconstructor
*/
MWF.xApplication.process.Xform.Importer = MWF.APPImporter = new Class({
Implements: [Events],
Extends: MWF.xApplication.process.Xform.Button,
_loadUserInterface: function(){
var button = this.node.getElement("button");
if (!button) button = new Element("button");
button.inject(this.node, "after");
this.node.destroy();
this.node = button;
this.node.set({
"id": this.json.id,
"text": this.json.name || this.json.id,
"styles": this.form.css.buttonStyles,
"MWFType": this.json.type
});
this.node.addEvent("click", function(){
this.upload();
}.bind(this));
if( this.json.allowDownloadTempalte && this.json.downloadTempalteFieldId ){
this.setDownloadEvent();
}
},
upload: function () {
debugger;
this.json.queryImportModel;
MWF.xDesktop.requireApp("query.Query", "Importer", function () {
var importer = new MWF.xApplication.query.Query.Importer(this.form.app.content, {
"application": this.json.queryImportModel.application || this.json.queryImportModel.appName,
"name": this.json.queryImportModel.id || this.json.queryImportModel.alias || this.json.queryImportModel.name
}, {}, this.form.app, this.form.Macro);
importer.load();
}.bind(this));
},
setDownloadEvent: function () {
this.bindEvent = function () {
var module = this._getModuleByPath(this.json.downloadTempalteFieldId);
if(module)module.node.addEvent("click", function () {
this.downloadTemplate();
}.bind(this))
this.fireEvent("afterLoad");
//加载完成以后,删除事件
this.form.removeEvent("afterModulesLoad", this.bindEvent );
}.bind(this);
//去要表单的所有组件加载完成以后再去获取外部组件
this.form.addEvent("afterModulesLoad", this.bindEvent );
},
downloadTemplate: function(){
MWF.xDesktop.requireApp("query.Query", "Importer", function () {
var importer = new MWF.xApplication.query.Query.Importer(this.form.app.content, {
"application": this.json.queryImportModel.application || this.json.queryImportModel.appName,
"name": this.json.queryImportModel.id || this.json.queryImportModel.alias || this.json.queryImportModel.name
}, {}, this.form.app, this.form.Macro);
importer.downloadTemplate(fileName);
}.bind(this));
}
});
......@@ -50,6 +50,7 @@ MWF.xApplication.process.Xform.require = function(callback){
["process.Xform", "Html"],
["process.Xform", "Statement"],
["process.Xform", "StatementSelector"],
["process.Xform", "Importer"]
];
MWF.xDesktop.requireApp(modules, null, function(){
if (callback) callback();
......
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
MWF.xDesktop.requireApp("process.Xform", "ViewSelector", null, false);
/** @class ViewSelector 查询视图选择组件。
/** @class StatementSelector 查询视图选择组件。
* @example
* //可以在脚本中获取该组件
* //方法1:
......
......@@ -156,7 +156,6 @@
"documentActionNode": {
"font-size" : "12px",
"height": "20px",
"width": "20px",
"line-height": "20px",
"color": "#0066cc",
"cursor": "pointer",
......
......@@ -839,7 +839,7 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
}
data = this.document.title;
if( data && data > 70){
if( data && data.length > 70){
errorTextList.push(this.getCol("title", false) + '"'+ data +'"'+ lp.cmsTitleLengthInfor + lp.fullstop );
errorTextListExcel.push(this.getCol("title", false) + '"'+ data +'"'+ + lp.cmsTitleLengthInfor + lp.fullstop );
}
......@@ -1004,7 +1004,7 @@ MWF.xApplication.query.Query.Importer.Row = new Class({
}
if( json.data.documentPublishTime === "importer" ){
this.document.publishTime = new Date().format(db);
this.document.publishTime = new Date().format("db");
}else{
this.setDataWithField(this.document, "documentPublisherTimeField", "publishTime", false);
}
......
......@@ -666,14 +666,16 @@ MWF.xApplication.query.Query.ImporterRecord.DetailView = new Class({
headNode.getElements("th").each(function(th){
if(th.get("lable") === 'importData'){
var count = this.explorer.isShowAll ? columnList.length : 5;
var seeAllAction = new Element("div", {
"text": this.explorer.isShowAll ? this.lp.showFiveColumn: this.lp.showAll,
"styles": this.css.actionNode_showAll,
}).inject(th);
seeAllAction.addEvent("click", function () {
this.explorer.switchSrcDataCount();
}.bind(this));
var count = this.explorer.isShowAll ? columnList.length : Math.min( columnList.length, 5 );
if( columnList.length > 5 ){
var seeAllAction = new Element("div", {
"text": this.explorer.isShowAll ? this.lp.showFiveColumn: this.lp.showAll,
"styles": this.css.actionNode_showAll,
}).inject(th);
seeAllAction.addEvent("click", function () {
this.explorer.switchSrcDataCount();
}.bind(this));
}
var newTr = new Element("tr").inject(headNode, "after");
for( var i=0; i<count; i++ ){
......@@ -703,7 +705,7 @@ MWF.xApplication.query.Query.ImporterRecord.DetailViewLine = new Class({
var srcData = o2.typeOf(itemData.srcData)==="string" ? JSON.parse(itemData.srcData||'{}') : itemData.srcData;
var columnList = this.explorer.importerJSON.data.columnList;
var count = this.explorer.isShowAll ? columnList.length : 5;
var count = this.explorer.isShowAll ? columnList.length : Math.min( columnList.length, 5 );
var getText = function (d) {
var t = o2.typeOf(d);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册