Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CRM
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
华国豪
CRM
Commits
22962d2a
Commit
22962d2a
authored
Apr 28, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
07356d18
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
122 deletions
+92
-122
main.js
src/main.js
+75
-2
index.js
src/plugins/index.js
+17
-120
No files found.
src/main.js
View file @
22962d2a
...
...
@@ -78,6 +78,7 @@ Vue.prototype.getLocalStorage = function () {
return
null
;
}
}
Vue
.
prototype
.
getNowDate
=
function
()
{
var
date
=
new
Date
();
var
seperator1
=
"-"
;
...
...
@@ -104,7 +105,8 @@ Vue.prototype.DateDiff = function (sDate1, sDate2) {
iDays
=
parseInt
(
Math
.
abs
(
oDate1
-
oDate2
)
/
1000
/
60
/
60
/
24
)
//把相差的毫秒数转换为天数
return
iDays
}
//价钱格式化,三位数逗号分隔,保留两位小数 duanjun
//价钱格式化,三位数逗号分隔,保留两位小数
Vue
.
prototype
.
moneyFormat
=
function
(
value
)
{
if
(
!
value
)
{
return
0.00
...
...
@@ -120,6 +122,7 @@ Vue.prototype.moneyFormat = function (value) {
}
return
x1
+
x2
;
},
// 注册
Vue
.
filter
(
'priceFormat'
,
function
(
value
)
{
if
(
value
==
null
)
{
...
...
@@ -180,7 +183,8 @@ Vue.prototype.random_string = function (len) {
}
return
pwd
;
},
//上传文件到本地服务器
//上传文件到文件服务器
Vue
.
prototype
.
UploadSelfFileT
=
function
(
path
,
files
,
successCall
)
{
if
(
files
&&
files
.
length
>
0
)
{
let
nameList
=
new
Array
()
...
...
@@ -206,6 +210,75 @@ Vue.prototype.random_string = function (len) {
}
}
/**
* 上传到当前Api站点
* @param params 上传需要携带信息
* @param fileObj 上传文件信息
* @param successCall 回调函数
*/
Vue
.
prototype
.
UploadLocalSystem
=
function
(
params
,
fileObj
,
successCall
)
{
let
that
=
this
;
let
url
=
that
.
domainManager
().
CRMUploadUrl
;
let
formData
=
new
FormData
()
if
(
configObj
)
{
formData
.
append
(
"params"
,
params
);
}
formData
.
append
(
'myfile'
,
fileObj
);
co
(
function
*
()
{
that
.
$http
.
post
(
url
,
formData
,
{})
.
then
(
res
=>
{
successCall
(
res
);
})
}).
catch
(
function
(
err
)
{
console
.
log
(
"上传文件出错"
+
err
);
});
}
//新页面打开页面
Vue
.
prototype
.
OpenNewUrl
=
function
(
path
,
queryObj
)
{
var
newUrl
=
this
.
$router
.
resolve
({
path
:
path
,
query
:
queryObj
});
window
.
open
(
newUrl
.
href
,
'_blank'
);
}
//验证只能输入2位小数
Vue
.
prototype
.
checkPrice
=
function
(
item
,
filed
)
{
var
value
=
""
;
if
(
typeof
item
[
filed
]
==
"string"
)
{
value
=
item
[
filed
];
}
else
{
value
=
item
[
filed
].
toString
();
}
value
=
value
.
replace
(
/
[^\d
.
]
/g
,
""
);
//清除“数字”和“.”以外的字符
value
=
value
.
replace
(
/
\.{2,}
/g
,
"."
);
//只保留第一个. 清除多余的
value
=
value
.
replace
(
"."
,
"$#$"
)
.
replace
(
/
\.
/g
,
""
)
.
replace
(
"$#$"
,
"."
);
value
=
value
.
replace
(
/^
(\-)
*
(\d
+
)\.(\d\d)
.*$/
,
"$1$2.$3"
);
//只能输入两个小数
if
(
value
.
indexOf
(
"."
)
<
0
&&
value
!=
""
)
{
//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
value
=
parseFloat
(
value
);
}
item
[
filed
]
=
value
;
}
//验证只能输入整数
Vue
.
prototype
.
checkInteger
=
function
(
item
,
filed
)
{
var
value
=
""
;
if
(
typeof
item
[
filed
]
==
"string"
)
{
value
=
item
[
filed
];
}
else
{
value
=
item
[
filed
].
toString
();
}
value
=
value
.
replace
(
this
.
$commonUtils
.
Regex
.
isInteger
,
""
);
item
[
filed
]
=
value
;
}
new
Vue
({
router
,
store
,
...
...
src/plugins/index.js
View file @
22962d2a
...
...
@@ -17,7 +17,9 @@ export default {
//domainUrl = "http://localhost:5003";
let
locationName
=
window
.
location
.
hostname
;
//旅游ERPApi
let
domainPostUrl
=
"http://192.168.10.2:8083"
let
domainPostUrl
=
""
domainPostUrl
=
"http://192.168.10.2:8083"
;
//domainPostUrl = "http://192.168.10.46";
if
(
this
.
isOnline
())
{
if
(
window
.
location
.
host
.
indexOf
(
'fcrmyx.oytour.com'
)
!=
-
1
)
{
domainUrl
=
"http://crm.oytour.com"
...
...
@@ -33,75 +35,19 @@ export default {
DownLoadContractUrl
:
domainPostUrl
,
//阿里服务器地址
AliUrl
:
"https://reborndev.oss-cn-hangzhou.aliyuncs.com"
,
//本站文件流下载地址
LocalFileStreamDownLoadUrl
:
domainUrl
+
"/api/file/GetFileFromWebApi"
,
//PDF文件预览地址
PDFViewUrl
:
domainUrl
+
"/plug/pdf/web/viewer.html?file="
,
//SocketUrl
WebSocketUrl
:
"ws://192.168.1.110:8080?account="
,
//google地图图片地址
GoogleMapImageUrl
:
"http://imgfile.oytour.com"
,
//常用提交数据URL
//CRMApi地址
PostUrl
:
domainUrl
,
PostUrl2
:
domainPostUrl
+
"/api/common/post"
,
//旅游ERPApi地址
ERPApiUrl
:
domainPostUrl
+
"/api/common/post"
,
//CRM本地文件上传
CRMUploadUrl
:
domainUrl
+
"/Upload/Index"
,
javaUrl
:
locationName
.
indexOf
(
'testb2b'
)
==
-
1
?
"http://efficient.oytour.com"
:
locationName
.
indexOf
(
'testb2b.oytour.com'
)
!==
-
1
?
"http://47.96.12.235:9001"
:
"http://192.168.10.215:9000"
,
ViittoFileUrl
:
locationName
.
indexOf
(
'oytour'
)
!==
-
1
||
locationName
.
indexOf
(
'testb2b.oytour.com'
)
!==
-
1
?
"http://staticfile.oytour.com"
:
'http://192.168.10.214:8130'
,
UploadUrl
:
locationName
.
indexOf
(
'oytour'
)
!==
-
1
||
locationName
.
indexOf
(
'testb2b.oytour.com'
)
!==
-
1
?
"http://uploadfile.oytour.com"
:
"http://192.168.10.214:8120"
,
LocalFileStreamDownLoadUrl
:
domainUrl
+
"/api/file/GetFileFromWebApi"
,
};
return
obj
;
},
Vue
.
prototype
.
GetLocalFile
=
function
(
cmd
,
msg
,
fileName
,
successCall
)
{
var
apiurl
=
this
.
domainManager
().
LocalFileStreamDownLoadUrl
;
var
timestamp
=
(
new
Date
()).
valueOf
();
if
(
!
localStorage
.
userInfo
&&
localStorage
.
userInfo
!=
""
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/login"
)
{
this
.
$router
.
push
({
path
:
'/login'
})
}
var
token
=
""
;
var
key
=
""
;
if
(
this
.
getLocalStorage
()
!=
null
)
{
token
=
this
.
getLocalStorage
().
token
;
key
=
this
.
getLocalStorage
().
secretKey
;
}
var
encodeMsg
=
encodeURIComponent
(
JSON
.
stringify
(
msg
)).
toLowerCase
();
var
md5Str
=
md5
(
`cmd=
${
cmd
}
&msg=
${
encodeMsg
}
×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
var
postData
=
{
"msg"
:
msg
,
"cmd"
:
cmd
,
"timestamp"
:
timestamp
,
"token"
:
token
,
"sign"
:
md5Str
}
this
.
$http
.
post
(
apiurl
,
postData
,
{
responseType
:
'arraybuffer'
}).
then
((
res
)
=>
{
let
blob
=
new
Blob
([
res
.
data
],
{
type
:
"application/vnd.ms-excel"
})
let
url
=
URL
.
createObjectURL
(
blob
);
let
link
=
document
.
createElement
(
'a'
);
link
.
href
=
url
;
link
.
setAttribute
(
"download"
,
fileName
);
document
.
body
.
appendChild
(
link
);
link
.
click
();
successCall
(
res
);
}).
catch
(
function
(
res
)
{});
},
//价钱格式化,三位数逗号分隔,保留两位小数 duanjun
Vue
.
prototype
.
moneyFormat
=
function
(
value
)
{
let
nStr
=
Number
(
value
).
toFixed
(
2
)
nStr
+=
''
;
let
x
=
nStr
.
split
(
'.'
);
let
x1
=
x
[
0
];
let
x2
=
x
.
length
>
1
?
'.'
+
x
[
1
]
:
''
;
var
rgx
=
/
(\d
+
)(\d{3})
/
;
while
(
rgx
.
test
(
x1
))
{
x1
=
x1
.
replace
(
rgx
,
'$1'
+
','
+
'$2'
);
}
return
x1
+
x2
;
},
//消息成功提示
Vue
.
prototype
.
Success
=
function
(
msg
)
{
this
.
$message
({
...
...
@@ -168,18 +114,14 @@ export default {
}
return
path
.
split
(
'?'
)[
0
]
+
'?width='
+
w
;
}
//打开新窗口连接
Vue
.
prototype
.
OpenNewUrl
=
function
(
URL
)
{
if
(
URL
!=
''
)
{
window
.
open
(
'http://'
+
URL
,
'_blank'
);
}
}
//旅游ERP接口
Vue
.
prototype
.
apipost2
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
}
var
apiurl
=
this
.
domainManager
().
PostUrl2
;
var
apiurl
=
this
.
domainManager
().
ERPApiUrl
;
var
timestamp
=
(
new
Date
()).
valueOf
();
this
.
apiurl
=
apiurl
;
if
(
!
localStorage
.
userInfo
&&
localStorage
.
userInfo
!=
""
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/login"
)
{
...
...
@@ -222,6 +164,8 @@ export default {
}
},
faildCall
)
}
//CRM接口
Vue
.
prototype
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
...
...
@@ -263,6 +207,8 @@ export default {
}
},
faildCall
)
},
//Java接口
Vue
.
prototype
.
apiJavaPost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
...
...
@@ -312,55 +258,6 @@ export default {
successCall
(
res
)
}
},
faildCall
)
},
Vue
.
prototype
.
getAction
=
function
(
actionId
,
lineId
)
{
let
msg
=
{};
msg
.
actionId
=
actionId
;
if
(
lineId
)
{
msg
.
lineId
=
lineId
;
}
this
.
apiJavaPost
(
'/api/b2b/home/getSpecialAction'
,
msg
,
res
=>
{
this
.
Travelload
=
false
;
if
(
res
.
data
.
resultCode
==
1
)
{
}
else
{
this
.
Error
(
res
.
data
.
message
);
}
},
null
)
}
//验证只能输入2位小数
Vue
.
prototype
.
checkPrice
=
function
(
item
,
filed
)
{
var
value
=
""
;
if
(
typeof
item
[
filed
]
==
"string"
)
{
value
=
item
[
filed
];
}
else
{
value
=
item
[
filed
].
toString
();
}
value
=
value
.
replace
(
/
[^\d
.
]
/g
,
""
);
//清除“数字”和“.”以外的字符
value
=
value
.
replace
(
/
\.{2,}
/g
,
"."
);
//只保留第一个. 清除多余的
value
=
value
.
replace
(
"."
,
"$#$"
)
.
replace
(
/
\.
/g
,
""
)
.
replace
(
"$#$"
,
"."
);
value
=
value
.
replace
(
/^
(\-)
*
(\d
+
)\.(\d\d)
.*$/
,
"$1$2.$3"
);
//只能输入两个小数
if
(
value
.
indexOf
(
"."
)
<
0
&&
value
!=
""
)
{
//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
value
=
parseFloat
(
value
);
}
item
[
filed
]
=
value
;
}
//验证只能输入整数
Vue
.
prototype
.
checkInteger
=
function
(
item
,
filed
)
{
var
value
=
""
;
if
(
typeof
item
[
filed
]
==
"string"
)
{
value
=
item
[
filed
];
}
else
{
value
=
item
[
filed
].
toString
();
}
value
=
value
.
replace
(
this
.
$commonUtils
.
Regex
.
isInteger
,
""
);
item
[
filed
]
=
value
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment