addWarehouse.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div v-loading="loading">
  3. <div class="form-box">
  4. <el-form
  5. label-position="top"
  6. :model="form"
  7. :rules="formRules"
  8. ref="form"
  9. label-width="100px"
  10. >
  11. <el-row>
  12. <el-col :span="6">
  13. <el-form-item
  14. :label="$t('product_material.warehouse.warehouseType')"
  15. prop="type"
  16. >
  17. <el-select
  18. v-model="form.type"
  19. :placeholder="$t('pleaseSelect')"
  20. style="width: 100%"
  21. >
  22. <el-option
  23. v-for="item in options"
  24. :key="item.value"
  25. :label="item.label"
  26. :value="item.value"
  27. >
  28. </el-option>
  29. </el-select>
  30. </el-form-item>
  31. </el-col>
  32. </el-row>
  33. <el-form-item
  34. :label="$t('product_material.warehouse.warehouseName')"
  35. prop="name"
  36. >
  37. <el-input
  38. v-model="form.name"
  39. :placeholder="$t('pleaseInput')"
  40. ></el-input>
  41. </el-form-item>
  42. <el-row>
  43. <el-col :span="6">
  44. <el-form-item
  45. :label="$t('product_material.warehouse.storekeeper')"
  46. prop="warehouseKeeperId"
  47. >
  48. <el-select
  49. v-model="form.warehouseKeeperId"
  50. :placeholder="$t('pleaseSelect')"
  51. style="width: 100%"
  52. >
  53. <el-option
  54. v-for="item in options"
  55. :key="item.value"
  56. :label="item.label"
  57. :value="item.value"
  58. >
  59. </el-option>
  60. </el-select>
  61. </el-form-item>
  62. </el-col>
  63. </el-row>
  64. <el-form-item
  65. :label="$t('product_material.warehouse.warehouseDescription')"
  66. >
  67. <el-input
  68. v-model="form.remarks"
  69. type="textarea"
  70. :placeholder="$t('pleaseInput')"
  71. :rows="4"
  72. ></el-input>
  73. </el-form-item>
  74. </el-form>
  75. </div>
  76. <div style="text-align: center; margin-top: 15px">
  77. <el-button size="small" @click="handleCancel"
  78. >{{ $t("cancel") }}
  79. </el-button>
  80. <el-button type="primary" size="small" @click="handleSubmit">
  81. {{ $t("submit") }}</el-button
  82. >
  83. </div>
  84. </div>
  85. </template>
  86. <script>
  87. export default {
  88. name: "addWarehouse",
  89. props: {
  90. form: {
  91. type: Object,
  92. default: () => {},
  93. },
  94. },
  95. data() {
  96. return {
  97. loading: false,
  98. // form: {
  99. // warehouseKeeperId: "",
  100. // type: "",
  101. // name: "",
  102. // remarks: "",
  103. // },
  104. formRules: {
  105. type: [
  106. {
  107. required: true,
  108. message: this.$t("product_material.warehouse.warehouseTypeRules"),
  109. trigger: "change",
  110. },
  111. ],
  112. warehouseKeeperId: [
  113. {
  114. required: true,
  115. message: this.$t(
  116. "product_material.warehouse.warehouseKeeperIdRules"
  117. ),
  118. trigger: "change",
  119. },
  120. ],
  121. name: [
  122. {
  123. required: true,
  124. message: this.$t("product_material.warehouse.warehouseNameRules"),
  125. trigger: "blur",
  126. },
  127. ],
  128. },
  129. };
  130. },
  131. methods: {
  132. handleSubmit() {
  133. this.$refs.form.validate((valid) => {
  134. if (valid) {
  135. this.loading = true;
  136. this.$emit("submit");
  137. }
  138. });
  139. },
  140. handleCancel() {
  141. this.$emit("cancel");
  142. },
  143. },
  144. };
  145. </script>
  146. <style lang="scss" scoped>
  147. .form-box {
  148. height: calc(100vh - 280px);
  149. overflow: auto;
  150. box-sizing: border-box;
  151. padding: 5px;
  152. }
  153. </style>