;!(function () { var commPath = Dec.fineServletURL + "/file?path=/com/fr/plugin/hw/decision/js"; BI.$import(commPath + "/utils.js"); BI.$import(commPath + "/table.info.js"); BI.$import(commPath + "/table.info.model.js"); BI.$import(commPath + "/hw.table.add.pop.js"); BI.$import(commPath + "/hw.table.add.pop.model.js"); BI.$import(commPath + "/attr/table.attr.js"); BI.$import(commPath + "/attr/table.attr.model.js"); BI.$import(commPath + "/attr/col.attr.js"); BI.$import(commPath + "/attr/col.attr.model.js"); BI.$import(commPath + "/attr/sheet.masker.js"); BI.$import(commPath + "/attr/td.widget.js"); BI.$import(commPath + "/pane/panes.js"); BI.$import(commPath + "/pane/panes.model.js"); BI.$import(commPath + "/pane/dec.hw.excel.export.pane.js"); BI.$import(commPath + "/pane/dec.hw.excel.export.pane.model.js"); BI.$import(commPath + "/pane/left.js"); BI.$import(commPath + "/pane/left.model.js"); BI.$import(commPath + "/pane/left.linklist.item.js"); BI.$import(commPath + "/pane/left.linklist.item.model.js"); BI.$import(commPath + "/pane/left.linklist.js"); BI.$import(commPath + "/pane/left.linklist.model.js"); BI.$import(commPath + "/pane/right.js"); BI.$import(commPath + "/pane/right.model.js"); BI.$import(commPath + "/pane/right.table.js"); BI.$import(commPath + "/pane/right.table.model.js"); BI.$import(commPath + "/pane/dec.page.table.plugin.js"); BI.$import(commPath + "/pane/authPane/auth.pane.js"); BI.$import(commPath + "/pane/authPane/auth.pane.model.js"); BI.$import(commPath + "/pane/authPane/auth.pane.right.js"); BI.$import(commPath + "/pane/authPane/auth.pane.right.model.js"); BI.config("dec.constant.management.navigation", function (items) { items.push({ value: "hw", // 地址栏显示的hash值 id: "fanruan-hw-excecl", // id text: "Excel导入", // 文字 //cardType: "dec.mng.excelExportPane", cardType: "dec.mng.panes", cls: "dir-font-20" // 图标类名 }); return items; }); /** * 管理项 */ BI.constant("dec.hw.col.type", [ {value: "2", text: "整数"}, {value: "3", text: "小数"}, {value: "12", text: "文本"}, {value: "16", text: "布尔"}, {value: "91", text: "日期"} ]); BI.constant("dec.hw.col.type.int", [2, 4]); BI.constant("dec.hw.col.type.str", [1, 12]); BI.constant("dec.hw.col.type.bool", [-7, 16]); BI.constant("dec.hw.col.type.date", [91, 93]); 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; } 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; } }); return data; }; BI.hwfield2ColTypeDeal = function(data){ BI.each(data, function (index, val) { if (val.colType === 16) { val.colType = "12"; } else if (val.colType === 32) { val.colType = "8"; } else if (val.colType === 48) { val.colType = "91"; } }); return data; }; /** * tab项 */ BI.constant("dec.hw.constant.tabs", [ {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); })();