"use strict";(self["webpackChunkcarabi_x2"]=self["webpackChunkcarabi_x2"]||[]).push([[1136],{4097:function(t,e,a){a.r(e),a.d(e,{default:function(){return u}});var n=function(){var t=this,e=t._self._c;return t.docKinds?e("select-docs",{attrs:{docKinds:t.docKinds,title:t.field.DOCPROP_NAME,values:[],canCreate:!1,multiple:!!t.field.DOCPROP_MULTI,getStructure:t.getStructure,getData:t.getData,fetchData:t.fetchData,columnChange:t.columnChange,columnOrder:t.columnOrder,sortChange:t.sortChange},on:{close:function(e){return t.$emit("close")},change:function(e){return t.$emit("change",e)}}}):t._e()},r=[],i=a(3216),c=a(8559),o={name:"ModalSelectParamDocs",components:{SelectDocs:()=>Promise.all([a.e(7661),a.e(8169),a.e(6062)]).then(a.bind(a,8940))},props:{field:Object,value:{type:Array,default:()=>[]}},data(){return{optionsInterface:null,docKinds:null,dataParams:null,curDocKind:null,curRow:0}},async mounted(){if(await this.$store.dispatch("docKinds/load"),this.curDocKind=this.$store.state.docKinds.docKinds.find((t=>t.VALUE===this.field.DOCPROP_OBJECT)),!this.curDocKind)throw"DocKind ("+this.field.DOCPROP_OBJECT+") not found";console.log("curDocKind",this.curDocKind),this.docKinds=[{DOCKIND_ID:this.curDocKind.VALUE_ID,DOCKIND_DESCR:this.curDocKind.NAME}]},methods:{async getStructure(){return await i.vd.select("PARAM_POPUP_REFLIST_STRUC_CS",{param_id:this.field.DOCPROP_ID},1e3)},async getData(t){return this.curRow=0,this.dataParams=t,await this.loadData(t.count)},async fetchData(t){let e=await this.loadData(t);return e.data},async loadData(t){let e=this.dataParams,a=c.A.convert_sort(e.pq_sort),n=c.A.convert_filter(e.pq_filter),r={PARAM_ID:this.field.DOCPROP_ID,STATUS_ID:"",FILTER:e.context,FILTER_COLS:n,ORDER_BY:a,RES_TREE_VALUE:e.curClassifId,XML_FILTER:e.xmlFilter},o=await i.vd.select("CRM_GET_PARAM_REF_DATA9",r,t,this.curRow);return this.curRow+=o.length,{data:o,count:0}},async columnChange(t){await i.vd.query("SET_USER_COLUMN_PROP",{carabi_doclist_id:this.field.DOCPROP_ID,width:t.WIDTH?t.WIDTH:0,visible:t.VISIBLE?1:0,column_name:t.PROP_SYS_NAME})},async columnOrder(t){await i.vd.query("CRM_SET_USER_COLUMN_SHOW_ORDER",{COLUMN_NAME:t.column,BEFORE_COLUMN_NAME:t.nextColumn,CARABI_DOCLIST_ID:this.field.DOCPROP_ID})},async sortChange(t){await i.vd.query("SET_USER_COLUMN_ORDERBY",{column_name:t.fieldName,orderby:t.direction,carabi_doclist_id:this.field.DOCPROP_ID})}}},l=o,d=a(1656),s=(0,d.A)(l,n,r,!1,null,null,null),u=s.exports},8559:function(t,e){class a{convert_params(t,e){let a={};for(let n in e)a[n]="",void 0!==t[e[n]]&&(a[n]=t[e[n]]);return a}convert_sort(t){if(!t)return"";t=JSON.parse(t);let e="";for(let a in t){let n=t[a];""!=e&&(e+=","),e+=n.dataIndx+" "+("up"==n.dir?"ASC":"DESC")}return e}convert_filter(t){return JSON.stringify({filter:this.convert_filter_obj(t)})}convert_filter_obj(t){if(!t)return[];t=JSON.parse(t);let e=[],a={begin:"=",gte:">=",lte:"<=",between:">="};if(t&&t.data)for(let n in t.data){let r=t.data[n];void 0!==a[r.condition]&&e.push({field_name:r.dataIndx,value:r.value,operator:a[r.condition]}),"between"==r.condition&&e.push({field_name:r.dataIndx,value:r.value2,operator:"<="})}return e}calc_full_count(t,e,a,n){let r=(e-1)*a+n;return t<r&&(t=n==a?(e+1)*a:r),t}fix_row_count(t,e,a,n){let r=e+n;return t<r&&(t=n===a?e+2*a:r),t}}e.A=new a}}]);
//# sourceMappingURL=ModalSelectParamDocs.ab29d091.js.map