<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">
|
<template slot="common-column-slot" slot-scope="{ row, col }">
|
<template v-if="col.prop == 'statusText'">
|
<el-tag :color="setStatusBgColor(row[col.prop])" :style="setStatusColor(row[col.prop])" class="cursor-pointer">
|
{{ row[col.prop] }}
|
</el-tag>
|
</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 == 'sortingStatus'">
|
<template>
|
<el-tag v-if="row[col.prop] == 1" 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] == 2" color="#00ff99" 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] == 3" color="#ff0000" style="color:black;border:0;color:#fff;">
|
{{ $refs[dataListRef].translateText( col.prop, row[col.prop], col.dropdown_Id ) }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop] == 5" color="#6699FF" 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" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :top.sync="editorOptions.top" :visible.sync="editorOptions.config.visible" :on-save-before="onSaveBefore" :detail-button-click="detailButtonClick" :btn-read-only="btnReadOnly" :auth-nodes="authNodes" @on-change="onChange" @on-item-click="(ref, val, itemData, field, formData)=>{onChange(ref, val, field, formData, itemData)}" @on-edit-load-after="onEditLoadAfter" @on-add-load-after="onEditLoadAfter" @on-detail-change="onDetailChange" @on-load-dropdown-after="onLoadDropdownAfter">
|
<!--自定义按钮插槽-->
|
<!-- <template slot="footer-button-region" slot-scope="{ formData, details }">
|
<el-button :disabled="btnReadOnly.toSaleOrder" type="success" icon="el-icon-yrt-zhuanyiwenti" @click.native="toSaleOrder(formData, details)">转到出库单</el-button>
|
</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>
|
|
<!-- 出库计划单批量导入 -->
|
<!-- <el-dialog v-dialogDrag :visible.sync="dialogLandingTime" title="出库单批量导入">
|
<el-form>
|
<el-upload ref="upload" :on-preview="handlePreview" :on-remove="handleRemove" :on-success="handleSuccess" :file-list="fileList" :auto-upload="true" :action="upLoadUrl()" :limit="1" class="upload-bill">
|
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitImport()">开始导入</el-button>
|
<el-button style="margin-left: 10px;" size="small" type="primary" plain>
|
<a :href="common.ossDomain+'/node-wms/template/出库计划单导入模板.xlsx'" style="color:while;font-size:12px;">下载模板</a>
|
</el-button>
|
<div slot="tip" class="el-upload__tip">只能上传扩展名为.xlsx的excel文件</div>
|
</el-upload>
|
</el-form>
|
|
<el-scrollbar :noresize="false" :native="false" wrap-class="scrollbar-wrap">
|
<ul class="msg-container">
|
<li v-for="(item, index) in msgList" :key="index" class="msg-item" v-html="item">
|
{{ index + 1 }}、{{ item }}
|
</li>
|
</ul>
|
</el-scrollbar>
|
<div ref="loading"></div>
|
</el-dialog> -->
|
|
<!-- 主表批量导入 -->
|
<import-dialog :visible.sync="orderImportConfig.isShowDialog" :import-config="orderImportConfig">
|
</import-dialog>
|
|
</div>
|
</template>
|
<script>
|
import baseLayout from "@/components/common/base-layout.vue";
|
import yrtSelector from "@/components/common/yrtSelector.vue";
|
import ImportDialog from "@/components/common/components/import-common-dialog";
|
|
export default {
|
name: "outbound-sale-order-plan",
|
components: { yrtSelector, ImportDialog },
|
mixins: [baseLayout],
|
// 自定义处理权限函数
|
doAuth(the) {},
|
data() {
|
return {
|
// 选择器配置参数
|
selectorConfig: {
|
title: "物料选择器",
|
width: "1000px",
|
visible: false,
|
// 配置路由
|
router: "/selector/s-product-selector"
|
},
|
selectorPositionConfig: {
|
title: "物料库存选择器",
|
width: "1000px",
|
visible: false,
|
// 配置路由
|
router: "/selector/x-product-selector",
|
url: "/api/common/GroupDataList",
|
fixedWhere: {
|
productStorage: {
|
operator: ">",
|
value: 0
|
}
|
}
|
},
|
// 出库单导入对话框参数
|
orderImportConfig: {
|
// 显示导入对话框
|
isShowDialog: false,
|
title: "出库单批量导入",
|
// 导入地址
|
url: "/api/outbound/orderPlan/importExcel",
|
// 模板地址
|
templateUrl: "/upload/template/焊装生产计划导入模板.xlsx"
|
},
|
// 出库计划单状态值
|
statusValueList: [
|
{
|
status: "审核成功",
|
bgColor: "#00ff99",
|
color: "black"
|
},
|
{
|
status: "新建",
|
bgColor: "#ffff66",
|
color: "#000"
|
},
|
{
|
status: "审核失败",
|
bgColor: "#ffcc66",
|
color: "#fff"
|
},
|
{
|
status: "在途中",
|
bgColor: "#00ffff",
|
color: "#000"
|
},
|
{
|
status: "部分交货",
|
bgColor: "#cc66ff",
|
color: "#fff"
|
},
|
{
|
status: "完全交货",
|
bgColor: "#00ccff",
|
color: "#fff"
|
},
|
{
|
status: "终止",
|
bgColor: "#ff6600",
|
color: "#fff"
|
},
|
{
|
status: "强制完成",
|
bgColor: "#00ccff",
|
color: "#fff"
|
},
|
{
|
status: "待审核",
|
bgColor: "#ffff33",
|
color: "#000"
|
},
|
{
|
status: "波次完成",
|
bgColor: "#ffcc33",
|
color: "#fff"
|
},
|
{
|
status: "打包中",
|
bgColor: "#66cccc",
|
color: "#000"
|
},
|
{
|
status: "部分打包",
|
bgColor: "#66cccc",
|
color: "#fff"
|
},
|
{
|
status: "打包完成",
|
bgColor: "#66cccc",
|
color: "#fff"
|
},
|
{
|
status: "已转出库单",
|
bgColor: "#33cc33",
|
color: "#fff"
|
},
|
{
|
status: "已发货",
|
bgColor: "#33cc33",
|
color: "#fff"
|
},
|
{
|
status: "部分退货",
|
bgColor: "#ff9999",
|
color: "#fff"
|
},
|
{
|
status: "完全退货",
|
bgColor: "#ff9999",
|
color: "#fff"
|
},
|
{
|
status: "已完成",
|
bgColor: "#99ffff",
|
color: "#fff"
|
},
|
{
|
status: "拣货中",
|
bgColor: "#33ffff",
|
color: "#fff"
|
},
|
{
|
status: "配货中",
|
bgColor: "#ccff66",
|
color: "#fff"
|
},
|
{
|
status: "等待配货",
|
bgColor: "#ccff66",
|
color: "#000"
|
},
|
{
|
status: "等待打包",
|
bgColor: "#cccc33",
|
color: "#000"
|
},
|
{
|
status: "用户取消",
|
bgColor: "#c53e3a",
|
color: "#fff"
|
},
|
{
|
status: "已合并",
|
bgColor: "#ff7043",
|
color: "#fff"
|
}
|
],
|
// 文件名
|
fileUrl: null,
|
fileList: [],
|
// 消息内容
|
msgList: [],
|
// 导入获得消息interval handle
|
intervalHandler: null,
|
// 导入key
|
uploadKey: null
|
|
// dialogLandingTime: false
|
};
|
},
|
mounted() {
|
this.uploadKey = this.common.getGUID();
|
},
|
methods: {
|
// 状态背景颜色
|
setStatusBgColor(status) {
|
var colorItem = this.statusValueList.find(item => {
|
return item.status === status;
|
});
|
var bgColor = "#fffff";
|
if (colorItem) bgColor = colorItem.bgColor;
|
|
return bgColor;
|
},
|
// 状态字体颜色
|
setStatusColor(status) {
|
var colorItem = this.statusValueList.find(item => {
|
return item.status === status;
|
});
|
var color = "#fffff";
|
if (colorItem) color = colorItem.color;
|
|
return {
|
border: 0,
|
color: color
|
};
|
},
|
// 级联改变数据
|
onChange(ref, val, field, formData) {
|
// 记录ID和Name
|
if (field.options.prop === "provinceName") {
|
// 设置表单数据
|
const item = ref.getOption(val);
|
// 改变市级下拉框
|
this.loadChildrenNode(item.value, 614, field.options.prop);
|
} else if (field.options.prop === "cityName") {
|
// 设置表单数据
|
const item = ref.getOption(val);
|
// 改变区级下拉框
|
this.loadChildrenNode(item.value, 615, field.options.prop);
|
} else if (field.options.prop === "clientShortName") {
|
// 隐藏下拉框
|
ref.doClose();
|
// 选择客户名称之后加载客户信息
|
const clientShortName = this.editor.formData["clientShortName"];
|
const url = "/api/basicInfo/base/client/getList";
|
const params = {
|
name: clientShortName
|
};
|
const _ref = this.dataList;
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.editor.changeValue("mobile", res.data[0].mobile);
|
this.editor.changeValue("shippingName", res.data[0].shippingName);
|
this.editor.changeValue("shippingAddress", res.data[0].shippingAddress);
|
this.editor.changeValue("province_Id", res.data[0].province_Id);
|
this.editor.changeValue("provinceName", res.data[0].provinceName);
|
this.editor.changeValue("city_Id", res.data[0].city_Id);
|
this.editor.changeValue("cityName", res.data[0].cityName);
|
this.editor.changeValue("region_Id", res.data[0].region_Id);
|
this.editor.changeValue("regionName", res.data[0].cityName);
|
this.editor.changeValue("tel", res.data[0].tel);
|
this.editor.changeValue("countryName", res.data[0].countryName);
|
this.editor.changeValue("client_Id", res.data[0].client_Id);
|
this.editor.changeValue("clientCode", res.data[0].clientCode);
|
} else {
|
this.editor.changeValue("mobile", null);
|
this.editor.changeValue("shippingName", null);
|
this.editor.changeValue("shippingAddress", null);
|
this.editor.changeValue("province_Id", null);
|
this.editor.changeValue("provinceName", null);
|
this.editor.changeValue("city_Id", null);
|
this.editor.changeValue("cityName", null);
|
this.editor.changeValue("region_Id", null);
|
this.editor.changeValue("regionName", null);
|
this.editor.changeValue("tel", null);
|
this.editor.changeValue("countryName", null);
|
this.editor.changeValue("client_Id", null);
|
this.editor.changeValue("clientCode", null);
|
}
|
};
|
this.common.ajax(url, params, callback, _ref);
|
}
|
},
|
// 根据省ID获得市
|
loadChildrenNode(id, dropdown_Id, prop) {
|
var editorRef = this.editor;
|
var where = { parentId: id };
|
var url = "/api/common/loadTreeNode";
|
var params = {
|
openNodeApi: true,
|
folder: "basicInfo/base",
|
dbServer: "Sys",
|
tableName: "Base_City",
|
tableView: "Base_City",
|
keyName: "city_Id",
|
nodeName: "cityName",
|
fixHasChild: false,
|
isBreakWay: false,
|
displayBreakWay: false,
|
parentName: "parentId",
|
orderBy: "orderNo desc, city_Id",
|
where: where,
|
extendColumns: ""
|
};
|
this.common.ajax(
|
url,
|
params,
|
res => {
|
if (res.result) {
|
var data = res.data.map(item => {
|
if (prop === "provinceName") {
|
const newItem = {
|
city_Id: item.value,
|
cityName: item.label,
|
value: item.value,
|
label: item.label
|
};
|
return newItem;
|
} else if (prop === "cityName") {
|
const newItem = {
|
region_Id: item.value,
|
regionName: item.label,
|
value: item.value,
|
label: item.label
|
};
|
return newItem;
|
}
|
});
|
editorRef.setDropdownData(dropdown_Id, data);
|
} else {
|
this.$message.error(res.msg);
|
}
|
},
|
true
|
);
|
},
|
// 列表页面按钮点击事件
|
buttonClick(authNode) {
|
switch (authNode) {
|
case "allImport":
|
// 出库计划单导入
|
// this.allImport();
|
// return false;
|
|
this.orderImportConfig.isShowDialog = true;
|
return true;
|
}
|
},
|
// 明细按钮点击事件
|
detailButtonClick(authNode) {
|
switch (authNode) {
|
case "detailAdd":
|
// 明细添加
|
this.openSelected();
|
return true;
|
case "detailAddPosition":
|
// 打开库存选择器
|
this.openPositionSelected();
|
return true;
|
}
|
},
|
// 打开物料选择器
|
openSelected() {
|
var editorRef = this.editor;
|
if (!editorRef.formData.consignorName) {
|
this.$message({
|
message: "请选择货主!",
|
type: "warning"
|
});
|
return;
|
}
|
const selector = this.$refs["selector-dialog"];
|
selector.setSearchValue("consignor_Id", [editorRef.formData.consignor_Id]);
|
selector.setReadOnly("consignor_Id", true); // 设为只读
|
selector.loadData();
|
this.selectorConfig.visible = true;
|
},
|
// 打开库存选择器
|
openPositionSelected() {
|
var editorRef = this.editor;
|
if (!editorRef.formData.consignorName) {
|
this.$message({
|
message: "请选择货主!",
|
type: "warning"
|
});
|
return;
|
}
|
|
const selector = this.$refs["selector-position-dialog"];
|
selector.setSearchValue("consignor_Id", [editorRef.formData.consignor_Id]);
|
selector.setReadOnly("consignor_Id", true); // 设为只读
|
selector.loadData();
|
this.selectorPositionConfig.visible = true;
|
},
|
// 将明细选择器选择中的数据填充到明细表中
|
onSelected(rows) {
|
rows.forEach(element => {
|
element.quantity = 1;
|
element.weight = element.weight ? element.weight : 0;
|
});
|
|
this.editor.addDetailDataRow(rows);
|
this.selectorConfig.visible = false;
|
this.setProduct();
|
},
|
// 将库存物料选择器选择中的数据填充到明细表中
|
onPositionSelected(rows) {
|
rows.forEach(element => {
|
element.batchNumber = element.batchNumber;
|
element.quantity = 1;
|
element.validQuantity = element.usingStorage;
|
element.weight = element.weight ? element.weight : 0;
|
});
|
this.editor.addDetailDataRow(rows);
|
this.selectorPositionConfig.visible = false;
|
this.setProduct();
|
},
|
// 数据加载后
|
onEditLoadAfter(formData) {
|
var statusText = formData.statusText;
|
if (statusText === "新建") {
|
// 新建
|
this.btnReadOnly.auditing = false;
|
this.btnReadOnly.stop = false;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.save = false;
|
this.$set(this.btnReadOnly, "toSaleOrder", true);
|
this.editorOptions.config.disabled = false; // 整个对话框可编辑
|
} else if (statusText === "审核成功") {
|
// 审核成功
|
this.btnReadOnly.auditing = false;
|
this.btnReadOnly.stop = false;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.save = true;
|
this.$set(this.btnReadOnly, "toSaleOrder", false);
|
this.editorOptions.config.disabled = true; // 整个对话框不可编辑
|
} else if (statusText === "已转出库单") {
|
// 已转出库单
|
this.btnReadOnly.auditing = true;
|
this.btnReadOnly.stop = true;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.save = true;
|
this.$set(this.btnReadOnly, "toSaleOrder", true);
|
this.editorOptions.config.disabled = true; // 整个对话框不可编辑
|
}
|
},
|
// 转到出库单
|
toSaleOrder(formData, details) {
|
this.$confirm("确实要转到出库单吗?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
if (formData.statusText !== "审核成功") {
|
this.$message.error("不是审核成功的单子不允许转移到出库单!");
|
return false;
|
}
|
const url = "/api/outbound/orderPlan/toSaleOrder";
|
const params = {
|
orderPlan_Id: formData.orderPlan_Id
|
};
|
const ref = this.dataList;
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.editor.config.visible = false;
|
ref.loadData();
|
}
|
};
|
this.common.ajax(url, params, callback, ref);
|
})
|
.catch(() => {
|
this.$message({
|
type: "info",
|
message: "已取消"
|
});
|
});
|
},
|
// 明细字段改变
|
onDetailChange(ref, val, row, field) {
|
this.setTotal(ref, val, row, field);
|
var formData = this.editor.formData;
|
var detailRows = formData["Sale_OrderPlanDetail"].rows;
|
// 大单位数量取整= 数量*大单位换算关系
|
detailRows.forEach(item => {
|
item.bigUnitnumber = (item.quantity || 0) * (item.unitConverts || 0);
|
item.bigUnitRounding = Math.floor((item.quantity || 0) * (item.unitConverts || 0));
|
});
|
},
|
// 合计计算
|
setTotal(ref, val, row, field) {
|
let totalQuantity = 0; // 合计数量
|
let totalMoney = 0; // 合计金额
|
let totalWeight = 0; // 合计重量
|
var formData = this.editor.formData;
|
var detailRows = formData["Sale_OrderPlanDetail"].rows;
|
detailRows.forEach(item => {
|
item.saleMoney = item.quantity * item.salePrice;
|
totalQuantity += item.quantity;
|
totalMoney += item.saleMoney;
|
// 行小计重量
|
if (field) {
|
// weight 单位毛重 / totalWeight 小计毛重 quantity 数量
|
if (field.prop === "quantity" || field.prop === "weight") {
|
// 小计 = 数量 * 单位毛重
|
item.totalWeight = Math.Round((item.quantity || 0) * (item.weight || 0), 2);
|
} else if (field && field.prop === "totalWeight") {
|
// 修改合计重量,计算出单位重量
|
if (item.quantity) {
|
item.weight = Math.Round((item.totalWeight || 0) / (item.quantity || 0), 2);
|
} else {
|
item.weight = 0;
|
}
|
}
|
}
|
// 合计重量
|
totalWeight += item.totalWeight;
|
});
|
this.editor.changeValue("totalQuantity", totalQuantity);
|
this.editor.changeValue("totalMoney", totalMoney);
|
this.editor.changeValue("totalWeight", Math.Round(totalWeight));
|
},
|
// 非编辑数据时计算明细
|
setProduct() {
|
let totalQuantity = 0; // 合计数量
|
let totalMoney = 0; // 合计金额
|
let totalWeight = 0; // 合计重量
|
var formData = this.editor.formData;
|
var detailRows = formData["Sale_OrderPlanDetail"].rows;
|
detailRows.forEach(item => {
|
// 明细
|
item.saleMoney = item.quantity * item.salePrice;
|
item.totalWeight = Math.Round((item.quantity || 0) * (item.weight || 0), 2);
|
item.weight = Math.Round((item.totalWeight || 0) / (item.quantity || 0), 2);
|
// 主表合计数据
|
totalQuantity += item.quantity;
|
totalMoney += item.saleMoney;
|
totalWeight += item.totalWeight;
|
});
|
this.editor.changeValue("totalQuantity", totalQuantity);
|
this.editor.changeValue("totalMoney", totalMoney);
|
this.editor.changeValue("totalWeight", Math.Round(totalWeight));
|
},
|
// 保存前事件
|
onSaveBefore(formData) {
|
var isQuantity = true;
|
// 集装箱号
|
const containerNos = [];
|
var datarows = formData["Sale_OrderPlanDetail"].rows;
|
if (!datarows.length) {
|
this.$message.error("明细不能为空!");
|
return false;
|
}
|
datarows.forEach(item => {
|
if (!item.storageName) {
|
isQuantity = false;
|
}
|
if (item.containerNo) {
|
if (!containerNos.find(row => row.containerNo === item.containerNo)) {
|
containerNos.push(item.containerNo);
|
}
|
}
|
});
|
if (!isQuantity) {
|
this.$message.error("明细列表仓库不能为空!");
|
return false;
|
}
|
const containerNo = Array.from(new Set(containerNos)).join(",");
|
this.editor.changeValue("containerNo", containerNo);
|
},
|
// 点击文件时的钩子
|
handlePreview(file) {},
|
handleRemove(file, fileList) {
|
this.fileUrl = null;
|
},
|
// 上传附件Url
|
upLoadUrl: function() {
|
var domain = this.common.domain;
|
return domain + "/api/common/uploadSingleFile";
|
},
|
// 上传成功后
|
handleSuccess(res, file) {
|
this.common.showMsg("上传成功!");
|
this.fileUrl = res.data.url;
|
},
|
// allImport() {
|
// this.dialogLandingTime = true;
|
// },
|
// 主表导入
|
submitImport() {
|
if (!this.fileUrl) {
|
this.$message.error("请上传文件!");
|
return;
|
}
|
this.msgList = [];
|
const url = "/api/outbound/orderPlan/importExcel";
|
const params = {
|
key: this.uploadKey,
|
url: this.fileUrl
|
// storageName: storageName
|
};
|
var callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
window.clearTimeout(this.intervalHandler);
|
this.intervalHandler = false;
|
this.getMsg();
|
this.fileList = [];
|
}
|
};
|
this.common.ajax(url, params, callback, this.$refs.loading);
|
},
|
// 获得导入消息
|
getMsg() {
|
// 获得同步消息
|
var url = "/api/common/getUploadMsg";
|
const params = {
|
key: this.uploadKey
|
};
|
var callBack = res => {
|
if (!res.result) {
|
window.clearInterval(this.intervalHandler);
|
this.intervalHandler = false;
|
if (Array.isArray(res.data)) {
|
this.msgList = this.msgList.concat(res.data);
|
}
|
return;
|
}
|
if (Array.isArray(res.data)) {
|
this.msgList = this.msgList.concat(res.data.filter(item => item !== "-1"));
|
}
|
if (res.data.indexOf("-1") >= 0) {
|
window.clearTimeout(this.intervalHandler);
|
this.intervalHandler = null;
|
this.dataList.reload();
|
return;
|
}
|
this.intervalHandler = window.setTimeout(this.getMsg, 1000);
|
};
|
this.common.ajax(url, params, callBack, this.$refs.loading);
|
},
|
// 新建设置默认值,编辑页面下拉框加载完毕后
|
onLoadDropdownAfter() {
|
// 设置工厂名称第一条,只有新建时设置默认第一条
|
const consignorDropdown = this.editor.getDropdownData(797);
|
if (consignorDropdown && consignorDropdown.length && !this.masterData.orderPlan_Id) {
|
const conInfo = consignorDropdown[0];
|
this.editor.changeValue("consignor_Id", conInfo.consignor_Id);
|
this.editor.changeValue("consignorCode", conInfo.consignorCode);
|
this.editor.changeValue("consignorName", conInfo.consignorName);
|
}
|
}
|
}
|
};
|
</script>
|