Browse Source

缓存发货通知单导入的一些数据

java8
han\hanst 5 months ago
parent
commit
6648d526a1
  1. 2
      src/views/modules/ecss/codelnotify.vue
  2. 2
      src/views/modules/ecss/codelnotifyConfirm.vue
  3. 112
      src/views/modules/ecss/del_upload_excel.vue

2
src/views/modules/ecss/codelnotify.vue

@ -96,7 +96,7 @@
fixed="left"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" v-if="scope.row.notifyStatus!=='订单取消'" @click="updateHeaderModelDo(scope.row)">修改</a>
<a type="text" size="small" @click="updateHeaderModelDo(scope.row)">修改</a>
<a type="text" style="color: green" size="small" v-if="scope.row.notifyStatus==='已计划' && scope.row.notifyStatus!=='订单取消'" @click="xiadaChoose()">下达</a>
<a type="text" style="color: orange" size="small" v-if="scope.row.notifyStatus==='已下达'&& scope.row.notifyStatus!=='订单取消'" @click="jihuaEcssDel(scope.row)">取消下达</a>
<a type="text" style="color: red" size="small" v-if="scope.row.notifyStatus!=='订单取消'" @click="cancelDelHeader(scope.row)">废弃</a>

2
src/views/modules/ecss/codelnotifyConfirm.vue

@ -70,7 +70,7 @@
fixed="left"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" v-if="scope.row.notifyStatus==='仓库已确认' || scope.row.notifyStatus==='已报关'" @click="updateModelOpen(scope.row)">修改</a>
<a type="text" size="small" v-if="scope.row.notifyStatus==='已报关'" @click="updateModelOpen(scope.row)">修改</a>
<a type="text" size="small" v-if="scope.row.notifyStatus==='已下达'" @click="confirmModelOpen(scope.row)">仓库确认</a>
<a type="text" size="small" v-if="scope.row.notifyStatus==='仓库已确认'" @click="cancerConfirm(scope.row)">取消确认</a>
</template>

112
src/views/modules/ecss/del_upload_excel.vue

@ -33,7 +33,7 @@
</span>
</template>
<el-input type="textarea"
:rows="2" v-model="pageData.customerName" ></el-input>
:rows="2" v-model="pageData.customerName"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
@ -44,7 +44,7 @@
</span>
</template>
<el-input type="textarea"
:rows="2" v-model="pageData.overseasShipper" ></el-input>
:rows="2" v-model="pageData.overseasShipper"></el-input>
</el-form-item>
</el-col>
@ -56,7 +56,7 @@
</span>
</template>
<el-input type="textarea"
:rows="3" v-model="pageData.localShipAddress" ></el-input>
:rows="3" v-model="pageData.localShipAddress"></el-input>
</el-form-item>
</el-col>
@ -68,7 +68,7 @@
</span>
</template>
<el-input type="textarea"
:rows="3" v-model="pageData.overseasAddress" ></el-input>
:rows="3" v-model="pageData.overseasAddress"></el-input>
</el-form-item>
</el-col>
<el-col :span="24" style="margin-top: 60px">
@ -227,13 +227,95 @@
localShipAddressFlag:false,
overseasShipperFlag:false,
overseasAddressFlag:false,
cacheKey: '', //
cacheTimer: null, //
}
},
watch: {
// pageData
pageData: {
handler: function(newVal, oldVal) {
//
if (this.visible && this.cacheKey) {
this.saveToCache();
}
},
deep: true
}
},
beforeDestroy() {
//
if (this.cacheTimer) {
clearTimeout(this.cacheTimer);
}
},
methods: {
//
generateCacheKey() {
const userId = this.$store.state.user.id || this.$store.state.user.name;
return `ecss_del_upload_cache_${userId}`;
},
//
saveToCache() {
//
if (this.cacheTimer) {
clearTimeout(this.cacheTimer);
}
// 500ms
this.cacheTimer = setTimeout(() => {
try {
const cacheData = {
pageData: {
buNo: this.pageData.buNo,
customerName: this.pageData.customerName,
localShipAddress: this.pageData.localShipAddress,
overseasShipper: this.pageData.overseasShipper,
overseasAddress: this.pageData.overseasAddress,
cnative: this.pageData.cnative,
salesArea: this.pageData.salesArea,
}
};
localStorage.setItem(this.cacheKey, JSON.stringify(cacheData));
} catch (error) {
console.warn('保存缓存失败:', error);
}
}, 500);
},
//
loadFromCache() {
try {
const cachedData = localStorage.getItem(this.cacheKey);
if (cachedData) {
const parsedData = JSON.parse(cachedData);
if (parsedData.pageData) {
//
Object.assign(this.pageData, parsedData.pageData);
return true;
}
}
} catch (error) {
console.warn('加载缓存失败:', error);
}
return false;
},
//
clearCache() {
try {
localStorage.removeItem(this.cacheKey);
} catch (error) {
console.warn('清除缓存失败:', error);
}
},
//
init () {
this.fileList = []
this.cacheKey = this.generateCacheKey();
let tempData = {
username: this.$store.state.user.name,
}
@ -244,18 +326,27 @@
this.pageData.buNo=data.row2[0].buNo
}
}
// BU
this.loadFromCache();
})
getCustomerList({}).then(({data}) => {
//
if (data && data.code === 0) {
this.customerList=data.rows
}
});
this.pageData.customerName=''
this.pageData.cnative=''
this.pageData.localShipAddress='',
this.pageData.overseasShipper='',
this.pageData.overseasAddress='',
//
if (!this.loadFromCache()) {
this.pageData.customerName=''
this.pageData.cnative=''
this.pageData.localShipAddress='',
this.pageData.overseasShipper='',
this.pageData.overseasAddress='',
this.pageData.salesArea=''
}
this.customerPersons=[]
this.customerAddrs=[]
//
@ -338,6 +429,7 @@
this.deleteFile()
//
this.visible = false
//
},
deleteFile(){
this.fileList = []
@ -392,6 +484,8 @@
saveEcssCoDelNotifyByExcel(formData).then(({data}) => {
if (data.code === 0) {
this.$message.success(data.msg)
//
this.clearCache()
//
this.closeDialog()
} else {

Loading…
Cancel
Save