function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,t){var i="agDropdownCellEditor",a="ag.dropdown.celleditor",o={maxHeight:200},n=27,r=9,l=37,s=38,d=39,c=40,u=13,p=16,f=function(t,a){this.grid=a.grid,this.config=a.config,this.items=a.data.items,this.selected=a.data.selected,this.hook=a.hook,this.arrow=a.arrow||"icon-search",this.name=a.name,this.onSelect=a.select||function(){},this.$input=e(t),this.settings=e.extend({},o,a),this.init(),e.fn[i].instances.push(this)};e.extend(f.prototype,{init:function(){this._construct(),this._events()},_construct:function(){this.$container=e('
'),this.$arrow=e('
'),this.$dropdown=e('
')},a.prototype.getGui=function(){return this.eGui},o.prototype.init=function(e){this.eGui=document.createElement("span"),this.eGui.innerHTML=e.value||""},o.prototype.getGui=function(){return this.eGui},n.prototype.init=function(e){var t=e.api.gridCore.gridOptions;if(!e.node.rowPinned&&null!=e.data){var i=e.data,a="";i.master_id>0&&e.colDef.options.forEach((function(e){if(e.display){var o=''+e.name+"";a+=t.actionCellBeforeRender(o,e,i)||""}})),this.eGui=document.createElement("span"),this.eGui.innerHTML=a}},n.prototype.getGui=function(){return this.eGui},r.prototype.init=function(e){this.grid=e,this.selectedKey=null,this.items=e.colDef.cellEditorParams.values,this.eInput=document.createElement("input"),this.eInput.value=e.value||"",this.eInput.className="ag-cell-edit-input form-control"},r.prototype.getGui=function(e){return this.eInput},r.prototype.afterGuiAttached=function(){var e=this,i=e.grid,a=e.eInput.value;t(e.eInput).agDropdownCellEditor({grid:e,arrow:"fa-caret-down",data:{items:e.items,selected:i.data[i.select_key]},select:function(t){t?(i.data[i.select_key]=t.id,e.eInput.value=t.name,e.selectedKey=t.id):e.eInput.value=a,i.stopEditing()}}),e.eInput.focus(),e.eInput.select()},r.prototype.getValue=function(){return this.eInput.value},r.prototype.destroy=function(){t("body").find(".combo-select").remove()},l.prototype.init=function(e){var t=e.value,i=e.colDef.cellEditorParams.values;this.eGui=document.createElement("div"),this.eGui.innerHTML=i[t]||i[0]},l.prototype.getGui=function(){return this.eGui},s.prototype.init=function(e){var t=e.value;this.eInput=document.createElement("input"),this.eInput.type="checkbox",this.eInput.checked=t,this.eInput.value=t},s.prototype.getGui=function(e){return this.eInput},s.prototype.afterGuiAttached=function(){this.eInput.focus(),this.eInput.select()},s.prototype.getValue=function(){return this.eInput.checked?1:0},s.prototype.destroy=function(){},d.prototype.init=function(e){this.params=e,this.eInput=document.createElement("div"),this.eInput.tabIndex="-1";var i=e.colDef.field+"_"+e.data.id,a=e.query;a.multi=1,a.is_grid=1,a.url=e.url,a.grid_id=e.data.id,a.title=e.title;var o="";t.each(a,(function(e,t){o+=" data-"+e+'="'+t+'"'})),this.query=a,this.eInput.innerHTML='',this.eInput.className="ag-input-wrapper ag-input-dialog-wrapper"},d.prototype.getGui=function(e){return this.eInput},d.prototype.afterGuiAttached=function(){var e=this;t(e.eInput).find("input").gdooSuggest({item:e.params.data,query:e.query}).on("onSelect",(function(t,i){e.params.data[e.query.name]=i[e.query.name],e.eInput.querySelector("input").value=i[e.query.name]})),e.eInput.querySelector("input").select()},d.prototype.getValue=function(){return this.params.data[this.params.query.name]},d.prototype.destroy=function(){t(this.eInput).find("input").off()},d.prototype.isPopup=function(){return!1},c.prototype.init=function(e){this.params=e.colDef.cellEditorParams,this.eInput=document.createElement("div"),this.eInput.innerHTML='',this.eInput.className="ag-input-wrapper ag-input-date-wrapper"},c.prototype.getGui=function(e){return this.eInput},c.prototype.afterGuiAttached=function(){this.eInput.querySelector("input").click()},c.prototype.getValue=function(){return this.eInput.querySelector("input").value},c.prototype.destroy=function(){},e.agGridOptions=function(){var e={defaultColDef:{minWidth:100,enableRowGroup:!0,enablePivot:!0,enableValue:!0,sortable:!0,resizable:!0,filter:!0,comparator:function(e,t){return"htmlCellRenderer"==this.cellRenderer?(e=delHtmlTag(e),t=delHtmlTag(t),e.localeCompare(t)):"string"==typeof e?e.localeCompare(t):e>t?1:e数据加载中...',overlayNoRowsTemplate:'
暂无数据
暂无数据
',generatePinnedBottomData:function(){var t=this,i={},a=!1;e.columnApi.getAllGridColumns().forEach((function(e){e.colDef.calcFooter&&(a=!0,i[e.colId]=t.calculatePinnedBottomData(e))})),a&&t.api.setPinnedBottomRowData([i])},calculatePinnedBottomData:function(t){var i=0;return e.api.forEachNode((function(e){i+=toNumber(e.data[t.colId])})),0==i?"":i},actionCellBeforeRender:function(e,t,i){return e},remoteData:function(i,a){var o=this,n=e.remoteParams;for(var r in i)n[r]=i[r];e.api.showLoadingOverlay(),t.post(e.remoteDataUrl,n,(function(i){if(e.remoteBeforeSuccess.call(e,i),"function"==typeof a&&a(i),i.per_page)if(null===o.pagerDom){var n=o.api.gridCore.eGridDiv,r=n.id+"-pager";t(n).after('
'),o.pagerDom=t("#"+r).Paging({pagesize:i.per_page,count:i.total,current:i.current_page,pageSizeList:[50,100,500,1e3,2e3,5e3,1e4,2e4,5e4],callback:function(e,t,i){o.remoteData2({page:e,limit:t})}})}else o.pagerDom[0].render({pagesize:i.per_page,count:i.total,current:i.current_page});e.api.hideOverlay(),e.api.setRowData(i.data),e.generatePinnedBottomData(),e.remoteAfterSuccess.call(e,i)}),"json")},remoteData2:function(i,a){var o=e.remoteParams;for(var n in i)o[n]=i[n];e.api.showLoadingOverlay(),t.post(e.remoteDataUrl,o,(function(t){e.remoteBeforeSuccess.call(e,t),"function"==typeof a&&a(t),e.api.hideOverlay(),e.api.setRowData(t.data),e.generatePinnedBottomData(),e.remoteAfterSuccess.call(e,t)}),"json")}};return e}}(window,jQuery),function(e){var t=function(e){var t=this;t.args=e,t.trigger=function(e){if("function"==typeof t.args[e]){for(var i=[],a=1;a0&&a.action.rowDoubleClick&&a.action.rowDoubleClick(e.data)},this.div=function(t){var i=document.querySelector("#"+this.table+"-grid");return i.style.height=this.getPanelHeight(t),new agGrid.Grid(i,this.grid),e(i).on("click",'[data-toggle="event"]',(function(){var t=e(this).data();t.master_id>0&&a.action[t.action](t)})),i},this.getPanelHeight=function(t){return"calc(100vh - "+(e(".gdoo-list-grid").position().top+t+"px")+")"},this.init=function(i){var a=this;if(0==a.header.init){var o=i.header;a.header.init=!0,a.header.create_btn=o.create_btn,a.header.trash_btn=o.trash_btn,a.header.name=o.name,a.header.table=t;var n=o.search_form;n.simple_search=o.simple_search_form,a.header.search_form=n,a.search.forms=n.forms,a.action.table=t,a.action.name=o.master_name,a.action.bill_url=o.bill_uri,o.access&&(a.header.access=o.access),o.right_buttons&&(a.header.right_buttons=o.right_buttons),o.left_buttons&&(a.header.left_buttons=o.left_buttons),o.buttons&&(a.header.center_buttons=o.buttons),o.bys&&(a.header.bys=o.bys),o.tabs&&(a.header.tabs=o.tabs,a.header.tabs.active=n.params.tab?n.params.tab:o.tabs.items[0].value),a.grid.api.setColumnDefs(o.columns),a.grid.columnDefs=o.columns,a.grid.remoteParams=n.query,e("#"+t+"-page").show(),setTimeout((function(){a.searchForm()}),1)}},this.searchForm=function(){var t=this;t.search.advanced.el=e("#"+t.table+"-search-form-advanced").searchForm({data:t.search.forms,advanced:!0}),t.search.simple.el=e("#"+t.table+"-search-form").searchForm({data:t.search.forms}),t.search.simple.el.find("#search-submit").on("click",(function(){var i=t.search.simple.el.serializeArray(),a={};return t.search.queryType="simple",e.map(i,(function(e){a[e.name]=e.value})),a.page=1,t.grid.remoteData(a),!1}))},this.setup={header:this.header,action:this.action,grid:this.grid},i.grids[t]={grid:this.grid,search:this.search}}};window.gdoo=i}(jQuery);var select2List={};!function(e){e.fn.select2Field=function(t){$this=e(this);var i=$this.attr("key"),a=gdoo.event.get(i),o={width:"100%",placeholder:" - ",allowClear:!0,minimumInputLength:0,resultCache:!0,ajax:{type:"POST",url:"",dataType:"json",delay:250,cache:!1,data:function(e){var i=t.ajaxParams||{};return i.q=e.term||"",i.page=e.page||1,i.resultCache=!0,a.trigger("query",i),i},processResults:function(e,t){return{results:e.data,pagination:{more:e.current_page