发货管理

This commit is contained in:
caoxinyu
2018-12-20 18:43:29 +08:00
parent 223062042a
commit d113487c3a
7 changed files with 356 additions and 70 deletions

View File

@@ -0,0 +1,19 @@
// 导出Excel方法表格id不加扩展名的文件名sheet名
export function exportExcelMethod(tableId, fileName, sheetName) {
tableToExcel(tableId, fileName, sheetName)
}
const tableToExcel = (function() {
const uri = 'data:application/vnd.ms-excel;base64,'
// 设置导出表格的单元格默认高度/宽度/边框样式/字体颜色/背景颜色/居中网页显示表格宽度建议1240tr/td视情况而定
const template = `<html xmlns:x="urn:schemas-microsoft-com:office:excel"><head><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><meta charset="UTF-8"><style type="text/css">table td {border: 1px solid #000000;width:100px;text-align: center;color: #000000;} th {border: 1px solid #000000;width:100px;text-align: center;color: #000000;}</style></head><body><table>{table}</table></body></html>`
const base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
const format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p] }) }
return function(table, filename, sheetname) {
if (!table.nodeType) table = document.getElementById(table)
const ctx = { worksheet: sheetname || 'Worksheet', table: table.innerHTML }
const aTag = document.createElement('a')
aTag.href = uri + base64(format(template, ctx))
aTag.download = filename
aTag.click()
}
})()

View File

