UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

2 lines (1 loc) 3.87 kB
(function(n,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("../common/index.umd.js"),require("vue"),require("../dynamic-resolver/index.umd.js"),require("../designer-canvas/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","../common/index.umd.js","vue","../dynamic-resolver/index.umd.js","../designer-canvas/index.umd.js"],p):(n=typeof globalThis<"u"?globalThis:n||self,p(n["approval-logs"]={},n.common,n.Vue,n.dynamicResolver,n.designerCanvas))})(this,function(n,p,u,w,L){"use strict";const S={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/approval-logs.schema.json",title:"approval-logs",description:"A Farris Business Component",type:"object",properties:{id:{description:"The unique identifier for a component",type:"string"},type:{description:"The type string of a component",type:"string",default:"approval-logs"},dataId:{type:"string",default:""},displayType:{type:"string",default:"card"},showForecastLogs:{type:"boolean",default:!1},showHistoryLogs:{type:"boolean",default:!1},workflowScriptUrl:{type:"string",default:"/platform/runtime/wf/webapp/mobiletaskcenter/taskComment.js"}},required:["id","type","displayType","showForecastLogs","showHistoryLogs"]},T=new Map([]);function F(e,f,s){var l,a;const r=f,t=(l=s.bindingSourceContext)==null?void 0:l.entityFieldNode;t&&(r.binding={type:"Form",path:t.bindingField,field:t.id,fullPath:t.path});const i=s.parentComponentInstance,o=(a=i==null?void 0:i.schema)==null?void 0:a.type;if(!o||o===L.DgControl.section.type)return r;const d=e.getSchemaByType("section"),c=Math.random().toString().slice(2,6);return Object.assign(d,{id:`section-${c}`,appearance:{class:"f-section-in-mainsubcard"},mainTitle:"审批记录",contents:[r]}),d}const y={dataId:{type:String,default:""},displayType:{type:String,default:"card"},showForecastLogs:{type:Boolean,default:!1},showHistoryLogs:{type:Boolean,default:!1},workflowScriptUrl:{type:String,default:""}},b=w.getPropsResolverGenerator(y,S,T,F),g={};function I(){function e(s=1){const r=s*60*60*1e3,t=Date.now();return t-t%r}function f(s){if(!s)return Promise.resolve();if(g[s])return g[s];const r=new Promise((t,i)=>{const o=document.createElement("script");o.src=s+`?v=${e()}`,o.type="text/javascript",o.async=!0;function d(){o.removeEventListener("load",c),o.removeEventListener("error",l)}function c(){d(),t()}function l(a){d(),delete g[s],i(a)}o.addEventListener("load",c),o.addEventListener("error",l),document.head.appendChild(o)});return g[s]=r,r}return{loadJsScript:f}}const j=u.defineComponent({name:"FApprovalLogs",props:y,emits:[],setup(e,f){const{loadJsScript:s}=I(),r=p.isMobilePhone(),t=u.ref();function i(){return!!window.gspTaskCenterBizLog}function o(){return window.gspTaskCenterBizLog.ApprovalLogUtil}function d(){return e.displayType==="data-grid"&&!r?"datagrid":"card"}function c(){t.value&&(t.value.innerHTML="")}function l(){if(d()==="datagrid"){const m={bizInstId:e.dataId,container:t.value,showHeader:!1,showViewProcess:!1,ifForecast:!!e.showForecastLogs,isIncludeHistory:!!e.showHistoryLogs};o().getWebHtml(m)}else{const m={bizInstId:e.dataId,container:t.value,terminal:r?"mobile":"web",typeId:"wf",showHeader:!1,showForecastBtn:r,ifForecast:!!e.showForecastLogs,isIncludeHistory:!!e.showHistoryLogs};o().getWebLogsHtml(m)}}async function a(){if(!e.dataId||!t.value){c();return}i()||await s(e.workflowScriptUrl).catch(v=>{console.error(v)}),i()&&l()}u.onMounted(a),u.watch([()=>e.dataId,()=>e.displayType,()=>e.showForecastLogs,()=>e.showHistoryLogs],()=>{c(),a()});function H(){a()}return f.expose({refreshData:H}),()=>u.createVNode("div",{ref:t,class:"fv-approval-logs"},null)}}),h=p.withInstall(j);n.FApprovalLogs=h,n.approvalLogsProps=y,n.default=h,n.propsResolverGenerator=b,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});