@zhijiancloud/bpm 1.0.98 → 1.0.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("lodash"),require("qs")):"function"==typeof define&&define.amd?define(["lodash","qs"],t):"object"==typeof exports?exports.bpm2=t(require("lodash"),require("qs")):e.bpm2=t(e.lodash,e.qs)}(self,function(e,t){return function(){var i={5281:function(e,t,i){"use strict";i.d(t,{A:function(){return d}});var l=i(9795),s=i(6773),a=i.n(s),o=class{constructor(e,t={}){this._fnBatchLoad=e,this._options=t,this._queue=[]}async load(e){let t=await this.loads(e);return a().get(t,"0")}loads(...e){return new Promise((t,i)=>{this._queue.push({keys:e,resolve:t,reject:i}),1==this._queue.length&&this.nextTick(()=>{this.process()})})}nextTick(e){setTimeout(e,0)}process(){let e=this._queue;this._queue=[];let t={};a().each(e,e=>{a().each(e.keys,e=>t[e]=null)});let i=a().keys(t);this._fnBatchLoad(i).then(l=>{a().each(i,(e,i)=>{t[e]=l[i]}),a().each(e,({keys:e,resolve:i})=>{i(a().map(e,e=>t[e]))})}).catch(t=>{a().each(e,({reject:e})=>e(t))})}},r=i(5360),n=i.n(r);const u=async(e,t,i)=>{if(t.setNetworking(!0),t.netHeader&&(e.headers={common:t.netHeader}),e.params=_.merge({},e.params,i),t.env.ignore_levels&&_.set(e.params,"ignore_levels",!0),(0,l.Fr)()){let t=zj.utils.pageParam().token;e.params=_.merge({token:t,platform:"phone"},e.params)}e.isSilentOnErr=e=>{let t=_.get(e,"data.result");return t>=19e6||t<=19999999};let s=_.cloneDeep(e);if(s.can_custom_org_params){let e=_.cloneDeep(_.get(t,"orgInfo",{}));e.custom_page_level&&(s.params.page_level=e.custom_page_level),e.custom_group_id&&(s.params.group_id=e.custom_group_id),e.custom_team_id&&(s.params.team_id=e.custom_team_id),e.custom_project_id&&(s.params.project_id=e.custom_project_id)}let a=await zj.net.request(s);return t.setNetworking(!1),a},c={},p={};var d={assistSelectEntranceForm:{getListDefinition(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s}){return u({url:`/app_flow/v1/papi/assist_select_entrance_form/${t}/${i}/list_definition/`,method:"GET"},e,l)},getOptions(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a){return u({url:`/app_flow/v1/papi/assist_select_entrance_form/${t}/${i}/list_search/`,method:"GET",params:a},e,l)},getListSelected(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a){return u({url:`/app_flow/v1/papi/assist_select_entrance_form/${t}/${i}/list_selected/`,method:"GET",params:a},e,l)}},assistField:{getBatchLoader(e,{formDefId:t,fieldDefId:i,orgInfo:l,uniqueId:s}){const a=`${t}/${i}`,r=c[a]||new o(async a=>{let o=`/app_flow/v1/papi/assist_field/${t}/${i}/list_title/`;const r=await u({url:o,method:"GET",params:{values:JSON.stringify(a)}},e,l),n=_.get(r,"data.data.data",{});let c=[];return _.map(a,e=>{s?(e=JSON.parse(e),e=_.get(e,`${s}`),c=_.concat(c,n[e])):c=_.concat(c,n[e])}),c});return c[a]=r,r},getTitle(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a){return u({url:`/app_flow/v1/papi/assist_field/${t}/${i}/list_title/`,method:"GET",params:{values:JSON.stringify(a)}},e,l)},async searchSelectOpts(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a={},o=""){o&&(a.q=o);let r=s?`/app_flow/v1/papi/dm/assist_field/${t}/${i}/search_title/`:`/app_flow/v1/papi/assist_field/${t}/${i}/search_title/`,n=`${t}/${i}/${o}/${JSON.stringify(l)}/${JSON.stringify(a)}`,c={};return p[n]&&"loading"==p[n]?await this.waitCacheMapData(n):(!p[n]||(new Date).getTime()-p[n].last_time>6e4?(p[n]="loading",c=await u({url:r,method:s?"GET":"POST",data:a,can_custom_org_params:!0},e,l),p[n]={last_time:(new Date).getTime(),result:c}):p[n].result&&(c=p[n].result),c)},waitCacheMapData(e){return new Promise(t=>{let i=setInterval(()=>{p[e]&&"loading"!=p[e]&&p[e].result&&(clearInterval(i),t(p[e].result))},100)})},async selectFromMulFormSearchOpts(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a={},o=""){o&&(a.q=o);let r=s?`/app_flow/v1/papi/dm/assist_field/select_form_mul_form/${t}/${i}/search_title/`:`/app_flow/v1/papi/assist_field/select_form_mul_form/${t}/${i}/search_title/`,n=`select_form_mul_form_search_${t}/${i}/${o}/${JSON.stringify(l)}/${JSON.stringify(a)}`,c={};return p[n]&&"loading"==p[n]?await this.waitCacheMapData(n):(!p[n]||(new Date).getTime()-p[n].last_time>6e4?(p[n]="loading",c=await u({url:r,method:"GET",params:a},e,l),p[n]={last_time:(new Date).getTime(),result:c}):p[n].result&&(c=p[n].result),c)},selectFromMulFormListTitleLoader(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s}){const a=`${t}/${i}`,r=c[a]||new o(async a=>{let o=s?`/app_flow/v1/papi/dm/assist_field/select_form_mul_form/${t}/${i}/list_title/`:`/app_flow/v1/papi/assist_field/select_form_mul_form/${t}/${i}/list_title/`;const r=await u({url:o,method:"GET",params:{values:JSON.stringify(a)}},e,l),n=_.get(r.data,"data.items",[]),c={};n.forEach(e=>{Object.keys(e.data).forEach(t=>{let i=e.data[t];c[t]={form_def_id:_.get(e,"definition.form.id"),form_title:_.get(e,"definition.form.name"),label:i}})});let p=[];return a.forEach(e=>{p.push(c[e])}),p});return c[a]=r,r},async selectFromMulFormListTitle(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a){let o=s?`/app_flow/v1/papi/dm/assist_field/select_form_mul_form/${t}/${i}/list_title/`:`/app_flow/v1/papi/assist_field/select_form_mul_form/${t}/${i}/list_title/`,r=`select_form_mul_form_list_title_${t}/${i}}/${JSON.stringify(l)}/${JSON.stringify(a)}`,n={};return p[r]&&"loading"==p[r]?await this.waitCacheMapData(r):(!p[r]||(new Date).getTime()-p[r].last_time>6e4?(p[r]="loading",n=await u({url:o,method:"GET",params:{values:JSON.stringify(a)}},e,l),p[r]={last_time:(new Date).getTime(),result:n}):p[r].result&&(n=p[r].result),n)}},assistTreeField:{searchSelectOpts(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a={},o=""){return o&&(a.q=o),u({url:s?`/app_flow/v1/papi/dm/assist_tree_field/${t}/${i}/search_title/`:`/app_flow/v1/papi/assist_tree_field/${t}/${i}/search_title/`,method:"GET",params:a,can_custom_org_params:!0},e,l)}},assistUserTaskCC:{searchSelectOpts(e,{formDefId:t,node:i,orgInfo:l,isDm:s},a={},o=""){return o&&(a.q=o),u({url:`/app_flow/v1/papi/assist_user_task_cc/${t}/${i}/search_title/`,method:"GET",params:a},e,l)}},OCR:{getCreatedTaskList(e){return zj.net.w.noapi({url:"/base_srv_module/v2/gapi/task/async_notify_list",method:"POST",data:n().stringify({group_id:zj.pageParam().group_id||0,file_md5:e})})},getTaskId(e){return zj.net.w.noapi({url:"/base_srv_module/v2/gapi/task/async_notify_submit",method:"POST",data:n().stringify({group_id:zj.pageParam().group_id||0,name:"OCR识别MD5_"+e,vendor_code:"csmart",enable_notify:0,task_type:1,creator:zj.app.accessInfo.user_id,file_md5:e})})},getOcrResult(e){return zj.net.w.noapi({url:"/base_srv_module/v2/gapi/task/detail",method:"POST",data:n().stringify(e)})},ocrCreateForm(e,t){return zj.net.w.noapi.json({url:"/app_flow/v1/papi/ocr_create/submit",method:"POST",params:t,data:e})}}}},9795:function(e,t,i){"use strict";function l(){for(var e=["iphone","ipod","ipad","android","mobile","blackberry","webos","incognito","webmate","bada","nokia","lg","ucweb","skyfire"],t=navigator.userAgent.toLowerCase(),i=!1,l=0,s=e.length;l<s;l++)-1!=t.indexOf(e[l])&&(i=!0);return i}i.d(t,{Fr:function(){return l}}),i(6773),i(5360)},4967:function(e,t,i){"use strict";i.d(t,{A:function(){return n}});var l=function(){var e=this,t=e.$createElement;return(e._self._c||t)("span",{staticClass:"bpm-text-view",class:e.uiType+"-text-view "+e.fieldConf.type+"-view",attrs:{title:e.label}},[e._v(e._s(e.label))])};l._withStripped=!0;var s=i(6773),a=i.n(s),o={props:["value","fieldConf","row","formName","orgInfo"],data(){return{label:""}},watch:{value(){this.loadRemoteLabel()}},mounted(){this.loadRemoteLabel()},methods:{async loadRemoteLabel(){let e=this.value;if(a().isNil(e)||!e)return this.label=zj.z("未选择","c.not_selected");try{let t=a().isArray(e)?e:[e],i=a().get(this.fieldConf,"id");a().isEmpty(t)?this.label=zj.z("未选择","c.not_selected"):(t=a().isArray(t)?t:[t],this.label=await this.$bpm.fetchLabelByValues(t,i,this.formName,this.row),this.$emit("assist_field_label_loaded",this.label))}finally{}}}},r=(0,i(4486).A)(o,l,[],!1,null,null,null);r.options.__file="components/lib/mixins/RemoteSelectReader.vue";var n=r.exports},4486:function(e,t,i){"use strict";function l(e,t,i,l,s,a,o,r){var n,u="function"==typeof e?e.options:e;if(t&&(u.render=t,u.staticRenderFns=i,u._compiled=!0),l&&(u.functional=!0),a&&(u._scopeId="data-v-"+a),o?(n=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),s&&s.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=n):s&&(n=r?function(){s.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:s),n)if(u.functional){u._injectStyles=n;var c=u.render;u.render=function(e,t){return n.call(t),c(e,t)}}else{var p=u.beforeCreate;u.beforeCreate=p?[].concat(p,n):[n]}return{exports:e,options:u}}i.d(t,{A:function(){return l}})},7642:function(e){e.exports=function(){return this.ELEMENT}()},5554:function(e){e.exports=function(){return this.Vue}()},6773:function(t){"use strict";t.exports=e},5360:function(e){"use strict";e.exports=t}},l={};function s(e){var t=l[e];if(void 0!==t)return t.exports;var a=l[e]={exports:{}};return i[e](a,a.exports,s),a.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return function(){"use strict";s.r(a),s.d(a,{default:function(){return w}});var e=function(){var e=this,t=e.$createElement;return(e._self._c||t)(e.curComponent,e._b({ref:"inner-component",tag:"component",staticClass:"bpm-select-form-field",attrs:{type:e.type,fieldConf:e.fieldConf,row:e.row,mode:e.mode,orgInfo:e.orgInfo,formName:e.formName,uiType:e.uiType,isMultiple:e.multiple,allowCreate:e.allowCreate,allowRemote:e.allowRemote},on:{change:e.handleChange,setAllValue:e.setAllValue,setDefaultValue:e.setDefaultValue},model:{value:e.curVal,callback:function(t){e.curVal=t},expression:"curVal"}},"component",e.$attrs,!1))};e._withStripped=!0;var t=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"bpm-select-edit",staticStyle:{display:"flex"}},[e.isCheckbox||e.isButton?[e.isMultiple?i("el-checkbox-group",{on:{change:e.onCheckboxChange},model:{value:e.curCheckBoxVal,callback:function(t){e.curCheckBoxVal=t},expression:"curCheckBoxVal"}},[e.isCheckbox?e._l(e.safeOptions,function(t,l){return i("el-checkbox",{key:e.getOptionKey(t,l),attrs:{label:t.value}},[e._v(e._s(t.label))])}):e._e(),e._v(" "),e.isButton?e._l(e.safeOptions,function(t,l){return i("el-checkbox-button",{key:e.getOptionKey(t,l),attrs:{label:t.value}},[e._v(e._s(t.label))])}):e._e()],2):i("el-radio-group",{on:{change:e.onRadioChange},model:{value:e.curRadioVal,callback:function(t){e.curRadioVal=t},expression:"curRadioVal"}},[e.isCheckbox?e._l(e.safeOptions,function(t,l){return i("el-radio",{key:e.getOptionKey(t,l),attrs:{label:t.value},model:{value:e.radio,callback:function(t){e.radio=t},expression:"radio"}},[e._v(e._s(t.label))])}):e._e(),e._v(" "),e.isButton?e._l(e.safeOptions,function(t,l){return i("el-radio-button",{key:e.getOptionKey(t,l),attrs:{label:t.value}},[e._v(e._s(t.label))])}):e._e()],2)]:[e.showUnit?i("select-unit",{attrs:{fieldConf:e.fieldConf,formDefId:e.formDefId,orgInfo:e.orgInfo},on:{change:e.handleUnitChange}}):e._e(),e._v(" "),i("el-select",e._b({key:e.isMultiple?"two":"one",staticStyle:{flex:"1"},attrs:{placeholder:e.placeholder,multiple:e.isMultiple,clearable:"",filterable:"",remote:!!(e.allowRemote&&e.options_max_count>99),"allow-create":e.allowCreate,"remote-method":!!(e.allowRemote&&e.options_max_count>99)&&e.remoteMethod},on:{change:e.onChange},model:{value:e.curVal,callback:function(t){e.curVal=t},expression:"curVal"}},"el-select",e.$attrs,!1),e._l(e.safeOptions,function(t,l){return i("el-option",{key:e.getOptionKey(t,l),attrs:{label:t.label,value:t.value}},[t.label&&t.label.length>60?i("el-tooltip",{staticClass:"item",attrs:{"popper-class":"bpm-select-edit-option-tooltip",effect:"light",content:t.value,placement:"bottom-start","open-delay":500}},[i("span",[e._v(e._s(t.label))])]):i("span",[e._v(e._s(t.label))])],1)}),1)]],2)};t._withStripped=!0;var i=s(5554),l=s.n(i),o=s(7642),r=s(5281),n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("el-select",{attrs:{placeholder:e.$z("单位选择","b2.common.unit_selection"),filterable:"",remote:""},on:{"remote-method":e.remoteMethod,change:e.handleUnitChange},model:{value:e.selectedTeam,callback:function(t){e.selectedTeam=t},expression:"selectedTeam"}},e._l(e.teams,function(e){return i("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})}),1)};n._withStripped=!0;var u={name:"SelectUnit",props:["fieldConf","orgInfo","formDefId"],data(){return{selectedTeam:"",teams:[],teamMap:{},teamKeyword:"",debounceSearchTeams:_.debounce(_.bind(this.loadTeams,this),150,{trailing:!0,leading:!1})}},mounted(){this.loadTeams()},methods:{handleUnitChange(){this.$emit("change",this.selectedTeam)},async loadTeams(){let e=_.get(this.orgInfo,"page_level"),t=_.get(this.orgInfo,`${e}_id`);this.teams=await this.$bpm.searchTeamSelectOpts(this.fieldConf.id,{keyword:this.teamKeyword,[`${e}_id`]:t},this.formDefId),this.teamMap=_.keyBy(this.teams,"value")},remoteMethod(e){this.teamKeyword=e||"",this.debounceSearchTeams()}}},c=s(4486),p=(0,c.A)(u,n,[],!1,null,null,null);p.options.__file="components/lib/bpmSelectFromField/src/part/select-unit.vue";var d=p.exports;l().use(o.Select),l().use(o.Option),l().use(o.Tooltip);var f={props:["type","value","fieldConf","row","formName","formDefId","orgInfo","dm","isMultiple","allowCreate","allowRemote"],components:{SelectUnit:d},data(){return{curVal:[],curCheckBoxVal:[],curRadioVal:null,options:[],all_options:[],options_max_count:0,keyword:"",unit:{search_type:"",org_id:""},isInitOptions:!1,trigger_parent_depends_timer:!1}},watch:{curVal(e){"SelectProject"!=this.fieldConf.type||"project_id"==zj.pageParam().form_name||"SelectProject"!=this.fieldConf.type||this.isMultiple||(this.$bpm.orgInfo.custom_project_id=e,this.$bpm.orgInfo.custom_page_level="project",e||(this.$bpm.orgInfo.custom_page_level=null))},value(){this.curVal=this.value,this.isMultiple?this.curVal?this.curCheckBoxVal=this.curVal:this.curCheckBoxVal=[]:this.curRadioVal=this.curVal,this.$nextTick(()=>this.setOptionsByVal())},getSelectOptions:function(e){console.log("----selectOptions----",e),this.transformOptions(e,!0)}},inject:["selectOptions"],computed:{isCheckbox(){return"default"==_.get(this.fieldConf,"style")},isButton(){return"button"==_.get(this.fieldConf,"style")},placeholder(){return this.fieldConf.desc||this.fieldConf.name},getSelectOptions(){return this.selectOptions?this.selectOptions():[]},showUnit(){return"SelectURUser"===this.type||"MulSelectURUser"===this.type},safeOptions(){return _.filter(this.options||[],e=>e&&!_.isNil(e.value))}},created(){this.curVal=this.isMultiple?[]:null},mounted(){const e=this.fieldConf.perm||{visible:!0};console.log("loadSelectOpts_this.fieldConf",this.fieldConf),console.log("loadSelectOpts_Perm",e),e.visible&&(this.fieldConf.range_remote&&this.fieldConf.range_remote.depends&&this.fieldConf.range_remote.depends.length>0&&!this.dm?(this.trigger_parent_depends_timer&&clearTimeout(this.trigger_parent_depends_timer),this.trigger_parent_depends_timer=setTimeout(()=>{this.isInitOptions=!0,this.triggerParentLoadSelectByDepends()},500)):this.loadSelectOpts()),this.curVal=this.value,_.isArray(this.curVal)?this.curCheckBoxVal=this.value:this.curRadioVal=this.value,this.$nextTick(()=>this.setOptionsByVal())},destroyed(){this.trigger_parent_depends_timer&&clearTimeout(this.trigger_parent_depends_timer),this.trigger_parent_depends_timer=!1,"project"!=this.$bpm.orgInfo.page_level&&(delete this.$bpm.orgInfo.custom_project_id,delete this.$bpm.orgInfo.custom_page_level)},methods:{triggerParentLoadSelectByDepends(){console.log("triggerParentLoadSelectByDepends");let e=this.$parent;for(;e;){if(console.log("triggerParentLoadSelectByDepends_parentVm",e),_.isFunction(e.loadSelectByDepends))return void e.loadSelectByDepends();e=e.$parent}},getOptionKey(e,t){return e?e.value+`_option_${t}`:`empty_option_${t}`},onCheckboxChange(e){this.curVal=this.curCheckBoxVal,this.$emit("input",this.curVal),this.$emit("change",this.curVal)},onRadioChange(e){this.curVal=this.curRadioVal,this.$emit("input",this.curVal),this.$emit("change",this.curVal)},setOptionsByVal(){let e=_.cloneDeep(this.all_options);_.isArray(this.value)?(1==e.length&&(e=[],this.all_options=[]),_.each(this.value,t=>{_.find(e,{value:t})||e.push({value:t,label:t})})):this.value&&!_.find(e,{value:this.value})&&(1==e.length&&(e=[],this.all_options=[]),e.push({value:this.value,label:this.value})),0==this.all_options.length&&(this.all_options=_.cloneDeep(e)),this.options=_.cloneDeep(e)},handleUnitChange(e){let t=_.split(e,"$"),i=_.get(t,"0"),l=_.get(t,"1");this.unit={search_type:i,org_id:l},this.loadSelectOpts("",JSON.stringify(this.unit))},remoteMethod(e){let t="";this.showUnit&&this.unit.search_type&&(t=JSON.stringify(this.unit)),e?this.loadSelectOpts(e,t):this.options=_.cloneDeep(this.all_options)},_setSelectItem(e){if(this.all_options=_.cloneDeep(e),this.fieldConf.default&&"Default"==this.fieldConf.default.type&&"EVCFirstElem"==this.fieldConf.default.value.type)return e&&e.length?this.isMultiple?(this.curVal=[e[0].value],this.curCheckBoxVal=[e[0].value]):(this.curVal=e[0].value,this.curRadioVal=e[0].value):this.isMultiple?(this.curVal=[],this.curCheckBoxVal=[]):(this.curVal=null,this.curRadioVal=null),this.$emit("setDefaultValue",this.curVal),this.$emit("input",this.curVal),void this.$emit("change",this.curVal);if(this.isMultiple&&this.fieldConf.default&&"Default"==this.fieldConf.default.type&&"EVCAllElem"==this.fieldConf.default.value.type){let t=[];return _.each(e,e=>{t.push(e.value)}),this.$emit("setAllValue",t),this.$emit("setDefaultValue",t),this.curVal=t,this.curCheckBoxVal=t,this.$emit("input",this.curVal),void this.$emit("change",this.curVal)}let t=_.cloneDeep(this.curVal);if(!this.allowRemote){if(e&&e.length){let i=null;this.isMultiple?(i=[],_.each(t,t=>{_.find(e,{value:t})&&i.push(t)}),this.curVal=i,this.curCheckBoxVal=i):(_.find(e,{value:t})&&(i=t),this.curVal=i,this.curRadioVal=i)}else this.isMultiple?(this.curVal=[],this.curCheckBoxVal=[]):(this.curVal=null,this.curRadioVal=null);_.isEqual(t,this.curVal)||(this.$emit("input",this.curVal),this.$emit("change",this.curVal))}},async loadSelectOpts(e="",t=""){let i,l=this.fieldConf.id,s={q:e,spec:t};if("UserTaskCC"===this.fieldConf.type){const e=this.fieldConf.node;i=await r.A.assistUserTaskCC.searchSelectOpts(this.$bpm,{formDefId:this.formDefId,node:e,orgInfo:this.orgInfo,isDm:this.dm},s)}else i=await r.A.assistField.searchSelectOpts(this.$bpm,{formDefId:this.formDefId,fieldDefId:l,orgInfo:this.orgInfo,isDm:this.dm},s),console.log("loadSelectOpts_res",i);const a=_.get(i.data,"data.data",[]);return this.transformOptions(a,!1)},transformOptions(e,t=!0){let i=_.map(e,e=>({value:e[0],label:e[1]}));return i=_.sortBy(i,["label"]),this.options_max_count<i.length&&(this.options_max_count=i.length),i.length&&(this.all_options=_.cloneDeep(i)),this.options=i,(this.options.length>0||t)&&!this.isInitOptions&&this._setSelectItem(this.options),this.isInitOptions=!1,i},onChange(e){console.log("bpmSelectFromField onChange curVal: ",e),"SelectProject"!=this.fieldConf.type||"project_id"==zj.pageParam().form_name||"SelectProject"!=this.fieldConf.type||this.isMultiple||this.$emit("reload",{id:this.fieldConf.id,value:e}),""===e&&(e=null),this.$emit("input",e),this.$emit("change",e)}}},h=(0,c.A)(f,t,[],!1,null,null,null);h.options.__file="components/lib/bpmSelectFromField/src/part/editor.vue";var m=h.exports,g={mixins:[s(4967).A]},v=(0,c.A)(g,void 0,void 0,!1,null,null,null);v.options.__file="components/lib/bpmSelectFromField/src/part/reader.vue";var y=v.exports,b={name:"BpmSelectFromField",components:{editorComponent:m,readerComponent:y},props:{value:{type:[Array,Number,String]},type:{type:String,default:"SelectFromField"},fieldConf:{type:Object,default(){return{}}},row:{type:Object,default(){return{}}},mode:{type:String,default(){return"view"}},uiType:{type:String,default(){return"default"}},orgInfo:{type:Object},formName:{type:String},isMultiple:{type:Boolean,default(){return!1}}},data(){return{curVal:""}},computed:{curComponent(){return"view"==this.mode?y:m},multiple(){let e=this.isMultiple||0===this.type.indexOf("Mul");return"UserTaskCC"===this.type&&this.fieldConf.selecter&&(e=0===(this.fieldConf.selecter.type||"MulSelectUser4CC").indexOf("Mul")),e},allowCreate(){return!(!this.fieldConf.range_remote||"add"!=this.fieldConf.range_remote.enable_add_item)},allowRemote(){return!(!this.fieldConf.range_remote||!this.fieldConf.range_remote.enable_remote_search)}},watch:{value(){this.curVal=this.value}},mounted(){this.curVal=this.value},methods:{setAllValue(e){this.$emit("setAllValue",e)},setDefaultValue(e){this.$emit("setDefaultValue",e)},handleChange(e){this.$emit("input",e),this.$emit("change",e)}}},C=(0,c.A)(b,e,[],!1,null,null,null);C.options.__file="components/lib/bpmSelectFromField/src/main.vue";var $=C.exports;$.install=function(e){e.component($.name,$)};var w=$}(),a}()});
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("lodash"),require("qs")):"function"==typeof define&&define.amd?define(["lodash","qs"],t):"object"==typeof exports?exports.bpm2=t(require("lodash"),require("qs")):e.bpm2=t(e.lodash,e.qs)}(self,function(e,t){return function(){var i={5281:function(e,t,i){"use strict";i.d(t,{A:function(){return d}});var l=i(9795),s=i(6773),a=i.n(s),o=class{constructor(e,t={}){this._fnBatchLoad=e,this._options=t,this._queue=[]}async load(e){let t=await this.loads(e);return a().get(t,"0")}loads(...e){return new Promise((t,i)=>{this._queue.push({keys:e,resolve:t,reject:i}),1==this._queue.length&&this.nextTick(()=>{this.process()})})}nextTick(e){setTimeout(e,0)}process(){let e=this._queue;this._queue=[];let t={};a().each(e,e=>{a().each(e.keys,e=>t[e]=null)});let i=a().keys(t);this._fnBatchLoad(i).then(l=>{a().each(i,(e,i)=>{t[e]=l[i]}),a().each(e,({keys:e,resolve:i})=>{i(a().map(e,e=>t[e]))})}).catch(t=>{a().each(e,({reject:e})=>e(t))})}},r=i(5360),n=i.n(r);const u=async(e,t,i)=>{if(t.setNetworking(!0),t.netHeader&&(e.headers={common:t.netHeader}),e.params=_.merge({},e.params,i),t.env.ignore_levels&&_.set(e.params,"ignore_levels",!0),(0,l.Fr)()){let t=zj.utils.pageParam().token;e.params=_.merge({token:t,platform:"phone"},e.params)}e.isSilentOnErr=e=>{let t=_.get(e,"data.result");return t>=19e6||t<=19999999};let s=_.cloneDeep(e);if(s.can_custom_org_params){let e=_.cloneDeep(_.get(t,"orgInfo",{}));e.custom_page_level&&(s.params.page_level=e.custom_page_level),e.custom_group_id&&(s.params.group_id=e.custom_group_id),e.custom_team_id&&(s.params.team_id=e.custom_team_id),e.custom_project_id&&(s.params.project_id=e.custom_project_id)}let a=await zj.net.request(s);return t.setNetworking(!1),a},c={},p={};var d={assistSelectEntranceForm:{getListDefinition(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s}){return u({url:`/app_flow/v1/papi/assist_select_entrance_form/${t}/${i}/list_definition/`,method:"GET"},e,l)},getOptions(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a){return u({url:`/app_flow/v1/papi/assist_select_entrance_form/${t}/${i}/list_search/`,method:"GET",params:a},e,l)},getListSelected(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a){return u({url:`/app_flow/v1/papi/assist_select_entrance_form/${t}/${i}/list_selected/`,method:"GET",params:a},e,l)}},assistField:{getBatchLoader(e,{formDefId:t,fieldDefId:i,orgInfo:l,uniqueId:s}){const a=`${t}/${i}`,r=c[a]||new o(async a=>{let o=`/app_flow/v1/papi/assist_field/${t}/${i}/list_title/`;const r=await u({url:o,method:"GET",params:{values:JSON.stringify(a)}},e,l),n=_.get(r,"data.data.data",{});let c=[];return _.map(a,e=>{s?(e=JSON.parse(e),e=_.get(e,`${s}`),c=_.concat(c,n[e])):c=_.concat(c,n[e])}),c});return c[a]=r,r},getTitle(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a){return u({url:`/app_flow/v1/papi/assist_field/${t}/${i}/list_title/`,method:"GET",params:{values:JSON.stringify(a)}},e,l)},async searchSelectOpts(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a={},o=""){o&&(a.q=o);let r=s?`/app_flow/v1/papi/dm/assist_field/${t}/${i}/search_title/`:`/app_flow/v1/papi/assist_field/${t}/${i}/search_title/`,n=`${t}/${i}/${o}/${JSON.stringify(l)}/${JSON.stringify(a)}`,c={};return p[n]&&"loading"==p[n]?await this.waitCacheMapData(n):(!p[n]||(new Date).getTime()-p[n].last_time>6e4?(p[n]="loading",c=await u({url:r,method:s?"GET":"POST",data:a,can_custom_org_params:!0},e,l),p[n]={last_time:(new Date).getTime(),result:c}):p[n].result&&(c=p[n].result),c)},waitCacheMapData(e){return new Promise(t=>{let i=setInterval(()=>{p[e]&&"loading"!=p[e]&&p[e].result&&(clearInterval(i),t(p[e].result))},100)})},async selectFromMulFormSearchOpts(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a={},o=""){o&&(a.q=o);let r=s?`/app_flow/v1/papi/dm/assist_field/select_form_mul_form/${t}/${i}/search_title/`:`/app_flow/v1/papi/assist_field/select_form_mul_form/${t}/${i}/search_title/`,n=`select_form_mul_form_search_${t}/${i}/${o}/${JSON.stringify(l)}/${JSON.stringify(a)}`,c={};return p[n]&&"loading"==p[n]?await this.waitCacheMapData(n):(!p[n]||(new Date).getTime()-p[n].last_time>6e4?(p[n]="loading",c=await u({url:r,method:"GET",params:a},e,l),p[n]={last_time:(new Date).getTime(),result:c}):p[n].result&&(c=p[n].result),c)},selectFromMulFormListTitleLoader(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s}){const a=`${t}/${i}`,r=c[a]||new o(async a=>{let o=s?`/app_flow/v1/papi/dm/assist_field/select_form_mul_form/${t}/${i}/list_title/`:`/app_flow/v1/papi/assist_field/select_form_mul_form/${t}/${i}/list_title/`;const r=await u({url:o,method:"GET",params:{values:JSON.stringify(a)}},e,l),n=_.get(r.data,"data.items",[]),c={};n.forEach(e=>{Object.keys(e.data).forEach(t=>{let i=e.data[t];c[t]={form_def_id:_.get(e,"definition.form.id"),form_title:_.get(e,"definition.form.name"),label:i}})});let p=[];return a.forEach(e=>{p.push(c[e])}),p});return c[a]=r,r},async selectFromMulFormListTitle(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a){let o=s?`/app_flow/v1/papi/dm/assist_field/select_form_mul_form/${t}/${i}/list_title/`:`/app_flow/v1/papi/assist_field/select_form_mul_form/${t}/${i}/list_title/`,r=`select_form_mul_form_list_title_${t}/${i}}/${JSON.stringify(l)}/${JSON.stringify(a)}`,n={};return p[r]&&"loading"==p[r]?await this.waitCacheMapData(r):(!p[r]||(new Date).getTime()-p[r].last_time>6e4?(p[r]="loading",n=await u({url:o,method:"GET",params:{values:JSON.stringify(a)}},e,l),p[r]={last_time:(new Date).getTime(),result:n}):p[r].result&&(n=p[r].result),n)}},assistTreeField:{searchSelectOpts(e,{formDefId:t,fieldDefId:i,orgInfo:l,isDm:s},a={},o=""){return o&&(a.q=o),u({url:s?`/app_flow/v1/papi/dm/assist_tree_field/${t}/${i}/search_title/`:`/app_flow/v1/papi/assist_tree_field/${t}/${i}/search_title/`,method:"GET",params:a,can_custom_org_params:!0},e,l)}},assistUserTaskCC:{searchSelectOpts(e,{formDefId:t,node:i,orgInfo:l,isDm:s},a={},o=""){return o&&(a.q=o),u({url:`/app_flow/v1/papi/assist_user_task_cc/${t}/${i}/search_title/`,method:"GET",params:a},e,l)}},OCR:{getCreatedTaskList(e){return zj.net.w.noapi({url:"/base_srv_module/v2/gapi/task/async_notify_list",method:"POST",data:n().stringify({group_id:zj.pageParam().group_id||0,file_md5:e})})},getTaskId(e){return zj.net.w.noapi({url:"/base_srv_module/v2/gapi/task/async_notify_submit",method:"POST",data:n().stringify({group_id:zj.pageParam().group_id||0,name:"OCR识别MD5_"+e,vendor_code:"csmart",enable_notify:0,task_type:1,creator:zj.app.accessInfo.user_id,file_md5:e})})},getOcrResult(e){return zj.net.w.noapi({url:"/base_srv_module/v2/gapi/task/detail",method:"POST",data:n().stringify(e)})},ocrCreateForm(e,t){return zj.net.w.noapi.json({url:"/app_flow/v1/papi/ocr_create/submit",method:"POST",params:t,data:e})}}}},9795:function(e,t,i){"use strict";function l(){for(var e=["iphone","ipod","ipad","android","mobile","blackberry","webos","incognito","webmate","bada","nokia","lg","ucweb","skyfire"],t=navigator.userAgent.toLowerCase(),i=!1,l=0,s=e.length;l<s;l++)-1!=t.indexOf(e[l])&&(i=!0);return i}i.d(t,{Fr:function(){return l}}),i(6773),i(5360)},4967:function(e,t,i){"use strict";i.d(t,{A:function(){return n}});var l=function(){var e=this,t=e.$createElement;return(e._self._c||t)("span",{staticClass:"bpm-text-view",class:e.uiType+"-text-view "+e.fieldConf.type+"-view",attrs:{title:e.label}},[e._v(e._s(e.label))])};l._withStripped=!0;var s=i(6773),a=i.n(s),o={props:["value","fieldConf","row","formName","orgInfo"],data(){return{label:""}},watch:{value(){this.loadRemoteLabel()}},mounted(){this.loadRemoteLabel()},methods:{async loadRemoteLabel(){let e=this.value;if(a().isNil(e)||!e)return this.label=zj.z("未选择","c.not_selected");try{let t=a().isArray(e)?e:[e],i=a().get(this.fieldConf,"id");a().isEmpty(t)?this.label=zj.z("未选择","c.not_selected"):(t=a().isArray(t)?t:[t],this.label=await this.$bpm.fetchLabelByValues(t,i,this.formName,this.row),this.$emit("assist_field_label_loaded",this.label))}finally{}}}},r=(0,i(4486).A)(o,l,[],!1,null,null,null);r.options.__file="components/lib/mixins/RemoteSelectReader.vue";var n=r.exports},4486:function(e,t,i){"use strict";function l(e,t,i,l,s,a,o,r){var n,u="function"==typeof e?e.options:e;if(t&&(u.render=t,u.staticRenderFns=i,u._compiled=!0),l&&(u.functional=!0),a&&(u._scopeId="data-v-"+a),o?(n=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),s&&s.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=n):s&&(n=r?function(){s.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:s),n)if(u.functional){u._injectStyles=n;var c=u.render;u.render=function(e,t){return n.call(t),c(e,t)}}else{var p=u.beforeCreate;u.beforeCreate=p?[].concat(p,n):[n]}return{exports:e,options:u}}i.d(t,{A:function(){return l}})},7642:function(e){e.exports=function(){return this.ELEMENT}()},5554:function(e){e.exports=function(){return this.Vue}()},6773:function(t){"use strict";t.exports=e},5360:function(e){"use strict";e.exports=t}},l={};function s(e){var t=l[e];if(void 0!==t)return t.exports;var a=l[e]={exports:{}};return i[e](a,a.exports,s),a.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return function(){"use strict";s.r(a),s.d(a,{default:function(){return w}});var e=function(){var e=this,t=e.$createElement;return(e._self._c||t)(e.curComponent,e._b({ref:"inner-component",tag:"component",staticClass:"bpm-select-form-field",attrs:{type:e.type,fieldConf:e.fieldConf,row:e.row,mode:e.mode,orgInfo:e.orgInfo,formName:e.formName,uiType:e.uiType,isMultiple:e.multiple,allowCreate:e.allowCreate,allowRemote:e.allowRemote},on:{change:e.handleChange,setAllValue:e.setAllValue,setDefaultValue:e.setDefaultValue},model:{value:e.curVal,callback:function(t){e.curVal=t},expression:"curVal"}},"component",e.$attrs,!1))};e._withStripped=!0;var t=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"bpm-select-edit",staticStyle:{display:"flex"}},[e.isCheckbox||e.isButton?[e.isMultiple?i("el-checkbox-group",{on:{change:e.onCheckboxChange},model:{value:e.curCheckBoxVal,callback:function(t){e.curCheckBoxVal=t},expression:"curCheckBoxVal"}},[e.isCheckbox?e._l(e.safeOptions,function(t,l){return i("el-checkbox",{key:e.getOptionKey(t,l),attrs:{label:t.value}},[e._v(e._s(t.label))])}):e._e(),e._v(" "),e.isButton?e._l(e.safeOptions,function(t,l){return i("el-checkbox-button",{key:e.getOptionKey(t,l),attrs:{label:t.value}},[e._v(e._s(t.label))])}):e._e()],2):i("el-radio-group",{on:{change:e.onRadioChange},model:{value:e.curRadioVal,callback:function(t){e.curRadioVal=t},expression:"curRadioVal"}},[e.isCheckbox?e._l(e.safeOptions,function(t,l){return i("el-radio",{key:e.getOptionKey(t,l),attrs:{label:t.value},model:{value:e.radio,callback:function(t){e.radio=t},expression:"radio"}},[e._v(e._s(t.label))])}):e._e(),e._v(" "),e.isButton?e._l(e.safeOptions,function(t,l){return i("el-radio-button",{key:e.getOptionKey(t,l),attrs:{label:t.value}},[e._v(e._s(t.label))])}):e._e()],2)]:[e.showUnit?i("select-unit",{attrs:{fieldConf:e.fieldConf,formDefId:e.formDefId,orgInfo:e.orgInfo},on:{change:e.handleUnitChange}}):e._e(),e._v(" "),i("el-select",e._b({key:e.isMultiple?"two":"one",staticStyle:{flex:"1"},attrs:{placeholder:e.placeholder,multiple:e.isMultiple,clearable:"",filterable:"",remote:e.isRemoteSearchEnabled,"allow-create":e.allowCreate,"remote-method":!!e.isRemoteSearchEnabled&&e.remoteMethod},on:{change:e.onChange,clear:e.handleClear},model:{value:e.curVal,callback:function(t){e.curVal=t},expression:"curVal"}},"el-select",e.$attrs,!1),e._l(e.safeOptions,function(t,l){return i("el-option",{key:e.getOptionKey(t,l),attrs:{label:t.label,value:t.value}},[t.label&&t.label.length>60?i("el-tooltip",{staticClass:"item",attrs:{"popper-class":"bpm-select-edit-option-tooltip",effect:"light",content:t.value,placement:"bottom-start","open-delay":500}},[i("span",[e._v(e._s(t.label))])]):i("span",[e._v(e._s(t.label))])],1)}),1)]],2)};t._withStripped=!0;var i=s(5554),l=s.n(i),o=s(7642),r=s(5281),n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("el-select",{attrs:{placeholder:e.$z("单位选择","b2.common.unit_selection"),filterable:"",remote:""},on:{"remote-method":e.remoteMethod,change:e.handleUnitChange},model:{value:e.selectedTeam,callback:function(t){e.selectedTeam=t},expression:"selectedTeam"}},e._l(e.teams,function(e){return i("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})}),1)};n._withStripped=!0;var u={name:"SelectUnit",props:["fieldConf","orgInfo","formDefId"],data(){return{selectedTeam:"",teams:[],teamMap:{},teamKeyword:"",debounceSearchTeams:_.debounce(_.bind(this.loadTeams,this),150,{trailing:!0,leading:!1})}},mounted(){this.loadTeams()},methods:{handleUnitChange(){this.$emit("change",this.selectedTeam)},async loadTeams(){let e=_.get(this.orgInfo,"page_level"),t=_.get(this.orgInfo,`${e}_id`);this.teams=await this.$bpm.searchTeamSelectOpts(this.fieldConf.id,{keyword:this.teamKeyword,[`${e}_id`]:t},this.formDefId),this.teamMap=_.keyBy(this.teams,"value")},remoteMethod(e){this.teamKeyword=e||"",this.debounceSearchTeams()}}},c=s(4486),p=(0,c.A)(u,n,[],!1,null,null,null);p.options.__file="components/lib/bpmSelectFromField/src/part/select-unit.vue";var d=p.exports;l().use(o.Select),l().use(o.Option),l().use(o.Tooltip);var h={props:["type","value","fieldConf","row","formName","formDefId","orgInfo","dm","isMultiple","allowCreate","allowRemote"],components:{SelectUnit:d},data(){return{curVal:[],curCheckBoxVal:[],curRadioVal:null,options:[],all_options:[],options_max_count:0,keyword:"",unit:{search_type:"",org_id:""},isInitOptions:!1,trigger_parent_depends_timer:!1}},watch:{curVal(e){"SelectProject"!=this.fieldConf.type||"project_id"==zj.pageParam().form_name||"SelectProject"!=this.fieldConf.type||this.isMultiple||(this.$bpm.orgInfo.custom_project_id=e,this.$bpm.orgInfo.custom_page_level="project",e||(this.$bpm.orgInfo.custom_page_level=null))},value(){this.curVal=this.value,this.isMultiple?this.curVal?this.curCheckBoxVal=this.curVal:this.curCheckBoxVal=[]:this.curRadioVal=this.curVal,this.$nextTick(()=>this.setOptionsByVal())},getSelectOptions:function(e){console.log("----selectOptions----",e),this.transformOptions(e,!0)}},inject:["selectOptions"],computed:{isCheckbox(){return"default"==_.get(this.fieldConf,"style")},isButton(){return"button"==_.get(this.fieldConf,"style")},placeholder(){return this.fieldConf.desc||this.fieldConf.name},getSelectOptions(){return this.selectOptions?this.selectOptions():[]},showUnit(){return"SelectURUser"===this.type||"MulSelectURUser"===this.type},isRemoteSearchEnabled(){return this.allowRemote&&this.options_max_count>99},safeOptions(){return _.filter(this.options||[],e=>e&&!_.isNil(e.value))}},created(){this.curVal=this.isMultiple?[]:null},mounted(){const e=this.fieldConf.perm||{visible:!0};console.log("loadSelectOpts_this.fieldConf",this.fieldConf),console.log("loadSelectOpts_Perm",e),e.visible&&(this.fieldConf.range_remote&&this.fieldConf.range_remote.depends&&this.fieldConf.range_remote.depends.length>0&&!this.dm?(this.trigger_parent_depends_timer&&clearTimeout(this.trigger_parent_depends_timer),this.trigger_parent_depends_timer=setTimeout(()=>{this.isInitOptions=!0,this.triggerParentLoadSelectByDepends()},500)):this.loadSelectOpts()),this.curVal=this.value,_.isArray(this.curVal)?this.curCheckBoxVal=this.value:this.curRadioVal=this.value,this.$nextTick(()=>this.setOptionsByVal())},destroyed(){this.trigger_parent_depends_timer&&clearTimeout(this.trigger_parent_depends_timer),this.trigger_parent_depends_timer=!1,"project"!=this.$bpm.orgInfo.page_level&&(delete this.$bpm.orgInfo.custom_project_id,delete this.$bpm.orgInfo.custom_page_level)},methods:{triggerParentLoadSelectByDepends(){console.log("triggerParentLoadSelectByDepends");let e=this.$parent;for(;e;){if(console.log("triggerParentLoadSelectByDepends_parentVm",e),_.isFunction(e.loadSelectByDepends))return void e.loadSelectByDepends();e=e.$parent}},getOptionKey(e,t){return e?e.value+`_option_${t}`:`empty_option_${t}`},onCheckboxChange(e){this.curVal=this.curCheckBoxVal,this.$emit("input",this.curVal),this.$emit("change",this.curVal)},onRadioChange(e){this.curVal=this.curRadioVal,this.$emit("input",this.curVal),this.$emit("change",this.curVal)},setOptionsByVal(){let e=_.cloneDeep(this.all_options);_.isArray(this.value)?(1==e.length&&(e=[],this.all_options=[]),_.each(this.value,t=>{_.find(e,{value:t})||e.push({value:t,label:t})})):this.value&&!_.find(e,{value:this.value})&&(1==e.length&&(e=[],this.all_options=[]),e.push({value:this.value,label:this.value})),0==this.all_options.length&&(this.all_options=_.cloneDeep(e)),this.options=_.cloneDeep(e)},handleUnitChange(e){let t=_.split(e,"$"),i=_.get(t,"0"),l=_.get(t,"1");this.unit={search_type:i,org_id:l},this.loadSelectOpts("",JSON.stringify(this.unit))},buildRemoteSpec(){return this.showUnit&&this.unit.search_type?JSON.stringify(this.unit):""},handleClear(){this.isRemoteSearchEnabled&&this.loadSelectOpts("",this.buildRemoteSpec())},remoteMethod(e){let t=this.buildRemoteSpec();e?this.loadSelectOpts(e,t):this.options=_.cloneDeep(this.all_options)},_setSelectItem(e){if(this.all_options=_.cloneDeep(e),this.fieldConf.default&&"Default"==this.fieldConf.default.type&&"EVCFirstElem"==this.fieldConf.default.value.type)return e&&e.length?this.isMultiple?(this.curVal=[e[0].value],this.curCheckBoxVal=[e[0].value]):(this.curVal=e[0].value,this.curRadioVal=e[0].value):this.isMultiple?(this.curVal=[],this.curCheckBoxVal=[]):(this.curVal=null,this.curRadioVal=null),this.$emit("setDefaultValue",this.curVal),this.$emit("input",this.curVal),void this.$emit("change",this.curVal);if(this.isMultiple&&this.fieldConf.default&&"Default"==this.fieldConf.default.type&&"EVCAllElem"==this.fieldConf.default.value.type){let t=[];return _.each(e,e=>{t.push(e.value)}),this.$emit("setAllValue",t),this.$emit("setDefaultValue",t),this.curVal=t,this.curCheckBoxVal=t,this.$emit("input",this.curVal),void this.$emit("change",this.curVal)}let t=_.cloneDeep(this.curVal);if(!this.allowRemote){if(e&&e.length){let i=null;this.isMultiple?(i=[],_.each(t,t=>{_.find(e,{value:t})&&i.push(t)}),this.curVal=i,this.curCheckBoxVal=i):(_.find(e,{value:t})&&(i=t),this.curVal=i,this.curRadioVal=i)}else this.isMultiple?(this.curVal=[],this.curCheckBoxVal=[]):(this.curVal=null,this.curRadioVal=null);_.isEqual(t,this.curVal)||(this.$emit("input",this.curVal),this.$emit("change",this.curVal))}},async loadSelectOpts(e="",t=""){let i,l=this.fieldConf.id,s={q:e,spec:t};if("UserTaskCC"===this.fieldConf.type){const e=this.fieldConf.node;i=await r.A.assistUserTaskCC.searchSelectOpts(this.$bpm,{formDefId:this.formDefId,node:e,orgInfo:this.orgInfo,isDm:this.dm},s)}else i=await r.A.assistField.searchSelectOpts(this.$bpm,{formDefId:this.formDefId,fieldDefId:l,orgInfo:this.orgInfo,isDm:this.dm},s),console.log("loadSelectOpts_res",i);const a=_.get(i.data,"data.data",[]);return this.transformOptions(a,!1)},transformOptions(e,t=!0){let i=_.map(e,e=>({value:e[0],label:e[1]}));return i=_.sortBy(i,["label"]),this.options_max_count<i.length&&(this.options_max_count=i.length),i.length&&(this.all_options=_.cloneDeep(i)),this.options=i,(this.options.length>0||t)&&!this.isInitOptions&&this._setSelectItem(this.options),this.isInitOptions=!1,i},onChange(e){console.log("bpmSelectFromField onChange curVal: ",e),"SelectProject"!=this.fieldConf.type||"project_id"==zj.pageParam().form_name||"SelectProject"!=this.fieldConf.type||this.isMultiple||this.$emit("reload",{id:this.fieldConf.id,value:e}),""===e&&(e=null),this.$emit("input",e),this.$emit("change",e)}}},f=(0,c.A)(h,t,[],!1,null,null,null);f.options.__file="components/lib/bpmSelectFromField/src/part/editor.vue";var m=f.exports,g={mixins:[s(4967).A]},v=(0,c.A)(g,void 0,void 0,!1,null,null,null);v.options.__file="components/lib/bpmSelectFromField/src/part/reader.vue";var y=v.exports,b={name:"BpmSelectFromField",components:{editorComponent:m,readerComponent:y},props:{value:{type:[Array,Number,String]},type:{type:String,default:"SelectFromField"},fieldConf:{type:Object,default(){return{}}},row:{type:Object,default(){return{}}},mode:{type:String,default(){return"view"}},uiType:{type:String,default(){return"default"}},orgInfo:{type:Object},formName:{type:String},isMultiple:{type:Boolean,default(){return!1}}},data(){return{curVal:""}},computed:{curComponent(){return"view"==this.mode?y:m},multiple(){let e=this.isMultiple||0===this.type.indexOf("Mul");return"UserTaskCC"===this.type&&this.fieldConf.selecter&&(e=0===(this.fieldConf.selecter.type||"MulSelectUser4CC").indexOf("Mul")),e},allowCreate(){return!(!this.fieldConf.range_remote||"add"!=this.fieldConf.range_remote.enable_add_item)},allowRemote(){return!(!this.fieldConf.range_remote||!this.fieldConf.range_remote.enable_remote_search)}},watch:{value(){this.curVal=this.value}},mounted(){this.curVal=this.value},methods:{setAllValue(e){this.$emit("setAllValue",e)},setDefaultValue(e){this.$emit("setDefaultValue",e)},handleChange(e){this.$emit("input",e),this.$emit("change",e)}}},C=(0,c.A)(b,e,[],!1,null,null,null);C.options.__file="components/lib/bpmSelectFromField/src/main.vue";var $=C.exports;$.install=function(e){e.component($.name,$)};var w=$}(),a}()});