"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
;/* empty css                                               */
;/* empty css                                                */
;/* empty css                                                  */
;/* empty css                                                 */
;/* empty css                                                */
;/* empty css                                                     */
;/* empty css                                               */
;/* empty css                                              */
;/* empty css                                                       */
;/* empty css                                                 */
;/* empty css                                               */
;/* empty css                                               */
;/* empty css                                                */
;/* empty css                                                  */
;/* empty css                                                */
;/* empty css                                                     */
;/* empty css                                                 */
;/* empty css                                                            */
const Vue = require("vue");
;/* empty css                  */
const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
const index = require("../../../../node_modules/vant/es/action-bar/index.js");
const index$1 = require("../../../../node_modules/vant/es/action-bar-button/index.js");
const index$2 = require("../../../../node_modules/vant/es/popup/index.js");
const index$3 = require("../../../../node_modules/vant/es/field/index.js");
const index$4 = require("../../../../node_modules/vant/es/picker/index.js");
const _hoisted_1 = { class: "appPopContent" };
const _hoisted_2 = { class: "appOptContent" };
const _sfc_main = {
  __name: "ApprovalBar",
  props: {
    actionBarOptions: {
      type: Array,
      default: []
    }
  },
  setup(__props) {
    const showAgreePop = Vue.ref(false);
    const showOtherPop = Vue.ref(false);
    const showOpinionPicker = Vue.ref(false);
    const showTargetNodePicker = Vue.ref(false);
    const currentActionItem = Vue.ref({});
    const opinionForm = Vue.reactive({
      opinionType: "",
      opinionContent: "",
      targetNode: ""
    });
    function clickHandler(item) {
      console.log("🚀 ~ clickHandler ~ item:", item);
      if (item.approvalType == "agree") {
        showAgreePop.value = true;
      } else if (item.approvalType == "other") {
        currentActionItem.value = item;
        opinionForm.opinionType = "";
        opinionForm.opinionContent = "";
        opinionForm.targetNode = "";
        showOtherPop.value = true;
      }
    }
    function onOpinionConfirm({ selectedOptions }) {
      var _a;
      opinionForm.opinionType = ((_a = selectedOptions[0]) == null ? void 0 : _a.value) || "";
      showOpinionPicker.value = false;
    }
    function onTargetNodeConfirm({ selectedOptions }) {
      var _a;
      opinionForm.targetNode = ((_a = selectedOptions[0]) == null ? void 0 : _a.value) || "";
      showTargetNodePicker.value = false;
    }
    function submitOpinion() {
      console.log("提交审批意见:", opinionForm);
      showOtherPop.value = false;
    }
    return (_ctx, _cache) => {
      const _component_van_action_bar_button = index$1.ActionBarButton;
      const _component_van_action_bar = index.ActionBar;
      const _component_van_popup = index$2.Popup;
      const _component_van_field = index$3.Field;
      const _component_van_picker = index$4.Picker;
      return Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, null, [
        Vue.createVNode(_component_van_action_bar, { "safe-area-inset-bottom": "" }, {
          default: Vue.withCtx(() => [
            (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(__props.actionBarOptions, (item) => {
              return Vue.openBlock(), Vue.createBlock(_component_van_action_bar_button, {
                class: Vue.normalizeClass(item.bgClass || "icon-blue"),
                text: item.text,
                onClick: ($event) => clickHandler(item)
              }, null, 8, ["class", "text", "onClick"]);
            }), 256))
          ]),
          _: 1
        }),
        Vue.createVNode(_component_van_popup, {
          show: Vue.unref(showAgreePop),
          "onUpdate:show": _cache[0] || (_cache[0] = ($event) => Vue.isRef(showAgreePop) ? showAgreePop.value = $event : null),
          round: "",
          position: "bottom",
          style: { height: "30%" }
        }, null, 8, ["show"]),
        Vue.createVNode(_component_van_popup, {
          show: Vue.unref(showOtherPop),
          "onUpdate:show": _cache[6] || (_cache[6] = ($event) => Vue.isRef(showOtherPop) ? showOtherPop.value = $event : null),
          round: "",
          position: "bottom"
        }, {
          default: Vue.withCtx(() => [
            Vue.createElementVNode("div", _hoisted_1, [
              Vue.createElementVNode("div", _hoisted_2, [
                Vue.createVNode(_component_van_field, {
                  modelValue: Vue.unref(currentActionItem).opinionType,
                  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => Vue.unref(currentActionItem).opinionType = $event),
                  "is-link": "",
                  readonly: "",
                  label: "审批意见",
                  placeholder: "请选择审批意见",
                  onClick: _cache[2] || (_cache[2] = ($event) => showOpinionPicker.value = true)
                }, null, 8, ["modelValue"]),
                Vue.unref(currentActionItem).needTargetNode ? (Vue.openBlock(), Vue.createBlock(_component_van_field, {
                  key: 0,
                  modelValue: Vue.unref(opinionForm).targetNode,
                  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => Vue.unref(opinionForm).targetNode = $event),
                  "is-link": "",
                  readonly: "",
                  label: "目标节点",
                  placeholder: "请选择目标节点",
                  onClick: _cache[4] || (_cache[4] = ($event) => showTargetNodePicker.value = true)
                }, null, 8, ["modelValue"])) : Vue.createCommentVNode("", true),
                Vue.createVNode(_component_van_field, {
                  modelValue: Vue.unref(opinionForm).opinionContent,
                  "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => Vue.unref(opinionForm).opinionContent = $event),
                  rows: "6",
                  autosize: "",
                  label: "意见内容",
                  type: "textarea",
                  maxlength: "500",
                  "show-word-limit": "",
                  placeholder: "请输入审批意见"
                }, null, 8, ["modelValue"])
              ]),
              Vue.createVNode(_component_van_action_bar, { "safe-area-inset-bottom": "" }, {
                default: Vue.withCtx(() => [
                  Vue.createVNode(_component_van_action_bar_button, {
                    class: Vue.normalizeClass("icon-blue"),
                    text: "提交",
                    onClick: submitOpinion
                  })
                ]),
                _: 1
              })
            ])
          ]),
          _: 1
        }, 8, ["show"]),
        Vue.createVNode(_component_van_popup, {
          show: Vue.unref(showOpinionPicker),
          "onUpdate:show": _cache[8] || (_cache[8] = ($event) => Vue.isRef(showOpinionPicker) ? showOpinionPicker.value = $event : null),
          round: "",
          position: "bottom"
        }, {
          default: Vue.withCtx(() => [
            Vue.createVNode(_component_van_picker, {
              columns: Vue.unref(currentActionItem).opinionOptions || [],
              onConfirm: onOpinionConfirm,
              onCancel: _cache[7] || (_cache[7] = ($event) => showOpinionPicker.value = false)
            }, null, 8, ["columns"])
          ]),
          _: 1
        }, 8, ["show"]),
        Vue.createVNode(_component_van_popup, {
          show: Vue.unref(showTargetNodePicker),
          "onUpdate:show": _cache[10] || (_cache[10] = ($event) => Vue.isRef(showTargetNodePicker) ? showTargetNodePicker.value = $event : null),
          round: "",
          position: "bottom"
        }, {
          default: Vue.withCtx(() => [
            Vue.createVNode(_component_van_picker, {
              columns: Vue.unref(currentActionItem).targetNodeOptions || [],
              onConfirm: onTargetNodeConfirm,
              onCancel: _cache[9] || (_cache[9] = ($event) => showTargetNodePicker.value = false)
            }, null, 8, ["columns"])
          ]),
          _: 1
        }, 8, ["show"])
      ], 64);
    };
  }
};
const _ApprovalBar = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-fc8cdb72"]]);
exports.default = _ApprovalBar;
