@{
|
Layout = "~/Views/Shared/_LayoutVue.cshtml";
|
ViewBag.Title = "EditLogistics";
|
}
|
|
<div id="editLogistics" v-cloak>
|
<el-card class="box-card">
|
<el-form label-width="90px" v-bind:model="formData" class="demo-ruleForm" v-bind:inline="true">
|
<el-form-item label="物流公司:">
|
<hh-select-url v-model="formData.logisticsFlag"
|
url="/Basic/Common/GetLogisticsCompany"
|
valuefield="CN_S_LOGISTICS_FLAG"
|
textfield="CN_S_LOGISTICS_NAME"
|
datafield="Data"></hh-select-url>
|
</el-form-item>
|
<el-button v-if="false" size="mini" type="primary" v-on:click="createLogistics">一键生成物流单</el-button>
|
<el-button style="float:right" size="mini" type="primary" v-on:click="saveLogistics">保 存</el-button>
|
</el-form>
|
</el-card>
|
<el-table class="tb-edit" v-bind:data="logisticsData" style="width: 100%;" border
|
highlight-current-row
|
size="mini">
|
<el-table-column type="index" width="45" align="center" label="行号">
|
</el-table-column>
|
<el-table-column label="发货通知单" prop="CN_S_OP_NO"></el-table-column>
|
<el-table-column label="物流单号" prop="CN_S_WAYBILL_NO">
|
<template scope="scope">
|
<el-input v-model="scope.row.CN_S_WAYBILL_NO"
|
size="mini"></el-input>
|
<span>{{scope.row.CN_S_WAYBILL_NO}}</span>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
@section scripts{
|
<script>
|
new Vue({
|
data: {
|
formData: {
|
logisticsFlag: "",
|
},
|
logisticsData: [],
|
opNos: ""
|
},
|
watch: {
|
deep: true,
|
"formData.logisticsFlag": function (val) {
|
//alert(val);
|
}
|
},
|
methods: {
|
validate: function () {
|
var $this = this;
|
if (!$this.formData.logisticsFlag) {
|
wms.warning("请选择物流公司!");
|
return false;
|
}
|
var failedMsg = "";
|
$.each($this.logisticsData, function (i, n) {
|
if (!n.CN_S_WAYBILL_NO) {
|
failedMsg = "物流单号不可为空!";
|
return false;
|
}
|
});
|
if (failedMsg) {
|
wms.warning(failedMsg);
|
return false;
|
}
|
return true;
|
},
|
saveLogistics: function () {
|
var $this = this;
|
if (!this.validate()) return;
|
var updateLogistics = [];
|
$this.logisticsData.forEach(function (n) {
|
updateLogistics.push({
|
CN_S_LOGISTICS_FLAG: $this.formData.logisticsFlag,
|
CN_S_WAYBILL_NO: n.CN_S_WAYBILL_NO,
|
CN_S_OP_NO: n.CN_S_OP_NO
|
});
|
});
|
ajaxManage({
|
url: "@Url.Action("SaveWayBill")",
|
data: JSON.stringify(updateLogistics),
|
success: function (data) {
|
wms.showMsg(data);
|
wms.dialogFrame.cb();
|
}
|
});
|
},
|
loadLogistics: function () {
|
var $this = this;
|
ajaxManage({
|
url: "@Url.Action("GetOutMstRange")?opNos=" + $this.opNos,
|
success: function (data) {
|
wms.showMsg(data, function () {
|
$this.logisticsData = data.Data;
|
});
|
}
|
});
|
},
|
createLogistics: function () {
|
var $this = this;
|
var opNo = [];
|
$this.logisticsData.forEach(function (n) {
|
opNo.push(n.CN_S_OP_NO);
|
});
|
//
|
ajaxManage({
|
url: "@Url.Action("CreateLogistics")?outNos=" + opNo.join(','),
|
success: function (data) {
|
wms.showMsg(data, function () {
|
console.log(data.Data);
|
data.Data.forEach(function (n) {
|
if (n.Success) {
|
wms.$notify({
|
title: '生成成功',
|
message: 'hh',
|
type: 'success'
|
});
|
} else {
|
wms.$notify.error({
|
title: '生成失败',
|
message: n.Reason
|
});
|
}
|
});
|
});
|
}
|
});
|
}
|
},
|
mounted: function () {
|
this.opNos = GetUrlParam("opNos");
|
this.loadLogistics();
|
if (this.logisticsData[0].CN_S_LOGISTICS_FLAG)
|
this.formData.logisticsFlag = this.logisticsData[0].CN_S_LOGISTICS_FLAG;
|
},
|
el: '#editLogistics'
|
});
|
</script>
|
}
|