@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
957 lines (956 loc) • 29.8 kB
JavaScript
var R = Object.defineProperty;
var k = (c, e, t) => e in c ? R(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t;
var g = (c, e, t) => k(c, typeof e != "symbol" ? e + "" : e, t);
import { isMobilePhone as B, withInstall as A } from "../../components/common/index.esm.js";
import { getPropsResolverGenerator as N, createApprovalLogsBindingResolver as U } from "../../components/dynamic-resolver/index.esm.js";
import { defineComponent as M, ref as P, inject as V, computed as S, onMounted as F, createVNode as u, createTextVNode as y, Fragment as O, watch as $ } from "vue";
import { DgControl as E, canvasChanged as H, refreshCanvas as q, useDesignerComponent as j } from "../../components/designer-canvas/index.esm.js";
import { cloneDeep as z } from "lodash-es";
const _ = "https://json-schema.org/draft/2020-12/schema", D = "https://farris-design.gitee.io/approval-logs.schema.json", G = "approval-logs", J = "A Farris Business Component", W = "object", K = {
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"
}
}, Q = [
"id",
"type",
"displayType",
"showForecastLogs",
"showHistoryLogs"
], X = {
$schema: _,
$id: D,
title: G,
description: J,
type: W,
properties: K,
required: Q
}, Y = /* @__PURE__ */ new Map([]);
function Z(c, e, t) {
var l, d;
const i = e, s = (l = t.bindingSourceContext) == null ? void 0 : l.entityFieldNode;
s && (i.binding = {
type: "Form",
path: s.bindingField,
field: s.id,
fullPath: s.path
});
const o = t.parentComponentInstance, n = (d = o == null ? void 0 : o.schema) == null ? void 0 : d.type;
if (!n || n === E.section.type)
return i;
const a = c.getSchemaByType("section"), r = Math.random().toString().slice(2, 6);
return Object.assign(a, {
id: `section-${r}`,
appearance: {
class: "f-section-in-mainsubcard"
},
mainTitle: "审批记录",
contents: [i]
}), a;
}
const I = {
/** 单据ID */
dataId: { type: String, default: "" },
/** 展示类型 */
displayType: { type: String, default: "card" },
/** 是否展示预测日志 */
showForecastLogs: { type: Boolean, default: !1 },
/** 是否展示历史日志 */
showHistoryLogs: { type: Boolean, default: !1 },
/** 审批流脚本地址 */
workflowScriptUrl: { type: String, default: "" }
}, T = N(
I,
X,
Y,
Z
);
function ee(c) {
const { formSchemaUtils: e, formStateMachineUtils: t } = c;
function i(r, l = "") {
return {
path: l + r.code,
field: r.id,
fullPath: r.code
};
}
function s(r, l = "") {
const d = e.getViewModelById(r);
return d ? d.states.map((p) => i(p, l)) : [];
}
function o(r) {
const l = e.getRootViewModelId(), d = s(r);
if (r === l)
return d;
const p = s(l, "root-component.");
return [...d, ...p];
}
function n(r) {
return r.binding && r.binding.path || r.id || "";
}
function a() {
return t && t.getRenderStates() || [];
}
return { getVariables: o, getControlName: n, getStateMachines: a };
}
class te {
constructor(e) {
g(this, "sessionVariables", [
{
key: "CurrentSysOrgName",
name: "当前组织Name",
description: "当前组织Name"
},
// {
// key: "CurrentSysOrgCode",
// name: "当前组织Code",
// description: "当前组织Code"
// },
{
key: "CurrentSysOrgId",
name: "当前组织Id",
description: "当前组织Id"
},
{
key: "CurrentUserName",
name: "当前用户Name",
description: "当前用户Name"
},
{
key: "CurrentUserCode",
name: "当前用户Code",
description: "当前用户Code"
},
{
key: "CurrentUserId",
name: "当前用户Id",
description: "当前用户Id"
},
{
key: "CurrentLanguage",
name: "当前语言编号",
description: "当前登录的语言编号,例如简体中文返回'zh-CHS',英文返回'en',繁体中文'zh-CHT'"
}
]);
g(this, "expressionNames", {
compute: "计算表达式",
dependency: "依赖表达式",
validate: "验证表达式",
dataPicking: "帮助前表达式",
visible: "可见表达式",
readonly: "只读表达式",
required: "必填表达式"
});
g(this, "getExpressionConverter", (e, t) => ({
convertFrom: (i, s, o, n) => {
const a = o.getExpressionRuleValue(e, t || s);
return a && a.value || "";
},
convertTo: (i, s, o, n, a) => {
var r;
if (s === "dataPicking" && (o != null && o.target)) {
const l = `${o.target}_dataPicking`;
((r = o.rules) == null ? void 0 : r.some(
(p) => p.id === l && p.value
)) ? i.dictPickingExpressionId = l : delete i.dictPickingExpressionId;
}
n.updateExpression(o);
}
}));
this.formSchemaService = e;
}
getExpressionRule(e, t) {
const i = this.getExpressionData();
if (!i)
return "";
const s = i.find((n) => n.target === e);
if (!s)
return "";
const o = s.rules.find((n) => n.type === t);
return o || "";
}
// 获取上下文表单变量
getContextFormVariables() {
const { module: e } = this.formSchemaService.getFormSchema();
if (!e.viewmodels || e.viewmodels.length === 0)
return [];
const t = this.formSchemaService.getRootViewModelId(), i = this.formSchemaService.getViewModelById(t);
if (!i || !i.states || i.states.length === 0)
return [];
const s = [];
return i.states.filter((o) => o.category === "remote").forEach((o) => {
s.push({
key: o.code,
name: o.name,
description: o.name,
category: o.category
});
}), s;
}
createTreeNode(e, t, i = "label") {
return {
id: e.id,
name: e.name,
bindingPath: e[i],
parents: t,
type: "field"
};
}
buildEntityFieldsTreeData(e = null, t) {
const i = [];
return e == null || e.forEach((s) => {
var a;
const o = this.createTreeNode(s, t);
let n = [];
(a = s.type) != null && a.fields && (n = this.buildEntityFieldsTreeData(s.type.fields, [...t, s.label])), i.push({
data: o,
children: n,
expanded: !0
});
}), i;
}
buildChildEntityTreeData(e = null, t) {
const i = [];
return e == null || e.forEach((s) => {
var r, l;
const o = this.createTreeNode(s, t);
o.type = "entity";
const n = this.buildEntityFieldsTreeData((r = s.type) == null ? void 0 : r.fields, [...t, s.label]), a = this.buildChildEntityTreeData((l = s.type) == null ? void 0 : l.entities, [...t, s.label]);
a != null && a.length && (n == null || n.push(...a)), i.push({
data: o,
children: n || [],
// 空值回退
expanded: !0
});
}), i;
}
getEntitiesTreeData() {
const e = this.formSchemaService.getSchemaEntities();
if (!(e != null && e.length))
return [];
const t = e[0];
if (!(t != null && t.type))
return [];
const i = this.buildEntityFieldsTreeData(t.type.fields, [t.code]), s = this.buildChildEntityTreeData(t.type.entities, [t.code]);
return s != null && s.length && (i == null || i.push(...s)), {
entityCode: t.code,
fields: [{
data: this.createTreeNode(t, [], "code"),
children: i || []
}]
};
}
getEntitiesAndVariables() {
return {
entities: this.getEntitiesTreeData(),
variables: {
session: {
name: "系统变量",
items: this.sessionVariables,
visible: !1
},
forms: {
name: "表单变量",
items: this.getContextFormVariables(),
visible: !0
}
}
};
}
onBeforeOpenExpression(e, t, i) {
const s = i === "Field" ? e.binding.field : e.id, o = this.getExpressionRule(s, t), n = this.getEntitiesAndVariables(), a = {
message: ["validate", "required", "dataPicking"].includes(t) && o ? o.message : "",
...n
};
return o.messageType != null && (a.messageType = o.messageType), a;
}
buildRule(e, t, i, s) {
const { expression: o, message: n, messageType: a } = t, r = {
id: `${e}_${i}`,
type: i,
value: o
};
return (i === "validate" || i === "dataPicking" || i === "required") && (r.message = n), i === "dataPicking" && (r.messageType = a), i === "validate" && s && (r.elementId = s), r;
}
getExpressionData() {
const { expressions: e } = this.formSchemaService.getFormSchema().module;
return e || [];
}
updateExpression(e, t, i, s) {
const o = t === "Field" ? e.binding.field : e.id, n = this.buildRule(o, i, s, e.type === "form-group" ? e.id : "");
let r = this.getExpressionData().find((d) => d.targetType === t && d.target === o);
const l = (d) => d.value.trim() === "";
if (r) {
const d = r.rules.find((p) => p.id === n.id);
if (d)
l(n) ? r.rules = r.rules.filter((p) => p.id !== n.id) : (Object.assign(d, n), s === "validate" && e.type === "form-group" && (d.elementId = e.id));
else {
if (l(n))
return null;
r.rules = r.rules || [], r.rules.push(n);
}
} else {
if (l(n))
return null;
r = {
target: `${o}`,
rules: [n],
targetType: t
};
}
return r;
}
getExpressionEditorOptions(e, t, i, s) {
return i.reduce((o, n) => {
var r, l;
const a = t === "Field" ? (r = e == null ? void 0 : e.binding) == null ? void 0 : r.field : e.id;
return o[n] = {
hide: t === "Field" ? !!((l = e == null ? void 0 : e.binding) != null && l.field) : !1,
description: "",
title: this.expressionNames[n],
type: "string",
$converter: this.getExpressionConverter(a),
refreshPanelAfterChanged: !0,
editor: {
type: "expression-editor",
singleExpand: !1,
dialogTitle: `${this.expressionNames[n]}编辑器`,
showMessage: n === "validate" || n === "dataPicking" || n === "required",
showMessageType: n === "dataPicking",
beforeOpen: () => this.onBeforeOpenExpression(e, n, t),
onSubmitModal: (d) => {
const p = this.updateExpression(e, t, d, n);
if (s) {
const f = this.buildRule(a, d, n);
s(f);
}
return p;
}
}
}, o;
}, {});
}
getExpressionInfo(e, t, i) {
const s = t === "Field" ? e.binding.field : e.id, o = this.getExpressionRule(s, i), n = {
value: o && o.value,
targetId: s,
targetType: t,
expressionType: i
};
return o && o.message && (n.message = o.message), n;
}
getExpressionConfig(e, t, i = ["compute", "dependency", "validate"], s) {
var o;
return {
description: "表达式",
title: "表达式",
hide: !(e.binding && ((o = e.binding) == null ? void 0 : o.type) === "Form"),
properties: {
...this.getExpressionEditorOptions(e, t, i, s)
}
};
}
getExpressionOptions(e, t, i) {
const s = this.getExpressionInfo(e, t, i);
return {
dialogTitle: `${this.expressionNames[i] || "表达式"}编辑器`,
singleExpand: !1,
showMessage: i === "required",
beforeOpen: () => this.onBeforeOpenExpression(e, i, t),
expressionInfo: s
};
}
}
class ie {
constructor(e, t) {
g(this, "componentId");
g(this, "viewModelId");
g(this, "eventsEditorUtils");
g(this, "formSchemaUtils");
g(this, "formMetadataConverter");
g(this, "designViewModelUtils");
g(this, "designViewModelField");
g(this, "controlCreatorUtils");
g(this, "designerHostService");
g(this, "designerContext");
g(this, "modalService", null);
/** 表单规则 */
g(this, "formRule", null);
g(this, "schemaService", null);
g(this, "metadataService", null);
g(this, "propertyConfig", {
type: "object",
categories: {}
});
g(this, "expressionProperty");
var i;
this.componentId = e, this.designerHostService = t, this.eventsEditorUtils = t.eventsEditorUtils, this.formSchemaUtils = t.formSchemaUtils, this.formMetadataConverter = t.formMetadataConverter, this.viewModelId = ((i = this.formSchemaUtils) == null ? void 0 : i.getViewModelIdByComponentId(e)) || "", this.designViewModelUtils = t.designViewModelUtils, this.controlCreatorUtils = t.controlCreatorUtils, this.metadataService = t.metadataService, this.schemaService = t.schemaService, this.designerContext = t.designerContext, this.modalService = t.modalService, this.expressionProperty = new te(this.formSchemaUtils);
}
/**
* 是否在响应式表单中
*/
inResponsiveForm() {
var e;
return !!((e = this.designerContext) != null && e.responsiveForm);
}
getFormDesignerInstance() {
var e, t;
return (t = (e = this.designerContext) == null ? void 0 : e.instances) == null ? void 0 : t.formDesigner.value;
}
getTableInfo() {
var e;
return (e = this.schemaService) == null ? void 0 : e.getTableInfoByViewModelId(this.viewModelId);
}
setDesignViewModelField(e) {
var i;
const t = e.binding && e.binding.type === "Form" && e.binding.field;
if (t) {
if (!this.designViewModelField) {
const s = this.designViewModelUtils.getDgViewModel(this.viewModelId);
this.designViewModelField = s.fields.find((o) => o.id === t);
}
e.updateOn = (i = this.designViewModelField) == null ? void 0 : i.updateOn;
}
}
getBasicPropConfig(e) {
return {
description: "Basic Information",
title: "基本信息",
properties: {
id: {
description: "组件标识",
title: "标识",
type: "string",
readonly: !0
},
type: {
description: "组件类型",
title: "控件类型",
type: "select",
editor: {
type: "combo-list",
textField: "name",
valueField: "value",
idField: "value",
editable: !1,
data: [{ value: e.type, name: E[e.type] && E[e.type].name }]
}
}
}
};
}
getAppearanceConfig(e = null, t = {}, i) {
const s = {
title: "外观",
description: "Appearance"
}, o = {
class: {
title: "class样式",
type: "string",
description: "组件的CSS样式",
$converter: "/converter/appearance.converter",
parentPropertyID: "appearance"
},
style: {
title: "style样式",
type: "string",
description: "组件的样式",
$converter: "/converter/appearance.converter",
parentPropertyID: "appearance"
}
};
for (const n in t)
o[n] = Object.assign(o[n] || {}, t[n]);
return {
...s,
properties: { ...o },
setPropertyRelates(n, a) {
if (n) {
switch (n && n.propertyID) {
case "class":
case "style": {
H.value++;
break;
}
}
i && i(n, e, a);
}
}
};
}
/**
*
* @param propertyData
* @param propertyTypes
* @param propertyName
* @param constInfos
* @param variableInfos
* @param expressionType 指定表达式类型,存在属性和表达式类型不一致的情况
* @returns
*/
getPropertyEditorParams(e, t = [], i = "visible", s = {}, o = {}, n = "") {
const { getVariables: a, getControlName: r, getStateMachines: l } = ee(this.designerHostService), d = this.getRealTargetType(e), p = t && t.length > 0 ? t : ["Const", "Variable", "StateMachine", "Expression"], f = {
type: "property-editor",
propertyTypes: p
};
return p.map((m) => {
switch (m) {
case "Const":
Object.assign(f, {
constType: "enum",
constEnums: [{ id: !0, name: "是" }, { id: !1, name: "否" }]
}, s);
break;
case "Expression":
f.expressionConfig = this.getExpressionOptions(e, d, n || i);
break;
case "StateMachine":
f.stateMachines = l();
break;
case "Variable":
Object.assign(f, {
controlName: r(e),
newVariablePrefix: "is",
newVariableType: "Boolean",
variables: a(this.viewModelId),
parentComponentId: this.componentId === "root-component" ? "" : "root-component",
onBeforeOpenVariables: (h) => {
h.value = a(this.viewModelId);
}
}, o), this.designerContext.designerMode === "PC_RTC" && (f.newVariablePrefix = "ext_" + f.newVariablePrefix);
break;
}
}), f;
}
getVisibleProperty(e, t = "") {
var o;
let i = ["Const", "Variable", "StateMachine", "Expression"];
return t === "gridFieldEditor" ? i = ["Const", "Expression"] : t === "form-group" && !((o = e.binding) != null && o.field) ? i = ["Const", "Variable", "StateMachine", "Custom"] : t === "dataGrid" || t === "treeGrid" || t === "wizard" ? i = ["Const", "Variable", "Expression"] : (e.type.indexOf("toolbar-item") > -1 || t === "form-group") && (i = ["Const", "Variable", "StateMachine", "Custom", "Expression"]), {
visible: {
title: "是否可见",
type: "boolean",
description: "运行时组件是否可见",
editor: this.getPropertyEditorParams(e, i, "visible")
}
};
}
/**
* 获取行为
* @param propertyData
* @param viewModelId
* @returns
*/
getBehaviorConfig(e, t = "", i = {}, s) {
const o = {
title: "行为",
description: ""
}, n = this.getVisibleProperty(e, t);
for (const r in i)
n[r] = Object.assign(n[r] || {}, i[r]);
const a = this;
return {
...o,
properties: { ...n },
setPropertyRelates(r, l) {
if (r) {
switch (r.propertyID) {
case "disabled":
case "readonly":
case "visible":
a.afterMutilEditorChanged(e, r);
break;
}
s && s(r, l);
}
}
};
}
/**
* 当多值编辑器变更时
* @param propertyData
* @param changeObject
*/
afterMutilEditorChanged(e, t) {
this.addNewVariableToViewModel(t, this.viewModelId), this.updateExpressionValue(t, e), this.clearExpression(t, e);
}
/**
*
* @param propertyId
* @param componentInstance
* @returns
*/
updateElementByParentContainer(e, t) {
const i = t && t.parent && t.parent.schema;
if (!i)
return;
const s = i.contents.findIndex((n) => n.id === e), o = z(i.contents[s]);
i.contents.splice(s, 1), i.contents.splice(s, 0, o), q();
}
/**
* 属性编辑器,在编辑过程中会新增变量,此处需要将新增的变量追加到ViewModel中
* @param changeObject
* @param viewModelId
* @returns
*/
addNewVariableToViewModel(e, t) {
const i = e.propertyValue;
if (!(i && typeof i == "object") || !(i.type === "Variable" && i.isNewVariable))
return;
const n = {
id: i.field,
category: "locale",
code: i.fullPath,
name: i.fullPath,
type: i.newVariableType || "String",
isRtcVariable: this.designerContext.designerMode === "PC_RTC" ? !0 : void 0
};
delete i.newVariableType, delete i.isNewVariable, this.formSchemaUtils.getVariableByCode(n.code) || this.formSchemaUtils.getViewModelById("root-viewmodel").states.push(n);
}
getExpressions() {
let e = [];
return this.formRule ? (this.formRule.expressions = this.formRule.expressions || [], e = this.formRule.expressions || []) : e = this.formSchemaUtils.getExpressions(), e;
}
/**
* 更新表达式到expressions节点
* @param changeObject
*/
updateExpressionValue(e, t) {
const i = e.propertyValue;
if (!((i && i.type) === "Expression" && i.expressionInfo))
return;
const { expressionId: n, expressionInfo: a } = i, { targetId: r, targetType: l, expressionType: d, value: p, message: f } = a, m = this.getExpressions();
let h = m.find((v) => v.target === r);
h || (h = { target: r, rules: [], targetType: l }, m.push(h));
const x = h.rules.find((v) => v.type === d);
if (x)
x.id = n, x.value = p, x.message = f, (d === "minDate" || d === "maxDate" || d === "defaultTime") && (x.elementId = t.id);
else {
const v = { id: n, type: d, value: p, message: f, elementId: t.id };
h.rules.push(v);
}
delete i.expressionInfo;
}
/**
* 属性类型切换为非表达式后,清除原表达式
* @param changeObject
* @param propertyData
* @returns
*/
clearExpression(e, t) {
const i = e.propertyValue;
if (i && i.type === "Expression")
return;
const o = e.propertyID, n = this.getExpressions(), a = t.binding ? t.binding.field : t.id, r = n.find((l) => l.target === a);
!r || !r.rules || (r.rules = r.rules.filter((l) => l.type !== o));
}
getExpressionOptions(e, t, i) {
return this.expressionProperty.getExpressionOptions(e, t, i);
}
getRealTargetType(e) {
return ["response-toolbar-item", "tab-toolbar-item", "section-toolbar-item", "drawer-toolbar-item"].indexOf(e.type) > -1 ? "Button" : e.binding && e.binding.field ? "Field" : "Container";
}
createBaseEventProperty(e) {
const t = {};
return t[this.viewModelId] = {
type: "events-editor",
editor: {
initialData: e,
viewSourceHandle: (i) => {
var s;
((s = i.controller) == null ? void 0 : s.label.indexOf(this.formSchemaUtils.getModule().code)) > -1 && this.eventsEditorUtils.jumpToMethod(i);
}
}
}, t;
}
}
class se extends ie {
constructor(e, t) {
super(e, t);
}
getPropertyConfig(e) {
var o;
const { designerContext: t } = this.designerHostService, s = !(((o = t == null ? void 0 : t.terminalRef) == null ? void 0 : o.value) === "Mobile");
return this.propertyConfig.categories.basic = this.getBasicPropConfig(e), s && (this.propertyConfig.categories.appearance = this.getAppearancePropConfig(e)), this.propertyConfig.categories.behavior = this.getBehaviorPropConfig(e), this.propertyConfig;
}
getAppearancePropConfig(e) {
return {
title: "外观",
description: "Appearance",
properties: {
displayType: {
title: "显示类型",
type: "enum",
description: "审批记录数据支持以“卡片”模式或者“表格”模式展示",
editor: {
data: [
{ id: "card", name: "卡片" },
{ id: "data-grid", name: "表格" }
]
}
}
}
};
}
getBehaviorPropConfig(e) {
return {
title: "行为",
description: "Behavior",
properties: {
showForecastLogs: {
title: "是否展示预测日志",
type: "boolean",
description: "是否显示“未到达”的节点",
defaultValue: !1
},
showHistoryLogs: {
title: "是否展示历史日志",
type: "boolean",
description: "是否展示历史日志",
defaultValue: !1
}
}
};
}
}
function ne(c, e) {
function t() {
return !1;
}
function i() {
return !0;
}
function s() {
return !0;
}
function o() {
return !0;
}
function n(r) {
return new se(r, e).getPropertyConfig(c);
}
function a() {
return "";
}
return {
canAccepts: t,
hideNestedPaddingInDesginerView: o,
getPropsConfig: n,
checkCanDeleteComponent: i,
checkCanMoveComponent: s,
getDesignerClass: a
};
}
const oe = /* @__PURE__ */ M({
name: "FApprovalLogsDesign",
props: I,
emits: [],
setup(c, e) {
const t = P(), i = V("designer-host-service"), s = V("design-item-context"), o = ne(s.schema, i), n = j(t, s, o), {
designerContext: a
} = i, r = S(() => {
var m;
return ((m = a == null ? void 0 : a.terminalRef) == null ? void 0 : m.value) === "Mobile";
});
F(() => {
t.value.componentInstance = n;
}), e.expose(n.value);
function l(m, h, x, v, L) {
return u("div", {
class: "log-node"
}, [!m && u("div", {
class: "log-timeline-item-tail"
}, null), u("div", {
class: "timeline-item-head timeline-item-head-blue"
}, null), u("div", {
class: "log-item-content"
}, [u("div", {
class: "log-item-content-header"
}, [u("div", {
class: "log-node-name"
}, [h])]), u("div", {
class: "log-node-main-content"
}, [u("div", {
class: "log-node-main-content-first"
}, [u("div", {
class: "log-operator-avatar"
}, [u("div", {
class: "log-operator-avatar-img"
}, [u("i", {
class: "f-icon f-icon-top_my"
}, null)])]), u("div", {
class: "log-avatar-right"
}, [u("div", {
class: "log-operator-and-action"
}, [u("div", {
class: "log-operator"
}, [u("div", {
class: "log-operator-name"
}, [x])]), u("div", {
class: `log-action-name log-action-name-${v}`
}, [u("span", null, [v === "submit" ? "提交" : "待办理"])])]), L])])])])]);
}
function d() {
return u("div", {
class: "log-message-and-times"
}, [u("div", null, [u("div", {
class: "log-log-time"
}, [y("提交时间:xxxx-xx-xx xx:xx:xx")])]), u("div", {
class: "log-terminal"
}, [y("来自:电脑端")])]);
}
function p() {
return u(O, null, [u("div", {
class: "log-start-time"
}, [y("接收时间:xxxx-xx-xx xx:xx:xx")]), u("div", {
class: "log-task-read"
}, [u("div", {
class: "log-task-read-img"
}, null), u("div", {
class: "log-task-read-text"
}, [y("已读")]), u("div", null, [y("xxxx-xx-xx xx:xx:xx")])])]);
}
const f = S(() => ({
"fv-approval-logs-design": !0,
"fv-approval-logs-design--small-screen": r.value
}));
return () => u("div", {
ref: t,
class: f.value
}, [u("div", {
class: "task-log-body"
}, [l(!1, "开始", "发起人", "submit", d()), l(!0, "审批活动", "审批人", "todo", p())])]);
}
}), w = {};
function re() {
function c(t = 1) {
const i = t * 60 * 60 * 1e3, s = Date.now();
return s - s % i;
}
function e(t) {
if (!t)
return Promise.resolve();
if (w[t])
return w[t];
const i = new Promise((s, o) => {
const n = document.createElement("script");
n.src = t + `?v=${c()}`, n.type = "text/javascript", n.async = !0;
function a() {
n.removeEventListener("load", r), n.removeEventListener("error", l);
}
function r() {
a(), s();
}
function l(d) {
a(), delete w[t], o(d);
}
n.addEventListener("load", r), n.addEventListener("error", l), document.head.appendChild(n);
});
return w[t] = i, i;
}
return {
loadJsScript: e
};
}
const ae = /* @__PURE__ */ M({
name: "FApprovalLogs",
props: I,
emits: [],
setup(c, e) {
const {
loadJsScript: t
} = re(), i = B(), s = P();
function o() {
return !!window.gspTaskCenterBizLog;
}
function n() {
return window.gspTaskCenterBizLog.ApprovalLogUtil;
}
function a() {
return c.displayType === "data-grid" && !i ? "datagrid" : "card";
}
function r() {
s.value && (s.value.innerHTML = "");
}
function l() {
if (a() === "datagrid") {
const m = {
bizInstId: c.dataId,
container: s.value,
showHeader: !1,
showViewProcess: !1,
ifForecast: !!c.showForecastLogs,
isIncludeHistory: !!c.showHistoryLogs
};
n().getWebHtml(m);
} else {
const m = {
bizInstId: c.dataId,
container: s.value,
terminal: i ? "mobile" : "web",
typeId: "wf",
showHeader: !1,
showForecastBtn: i,
ifForecast: !!c.showForecastLogs,
isIncludeHistory: !!c.showHistoryLogs
};
n().getWebLogsHtml(m);
}
}
async function d() {
if (!c.dataId || !s.value) {
r();
return;
}
o() || await t(c.workflowScriptUrl).catch((f) => {
console.error(f);
}), o() && l();
}
F(d), $([() => c.dataId, () => c.displayType, () => c.showForecastLogs, () => c.showHistoryLogs], () => {
r(), d();
});
function p() {
d();
}
return e.expose({
refreshData: p
}), () => u("div", {
ref: s,
class: "fv-approval-logs"
}, null);
}
}), b = "approval-logs", C = A(oe);
C.register = (c, e, t, i, s) => {
c[b] = ae, e[b] = T(s), i[b] = { bindingResolver: U() };
};
C.registerDesigner = (c, e, t, i) => {
c[b] = C, e[b] = T(i);
};
export {
C as FApprovalLogsDesign,
C as default
};