<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-delete-before="onDeleteBefore" :on-stop-before="onStopBefore">
|
<template slot="common-column-slot" slot-scope="{row, col}">
|
<template v-if="col.prop=='statusText'">
|
<state-flow :load-options="stateLoadOptions" :where="{order_Id: row[dataOptions.idField]}">
|
<template slot="content">
|
<el-tag :color="setStatusBgColor(row[col.prop])" :style="setStatusColor(row[col.prop])">
|
{{ row[col.prop] }}
|
</el-tag>
|
</template>
|
</state-flow>
|
</template>
|
<!--审核字段-->
|
<template v-else-if="col.prop=='auditing'">
|
<template>
|
<el-tag v-if="row[col.prop]==0" color="#ffff33" style="color:black;border:0">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop]==1" color="#ff0033" style="color:white;border:0">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop]==2" color="#33cc33" style="color:black;border:0;color:#fff;">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</el-tag>
|
<span v-else>
|
{{ row[col.prop] }}
|
</span>
|
</template>
|
</template>
|
<!--连接字段-->
|
<template v-else-if="col.prop==dataOptions.linkColumn">
|
<el-link type="primary" @click.native="()=>{linkEditor(row[dataOptions.idField]);}">{{ row[col.prop] }}</el-link>
|
</template>
|
<template v-else-if="col.dropdown_Id>0">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</template>
|
<template v-else>
|
<template v-if="['date', 'datetime'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatDate(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else-if="['byte', 'int32', 'int64', 'decimal', 'double'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatNumber(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else>
|
{{ row[col.prop] }}
|
</template>
|
</template>
|
</template>
|
</yrt-data-list>
|
|
<!--数据编辑器Editor-->
|
<yrt-editor :ref="editorRef" :data-list-ref="dataListRef" :fields="editorOptions.fields" :config="editorOptions.config" :data-options="dataOptions" :action.sync="editorOptions.action" :top.sync="editorOptions.top" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :use-detail-slot="[ 'images']" :auth-nodes="authNodes" :btn-read-only="btnReadOnly" :default-value="defaultValue" :edit-button-click="editButtonClick" :before-close="beforeClose" :on-stop-before="onStopBefore" :on-save-before="onSaveBefore" :use-label-slot="useLabelSlot" @on-edit-load-after="onEditLoadAfter" @on-detail-change="onDetailChange" @on-add-load-after="onEditLoadAfter" @on-row-change="onRowChange" @on-item-click="(ref, val, itemData, field, formData)=>{onChange(ref, val, field, formData, itemData)}" @on-change="onChange" @on-load-dropdown-after="onLoadDropdownAfter">
|
<!--自定义标签插槽-->
|
<template slot="label-feeItem_Ids">
|
一次性收费项
|
<a href="javascript:;" style="color:blue;" @click="showFeeTtemPopup()">修改</a>
|
</template>
|
<!--自定义按钮插槽-->
|
<!-- <template slot="footer-button-region" slot-scope="{ formData, details }"> -->
|
<!--打印条码按钮-->
|
<!-- <el-button :disabled="btnReadOnly.printBarcode" type="success" icon="el-icon-yrt-print" @click.native="printBarcode(formData, details)">打印条码</el-button> -->
|
<!--打印中条码按钮-->
|
<!-- <el-button :disabled="btnReadOnly.printBarcode" type="success" icon="el-icon-yrt-print" @click.native="printBarcode(formData, details, 'middleBarcode')">打印中条码</el-button> -->
|
<!--打印大条码按钮-->
|
<!-- <el-button :disabled="btnReadOnly.printBarcode" type="success" icon="el-icon-yrt-print" @click.native="printBarcode(formData, details, 'bigBarcode')">打印大条码</el-button> -->
|
<!-- </template> -->
|
<template slot="detail-column-slot" slot-scope="{ row, col, formData }">
|
<template v-if="col.prop === 'images'">
|
<el-image :src="row.images" :fit="fit" style="width: 140px; height: 100px"></el-image>
|
</template>
|
</template>
|
</yrt-editor>
|
|
<!--物料选择器-->
|
<yrt-selector ref="selector-dialog" :config="selectorConfig" :visible.sync="selectorConfig.visible" @on-selected="onSelected"></yrt-selector>
|
<!--物料库存选择器-->
|
<yrt-selector ref="selector-position-dialog" :config="selectorPositionConfig" :visible.sync="selectorPositionConfig.visible" :url="selectorPositionConfig.url" @on-selected="onPositionSelected"></yrt-selector>
|
<!--打印条码弹出页面-->
|
<order-barcode ref="barcode-dialog" :visible.sync="barcodeVisible"></order-barcode>
|
<!--明细转移页面-->
|
<detail-transfer ref="detailtransfer-dialog" :visible.sync="detailtransferVisible"></detail-transfer>
|
<!--批量拆分-->
|
<batch-transfer ref="batchtransfer-dialog" :visible.sync="batchtransferVisible"></batch-transfer>
|
<!--批量更改折扣率页面-->
|
<batch-update ref="batchupdate-dialog" :visible.sync="batchupdateVisible"></batch-update>
|
<!--批量拆分导入-->
|
<batch-import ref="batchimport-dialog" :visible.sync="batchimportVisible"></batch-import>
|
<!--明细拆分单据-->
|
<order-detail-split ref="detailsplitDialog" :visible.sync="detailsplitimportVisible"></order-detail-split>
|
<!-- 一键确认入库 -->
|
<quick-enter-dialog ref="checkEnterDialog" :visible.sync="checkEnterVisible"></quick-enter-dialog>
|
<!-- 一次性收费项 -->
|
<order-one-charge ref="feeTtemPopupDialog" :visible.sync="isFeeTtemPopupVisible"></order-one-charge>
|
<!--明细导入-->
|
<import-dialog :visible.sync="orderImportConfig.isShowDialog" :import-config="orderImportConfig" :before-import-submit="beforeImportSubmit" @on-close="onCloseOrderDetail">
|
</import-dialog>
|
</div>
|
</template>
|
|
<script>
|
import baseLayout from "@/components/common/base-layout.vue";
|
import yrtSelector from "@/components/common/yrtSelector.vue";
|
import orderBarcode from "./components/order-barcode.vue";
|
import detailTransfer from "./components/detail-transfer.vue";
|
import batchUpdate from "./components/batch-update.vue";
|
import batchTransfer from "./components/batch-transfer.vue";
|
import batchImport from "./components/batch-import.vue";
|
import stateFlow from "@/components/common/components/stateflow.vue";
|
import quickEnterDialog from "./components/quick-enter-dialog.vue";
|
import ImportDialog from "@/components/common/components/import-common-dialog";
|
import orderDetailSplit from "./components/order-detail-split.vue";
|
import orderOneCharge from "./components/order-one-charge.vue";
|
|
import orderMixinButton from "./components/order-mixin-button.vue";
|
import orderMixinStatus from "./components/order-mixin-status.vue";
|
var moment = require("moment");
|
|
export default {
|
name: "inbound-purchase-order-wx",
|
components: {
|
yrtSelector,
|
orderBarcode,
|
detailTransfer,
|
batchUpdate,
|
batchTransfer,
|
batchImport,
|
stateFlow,
|
quickEnterDialog,
|
ImportDialog,
|
orderDetailSplit,
|
orderOneCharge
|
},
|
mixins: [baseLayout, orderMixinButton, orderMixinStatus],
|
// 自定义处理权限函数
|
doAuth(the) {
|
// 判断当前版本是否拥有导入权限
|
var authList = [
|
{ name: "预到货单批量导入", auth: "allImport" },
|
{ name: "打印预到货单", auth: "print" }
|
// { name: "确认在途中", auth: "inTransit" }
|
];
|
const names = authList.map(item => {
|
return item.name;
|
});
|
the.common.isSaaSAuth(names, res => {
|
res = the.common.objectToCase(res);
|
authList.forEach(node => {
|
let hasAuth = res.result;
|
if (hasAuth) {
|
hasAuth = res.data.some(item => {
|
return item.moduleName === node.name;
|
});
|
}
|
the.authNodes[node.auth] = hasAuth;
|
});
|
});
|
},
|
data() {
|
return {
|
fileList: [],
|
// 条码对话框是否显示
|
barcodeVisible: false,
|
// 表单默认值,新建时用
|
defaultValue: {
|
statusID: 1,
|
statusText: "新建"
|
},
|
// 配置参数
|
config: {
|
// 预到货单明细自动生成批次号
|
in_autoGenerateBatchCode: false,
|
// 预到货单明细自动生成唯一码
|
in_autoSingleSignCode: false
|
},
|
orderImportConfig: {
|
// 显示导入对话框
|
isShowDialog: false,
|
title: "入库单批量导入",
|
// 导入地址
|
url: "api/inbound/order/importExcel",
|
// 模板地址
|
templateUrl: "https://auod-beijing.oss-cn-beijing.aliyuncs.com/node-wms/template/预到货单明细导入模板.xlsx"
|
// templateUrl: this.common.templateDomain + "/node-wms/template/预到货单明细导入模板.xlsx"
|
},
|
// 明细拆分是否显示
|
detailsplitimportVisible: false,
|
// 一次性收费项弹框
|
isFeeTtemPopupVisible: false
|
};
|
},
|
mounted() {
|
this.getConfig();
|
},
|
// 自定义初始化数据
|
init(the) {
|
var userInfo = the.common.getUserInfo();
|
// 设置经手人不是超级管理员,不允许编辑
|
if (!userInfo.isAdministrator) {
|
the.editorOptions.fields.forEach(cols => {
|
cols.columns &&
|
cols.columns.forEach(col => {
|
col.fields.forEach(item => {
|
if (item.options.prop === "UserTrueName") {
|
item.options.disabled = true;
|
}
|
});
|
});
|
});
|
}
|
},
|
activated() {
|
// SaaS模块权限
|
this.common.hasSaaSAuth("预到货单", this.$refs.container);
|
},
|
methods: {
|
onChange(ref, val, field, formData) {
|
debugger;
|
if (field.options.prop === "plateCode") {
|
// this.editor.changeValue("plateType", val);
|
const plateCode = this.editor.formData["plateCode"];
|
const url = "/api/basicInfo/base/plate/getList";
|
const params = {
|
name: plateCode
|
};
|
const _ref = this.dataList;
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.editor.changeValue("plateType", res.data[0].plateType);
|
this.editor.changeValue("plateType_Id", res.data[0].plateType_Id);
|
this.editor.changeValue("storageCode", res.data[0].storageCode);
|
this.editor.changeValue("storageName", res.data[0].storageName);
|
this.loadProductDropDown();
|
} else {
|
this.editor.changeValue("plateType", null);
|
}
|
};
|
this.common.ajax(url, params, callback, _ref);
|
}
|
},
|
// 下拉框加载完毕后
|
onLoadDropdownAfter(formData) {
|
// 在新间时获取工厂名称第一条数据
|
const consignorDropdownList = this.editor.getDropdownData(797);
|
if (consignorDropdownList && consignorDropdownList.length) {
|
// 只有新建时,默认值
|
if (!formData.order_Id) {
|
const firstItem = consignorDropdownList[0];
|
this.defaultValue.consignor_Id = firstItem.consignor_Id;
|
this.defaultValue.consignorCode = firstItem.consignorCode;
|
this.defaultValue.consignorName = firstItem.consignorName;
|
formData.consignor_Id = firstItem.consignor_Id;
|
formData.consignorCode = firstItem.consignorCode;
|
formData.consignorName = firstItem.consignorName;
|
}
|
}
|
},
|
// 加载明细商品下拉框
|
loadProductDropDown() {
|
debugger;
|
var plateType = this.masterData.plateType;
|
var plateType_Id = this.masterData.plateType_Id;
|
const url = "/api/basicInfo/base/productInfo/getListByPlateType";
|
const params = {
|
plateType_Id: plateType_Id,
|
plateType: plateType
|
};
|
var callback = res => {
|
if (res.result) {
|
this.editor.setDropdownData(34, res.data);
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
},
|
// 将选择器选择中的数据填充到明细表中
|
onPositionSelected(rows) {
|
rows.forEach(item => {
|
if (!item.originPlace) {
|
if (this.detailRows.length) {
|
item.originPlace = this.detailRows[this.detailRows.length - 1].originPlace;
|
}
|
}
|
});
|
this.editor.addDetailDataRow(rows);
|
this.selectorPositionConfig.visible = false;
|
},
|
// 将选择器选择中的数据填充到明细表中
|
onSelected(rows) {
|
// 设置默认值
|
const lastRow = this.detailRows[this.detailRows.length - 1];
|
let originPlace = lastRow ? lastRow.originPlace : "";
|
rows.forEach(row => {
|
row.originPlace = row.originPlace;
|
|
if (originPlace && !row.originPlace) {
|
row.originPlace = originPlace;
|
}
|
if (row.originPlace) {
|
originPlace = row.originPlace;
|
}
|
});
|
this.editor.addDetailDataRow(rows);
|
this.selectorConfig.visible = false;
|
},
|
// 获得配置参数
|
getConfig() {
|
var keys = Object.keys(this.config).join(",");
|
var url = "/api/sys/param/getConfig";
|
var params = {
|
openNodeApi: true,
|
keys: keys
|
};
|
var callback = res => {
|
this.common.showMsg(res);
|
this.valueList = res.data;
|
// 获得参数值列表,将数字转换为对象
|
res.data.forEach(item => {
|
var value03 = item.value03;
|
if (this.common.isNumber(item.value03)) {
|
value03 = parseInt(item.value03);
|
}
|
this.$set(this.config, item.value02, !!value03);
|
});
|
};
|
this.common.ajax(url, params, callback, this.$refs.container);
|
},
|
// 上传前事件
|
beforeUpload() {},
|
// 数据加载后
|
onEditLoadAfter(formData) {
|
var statusID = formData.statusID;
|
if (statusID === 1) {
|
// 新建
|
this.btnReadOnly.auditing = false;
|
this.btnReadOnly.stop = false;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.save = false;
|
this.btnReadOnly.inTransit = false;
|
this.editorOptions.config.disabled = false; // 整个对话框可编辑
|
} else if (statusID === 2) {
|
// 审核成功
|
this.btnReadOnly.auditing = true;
|
this.btnReadOnly.stop = false;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.save = true;
|
this.btnReadOnly.inTransit = false;
|
this.editorOptions.config.disabled = true; // 整个对话框可编辑
|
} else if (statusID === 4) {
|
// 4-在途中
|
this.btnReadOnly.auditing = true;
|
this.btnReadOnly.stop = false;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.save = true;
|
this.btnReadOnly.inTransit = true;
|
this.editorOptions.config.disabled = true; // 整个对话框可编辑
|
} else if (statusID === 8) {
|
// 8-完全交货
|
this.btnReadOnly.auditing = true;
|
this.btnReadOnly.stop = true;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.save = true;
|
this.btnReadOnly.inTransit = true;
|
this.editorOptions.config.disabled = true; // 整个对话框可编辑
|
} else if (statusID === 14) {
|
// 已合并
|
this.btnReadOnly.auditing = true;
|
this.btnReadOnly.stop = true;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.save = true;
|
this.btnReadOnly.inTransit = true;
|
this.editorOptions.config.disabled = true; // 整个对话框可编辑
|
} else if (statusID === 9) {
|
// 9-终止
|
this.btnReadOnly.auditing = true;
|
this.btnReadOnly.stop = true;
|
this.btnReadOnly.open = false;
|
this.btnReadOnly.save = true;
|
this.btnReadOnly.inTransit = true;
|
this.editorOptions.config.disabled = true; // 整个对话框可编辑
|
} else {
|
// 3-部分交货,9-终止
|
this.btnReadOnly.auditing = true;
|
this.btnReadOnly.stop = true;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.save = true;
|
this.btnReadOnly.inTransit = true;
|
this.editorOptions.config.disabled = true; // 整个对话框可编辑
|
}
|
|
if (formData && formData.order_Id) {
|
let totalQuantity = 0;
|
let totalMoney = 0;
|
let totalRateMoney = 0;
|
var detailRows = formData["Purchase_OrderList"].rows;
|
detailRows.forEach(item => {
|
totalQuantity += item.quantity;
|
totalMoney += item.purchaseMoney;
|
totalRateMoney += item.taxAmount;
|
});
|
this.editor.changeValue("totalQuantity", totalQuantity);
|
this.editor.changeValue("totalMoney", totalMoney);
|
this.editor.changeValue("totalRateMoney", totalRateMoney);
|
}
|
},
|
// 明细字段改变
|
onDetailChange(ref, val, row, field) {
|
this.setTotal(ref, val, row, field);
|
if (!row.quantity || !row.unitConvert) {
|
row.bigUnitRounding = 0;
|
} else {
|
row.bigQty = Math.Round(row.quantity / row.unitConvert, 4);
|
row.bigUnitRounding = Math.ceil(row.quantity / row.unitConvert, 4);
|
}
|
if (row.produceDate) {
|
row.effectivedate = moment(row.produceDate)
|
.add(row.shelfLifeDay || 0, "days")
|
.format("YYYY-MM-DD");
|
}
|
},
|
// 求和
|
setTotal(ref, val, row, field) {
|
var detailRows = this.detailRows;
|
// 合计数量求和
|
let totalQuantity = 0;
|
let totalMoney = 0.0;
|
let totalRateMoney = 0.0;
|
let totalWeight = 0.0;
|
detailRows.forEach(item => {
|
if (item.productName) {
|
var now = moment().format("YYYY-MM-DD");
|
const url = "/api/basicInfo/base/productInfo/getByIds";
|
const params = {
|
id: item.product_Id
|
};
|
var callback = res => {
|
if (res.result) {
|
// this.editor.setDropdownData(34, res.data);
|
this.dataTable = res.data;
|
item.weight = this.dataTable.weight;
|
item.ratePrice = this.dataTable.ratePrice;
|
item.images = this.dataTable.images;
|
if (!item.produceDate) {
|
item.produceDate = now;
|
}
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
}
|
|
// var now = moment().format("YYYY-MM-DD");
|
// if (item.produceDate) {
|
// item.produceDate = now;
|
// }
|
const urls = "/api/tms/userSys/quotation/getBatchNumber";
|
const param = {
|
code: item.productCode,
|
time: item.produceDate
|
};
|
var callbacks = res => {
|
if (res.result) {
|
// this.editor.setDropdownData(34, res.data);
|
this.getBatchNumber = res.data;
|
item.batchNumber = this.getBatchNumber.batchNumber;
|
}
|
};
|
this.common.ajax(urls, param, callbacks, true);
|
|
// item.ratePrice = Math.Round((item.purchasePrice || 0) * (1 + (item.rate || 0)), 2);
|
// 明细不含税金额 = 数量 * 不含税单价;
|
item.purchaseMoney = Math.Round((item.quantity || 0) * (item.ratePrice || 0), 2);
|
// 含税金额 = 数量 * 含税单价;
|
item.taxAmount = Math.Round((item.quantity || 0) * (item.ratePrice || 0), 2);
|
item.rateMoney = item.taxAmount;
|
// 行小计重量
|
if (field) {
|
// weight 单位毛重 / totalWeight 小计毛重 quantity 数量
|
if (field.prop === "quantity" || field.prop === "weight") {
|
// 小计 = 数量 * 单位毛重
|
this.$set(item, "totalWeight", Math.Round((item.quantity || 0) * (item.weight || 0), 4));
|
} else if (field && field.prop === "totalWeight") {
|
// 修改合计重量,计算出单位重量
|
if (item.quantity) {
|
this.$set(item, "weight", Math.Round((item.totalWeight || 0) / (item.quantity || 0), 4));
|
} else {
|
item.weight = 0;
|
}
|
}
|
}
|
item.unitPackage = Math.ceil(item.unitPackage);
|
if (field) {
|
if (field.prop === "quantity") {
|
// 总数量同步于数量
|
item.totalPackageQty = item.quantity;
|
}
|
if (field.prop === "totalPackageQty") {
|
this.$set(item, "totalPackageQty", item.totalPackageQty);
|
}
|
if (field.prop === "paiQty") {
|
item.paiQty = Math.ceil(item.paiQty);
|
} else {
|
item.paiQty = item.unitPackage ? Math.ceil(item.totalPackageQty / item.unitPackage) : 0;
|
}
|
}
|
// item.totalPackageQty = item.quantity;
|
// 建议拍数 = 总件数 / 打包配置
|
// item.paiQty = item.unitPackage ? Math.ceil(item.totalPackageQty || 0 / item.unitPackage || 0) : 0;
|
|
totalQuantity += item.quantity || 0;
|
totalMoney += item.purchaseMoney || 0;
|
totalRateMoney += item.taxAmount || 0;
|
totalWeight += item.totalWeight || 0;
|
// debugger;
|
if (item.unitPackageType === "按数量") {
|
item.totalPackageQty = item.quantity;
|
} else if (item.unitPackageType === "按毛重") {
|
item.totalPackageQty = item.totalWeight;
|
} else if (item.unitPackageType === "按大单位数量") {
|
item.totalPackageQty = item.bigUnitRounding;
|
}
|
});
|
this.editor.changeValue("totalQuantity", totalQuantity);
|
this.editor.changeValue("totalMoney", Math.Round(totalMoney, 2));
|
this.editor.changeValue("totalRateMoney", Math.Round(totalRateMoney, 2));
|
this.editor.changeValue("totalWeight", Math.Round(totalWeight, 4));
|
// this.editor.changeValue("totalWeight", totalWeight);
|
// this.editor.changeValue("weight", Math.Round(weight, 2));
|
},
|
// 保存前事件
|
onSaveBefore() {
|
this.setTotal();
|
|
// 生成数据
|
this.detailRows.forEach((row, index) => {
|
const currentDate = moment(new Date());
|
if (this.config.in_autoGenerateBatchCode && !row.batchNumber) {
|
row.batchNumber = currentDate.format("YYYYMMDD") + "-" + (index + 1);
|
row.__ischange__ = true;
|
}
|
if (this.config.in_autoSingleSignCode && !row.singleSignCode) {
|
row.singleSignCode = this.common.getGUID();
|
row.__ischange__ = true;
|
}
|
});
|
|
let hasQty = true;
|
var formData = this.editor.formData;
|
var detailRows = formData["Purchase_OrderList"].rows;
|
detailRows.forEach(item => {
|
if (item.quantity <= 0 && !item.quantity) {
|
hasQty = false;
|
}
|
});
|
if (!hasQty) {
|
this.$message({
|
message: "下线数量必须大于0!",
|
type: "warning"
|
});
|
return false;
|
}
|
},
|
// 删除前事件
|
onDeleteBefore(rows) {
|
let statusText = true;
|
rows.forEach(rowData => {
|
statusText = rowData.statusText;
|
if (statusText !== "新建") {
|
statusText = false;
|
}
|
});
|
if (statusText === false) {
|
this.$message.error("仅可删除新建预到货单!");
|
return false;
|
}
|
return true;
|
},
|
// 终止前事件
|
onStopBefore(rows) {
|
const statusList = ["新建", "审核成功", "在途中"];
|
for (const row of rows) {
|
const statusText = row.statusText;
|
|
if (statusList.indexOf(statusText) < 0) {
|
this.$message.error(`只有["新建", "审核成功", "在途中"]状态时才可以做终止动作!`);
|
return false;
|
}
|
return true;
|
}
|
},
|
// 关闭窗口前钩子函数, return true关闭窗口
|
beforeClose() {
|
const detailList = this.editor.formData["Purchase_OrderList"].rows.filter(item => {
|
return !item.orderList_Id;
|
});
|
if (this.editor.formData.statusText === "新建" && detailList.length) {
|
this.$confirm("数据未保存,是否关闭?", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
this.editor.config.visible = false;
|
})
|
.catch(() => {
|
this.$message({
|
type: "info",
|
message: "已取消"
|
});
|
this.editor.config.visible = true;
|
});
|
} else {
|
this.editor.config.visible = false;
|
}
|
},
|
// 表格下拉框字段改变事件
|
onRowChange(ref, val, field) {
|
// 货主和仓库改变
|
if (["consignorName", "storageName"].indexOf(field.options.prop) >= 0) {
|
window.setTimeout(() => {
|
this.getDefaultItems();
|
}, 200);
|
}
|
},
|
// 获取一次性收费项默认值
|
getDefaultItems() {
|
const formData = this.editor.formData;
|
if (formData.feeItem_Ids && this.editorOptions.config.action !== "add") return; // 已经有值了不在设置默认值
|
|
const url = "/api/finance/baseOneCharge/getDefaultItems";
|
const params = {
|
associatedTasks: "入库单",
|
consignor_Id: formData.consignor_Id,
|
storage_Id: formData.storage_Id
|
};
|
this.common.ajax(url, params, res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.$set(formData, "feeItem_Ids", res.data);
|
}
|
});
|
},
|
// 预到货明细批量导入前事件
|
beforeImportSubmit() {
|
const order_Id = this.editor.formData["order_Id"];
|
// 自定义参数
|
this.orderImportConfig.params = {
|
order_Id: order_Id
|
};
|
},
|
// 明细导入窗口关闭时事件
|
onCloseOrderDetail() {
|
this.editor.reload();
|
}
|
}
|
};
|
</script>
|