ke_junjie
2025-06-04 bb6e2230bb8ded3c5546bc4e4c282ee343754475
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<template>
  <div class="invetoryEdit height overflow">
    <div class="centent-form overflowy-auto">
      <el-form
        class="margin-auto width90"
        ref="registerForm"
        :model="registerForm"
        size="mini"
        :rules="rules"
        label-position="left"
        label-width="120px"
      >
        <el-form-item label="编号:" prop="place">
          <el-input disabled v-model="registerForm.pvcCode" clearable></el-input>
        </el-form-item>
        <el-form-item label="库位号:" prop="placeType">
          <el-select v-model="registerForm.place" filterable clearable placeholder="请选择">
            <el-option
              v-for="(item, index) in placeList"
              :key="'place' + index"
              :label="item.place"
              :value="item.place"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="器具号:" prop="placeType">
          <el-select v-model="registerForm.containerName" filterable clearable placeholder="请选择">
            <el-option
              v-for="(item, index) in containerNameList"
              :key="'containerName' + index"
              :label="item.containerName"
              :value="item.containerName"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
    </div>
    <div class="palteEdit-button text-right margin-right15 margin-top2">
      <el-button
        type="primary"
        size="mini"
        class="form-buttom"
        :loading="savloading"
        @click="submitForm('registerForm')"
        >提交</el-button
      >
      <el-button type="primary" size="mini" class="form-buttom" @click="$emit('cancel')">取消</el-button>
    </div>
  </div>
</template>
 
<script>
import { PlaceAddOrUpdate, PlaceVsContainerGetCode } from '@/api/inventory';
import { PlaceSearch } from '@/api/position';
import { ContainerSearch } from '@/api/palte';
export default {
  data() {
    return {
      registerForm: { pvcCode: '' },
      placeList: [],
      containerNameList: [],
      disabled: false,
      rules: {
        deptName: { required: true, message: '请输部门名称', trigger: 'change' },
        deptDes: { required: true, message: '请输入部门描述', trigger: 'change' },
        enable: { required: true, message: '请选择是否启用', trigger: 'change' }
      },
      savloading: false
    };
  },
  props: {
    rowitem: {
      type: Object,
      default: {}
    }
  },
  mounted() {
    if (JSON.stringify(this.rowitem) != '{}') {
      this.registerForm = this.rowitem;
    } else {
      this.PlaceVsContainerGetCode();
    }
 
    this.PlaceSearch();
    this.ContainerSearch();
  },
  methods: {
    //编号
    PlaceVsContainerGetCode() {
      PlaceVsContainerGetCode().then(res => {
        this.registerForm.pvcCode = res;
      });
    },
    //库位编号
    PlaceSearch() {
      PlaceSearch('1&onePageNum=999').then(res => {
        if (res.code == 0) {
          this.placeList = res.data;
        }
      });
    },
    //器具编号
    ContainerSearch() {
      ContainerSearch('1&onePageNum=999').then(res => {
        if (res.code == 0) {
          this.containerNameList = res.data;
        }
      });
    },
    submitForm(registerForm) {
      this.$refs[registerForm].validate(valid => {
        if (valid) {
          this.savloading = true;
          PlaceAddOrUpdate(this.registerForm).then(res => {
            if (res.code == 0) {
              this.$message({
                type: 'success',
                message: '提交成功'
              });
              this.$emit('addsubmit');
            } else {
              this.$message({
                type: 'warning',
                message: '提交失败'
              });
            }
            this.savloading = false;
          });
        }
      });
    }
  },
  watch: {}
};
</script>
 
<style lang="scss" scoped>
.invetoryEdit {
  width: 98%;
  padding: 1%;
  .show-pwd {
    position: absolute;
    right: 10px;
    top: 3px;
    font-size: 16px;
    color: #889aa4;
    cursor: pointer;
    user-select: none;
  }
  .centent-form {
    height: 92%;
    width: 100%;
    margin: auto;
  }
  .invetoryEdit-button {
  }
  ::v-deep .el-form-item__content {
    width: 60%;
  }
  ::v-deep .el-select {
    width: 100%;
  }
}
</style>