|
@@ -6,6 +6,12 @@
|
|
|
<ws-button type="primary" @click="print('',1)"
|
|
|
v-hasPermission="`acquisitionManagement.acquisitionWeight.print`">批量打印
|
|
|
</ws-button>
|
|
|
+ <el-upload style="margin-left: 8px;" class="upload-demo inline-block margin-right-10" action=""
|
|
|
+ :on-change="handleChange" :show-file-list="false"
|
|
|
+ accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
|
|
|
+ :auto-upload="false">
|
|
|
+ <el-button type="primary" class="show-excel">excel导入打印</el-button>
|
|
|
+ </el-upload>
|
|
|
</template>
|
|
|
<template slot="right">
|
|
|
<ws-select v-model="warehouseName" placeholder="" @change="warehouseNameChange" :value="searchType"
|
|
@@ -13,9 +19,10 @@
|
|
|
<ws-option v-for="item in warehouseList" :key="item.value" :label="item.value" :value="item.value"
|
|
|
style="color: #8890b1" />
|
|
|
</ws-select>
|
|
|
- <el-date-picker style="margin: 0 10px 0 0" value-format='yyyy-MM-dd' v-model="value2" @change='datechange' type="daterange" align="right" unlink-panels range-separator="至"
|
|
|
- start-placeholder="起始时间" end-placeholder="截止时间" >
|
|
|
- </el-date-picker>
|
|
|
+ <el-date-picker style="margin: 0 10px 0 0" value-format='yyyy-MM-dd' v-model="value2" @change='datechange'
|
|
|
+ type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="起始时间"
|
|
|
+ end-placeholder="截止时间">
|
|
|
+ </el-date-picker>
|
|
|
<div></div>
|
|
|
<ws-input v-model="searchKeyWord" placeholder="可按编号、客户名、车牌号查找" clearable maxlength="500" type="input">
|
|
|
</ws-input>
|
|
@@ -42,22 +49,27 @@
|
|
|
<template slot-scope="scope">
|
|
|
<div v-if='scope.row.qualityInspectionManagement.boxNo'>{{scope.row.qualityInspectionManagement.boxNo}}</div>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="boxNoOther" label="箱号-2">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="boxNoOther" label="箱号-2">
|
|
|
<template slot-scope="scope">
|
|
|
- <div v-if='scope.row.qualityInspectionManagement.boxNoOther'>{{scope.row.qualityInspectionManagement.boxNoOther}}</div>
|
|
|
+ <div v-if='scope.row.qualityInspectionManagement.boxNoOther'>
|
|
|
+ {{scope.row.qualityInspectionManagement.boxNoOther}}
|
|
|
+ </div>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="titleNo" label="封号-1">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="titleNo" label="封号-1">
|
|
|
<template slot-scope="scope">
|
|
|
- <div v-if='scope.row.qualityInspectionManagement.titleNo'>{{scope.row.qualityInspectionManagement.titleNo}}</div>
|
|
|
+ <div v-if='scope.row.qualityInspectionManagement.titleNo'>{{scope.row.qualityInspectionManagement.titleNo}}
|
|
|
+ </div>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="titleNoOther" label="封号-2">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="titleNoOther" label="封号-2">
|
|
|
<template slot-scope="scope">
|
|
|
- <div v-if='scope.row.qualityInspectionManagement.titleNoOther'>{{scope.row.qualityInspectionManagement.titleNoOther}}</div>
|
|
|
+ <div v-if='scope.row.qualityInspectionManagement.titleNoOther'>
|
|
|
+ {{scope.row.qualityInspectionManagement.titleNoOther}}
|
|
|
+ </div>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="goodsName" label="货名"></el-table-column>
|
|
|
<el-table-column prop="type" label="类型"></el-table-column>
|
|
|
<el-table-column prop="grossWeight" label="毛重(公斤)" width="120"></el-table-column>
|
|
@@ -172,10 +184,11 @@
|
|
|
modification: [],
|
|
|
jjSelectPrintList: [],
|
|
|
radio: 'A4',
|
|
|
- isShowPrintType: false,
|
|
|
- value2:[],
|
|
|
- startDate:"",
|
|
|
- endDate:""
|
|
|
+ value2: [],
|
|
|
+ startDate: "",
|
|
|
+ endDate: "",
|
|
|
+ excelPrintData: [],
|
|
|
+ isExcelPrint: false,
|
|
|
}
|
|
|
},
|
|
|
activated() {
|
|
@@ -201,6 +214,119 @@
|
|
|
// }
|
|
|
// }
|
|
|
},
|
|
|
+ handleChange(file, fileList) {
|
|
|
+ this.fileTemp = file.raw
|
|
|
+ let fileName = file.raw.name
|
|
|
+ let fileType = fileName.substring(fileName.lastIndexOf('.') + 1);
|
|
|
+ // 判断上传文件格式
|
|
|
+ if (this.fileTemp) {
|
|
|
+ if ((fileType == 'xlsx') || (fileType == 'xls')) {
|
|
|
+ this.importf(this.fileTemp)
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '附件格式错误,请删除后重新上传!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请上传附件!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ importf(obj) {
|
|
|
+ this.excelFreightspace = []
|
|
|
+ this.dialogVisible = true;
|
|
|
+ let _this = this;
|
|
|
+ let inputDOM = this.$refs.inputer; // 通过DOM取文件数据
|
|
|
+ this.file = event.currentTarget.files[0];
|
|
|
+ var rABS = false; //是否将文件读取为二进制字符串
|
|
|
+ var f = this.file;
|
|
|
+ var reader = new FileReader();
|
|
|
+ //if (!FileReader.prototype.readAsBinaryString) {
|
|
|
+ FileReader.prototype.readAsBinaryString = function(f) {
|
|
|
+ var binary = "";
|
|
|
+ var rABS = false; //是否将文件读取为二进制字符串
|
|
|
+ var pt = this;
|
|
|
+ var wb; //读取完成的数据
|
|
|
+ var outdata;
|
|
|
+ var reader = new FileReader();
|
|
|
+ reader.onload = function(e) {
|
|
|
+ var bytes = new Uint8Array(reader.result);
|
|
|
+ var length = bytes.byteLength;
|
|
|
+ for (var i = 0; i < length; i++) {
|
|
|
+ binary += String.fromCharCode(bytes[i]);
|
|
|
+ }
|
|
|
+ var XLSX = require('xlsx');
|
|
|
+ if (rABS) {
|
|
|
+ wb = XLSX.read(btoa(fixdata(binary)), {
|
|
|
+ type: 'base64',
|
|
|
+ cellDates: true
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ wb = XLSX.read(binary, {
|
|
|
+ type: 'binary'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // excel导入的数据
|
|
|
+ outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
|
|
|
+ let arr = []
|
|
|
+ let _index = 0
|
|
|
+ outdata.map(v => {
|
|
|
+ _index++
|
|
|
+ let jsonString = JSON.stringify(v).replace(/\//g, '').replace(/\s/ig, '');
|
|
|
+ console.log(jsonString);
|
|
|
+ v = JSON.parse(jsonString);
|
|
|
+ let obj = {
|
|
|
+ qualityInspectionManagement: {}
|
|
|
+ }
|
|
|
+ obj.compName = v.公司名
|
|
|
+ obj.number = v.编号
|
|
|
+ obj.customer = v.客户姓名
|
|
|
+ obj.customerPhone = v.客户电话
|
|
|
+ obj.carNumber = v.车牌号
|
|
|
+ obj.compName = v.收货单位
|
|
|
+ obj.person = v.联系人
|
|
|
+ obj.personPhone = v.联系电话
|
|
|
+ obj.goodsName = v.货名
|
|
|
+ obj.type = v.类型
|
|
|
+ obj.qualityInspectionManagement.bulkDensity = v.容重
|
|
|
+ obj.qualityInspectionManagement.imperfectGrain = v.不完善粒
|
|
|
+ obj.qualityInspectionManagement.grade = v.等级
|
|
|
+ obj.qualityInspectionManagement.waterContent = v.水分
|
|
|
+ obj.qualityInspectionManagement.jiaorenli = v.热损伤
|
|
|
+ obj.qualityInspectionManagement.qualityDate = v.质检时间
|
|
|
+ obj.qualityInspectionManagement.impurity = v.杂质
|
|
|
+ obj.qualityInspectionManagement.mildewGrain = v.霉变粒
|
|
|
+ obj.qualityInspectionManagement.buckleMiscellaneous = v.扣杂
|
|
|
+ obj.grossWeight = v.毛重
|
|
|
+ obj.tare = v.皮重
|
|
|
+ obj.buckleMiscellaneous = v.扣重
|
|
|
+ obj.netWeight = v.净重
|
|
|
+ obj.grossDate = v.毛重检斤时间
|
|
|
+ obj.tareDate = v.皮重检斤时间
|
|
|
+ obj.secretaryWeigher = v.毛检
|
|
|
+ obj.skinInspector = v.皮检
|
|
|
+
|
|
|
+ console.log(obj)
|
|
|
+ _this.excelPrintData.push(obj)
|
|
|
+ if (_index == outdata.length) {
|
|
|
+ _this.isShowPrintType = true
|
|
|
+ _this.isExcelPrint = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ reader.readAsArrayBuffer(f);
|
|
|
+ }
|
|
|
+ if (rABS) {
|
|
|
+ reader.readAsArrayBuffer(f);
|
|
|
+ } else {
|
|
|
+ reader.readAsBinaryString(f);
|
|
|
+ }
|
|
|
+ console.log(reader)
|
|
|
+ },
|
|
|
handleRowClick(row) {},
|
|
|
handleSelectionChange(val) {
|
|
|
this.modification = val
|
|
@@ -212,35 +338,46 @@
|
|
|
if (type == 1) {
|
|
|
localStorage.setItem('selectPrint_jjSelectPrintList', JSON.stringify(this.jjSelectPrintList))
|
|
|
window.open('../../../../static/weightCheck.html?type=2&radioType=' + radioType)
|
|
|
+ } else if (type == 2) {
|
|
|
+ localStorage.setItem('selectPrint_jjSelectPrintList', JSON.stringify(this.excelPrintData))
|
|
|
+ window.open('../../../../static/weightCheck.html?type=2&radioType=' + radioType)
|
|
|
} else {
|
|
|
|
|
|
window.open('../../../../static/weightCheck.html?type=2&tableData=' + JSON.stringify(this.dialogData))
|
|
|
}
|
|
|
},
|
|
|
- typePrintClick() {
|
|
|
- this.jjSelectPrintList = []
|
|
|
- let index1 = 0;
|
|
|
- for (let i = 0; i < this.modification.length; i++) {
|
|
|
- getPrint({
|
|
|
- id: this.modification[i].id
|
|
|
- })
|
|
|
- .toPromise()
|
|
|
- .then((response) => {
|
|
|
- index1++;
|
|
|
- this.jjSelectPrintList.push(response)
|
|
|
- if (index1 == this.modification.length) {
|
|
|
- this.printBig(1, this.radio)
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((response) => {})
|
|
|
+ typePrintClick(type) {
|
|
|
+ if (this.isExcelPrint) {
|
|
|
+ this.printBig(2, this.radio)
|
|
|
+ this.isExcelPrint = false
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.jjSelectPrintList = []
|
|
|
+ let index1 = 0;
|
|
|
+ for (let i = 0; i < this.modification.length; i++) {
|
|
|
+ getPrint({
|
|
|
+ id: this.modification[i].id
|
|
|
+ })
|
|
|
+ .toPromise()
|
|
|
+ .then((response) => {
|
|
|
+ index1++;
|
|
|
+ this.jjSelectPrintList.push(response)
|
|
|
+ if (index1 == this.modification.length) {
|
|
|
+ this.printBig(1, this.radio)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((response) => {})
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
typePrintCannelClick() {
|
|
|
this.isShowPrintType = false
|
|
|
},
|
|
|
print(row, type, pageType) {
|
|
|
if (type == 1) {
|
|
|
- this.isShowPrintType = true
|
|
|
+ this.isShowPrintType = true
|
|
|
} else {
|
|
|
getPrint({
|
|
|
id: row.id
|
|
@@ -307,7 +444,7 @@
|
|
|
find() {
|
|
|
this.getList()
|
|
|
},
|
|
|
- datechange(){
|
|
|
+ datechange() {
|
|
|
this.startDate = this.value2[0]
|
|
|
this.endDate = this.value2[1]
|
|
|
this.getList()
|
|
@@ -387,8 +524,8 @@
|
|
|
pageSize: this.pageSize,
|
|
|
searchKeyWord: this.searchKeyWord,
|
|
|
warehouseName: this.warehouseName,
|
|
|
- startDate:this.startDate,
|
|
|
- endDate:this.endDate,
|
|
|
+ startDate: this.startDate,
|
|
|
+ endDate: this.endDate,
|
|
|
managementType: 1
|
|
|
})
|
|
|
.toPromise()
|
|
@@ -564,21 +701,28 @@
|
|
|
border-radius: 10px;
|
|
|
z-index: 999;
|
|
|
}
|
|
|
-/deep/.el-radio-group{
|
|
|
- width: 100%;
|
|
|
- display: flex;
|
|
|
-}
|
|
|
-/deep/.el-radio__label{
|
|
|
- font-size: 20px;
|
|
|
-}
|
|
|
-/deep/.el-radio__inner{
|
|
|
- // background: red;
|
|
|
- height: 20px;
|
|
|
- width: 20px;
|
|
|
-}
|
|
|
+
|
|
|
+ /deep/.el-radio-group {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/.el-radio__label {
|
|
|
+ font-size: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/.el-radio__inner {
|
|
|
+ // background: red;
|
|
|
+ height: 20px;
|
|
|
+ width: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
.label-width {
|
|
|
width: 100%;
|
|
|
text-align: center;
|
|
|
font-size: 20px;
|
|
|
}
|
|
|
+ .show-excel{
|
|
|
+ opacity:0;
|
|
|
+ }
|
|
|
</style>
|