

<script>
/* eslint-disable */
// sd-skip-auto-import
import selector from"@/common/components/sd-select-tree";import axios from"@/common/services/axios-instance";import components from"./_import-components/sd-tree-selector-import";export const metaInfo={caption:"树选择器",component:{props:["designerData"],render(){const e=arguments[0];return e(selector,{attrs:{value:this.designerData.attr.defaultValue?this.designerData.attr.defaultValue.split(","):[],dataSource:this.designerData.attr.selectTreeItem,showLevel:this.designerData.attr.showLevel}})}},icon:"sd-org-chart",order:1900};export const fieldProps={dataType:"selectTree",attrFD:{formItemProps:{inputProps:{}}},attr:{multiple:"false",selectTreeItem:void 0,showLevel:"1"}};var _render=function e(){var t=this,o=t._self._c;return o("div",[o("a-form-model-item",[o("div",{attrs:{slot:"label"},slot:"label"},[t._v(" 选项 "),o("a-select",{attrs:{value:t.component.attrFD.listItemType||"custom"},on:{change:e=>{t.component.attr.treeModuleDict=void 0;t.component.attr.selectTreeItem=void 0;t.component.attr.defaultValue=void 0;t.$set(t.component.attrFD,"listItemType",e)}}},[o("a-select-option",{attrs:{value:"dict"}},[t._v(" 树数据字典 ")]),o("a-select-option",{attrs:{value:"appDict"}},[t._v(" 应用内树数据字典 ")]),o("a-select-option",{attrs:{value:"custom"}},[t._v(" 自定义 ")])],1)],1),"custom"!==t.component.attrFD.listItemType?o("sd-tree-picker",{key:t.key,attrs:{value:t.component.attr.treeModuleDict,single:"","load-tree-data":t.loadTreeData,"option-label":"name","option-value":"code"},on:{change:t.updateTreeItem}}):o("sd-tree-editor",{model:{value:t.component.attr.selectTreeItem,callback:function(e){t.$set(t.component.attr,"selectTreeItem",e)},expression:"component.attr.selectTreeItem"}})],1),o("a-form-model-item",[o("sd-ugly-checkbox",{attrs:{slot:"label"},on:{input:t.multipleModeChange},slot:"label",model:{value:t.component.attr.multiple,callback:function(e){t.$set(t.component.attr,"multiple",e)},expression:"component.attr.multiple"}},[t._v(" 多选 ")])],1),t.component.attr.selectTreeItem?o("a-form-model-item",[o("div",{attrs:{slot:"label"},slot:"label"},[t._v(" 标签显示层级 "),o("a-tooltip",[o("template",{slot:"title"},[t._v(" 从根节点到选中节点，第几级开始显示标签 ")]),o("a-icon",{attrs:{type:"question-circle"}})],2)],1),o("sd-ugly-number",{model:{value:t.component.attr.showLevel,callback:function(e){t.$set(t.component.attr,"showLevel",e)},expression:"component.attr.showLevel"}})],1):t._e(),t.component.attr.selectTreeItem?o("a-form-model-item",{attrs:{label:"默认值"}},[o("sd-select-tree",{attrs:{value:t.component.attr.defaultValue?t.component.attr.defaultValue.split(","):[],"data-source":t.component.attr.selectTreeItem,single:"false"===t.component.attr.multiple,"show-level":t.component.attr.showLevel},on:{change:e=>{t.$set(t.component.attr,"defaultValue",e.join(","))}}})],1):t._e()],1)};var staticRenderFns=[];_render._withStripped=true;export default{name:"SdTreeSelector",components:components,data(){return{appId:"",key:0}},created(){this.appId=this.$route.query.appId},methods:{multipleModeChange(e){if("false"===e&&this.component.attrFD.defaultValue?.length)this.component.attrFD.defaultValue=[this.component.attrFD.defaultValue[0]]},loadTreeData(e){return axios.get(`api/framework/v1/onl-treemodule/categories/${e?"categoryTree":"topCategoryList"}?parentCode=${e}${"appDict"===this.component.attrFD.listItemType?"&&appId="+this.appId:""}`).then((e=>e.data.map((e=>({...e,isLeaf:e.leaf})))))},updateTreeItem(e){this.$set(this.component.attr,"treeModuleDict",e);this.key++;this.component.attr.selectTreeItem=void 0;this.component.attr.defaultValue=void 0;if(e?.length)axios.get("api/framework/v1/onl-treemodule/categories/categoryTree?parentCode="+e[0].id).then((e=>{this.component.attr.selectTreeItem=e.data}))}},render:_render,staticRenderFns:staticRenderFns};</script>

<style module lang="scss">
@use '@/common/design' as *;
</style>
