<template>
|
<div 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" :is-init-load="false">
|
</yrt-data-list>
|
<!--数据编辑器Editor-->
|
<yrt-editor :ref="editorRef" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :btn-read-only="btnReadOnly" :action.sync="editorOptions.action" :top.sync="editorOptions.top" :visible.sync="editorOptions.config.visible" :auth-nodes="authNodes" @on-blur="onBlur" @on-add-load-after="onAddLoadAfter" @on-edit-load-after="onEditLoadAfter">
|
<!--自定义按钮插槽-->
|
<template slot="footer-button-region" slot-scope="{ formData, details }">
|
<!--打印条码按钮-->
|
<el-button :disabled="btnReadOnly.returngoods" type="primary" icon="el-icon-yrt-tuihuo" @click.native="runReturngoods()">退货</el-button>
|
<el-button :disabled="btnReadOnly.cancelReturn" type="primary" icon="el-icon-yrt-tuihuochuli" @click.native="runCancelReturn()">取消退货</el-button>
|
</template>
|
</yrt-editor>
|
</div>
|
</template>
|
|
<script>
|
import baseLayout from "@/components/common/base-layout.vue";
|
|
export default {
|
name: "tms-way-bill-tracking",
|
components: {
|
baseLayout
|
},
|
mixins: [baseLayout],
|
data() {
|
return {
|
// 自动加载
|
jiazaiorder: ["plateCode"],
|
// 赋值
|
fuzhiorder: ["wayBillCode"]
|
};
|
},
|
methods: {
|
// 列表页面按钮点击事件
|
buttonClick(authNode) {
|
switch (authNode) {
|
case "returnGoods":
|
// 退货
|
this.runReturngoods();
|
return false;
|
case "cancelReturn":
|
// 取消退货
|
this.runCancelReturn();
|
return false;
|
}
|
},
|
|
// 退货操作
|
runReturngoods() {
|
var editorRef = this.editor;
|
var formData = editorRef.formData;
|
if (!formData.wayBillCode) {
|
this.$message.error("请输入运单号");
|
return;
|
}
|
var url = "/api/tms/wayBill/billReturnGoods";
|
const params = {
|
ids: [formData.wayBill_Id],
|
wayBillCode: formData.wayBillCode,
|
abnormalReason: formData.abnormalReason,
|
remark: formData.remark
|
};
|
this.common.ajax(url, params, res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.$set(this.btnReadOnly, "returngoods", true);
|
// 刷新窗口
|
this.dataList.reload();
|
// 关闭窗口
|
editorRef.cancel();
|
}
|
});
|
},
|
|
// 取消退货
|
runCancelReturn() {
|
var editorRef = this.editor;
|
var formData = editorRef.formData;
|
if (!formData.wayBillCode) {
|
this.$message.error("请输入运单号");
|
return;
|
}
|
// 获得已选中的ID
|
const url = "/api/tms/wayBill/billmultiCancelReturn";
|
const params = {
|
wayBillCode: formData.wayBillCode,
|
ids: [formData.wayBill_Id]
|
};
|
this.common.ajax(url, params, res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
// 刷新窗口
|
this.dataList.reload();
|
// 关闭窗口
|
editorRef.cancel();
|
}
|
});
|
},
|
onEditLoadAfter(formData) {
|
var toStatus = formData.toStatus;
|
if (
|
toStatus === "新建" ||
|
toStatus === "审核成功" ||
|
toStatus === "待录入" ||
|
toStatus === "已提交" ||
|
toStatus === "录入异常" ||
|
toStatus === "组板异常" ||
|
toStatus === "处理中" ||
|
toStatus === "处理完成"
|
) {
|
this.$set(this.btnReadOnly, "returngoods", false);
|
this.$set(this.btnReadOnly, "cancelReturn", true);
|
} else if (toStatus === "已退货") {
|
this.$set(this.btnReadOnly, "returngoods", true);
|
this.$set(this.btnReadOnly, "cancelReturn", false);
|
} else {
|
this.$set(this.btnReadOnly, "returngoods", false);
|
this.$set(this.btnReadOnly, "cancelReturn", true);
|
}
|
},
|
onAddLoadAfter(formData) {
|
this.$set(this.btnReadOnly, "returngoods", true);
|
this.$set(this.btnReadOnly, "cancelReturn", true);
|
},
|
// 失去焦点加载信息
|
onBlur(ref, val, row, field) {
|
if (field.label === "运单号") {
|
if (!val) {
|
return;
|
}
|
const wayBillCode = val;
|
const url = "/api/tms/wayBill/getPlateCode";
|
const params = {
|
wayBillCode: wayBillCode
|
};
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
if (res.data.plateCode) {
|
this.jiazaiorder.forEach(field => {
|
this.$set(this.editor.formData, field, res.data[field]);
|
});
|
}
|
if (res.data.consignor_Id) {
|
this.$set(this.editor.formData, "consignor_Id", res.data.consignor_Id);
|
this.$set(this.editor.formData, "consignorName", res.data.consignorName);
|
this.$set(this.editor.formData, "plateCode", res.data.plateCode);
|
this.$set(this.editor.formData, "fromStatus", res.data.orderStatus);
|
this.$set(this.editor.formData, "wayBill_Id", res.data.wayBill_Id);
|
this.$set(this.editor.formData, "orderType", res.data.orderType);
|
this.$set(this.editor.formData, "storage_Id", res.data.storage_Id);
|
this.$set(this.editor.formData, "storageName", res.data.storageName);
|
var fromdata = res.data.orderStatus;
|
if (
|
fromdata === "已揽收" ||
|
fromdata === "审核成功" ||
|
fromdata === "待录入" ||
|
fromdata === "已提交" ||
|
fromdata === "录入异常" ||
|
fromdata === "组板异常" ||
|
fromdata === "处理中" ||
|
fromdata === "处理完成"
|
) {
|
this.$set(this.btnReadOnly, "returngoods", false);
|
this.$set(this.btnReadOnly, "cancelReturn", true);
|
} else if (fromdata === "已退货") {
|
this.$set(this.btnReadOnly, "returngoods", true);
|
this.$set(this.btnReadOnly, "cancelReturn", false);
|
} else {
|
this.$set(this.btnReadOnly, "returngoods", true);
|
this.$set(this.btnReadOnly, "cancelReturn", true);
|
}
|
}
|
} else {
|
this.$set(this.editor.formData, "wayBillCode", "");
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
}
|
}
|
}
|
};
|
</script>
|