Browse Source

BI-67659 fix: 覆盖追加的字段类型问题

master
Zhenfei.Li 4 years ago
parent
commit
5f489fe872
  1. 12
      src/main/resources/com/fr/plugin/hw/decision/js/attr/col.attr.js
  2. 179
      src/main/resources/com/fr/plugin/hw/decision/js/hw.option.js
  3. 1
      src/main/resources/com/fr/plugin/hw/decision/js/hw.table.add.pop.js
  4. 23
      src/main/resources/com/fr/plugin/hw/decision/js/pane/right.js
  5. 58
      src/main/resources/com/fr/plugin/hw/decision/js/table.info.model.js

12
src/main/resources/com/fr/plugin/hw/decision/js/attr/col.attr.js

@ -23,9 +23,6 @@
},
page:function () {
this.pager.setVPage(this.model.page);
},
excelItems:function () {
this.popularExcelBox(this.model.excelItems);
}
},
render: function () {
@ -130,15 +127,6 @@
allResult.push(result);
}
return allResult;
},
popularExcelBox:function (vals) {
console.log("popularExcelBox");
var self = this;
BI.each(self.excelBox, function (index, item) {
item.populate(vals);
item.setValue(self.model.perItems[index].excelCol);
})
}
});
BI.shortcut("dec.hw.table.col.attr", info);

179
src/main/resources/com/fr/plugin/hw/decision/js/hw.option.js

@ -67,13 +67,11 @@
BI.hwColTypeDeal = function(data){
BI.each(data, function (index, val) {
if (BI.contains(BI.Constants.getConstant("dec.hw.col.type.int"), val.colType)) {
val.colType = 2;
val.colType = 32;
} else if (BI.contains(BI.Constants.getConstant("dec.hw.col.type.str"), val.colType)) {
val.colType = 12;
} else if (BI.contains(BI.Constants.getConstant("dec.hw.col.type.bool"), val.colType)) {
val.colType = 16;
} else if (BI.contains(BI.Constants.getConstant("dec.hw.col.type.date"), val.colType)) {
val.colType = 91;
val.colType = 48;
}
});
return data;
@ -99,177 +97,4 @@
{value: "export", text: "Excel数据管理"},
{value: "auth", text: "Excel权限管理"}
]);
// 组件实现,效果为使用绝对布局组件放置了一个iframe
var Fanruan = BI.inherit(BI.Widget, {
props: {
baseCls: "dec-management-fanruan"
},
render: function () {
var self = this, o = this.options;
var file = {
type: "bi.multifile_editor",
ref: function (_ref) {
self.file = _ref;
},
width: 200,
// accept: "*.zip;",
url: Dec.fineServletURL + "/url/demo/test?width=32&height=32",
listeners: [
{
eventName: BI.MultifileEditor.EVENT_ERROR,
action: function (args) {
/* self.fireEvent("EVENT_ERROR");
self._closeUpload();*/
}
}, {
eventName: BI.MultifileEditor.EVENT_UPLOADED,
action: function (args) {
var files = this.getValue();
if (files[files.length - 1].errorCode) {
BI.Msg.toast(BI.i18nText(files[files.length - 1].errorMsg), {
level: "error"
});
self._closeUpload();
return;
}
var id = files[files.length - 1].attach_id;
var filename = files[files.length - 1].filename;
// self.store.analysisFile(id, filename);
}
}, {
eventName: BI.MultifileEditor.EVENT_CHANGE,
action: function () {
this.upload();
/* self._startUpload();*/
}
}
]
};
return {
type: "bi.absolute",
items: [
{
el: {
type: "bi.center_adapt",
items: [
{
el: file
}, {
el: {
type: "bi.button",
width: 200,
text: "123123",
handler: function () {
self.file.select();
}
}
}
]
},
top: 100,
left: 0,
right: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [{
type: "bi.button",
text: "新建",
handler: function () {
var pane = {
type: "dec.hw.table.add.popup",
add:true,
infoId:"add",
onClickConfirm: function (val, callback) {
Dec.HW.importTableData(val,function (res) {
debugger;
});
callback(true);
// self.store.addDepartment(val, callback);
},
listeners: [
{
eventName: "EVENT_CLOSE",
action: function () {
BI.Popovers.remove(self.getName() + "add");
}
}
]
};
BI.Popovers.create(self.getName() + "add", {
type: "bi.popover",
header: BI.i18nText("Dec-Add_Department"),
body: pane,
width: 700,
height: 800,
listeners: [
{
eventName: "EVENT_CLOSE",
action: function () {
BI.Popovers.remove(self.getName() + "add");
}
}
]
}).open(self.getName() + "add");
}
}, {
type: "bi.button",
text: "编辑",
handler:function () {
var pane = {
type: "dec.hw.table.add.popup",
add:false,
infoId:"edit",
onClickConfirm: function (val, callback) {
Dec.HW.importTableData(val,function (res) {
debugger;
});
callback(true);
// self.store.addDepartment(val, callback);
},
listeners: [
{
eventName: "EVENT_CLOSE",
action: function () {
BI.Popovers.remove(self.getName() + "edit");
}
}
]
};
BI.Popovers.create(self.getName() + "edit", {
type: "bi.popover",
header: BI.i18nText("Dec-Add_Department"),
body: pane,
width: 700,
height: 800,
listeners: [
{
eventName: "EVENT_CLOSE",
action: function () {
BI.Popovers.remove(self.getName() + "edit");
}
}
]
}).open(self.getName() + "edit");
}
}]
},
top: 0,
left: 0
}
]
};
}
});
BI.shortcut("dec.management.fanruan_demo", Fanruan);
})();

