Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rbc-demo
Overview
Overview
Details
Activity
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
王衍超
rbc-demo
Commits
c951a8a7
Commit
c951a8a7
authored
Feb 10, 2022
by
fengjiansheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(@gms/gms-plugin-billexpand): 修改暂存按钮调用统一接口
parent
23d0e4a2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
121 additions
and
15 deletions
+121
-15
tempSave.js
develop/@gms/gms-plugin-billexpand/src/actions/tempSave.js
+105
-15
errorMessageUtil.js
...ms-plugin-billexpand/src/actions/util/errorMessageUtil.js
+16
-0
No files found.
develop/@gms/gms-plugin-billexpand/src/actions/tempSave.js
View file @
c951a8a7
import
errorMessageUtil
from
"./util/errorMessageUtil"
;
/**
* 暂存按钮
* 不触发校验公式 调用已有保存逻辑
*/
export
default
{
export
default
{
defaultSaveActionName
:
"bill.Basic.quickSave"
,
execute
:
function
(
bill
,
param
)
{
execute
:
function
(
bill
,
param
)
{
if
(
bill
)
{
if
(
bill
)
{
let
postData
=
{
bill
.
setControlsSate
(
param
[
"_control_name_"
],
"enable"
,
false
);
actions
:
"bill.Basic.quickSave"
this
.
saveData
(
bill
,
param
,
this
)
}
bill
.
setControlsSate
(
param
[
"_control_name_"
],
'enable'
,
false
)
bill
.
executeServerAction
(
postData
,
function
(
code
,
data
)
{
bill
.
setControlsSate
(
param
[
"_control_name_"
],
'enable'
,
true
)
if
(
code
===
200
)
{
const
id
=
data
.
content
.
billData
.
id
GMS
.
vbus
.
$emit
(
'change-form-state'
,
{
state
:
'readOnly'
,
billId
:
id
})
GMS
.
$hideContainer
.
$Message
.
success
(
'暂存成功'
);
}
else
if
(
code
===
201
)
{
GMS
.
$hideContainer
.
$Message
.
error
(
data
.
message
);
}
else
if
(
code
===
202
)
{
GMS
.
$hideContainer
.
$Message
.
error
(
"暂存单据异常请联系管理员"
);
}
}
})
},
saveData
(
bill
,
param
)
{
let
that
=
this
;
let
buidData
=
bill
.
getBuillData
();
let
controlArr
=
bill
.
action
.
filter
((
v
)
=>
v
.
execute
===
"searchBillAction"
);
let
detailData
=
[];
let
arrApi1
=
[];
if
(
controlArr
.
length
>
0
&&
controlArr
[
0
].
param
.
field
&&
controlArr
[
0
].
param
.
field
.
length
>
0
)
{
let
tableList
=
controlArr
[
0
].
param
.
field
.
map
((
v
)
=>
v
.
targetTableName
);
tableList
=
Array
.
from
(
new
Set
(
tableList
));
tableList
.
forEach
((
v
)
=>
{
if
(
buidData
.
hasOwnProperty
(
v
))
{
for
(
let
i
=
0
;
i
<
bill
.
getSubData
(
v
).
length
;
i
++
)
{
let
rowDataObject
=
bill
.
getSubDataRow
(
v
,
i
);
let
obj
=
rowDataObject
.
getValue
(
"currentRowData"
);
if
(
obj
&&
obj
.
BILLDETAILOBJ
)
{
let
billId
=
obj
.
BILLID
;
let
billName
=
obj
.
BILLNAME
;
let
billDefine
=
billName
.
replace
(
/_E/gi
,
""
)
.
replace
(
/_R/gi
,
""
)
.
replace
(
/_A/gi
,
""
);
arrApi1
.
push
(
that
.
searchBillObj
(
billDefine
,
billId
,
obj
.
BILLDETAILOBJ
)
);
}
else
{
let
billId
=
rowDataObject
.
getData
().
BILLID
.
value
;
let
billName
=
rowDataObject
.
getData
().
BILLNAME
.
value
;
let
billDefine
=
billName
.
replace
(
/_E/gi
,
""
)
.
replace
(
/_R/gi
,
""
)
.
replace
(
/_A/gi
,
""
);
arrApi1
.
push
(
that
.
searchBillObj
(
billDefine
,
billId
));
}
}
}
});
}
}
if
(
arrApi1
.
length
>
0
)
{
Promise
.
all
(
arrApi1
).
then
((
list
)
=>
{
detailData
=
list
;
that
.
saveAsync
(
buidData
,
detailData
,
param
,
bill
);
});
}
else
{
that
.
saveAsync
(
buidData
,
detailData
,
param
,
bill
);
}
},
searchBillObj
(
billDefine
,
billId
,
BILLDETAILOBJ
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
GMS
.
$http
.
get
(
`/gms/bill/
${
billDefine
}
/
${
billId
}
?withSubs=true`
)
.
then
((
data
)
=>
{
let
obj
=
BILLDETAILOBJ
;
if
(
data
.
status
===
200
&&
data
.
data
.
code
===
0
)
{
if
(
!
BILLDETAILOBJ
)
{
obj
=
data
.
data
.
content
;
}
obj
.
recver
=
data
.
data
.
content
&&
data
.
data
.
content
.
recver
;
}
obj
.
billDefine
=
billDefine
;
resolve
(
obj
);
})
.
catch
((
error
)
=>
{
reject
(
error
);
});
});
},
saveAsync
(
buidData
,
detailData
,
param
,
bill
)
{
let
postData
=
{
data
:
buidData
,
detailData
:
detailData
,
};
let
url
=
`/rbc/bill/action/rbcbillsave/
${
param
.
define
}
/
${
this
.
defaultSaveActionName
}
?transmission=total`
;
GMS
.
$http
.
post
(
url
,
JSON
.
stringify
(
postData
),
{
headers
:
{
post
:
{
"Content-Type"
:
"application/json"
,},},
}).
then
(
function
(
response
)
{
bill
.
setControlsSate
(
param
[
"_control_name_"
],
"enable"
,
true
);
if
(
response
.
data
.
code
===
0
)
{
//存储返回回来的创建时间、修改时间
bill
.
getMasterData
().
setValue
(
"createTime"
,
response
.
data
.
content
.
billData
.
createTime
);
bill
.
getMasterData
().
setValue
(
"modifyTime"
,
response
.
data
.
content
.
billData
.
modifyTime
);
bill
.
getMasterData
().
setValue
(
"recver"
,
response
.
data
.
content
.
billData
.
recver
);
bill
.
getMasterData
().
setValue
(
"billCode"
,
response
.
data
.
content
.
billData
.
billCode
);
const
id
=
response
.
data
.
content
.
billData
.
id
;
GMS
.
vbus
.
$Message
.
success
(
"暂存成功"
);
GMS
.
vbus
.
$emit
(
'change-form-state'
,
{
state
:
'readOnly'
,
billId
:
id
})
GMS
.
vbus
.
$emit
(
"saveSuccess"
,
buidData
,
param
);
}
else
{
response
.
data
.
message
&&
GMS
.
vbus
.
$Message
.
error
({
content
:
errorMessageUtil
.
tempSaveAction
.
getErrorMessage
(
response
.
data
.
message
),
duration
:
3
});
}
}
}).
catch
(()
=>
{
});
},
}
}
develop/@gms/gms-plugin-billexpand/src/actions/util/errorMessageUtil.js
View file @
c951a8a7
...
@@ -37,6 +37,22 @@ export default {
...
@@ -37,6 +37,22 @@ export default {
return
errorPreMessage
===
""
?
this
.
commonMessage
:
errorPreMessage
+
this
.
getErrorBaseDataName
(
a
);
return
errorPreMessage
===
""
?
this
.
commonMessage
:
errorPreMessage
+
this
.
getErrorBaseDataName
(
a
);
}
}
},
},
tempSaveAction
:
{
commonMessage
:
"暂存失败,请联系系统管理员。"
,
getErrorMessage
(
a
)
{
if
(
!
a
||
!
_
.
isString
(
a
))
{
return
this
.
commonMessage
;
}
let
errorPreMessage
=
""
;
for
(
let
i
=
0
;
i
<
this
.
saveAction
.
customMessageList
.
length
;
i
++
)
{
if
(
a
.
indexOf
(
this
.
saveAction
.
customMessageList
[
i
].
preMessage
)
>
-
1
)
{
errorPreMessage
=
this
.
saveAction
.
customMessageList
[
i
].
convertMessage
;
break
;
}
}
return
errorPreMessage
===
""
?
this
.
commonMessage
:
errorPreMessage
+
this
.
saveAction
.
getErrorBaseDataName
(
a
);
}
},
submitAction
:
{
submitAction
:
{
commonMessage
:
"提交失败,请联系系统管理员。"
,
commonMessage
:
"提交失败,请联系系统管理员。"
,
customMessageList
:
[
customMessageList
:
[
...
...
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