From 5f489fe872a6efcab7d537e1b338f7e809831fa5 Mon Sep 17 00:00:00 2001 From: "Zhenfei.Li" Date: Sat, 4 Jul 2020 17:41:11 +0800 Subject: [PATCH] =?UTF-8?q?BI-67659=20fix:=20=E8=A6=86=E7=9B=96=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E7=9A=84=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/plugin/hw/decision/js/attr/col.attr.js | 12 -- .../com/fr/plugin/hw/decision/js/hw.option.js | 179 +----------------- .../plugin/hw/decision/js/hw.table.add.pop.js | 1 - .../fr/plugin/hw/decision/js/pane/right.js | 23 +-- .../plugin/hw/decision/js/table.info.model.js | 72 +++---- 5 files changed, 49 insertions(+), 238 deletions(-) diff --git a/src/main/resources/com/fr/plugin/hw/decision/js/attr/col.attr.js b/src/main/resources/com/fr/plugin/hw/decision/js/attr/col.attr.js index d592e31..4a1a384 100644 --- a/src/main/resources/com/fr/plugin/hw/decision/js/attr/col.attr.js +++ b/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); diff --git a/src/main/resources/com/fr/plugin/hw/decision/js/hw.option.js b/src/main/resources/com/fr/plugin/hw/decision/js/hw.option.js index f06e91b..adbde01 100644 --- a/src/main/resources/com/fr/plugin/hw/decision/js/hw.option.js +++ b/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); })(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/hw/decision/js/hw.table.add.pop.js b/src/main/resources/com/fr/plugin/hw/decision/js/hw.table.add.pop.js index 3f73b13..1006ca3 100644 --- a/src/main/resources/com/fr/plugin/hw/decision/js/hw.table.add.pop.js +++ b/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, diff --git a/src/main/resources/com/fr/plugin/hw/decision/js/pane/right.js b/src/main/resources/com/fr/plugin/hw/decision/js/pane/right.js index a1a16a8..776a866 100644 --- a/src/main/resources/com/fr/plugin/hw/decision/js/pane/right.js +++ b/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", diff --git a/src/main/resources/com/fr/plugin/hw/decision/js/table.info.model.js b/src/main/resources/com/fr/plugin/hw/decision/js/table.info.model.js index f8fc275..331b306 100644 --- a/src/main/resources/com/fr/plugin/hw/decision/js/table.info.model.js +++ b/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,21 +135,23 @@ this.model.importStatus=v; }, addItems:function () { - var self = this; - var result = BI.map(self.model.excelItems,function (index, item) { - return { - id:BI.UUID(), - colName: item.name || item.colName, - colType: item.type || 16, - colLength: "7000", - excelCol: index - } - }); - - console.log("excelAdd", self.model.items) - self.model.items=BI.concat(self.model.items, result); - console.log("excelAdd2", self.model.items) + 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, + colType: item.type || 16, + colLength: "7000", + excelCol: index + } + }); } }); BI.model("dec.hw.table.info.model", Model);