import { d as v, a as b, e as g, i as T, b as _, p as x } from "./workbench2.js";
import { l as w, cq as c, aM as A, aN as I, U as E, cf as B } from "./index2.js";
import { h as D, resolveComponent as m, resolveDirective as S, openBlock as r, createBlock as V, createSlots as $, withCtx as a, createVNode as d, createTextVNode as n, createElementVNode as L, toDisplayString as N, withDirectives as u, createElementBlock as f } from "vue";
const O = {
  name: "SHigherDemo",
  components: {},
  data() {
    return {
      isPermission: !1,
      formVisibleView: !1,
      params: {
        quoted: 0,
        lookupType: {}
      },
      quoted: [
        { name: "全部", code: 0 },
        { name: "是", code: 1 },
        { name: "否", code: 2 }
      ],
      columns: [],
      buttons: [
        {
          name: "添加",
          key: "add",
          show: !0,
          disabled: !1,
          type: "primary",
          icon: !0,
          api: null
        },
        {
          name: "批量删除",
          key: "delete",
          action: "remove",
          show: !0,
          disabled: !1,
          icon: !0,
          confirm: !0,
          api: this.deletesApi
        },
        {
          name: "同步",
          // 按钮名称
          key: "synchronize"
          // 按钮key 可替代action按钮权限字段
          // show: true, // 是否显示
          // disabled: false, // 是否禁用 可不设置
          // action: 'synchronize', // 按钮权限 不传则按照 key 渲染
          // icon: 'sync', // 可选值：空字符串 ''：不需要icon, true：需要icon 组件自从设定的iconMap中查找, 'add' 非空串：使用的icon
          // confirm: false, // 是否需要确认框
          // selection: false, // 是否需要表格批量选择的数据
          // api: null // 按钮对应接口api
        },
        {
          name: "导入",
          key: "import",
          show: !0,
          disabled: !1,
          icon: !0,
          api: this.importApi,
          templateApi: this.templateApi
        },
        {
          name: "导出",
          key: "export",
          show: !0,
          disabled: !1,
          icon: !0,
          api: null
        }
      ]
    };
  },
  mounted() {
    this.columns = [
      {
        title: "码表名称",
        dataIndex: "name",
        ellipsis: !0,
        isClick: !0,
        width: 300,
        filterConfig: {
          filterType: "INPUT"
        }
      },
      {
        title: "码表编码",
        dataIndex: "code",
        ellipsis: !0,
        template: !0,
        width: 300,
        filterConfig: {
          filterType: "SINGLE_SELECT",
          filterApi: c,
          props: {
            key: "label",
            value: "value"
          }
        }
      },
      {
        title: "码值数",
        dataIndex: "valueNums",
        ellipsis: !0,
        width: 300,
        filterConfig: {
          filterType: "MULTIPLE_SELECT",
          filterData: [
            {
              name: "是",
              value: 1
            },
            {
              name: "否",
              value: 0
            }
          ]
        }
      },
      {
        title: "被引用",
        dataIndex: "sort",
        ellipsis: !0,
        width: 300,
        filterConfig: {
          filterType: "DATETIME",
          filterApi: null,
          filterData: [
            {
              name: "男",
              value: 1
            },
            {
              name: "女",
              value: 0
            }
          ]
        }
      },
      {
        title: "描述",
        dataIndex: "remarks",
        ellipsis: !0,
        width: 300,
        filterConfig: {
          filterType: "FLOAT",
          precision: 4,
          step: 1e-4,
          minValue: 1e-4,
          maxValue: 9999,
          filterData: [
            {
              name: "是",
              value: 1
            },
            {
              name: "否",
              value: 0
            }
          ]
        }
      },
      {
        title: "最近更新人",
        dataIndex: "updateBy",
        ellipsis: !0,
        width: 300,
        customRender: (e) => e.text.name + "(" + e.text.no + ")",
        filterConfig: {
          filterType: "USER"
        }
      },
      {
        title: "最近更新时间",
        dataIndex: "updateDate",
        ellipsis: !0,
        width: 300,
        filterConfig: {
          filterType: "OFFICE"
        }
      },
      {
        title: "操作",
        dataIndex: "action",
        align: "center",
        fixed: "right",
        width: 100
        // scopedSlots: { customRender: 'action' }
      }
    ];
  },
  methods: {
    demoSelectApi() {
      return c();
    },
    levelOneChildren(e) {
      return A(e);
    },
    levelTwoChildren(e) {
      return I(e);
    },
    // tree 事件回调
    treeCallback(e, t) {
      this[e + "Tree"](t);
    },
    addTree(e) {
      console.log(e);
    },
    editTree(e) {
      console.log(e);
    },
    deleteTree(e) {
      console.log(e);
    },
    selectTree(e) {
      this.params.lookupType.id = e.nodeId, this.$refs.layout.reload();
    },
    // tree回调方法结束
    handRowAction(e, t) {
      t === 1 ? this.edit(e) : this.deleteApi(e);
    },
    btnCallback(e) {
      console.log("按钮事件回调：btnCallback =>", e), e === "add" && this.add();
    },
    deleteApi(e) {
      this.$confirm({
        title: "确认删除",
        content: () => D("div", { style: "color:red" }, "确认要删除该数据吗？"),
        onOk: () => {
          v(e.id).then(() => {
            this.$notification.success({
              key: "only-you",
              message: "操作成功",
              description: "删除成功"
            }), this.$refs.layout.reload();
          });
        }
      });
    },
    deletesApi(e) {
      return b(e);
    },
    exportApi() {
      return g(this.params);
    },
    importApi() {
      return T();
    },
    templateApi() {
      return _();
    },
    reset() {
      this.$refs.layout.reload();
    },
    page(e = {}) {
      return x(this.params, e).then((t) => t);
    },
    // ⬆️ 新组建方法使用
    paramChange() {
      this.$refs.layout.reload();
    },
    quotedChange() {
      this.$refs.layout.reload();
    },
    add() {
      this.$refs.layout.setStateBtn("synchronize", { disabled: !0, icon: "plus-circle" }), this.$emit("listCallback", "add");
    },
    edit(e = {}) {
      const t = {
        id: e.id
      };
      this.$open("add", t);
    },
    view(e, t) {
      console.log("field:", t), this.formVisibleView = !0, this.$nextTick(() => {
        this.$refs.dataStandardLookupView.view(e);
      });
    },
    handApprove(e) {
      console.log(e);
    }
    // ⬆️ slot业务页面使用方法
  }
}, R = ["onClick"], q = ["onClick"];
function P(e, t, U, F, o, i) {
  const h = m("HighlightOutlined"), y = E, C = B, k = m("s-super-list-layout"), s = S("action");
  return r(), V(k, {
    id: "layout",
    ref: "layout",
    buttons: o.buttons,
    onReset: i.reset,
    onBtnCallback: i.btnCallback,
    onTableColCallback: i.view,
    columns: o.columns,
    loadData: i.page,
    title: "基础列表示例"
  }, $({
    otherBtns: a((l) => [
      d(y, {
        class: "btn",
        type: "primary",
        onClick: (p) => i.handApprove(l)
      }, {
        default: a(() => [
          d(h),
          t[0] || (t[0] = n(" 提交审核 "))
        ]),
        _: 2
      }, 1032, ["onClick"])
    ]),
    code: a(({ text: l }) => [
      L("div", null, N(l), 1)
    ]),
    action: a(({ record: l }) => [
      u((r(), f("a", {
        onClick: (p) => i.handRowAction(l, 1)
      }, t[1] || (t[1] = [
        n("修改")
      ]), 8, R)), [
        [s, "edit"]
      ]),
      u(d(C, { type: "vertical" }, null, 512), [
        [s, "remove"]
      ]),
      u((r(), f("a", {
        onClick: (p) => i.handRowAction(l, 2)
      }, t[2] || (t[2] = [
        n("删除")
      ]), 8, q)), [
        [s, "remove"]
      ])
    ]),
    other: a(() => []),
    _: 2
  }, [
    o.isPermission ? {
      name: "empty",
      fn: a(() => [
        t[3] || (t[3] = n("抱歉 没有访问权限"))
      ]),
      key: "0"
    } : void 0
  ]), 1032, ["buttons", "onReset", "onBtnCallback", "onTableColCallback", "columns", "loadData"]);
}
const G = /* @__PURE__ */ w(O, [["render", P]]);
export {
  G as default
};
