<template>
  <div>
    <OrgEditor :initData="initData" :metainfo="metainfo"></OrgEditor>
  </div>
</template>
  <script>
import { getApp, saveAuths, findAuthsByRoles } from "@/api/meta";
import OrgEditor from "@/view/components/tables/forms/jsoneditor.vue";
import config from "@/config";
export default {
  name: "treeinfo_page",
  props: {},
  components: {
    OrgEditor
  },
  data() {
    return {
      metainfo: {
        name: "节点编辑",
        main: [
          {
            title: "基本信息",
            key: "baseinfo",
            cols: 1,
            ctls: [
              {
                type: "input",
                label: "序号",
                prop: "seq",
                placeHolder: "请输入序号",
                style: { width: "165px" },
                rules: [{ required: true, message: "  ", trigger: "blur" }]
              },
              {
                type: "input",
                label: "编码",
                prop: "code",
                placeHolder: "请输入编码",
                style: "",
                rules: [{ required: true, message: "  ", trigger: "blur" }]
              },
              {
                type: "input",
                label: "标题",
                prop: "title",
                placeHolder: "请输入节点标题",
                style: "",
                rules: [{ required: true, message: "  ", trigger: "blur" }],
                default: "点击修改"
              }
            ]
          },
          {
            title: "节点路径",
            key: "baseinfo",
            cols: 2,
            ctls: [
              {
                type: "input",
                label: "KEY",
                prop: "nodeKey",
                placeHolder: "请输入编码",
                disabled: true,
                style: "",
                rules: []
              },
              {
                type: "input",
                label: "路径",
                prop: "orgpath",
                placeHolder: "",
                disabled: true,
                style: "",
                rules: []
              }
            ]
          },
          {
            title: "授权信息",
            key: "baseinfo",
            cols: 2,
            ctls: [
              {
                type: "input",
                label: "兼职",
                prop: "orgtag",
                placeHolder: "输入兼职的部门编码，逗号分隔",
                style: "",
                rules: []
              },
              {
                type: "model-select",
                refModel: "auth.role",
                isMulti: true,
                label: "角色",
                prop: "roles",
                labelField: "name",
                valueField: "id",
                style: { "margin-left": "10px", width: "165px" }
              }
            ]
          }
        ],
        lists: null
      }
    };
  },
  mounted() {},
  methods: {
    initData(cbk) {
      cbk([
        {
          title: "目录",
          code: "root",
          orgpath:"/root",
          expand: true,
          roles: []
        }
      ]);
    }
  }
};
</script>
  <style>
</style>
