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
<template>
  <el-dialog :visible.sync="currentVisible" title="批量拆分" width="60%">
    <el-alert title="提示:批量拆分" type="success"></el-alert>
    <el-table :data="tableData" stripe style="width: 100%">
      <el-table-column prop="ExtendField09" label="序号" width="100">
      </el-table-column>
      <el-table-column prop="ProductName" label="物料名称" width="100">
      </el-table-column>
      <el-table-column prop="ProductModel" label="条形码" width="100">
      </el-table-column>
      <el-table-column prop="Quantity" label="数量" width="110">
        <template slot-scope="{$idnex, row}">
          <el-input-number v-model.number="row.Quantity" controls-position="right" class="w-100"></el-input-number>
        </template>
      </el-table-column>
      <el-table-column prop="ProduceDate" label="生产日期">
        <template slot-scope="{$idnex, row}">
          <el-date-picker v-model="row.ProduceDate" type="date" placeholder="选择日期" class="w-100%">
          </el-date-picker>
        </template>
      </el-table-column>
      <el-table-column prop="BatchNumber" label="批次号">
        <template slot-scope="{$idnex, row}">
          <el-input v-model="row.BatchNumber" placeholder="请输入内容" class="w-100"></el-input>
        </template>
      </el-table-column>
      <el-table-column prop="Remark" label="备注">
        <template slot-scope="{$idnex, row}">
          <el-input v-model="row.Remark" placeholder="请输入内容" class="w-60"></el-input>
        </template>
      </el-table-column>
      <el-table-column prop="caozuo" label="操作">
        <template slot-scope="{$idnex, row}">
          <el-button type="success" icon="el-icon-yrt-kaiqi" @click.native="addNewPositon(row.ExtendField09)">{{ row.ExtendField10 }}</el-button>
        </template>
      </el-table-column>
    </el-table>
 
    <div slot="footer" class="dialog-footer">
      <el-button @click="currentVisible = false">取 消</el-button>
      <el-button type="primary" @click="batchTransfer">确 定</el-button>
    </div>
  </el-dialog>
</template>
 
<script>
export default {
  name: "batch-transfer",
  components: {},
  props: {
    visible: {
      type: Boolean,
      default: false,
      required: true
    }
  },
  data() {
    return {
      id: "",
      // 明细表格数组
      tableData: [],
      // 表格输入框宽度设置
      formLabelWidth: "80px",
      // 明细表格数组的序号,删除指定列表用
      number: 0
    };
  },
  computed: {
    currentVisible: {
      get: function() {
        return this.visible;
      },
      set: function(val) {
        this.$emit("update:visible", val);
      }
    }
  },
  methods: {
    showData(rows) {
      this.tableData = rows;
      this.tableData[0].ExtendField09 = 0;
      this.tableData[0].ExtendField10 = "拆分";
    },
    // 拆分明细数据
    addNewPositon(index) {
      if (index === 0) {
        var newRow = JSON.parse(JSON.stringify(this.tableData[0]));
        this.tableData.push(newRow);
        this.tableData.forEach((rowData, index) => {
          if (index !== 0) {
            this.tableData[index].ExtendField10 = "删除";
            this.tableData[index].ExtendField09 = this.number + 1;
          }
        });
      } else {
        this.tableData.splice(index, 1);
      }
    },
    // 确认保存
    batchTransfer() {
      const ProductModelList = [];
      this.tableData.forEach(rowData => {
        const Quantity = rowData.Quantity;
        const ProduceDate = rowData.ProduceDate;
        const BatchNumber = rowData.BatchNumber;
        const Remark = rowData.Remark;
        ProductModelList.push({
          Quantity: Quantity,
          ProduceDate: ProduceDate,
          BatchNumber: BatchNumber,
          Remark: Remark
        });
      });
      const url = "/api/Purchase_Order/BatchTransfer";
      const params = {
        OrderList_Id: this.tableData[0].OrderList_Id,
        ProductModelLists: ProductModelList
      };
      var callback = res => {
        this.common.showMsg(res);
      };
      this.common.ajax(url, params, callback, null);
    }
  }
};
</script>
 
<style lang="less" scoped>
@deep: ~">>>";
@{deep} .el-dialog__body {
  padding: 0px 10px;
}
</style>