浏览代码

修改导出默认时间

wangchao 3 年之前
父节点
当前提交
6a16648aa7
共有 3 个文件被更改,包括 39 次插入11 次删除
  1. 10 2
      common/appUpdate.js
  2. 24 6
      common/helper.js
  3. 5 3
      pages/user/contractLook/inventoryCost.vue

+ 10 - 2
common/appUpdate.js

@@ -13,7 +13,8 @@ export default function appUpdate() {
 	    	imei: "1"
 	    },
 	    method: 'GET',
-	    success: (res) => {			
+	    success: (res) => {		
+			var that=this
 	    	if (res.statusCode === 200) {
 				console.log("uni.request update success",res)
 				plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
@@ -62,7 +63,14 @@ export default function appUpdate() {
 										force: false
 									}, function() {
 										plus.nativeUI.toast("热更新成功");
-										plus.runtime.restart();
+										uni.clearStorageSync();
+										that.$api.doRequest('post', '/auth/api/logout').then(res => {
+											if (res.data.data) {
+												that.$store.commit('logout')
+												that.$api.logout()
+												plus.runtime.restart();
+											}
+										})
 									}, function(e) {
 										console.log(e)
 										plus.nativeUI.toast(`热更新失败:${e.message}`);

+ 24 - 6
common/helper.js

@@ -12,13 +12,13 @@ const isArray = Array.isArray || function(obj) {
 const getListByUserId = function() {
 	let baseUrlNew = config.def().baseUrlNew
 	var userInfo = uni.getStorageSync("userInfo")
-	
-	console.log("------",userInfo)
-	if(userInfo){
+
+	console.log("------", userInfo)
+	if (userInfo) {
 		uni.request({
 			url: baseUrlNew + '/roleMenu/query/getListByUserId',
 			data: {
-				userId: userInfo.id?userInfo.id:userInfo.data.id
+				userId: userInfo.id ? userInfo.id : userInfo.data.id
 			},
 			method: 'GET',
 			success: (res) => {
@@ -26,7 +26,7 @@ const getListByUserId = function() {
 					uni.setStorageSync("jurisdiction", res.data.data)
 					let list = getUserAllRoles(res.data.data);
 					uni.setStorageSync("rolesList", list)
-		
+
 				}
 			}
 		})
@@ -65,6 +65,23 @@ const setAudit = (item) => {
 	console.log(item)
 }
 
+//获取当天日期
+const getNowFormatDate = () => {
+	var date = new Date();
+	var seperator1 = "-";
+	var year = date.getFullYear();
+	var month = date.getMonth() + 1;
+	var strDate = date.getDate();
+	if (month >= 1 && month <= 9) {
+		month = "0" + month;
+	}
+	if (strDate >= 0 && strDate <= 9) {
+		strDate = "0" + strDate;
+	}
+	var currentdate = year + seperator1 + month + seperator1 + strDate;
+	return currentdate;
+}
+
 
 
 export default {
@@ -74,5 +91,6 @@ export default {
 	isArray,
 	erpWarehouse,
 	getListByUserId,
-	setAudit
+	setAudit,
+	getNowFormatDate
 }

+ 5 - 3
pages/user/contractLook/inventoryCost.vue

@@ -32,7 +32,7 @@
 				<view class="modal-row">
 					<view class="">查询日期</view>
 					<view class="" @click="selectDate">
-						{{parameter.endDate?parameter.startDate+'-'+parameter.endDate:'请选择查询日期'}}
+						{{parameter.endDate?parameter.startDate+' - '+parameter.endDate:'请选择查询日期'}}
 					</view>
 				</view>
 				<view class="modal-row">
@@ -48,6 +48,7 @@
 </template>
 
 <script>
+	 import helper from '@/common/helper.js'; 
 	export default {
 		data() {
 			return {
@@ -77,8 +78,7 @@
 			this.init()
 		},
 		methods: {
-			selectDate() {
-				this.show = true
+			selectDate() {				this.show = true
 			},
 			change(e) {
 				this.parameter.startDate = e.startDate
@@ -126,6 +126,8 @@
 			},
 			toDetail(warehouseName) {
 				this.parameter.warehouseName = warehouseName
+				this.parameter.startDate = helper.getNowFormatDate()
+				this.parameter.endDate = helper.getNowFormatDate()
 				this.isShowDetailBtn = true
 			},
 			init() {