333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
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
167
168
169
170
171
172
<template>
  <el-dialog v-dialogDrag ref="uploadRef" :visible.sync="currentDialogVisible" :title="title" class="import-dialog-container" width="480px" @close="dialogClose">
    <el-form ref="form" label-width="120px">
      <el-row>
        <el-form-item label="物料号:" label-width="150px">
          <el-select v-model="form.product_Id" placeholder="请选择" @change="onChangeProductCode">
            <el-option v-for="item in dataInfo" :key="item.product_Id" :label="item.productCode" :value="item.product_Id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="空器具库存数:" label-width="150px">
          <label for="" style="color:#ff1100">{{ form.stockQuantity }}</label>
        </el-form-item>
        <el-form-item label="空器具需求数量:" label-width="150px">
          <el-input v-model="form.demandQuantity" :value="value2" class="w-200" @change="onChangeDemandQuantity"></el-input>
        </el-form-item>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="hideDialog()">取 消</el-button>
      <el-button type="primary" @click="save('form')">确认</el-button>
    </div>
  </el-dialog>
</template>
<script>
export default {
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    label: {
      type: String,
      default: null
    },
    config: {
      type: Object,
      default: () => {
        return {};
      }
    },
    // 导入前事件
    beforeImportSubmit: {
      type: Function,
      default: () => {
        return () => {};
      }
    }
  },
  data() {
    return {
      form: {
        product_Id: null,
        productCode: null,
        stockQuantity: null,
        demandQuantity: null
      },
      dataInfo: [],
      value: null,
      value2: null
    };
  },
  computed: {
    // 标题
    title: function() {
      return this.config.title || "批量导入操作";
    },
    // 显示窗口
    currentDialogVisible: {
      get: function() {
        return this.visible;
      },
      set: function(val) {
        this.$emit("update:visible", val);
      }
    }
  },
  mounted() {
    this.uploadKey = this.common.getGUID();
    this.productinfo();
  },
  methods: {
    // 司机改变事件
    onDriverChange(value) {},
    onVehicleChange(value) {},
    // 合并到表单中
    childListInfo(ids, total) {},
    // 保存数据
    save() {
      if (this.form.stockQuantity < this.form.demandQuantity) {
        this.$message.error("需求数量不能大于库存数量!");
        return;
      }
      const url = "/api/inbound/emptyEquipment/save";
      const formData = this.form;
      const params = {
        formData: formData
      };
      const callback = res => {
        this.common.showMsg(res);
        if (res.result) {
          this.currentDialogVisible = false;
          this.$parent.dataList.reload();
        }
      };
      this.common.ajax(url, params, callback, true);
    },
    hideDialog() {
      this.currentDialogVisible = false;
    },
    // 关闭窗口
    dialogClose() {
      this.$emit("on-close"); // 关闭事件
    },
    // 获取下拉框数据
    productinfo() {
      const url = "/api/basicInfo/product/productInfo/productInfo";
      const params = {};
      const callback = res => {
        this.common.showMsg(res);
        if (res.result) {
          this.dataInfo = res.data;
        }
      };
      this.common.ajax(url, params, callback);
    },
    onChangeProductCode(productId) {
      const url = "/api/inbound/emptyEquipment/onChangeProductCode";
      const params = {
        product_Id: productId
      };
      const callback = res => {
        this.common.showMsg(res);
        if (res.result) {
          this.form.stockQuantity = res.data.leth;
        }
      };
      this.common.ajax(url, params, callback, true);
    },
    onChangeDemandQuantity(value2) {
      this.form.demandQuantity = value2;
    }
  }
};
</script>
 
<style lang="scss" scoped>
.import-dialog-container {
  /deep/ .el-upload-list {
    margin-right: 20px;
  }
  /deep/ .scrollbar-wrap {
    max-height: 400px;
    overflow-x: hidden;
    padding: 0px;
    padding-bottom: 30px !important;
    padding-top: 0px !important;
  }
  .msg-container {
    margin: 0;
    padding: 0;
    .msg-item {
      margin: 0;
      padding: 5px 0;
      word-wrap: break-word;
    }
  }
  .body-content {
    margin-top: 20px;
  }
}
</style>