@{
|
Layout = "~/Views/Shared/_LayoutVue.cshtml";
|
ViewBag.Title = "Index";
|
}
|
|
@section head{
|
<style type="text/css">
|
.block {
|
text-align: right;
|
}
|
|
.el-form--inline .el-form-item__content {
|
width: 180px;
|
}
|
</style>
|
}
|
|
<div id="ImportXml">
|
<el-card class="box-card">
|
<el-form v-bind:model="formData" style="margin-top:5px;" label-width="75px" class="demo-ruleForm" v-bind:inline="true">
|
<el-form-item label="唯一码:">
|
<el-input v-model="formData.CN_S_CODE" required size="mini" style="width:190px"></el-input>
|
</el-form-item>
|
<el-form-item label="产品名称:">
|
<el-input size="mini" v-model="formData.CN_S_ITEM_NAME"></el-input>
|
</el-form-item>
|
<el-button style="margin-top:2px;margin-left:15px" size="mini" type="primary" v-on:click="search">查 询</el-button>
|
</el-form>
|
|
<el-upload ref="upload" action="UnscrambleXml"
|
v-bind:on-change="onUploadChange"
|
v-bind:on-preview="handlePreview"
|
v-bind:auto-upload="true"
|
v-bind:multiple="false"
|
v-bind:on-success="loadFileSuccess"
|
v-bind:on-remove="handleRemove"
|
v-bind:limit="1">
|
<el-button slot="trigger" size="min" type="primary" style="margin-left: 10px;margin-top:5px;padding: 8px 15px;">选取文件</el-button>
|
<el-button size="min" style="margin-left: 10px; margin-top:5px; padding: 8px 15px;" type="success" v-on:click="submitUpload">上传到服务器</el-button>
|
|
<div slot="tip" class="el-upload__tip">请上传xml/XML文件,选取文件后,单击文件名预览</div>
|
</el-upload>
|
</el-card>
|
<hh-table v-bind:coloptions="xmlCols"
|
v-bind:paging="true"
|
url="@Url.Action("GetXmlList")"
|
v-bind:check="false"
|
ref="xmllist"
|
dh="180">
|
</hh-table>
|
</div>
|
@section scripts{
|
<script>
|
new Vue({
|
el: "#ImportXml",
|
data: {
|
formData: {
|
CN_S_CODE: "",
|
CN_S_ITEM_NAME: ""
|
},
|
importShort: [],
|
importData: [],
|
defaults: {
|
fileType: ["xml", "XML"],
|
fileSize: 1024 * 1024 * 5
|
},
|
xmlCols: [
|
{ f: "CN_S_CODE", n: "唯一码", w: "190px" },
|
//{ f: "CN_S_CODE_TYPE", n: "编码类型" },
|
{ f: "CN_S_PARENT_CODE", n: "父级编码", w: "190px" },
|
{ f: "CN_S_PACKING_UNIT", n: "包装单位", w: "100px" },
|
{ f: "CN_S_PRODUCT_NAME", n: "产品名称", w: "160px" },
|
{ f: "CN_S_PZWH", n: "批准文号", w: "130px" },
|
{ f: "CN_S_BATCH_NO", n: "批次号", w: "130px" },
|
{ f: "CN_S_SPECIFICATION", n: "包装规格", w: "130px" },
|
{ f: "CN_S_TAG_RATIO", n: "贴码包装比例", w: "100px" },
|
{ f: "CN_S_MIN_PACK_UNIT", n: "最小包装单位", w: "100px" },
|
{ f: "CN_S_MIN_TAG_UNIT", n: "最小贴码单位", w: "100px" },
|
{ f: "CN_S_TAG_PACK_RATIO", n: "最小贴码与最小包装比例", w: "160px" },
|
{ f: "CN_S_OPERATOR", n: "入库操作员", w: "100px" },
|
{ f: "CN_T_OPR_DATE", n: "入库日期", w: "150px" },
|
{ f: "CN_F_QUANTITY", n: "入库数量", w: "90px" },
|
{ f: "CN_S_QUANTITY_UNIT", n: "数量单位", w: "90px" },
|
|
{ f: "CN_S_ITEM_CODE", n: "物料编码", w: "160px" },
|
{ f: "CN_S_ITEM_NAME", n: "物料名称", w: "160px" },
|
{ f: "CN_S_MODEL", n: "规格型号", w: "130px" },
|
{ f: "CN_S_MEASURE_UNIT", n: "计量单位", w: "100px" },
|
{ f: "CN_F_PACKING_QTY", n: "包装数量", w: "90px" },
|
|
{ f: "CN_T_PRODUCT_DATE", n: "生产日期", w: "150px" },
|
{ f: "CN_S_CREATOR", n: "创建人", w: "90px" },
|
{ f: "CN_T_CREATE", n: "创建日期", w: "180px" }
|
]
|
},
|
methods: {
|
search: function () {
|
var $this = this;
|
$this.$refs.xmllist.loadData($this.formData);
|
},
|
submitUpload: function () {
|
var $this = this;
|
if ($this.importData == "" || $this.importData == null || $this.importData == []) {
|
wms.warning("请选择文件后上传!");
|
return false;
|
}
|
wms.confirm("确定上传所选文件?", function () {
|
ajaxManage({
|
url: "@Url.Action("ImportXmlData")",
|
data: JSON.stringify($this.importData),
|
success: function (data) {
|
console.log(data);
|
if (data.Success) {
|
wms.success("Xml上传成功!");
|
} else {
|
wms.warning(data.Msg);
|
}
|
$this.$refs.upload.clearFiles();
|
$this.importShort = [];
|
$this.importData = [];
|
$this.$refs.xmllist.loadData($this.formData);
|
}
|
});
|
});
|
},
|
onUploadChange: function (file) {
|
var _this = this;
|
if ($.inArray(file.name.substring(file.name.lastIndexOf(".") + 1, file.name.length), _this.defaults.fileType) <= -1) {
|
wms.warning("只能上传xml格式的文件!");
|
this.$refs.upload.clearFiles();
|
return false;
|
}
|
|
if (file.size >= _this.defaults.fileSize) {
|
wms.warning("文件超出5M!");
|
return false;
|
}
|
},
|
loadFileSuccess: function (response, file, fileList) {
|
var $this = this;
|
var importData = response.Data.ImportData;
|
var importShort = response.Data.ImportShort;
|
$this.importShort = [];
|
$this.importData = [];
|
$this.importShort.push(importShort);
|
$this.importData.push(importData);
|
},
|
handlePreview: function (file) {
|
var $this = this;
|
console.log($this.importShort[0].batchNo);
|
var htmlStr = "<div style=\"padding-left:30px\"><font color=\"blue\">产品名称:</font>" + $this.importShort[0].productName + "</br>" + "<font color=\"blue\">批准文号:</font>" + $this.importShort[0].pzwh + "</br>"
|
+ "<font color=\"blue\">产品批次:</font>" + $this.importShort[0].batchNo + "</br>" + "<font color=\"blue\">包装规格:</font>" + $this.importShort[0].specification + "</br>"
|
+ "<font color=\"blue\">最小包装单位:</font>" + $this.importShort[0].minPackUnit + "</br>" + "<font color=\"blue\">最小贴码单位:</font>" + $this.importShort[0].minTagUnit + "</br>"
|
+ "<font color=\"blue\">最小贴码与最小包装比例:</font>" + $this.importShort[0].tagPackRatio + "</br>" + "<font color=\"blue\">生产日期:</font>" + $this.importShort[0].produceDate + "</br>"
|
+ "<font color=\"blue\">入库人员:</font>" + $this.importShort[0].operatorName + "</br>" + "<font color=\"blue\">入库日期:</font>" + $this.importShort[0].oprDate + "</br>"
|
+ "<font color=\"blue\">入库数量:</font>" + $this.importShort[0].count + "</br>" + "<font color=\"blue\">数量单位:</font>" + $this.importShort[0].countUnit + "</br>"
|
+ "<font color=\"blue\">贴码包装比例:</font>" + $this.importShort[0].tagRatio + "</div>";
|
|
wms.customConfirm({
|
title: '文件预览',
|
confirmText: '确定上传',
|
content: htmlStr,
|
callback: function (action) {
|
if (action == "confirm") {
|
$this.submitUpload();
|
}
|
}
|
});
|
},
|
handleRemove: function (file, fileList) {
|
var $this = this;
|
$this.importShort = [];
|
$this.importData = [];
|
}
|
},
|
mounted: function () {
|
|
}
|
})
|
</script>
|
}
|