|
@@ -139,13 +139,18 @@
|
|
|
</div>
|
|
|
<!-- 导入 -->
|
|
|
<div style="font-size: 16px; width: 50%; float: left; text-align: right">
|
|
|
- <el-button
|
|
|
- class="bg-bottom"
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- @click="import(deptBudgetList)"
|
|
|
- >导入</el-button
|
|
|
- >
|
|
|
+ <el-upload style="margin-left: 8px;"
|
|
|
+ class="upload-demo inline-block margin-right-10"
|
|
|
+ action=""
|
|
|
+ :on-change="handleChange"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-remove="handleRemove"
|
|
|
+ :file-list="fileListUpload"
|
|
|
+ :limit="limitUpload"
|
|
|
+ accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
|
|
|
+ :auto-upload="false">
|
|
|
+ <el-button type="primary">导入</el-button>
|
|
|
+ </el-upload>
|
|
|
</div>
|
|
|
<div class="liaison">
|
|
|
<div
|
|
@@ -334,8 +339,8 @@
|
|
|
/>
|
|
|
</el-upload>
|
|
|
<div class="tupian">
|
|
|
- <span v-if="deptBudgetList.tranCarInfoList && deptBudgetList.tranCarInfoList.length > 0 && deptBudgetList.tranCarInfoList[0].loadPoundImg != null " >1</span>
|
|
|
- <span v-else>未上传</span>
|
|
|
+ <span v-if="deptBudgetList.tranCarInfoList[0].loadPoundImg != null " >1</span>
|
|
|
+ <span v-if="deptBudgetList.tranCarInfoList[0].loadPoundImg == null ">未上传</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
</ws-form-item>
|
|
@@ -355,7 +360,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { regionData} from 'element-china-area-data'
|
|
|
-import { seeCat, packList, feedback, state } from '@/model/transport/index'
|
|
|
+import { seeCat, packList, feedback, state,importApplFileUrl } from '@/model/transport/index'
|
|
|
import { getstaff } from '@/model/warehouse/index'
|
|
|
import WsUpload from '@/components/WsUpload'
|
|
|
import mapDrag from '@/components/mapdrag/mapdrag'
|
|
@@ -415,6 +420,7 @@ export default {
|
|
|
size: 10,
|
|
|
value1: '',
|
|
|
unitList: [],
|
|
|
+ fileTemp:'',
|
|
|
freightspace: [
|
|
|
{
|
|
|
caseNo: '',
|
|
@@ -430,6 +436,9 @@ export default {
|
|
|
staffList: [],
|
|
|
options: [],
|
|
|
carModel: [],
|
|
|
+ tranCarInfoList: {
|
|
|
+ loadPoundImg: '',
|
|
|
+ },
|
|
|
//上传
|
|
|
accessoryTFs: false,
|
|
|
fileList: [],
|
|
@@ -502,7 +511,6 @@ export default {
|
|
|
// 关闭 dialog时 处理文件url 初始化upload组件
|
|
|
handleClose() {
|
|
|
this.dialogViewSpareMoney = false
|
|
|
- this.accessoryTFs = false
|
|
|
},
|
|
|
//下拉司机姓名改变事件
|
|
|
selectdriver() {},
|
|
@@ -520,8 +528,119 @@ export default {
|
|
|
uploadSuccess(data, files, url) {
|
|
|
console.log(data, files, url)
|
|
|
},
|
|
|
- //导入
|
|
|
- import() {},
|
|
|
+ handleClose() {
|
|
|
+ this.accessoryTFs = false
|
|
|
+ },
|
|
|
+ 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.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'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ wb = XLSX.read(binary, {
|
|
|
+ type: 'binary'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // outdata就是你想要的东西 excel导入的数据
|
|
|
+ outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
|
|
|
+ // excel 数据再处理
|
|
|
+ let arr = []
|
|
|
+ outdata.map(v => {
|
|
|
+ // let jsonString = JSON.stringify(v).replace(/\*/g, '').replace(/\s/ig,'');
|
|
|
+ let jsonString = JSON.stringify(v).replace(/\//g, '').replace(/\s/ig,'');
|
|
|
+ console.log(jsonString);
|
|
|
+ v = JSON.parse(jsonString);
|
|
|
+ let obj = {}
|
|
|
+ //xxx代表列名
|
|
|
+ obj.caseNo = v.箱号
|
|
|
+ obj.titleNo= v.封号
|
|
|
+ obj.binNumber = v.仓位号
|
|
|
+ obj.positionWeight=v.散船重量
|
|
|
+ obj.loadNetWeight = v.装船净重
|
|
|
+ obj.loadingDate = v.装船日期
|
|
|
+ arr.push(obj)
|
|
|
+ })
|
|
|
+ _this.freightspace.concat(arr)
|
|
|
+ }
|
|
|
+ reader.readAsArrayBuffer(f);
|
|
|
+ }
|
|
|
+ if (rABS) {
|
|
|
+ reader.readAsArrayBuffer(f);
|
|
|
+ } else {
|
|
|
+ reader.readAsBinaryString(f);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ uploadSectionFile (param) {
|
|
|
+ var fileName = param.file.name.split('.')
|
|
|
+ var fileSuffix = fileName[fileName.length - 1]
|
|
|
+ if (
|
|
|
+ !(
|
|
|
+ fileSuffix.toLowerCase() == 'xlsx' ||
|
|
|
+ fileSuffix.toLowerCase() == 'xls'
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ EventBus.$emit('error', this.$t('upload.message08'))
|
|
|
+ loading.close()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var data = new FormData()
|
|
|
+ data.append('file', param.file)
|
|
|
+ data.append('compId', sessionStorage.getItem('ws-pf_compId'))
|
|
|
+ data.append('userId', sessionStorage.getItem('ws-pf_userId'))
|
|
|
+
|
|
|
+ importApplFileUrl(data)
|
|
|
+ .toPromise()
|
|
|
+ .then(success => {
|
|
|
+
|
|
|
+ console.log(success)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
//完货
|
|
|
finished() {
|
|
|
this.$confirm(`完货操作后,装船信息不可修改,是否确定完货?`, {
|
|
@@ -635,9 +754,7 @@ export default {
|
|
|
if (valid) {
|
|
|
// this.deptBudgetList.totalStorage = this.totalStorage
|
|
|
this.tranCarInfoList = this.freightspace
|
|
|
- if(this.tranCarInfoList.length > 0){
|
|
|
- this.tranCarInfoList[0].sendDateStart = this.deptBudgetList.sendDateStart
|
|
|
- }
|
|
|
+ this.tranCarInfoList[0].sendDateStart = this.deptBudgetList.sendDateStart
|
|
|
// this.tranCarInfoList.boxNo = this.arr.toString()
|
|
|
for (var i = 0; i < this.tranCarInfoList.length; i++) {
|
|
|
this.tranCarInfoList[i].id = this.freightspace[i].id
|
|
@@ -677,18 +794,16 @@ export default {
|
|
|
.toPromise()
|
|
|
.then((response) => {
|
|
|
this.deptBudgetList = response
|
|
|
- if(response.tranCarInfoList.length >0 ){
|
|
|
- this.deptBudgetList.driver = response.tranCarInfoList[0].driver
|
|
|
- this.deptBudgetList.driverPhone =
|
|
|
- response.tranCarInfoList[0].driverPhone
|
|
|
- this.$set(this.deptBudgetList,'sendDateStart',response.tranCarInfoList[0].sendDateStart)
|
|
|
- this.deptBudgetList.receiveDateEnd =
|
|
|
- response.tranCarInfoList[0].receiveDateEnd
|
|
|
- this.deptBudgetList.shipName = response.tranCarInfoList[0].shipName
|
|
|
- this.deptBudgetList.shipNo = response.tranCarInfoList[0].shipNo
|
|
|
- this.deptBudgetList.shipType = response.tranCarInfoList[0].shipType
|
|
|
- this.deptBudgetList.boxNumber = response.tranCarInfoList[0].boxNumber
|
|
|
- }
|
|
|
+ this.deptBudgetList.driver = response.tranCarInfoList[0].driver
|
|
|
+ this.deptBudgetList.driverPhone =
|
|
|
+ response.tranCarInfoList[0].driverPhone
|
|
|
+ this.$set(this.deptBudgetList,'sendDateStart',response.tranCarInfoList[0].sendDateStart)
|
|
|
+ this.deptBudgetList.receiveDateEnd =
|
|
|
+ response.tranCarInfoList[0].receiveDateEnd
|
|
|
+ this.deptBudgetList.shipName = response.tranCarInfoList[0].shipName
|
|
|
+ this.deptBudgetList.shipNo = response.tranCarInfoList[0].shipNo
|
|
|
+ this.deptBudgetList.shipType = response.tranCarInfoList[0].shipType
|
|
|
+ this.deptBudgetList.boxNumber = response.tranCarInfoList[0].boxNumber
|
|
|
// this.deptBudgetList.tranCarInfoList = response.tranCarInfoList
|
|
|
this.freightspace = response.tranCarInfoList
|
|
|
for (var i = 0; i < this.freightspace.length; i++) {
|