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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
 
<template>
  <div ref="container" class="page-list-container">
    <!--数据Table-->
    <yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes" @on-load-dropdown-after="onLoadDropdownAfter">
    </yrt-data-list>
 
    <!--数据编辑器Editor-->
    <yrt-editor :ref="editorRef" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :auth-nodes="authNodes">
    </yrt-editor>
 
    <el-dialog :visible.sync="dialogFormVisible" title="空器具回库任务" width="30%">
      <el-form :label-width="formLabelWidth">
        <el-form-item label="选择仓库">
          <el-col :span="11">
            <el-select v-model="emptyReturn.storage_Id" placeholder="请选择仓库" @change="storageChange">
              <el-option v-for="item in storageList" :key="item.storage_Id" :label="item.storageName" :value="item.storage_Id">
              </el-option>
            </el-select>
          </el-col>
          <!-- <el-input v-model="name"></el-input> -->
        </el-form-item>
        <el-form-item label="空器具所在工位">
          <el-col :span="11">
            <el-select v-model="emptyReturn.destination_Id" placeholder="请选择所在工位" @change="destinationChange">
              <el-option v-for="item in destinationList" :key="item.destination_Id" :label="item.destinationName" :value="item.destination_Id">
              </el-option>
            </el-select>
          </el-col>
          <!-- <el-input v-model="name"></el-input> -->
        </el-form-item>
        <el-form-item label="空器具数量">
          <el-col :span="11">
            <el-input v-model="emptyReturn.totalQuantity"></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="备注">
          <el-col :span="11">
            <el-input v-model="emptyReturn.remark"></el-input>
          </el-col>
        </el-form-item>
      </el-form>
 
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="addNewOrder">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import baseLayout from "@/components/common/base-layout.vue";
 
export default {
  name: "sys",
  components: {},
  mixins: [baseLayout],
  data() {
    return {
      dialogFormVisible: false,
      formLabelWidth: "120px",
      emptyReturn: {
        storage_Id: 87,
        storageName: "立体仓"
      },
      destinationList: [],
      // 仓库下拉框
      storageList: []
    };
  },
  mounted() {
    this.getAlldestinationList();
  },
  methods: {
    // 权限按钮点击事件
    buttonClick(authNode) {
      switch (authNode) {
        // 新建
        case "add":
          this.dialogFormVisible = true;
          return true;
      }
    },
    // 明细按钮点击事件
    detailButtonClick(authNode) {
      switch (authNode) {
        case "detailAdd":
          // 商品明细添加
          this.detailAdd();
          return true;
      }
    },
    // 新建确认事件
    addNewOrder() {
      var url = "/api/inbound/quipmentReturn/save";
      const params = Object.assign({}, this.emptyReturn);
      var callback = res => {
        this.common.showMsg(res);
        if (res.result) {
          this.dataList.reload();
          this.dialogFormVisible = false;
        }
      };
      this.common.ajax(url, params, callback, true);
    },
    getAlldestinationList() {
      const url = "api/basicInfo/base/destination/getList";
      const params = {};
      var callback = res => {
        if (res.result) {
          this.destinationList = res.data;
          console.log(this.destinationList);
        }
      };
      this.common.ajax(url, params, callback, true);
    },
    // 选择器具
    destinationChange() {
      const item = this.destinationList.find(item => Number(item.destination_Id) === Number(this.emptyReturn.destination_Id));
      if (item) {
        this.emptyReturn.destinationName = item.destinationName;
      }
    },
    // 选择仓库
    storageChange() {
      const item = this.storageList.find(item => Number(item.storage_Id) === Number(this.emptyReturn.storage_Id));
      if (item) {
        this.emptyReturn.storageName = item.storageName;
      }
    },
    // 下拉框加载完毕后
    onLoadDropdownAfter(dropdownData) {
      this.storageList = this.dataList.getDropDownData(31);
    },
    // 明细添加
    detailAdd() {
      this.$prompt("请输入器具编号", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消"
      })
        .then(({ value }) => {
          this.getScanData(value);
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "取消输入"
          });
        });
    },
    // 选择物料编号带出明细数据
    getScanData(plateCode) {
      debugger;
      this.masterData.plateCode = this.decode(plateCode); // 解码
      const existPlateCode = this.detailRows.find(item => item.plateCode === plateCode);
      if (existPlateCode) {
        this.showError("已存在,不可重复扫描!");
        return;
      }
 
      if (!plateCode) {
        this.showError("器具编号不能为空");
        return;
      }
      const url = "/api/basicInfo/base/plate/getPlateInfo";
      var params = {
        plateCode: plateCode
      };
      this.common.ajax(
        url,
        params,
        res => {
          if (res.result) {
            this.masterData.storage_Id = res.data.storage_Id;
            this.masterData.storageName = res.data.storageName;
            this.masterData.plateType = res.data.plateType;
            this.masterData.plateType_Id = res.data.plateType_Id;
            this.masterData.packingQuantity = res.data.packingQuantity;
            res.data.product_Id = 0;
            res.data.productCode = res.data.plateCode;
            res.data.productName = res.data.plateName;
            this.detailRows.push(res.data);
          }
        },
        true
      );
    }
  }
};
</script>