

<script>
/* eslint-disable */
// sd-skip-auto-import
import{Modal}from"@/common/one-ui";import TableActionTypes from"@/common/services/table-action-types";import FormService from"../form-service";import components from"./_import-components/sd-form-template-category-import";var _render=function e(){var t=this,r=t._self._c;return r("div",{class:t.$style.wrap},[r("div",{class:t.$style.lefttree},[r("sd-form-template-catetree",{ref:"tree",attrs:{"root-type":"TEMP_CLASS_MANAGE","root-selected":""},on:{treeSelect:t.treeSelect}})],1),r("div",{class:t.$style.rightcontent},[r("a-card",[t.parent?r("sd-data-table-ex",{ref:"dataTable",attrs:{"form-id":"onlFormTempcategory","page-id":"online/templet/onlFormTempcategory",columns:t.columns,actions:t.actions,"show-selection":"","filter-expressions":t.expressions,"search-fields":["categoryName"]},on:{recordSaved:t.recordSaved,detailModalShow:t.detailModalShow},scopedSlots:t._u([{key:"form",fn:function({fields:e}){return[r("sd-form-item",{attrs:{name:"categoryName",label:"分类名称"}}),r("sd-form-item",{attrs:{name:"parentId",hidden:"","input-props":{defaultValue:t.parentSel[0]?t.parentSel[0].id:""}}}),e.parentId.readonly?[r("a-form-model-item",{attrs:{label:"上级分类"}},[t._v(" "+t._s(t.parent.name)+" ")])]:[r("a-form-model-item",{attrs:{label:"上级分类",prop:"parentId",rules:[{required:true}]}},[r("sd-form-template-cate-picker",{attrs:{"select-root":"","root-type":"TEMP_CLASS_MANAGE"},on:{change:t.categoryChange},model:{value:t.parentSel,callback:function(e){t.parentSel=e},expression:"parentSel"}})],1)]]}}],null,false,3027604349)}):t._e()],1)],1)])};var staticRenderFns=[];_render._withStripped=true;export default{name:"SdFormTemplateCategory",metaInfo:{title:"模板分类"},components:components,data(){return{columns:[{title:"分类名称",dataIndex:"categoryName",sdClickable:true}],actions:[{label:"新建",id:"new",permission:null,type:TableActionTypes.ex.create},{label:"删除",id:"delete",permission:null,type:TableActionTypes.batch,callback:this.delete}],parent:null,parentSel:[]}},computed:{expressions(){return this.parent?[{dataType:"str",name:"parentId",op:"eq",stringValue:this.parent.id}]:[]}},methods:{treeSelect(e){this.parent=e;this.parentSel=[this.parent]},detailModalShow(){this.parentSel=[this.parent]},categoryChange(){this.$refs.dataTable.getDetailModal().setFieldValue("parentId",this.parentSel[0]?.id)},recordSaved(){this.$refs.tree.refresh()},delete(e){return new Promise((t=>{Modal.confirm({title:"您确定删除这项内容吗？",content:"删除这条数据后，就无法恢复初始的状态。",okText:"删除",okType:"danger",onOk:()=>{FormService.deleteTemplateCate(e).then((e=>{this.$refs.dataTable.clearSelection(true);this.$refs.dataTable.refresh();this.$refs.tree.refresh()})).finally((()=>{t()}))},onCancel:()=>{t()}})}))}},render:_render,staticRenderFns:staticRenderFns};</script>

<style module lang="scss">
@use '@/common/design' as *;
.wrap {
  display: flex;
  min-height: 100%;
}
.lefttree {
  width: 20%;
  min-width: 150px;
  min-height: 100%;
  margin-right: $padding-lg;
  overflow: auto;
  :global(.ant-card) {
    min-height: 100%;
  }
}
.rightcontent {
  width: calc(80% - #{$padding-lg});
  min-height: 100%;
  overflow-y: auto;
  :global(.ant-card) {
    min-height: 100%;
  }
}
</style>
