From 1f673b1fa0e6f9f88468f72a6f2d6a4e0129ea13 Mon Sep 17 00:00:00 2001
From: kongdeqiang <123456>
Date: 星期六, 31 十二月 2022 20:04:09 +0800
Subject: [PATCH] 修改前端页面
---
src/assets/js/ByUtils.js | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 107 insertions(+), 2 deletions(-)
diff --git a/src/assets/js/ByUtils.js b/src/assets/js/ByUtils.js
index bec95ae..4183312 100644
--- a/src/assets/js/ByUtils.js
+++ b/src/assets/js/ByUtils.js
@@ -265,14 +265,24 @@
}).then((response) => {
//vm.$loading().close();
let data = response.data;
- if (data && data.code==0) {
+ if (data && data.code==0) {
callBackFunction(data);
} else {
if(data.message=='-9999'){
vm.$router.push({'path': '/login'});
vm.$alert('浼氳瘽缁撴潫锛岃閲嶆柊鐧诲綍', {'title': '鎻愮ず', 'type': 'warning', 'center': true, 'showClose': false});
}else{
- vm.$alert('鎿嶄綔澶辫触' , {'title': '鎻愮ず', 'type': 'warning', 'center': true, 'showClose': false});
+ let a = '';
+ if(response.data){
+ if(response.data.msg){
+ a=response.data.msg
+ }else {
+ a='鏈嶅姟鍣ㄦ晠闅�'
+ }
+ }else {
+ a="鏁版嵁閿欒"
+ }
+ vm.$alert(a , {'title': '鎻愮ず', 'type': 'warning', 'center': true, 'showClose': false});
}
}
}).catch((e) => {
@@ -282,6 +292,71 @@
// vm.$router.push({'path': '/login'});
}});
})
+ },
+
+ exportData(vm, url, data, successCallBackFunction) {
+ if (StringUtil.isNullOrEmpty(url)) {
+ vm.$alert('璇锋眰鍦板潃涓嶈兘涓虹┖', {'title': '鎻愮ず', 'type': 'warning', 'center': true, 'showClose': false});
+ return;
+ }
+ let callBackFunction = function (data) {
+ vm.$message({message: data.message, type: 'success'});
+ try {
+ vm.showDialog(false);
+ } catch (e) {
+ }
+ try {
+ vm.loadData();
+ } catch (e) {
+ }
+ }
+ if (successCallBackFunction) {
+ callBackFunction = successCallBackFunction;
+ }
+ // var token = "";
+ // if(this.getUser()){
+ // token = this.getUser().token;
+ // }
+ // vm.$loading();
+ vm.$axios({
+ // headers: {
+ // 'token': token
+ // },
+ withCredentials: false,
+ url: url,
+ method: 'post',
+ data: data
+ }).then((response) => {
+ //vm.$loading().close();
+ let data = response.data;
+ console.log(response,'response');
+ if (data) {
+ callBackFunction(data);
+ } else {
+ if(data.message=='-9999'){
+ vm.$router.push({'path': '/login'});
+ vm.$alert('浼氳瘽缁撴潫锛岃閲嶆柊鐧诲綍', {'title': '鎻愮ず', 'type': 'warning', 'center': true, 'showClose': false});
+ }else{
+ let a = '';
+ if(response.data){
+ if(response.data.msg){
+ a=response.data.msg
+ }else {
+ a='鏈嶅姟鍣ㄦ晠闅�'
+ }
+ }else {
+ a="鏁版嵁閿欒"
+ }
+ vm.$alert(a , {'title': '鎻愮ず', 'type': 'warning', 'center': true, 'showClose': false});
+ }
+ }
+ }).catch((e) => {
+ //vm.$loading().close();
+ vm.$alert('鎿嶄綔鍑虹幇寮傚父锛�' + e, {'title': '閿欒', 'type': 'error', 'center': true, 'showClose': false,callback:action=> {
+ // byUtils.setUser(null);
+ // vm.$router.push({'path': '/login'});
+ }});
+ })
},
postData4(vm, url, data, successCallBackFunction) {
@@ -734,4 +809,34 @@
}});
})
},
+ dateFormat(date,f) {
+ let format = 'yyyy-MM-dd hh:mm:ss'
+ if(f){
+ format = f;
+ }
+ if (date !== 'Invalid Date') {
+ var o = {
+ 'M+': date.getMonth() + 1, // month
+ 'd+': date.getDate(), // day
+ 'h+': date.getHours(), // hour
+ 'm+': date.getMinutes(), // minute
+ 's+': date.getSeconds(), // second
+ 'q+': Math.floor((date.getMonth() + 3) / 3), // quarter
+ 'S': date.getMilliseconds() // millisecond
+ }
+ if (/(y+)/.test(format)) {
+ format = format.replace(RegExp.$1,
+ (date.getFullYear() + '').substr(4 - RegExp.$1.length))
+ }
+ for (var k in o) {
+ if (new RegExp('(' + k + ')').test(format)) {
+ format = format.replace(RegExp.$1,
+ RegExp.$1.length === 1 ? o[k]
+ : ('00' + o[k]).substr(('' + o[k]).length))
+ }
+ }
+ return format
+ }
+ return ''
+ },
}
--
Gitblit v1.9.1