

<script>
/* eslint-disable */
// sd-skip-auto-import
import{Message}from"ant-design-vue";import components from"./_import-components/sd-form-template-picker-import";var _render=function e(){var t=this,a=t._self._c;return a("div",[a("sd-select",t._g({attrs:{value:t.value,options:[],open:false,"show-arrow":false,mode:"multiple"},nativeOn:{click:function(e){return t.inputClick.apply(null,arguments)}}},t.$listeners)),t.showModal?a("a-modal",{attrs:{"destroy-on-close":true,title:"选择模板",visible:t.showModal,width:1100},on:{ok:t.handleOk,cancel:t.handleCancel}},[a("div",{class:t.$style.wrap},[a("a-card",{class:t.$style.lefttree,attrs:{bordered:""}},[a("sd-form-template-catetree",{attrs:{"root-type":"USE_TEMP"},on:{treeSelect:t.treeSelect}})],1),a("a-card",{class:t.$style.rightcontent,attrs:{bordered:""}},[t.categoryId?a("sd-data-table",{ref:"dataTable",attrs:{"data-url":"api/framework/v1/page/businessList","process-req":e=>{e.data.formId="onlFormTemplet";return e},columns:t.columns,"filter-expressions":t.expressions,"search-fields":["templetName"]},scopedSlots:t._u([{key:"id",fn:function(e,s){return[a("a-radio-group",{class:t.$style.radio,model:{value:t.selectedRowKey,callback:function(e){t.selectedRowKey=e},expression:"selectedRowKey"}},[a("a-radio",{attrs:{value:`${e}_${s.templetName}`}})],1)]}},{key:"templetCategory",fn:function(e,s){return[a("a",{on:{click:function(e){return t.formPreView(s)}}},[t._v("预览")])]}}],null,false,3014538044)}):t._e()],1)],1)]):t._e(),a("sd-form-template-preview",{ref:"preview"})],1)};var staticRenderFns=[];_render._withStripped=true;export default{name:"SdFormTemplatePicker",components:components,model:{prop:"value",event:"change"},props:{value:{type:Array,default:()=>[]},templetType:{type:Number,default:1}},data(){return{showModal:false,categoryId:"",columns:[{title:"",dataIndex:"id",scopedSlots:{customRender:"id"},width:"60px"},{title:"模板名称",dataIndex:"templetName"},{title:"创建人",dataIndex:"creatorName",width:"150px"},{title:"操作",dataIndex:"templetCategory",scopedSlots:{customRender:"templetCategory"},width:"130px"}],selectedRowKey:""}},computed:{expressions(){return[{dataType:"long",name:"templetType",op:"eq",longValue:this.templetType}].concat("-1"!==this.categoryId?[{dataType:"str",name:"templetCategory",op:"eq",stringValue:this.categoryId}]:[])}},methods:{inputClick(){if(this.value?.[0])this.selectedRowKey=this.value[0].id+"_"+this.value[0].name;else this.selectedRowKey="";this.showModal=true},treeSelect(e){this.categoryId=e.id},handleOk(){if(this.selectedRowKey){const e=this.selectedRowKey.split("_");this.$emit("change",[{id:e.shift(),name:e.join("_")}])}this.showModal=false},handleCancel(){this.showModal=false},formPreView(e){this.$refs.preview.showPreView(e)},okClick(){this.$refs.render.validateFields().then((e=>{if(e)Message.info("此按钮仅供查看视觉效果，并没有实际的功能")}))}},render:_render,staticRenderFns:staticRenderFns};</script>

<style module lang="scss">
@use '@/common/design' as *;
.wrap {
  display: flex;
  height: 60vh;
  :global(.ant-card-body) {
    padding: 0;
  }
  .lefttree {
    width: 23%;
    min-height: 100%;
    margin-right: $padding-md;
    overflow: auto;
    :global(.ant-card) {
      min-height: 100%;
    }
    > :global(.ant-card-body) {
      padding: 10px;
    }
  }
  .rightcontent {
    width: calc(77% - #{$padding-md});
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    > :global(.ant-card-body) {
      padding-top: 7px;
    }
    .radio {
      float: right;
      :global(.ant-radio-wrapper) {
        margin-right: 0;
      }
    }
  }
}
</style>
