<template>
  <ts-form :data="data" :rules="rules" @submit="submitEvent" ref="xForm">
    <div slot="formCon">
      <ts-form-item field="themeClassifyValue">
        <ts-select
          :emphasize="true"
          :source="themeClassifyValueSource"
          v-model="data.themeClassifyValue"
          title="上级菜单"
          name="themeClassifyValue"
        ></ts-select>
      </ts-form-item>
      <ts-form-item field="designName">
        <ts-input
          v-model="data.menuname"
          title="菜单名称"
          :emphasize="true"
          placeholder
          name="menuname"
        ></ts-input>
      </ts-form-item>
      <!-- <div class="none">
        <ts-button id="addBiMenuMerge" type="submit" status="primary" ref="submit">提交</ts-button>
      </div> -->
    </div>
  </ts-form>
</template>

<script>
export default {
  name: 'biMenuMerge',
  props: ['biCustom', 'menuName'],
  data() {
    return {
      data: {},
      rules: {
        designName: [{ required: true, message: '请输入报表名称' }],
        themeClassifyValue: [{ required: true, message: '请输入主题分类' }]
      },
      themeClassifyValueSource: {
        dataType: 'local',
        code: 'value',
        text: 'label',
        data: [
          { value: 1, label: '医保' },
          { value: 2, label: '财务' },
          { value: 3, label: '药学' },
          { value: 4, label: '质控' },
          { value: 5, label: '院感' },
          { value: 6, label: '信息中心' }
        ],
        isReq: true,
        value: {
          name: '',
          code: ''
        }
      }
    }
  },
  created() {},
  mounted() {
    this.data.menuname = this.menuName
  },
  watch: {
    menuName: {
      handler() {
        this.data.menuname = this.menuName
      }
    }
  },
  methods: {
    // 表单提交验证
    submitEvent() {
      this.addSave()
    },
    addSave() {
      this.$emit('saveClick', { formData: this.data, type: 'add' })
    }
  }
}
</script>
<style lang="less" scoped>
</style>