@@ -1,7 +1,7 @@
<template>
<div>
<el-card>
<el-select v-model="projectNameValue" clearable filterable placeholder="请选择项目名称" size="small" style="margin-left: 10px;width: 200px" @change="searchPackingList();searchPackingListDetails();searchInvoice()">
<el-select v-model="projectNameValue" clearable filterable placeholder="请选择项目名称" size="small" style="margin-left: 10px;width: 200px" @change="searchPackingList();searchPackingListDetails();searchInvoice()" @clear="clearProject()">
<el-option
v-for="item in projectName"
:key="item.value"
@@ -28,6 +28,7 @@
highlight-current-row
style="width: 100%"
height="315"
size="mini"
@row-click="searchCargoBox"
>
<el-table-column align="center" label="发货单号" width="150">
@@ -65,9 +66,14 @@
{{ scope.row.运输状态 }}
</template>
</el-table-column>
<el-table-column align="center" label="运费" width="80">
<template slot-scope="scope">
{{ scope.row.运费 }}
</template>
</el-table-column>
<el-table-column align="center" label="签收人" width="80">
<template slot-scope="scope">
{{ scope.row.签收人 }}
{{ scope.row.签收人 === '' || scope.row.签收人 === null ? '未签收' : scope.row.签收人 }}
</template>
</el-table-column>
<el-table-column align="center" label="追溯码" width="150">
@@ -81,7 +87,7 @@
size="mini"
type="warning"
icon="el-icon-edit"
@click.stop="editWithdrawing(scope.row);flag1 = 4">导出</el-button>
@click.stop="exportTable()">导出</el-button>
<el-button
size="mini"
type="primary"
@@ -104,6 +110,7 @@
:file-list="fileList"
:before-upload="beforeUpload"
:on-success="onSuccess"
:limit="5"
:action="'http://localhost:8411/submit/upload2.ashx?InvoiceNum='+ invoiceNum"
list-type="picture-card">
<i class="el-icon-plus"/>
@@ -128,7 +135,8 @@
highlight-current-row
border
style="width: 100%"
height="500"
height="300"
size="mini"
@expand-change="selectMachine"
>
<el-table-column type="expand">
@@ -139,13 +147,14 @@
style="width: 600px; text-align: center"
height="300"
highlight-current-row
size="mini"
@row-click="choiceParts"
>
<el-table-column
align="center"
label="序号"
type="index"
width="100"/>
width="50"/>
<el-table-column label="代号" align="center">
<template slot-scope="scope">
{{ scope.row.代号 }}
@@ -209,7 +218,8 @@
highlight-current-row
border
style="width: 100%"
height="500"
height="300"
size="mini"
@row-click="choiceSpare"
>
<el-table-column align="center" label="序号" type="index" width="50"/>
@@ -252,7 +262,8 @@
highlight-current-row
border
style="width: 100%"
height="500"
height="300"
size="mini"
@row-click="choiceFile"
>
<el-table-column align="center" label="序号" type="index" width="50"/>
@@ -282,7 +293,7 @@
</div></el-col>
<el-col :span="2">
<div class="grid-content bg-purple">
<div style="height:554px">
<div style="height:300px">
<div>
<el-button :disabled="disabledmoveInto" round type="primary" size="small" style="margin-top: 200px;margin-left: 45px" @click="moveInto()"></el-button>
</div>
@@ -319,7 +330,7 @@
:data="tableData6"
border
style="width: 100%;margin-top: 3px"
height="500"
height="300"
highlight-current-row
@row-click="choiceGoods"
>
@@ -405,6 +416,13 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="运费" prop="运费" label-width="110px">
<el-input-number v-model="form1.运费" :precision="2" :step="0.1" style="width: 200px" size="small"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOffInvoice('form1')">取消</el-button>
@@ -513,6 +531,69 @@
<el-button type="primary" @click="submitRremove('form3')"> </el-button>
</div>
</el-dialog>
<el-card>
<div style="width: 100%">
<table id="table" class="tg" style="table-layout: fixed; width: 1228px;margin: auto;left: 50%;right: 50%">
<colgroup>
<col style="width: 100px">
<col style="width: 100px">
<col style="width: 100px">
<col style="width: 100px">
<col style="width: 100px">
<col style="width: 100px">
<col style="width: 100px">
<col style="width: 100px">
<col style="width: 100px">
</colgroup>
<tr>
<th class="tg-v15n" colspan="8" style="font-size: 38px">江苏高精机电装备有限公司</th>
<th class="tg-c3ow" rowspan="2" style="text-align: center; line-height: 114px">二维码</th>
</tr>
<tr>
<td class="tg-uys7" colspan="8" style="text-align: center;font-size: 26px">{{ 装箱单名称 }}发货单</td>
</tr>
<tr>
<td class="tg-c3ow">发货单号</td>
<td class="tg-c3ow" colspan="2">{{ 发货单号 }}</td>
<td class="tg-c3ow">收货人</td>
<td class="tg-c3ow" colspan="2">{{ 收货人 }}</td>
<td class="tg-c3ow">联系电话</td>
<td class="tg-c3ow" colspan="2">{{ 联系电话 }}</td>
</tr>
<tr>
<td class="tg-c3ow">收货地址</td>
<td class="tg-c3ow" colspan="2">{{ 收货地址 }}</td>
<td class="tg-c3ow">委托车辆</td>
<td class="tg-c3ow" colspan="2">{{ 委托车辆 }}</td>
<td class="tg-c3ow">发货日期</td>
<td class="tg-c3ow" colspan="2">{{ 发货日期 }}</td>
</tr>
<tr>
<td class="tg-c3ow">序号</td>
<td class="tg-c3ow">代号</td>
<td class="tg-c3ow" colspan="2">名称</td>
<td class="tg-c3ow">规格</td>
<td class="tg-c3ow">数量</td>
<td class="tg-c3ow" colspan="2">备注</td>
<td class="tg-c3ow">确认</td>
</tr>
<tr v-for="(list, index) in table" :key="index">
<td class="tg-c3ow">{{ index + 1 }}</td>
<td class="tg-c3ow">{{ list.代号 }}</td>
<td class="tg-c3ow" colspan="2">{{ list.名称 }}</td>
<td class="tg-c3ow">{{ list.规格 }}</td>
<td class="tg-c3ow">{{ list.数量 }}</td>
<td class="tg-c3ow" colspan="2">{{ list.备注 }}</td>
<td class="tg-c3ow"/>
</tr>
<tr>
<td class="tg-c3ow" colspan="7">本清单一式两份一份请收货人清点货物一份请签收人签收后交还司机带回本公司请签收人在货物卸车后立即清点</td>
<td class="tg-c3ow">签收人签字</td>
<td class="tg-c3ow"/>
</tr>
</table>
</div>
</el-card>
</div>
</template>
@@ -520,7 +601,8 @@
import request from '@/utils/request'
// import { sleep } from '@/utils/tool'
import elInput from 'element-ui/packages/input'
import { submitRremove, searchCargoBoxDetailed, submitMoveInto, delCargoBox, addCargoBox, searchCargoBox, editInvoice, delInvoice, addInvoice, editAdress, addAdress, deleteAdress, citySearch, provinceSearch, addressSearch, searchParts, searchHost, searchSparePart, searchProjectName, searchPackingList, searchFile, searchInvoice } from '@/api//MarketingCenter/DeliveryManagement'
import { exportExcelMethod } from './exportExcel'
import { selectDelivery, submitRremove, searchCargoBoxDetailed, submitMoveInto, delCargoBox, addCargoBox, searchCargoBox, editInvoice, delInvoice, addInvoice, editAdress, addAdress, deleteAdress, citySearch, provinceSearch, addressSearch, searchParts, searchHost, searchSparePart, searchProjectName, searchPackingList, searchFile, searchInvoice } from '@/api//MarketingCenter/DeliveryManagement'
import QRCode from 'qrcode'
export default {
components: {
@@ -528,10 +610,18 @@ export default {
},
data() {
return {
table: [],
canvas: [],
show: false,
num: '',
fileList: [],
发货单号: '',
收货人: '',
收货地址: '',
联系电话: '',
委托车辆: '',
发货日期: '',
装箱单名称: '',
a: 1, // 嵌套表格交换变量
b: 1, // 嵌套表格交换变量
flag1: '', // 发货单旗帜变量
@@ -612,7 +702,8 @@ export default {
发货日期: '',
运输状态: 0,
联系人: '',
联系方式: ''
联系方式: '',
运费: ''
},
form2: {
名称: '',
@@ -628,7 +719,8 @@ export default {
联系人: [{ required: true, message: '请选择联系人', trigger: 'blur' }],
联系方式: [{ required: true, message: '请选择联系方式', trigger: 'blur' }],
发货日期: [{ required: true, message: '请选择发货日期', trigger: 'change' }],
运输状态: [{ required: true, message: '请选择运输状态' }]
运输状态: [{ required: true, message: '请选择运输状态' }],
运费: [{ required: true, message: '请输入运费' }]
},
rules2: {}
}
@@ -705,6 +797,8 @@ export default {
},
// 发货单查询
searchInvoice() {
this.cargoBoxValue = ''
this.tableData6 = []
this.tableData5Loading = true
searchInvoice(this.projectNameValue).then(response => {
const data = response.data
@@ -724,7 +818,7 @@ export default {
return data
}).then(res => {
for (let i = 0; i < res.length; i++) {
QRCode.toCanvas(document.getElementById(this.canvas[i]), 'http://192.168.1.132:8080/#/DeliveryManagement/index?id=' + res[i].发货单编号.toString(), function(error) {
QRCode.toCanvas(document.getElementById(this.canvas[i]), 'http://192.168.0.110:8080/#/DeliveryManagement/index?id=' + res[i].发货单编号.toString(), function(error) {
if (error) console.error(error)
console.log('success!')
})
@@ -747,7 +841,7 @@ export default {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.flag1 === 1) {
addInvoice(this.projectNameValue, this.form1.车辆牌号, this.form1.运输状态, this.adressNum, this.form1.发货日期).then(response => {
addInvoice(this.projectNameValue, this.form1.车辆牌号, this.form1.运输状态, this.adressNum, this.form1.发货日期, this.form1.运费).then(response => {
this.dialogFormVisible1 = false
if (response.data[0].result === '1') {
this.$message.success('添加成功')
@@ -758,7 +852,7 @@ export default {
}
})
} else {
editInvoice(this.form1.车辆牌号, this.form1.运输状态, this.adressNum, this.form1.发货日期, this.invoiceNum).then(response => {
editInvoice(this.form1.车辆牌号, this.form1.运输状态, this.adressNum, this.form1.发货日期, this.invoiceNum, this.form1.运费).then(response => {
this.dialogFormVisible1 = false
if (response.data[0].result === '1') {
this.$message.success('信息更新成功')
@@ -784,6 +878,8 @@ export default {
this.form1.联系方式 = row.联系方式
this.adressNum = row.收货地址流水号
this.invoiceNum = row.发货单编号
this.title1 = '编辑'
this.form1.运费 = row.运费
},
// 删除发货单
delInvoice(row) {
@@ -899,6 +995,18 @@ export default {
this.invoiceNum = row.发货单编号
this.getFileList()
this.getSelect(searchCargoBox, ['货箱号', '货箱号编号'], 'cargoBox', this.invoiceNum)
selectDelivery(this.invoiceNum).then(response => {
this.table = response.data
this.装箱单名称 = response.data[0].装箱单名称
this.发货单号 = response.data[0].发货单号
this.收货人 = response.data[0].联系人
this.收货地址 = response.data[0].省份 + response.data[0].市名 + response.data[0].详细地址
this.委托车辆 = response.data[0].车辆牌号
this.联系电话 = response.data[0].联系方式
if (response.data[0].发货日期 !== '' || response.data[0].发货日期 !== null) {
this.发货日期 = response.data[0].发货日期.substring(0, response.data[0].发货日期.length - 8)
}
})
},
addCargoBox() {
this.$confirm('此操作将新增货箱, 是否继续?', '提示', {
@@ -907,12 +1015,16 @@ export default {
type: 'warning'
}).then(() => {
addCargoBox(this.invoiceNum).then(response => {
console.log(response)
if (response.data[0].result === '1') {
this.$message.sucess('增加成功')
this.getSelect(searchCargoBox, ['货箱号', '货箱号编号'], 'cargoBox', this.invoiceNum)
this.$message.success('增加成功')
this.cargoBox = []
this.cargoBoxValue = ''
} else {
this.$message.error('增加失败')
}
}).then(() => {
this.getSelect(searchCargoBox, ['货箱号', '货箱号编号'], 'cargoBox', this.invoiceNum)
})
})
},
@@ -924,11 +1036,14 @@ export default {
}).then(() => {
delCargoBox(this.cargoBoxValue).then(response => {
if (response.data[0].result === '1') {
this.$message.sucess('删除成功')
this.getSelect(searchCargoBox, ['货箱号', '货箱号编号'], 'cargoBox', this.invoiceNum)
this.$message.success('删除成功')
this.cargoBox = []
this.cargoBoxValue = ''
} else {
this.$message.error('数据占用')
}
}).then(() => {
this.getSelect(searchCargoBox, ['货箱号', '货箱号编号'], 'cargoBox', this.invoiceNum)
})
})
},
@@ -1068,7 +1183,7 @@ export default {
// 生成的二维码内容,可以添加变量
this.QueryDetail = this.cargoBoxValue.toString()
var canvas = document.getElementById('canvas')
QRCode.toCanvas(canvas, 'http://192.168.1.132:8080/#/searchBoxDetails/index?id=' + this.QueryDetail, function(error) {
QRCode.toCanvas(canvas, 'http://192.168.0.110:8080/#/searchBoxDetails/index?id=' + this.QueryDetail, function(error) {
if (error) console.error(error)
console.log('success!')
})
@@ -1138,6 +1253,14 @@ export default {
} else {
this.$message.error('上传失败')
}
},
exportTable() {
exportExcelMethod('table', '发货单', 'sheet1')
},
clearProject() {
this.cargoBox = []
this.cargoBoxValue = ''
this.tableData6 = []
}
}
}
@@ -1152,4 +1275,10 @@ export default {
width: 120px !important;
height: auto!important;
}
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
.tg .tg-v15n{font-weight:bold;font-size:24px;border-color:inherit;text-align:center}
.tg .tg-c3ow{border-color:inherit;text-align:center;vertical-align:top}
.tg .tg-kluc{font-size:24px;border-color:inherit;text-align:center}
</style>