"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../../../node_modules/element-plus/es/index.js");
;/* empty css                                                                */
;/* empty css                                                                      */
;/* empty css                                                                     */
;/* empty css                                                                        */
;/* empty css                                                                       */
;/* empty css                                                                            */
;/* empty css                                                                     */
const Vue = require("vue");
const index = require("./api/index.js");
const getInstance = require("../../../utils/getInstance.js");
const ApproveIdea = require("./ApproveIdea.vue.js");
;/* empty css               */
const index$1 = require("../../../../../../node_modules/element-plus/es/components/scrollbar/index.js");
const index$2 = require("../../../../../../node_modules/element-plus/es/components/timeline/index.js");
const index$3 = require("../../../../../../node_modules/element-plus/es/components/button/index.js");
const index$4 = require("../../../../../../node_modules/element-plus/es/components/drawer/index.js");
const _hoisted_1 = { class: "header" };
const _hoisted_2 = { class: "app nodeName" };
const _hoisted_3 = { class: "createTime" };
const _hoisted_4 = {
  key: 0,
  class: "appContent"
};
const _hoisted_5 = { class: "openTask" };
const _hoisted_6 = { style: { "font-weight": "bold" } };
const _hoisted_7 = {
  key: 0,
  class: "appAssignee"
};
const _hoisted_8 = {
  key: 1,
  class: "apping"
};
const _hoisted_9 = {
  key: 2,
  class: "apping"
};
const _hoisted_10 = { class: "duration" };
const _hoisted_11 = {
  key: 1,
  class: "appContent"
};
const _hoisted_12 = { class: "openTask sign" };
const _hoisted_13 = { style: { "font-weight": "bold" } };
const _hoisted_14 = { class: "appAssignee" };
const _hoisted_15 = { key: 0 };
const _hoisted_16 = {
  key: 1,
  style: { "color": "#999" }
};
const _hoisted_17 = { class: "duration" };
const _hoisted_18 = { class: "header" };
const _hoisted_19 = { class: "nodeName" };
const _hoisted_20 = { class: "createTime" };
const _hoisted_21 = {
  key: 0,
  class: "content"
};
const _hoisted_22 = { class: "app-header" };
const _hoisted_23 = { class: "approveType" };
const _hoisted_24 = { class: "duration" };
const _hoisted_25 = { class: "app-footer" };
const _hoisted_26 = { class: "endTime" };
const _hoisted_27 = {
  key: 0,
  class: "assignee"
};
const _hoisted_28 = { class: "assignee-name" };
const _hoisted_29 = {
  key: 1,
  class: "assignee"
};
const _hoisted_30 = {
  key: 1,
  class: "signContent"
};
const _hoisted_31 = { class: "content" };
const _hoisted_32 = { class: "app-header" };
const _hoisted_33 = { class: "approveType" };
const _hoisted_34 = { class: "duration" };
const _hoisted_35 = { class: "app-footer" };
const _hoisted_36 = { class: "endTime" };
const _hoisted_37 = { class: "assignee" };
const _hoisted_38 = { class: "assignee-name" };
const _hoisted_39 = {
  key: 1,
  class: "content"
};
const _sfc_main = /* @__PURE__ */ Object.assign({
  name: "FecTimeLine"
}, {
  __name: "timeLine",
  props: {
    traceNo: {
      type: String,
      default: ""
    },
    type: {
      //主子流程类型
      type: String,
      default: "app"
    },
    taskDefinitionKey: {
      type: String,
      default: ""
    }
  },
  emits: ["loaded"],
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const flowTimelineRef = Vue.ref();
    const ctx = getInstance.getCurrentVueInstance();
    const emit = __emit;
    const hisTaskList = Vue.ref([]);
    const taskList = Vue.ref([]);
    Vue.watch(
      () => props.traceNo,
      (traceNo) => {
        if (traceNo) {
          index.default.findTimeLineByTraceNo(
            ctx.$http,
            traceNo,
            props.type,
            props.taskDefinitionKey
          ).then((data) => {
            if (data) {
              hisTaskList.value = data.hisTask;
              taskList.value = data.task;
              Vue.nextTick(() => {
                emit("loaded", flowTimelineRef.value);
              });
            }
          });
        }
      },
      {
        immediate: true
      }
    );
    function getAssigneeName(assignee) {
      let assigneeName = "";
      for (let i in assignee) {
        assigneeName += assignee[i].opName;
        if (i < assignee.length - 1) {
          assigneeName += ",";
        }
      }
      return assigneeName;
    }
    function isBackToBack(assigneeList) {
      var _a;
      const assignee = assigneeList[0];
      if (assignee.opNo == ((_a = ctx.$store) == null ? void 0 : _a.getters.user.opNo)) {
        return true;
      } else {
        return false;
      }
    }
    const timeLineShow = Vue.ref(false);
    const childProcessInstanceId = Vue.ref();
    const childTaskDefinitionKey = Vue.ref();
    function queryChildProcess(item) {
      childProcessInstanceId.value = item.processInstanceId;
      childTaskDefinitionKey.value = item.taskDefinitionKey;
      timeLineShow.value = true;
    }
    function closeChildTimeLine() {
      timeLineShow.value = false;
    }
    __expose({
      closeChildTimeLine
    });
    return (_ctx, _cache) => {
      const _component_el_button = index$3.ElButton;
      const _component_el_timeline_item = index$2.ElTimelineItem;
      const _component_el_timeline = index$2.ElTimeline;
      const _component_el_scrollbar = index$1.ElScrollbar;
      const _component_FecTimeLine = Vue.resolveComponent("FecTimeLine");
      const _component_el_drawer = index$4.ElDrawer;
      return Vue.openBlock(), Vue.createElementBlock("div", {
        class: "flowTimeline",
        ref_key: "flowTimelineRef",
        ref: flowTimelineRef
      }, [
        Vue.createVNode(_component_el_scrollbar, null, {
          default: Vue.withCtx(() => [
            Vue.createVNode(_component_el_timeline, null, {
              default: Vue.withCtx(() => [
                (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(taskList), (node) => {
                  return Vue.openBlock(), Vue.createBlock(_component_el_timeline_item, {
                    "hide-timestamp": true,
                    color: "var(--el-color-primary)",
                    size: "large"
                  }, {
                    default: Vue.withCtx(() => [
                      Vue.createElementVNode("div", _hoisted_1, [
                        Vue.createElementVNode("span", _hoisted_2, Vue.toDisplayString(node.name), 1),
                        Vue.createElementVNode("span", _hoisted_3, Vue.toDisplayString(node.createTime), 1)
                      ]),
                      node.taskType == "task" || node.taskType == "callActivity" || node.taskType == "bizTask" ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_4, [
                        Vue.createElementVNode("div", _hoisted_5, [
                          Vue.createElementVNode("span", _hoisted_6, [
                            node.assignee ? (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_7, Vue.toDisplayString(getAssigneeName(node.assignee)), 1)) : Vue.createCommentVNode("", true),
                            node.taskType == "bizTask" || node.taskType == "callActivity" ? (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_8, " 办理中... ")) : (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_9, " 审批中... "))
                          ]),
                          Vue.createElementVNode("span", _hoisted_10, "已送达：" + Vue.toDisplayString(node.duration), 1),
                          node.taskType == "callActivity" ? (Vue.openBlock(), Vue.createBlock(_component_el_button, {
                            key: 0,
                            type: "primary",
                            link: "",
                            class: "queryChildProcBtn",
                            onClick: ($event) => queryChildProcess(node)
                          }, {
                            default: Vue.withCtx(() => _cache[1] || (_cache[1] = [
                              Vue.createTextVNode("查看详情 ")
                            ])),
                            _: 2
                          }, 1032, ["onClick"])) : Vue.createCommentVNode("", true)
                        ])
                      ])) : Vue.createCommentVNode("", true),
                      node.taskType == "signTask" ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_11, [
                        (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(node.signTaskList, (sign) => {
                          return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_12, [
                            Vue.createElementVNode("span", _hoisted_13, [
                              Vue.createElementVNode("span", _hoisted_14, [
                                isBackToBack(sign.assignee) ? (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_15, Vue.toDisplayString(getAssigneeName(sign.assignee)), 1)) : (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_16, "其他处理人"))
                              ]),
                              _cache[2] || (_cache[2] = Vue.createElementVNode("span", { class: "apping" }, " 审批中... ", -1))
                            ]),
                            Vue.createElementVNode("span", _hoisted_17, "已送达：" + Vue.toDisplayString(sign.duration), 1)
                          ]);
                        }), 256))
                      ])) : Vue.createCommentVNode("", true)
                    ]),
                    _: 2
                  }, 1024);
                }), 256)),
                (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(hisTaskList), (node) => {
                  return Vue.openBlock(), Vue.createBlock(_component_el_timeline_item, { "hide-timestamp": true }, {
                    default: Vue.withCtx(() => [
                      Vue.createElementVNode("div", _hoisted_18, [
                        Vue.createElementVNode("span", _hoisted_19, Vue.toDisplayString(node.name), 1),
                        Vue.createElementVNode("span", _hoisted_20, Vue.toDisplayString(node.createTime), 1)
                      ]),
                      node.taskType == "task" || node.taskType == "callActivity" ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_21, [
                        Vue.createElementVNode("div", _hoisted_22, [
                          Vue.createElementVNode("span", _hoisted_23, Vue.toDisplayString(node.approveName || "办理完成"), 1),
                          Vue.createElementVNode("span", _hoisted_24, "耗时：" + Vue.toDisplayString(node.duration), 1)
                        ]),
                        Vue.createVNode(ApproveIdea.default, {
                          approveDesc: node.approveDesc
                        }, null, 8, ["approveDesc"]),
                        Vue.createElementVNode("div", _hoisted_25, [
                          Vue.createElementVNode("span", _hoisted_26, [
                            _cache[3] || (_cache[3] = Vue.createElementVNode("i", { class: "el-icon-time" }, null, -1)),
                            Vue.createTextVNode(Vue.toDisplayString(node.endTime), 1)
                          ]),
                          node.taskType == "task" ? (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_27, [
                            _cache[4] || (_cache[4] = Vue.createTextVNode("处理人：")),
                            Vue.createElementVNode("span", _hoisted_28, Vue.toDisplayString(node.assigneeName), 1)
                          ])) : Vue.createCommentVNode("", true),
                          node.taskType == "callActivity" ? (Vue.openBlock(), Vue.createElementBlock("span", _hoisted_29, [
                            Vue.createVNode(_component_el_button, {
                              type: "primary",
                              link: "",
                              style: { "height": "25px" },
                              onClick: ($event) => queryChildProcess(node)
                            }, {
                              default: Vue.withCtx(() => _cache[5] || (_cache[5] = [
                                Vue.createTextVNode("查看详情")
                              ])),
                              _: 2
                            }, 1032, ["onClick"])
                          ])) : Vue.createCommentVNode("", true),
                          _cache[6] || (_cache[6] = Vue.createElementVNode("div", { class: "addNodeList" }, null, -1))
                        ])
                      ])) : Vue.createCommentVNode("", true),
                      node.taskType == "signTask" ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_30, [
                        node.signTaskList && node.signTaskList.length > 0 ? (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, { key: 0 }, Vue.renderList(node.signTaskList, (sign) => {
                          return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_31, [
                            Vue.createElementVNode("div", _hoisted_32, [
                              Vue.createElementVNode("span", _hoisted_33, Vue.toDisplayString(sign.approveName || "办理完成"), 1),
                              Vue.createElementVNode("span", _hoisted_34, "耗时：" + Vue.toDisplayString(sign.duration), 1)
                            ]),
                            Vue.createVNode(ApproveIdea.default, {
                              approveDesc: sign.approveDesc
                            }, null, 8, ["approveDesc"]),
                            Vue.createElementVNode("div", _hoisted_35, [
                              Vue.createElementVNode("span", _hoisted_36, [
                                _cache[7] || (_cache[7] = Vue.createElementVNode("i", { class: "el-icon-time" }, null, -1)),
                                Vue.createTextVNode(Vue.toDisplayString(sign.endTime), 1)
                              ]),
                              Vue.createElementVNode("span", _hoisted_37, [
                                _cache[8] || (_cache[8] = Vue.createTextVNode("处理人：")),
                                Vue.createElementVNode("span", _hoisted_38, Vue.toDisplayString(sign.assigneeName), 1)
                              ]),
                              _cache[9] || (_cache[9] = Vue.createElementVNode("div", { class: "addNodeList" }, null, -1))
                            ])
                          ]);
                        }), 256)) : (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_39, _cache[10] || (_cache[10] = [
                          Vue.createElementVNode("div", { class: "approve" }, [
                            Vue.createElementVNode("span", { class: "point" }),
                            Vue.createElementVNode("span", { class: "iconfont icon-flow-default approveIcon approve_color_11" }),
                            Vue.createElementVNode("span", { class: "approveName approve_color_11" }, "没有查看权限")
                          ], -1)
                        ])))
                      ])) : Vue.createCommentVNode("", true)
                    ]),
                    _: 2
                  }, 1024);
                }), 256))
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        Vue.createVNode(_component_el_drawer, {
          modelValue: Vue.unref(timeLineShow),
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => Vue.isRef(timeLineShow) ? timeLineShow.value = $event : null),
          direction: "rtl",
          "custom-class": "childTimelineDrawer",
          "modal-class": "childTimelineDrawerModal",
          "with-header": false
        }, {
          default: Vue.withCtx(() => [
            Vue.createVNode(_component_FecTimeLine, {
              processInstanceId: Vue.unref(childProcessInstanceId),
              taskDefinitionKey: Vue.unref(childTaskDefinitionKey)
            }, null, 8, ["processInstanceId", "taskDefinitionKey"])
          ]),
          _: 1
        }, 8, ["modelValue"])
      ], 512);
    };
  }
});
exports.default = _sfc_main;
