|
|
|
@ -10,64 +10,88 @@
|
|
|
|
|
add: this.options.add |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
/*beforeInit: function (callback) { |
|
|
|
|
this.store.initData(callback) |
|
|
|
|
},*/ |
|
|
|
|
watch: { |
|
|
|
|
count: function (v) { |
|
|
|
|
this.table.setCount(v); |
|
|
|
|
this.pager.setCount(v); |
|
|
|
|
}, |
|
|
|
|
pages: function (v) { |
|
|
|
|
this.pager.setAllPages(v); |
|
|
|
|
}, |
|
|
|
|
perItems: function () { |
|
|
|
|
this.table.populate(this._formatItems(this.model.perItems)); |
|
|
|
|
this.table.setPage(this.model.page); |
|
|
|
|
this.table.populate(this._getFieldItems(), this._getFieldHeader(), {freezeScroll: true}); |
|
|
|
|
this.pager.setVPage(this.model.page); |
|
|
|
|
}, |
|
|
|
|
page:function () { |
|
|
|
|
this.table.setPage(this.model.page); |
|
|
|
|
//this.popularExcelBox(this.model.excelItems);
|
|
|
|
|
this.pager.setVPage(this.model.page); |
|
|
|
|
}, |
|
|
|
|
excelItems:function () { |
|
|
|
|
this.popularExcelBox(this.model.excelItems); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted: function () { |
|
|
|
|
this.table.setCount(this.model.count); |
|
|
|
|
this.table.populate(this._formatItems(this.model.perItems)); |
|
|
|
|
}, |
|
|
|
|
render: function () { |
|
|
|
|
var self = this, o = this.options; |
|
|
|
|
return { |
|
|
|
|
type: "bi.absolute", |
|
|
|
|
type: "bi.vertical", |
|
|
|
|
items: [{ |
|
|
|
|
el: { |
|
|
|
|
type: "dec.page.table", |
|
|
|
|
header: [{text: "字段名"}, {text: "字段类型"}], |
|
|
|
|
columnSize: ["0.6", "0.4"], |
|
|
|
|
perPage: 5, |
|
|
|
|
type: "bi.components.preview_table", |
|
|
|
|
items: this._getFieldItems(), |
|
|
|
|
header: this._getFieldHeader(), |
|
|
|
|
columnSize: [480, 150], |
|
|
|
|
height: 300, |
|
|
|
|
tgap: 10, |
|
|
|
|
ref: function (_ref) { |
|
|
|
|
self.table = _ref; |
|
|
|
|
}, |
|
|
|
|
items: self.model.perItems, |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
type: "bi.all_count_pager", |
|
|
|
|
cls: "page-table-pager", |
|
|
|
|
count: this.model.count, |
|
|
|
|
curr: this.model.page, |
|
|
|
|
pages: this.model.pages, |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: "EVENT_CHANGE", |
|
|
|
|
action: function (v) { |
|
|
|
|
self.store.setPage(v); |
|
|
|
|
eventName: BI.Pager.EVENT_CHANGE, |
|
|
|
|
action: function () { |
|
|
|
|
self.store.setPage(this.getCurrentPage()); |
|
|
|
|
} |
|
|
|
|
}] |
|
|
|
|
|
|
|
|
|
// }, {
|
|
|
|
|
// type: "bi.components.preview_table",
|
|
|
|
|
// items: this._getFieldItems(),
|
|
|
|
|
// header: this._getFieldHeader(),
|
|
|
|
|
// columnSize: ["0.6", "0.4"],
|
|
|
|
|
// ref: function (ref) {
|
|
|
|
|
// self.table = _ref;
|
|
|
|
|
// }
|
|
|
|
|
}], |
|
|
|
|
ref: function (_ref) { |
|
|
|
|
self.pager = _ref; |
|
|
|
|
}, |
|
|
|
|
top: 0, bottom: 0, left: 0, right: 0 |
|
|
|
|
}] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getFieldHeader: function () { |
|
|
|
|
return [ |
|
|
|
|
BI.map(BI.Constants.getConstant("bi.conf.pack.excel.field.header"), function (idx, item) { |
|
|
|
|
return { |
|
|
|
|
text: item.text, |
|
|
|
|
textAlign: "left", |
|
|
|
|
hgap: 5 |
|
|
|
|
}; |
|
|
|
|
}) |
|
|
|
|
]; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getFieldItems: function () { |
|
|
|
|
var self = this; |
|
|
|
|
console.log("fieldItems", this.model.perItems) |
|
|
|
|
return BI.map(this.model.perItems, function (idx, field) { |
|
|
|
|
var items = [{ |
|
|
|
|
type: "bi.label", |
|
|
|
|
text: field.colName, |
|
|
|
|
title: field.colName, |
|
|
|
|
textAlign: "left", |
|
|
|
|
hgap: 5 |
|
|
|
|
}, { |
|
|
|
|
type: "bi.icon_text_item", |
|
|
|
|
cls: BI.Utils.getFieldIconByFieldType(field.colType), |
|
|
|
|
text: BI.Utils.getTextByFieldType(field.colType) |
|
|
|
|
}]; |
|
|
|
|
return items; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_formatItems: function (items) { |
|
|
|
|
console.log("_formatItems"); |
|
|
|
|
var allResult=[]; |
|
|
|
@ -86,39 +110,22 @@
|
|
|
|
|
value: item.colName |
|
|
|
|
}; |
|
|
|
|
result.push(colName); |
|
|
|
|
// var colType = {
|
|
|
|
|
// type: "bi.text_value_combo",
|
|
|
|
|
// disabled: !o.add,
|
|
|
|
|
// widgetType: "bi.text_value_combo",
|
|
|
|
|
// value: item.colType+"",
|
|
|
|
|
// items: BI.Constants.getConstant("dec.hw.col.type"),
|
|
|
|
|
// id: item.id,
|
|
|
|
|
// listeners: [
|
|
|
|
|
// {
|
|
|
|
|
// eventName: "EVENT_CHANGE",
|
|
|
|
|
// action: function () {
|
|
|
|
|
// self.store.updateItemColType(this.options.id,this.getValue()[0]);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// ]
|
|
|
|
|
// };
|
|
|
|
|
var colType = { |
|
|
|
|
type: "bi.component.field_type_combo", |
|
|
|
|
value: item.colType, |
|
|
|
|
listeners: [{ |
|
|
|
|
type: "bi.text_value_combo", |
|
|
|
|
disabled: !o.add, |
|
|
|
|
widgetType: "bi.text_value_combo", |
|
|
|
|
value: item.colType+"", |
|
|
|
|
items: BI.Constants.getConstant("dec.hw.col.type"), |
|
|
|
|
id: item.id, |
|
|
|
|
listeners: [ |
|
|
|
|
{ |
|
|
|
|
eventName: "EVENT_CHANGE", |
|
|
|
|
action: function (v) { |
|
|
|
|
self.store.setFieldType(idx, v); |
|
|
|
|
action: function () { |
|
|
|
|
self.store.updateItemColType(this.options.id,this.getValue()[0]); |
|
|
|
|
} |
|
|
|
|
}] |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|
// var colType = {
|
|
|
|
|
// type: "bi.icon_text_item",
|
|
|
|
|
// cls: "custom-add-group-font bi-list-item",
|
|
|
|
|
// text: BI.i18nText("BI-Basic_Add_Group"),
|
|
|
|
|
// textRgap: 5
|
|
|
|
|
// value: item.colType
|
|
|
|
|
// }
|
|
|
|
|
result.push(colType); |
|
|
|
|
allResult.push(result); |
|
|
|
|
} |
|
|
|
|