|
@@ -11,7 +11,7 @@
|
|
|
<!-- 主表信息 填写-->
|
|
|
<a-card :bordered="true">
|
|
|
<div class="table-page-search-wrapper">
|
|
|
- <a-form-model layout="inline" ref="form" :model="clothesAdd" :rules="validatorRules">
|
|
|
+ <a-form-model layout="inline" ref="formModel" :model="clothesAdd" :rules="validatorRules">
|
|
|
<a-row :gutter="24">
|
|
|
<a-col :md="6" :sm="8">
|
|
|
<a-form-model-item label="订单号" prop="orderNum">
|
|
@@ -250,7 +250,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
|
|
import { JVXETypes } from '@/components/jeecg/JVxeTable'
|
|
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
|
|
import ReferencePrePacklist from '@views/packing-list/packinglist-clothes/referencePrePacklist'
|
|
|
-import { orderSpltListId } from '@api/document/packing-list/packinglist-clothes.js'
|
|
|
+import { orderSpltListId,addSpltList } from '@api/document/packing-list/packinglist-clothes.js'
|
|
|
|
|
|
|
|
|
export default {
|
|
@@ -262,6 +262,11 @@ export default {
|
|
|
let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
|
|
|
|
|
|
return {
|
|
|
+
|
|
|
+ toolbarConfig: {
|
|
|
+ // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
|
|
|
+ btn: []
|
|
|
+ },
|
|
|
// 表头
|
|
|
clothesAddColumns: [
|
|
|
{
|
|
@@ -378,13 +383,13 @@ export default {
|
|
|
title: '件数/箱',
|
|
|
key: 'piecesBox',
|
|
|
width: 120,
|
|
|
- type: JVXETypes.inputNumber
|
|
|
+ type: JVXETypes.normal
|
|
|
},
|
|
|
{
|
|
|
title: '箱数',
|
|
|
key: 'boxNumber',
|
|
|
width: 120,
|
|
|
- type: JVXETypes.inputNumber
|
|
|
+ type: JVXETypes.normal
|
|
|
},
|
|
|
|
|
|
{
|
|
@@ -486,6 +491,7 @@ export default {
|
|
|
// pageSize: 0
|
|
|
},
|
|
|
visible: false,
|
|
|
+ sizeFields:[], // 尺码字段
|
|
|
confirmLoading: false,
|
|
|
validatorRules: {
|
|
|
orderNum: [{ required: true, message: '订单号不能为空', trigger: 'blur' }],
|
|
@@ -495,12 +501,21 @@ export default {
|
|
|
}
|
|
|
// dateFormat: 'YYYY-MM-DD'
|
|
|
}
|
|
|
+ },
|
|
|
+ // 接收父组件查询方法
|
|
|
+ props: {
|
|
|
+ fatherList: {
|
|
|
+ type: Function,
|
|
|
+ default: null
|
|
|
+ }
|
|
|
},
|
|
|
created() {},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
// 参照回调
|
|
|
referCallback(idArr){
|
|
|
+ this.clothesAdd = {}
|
|
|
+ this.clothesAddData = []
|
|
|
var preId = idArr[0]
|
|
|
orderSpltListId({id:preId}).then(res => {
|
|
|
var data = res.result
|
|
@@ -529,16 +544,16 @@ export default {
|
|
|
|
|
|
dynamicColumns(sizeTables){
|
|
|
var newColumns = this.clothesAddColumns
|
|
|
- var i = 0
|
|
|
- for(;i < newColumns.length ; i++){
|
|
|
+ if (sizeTables != null){
|
|
|
+ var i = 0
|
|
|
+ for(;i < newColumns.length ; i++){
|
|
|
if(newColumns[i].insertAfter){
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- console.log(sizeTables)
|
|
|
- debugger
|
|
|
// 插入数据
|
|
|
for (var j=0;j<sizeTables.length;j++){
|
|
|
+ this.sizeFields.push('size-'+sizeTables[j].size);
|
|
|
var field = {
|
|
|
title: sizeTables[j].size,
|
|
|
key: 'size-'+sizeTables[j].size,
|
|
@@ -547,7 +562,7 @@ export default {
|
|
|
isSize:true,
|
|
|
};
|
|
|
newColumns.splice(i+1+j,0,field);
|
|
|
- debugger
|
|
|
+ }
|
|
|
}
|
|
|
this.clothesAddColumns = newColumns
|
|
|
},
|
|
@@ -606,6 +621,34 @@ export default {
|
|
|
handleDelete(id) {
|
|
|
console.log('id:', id)
|
|
|
},
|
|
|
+
|
|
|
+ handleValueChange(event) {
|
|
|
+ var dataRow = event.row
|
|
|
+ console.log(dataRow)
|
|
|
+ if (dataRow.startingBoxNumber != undefined && dataRow.startingBoxNumber != "" &&
|
|
|
+ dataRow.endCaseNumber != undefined && dataRow.endCaseNumber != ""){
|
|
|
+ dataRow.boxNumber = dataRow.endCaseNumber*1-dataRow.startingBoxNumber*1+1;
|
|
|
+ }
|
|
|
+ var allSizeSum = this.getAllSizeSum(dataRow);
|
|
|
+ dataRow.piecesBox = allSizeSum
|
|
|
+ dataRow.total = dataRow.piecesBox*dataRow.boxNumber
|
|
|
+ if (dataRow.netWeight != "" && dataRow.netWeight != undefined){
|
|
|
+ dataRow.totalNetWeight = dataRow.netWeight * dataRow.boxNumber;
|
|
|
+ }
|
|
|
+ if (dataRow.grossWeight != "" && dataRow.grossWeight != undefined){
|
|
|
+ dataRow.totalGrossWeight = dataRow.grossWeight * dataRow.boxNumber;
|
|
|
+ }
|
|
|
+ if (dataRow.outerBoxLength != "" && dataRow.outerBoxLength != undefined &&
|
|
|
+ dataRow.outerBoxWidth != "" && dataRow.outerBoxWidth != undefined &&
|
|
|
+ dataRow.outerBoxHeight != "" && dataRow.outerBoxHeight != undefined){
|
|
|
+ dataRow.totalVolume = dataRow.outerBoxLength * dataRow.outerBoxWidth * dataRow.outerBoxHeight * dataRow.boxNumber
|
|
|
+ console.log(dataRow)
|
|
|
+ }
|
|
|
+ if (dataRow.unitPrice != undefined && dataRow.unitPrice != ""){
|
|
|
+ dataRow.totalPrice = dataRow.unitPrice*dataRow.total
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
// 操作按钮 复制
|
|
|
copy(record) {},
|
|
|
// -------------------------------------
|
|
@@ -617,23 +660,120 @@ export default {
|
|
|
},
|
|
|
// 抽屉 提交
|
|
|
submitAdd() {
|
|
|
- console.log('保存新增、刷新发运明细列表')
|
|
|
- const that = this
|
|
|
+ const that = this;
|
|
|
// 触发表单验证
|
|
|
- this.$refs.form.validate(valid => {
|
|
|
+ that.$refs.formModel.validate(valid => {
|
|
|
if (valid) {
|
|
|
- that.confirmLoading = true
|
|
|
+ if (this.sizeFields.length == 0){
|
|
|
+ this.$message.error('当前记录没有尺码字段,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // that.confirmLoading = true
|
|
|
+ var newObj = {}
|
|
|
+ newObj.itemNumber = this.clothesAdd.styleNum
|
|
|
+ newObj.orderNumber = this.clothesAdd.orderNum
|
|
|
+ newObj.productName = this.clothesAdd.name
|
|
|
+ newObj.sizeRange = this.clothesAdd.sizeRange
|
|
|
+ newObj.customer = this.clothesAdd.customer
|
|
|
+ newObj.containerCode = this.clothesAdd.containerCode
|
|
|
+ newObj.containerNumber = this.clothesAdd.containerNo
|
|
|
+ newObj.memo = this.clothesAdd.note
|
|
|
+ newObj.garmentFactory = this.clothesAdd.clothesFactory
|
|
|
+ newObj.exportInvoiceNo = this.clothesAdd.exportInvoiceNo
|
|
|
+ newObj.shippingOrderNumber = this.clothesAdd.bookNum
|
|
|
+ newObj.syPackingListTailoringItemList = this.clothesAddData
|
|
|
+ var sort = 0;
|
|
|
+ for (var i=0; i<newObj.syPackingListTailoringItemList.length;i++){
|
|
|
+ var tableRow = newObj.syPackingListTailoringItemList[i];
|
|
|
+ var allSizeSum = this.getAllSizeSum(tableRow);
|
|
|
+ if (allSizeSum == 0){
|
|
|
+ this.$message.error('第'+(i+1)+'行所有尺码数量为0,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(tableRow.startingBoxNumber > tableRow.endCaseNumber) {
|
|
|
+ this.$message.error('第'+(i+1)+'行起始箱号大于结束箱号,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tableRow.startingBoxNumber == ""){
|
|
|
+ this.$message.error('第'+(i+1)+'行起始箱号未填,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tableRow.endCaseNumber == ""){
|
|
|
+ this.$message.error('第'+(i+1)+'行结束箱号未填,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tableRow.boxNumber == "" || tableRow.boxNumber == 0){
|
|
|
+ this.$message.error('第'+(i+1)+'行箱数,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tableRow.netWeight == null || tableRow.netWeight == "" || tableRow.netWeight == undefined){
|
|
|
+ this.$message.error('第'+(i+1)+'行净重/箱未填,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tableRow.piecesBox == null || tableRow.piecesBox == "" || tableRow.piecesBox == undefined){
|
|
|
+ this.$message.error('第'+(i+1)+'行件数/箱未填,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tableRow.grossWeight == null || tableRow.grossWeight == "" || tableRow.grossWeight == undefined){
|
|
|
+ this.$message.error('第'+(i+1)+'行毛重/箱未填,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tableRow.outerBoxLength == null || tableRow.outerBoxLength == "" || tableRow.outerBoxLength == undefined){
|
|
|
+ this.$message.error('第'+(i+1)+'行外箱长度未填,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tableRow.outerBoxWidth == null || tableRow.outerBoxWidth == "" || tableRow.outerBoxWidth == undefined){
|
|
|
+ this.$message.error('第'+(i+1)+'行外箱宽度未填,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tableRow.outerBoxHeight == null || tableRow.outerBoxHeight == "" || tableRow.outerBoxHeight == undefined){
|
|
|
+ this.$message.error('第'+(i+1)+'行外箱高度未填,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (tableRow.netWeightToo == null || tableRow.netWeightToo == "" || tableRow.netWeightToo == undefined){
|
|
|
+ this.$message.error('第'+(i+1)+'行净净重未填,无法保存');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (var j=0; j<tableRow.sizeTables.length; j++){
|
|
|
+ var sizeTable = tableRow.sizeTables[j];
|
|
|
+ var field = 'size-'+sizeTable.size;
|
|
|
+ tableRow.sizeTables[j].proportion = tableRow[field];
|
|
|
+ }
|
|
|
+ tableRow.sort = ++sort;
|
|
|
+ }
|
|
|
+ addSpltList(newObj).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('新增成功')
|
|
|
+ this.close()
|
|
|
+ //清空信息
|
|
|
+ newObj = {};
|
|
|
+ that.fatherList() // 调用父组件 查询方法
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.message)
|
|
|
}
|
|
|
})
|
|
|
- this.close()
|
|
|
- // this.getShipmentList() // 刷新 装箱单-成衣列表
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取不同尺码数量之和
|
|
|
+ getAllSizeSum(record){
|
|
|
+ var ret = 0;
|
|
|
+ for (var i=0; i<this.sizeFields.length; i++){
|
|
|
+ if (record[this.sizeFields[i]] != undefined && record[this.sizeFields[i]] != ""){
|
|
|
+ ret += record[this.sizeFields[i]]*1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
},
|
|
|
|
|
|
// -------------------------------------
|
|
|
close() {
|
|
|
this.$emit('close')
|
|
|
this.visible = false
|
|
|
- this.$refs.form.resetFields()
|
|
|
+ this.clothesAdd = {}
|
|
|
+ this.clothesAddData = []
|
|
|
+ // this.$refs.form.resetFields()
|
|
|
},
|
|
|
// - father------------------------------------
|
|
|
aa() {},
|