<template>
  <nm-form-vuetify-drawer ref="form" v-bind="form" v-on="on" :parent="parent" :title="title" placement="left" :visible.sync="visible_">
    <v-text-field v-model="form.model.nId" label="编码" :rules="form.rules.nIdRules"></v-text-field>

    <v-text-field v-model="form.model.name" label="名称" :rules="form.rules.nameRules"></v-text-field>

    <v-text-field v-model="form.model.descrition" label="描述" :rules="form.rules.descritionRules"></v-text-field>

    <v-checkbox v-model="form.model.isDefault" label="是否默认" :rules="form.rules.isDefaultRules"> </v-checkbox>

    <v-text-field v-model="form.model.stateMachineNId" label="状态机Id" :rules="form.rules.stateMachineNIdRules"></v-text-field>
  </nm-form-vuetify-drawer>
</template>
<script>
import { mixins } from 'xmanager-ui'
const { add, edit, update } = $api.materialApp.materialTrackingUnitTemplate

export default {
  mixins: [mixins.formSave],
  data() {
    return {
      title: '物料跟踪单位模板',
      actions: { add, edit, update },
      parent: this,
      form: {
        model: {
          /** 编码 */
          nId: '',
          /** 名称 */
          name: '',
          /** 描述 */
          descrition: '',
          /** 是否默认 */
          isDefault: false,
          /** 状态机Id */
          stateMachineNId: '',
          /** 是否冻结 */
          isFrozen: false,
          /** 是否锁定 */
          isLocked: false
        },
        rules: {
          nIdRules: [v => !!v || '编码 is required'],
          nameRules: [],
          descritionRules: [],
          isDefaultRules: [],
          stateMachineNIdRules: [],
          isFrozenRules: [],
          isLockedRules: []
        }
      }
    }
  },
  mounted: {
    customResetFunction() {
      this.form.model.stateMachineNId = ''
      this.form.model.descrition = ''
      this.form.model.name = ''
      this.form.model.nId = ''
      this.form.model.isDefault = false
    }
  }
}
</script>
