@zhijiancloud/bpm 0.0.34 → 0.0.36
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.
- package/dist/bpmAudit.umd.js +1 -1
- package/dist/bpmField.umd.js +2 -2
- package/dist/bpmFormField.umd.js +2 -2
- package/dist/bpmMulImage.umd.js +1 -1
- package/dist/bpmSelectFromField.umd.js +1 -1
- package/dist/bpmSignature.umd.js +1 -1
- package/dist/bpmSubForm.umd.js +1 -1
- package/dist/bpmSubFormField.umd.js +2 -2
- package/dist/bpmTime.umd.js +1 -1
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/bpmSubForm.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@antv/g6")):"function"==typeof define&&define.amd?define(["@antv/g6"],t):"object"==typeof exports?exports.bpm2=t(require("@antv/g6")):e.bpm2=t(e["@antv/g6"])}(self,(function(e){return function(){"use strict";var t={3663:function(e,t,a){a.d(t,{r:function(){return r}});let l=[{key:"lt",name:"早于"},{key:"gt",name:"晚于"},{key:"gte",name:"不早于"},{key:"lte",name:"不晚于"}],i=[{key:"in",name:"在列表中"}],n=[{key:"in",name:"在列表中"},{key:"all",name:"包含所有"}];const r={Text:{name:"单行文本",hasBpmField:!0,tableColWidth:240,actions:[{key:"contains",name:"包含"},{key:"eq",name:"等于"}],attrs:["type","value_type","id","name","linkage"]},TextArea:{name:"多行文本",hasBpmField:!0,tableColWidth:300,actions:[{key:"contains",name:"包含"},{key:"eq",name:"等于"}],attrs:["type","value_type","id","name","linkage"]},SerialNumber:{name:"流水号",hasBpmField:!0,actions:[{key:"contains",name:"包含"}],options:{type:"Text"},attrs:["type","id","name","linkage"]},Number:{name:"数字",hasBpmField:!0,tableColWidth:200,actions:[{key:"eq",name:"等于"},{key:"gt",name:"大于"},{key:"gte",name:"大于等于"},{key:"lt",name:"小于"},{key:"lte",name:"小于等于"},{key:"ne",name:"不等于"}],attrs:["type","id","name","value_type","is_int","view.precision","linkage"]},DateTime:{name:"日期时间选择器",tableColWidth:240,hasBpmField:!0,actions:l,attrs:["type","id","name","check.format","view.format","linkage"]},Date:{name:"日期选择器",tableColWidth:240,hasBpmField:!0,actions:l,attrs:["type","id","name","check.format","view.format","linkage"]},Time:{name:"时间选择器",hasBpmField:!0,tableColWidth:240,actions:l,attrs:["type","id","name","check.format","view.format","linkage"]},Timestamp:{name:"※时间戳",tableColWidth:240,actions:l,attrs:["type","id","name","check.format","view.format","linkage"]},Select:{name:"单选",hasBpmField:!0,tableColWidth:220,actions:i,options:{type:"MulSelect"},attrs:["type","id","name","value_type","style","range_enum","linkage"]},Status:{name:"状态",hasBpmField:!0,tableColWidth:150,actions:i,options:{type:"MulSelect"},attrs:["type","id","name","value_type","style","range_enum","linkage"]},MulSelect:{name:"多选",hasBpmField:!0,tableColWidth:220,actions:n,attrs:["type","id","name","value_type","result_type","style","range_enum","linkage"]},SelectFromForm:{name:"远程单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectFromForm"},attrs:["type","id","name","range_remote","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.form","range_remote.depends","linkage"]},MulSelectFromForm:{name:"远程多项选择",hasBpmField:!0,tableColWidth:200,actions:n,attrs:["type","id","name","range_remote","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.form","range_remote.depends","linkage"]},SelectProject:{name:"项目单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectProject"},attrs:["type","id","name","range_remote","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},MulSelectProject:{name:"项目多项选择",hasBpmField:!0,tableColWidth:200,actions:n,attrs:["type","id","name","range_remote","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},SelectUser:{name:"用户单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectUser"},attrs:["type","id","name","range_remote","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},MulSelectUser:{name:"用户多项选择",hasBpmField:!0,tableColWidth:200,actions:n,options:{type:"MulSelectUser"},attrs:["type","id","name","range_remote","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},SelectURUser:{name:"用户单项选择(新)",hasBpmField:!0,tableColWidth:400,actions:i,options:{type:"MulSelectURUser"},attrs:["type","id","name","range_remote","value_type","filters","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},MulSelectURUser:{name:"用户多项选择(新)",hasBpmField:!0,tableColWidth:400,actions:n,options:{type:"MulSelectURUser"},attrs:["type","id","name","range_remote","value_type","filters","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},SelectRootCategory:{name:"根任务类型选择",hasBpmField:!0,tableColWidth:200,actions:[{key:"eq",name:"等于"}],attrs:["type","id","name","category_cls","value_type","linkage"]},SelectCheckItem:{name:"检查项单项选择",hasBpmField:!0,actions:i,tableColWidth:200,options:{type:"MulSelectCheckItem"},attrs:["type","id","name","category_cls","value_type","range_remote","root_category","tree_select","can_select","can_select.filter_expression","range_remote.filter_expression","range_remote.depends","linkage"]},MulSelectCheckItem:{name:"检查项多项选择",hasBpmField:!0,tableColWidth:200,actions:n,attrs:["type","id","name","category_cls","value_type","range_remote","root_category","tree_select","can_select","can_select.filter_expression","range_remote.filter_expression","range_remote.depends","linkage"]},SelectSort:{name:"分类单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectSort"},attrs:["type","id","name","value_type","range_remote","tree_select","can_select","can_select.filter_expression","range_remote.filter_expression","range_remote.depends","linkage"]},MulSelectSort:{name:"分类多项选择",hasBpmField:!0,tableColWidth:200,actions:n,attrs:["type","id","name","value_type","range_remote","tree_select","can_select","can_select.filter_expression","range_remote.filter_expression","range_remote.depends","linkage"]},SelectPartner:{name:"合作伙伴单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectPartner"},attrs:["type","id","name","value_type","range_remote","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},MulSelectPartner:{name:"合作伙伴多项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectPartner"},attrs:["type","id","name","value_type","range_remote","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},SelectOrg:{name:"单位单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectOrg"},attrs:["type","id","name","value_type","range_remote","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},MulSelectOrg:{name:"单位多项选择",hasBpmField:!0,tableColWidth:200,actions:n,attrs:["type","id","name","value_type","range_remote","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},Audit:{name:"审批",hasBpmField:!0,actions:[{key:"ar_eq",name:"审批结果等于"},{key:"ar_in",name:"审批结果在列表中"}],actionOptions:[{value:0,label:"未审批"},{value:1,label:"审批通过"},{value:2,label:"审批未通过"}],attrs:["type","id","name","linkage"],options:{result_type:"Array",value_type:"int",type:"MulSelect",style:"default",range_enum:[[0,"未审批"],[1,"通过"],[2,"未通过"]]}},MulArea:{name:"区域多项选择",actions:n,attrs:["type","id","name","value_type","can","linkage"]},Area:{name:"区域单项选择",actions:i,options:{type:"MulArea"},attrs:["type","id","name","value_type","can","linkage"]},SelectFormId:{name:"表单单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectFormId"},attrs:["type","id","name","value_type","form_select_type","linkage"]},MulSelectFormId:{name:"表单多项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectFormId"},attrs:["type","id","name","value_type","form_select_type","linkage"]},SelectFromField:{name:"远程单选(从字段)",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectFromField"},attrs:["type","id","name","range_remote","style","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.form","range_remote.depends","linkage"]},MulSelectFromField:{name:"远程多选(从字段)",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectFromField"},attrs:["type","id","name","range_remote","style","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.form","range_remote.depends","linkage"]},MulSelectEntranceForm:{name:"远程多项选择(从入口)",hasBpmField:!0},SelectHouseOwner:{name:"业主选择"},MulSelectIssue:{name:"问题选择"},MulFile:{name:"附件",hasBpmField:!0,tableColWidth:150},MulImage:{name:"图片",hasBpmField:!0,tableColWidth:150},Signature:{name:"签名",hasBpmField:!0},OnlineEditor:{name:"在线文档编辑器"},Spliter:{name:"分割线",hasBpmField:!1},Stepper:{name:"步进器",hasBpmField:!1},Quote:{name:"跨表单数据引用",hasBpmField:!1},Order:{name:"排序控件",hasBpmField:!1},SubForm:{name:"子表单",hasBpmField:!0},XSubForm:{name:"子表单(增强版)",hasBpmField:!0},OrderSubForm:{name:"排序子表单",hasBpmField:!0},AreaElevation:{name:"区域快速选择器",hasBpmField:!0,tableColWidth:200},RichText:{name:"富文本编辑框",hasBpmField:!0,tableColWidth:100}}},1900:function(e,t,a){function l(e,t,a,l,i,n,r,o){var s,d="function"==typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=a,d._compiled=!0),l&&(d.functional=!0),n&&(d._scopeId="data-v-"+n),r?(s=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__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},d._ssrRegister=s):i&&(s=o?function(){i.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:i),s)if(d.functional){d._injectStyles=s;var m=d.render;d.render=function(e,t){return s.call(t),m(e,t)}}else{var p=d.beforeCreate;d.beforeCreate=p?[].concat(p,s):[s]}return{exports:e,options:d}}a.d(t,{Z:function(){return l}})},4488:function(t){t.exports=e}},a={};function l(e){var i=a[e];if(void 0!==i)return i.exports;var n=a[e]={exports:{}};return t[e](n,n.exports,l),n.exports}l.d=function(e,t){for(var a in t)l.o(t,a)&&!l.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){l.r(i),l.d(i,{default:function(){return S}});var e=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",["table"===e.uiType?a("el-button",{attrs:{type:"text"},on:{click:function(t){e.showSubForm=!0}}},[e._v("查看子表单")]):"table"===e.showStyle?a("SubFormStyleTable",e._b({attrs:{value:e.subformData,columns:e.columns,subformPerm:e.subformPerm,fieldConf:e.fieldConf,mode:e.mode,"max-height":e.maxHeight,"show-header":e.showHeader,resizable:e.resizable,container:e.fieldSelf,linkageItem:e.linkageItem},on:{change:e.handleChange}},"SubFormStyleTable",e.$attrs,!1)):a("SubFormStyleCard",e._b({attrs:{value:e.subformData,columns:e.columns,subformPerm:e.subformPerm,fieldConf:e.fieldConf,mode:e.mode,"max-height":e.maxHeight,container:e.fieldSelf,linkageItem:e.linkageItem},on:{change:e.handleChange}},"SubFormStyleCard",e.$attrs,!1)),e._v(" "),"table"===e.uiType?a("el-dialog",{attrs:{title:e.subFormDialogTitle,visible:e.showSubForm,width:"50%"},on:{"update:visible":function(t){e.showSubForm=t},close:function(t){e.showSubForm=!1}}},[a("div",{staticStyle:{"max-height":"70vh",overflow:"auto"}},["table"===e.showStyle?a("SubFormStyleTable",e._b({attrs:{value:e.subformData,columns:e.columns,subformPerm:e.subformPerm,fieldConf:e.fieldConf,mode:e.mode,"max-height":e.dialogTableMaxHeight,"show-header":!0,resizable:!0,container:e.fieldSelf,linkageItem:e.linkageItem},on:{change:e.handleChange}},"SubFormStyleTable",e.$attrs,!1)):a("SubFormStyleCard",e._b({attrs:{value:e.subformData,columns:e.columns,subformPerm:e.subformPerm,fieldConf:e.fieldConf,container:e.fieldSelf,linkageItem:e.linkageItem,mode:e.mode},on:{change:e.handleChange}},"SubFormStyleCard",e.$attrs,!1))],1)]):e._e()],1)};e._withStripped=!0;var t=l(3663),a=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("el-table",{staticStyle:{width:"100%"},attrs:{data:e.showSubformData,"max-height":e.maxHeight,"show-header":e.showHeader,resizable:e.resizable,border:"",stripe:""}},[e.showIndex?a("el-table-column",{attrs:{type:"index",label:e.indexLabel,width:100}}):e._e(),e._v(" "),e._l(e.columns,(function(t){return a("el-table-column",{key:t.key,attrs:{prop:t.id,label:t.label,"min-width":t.minWidth,sortable:t.sortable,"sort-by":t.sortBy},scopedSlots:e._u([{key:"default",fn:function(l){return[a("bpm-sub-form-field",e._b({attrs:{type:t.data.type,fieldConf:t.data,mode:e.getFieldMode(t.data.perm),uiType:"table",rowIndex:l.row.rowIndex,container:e.container},on:{input:e.handleInput,change:e.handleChange},model:{value:l.row[t.id],callback:function(a){e.$set(l.row,t.id,a)},expression:"scope.row[col.id]"}},"bpm-sub-form-field",e.$attrs,!1))]}}],null,!0)})})),e._v(" "),e.canRemove?a("el-table-column",{attrs:{prop:"delete",label:"操作",width:100},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{staticClass:"btn-delete",attrs:{type:"danger",icon:"el-icon-delete",circle:""},on:{click:function(a){return e.handleRemoveItem(t.row.rowIndex)}}})]}}],null,!1,2495394456)}):e._e()],2),e._v(" "),e.canAdd?a("el-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"default",icon:"el-icon-plus"},on:{click:e.handleAddItem}},[e._v("添加项")]):e._e()],1)};a._withStripped=!0;var n={props:{value:{type:Array,default(){return[]}},columns:{type:Array,default(){return[]}},subformPerm:{type:Object,default(){return{}}},fieldConf:{type:Object,default(){return{}}},mode:{type:String,default:"view"},maxHeight:{type:[Number,String],default:500},container:{type:Object,default(){return{}}}},data(){return{subformData:[],showSubformData:[],_oldVal:null}},computed:{userId(){return _.get(this.$bpm.userInfo,"user_id",0)},maxId(){let e=_.map(this.subformData,"_meta.id");return _.max(e)||0},originItem(){let e={};const t={int:0,text:"",array:[],struct:[]};return this.columns.forEach((a=>{e[a.id]=t[a.data.value_type]||""})),e},canAdd(){return"edit"===this.mode&&this.subformPerm.creatable},canRemove(){return"edit"===this.mode&&this.subformPerm.deletable},showIndex(){return!!this.fieldConf.show_index},indexLabel(){return this.fieldConf.index_label||zj.z("序号","c.b2.common.subform_index")},groupField(){return _.get(this.fieldConf,"group_by.by","")},showField(){return _.get(this.fieldConf,"is_show_field")},readonly(){return!_.get(this.fieldConf,"perm.editable",!1)}},watch:{value:{handler(e){e&&_.isArray(e)?this.subformData=e:this.subformData=[]},immediate:!0},subformData:{handler(e){this.showSubformData=this.setData(e),console.log("this.showSubformData",this.showSubformData)},deep:!0,immediate:!0}},methods:{getFieldMode(e){let t=this.mode;return!e||"edit"!==t||e.editable||e.writable||(t="view"),t},throttleEmit:_.throttle((function(){"edit"===this.mode&&this.$emit("change",this.subformData)}),1e3),handleChange(e){console.log("field change: ",e),this.throttleEmit()},handleInput(e){console.log("field input: ",e)},async handleAddItem(){let e=this.maxId+1,t=this.subformData.length,a=t>=1?this.subformData[t-1]:_.cloneDeep(this.originItem),l=_.get(this.fieldConf,"fill_in_last_fields",[]);a=_.pick(a,l),_.isEmpty(a)||delete a._meta,console.log("lastItem: ",a);let i={isNew:!0,_meta:{id:e,creator:this.userId,is_deleted:!1}};i=_.merge(i,a),await this.linkageItem.fillDefault(i,[],this.mode),!this.subformData||_.isEmpty(this.subformData)?this.subformData=[i]:this.subformData.push(i),console.log("this.subformData",this.subformData);let{relyHandleList:n,firstId:r}=this.linkageItem.getRelyHandleList("sure000");_.set(this.relyHandleListMap,this.subformData.length-1,n),_.isEmpty(n)&&this.$bpm.$emit("initRelyComplete",this),r&&setTimeout((async()=>{let e=await this.linkageItem.loadLinkage(n,this.subformData,this.container.formData,this.fieldConf.id,this.subformData.length-1);_.map(e,((e,t)=>{this.$set(this.subformData[this.subformData.length-1],`${t}`,e)})),this.$bpm.$emit("handeInitRely",{id:r,rowIndex:this.subformData.length-1})}),500)},setData(e){let t=this.showField,a=_.filter(e,((e,a)=>(e.rowIndex=a,!e._meta.is_deleted&&(!t||t&&(2==e[t]||!e[t])))));if(this.groupField&&this.$q.platform.is.desktop&&this.readonly){let e=_.groupBy(a,this.groupField);_.map(e,((e,t)=>{_.each(e,((e,a)=>{0==a&&(e._groupField=t)}))}))}return console.log("tableData",a),this._oldVal=JSON.stringify(e),a},handleRemoveItem(e){this.subformData[e].isNew?this.subformData.splice(e,1):this.subformData[e]._meta.is_deleted=!0,this.handleChange()}}},r={name:"SubFormStyleTable",mixins:[n],props:{showHeader:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},linkageItem:{type:Object,default:function(){return{}}}}},o=l(1900),s=(0,o.Z)(r,a,[],!1,null,null,null);s.options.__file="components/lib/bpmSubForm/src/table.vue";var d=s.exports,m=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{style:{overflow:"auto"}},[e._l(e.showSubformData,(function(t,l){return a("el-card",{key:l,staticClass:"bpm-subform-card",class:e.mode,attrs:{shadow:"hover","body-style":{padding:"10px 20px",overflow:"auto",position:"relative",paddingRight:e.canRemove?"70px":"20px"}}},[a("el-form",{attrs:{"label-width":"180px",inline:!1}},[e.showIndex?a("el-form-item",{attrs:{label:e.indexLabel}},[e._v("\n "+e._s(l+1)+"\n ")]):e._e(),e._v(" "),e._l(e.columns,(function(i){return a("el-form-item",{key:i.key,attrs:{label:i.label,required:i.data.check&&i.data.check.required}},[a("bpm-sub-form-field",e._b({attrs:{type:i.data.type,fieldConf:i.data,mode:e.getFieldMode(i.data.perm),uiType:"form",rowIndex:l,container:e.container},on:{change:e.handleChange},model:{value:t[i.id],callback:function(a){e.$set(t,i.id,a)},expression:"item[col.id]"}},"bpm-sub-form-field",e.$attrs,!1))],1)}))],2),e._v(" "),e.canRemove?a("el-button",{staticClass:"btn-delete",attrs:{type:"danger",icon:"el-icon-delete",circle:""},on:{click:function(a){return e.handleRemoveItem(t.rowIndex)}}}):e._e()],1)})),e._v(" "),e.canAdd?a("el-button",{attrs:{type:"default",icon:"el-icon-plus"},on:{click:e.handleAddItem}},[e._v("添加项")]):e._e()],2)};m._withStripped=!0;var p={name:"SubFormStyleCard",mixins:[n],props:{linkageItem:{type:Object,default:function(){return{}}}}},u=(0,o.Z)(p,m,[],!1,null,null,null);u.options.__file="components/lib/bpmSubForm/src/card.vue";var h=u.exports,c=l(4488);class f{constructor(e,t){this.penetrationZList=[],this.elementIdList=[],this.eleMap={},this.relyGraphData={nodes:[],edges:[]},this.elements=[],this.bpm=e,this.value=t}addStackArr(e,t,a){this.eleMap=t,this.elements=_.concat(this.elements,e),this.elementIdList=_.map(t,"id"),_.each(e,(e=>{a&&_.set(e,"parentId",a);let l=_.get(e,"linkage.depends",[]),i=_.get(e,"scope.depends",[]),n=_.get(e,"range_remote.depends",[]),r=_.concat(l,i);r=_.concat(r,n),a||(this.penetrationZList=_.concat(this.penetrationZList,r)),e.elements&&this.addStackArr(e.elements,t,e.id)})),this.createTopoGraph(e),this.penetrationZList=_.uniq(this.penetrationZList),this.penetrationZList=_.intersection(this.elementIdList,this.penetrationZList),this.relyGraphData.nodes.push({id:"sure000",name:"顶点"}),_.each(this.penetrationZList,(e=>{this.relyGraphData.edges.push({source:"sure000",target:e})}))}createTopoGraph(e){_.each(e,(e=>{let t=_.get(e,"mappings",[]),a=_.map(t,"local_field_id");_.each(a,(t=>{if(_.includes(this.elementIdList,t)){let a=_.get(this.eleMap,t);this.relyGraphData.nodes.push(a),this.relyGraphData.nodes.push(e),this.relyGraphData.edges.push({source:e.id,target:t})}}));let l=_.get(e,"linkage.depends",[]),i=_.get(e,"scope.depends",[]),n=_.get(e,"range_remote.depends",[]),r=_.concat(l,i);r=_.concat(r,n);let o=_.get(this.eleMap,e.id);if(_.each(r,(e=>{_.get(this.eleMap,e)||(_.pullAll(r,[e]),r=_.cloneDeep(r))})),r.length){let t=_.pullAll(this.penetrationZList,[e.id]);this.penetrationZList=_.cloneDeep(t)}_.each(r,(t=>{if(t&&e.id&&_.includes(this.elementIdList,t)){let a=_.get(this.eleMap,t);if(!a||!o)return;let l=o.id,i=_.get(this.eleMap,t);a&&!i&&(this.penetrationZList=_.replace(this.penetrationZList,t,l),this.penetrationZList=_.split(this.penetrationZList,",")),this.relyGraphData.nodes.push(e),this.relyGraphData.nodes.push(a),this.relyGraphData.edges.push({source:t,target:l})}e.elements&&this.createTopoGraph(e.elements)}))}))}getRelyHandleList(e,t){let a=[];const{breadthFirstSearch:l}=c.Algorithm;let i=null;return l(this.relyGraphData,e,{enter:({current:e,previous:t})=>{},leave:({current:l,previous:n})=>{i||l==e||t&&!_.includes(t,l)||(i=l),l!=e&&a.push(l)}}),{relyHandleList:a,firstId:i}}async loadLinkage(e,t,a,l,i){let n=[],r={};_.each(e,(e=>{let t=_.get(this.eleMap,e),l=_.get(t,"linkage.depends");if("Quote"==t.type&&(l=_.concat(l,_.get(t,"scope.depends"))),l=_.intersection(l,this.elementIdList),!_.isEmpty(l)){let t={calculate_type:"linkage",field_def_id:e},o=_.pick(a,l);r=_.merge(r,o),_.isNil(i)||_.set(t,"idx",i),n.push(t)}})),t&&_.set(r,l,t);let o=await this.bpm.loadResult({params:{cal_fields:n,fields:r}});return _.map(o.data,((e,t)=>{let a=_.get(this.eleMap,`${t}.type`);_.includes(["SelectFromForm","Quote"],a)&&(e=_.get(e,"data.form_id")),o.data[t]=e})),o.data}async fillDefault(e,t=[],a){let l=[];if(_.each(this.elements,(i=>{if(_.includes(t,i.id))return _.set(e,i.id,null),void this.setLocalCache(i.id,null,a);let n=_.get(e,i.id);if(!_.isNil(n))return;let r=_.get(i,"default.value.type");if("EVCConfig"==r){let t=_.get(i,"default.value.value",null);_.set(e,i.id,t),this.setLocalCache(i.id,t,a)}"EVCExpression"!=r&&"EVCFirstElem"!=r||l.push({calculate_type:"default",field_def_id:i.id})})),_.isEmpty(l))return;let i=await this.bpm.loadResult({params:{cal_fields:l}});_.map(i.data,((t,l)=>{let i=_.get(this.eleMap,`${l}.type`);_.includes(["SelectFromForm","Quote"],i)&&(t=_.get(t,"data.form_id")),_.includes(["MulSelectFromForm"],i)&&(t=_.map(t,"data.form_id")),_.set(e,l,t),this.setLocalCache(l,t,a)}))}setLocalCache(e,t,a){let l=_.get(this.eleMap,`${e}.value_type`);this.bpm.setLocalCache(a,`${e}.${l}`,t)}}var y={name:"BpmSubForm",components:{SubFormStyleTable:d,SubFormStyleCard:h},props:{value:{type:Array,default(){return[]}},type:{type:String,default:"XSubForm"},fieldConf:{type:Object,default(){return{}}},mode:{type:String,default:"view"},uiType:{type:String,default:"default"},maxHeight:{type:[Number,String],default:500},showHeader:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},container:{type:Object,default:function(){return{}}}},data(){return{subformData:[],dialogTableMaxHeight:500,showSubForm:!1,linkageItem:null,dobounceSetData:_.debounce(_.bind(this.setData,this),150,{trailing:!0,leading:!1}),relyHandleList:[],relyHandleListMap:{}}},computed:{fieldSelf(){return this},columns(){const e=this.fieldConf.elements||[],a=[];return e.forEach((e=>{const l=t.r[e.type]||{},i=e.perm||{visible:!0,editable:!0,writable:!0};if(this.dm||i.visible){let t=this.mode;"edit"!==t||i.editable||i.writable||(t="view"),a.push({key:e.id,id:e.id,label:e.name||e.id,minWidth:l.tableColWidth||100,sortable:!0,sortBy:e.id,fieldMode:t,data:e})}})),a},subFormDialogTitle(){return this.fieldConf.name||this.fieldConf.id},showStyle(){return this.fieldConf.style||"table"},subformPerm(){return this.fieldConf.perm||{creatable:!1,deletable:!1,editable:!1,memorable:!1,modifiable:!1,visible:!0,writable:!1}},isSubForm(){return!0},elementIdList(){return _.map(this.fieldConf.elements,"id")},eleMap(){let e=this.fieldConf.elements,t=_.get(this.container,"formSchema.elements");return e=_.concat(e,t),_.keyBy(e,"id")}},watch:{value:{handler(e){e&&_.isArray(e)?this.subformData=e:this.subformData=[]},immediate:!0}},created(){this.linkageItem=new f(this.$bpm),this.dialogTableMaxHeight=Math.floor(window.innerHeight/100*70-114)},mounted(){this.linkageItem.addStackArr(this.fieldConf.elements,this.eleMap),this.dobounceSetData(),this.setData(),this.initLinkage()},methods:{handleChange(e){this.$emit("input",e),this.$emit("change",e)},initLinkage(){let{relyHandleList:e}=this.linkageItem.getRelyHandleList("sure000");_.set(this.relyHandleListMap,this.value.length-1,e),console.log("relyHandleList",e),console.log("this.relyHandleListMap",this.relyHandleListMap),setTimeout((()=>{console.log("initRelyComplete_subFormInitLinkage",this),this.$bpm.$emit("initRelyComplete",this)}),2e3)},handleNextRely(e){console.log("sub-form-handleNextRely");let t=_.get(this.relyHandleListMap,e);console.log("sub-form-handleNextRely_relyHandleList",t),t&&t.shift(),_.isEmpty(t)&&this.$bpm.$emit("initRelyComplete",this);let a=_.head(t,e);a&&this.$bpm.$emit("handeInitRely",{id:a,rowIndex:e})},async handleRelyById(e,t){console.log("sub-form-handleRelyById",e),console.log("sub-form-handleRelyById-rowIndex",t),console.log("sub-form-handleRelyById-this.elementIdList",this.elementIdList);let{relyHandleList:a,firstId:l}=this.linkageItem.getRelyHandleList(e,this.elementIdList);if(console.log("sub-form-handleRelyById-relyHandleList",a),console.log("sub-form-handleRelyById-firstId",l),_.set(this.relyHandleListMap,t,a),l){let e=await this.linkageItem.loadLinkage(a,this.value,this.container.formData,this.fieldConf.id,t);console.log("sub-form-handleRelyById-result",e),_.map(e,((e,a)=>{this.$set(this.value[t],`${a}`,e)})),this.$bpm.$emit("handeRelyById",{id:l,rowIndex:t})}},handleNextRelyById(e){console.log("sub-form-handleNextRelyById");let t=_.get(this.relyHandleListMap,e);console.log("sub-form-handleNextRelyById-relyHandleList",t),t.shift(),_.isEmpty(t)&&this.$bpm.$emit("initRelyComplete",this);let a=_.head(t);a&&this.$bpm.$emit("handeRelyById",{id:a,rowIndex:e})},setData(){}}},g=(0,o.Z)(y,e,[],!1,null,"e0a458ce",null);g.options.__file="components/lib/bpmSubForm/src/main.vue";var b=g.exports;b.install=function(e){e.component(b.name,b)};var S=b}(),i}()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@antv/g6")):"function"==typeof define&&define.amd?define(["@antv/g6"],t):"object"==typeof exports?exports.bpm2=t(require("@antv/g6")):e.bpm2=t(e["@antv/g6"])}(self,(function(e){return function(){"use strict";var t={3663:function(e,t,a){a.d(t,{r:function(){return r}});let l=[{key:"lt",name:"早于"},{key:"gt",name:"晚于"},{key:"gte",name:"不早于"},{key:"lte",name:"不晚于"}],i=[{key:"in",name:"在列表中"}],n=[{key:"in",name:"在列表中"},{key:"all",name:"包含所有"}];const r={Text:{name:"单行文本",hasBpmField:!0,tableColWidth:240,actions:[{key:"contains",name:"包含"},{key:"eq",name:"等于"}],attrs:["type","value_type","id","name","linkage"]},TextArea:{name:"多行文本",hasBpmField:!0,tableColWidth:300,actions:[{key:"contains",name:"包含"},{key:"eq",name:"等于"}],attrs:["type","value_type","id","name","linkage"]},SerialNumber:{name:"流水号",hasBpmField:!0,actions:[{key:"contains",name:"包含"}],options:{type:"Text"},attrs:["type","id","name","linkage"]},Number:{name:"数字",hasBpmField:!0,tableColWidth:200,actions:[{key:"eq",name:"等于"},{key:"gt",name:"大于"},{key:"gte",name:"大于等于"},{key:"lt",name:"小于"},{key:"lte",name:"小于等于"},{key:"ne",name:"不等于"}],attrs:["type","id","name","value_type","is_int","view.precision","linkage"]},DateTime:{name:"日期时间选择器",tableColWidth:240,hasBpmField:!0,actions:l,attrs:["type","id","name","check.format","view.format","linkage"]},Date:{name:"日期选择器",tableColWidth:240,hasBpmField:!0,actions:l,attrs:["type","id","name","check.format","view.format","linkage"]},Time:{name:"时间选择器",hasBpmField:!0,tableColWidth:240,actions:l,attrs:["type","id","name","check.format","view.format","linkage"]},Timestamp:{name:"※时间戳",tableColWidth:240,actions:l,attrs:["type","id","name","check.format","view.format","linkage"]},Select:{name:"单选",hasBpmField:!0,tableColWidth:220,actions:i,options:{type:"MulSelect"},attrs:["type","id","name","value_type","style","range_enum","linkage"]},Status:{name:"状态",hasBpmField:!0,tableColWidth:150,actions:i,options:{type:"MulSelect"},attrs:["type","id","name","value_type","style","range_enum","linkage"]},MulSelect:{name:"多选",hasBpmField:!0,tableColWidth:220,actions:n,attrs:["type","id","name","value_type","result_type","style","range_enum","linkage"]},SelectFromForm:{name:"远程单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectFromForm"},attrs:["type","id","name","range_remote","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.form","range_remote.depends","linkage"]},MulSelectFromForm:{name:"远程多项选择",hasBpmField:!0,tableColWidth:200,actions:n,attrs:["type","id","name","range_remote","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.form","range_remote.depends","linkage"]},SelectProject:{name:"项目单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectProject"},attrs:["type","id","name","range_remote","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},MulSelectProject:{name:"项目多项选择",hasBpmField:!0,tableColWidth:200,actions:n,attrs:["type","id","name","range_remote","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},SelectUser:{name:"用户单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectUser"},attrs:["type","id","name","range_remote","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},MulSelectUser:{name:"用户多项选择",hasBpmField:!0,tableColWidth:200,actions:n,options:{type:"MulSelectUser"},attrs:["type","id","name","range_remote","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},SelectURUser:{name:"用户单项选择(新)",hasBpmField:!0,tableColWidth:400,actions:i,options:{type:"MulSelectURUser"},attrs:["type","id","name","range_remote","value_type","filters","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},MulSelectURUser:{name:"用户多项选择(新)",hasBpmField:!0,tableColWidth:400,actions:n,options:{type:"MulSelectURUser"},attrs:["type","id","name","range_remote","value_type","filters","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},SelectRootCategory:{name:"根任务类型选择",hasBpmField:!0,tableColWidth:200,actions:[{key:"eq",name:"等于"}],attrs:["type","id","name","category_cls","value_type","linkage"]},SelectCheckItem:{name:"检查项单项选择",hasBpmField:!0,actions:i,tableColWidth:200,options:{type:"MulSelectCheckItem"},attrs:["type","id","name","category_cls","value_type","range_remote","root_category","tree_select","can_select","can_select.filter_expression","range_remote.filter_expression","range_remote.depends","linkage"]},MulSelectCheckItem:{name:"检查项多项选择",hasBpmField:!0,tableColWidth:200,actions:n,attrs:["type","id","name","category_cls","value_type","range_remote","root_category","tree_select","can_select","can_select.filter_expression","range_remote.filter_expression","range_remote.depends","linkage"]},SelectSort:{name:"分类单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectSort"},attrs:["type","id","name","value_type","range_remote","tree_select","can_select","can_select.filter_expression","range_remote.filter_expression","range_remote.depends","linkage"]},MulSelectSort:{name:"分类多项选择",hasBpmField:!0,tableColWidth:200,actions:n,attrs:["type","id","name","value_type","range_remote","tree_select","can_select","can_select.filter_expression","range_remote.filter_expression","range_remote.depends","linkage"]},SelectPartner:{name:"合作伙伴单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectPartner"},attrs:["type","id","name","value_type","range_remote","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},MulSelectPartner:{name:"合作伙伴多项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectPartner"},attrs:["type","id","name","value_type","range_remote","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},SelectOrg:{name:"单位单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectOrg"},attrs:["type","id","name","value_type","range_remote","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},MulSelectOrg:{name:"单位多项选择",hasBpmField:!0,tableColWidth:200,actions:n,attrs:["type","id","name","value_type","range_remote","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.depends","linkage"]},Audit:{name:"审批",hasBpmField:!0,actions:[{key:"ar_eq",name:"审批结果等于"},{key:"ar_in",name:"审批结果在列表中"}],actionOptions:[{value:0,label:"未审批"},{value:1,label:"审批通过"},{value:2,label:"审批未通过"}],attrs:["type","id","name","linkage"],options:{result_type:"Array",value_type:"int",type:"MulSelect",style:"default",range_enum:[[0,"未审批"],[1,"通过"],[2,"未通过"]]}},MulArea:{name:"区域多项选择",actions:n,attrs:["type","id","name","value_type","can","linkage"]},Area:{name:"区域单项选择",actions:i,options:{type:"MulArea"},attrs:["type","id","name","value_type","can","linkage"]},SelectFormId:{name:"表单单项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectFormId"},attrs:["type","id","name","value_type","form_select_type","linkage"]},MulSelectFormId:{name:"表单多项选择",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectFormId"},attrs:["type","id","name","value_type","form_select_type","linkage"]},SelectFromField:{name:"远程单选(从字段)",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectFromField"},attrs:["type","id","name","range_remote","style","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.form","range_remote.depends","linkage"]},MulSelectFromField:{name:"远程多选(从字段)",hasBpmField:!0,tableColWidth:200,actions:i,options:{type:"MulSelectFromField"},attrs:["type","id","name","range_remote","style","value_type","range_remote.filter_expression","range_remote.store_field","range_remote.display_field","range_remote.form","range_remote.depends","linkage"]},MulSelectEntranceForm:{name:"远程多项选择(从入口)",hasBpmField:!0},SelectHouseOwner:{name:"业主选择"},MulSelectIssue:{name:"问题选择"},MulFile:{name:"附件",hasBpmField:!0,tableColWidth:150},MulImage:{name:"图片",hasBpmField:!0,tableColWidth:150},Signature:{name:"签名",hasBpmField:!0},OnlineEditor:{name:"在线文档编辑器"},Spliter:{name:"分割线",hasBpmField:!1},Stepper:{name:"步进器",hasBpmField:!1},Quote:{name:"跨表单数据引用",hasBpmField:!1},Order:{name:"排序控件",hasBpmField:!1},SubForm:{name:"子表单",hasBpmField:!0},XSubForm:{name:"子表单(增强版)",hasBpmField:!0},OrderSubForm:{name:"排序子表单",hasBpmField:!0},AreaElevation:{name:"区域快速选择器",hasBpmField:!0,tableColWidth:200},RichText:{name:"富文本编辑框",hasBpmField:!0,tableColWidth:100}}},1900:function(e,t,a){function l(e,t,a,l,i,n,r,o){var s,d="function"==typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=a,d._compiled=!0),l&&(d.functional=!0),n&&(d._scopeId="data-v-"+n),r?(s=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__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(r)},d._ssrRegister=s):i&&(s=o?function(){i.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:i),s)if(d.functional){d._injectStyles=s;var m=d.render;d.render=function(e,t){return s.call(t),m(e,t)}}else{var p=d.beforeCreate;d.beforeCreate=p?[].concat(p,s):[s]}return{exports:e,options:d}}a.d(t,{Z:function(){return l}})},4488:function(t){t.exports=e}},a={};function l(e){var i=a[e];if(void 0!==i)return i.exports;var n=a[e]={exports:{}};return t[e](n,n.exports,l),n.exports}l.d=function(e,t){for(var a in t)l.o(t,a)&&!l.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){l.r(i),l.d(i,{default:function(){return S}});var e=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",["table"===e.uiType?a("el-button",{attrs:{type:"text"},on:{click:function(t){e.showSubForm=!0}}},[e._v("查看子表单")]):"table"===e.showStyle?a("SubFormStyleTable",e._b({attrs:{value:e.subformData,columns:e.columns,subformPerm:e.subformPerm,fieldConf:e.fieldConf,mode:e.mode,dm:e.dm,"max-height":e.maxHeight,"show-header":e.showHeader,resizable:e.resizable,container:e.fieldSelf,linkageItem:e.linkageItem},on:{change:e.handleChange}},"SubFormStyleTable",e.$attrs,!1)):a("SubFormStyleCard",e._b({attrs:{value:e.subformData,columns:e.columns,subformPerm:e.subformPerm,fieldConf:e.fieldConf,mode:e.mode,dm:e.dm,"max-height":e.maxHeight,container:e.fieldSelf,linkageItem:e.linkageItem},on:{change:e.handleChange}},"SubFormStyleCard",e.$attrs,!1)),e._v(" "),"table"===e.uiType?a("el-dialog",{attrs:{title:e.subFormDialogTitle,visible:e.showSubForm,width:"50%"},on:{"update:visible":function(t){e.showSubForm=t},close:function(t){e.showSubForm=!1}}},[a("div",{staticStyle:{"max-height":"70vh",overflow:"auto"}},["table"===e.showStyle?a("SubFormStyleTable",e._b({attrs:{value:e.subformData,columns:e.columns,subformPerm:e.subformPerm,fieldConf:e.fieldConf,mode:e.mode,dm:e.dm,"max-height":e.dialogTableMaxHeight,"show-header":!0,resizable:!0,container:e.fieldSelf,linkageItem:e.linkageItem},on:{change:e.handleChange}},"SubFormStyleTable",e.$attrs,!1)):a("SubFormStyleCard",e._b({attrs:{value:e.subformData,columns:e.columns,subformPerm:e.subformPerm,fieldConf:e.fieldConf,container:e.fieldSelf,linkageItem:e.linkageItem,mode:e.mode,dm:e.dm},on:{change:e.handleChange}},"SubFormStyleCard",e.$attrs,!1))],1)]):e._e()],1)};e._withStripped=!0;var t=l(3663),a=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("el-table",{staticStyle:{width:"100%"},attrs:{data:e.showSubformData,"max-height":e.maxHeight,"show-header":e.showHeader,resizable:e.resizable,border:"",stripe:""}},[e.showIndex?a("el-table-column",{attrs:{type:"index",label:e.indexLabel,width:100}}):e._e(),e._v(" "),e._l(e.columns,(function(t){return a("el-table-column",{key:t.key,attrs:{prop:t.id,label:t.label,"min-width":t.minWidth,sortable:t.sortable,"sort-by":t.sortBy},scopedSlots:e._u([{key:"default",fn:function(l){return[a("bpm-sub-form-field",e._b({attrs:{type:t.data.type,fieldConf:t.data,mode:e.dm?e.mode:e.getFieldMode(t.data.perm),dm:e.dm,uiType:"table",rowIndex:l.row.rowIndex,container:e.container},on:{input:e.handleInput,change:e.handleChange},model:{value:l.row[t.id],callback:function(a){e.$set(l.row,t.id,a)},expression:"scope.row[col.id]"}},"bpm-sub-form-field",e.$attrs,!1))]}}],null,!0)})})),e._v(" "),e.canRemove?a("el-table-column",{attrs:{prop:"delete",label:"操作",width:100},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{staticClass:"btn-delete",attrs:{type:"danger",icon:"el-icon-delete",circle:""},on:{click:function(a){return e.handleRemoveItem(t.row.rowIndex)}}})]}}],null,!1,2495394456)}):e._e()],2),e._v(" "),e.canAdd?a("el-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"default",icon:"el-icon-plus"},on:{click:e.handleAddItem}},[e._v("添加项")]):e._e()],1)};a._withStripped=!0;var n={props:{value:{type:Array,default(){return[]}},columns:{type:Array,default(){return[]}},subformPerm:{type:Object,default(){return{}}},fieldConf:{type:Object,default(){return{}}},mode:{type:String,default:"view"},maxHeight:{type:[Number,String],default:500},container:{type:Object,default(){return{}}}},data(){return{subformData:[],showSubformData:[],_oldVal:null}},computed:{userId(){return _.get(this.$bpm.userInfo,"user_id",0)},maxId(){let e=_.map(this.subformData,"_meta.id");return _.max(e)||0},originItem(){let e={};const t={int:0,text:"",array:[],struct:[]};return this.columns.forEach((a=>{e[a.id]=t[a.data.value_type]||""})),e},canAdd(){return"edit"===this.mode&&(this.subformPerm.creatable||this.dm)},canRemove(){return"edit"===this.mode&&(this.subformPerm.deletable||this.dm)},showIndex(){return!!this.fieldConf.show_index},indexLabel(){return this.fieldConf.index_label||zj.z("序号","c.b2.common.subform_index")},groupField(){return _.get(this.fieldConf,"group_by.by","")},showField(){return _.get(this.fieldConf,"is_show_field")},readonly(){return!_.get(this.fieldConf,"perm.editable",!1)}},watch:{value:{handler(e){e&&_.isArray(e)?this.subformData=e:this.subformData=[]},immediate:!0},subformData:{handler(e){this.showSubformData=this.setData(e),console.log("this.showSubformData",this.showSubformData)},deep:!0,immediate:!0}},methods:{getFieldMode(e){let t=this.mode;return!e||"edit"!==t||e.editable||e.writable||(t="view"),t},throttleEmit:_.throttle((function(){"edit"===this.mode&&this.$emit("change",this.subformData)}),1e3),handleChange(e){console.log("field change: ",e),this.throttleEmit()},handleInput(e){console.log("field input: ",e)},async handleAddItem(){let e=this.maxId+1,t=this.subformData.length,a=t>=1?this.subformData[t-1]:_.cloneDeep(this.originItem),l=_.get(this.fieldConf,"fill_in_last_fields",[]);a=_.pick(a,l),_.isEmpty(a)||delete a._meta,console.log("lastItem: ",a);let i={isNew:!0,_meta:{id:e,creator:this.userId,is_deleted:!1}};i=_.merge(i,a),await this.linkageItem.fillDefault(i,[],this.mode),!this.subformData||_.isEmpty(this.subformData)?this.subformData=[i]:this.subformData.push(i),console.log("this.subformData",this.subformData);let{relyHandleList:n,firstId:r}=this.linkageItem.getRelyHandleList("sure000");_.set(this.relyHandleListMap,this.subformData.length-1,n),_.isEmpty(n)&&this.$bpm.$emit("initRelyComplete",this),r&&setTimeout((async()=>{let e=await this.linkageItem.loadLinkage(n,this.subformData,this.container.formData,this.fieldConf.id,this.subformData.length-1);_.map(e,((e,t)=>{this.$set(this.subformData[this.subformData.length-1],`${t}`,e)})),this.$bpm.$emit("handeInitRely",{id:r,rowIndex:this.subformData.length-1})}),500)},setData(e){let t=this.showField,a=_.filter(e,((e,a)=>(e.rowIndex=a,!e._meta.is_deleted&&(!t||t&&(2==e[t]||!e[t])))));if(this.groupField&&this.$q.platform.is.desktop&&this.readonly){let e=_.groupBy(a,this.groupField);_.map(e,((e,t)=>{_.each(e,((e,a)=>{0==a&&(e._groupField=t)}))}))}return console.log("tableData",a),this._oldVal=JSON.stringify(e),a},handleRemoveItem(e){this.subformData[e].isNew?this.subformData.splice(e,1):this.subformData[e]._meta.is_deleted=!0,this.handleChange()}}},r={name:"SubFormStyleTable",mixins:[n],props:{showHeader:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},linkageItem:{type:Object,default:function(){return{}}},mode:{type:String,default:"view"},dm:{type:Boolean,default(){return!1}}}},o=l(1900),s=(0,o.Z)(r,a,[],!1,null,null,null);s.options.__file="components/lib/bpmSubForm/src/table.vue";var d=s.exports,m=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{style:{overflow:"auto"}},[e._l(e.showSubformData,(function(t,l){return a("el-card",{key:l,staticClass:"bpm-subform-card",class:e.mode,attrs:{shadow:"hover","body-style":{padding:"10px 20px",overflow:"auto",position:"relative",paddingRight:e.canRemove?"70px":"20px"}}},[a("el-form",{attrs:{"label-width":"180px",inline:!1}},[e.showIndex?a("el-form-item",{attrs:{label:e.indexLabel}},[e._v("\n "+e._s(l+1)+"\n ")]):e._e(),e._v(" "),e._l(e.columns,(function(i){return a("el-form-item",{key:i.key,attrs:{label:i.label,required:i.data.check&&i.data.check.required}},[a("bpm-sub-form-field",e._b({attrs:{type:i.data.type,fieldConf:i.data,mode:e.getFieldMode(i.data.perm),uiType:"form",rowIndex:l,container:e.container},on:{change:e.handleChange},model:{value:t[i.id],callback:function(a){e.$set(t,i.id,a)},expression:"item[col.id]"}},"bpm-sub-form-field",e.$attrs,!1))],1)}))],2),e._v(" "),e.canRemove?a("el-button",{staticClass:"btn-delete",attrs:{type:"danger",icon:"el-icon-delete",circle:""},on:{click:function(a){return e.handleRemoveItem(t.rowIndex)}}}):e._e()],1)})),e._v(" "),e.canAdd?a("el-button",{attrs:{type:"default",icon:"el-icon-plus"},on:{click:e.handleAddItem}},[e._v("添加项")]):e._e()],2)};m._withStripped=!0;var p={name:"SubFormStyleCard",mixins:[n],props:{linkageItem:{type:Object,default:function(){return{}}}}},u=(0,o.Z)(p,m,[],!1,null,null,null);u.options.__file="components/lib/bpmSubForm/src/card.vue";var h=u.exports,c=l(4488);class f{constructor(e,t){this.penetrationZList=[],this.elementIdList=[],this.eleMap={},this.relyGraphData={nodes:[],edges:[]},this.elements=[],this.bpm=e,this.value=t}addStackArr(e,t,a){this.eleMap=t,this.elements=_.concat(this.elements,e),this.elementIdList=_.map(t,"id"),_.each(e,(e=>{a&&_.set(e,"parentId",a);let l=_.get(e,"linkage.depends",[]),i=_.get(e,"scope.depends",[]),n=_.get(e,"range_remote.depends",[]),r=_.concat(l,i);r=_.concat(r,n),a||(this.penetrationZList=_.concat(this.penetrationZList,r)),e.elements&&this.addStackArr(e.elements,t,e.id)})),this.createTopoGraph(e),this.penetrationZList=_.uniq(this.penetrationZList),this.penetrationZList=_.intersection(this.elementIdList,this.penetrationZList),this.relyGraphData.nodes.push({id:"sure000",name:"顶点"}),_.each(this.penetrationZList,(e=>{this.relyGraphData.edges.push({source:"sure000",target:e})}))}createTopoGraph(e){_.each(e,(e=>{let t=_.get(e,"mappings",[]),a=_.map(t,"local_field_id");_.each(a,(t=>{if(_.includes(this.elementIdList,t)){let a=_.get(this.eleMap,t);this.relyGraphData.nodes.push(a),this.relyGraphData.nodes.push(e),this.relyGraphData.edges.push({source:e.id,target:t})}}));let l=_.get(e,"linkage.depends",[]),i=_.get(e,"scope.depends",[]),n=_.get(e,"range_remote.depends",[]),r=_.concat(l,i);r=_.concat(r,n);let o=_.get(this.eleMap,e.id);if(_.each(r,(e=>{_.get(this.eleMap,e)||(_.pullAll(r,[e]),r=_.cloneDeep(r))})),r.length){let t=_.pullAll(this.penetrationZList,[e.id]);this.penetrationZList=_.cloneDeep(t)}_.each(r,(t=>{if(t&&e.id&&_.includes(this.elementIdList,t)){let a=_.get(this.eleMap,t);if(!a||!o)return;let l=o.id,i=_.get(this.eleMap,t);a&&!i&&(this.penetrationZList=_.replace(this.penetrationZList,t,l),this.penetrationZList=_.split(this.penetrationZList,",")),this.relyGraphData.nodes.push(e),this.relyGraphData.nodes.push(a),this.relyGraphData.edges.push({source:t,target:l})}e.elements&&this.createTopoGraph(e.elements)}))}))}getRelyHandleList(e,t){let a=[];const{breadthFirstSearch:l}=c.Algorithm;let i=null;return l(this.relyGraphData,e,{enter:({current:e,previous:t})=>{},leave:({current:l,previous:n})=>{i||l==e||t&&!_.includes(t,l)||(i=l),l!=e&&a.push(l)}}),{relyHandleList:a,firstId:i}}async loadLinkage(e,t,a,l,i){let n=[],r={};_.each(e,(e=>{let t=_.get(this.eleMap,e),l=_.get(t,"linkage.depends");if("Quote"==t.type&&(l=_.concat(l,_.get(t,"scope.depends"))),l=_.intersection(l,this.elementIdList),!_.isEmpty(l)){let t={calculate_type:"linkage",field_def_id:e},o=_.pick(a,l);r=_.merge(r,o),_.isNil(i)||_.set(t,"idx",i),n.push(t)}})),t&&_.set(r,l,t);let o=await this.bpm.loadResult({params:{cal_fields:n,fields:r}});return _.map(o.data,((e,t)=>{let a=_.get(this.eleMap,`${t}.type`);_.includes(["SelectFromForm","Quote"],a)&&(e=_.get(e,"data.form_id")),o.data[t]=e})),o.data}async fillDefault(e,t=[],a){let l=[];if(_.each(this.elements,(i=>{if(_.includes(t,i.id))return _.set(e,i.id,null),void this.setLocalCache(i.id,null,a);let n=_.get(e,i.id);if(!_.isNil(n))return;let r=_.get(i,"default.value.type");if("EVCConfig"==r){let t=_.get(i,"default.value.value",null);_.set(e,i.id,t),this.setLocalCache(i.id,t,a)}"EVCExpression"!=r&&"EVCFirstElem"!=r||l.push({calculate_type:"default",field_def_id:i.id})})),_.isEmpty(l))return;let i=await this.bpm.loadResult({params:{cal_fields:l}});_.map(i.data,((t,l)=>{let i=_.get(this.eleMap,`${l}.type`);_.includes(["SelectFromForm","Quote"],i)&&(t=_.get(t,"data.form_id")),_.includes(["MulSelectFromForm"],i)&&(t=_.map(t,"data.form_id")),_.set(e,l,t),this.setLocalCache(l,t,a)}))}setLocalCache(e,t,a){let l=_.get(this.eleMap,`${e}.value_type`);this.bpm.setLocalCache(a,`${e}.${l}`,t)}}var y={name:"BpmSubForm",components:{SubFormStyleTable:d,SubFormStyleCard:h},props:{value:{type:Array,default(){return[]}},type:{type:String,default:"XSubForm"},fieldConf:{type:Object,default(){return{}}},mode:{type:String,default:"view"},uiType:{type:String,default:"default"},maxHeight:{type:[Number,String],default:500},showHeader:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},container:{type:Object,default:function(){return{}}},dm:{type:Boolean,default(){return!1}}},data(){return{subformData:[],dialogTableMaxHeight:500,showSubForm:!1,linkageItem:null,dobounceSetData:_.debounce(_.bind(this.setData,this),150,{trailing:!0,leading:!1}),relyHandleList:[],relyHandleListMap:{}}},computed:{fieldSelf(){return this},columns(){const e=this.fieldConf.elements||[],a=[];return e.forEach((e=>{const l=t.r[e.type]||{},i=e.perm||{visible:!0,editable:!0,writable:!0};if(this.dm||i.visible){let t=this.mode;"edit"!==t||i.editable||i.writable||(t="view"),a.push({key:e.id,id:e.id,label:e.name||e.id,minWidth:l.tableColWidth||100,sortable:!0,sortBy:e.id,fieldMode:t,data:e})}})),a},subFormDialogTitle(){return this.fieldConf.name||this.fieldConf.id},showStyle(){return this.fieldConf.style||"table"},subformPerm(){return this.fieldConf.perm||{creatable:!1,deletable:!1,editable:!1,memorable:!1,modifiable:!1,visible:!0,writable:!1}},isSubForm(){return!0},elementIdList(){return _.map(this.fieldConf.elements,"id")},eleMap(){let e=this.fieldConf.elements,t=_.get(this.container,"formSchema.elements");return e=_.concat(e,t),_.keyBy(e,"id")}},watch:{value:{handler(e){e&&_.isArray(e)?this.subformData=e:this.subformData=[]},immediate:!0}},created(){this.linkageItem=new f(this.$bpm),this.dialogTableMaxHeight=Math.floor(window.innerHeight/100*70-114)},mounted(){this.linkageItem.addStackArr(this.fieldConf.elements,this.eleMap),this.dobounceSetData(),this.setData(),this.initLinkage()},methods:{handleChange(e){this.$emit("input",e),this.$emit("change",e)},initLinkage(){let{relyHandleList:e}=this.linkageItem.getRelyHandleList("sure000");_.set(this.relyHandleListMap,this.value.length-1,e),console.log("relyHandleList",e),console.log("this.relyHandleListMap",this.relyHandleListMap),setTimeout((()=>{console.log("initRelyComplete_subFormInitLinkage",this),this.$bpm.$emit("initRelyComplete",this)}),2e3)},handleNextRely(e){console.log("sub-form-handleNextRely");let t=_.get(this.relyHandleListMap,e);console.log("sub-form-handleNextRely_relyHandleList",t),t&&t.shift(),_.isEmpty(t)&&this.$bpm.$emit("initRelyComplete",this);let a=_.head(t,e);a&&this.$bpm.$emit("handeInitRely",{id:a,rowIndex:e})},async handleRelyById(e,t){console.log("sub-form-handleRelyById",e),console.log("sub-form-handleRelyById-rowIndex",t),console.log("sub-form-handleRelyById-this.elementIdList",this.elementIdList);let{relyHandleList:a,firstId:l}=this.linkageItem.getRelyHandleList(e,this.elementIdList);if(console.log("sub-form-handleRelyById-relyHandleList",a),console.log("sub-form-handleRelyById-firstId",l),_.set(this.relyHandleListMap,t,a),l){let e=await this.linkageItem.loadLinkage(a,this.value,this.container.formData,this.fieldConf.id,t);console.log("sub-form-handleRelyById-result",e),_.map(e,((e,a)=>{this.$set(this.value[t],`${a}`,e)})),this.$bpm.$emit("handeRelyById",{id:l,rowIndex:t})}},handleNextRelyById(e){console.log("sub-form-handleNextRelyById");let t=_.get(this.relyHandleListMap,e);console.log("sub-form-handleNextRelyById-relyHandleList",t),t.shift(),_.isEmpty(t)&&this.$bpm.$emit("initRelyComplete",this);let a=_.head(t);a&&this.$bpm.$emit("handeRelyById",{id:a,rowIndex:e})},setData(){}}},g=(0,o.Z)(y,e,[],!1,null,"e0a458ce",null);g.options.__file="components/lib/bpmSubForm/src/main.vue";var b=g.exports;b.install=function(e){e.component(b.name,b)};var S=b}(),i}()}));
|