<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>
|