123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <template>
- <div v-loading="loading">
- <div class="form-box">
- <el-form
- label-position="top"
- :model="form"
- :rules="formRules"
- ref="form"
- label-width="100px"
- >
- <el-row>
- <el-col :span="6">
- <el-form-item
- :label="$t('product_material.warehouse.warehouseType')"
- prop="type"
- >
- <el-select
- v-model="form.type"
- :placeholder="$t('pleaseSelect')"
- style="width: 100%"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-form-item
- :label="$t('product_material.warehouse.warehouseName')"
- prop="name"
- >
- <el-input
- v-model="form.name"
- :placeholder="$t('pleaseInput')"
- ></el-input>
- </el-form-item>
- <el-row>
- <el-col :span="6">
- <el-form-item
- :label="$t('product_material.warehouse.storekeeper')"
- prop="warehouseKeeperId"
- >
- <el-select
- v-model="form.warehouseKeeperId"
- :placeholder="$t('pleaseSelect')"
- style="width: 100%"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-form-item
- :label="$t('product_material.warehouse.warehouseDescription')"
- >
- <el-input
- v-model="form.remarks"
- type="textarea"
- :placeholder="$t('pleaseInput')"
- :rows="4"
- ></el-input>
- </el-form-item>
- </el-form>
- </div>
- <div style="text-align: center; margin-top: 15px">
- <el-button size="small" @click="handleCancel"
- >{{ $t("cancel") }}
- </el-button>
- <el-button type="primary" size="small" @click="handleSubmit">
- {{ $t("submit") }}</el-button
- >
- </div>
- </div>
- </template>
- <script>
- export default {
- name: "addWarehouse",
- props: {
- form: {
- type: Object,
- default: () => {},
- },
- },
- data() {
- return {
- loading: false,
- // form: {
- // warehouseKeeperId: "",
- // type: "",
- // name: "",
- // remarks: "",
- // },
- formRules: {
- type: [
- {
- required: true,
- message: this.$t("product_material.warehouse.warehouseTypeRules"),
- trigger: "change",
- },
- ],
- warehouseKeeperId: [
- {
- required: true,
- message: this.$t(
- "product_material.warehouse.warehouseKeeperIdRules"
- ),
- trigger: "change",
- },
- ],
- name: [
- {
- required: true,
- message: this.$t("product_material.warehouse.warehouseNameRules"),
- trigger: "blur",
- },
- ],
- },
- };
- },
- methods: {
- handleSubmit() {
- this.$refs.form.validate((valid) => {
- if (valid) {
- this.loading = true;
- this.$emit("submit");
- }
- });
- },
- handleCancel() {
- this.$emit("cancel");
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .form-box {
- height: calc(100vh - 280px);
- overflow: auto;
- box-sizing: border-box;
- padding: 5px;
- }
- </style>
|