|
@@ -2,8 +2,23 @@
|
|
|
<div class="app-container">
|
|
|
<!-- 查询和其他操作 -->
|
|
|
<div class="filter-container">
|
|
|
+ <el-input
|
|
|
+ v-model="listQuery.type.containerNo"
|
|
|
+ clearable
|
|
|
+ class="filter-item"
|
|
|
+ size="small"
|
|
|
+ style="width: 200px;"
|
|
|
+ placeholder="请输入集装箱柜号"
|
|
|
+ />
|
|
|
+ <el-input
|
|
|
+ v-model="listQuery.type.customerNo"
|
|
|
+ clearable
|
|
|
+ class="filter-item"
|
|
|
+ size="small"
|
|
|
+ style="width: 200px;"
|
|
|
+ placeholder="请输入客户编号"
|
|
|
+ />
|
|
|
<el-button
|
|
|
- v-permission="['maritimeAdministration:maritimeadministration:list']"
|
|
|
class="filter-item"
|
|
|
type="primary"
|
|
|
size="mini"
|
|
@@ -11,33 +26,60 @@
|
|
|
@click="handleFilter"
|
|
|
>查找</el-button>
|
|
|
<el-button
|
|
|
- v-permission="['maritimeAdministration:maritimeadministration:create']"
|
|
|
class="filter-item"
|
|
|
type="primary"
|
|
|
size="mini"
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleCreate"
|
|
|
>添加</el-button>
|
|
|
+ <el-button
|
|
|
+ class="filter-item"
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="exportlist">导出</el-button>
|
|
|
+
|
|
|
+ <el-upload
|
|
|
+ :on-change="importClick"
|
|
|
+ :show-file-list="false"
|
|
|
+ :auto-upload="false"
|
|
|
+ style="margin-left: 8px;margin-bottom:0"
|
|
|
+ class="filter-item"
|
|
|
+ action=""
|
|
|
+ accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel">
|
|
|
+ <el-button
|
|
|
+ class="filter-item"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-edit">导入</el-button>
|
|
|
+ </el-upload>
|
|
|
</div>
|
|
|
|
|
|
<!-- 查询结果 -->
|
|
|
<el-table
|
|
|
v-loading="listLoading"
|
|
|
:data="list"
|
|
|
+ :span-method="objectSpanMethod"
|
|
|
size="small"
|
|
|
element-loading-text="正在查询中。。。"
|
|
|
border
|
|
|
fit
|
|
|
highlight-current-row
|
|
|
- >
|
|
|
+ @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column :selectable="selectInit" type="selection"/>
|
|
|
+ <el-table-column align="center" label="快递公司" prop="courierServicesCompany" />
|
|
|
<el-table-column align="center" label="集装箱柜号" prop="containerNo" />
|
|
|
<el-table-column align="center" label="客户编号" prop="customerNo" />
|
|
|
+ <el-table-column align="center" label="已收到单号" prop="receivedNo" />
|
|
|
+ <el-table-column align="center" label="内件明细" prop="internalDetails" />
|
|
|
+ <el-table-column align="center" label="实重" prop="weight" />
|
|
|
+ <el-table-column align="center" label="长" prop="long1" />
|
|
|
+ <el-table-column align="center" label="宽" prop="wide" />
|
|
|
+ <el-table-column align="center" label="高" prop="height" />
|
|
|
+ <el-table-column align="center" label="体积重" prop="bulkWeight" />
|
|
|
<el-table-column align="center" label="包裹数" prop="count" />
|
|
|
<el-table-column align="center" label="人民币" prop="rmb" />
|
|
|
- <el-table-column align="center" label="欧元 */" prop="euro" />
|
|
|
- <el-table-column align="center" label="备注" prop="remark" />
|
|
|
-
|
|
|
- <el-table-column align="center" label="操作" class-name="small-padding fixed-width">
|
|
|
+ <el-table-column align="center" label="欧元" prop="euro" />
|
|
|
+ <el-table-column align="center" label="操作" class-name="small-padding" width="200px">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
v-permission="['maritimeAdministration:maritimeadministration:edit']"
|
|
@@ -55,13 +97,14 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
- <pagination
|
|
|
- v-show="total>0"
|
|
|
+ <el-pagination
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-sizes="[100, 200, 300, 400,1000,1500,2000]"
|
|
|
+ :page-size="100"
|
|
|
:total="total"
|
|
|
- :page.sync="listQuery.page"
|
|
|
- :limit.sync="listQuery.limit"
|
|
|
- @pagination="getList"
|
|
|
- />
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"/>
|
|
|
|
|
|
<!-- 添加或修改对话框 -->
|
|
|
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
|
@@ -70,30 +113,50 @@
|
|
|
:rules="rules"
|
|
|
:model="dataForm"
|
|
|
status-icon
|
|
|
- label-position="left"
|
|
|
+ label-position="right"
|
|
|
label-width="100px"
|
|
|
- style="width: 400px; margin-left:50px;"
|
|
|
>
|
|
|
<el-form-item label="id" prop="id" hidden>
|
|
|
<el-input v-model="dataForm.id" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="集装箱柜号" prop="deductionEuro">
|
|
|
- <el-input v-model="dataForm.deductionEuro" />
|
|
|
+ <el-form-item label="集装箱柜号" prop="containerNo" class="item-style">
|
|
|
+ <el-input v-model="dataForm.containerNo" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="客户编号" prop="customerNo" class="item-style">
|
|
|
+ <el-input v-model="dataForm.customerNo" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="快递公司" prop="courierServicesCompany" class="item-style">
|
|
|
+ <el-input v-model="dataForm.courierServicesCompany" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="客户编号" prop="deductionEuro">
|
|
|
- <el-input v-model="dataForm.deductionEuro" />
|
|
|
+ <el-form-item label="已收到单号" prop="receivedNo" class="item-style">
|
|
|
+ <el-input v-model="dataForm.receivedNo" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="包裹数" prop="deductionEuro">
|
|
|
- <el-input v-model="dataForm.deductionEuro" />
|
|
|
+ <el-form-item label="内件明细" prop="internalDetails" class="item-style">
|
|
|
+ <el-input v-model="dataForm.internalDetails" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="人民币" prop="deductionEuro">
|
|
|
- <el-input v-model="dataForm.deductionEuro" />
|
|
|
+ <el-form-item label="实重" prop="weight" class="item-style">
|
|
|
+ <el-input v-model="dataForm.weight" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="欧元" prop="deductionEuro">
|
|
|
- <el-input v-model="dataForm.deductionEuro" />
|
|
|
+ <el-form-item label="长" prop="long1" class="item-style">
|
|
|
+ <el-input v-model="dataForm.long1" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="备注" prop="remark">
|
|
|
- <el-input v-model="dataForm.deductionEuro" />
|
|
|
+ <el-form-item label="宽" prop="wide" class="item-style">
|
|
|
+ <el-input v-model="dataForm.wide" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="高" prop="height" class="item-style">
|
|
|
+ <el-input v-model="dataForm.height" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="体积重" prop="bulkWeight" class="item-style">
|
|
|
+ <el-input v-model="dataForm.bulkWeight" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="包裹数" prop="count" class="item-style">
|
|
|
+ <el-input v-model="dataForm.count" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="人民币" prop="rmb" class="item-style">
|
|
|
+ <el-input v-model="dataForm.rmb" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="欧元" prop="euro" class="item-style">
|
|
|
+ <el-input v-model="dataForm.euro" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -115,7 +178,9 @@ import {
|
|
|
listMaritimeAdministration,
|
|
|
createMaritimeAdministration,
|
|
|
updateMaritimeAdministration,
|
|
|
- deleteMaritimeAdministration
|
|
|
+ deleteMaritimeAdministration,
|
|
|
+ exportXlsx,
|
|
|
+ importWord
|
|
|
} from '@/api/MaritimeAdministration'
|
|
|
import Pagination from '@/components/Pagination'
|
|
|
export default {
|
|
@@ -123,12 +188,19 @@ export default {
|
|
|
components: { Pagination },
|
|
|
data() {
|
|
|
return {
|
|
|
+ modification: [],
|
|
|
+ currentPage: 1,
|
|
|
+ tableList: [],
|
|
|
list: null,
|
|
|
total: 0,
|
|
|
listLoading: true,
|
|
|
listQuery: {
|
|
|
page: 1,
|
|
|
- limit: 20
|
|
|
+ limit: 20,
|
|
|
+ type: {
|
|
|
+ containerNo: '',
|
|
|
+ customerNo: ''
|
|
|
+ }
|
|
|
},
|
|
|
dataForm: {
|
|
|
id: undefined
|
|
@@ -145,13 +217,221 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.getList()
|
|
|
+ this.currentPage = 1
|
|
|
},
|
|
|
methods: {
|
|
|
+ selectInit(row) {
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ async exportlist() { debugger
|
|
|
+ if (this.modification.length == 0) {
|
|
|
+ this.$message.warning('请选择要导出的条目!')
|
|
|
+ } else {
|
|
|
+ console.log('导出数据', this.modification)
|
|
|
+ const _data = {
|
|
|
+ maritimeDetailDTOS: this.modification
|
|
|
+ }
|
|
|
+ const {
|
|
|
+ data
|
|
|
+ } = await exportXlsx(_data).then((response) => {
|
|
|
+ this.download(response.data.data)
|
|
|
+ if (response.status == '200') {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ importClick(file, fileList) {
|
|
|
+ this.fileTemp = file.raw
|
|
|
+ const fileName = file.raw.name
|
|
|
+ const 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.countryList = []
|
|
|
+ this.excelFreightspace = []
|
|
|
+ // this.dialogVisible = true;
|
|
|
+ const _this = this
|
|
|
+ const 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'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // outdata就是你想要的东西 excel导入的数据
|
|
|
+ outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]])
|
|
|
+ // excel 数据再处理
|
|
|
+ const arr = []
|
|
|
+ outdata.map(v => {
|
|
|
+ // let jsonString = JSON.stringify(v).replace(/\*/g, '').replace(/\s/ig,'');
|
|
|
+ const jsonString = JSON.stringify(v).replace(/\//g, '').replace(/\s/ig, '')
|
|
|
+ v = JSON.parse(jsonString)
|
|
|
+ const obj = {}
|
|
|
+ // xxx代表列名
|
|
|
+ obj.receiptPaymentDate = v.收款日期
|
|
|
+ obj.receivingWithdrawingRegion = v.收款地
|
|
|
+ obj.receivingWithdrawingPeople = v.付款人
|
|
|
+ obj.deductionEuro = v.金额EUR
|
|
|
+ obj.deductionRmb = v.金额RMB
|
|
|
+ obj.businessType = 1
|
|
|
+ obj.remarks = v.备注1
|
|
|
+ obj.remark = v.备注2
|
|
|
+ obj.updatePeople = _this.$store.getters.name
|
|
|
+ if (!obj.deductionEuro) {
|
|
|
+ obj.deductionEuro = 0
|
|
|
+ }
|
|
|
+ if (!obj.deductionRmb) {
|
|
|
+ obj.deductionRmb = 0
|
|
|
+ }
|
|
|
+ for (let i = 0; i < _this.placeList.length; i++) {
|
|
|
+ _this.countryList.push(_this.placeList[i].country)
|
|
|
+ }
|
|
|
+ if (!_this.countryList.includes(obj.receivingWithdrawingRegion)) {
|
|
|
+ _this.isAllowExport = false
|
|
|
+ _this.$notify({
|
|
|
+ title: '失败',
|
|
|
+ message: '导入失败,导入数据中收款地在系统中不存在,请重新编辑',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ _this.excelFreightspace.push(obj)
|
|
|
+ _this.isAllowExport = true
|
|
|
+ }
|
|
|
+ for (let i = 0; i < _this.khList.length; i++) {
|
|
|
+ _this.khList1.push(_this.khList[i].receivingWithdrawingPeople)
|
|
|
+ }
|
|
|
+ if (!_this.khList1.includes(obj.receivingWithdrawingPeople)) {
|
|
|
+ _this.isAllowExport = false
|
|
|
+ _this.$notify({
|
|
|
+ title: '失败',
|
|
|
+ message: '导入失败,导入数据中客户不存在,请重新编辑',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ _this.excelFreightspace.push(obj)
|
|
|
+ _this.isAllowExport = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (_this.excelFreightspace && _this.isAllowExport) {
|
|
|
+ importWord(_this.excelFreightspace).then((response) => {
|
|
|
+ if (response.status == '200') {
|
|
|
+ _this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '导入成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ _this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reader.readAsArrayBuffer(f)
|
|
|
+ }
|
|
|
+ if (rABS) {
|
|
|
+ reader.readAsArrayBuffer(f)
|
|
|
+ } else {
|
|
|
+ reader.readAsBinaryString(f)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSizeChange(val) {
|
|
|
+ console.log(`每页 ${val} 条`)
|
|
|
+ this.listQuery.limit = val
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.listQuery.page = val
|
|
|
+ console.log(`当前页: ${val}`)
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.modification = val
|
|
|
+ },
|
|
|
+ makeList(targetList) {
|
|
|
+ this.list = targetList
|
|
|
+ console.log(targetList)
|
|
|
+ const data = this.list
|
|
|
+ const arr = [] // 存放格式后的数据
|
|
|
+ const rowspan = [] // 存放数组每行的 合并row 数据
|
|
|
+ data.forEach(item => {
|
|
|
+ // debugger
|
|
|
+ for (let i = 0; i < item.maritimeDetailDOS.length; i++) {
|
|
|
+ const params = { ...item, ...item.maritimeDetailDOS[i] } // 合并数据item与item.data[i]的数据,构成新的行数据
|
|
|
+ params.rmb = item.maritimeDetailDOS.length // 获取合并的 行数(row -> 取item的子数组长度)
|
|
|
+ delete params.maritimeDetailDOS // 删除 rdata中的data属性; item属性中存在data,我们又获取了 item.data[i] 数据,所以此属性没用了删掉
|
|
|
+ console.log('delete params->', params) // 通过循环获取到所有数据列表
|
|
|
+ arr.push(params) // 存储格式好的数据
|
|
|
+ // 生成合并信息的数组 [3, 0, 0, 2, 0, 4, 0, 0, 0] 其中的0代表隐藏
|
|
|
+ if (i == 0) {
|
|
|
+ rowspan.push(item.maritimeDetailDOS.length)
|
|
|
+ } else {
|
|
|
+ rowspan.push(0)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.list = arr // 处理好格式的 arr 进行赋值
|
|
|
+ console.log('tableData->', this.list)
|
|
|
+ console.log('rowspan->', rowspan)
|
|
|
+ this.rowspan = rowspan
|
|
|
+ },
|
|
|
+ // 单元格合并
|
|
|
+ objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
+ // 行,列,行下标,列下标( 控制要合并的列 )
|
|
|
+ if ([2, 3, 11, 12].includes(columnIndex)) {
|
|
|
+ const _row = this.rowspan[rowIndex]
|
|
|
+ const _col = _row > 0 ? 1 : 0 // 如果这一行隐藏了,这列也隐藏
|
|
|
+ return {
|
|
|
+ rowspan: _row, // 合并的行数
|
|
|
+ colspan: _col // 合并的列数,设为0则直接不显示
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
getList() {
|
|
|
this.listLoading = true
|
|
|
listMaritimeAdministration(this.listQuery)
|
|
|
.then(response => {
|
|
|
- this.list = response.data.data.items
|
|
|
+ this.makeList(response.data.data.items)
|
|
|
+ // this.list = response.data.data.items
|
|
|
this.total = response.data.data.total
|
|
|
this.listLoading = false
|
|
|
})
|
|
@@ -171,12 +451,15 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
handleCreate() {
|
|
|
- this.resetForm()
|
|
|
- this.dialogStatus = 'create'
|
|
|
- this.dialogFormVisible = true
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['dataForm'].clearValidate()
|
|
|
+ this.$router.push({
|
|
|
+ path: 'MaritimeAdministrationadd'
|
|
|
})
|
|
|
+ // this.resetForm()
|
|
|
+ // this.dialogStatus = 'create'
|
|
|
+ // this.dialogFormVisible = true
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$refs['dataForm'].clearValidate()
|
|
|
+ // })
|
|
|
},
|
|
|
createData() {
|
|
|
this.$refs['dataForm'].validate(valid => {
|
|
@@ -203,12 +486,19 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
handleUpdate(row) {
|
|
|
- this.dataForm = Object.assign({}, row)
|
|
|
- this.dialogStatus = 'update'
|
|
|
- this.dialogFormVisible = true
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['dataForm'].clearValidate()
|
|
|
+ debugger
|
|
|
+ this.$router.push({
|
|
|
+ path: 'MaritimeAdministrationedit',
|
|
|
+ query: {
|
|
|
+ id: row.infoId
|
|
|
+ }
|
|
|
})
|
|
|
+ // this.dataForm = Object.assign({}, row)
|
|
|
+ // this.dialogStatus = 'update'
|
|
|
+ // this.dialogFormVisible = true
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$refs['dataForm'].clearValidate()
|
|
|
+ // })
|
|
|
},
|
|
|
updateData() {
|
|
|
this.$refs['dataForm'].validate(valid => {
|
|
@@ -274,3 +564,13 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.item-style {
|
|
|
+ width: 48%;
|
|
|
+ display: inline-block;
|
|
|
+ // margin-left: 20px;
|
|
|
+}
|
|
|
+.el-form-item--medium .el-form-item__label {
|
|
|
+ text-align: right;
|
|
|
+}
|
|
|
+</style>
|