1
src/main/resources/com/fr/plugin/hw/decision/js/hw.table.add.pop.js

@ -41,7 +41,6 @@
{
el: {
type: "dec.hw.table.info",
text: "测试",
add: o.add,
infoId:o.infoId,
aliasName: o.aliasName,

23
src/main/resources/com/fr/plugin/hw/decision/js/pane/right.js

@ -49,12 +49,10 @@
add:false,
infoId:"cover",
aliasName: self.model.selectedLink,
onClickConfirm: function (val, callback) {
console.log(val);
Dec.HW.importTableData(val,function (res) {
debugger;
callback(res);
});
onClickConfirm: function (table, callback) {
var tableData = BI.deepClone(table);
BI.hwfield2ColTypeDeal(tableData.items);
Dec.HW.importTableData(tableData, callback);
},
listeners: [
{
@ -74,7 +72,7 @@
header: "覆盖",
body: pane,
width: 700,
height: 600,
height: 700,
listeners: [
{
eventName: "EVENT_CLOSE",
@ -97,11 +95,10 @@
add:false,
infoId:"addTo",
aliasName: self.model.selectedLink,
onClickConfirm: function (val, callback) {
console.log(val);
Dec.HW.importTableData(val,function (res) {
callback(res);
})
onClickConfirm: function (table, callback) {
var tableData = BI.deepClone(table);
BI.hwfield2ColTypeDeal(tableData.items);
Dec.HW.importTableData(tableData, callback)
},
listeners: [
{
@ -121,7 +118,7 @@
header: "追加",
body: pane,
width: 700,
height: 600,
height: 700,
listeners: [
{
eventName: "EVENT_CLOSE",

58
src/main/resources/com/fr/plugin/hw/decision/js/table.info.model.js

@ -17,12 +17,12 @@
childContext: ["items", "connection", "schema", "aliasName", "tableName", "excelItems", "infoId"],
computed: {},
watch: {
excelItems:function (v) {
if (this.model.infoId == "add"){
if (this.model.infoId == "add") {
this.addItems()
} else {
this.coverItems()
}
}
},
@ -81,15 +81,15 @@
self.model.result.titleRow = 0;
self.model.excelItems = fields;
// items 匹配相同的列名
BI.each(self.model.items, function (index, item) {
var sameNameItem = BI.filter(self.model.excelItems, function (i, v) {
return v.text == item.name
});
if (sameNameItem.length != 0){
item.excelCol = sameNameItem[0].value;
}
});
// // items 匹配相同的列名
// BI.each(self.model.items, function (index, item) {
// var sameNameItem = BI.filter(self.model.excelItems, function (i, v) {
// return v.text == item.name
// });
// if (sameNameItem.length != 0){
// item.excelCol = sameNameItem[0].value;
// }
// });
self.model.importStatus="finish";
} else {
@ -113,15 +113,15 @@
self.model.result.titleRow=res.data[0].titleRow;
self.model.excelItems = res.data;
// items 匹配相同的列名
BI.each(self.model.items, function (index, item) {
var sameNameItem = BI.filter(self.model.excelItems, function (i, v) {
return v.text == item.colName
});
if (sameNameItem.length != 0){
item.excelCol = sameNameItem[0].value;
}
});
// // items 匹配相同的列名
// BI.each(self.model.items, function (index, item) {
// var sameNameItem = BI.filter(self.model.excelItems, function (i, v) {
// return v.text == item.colName
// });
// if (sameNameItem.length != 0){
// item.excelCol = sameNameItem[0].value;
// }
// });
self.model.importStatus="finish";
callback && callback(true);
} else {
@ -135,8 +135,15 @@
this.model.importStatus=v;
},
addItems:function () {
var self = this;
var result = BI.map(self.model.excelItems,function (index, item) {
this.model.items=BI.concat(this.model.items, this._formatItems(this.model.excelItems));
},
coverItems: function () {
this.model.items = this._formatItems(this.model.excelItems);
}
},
_formatItems: function (items) {
return BI.map(items, function (index, item) {
return {
id:BI.UUID(),
colName: item.name || item.colName,
@ -145,11 +152,6 @@
excelCol: index
}
});
console.log("excelAdd", self.model.items)
self.model.items=BI.concat(self.model.items, result);
console.log("excelAdd2", self.model.items)
}
}
});
BI.model("dec.hw.table.info.model", Model);

Loading…
Cancel
Save