<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.proppertyType" label="属性" :rules="form.rules.proppertyTypeRules"></v-text-field> -->
    <v-select v-model="form.model.propertyType" :rules="form.rules.propertyTypeRules" :items="typeData" item-text="name" item-value="nId" label="物料属性类型"></v-select>

    <v-text-field v-model="form.model.propertyValue" label="属性值" :rules="form.rules.propertyValueRules"></v-text-field>

    <!-- <v-text-field v-model="form.model.billOfMaterial" label="物料清单" :rules="form.rules.billOfMaterialRules"></v-text-field> -->

    <!-- <v-checkbox v-model="form.model.isLocked" label="是否锁定" :rules="form.rules.isLockedRules"> </v-checkbox>

    <v-checkbox v-model="form.model.isFrozen" label="是否冻结" :rules="form.rules.isFrozenRules"> </v-checkbox> -->
  </nm-form-vuetify-drawer>
</template>
<script>
import { mixins } from 'xmanager-ui'
const { add, edit, update } = $api.materialApp.billOfMaterialProperty

export default {
  props: {
    bomId: {
      type: String,
      default: ''
    }
  },
  mixins: [mixins.formSave],
  data() {
    return {
      title: '物料清单属性',
      actions: { add, edit, update },
      parent: this,
      typeData: [
        { name: 'string', nId: 'string' },
        { name: 'bool', nId: 'bool' },
        { name: 'int', nId: 'int' }
      ],
      form: {
        model: {
          /** 编码 */
          nId: '',
          /** 属性 */
          propertyType: '',
          /** 属性值 */
          propertyValue: '',
          /** 物料清单 */
          billOfMaterial: ''
          // /** 是否锁定 */
          // isLocked: false,
          // /** 是否冻结 */
          // isFrozen: false
        },
        rules: {
          nIdRules: [v => !!v || '编码 is required'],
          propertyTypeRules: [],
          propertyValueRules: [],
          billOfMaterialRules: [],
          isLockedRules: [],
          isFrozenRules: []
        }
      }
    }
  },
  methods: {
    customResetFunction() {
      this.form.model.billOfMaterial = this.bomId
      this.form.model.nId = ''
      this.form.model.propertyValue = ''
      this.form.model.propertyType = ''
    }
  }
}
</script>
