import { d as S, a as A, e as P, i as V, b as B, p as I } from "./workbench2.js";
import { h as U, resolveComponent as g, resolveDirective as T, openBlock as u, createBlock as h, createSlots as D, withCtx as a, createVNode as o, createTextVNode as d, createElementBlock as m, Fragment as C, renderList as b, toDisplayString as c, createElementVNode as L, withDirectives as y } from "vue";
import { l as R, U as N, bv as O, aC as z, aD as H, cf as F } from "./index2.js";
const M = {
  name: "WorkBench",
  data() {
    return {
      isPermission: !1,
      formVisibleView: !1,
      params: {
        quoted: 0,
        lookupType: {}
      },
      quoted: [
        { name: "全部", code: 0 },
        { name: "是", code: 1 },
        { name: "否", code: 2 }
      ],
      columns: [
        {
          title: "码表名称",
          dataIndex: "name",
          ellipsis: !0,
          width: "20%",
          isClick: !0
        },
        {
          title: "码表编码",
          dataIndex: "code",
          ellipsis: !0,
          template: !0,
          width: "20%"
        },
        {
          title: "码值数",
          dataIndex: "valueNums",
          ellipsis: !0,
          width: "10%"
        },
        {
          title: "被引用",
          dataIndex: "sort",
          ellipsis: !0,
          width: "10%"
        },
        {
          title: "描述",
          dataIndex: "remarks",
          ellipsis: !0,
          width: "20%"
        },
        {
          title: "最近更新人",
          dataIndex: "updateBy",
          ellipsis: !0,
          width: "20%",
          customRender: (t) => t.text.name + "(" + t.text.no + ")"
        },
        {
          title: "最近更新时间",
          dataIndex: "updateDate",
          ellipsis: !0,
          width: "20%"
        },
        {
          title: "操作",
          dataIndex: "action",
          width: "10%",
          align: "center"
          // scopedSlots: { customRender: 'action' }
        }
      ],
      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
        }
      ],
      treeData: []
    };
  },
  mounted() {
  },
  methods: {
    addTree(t) {
      console.log(t);
    },
    editTree(t) {
      console.log(t);
    },
    deleteTree(t) {
      console.log(t);
    },
    selectTree(t) {
      this.params.lookupType.id = t.nodeId, this.$refs.layout.reload();
    },
    // tree回调方法结束
    handRowAction(t, l) {
      l === 1 ? this.edit(t) : this.deleteApi(t);
    },
    btnCallback(t) {
      console.log("按钮事件回调：btnCallback =>", t), t === "add" && this.add();
    },
    deleteApi(t) {
      this.$confirm({
        title: "确认删除",
        content: () => U("div", { style: "color:red" }, "确认要删除该数据吗？"),
        onOk: () => {
          S(t.id).then(() => {
            this.$notification.success({
              key: "only-you",
              message: "操作成功",
              description: "删除成功"
            }), this.$refs.layout.reload();
          });
        }
      });
    },
    deletesApi(t) {
      return A(t);
    },
    exportApi() {
      return P(this.params);
    },
    importApi() {
      return V();
    },
    templateApi() {
      return B();
    },
    reset() {
      this.$refs.layout.reload();
    },
    page(t = {}) {
      return I(this.params, t).then((l) => l);
    },
    // ⬆️ 新组建方法使用
    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(t = {}) {
      const l = {
        id: t.id
      };
      this.$open("add", l);
    },
    view(t, l) {
      this.formVisibleView = !0, this.$nextTick(() => {
        this.$refs.dataStandardLookupView.view(t);
      });
    },
    handApprove(t) {
      console.log(t);
    }
    // ⬆️ slot业务页面使用方法
  }
}, W = ["onClick"], j = ["onClick"];
function G(t, l, J, K, n, r) {
  const k = g("HighlightOutlined"), x = N, p = O, i = g("s-filter-item"), f = z, v = H, w = g("s-filter-wrap"), q = F, E = g("s-list-layout"), _ = T("action");
  return u(), h(E, {
    id: "layout",
    ref: "layout",
    buttons: n.buttons,
    onReset: r.reset,
    onBtnCallback: r.btnCallback,
    onTableColCallback: r.view,
    columns: n.columns,
    loadData: r.page,
    title: "基础列表示例"
  }, D({
    otherBtns: a((e) => [
      o(x, {
        class: "btn",
        type: "primary",
        onClick: (s) => r.handApprove(e)
      }, {
        default: a(() => [
          o(k),
          l[11] || (l[11] = d(" 提交审核 "))
        ]),
        _: 2
      }, 1032, ["onClick"])
    ]),
    filter: a(() => [
      o(w, null, {
        default: a(() => [
          o(i, {
            label: t.$l("添加")
          }, {
            default: a(() => [
              o(p, {
                maxLength: 50,
                onPressEnter: r.paramChange,
                value: n.params.name,
                "onUpdate:value": l[0] || (l[0] = (e) => n.params.name = e),
                allowClear: !0,
                placeholder: "请输入名称或编码"
              }, null, 8, ["onPressEnter", "value"])
            ]),
            _: 1
          }, 8, ["label"]),
          o(i, { label: "被引用" }, {
            default: a(() => [
              o(v, {
                showSearch: "",
                allowClear: "",
                autoClearSearchValue: "",
                placeholder: "请选择",
                onChange: r.quotedChange,
                value: n.params.quoted,
                "onUpdate:value": l[1] || (l[1] = (e) => n.params.quoted = e)
              }, {
                default: a(() => [
                  (u(!0), m(C, null, b(n.quoted, (e, s) => (u(), h(f, {
                    value: e.code,
                    key: s
                  }, {
                    default: a(() => [
                      d(c(e.name), 1)
                    ]),
                    _: 2
                  }, 1032, ["value"]))), 128))
                ]),
                _: 1
              }, 8, ["onChange", "value"])
            ]),
            _: 1
          }),
          o(i, { label: "关键字" }, {
            default: a(() => [
              o(p, {
                maxLength: 50,
                onPressEnter: r.paramChange,
                value: n.params.name,
                "onUpdate:value": l[2] || (l[2] = (e) => n.params.name = e),
                allowClear: !0,
                placeholder: "请输入名称或编码"
              }, null, 8, ["onPressEnter", "value"])
            ]),
            _: 1
          })
        ]),
        _: 1
      })
    ]),
    filterMore: a(() => [
      o(w, { type: "filter-more" }, {
        default: a(() => [
          o(i, {
            mb: 10,
            label: "更多条件一"
          }, {
            default: a(() => [
              o(p, {
                maxLength: 50,
                onPressEnter: r.paramChange,
                value: n.params.name,
                "onUpdate:value": l[3] || (l[3] = (e) => n.params.name = e),
                allowClear: !0,
                placeholder: "请输入名称或编码"
              }, null, 8, ["onPressEnter", "value"])
            ]),
            _: 1
          }),
          o(i, {
            mb: 10,
            label: "更多条件二"
          }, {
            default: a(() => [
              o(v, {
                showSearch: "",
                allowClear: "",
                autoClearSearchValue: "",
                placeholder: "请选择",
                onChange: r.quotedChange,
                value: n.params.quoted,
                "onUpdate:value": l[4] || (l[4] = (e) => n.params.quoted = e)
              }, {
                default: a(() => [
                  (u(!0), m(C, null, b(n.quoted, (e, s) => (u(), h(f, {
                    value: e.code,
                    key: s
                  }, {
                    default: a(() => [
                      d(c(e.name), 1)
                    ]),
                    _: 2
                  }, 1032, ["value"]))), 128))
                ]),
                _: 1
              }, 8, ["onChange", "value"])
            ]),
            _: 1
          }),
          o(i, {
            mb: 10,
            label: "更多条件一"
          }, {
            default: a(() => [
              o(p, {
                maxLength: 50,
                onPressEnter: r.paramChange,
                value: n.params.name,
                "onUpdate:value": l[5] || (l[5] = (e) => n.params.name = e),
                allowClear: !0,
                placeholder: "请输入名称或编码"
              }, null, 8, ["onPressEnter", "value"])
            ]),
            _: 1
          }),
          o(i, {
            mb: 10,
            label: "更多条件二"
          }, {
            default: a(() => [
              o(v, {
                showSearch: "",
                allowClear: "",
                autoClearSearchValue: "",
                placeholder: "请选择",
                onChange: r.quotedChange,
                value: n.params.quoted,
                "onUpdate:value": l[6] || (l[6] = (e) => n.params.quoted = e)
              }, {
                default: a(() => [
                  (u(!0), m(C, null, b(n.quoted, (e, s) => (u(), h(f, {
                    value: e.code,
                    key: s
                  }, {
                    default: a(() => [
                      d(c(e.name), 1)
                    ]),
                    _: 2
                  }, 1032, ["value"]))), 128))
                ]),
                _: 1
              }, 8, ["onChange", "value"])
            ]),
            _: 1
          }),
          o(i, {
            mb: 10,
            label: "更多条件一"
          }, {
            default: a(() => [
              o(p, {
                maxLength: 50,
                onPressEnter: r.paramChange,
                value: n.params.name,
                "onUpdate:value": l[7] || (l[7] = (e) => n.params.name = e),
                allowClear: !0,
                placeholder: "请输入名称或编码"
              }, null, 8, ["onPressEnter", "value"])
            ]),
            _: 1
          }),
          o(i, {
            mb: 10,
            label: "更多条件二"
          }, {
            default: a(() => [
              o(v, {
                showSearch: "",
                allowClear: "",
                autoClearSearchValue: "",
                placeholder: "请选择",
                onChange: r.quotedChange,
                value: n.params.quoted,
                "onUpdate:value": l[8] || (l[8] = (e) => n.params.quoted = e)
              }, {
                default: a(() => [
                  (u(!0), m(C, null, b(n.quoted, (e, s) => (u(), h(f, {
                    value: e.code,
                    key: s
                  }, {
                    default: a(() => [
                      d(c(e.name), 1)
                    ]),
                    _: 2
                  }, 1032, ["value"]))), 128))
                ]),
                _: 1
              }, 8, ["onChange", "value"])
            ]),
            _: 1
          }),
          o(i, {
            mb: 10,
            label: "更多条件一"
          }, {
            default: a(() => [
              o(p, {
                maxLength: 50,
                onPressEnter: r.paramChange,
                value: n.params.name,
                "onUpdate:value": l[9] || (l[9] = (e) => n.params.name = e),
                allowClear: !0,
                placeholder: "请输入名称或编码"
              }, null, 8, ["onPressEnter", "value"])
            ]),
            _: 1
          }),
          o(i, {
            mb: 10,
            label: "更多条件二"
          }, {
            default: a(() => [
              o(v, {
                showSearch: "",
                allowClear: "",
                autoClearSearchValue: "",
                placeholder: "请选择",
                onChange: r.quotedChange,
                value: n.params.quoted,
                "onUpdate:value": l[10] || (l[10] = (e) => n.params.quoted = e)
              }, {
                default: a(() => [
                  (u(!0), m(C, null, b(n.quoted, (e, s) => (u(), h(f, {
                    value: e.code,
                    key: s
                  }, {
                    default: a(() => [
                      d(c(e.name), 1)
                    ]),
                    _: 2
                  }, 1032, ["value"]))), 128))
                ]),
                _: 1
              }, 8, ["onChange", "value"])
            ]),
            _: 1
          })
        ]),
        _: 1
      })
    ]),
    code: a(({ text: e }) => [
      L("div", null, c(e), 1)
    ]),
    action: a(({ record: e }) => [
      y((u(), m("a", {
        onClick: (s) => r.handRowAction(e, 1)
      }, l[12] || (l[12] = [
        d("修改")
      ]), 8, W)), [
        [_, "edit"]
      ]),
      y(o(q, { type: "vertical" }, null, 512), [
        [_, "remove"]
      ]),
      y((u(), m("a", {
        onClick: (s) => r.handRowAction(e, 2)
      }, l[13] || (l[13] = [
        d("删除")
      ]), 8, j)), [
        [_, "remove"]
      ])
    ]),
    other: a(() => []),
    _: 2
  }, [
    n.isPermission ? {
      name: "empty",
      fn: a(() => [
        l[14] || (l[14] = d("抱歉 没有访问权限"))
      ]),
      key: "0"
    } : void 0
  ]), 1032, ["buttons", "onReset", "onBtnCallback", "onTableColCallback", "columns", "loadData"]);
}
const Z = /* @__PURE__ */ R(M, [["render", G]]);
export {
  Z as default
};
