'
if (i != data.length - 1) {
if (data[i].node != data[i + 1].node) {
_html += ''
}
}
}
if (!_html) {
_html = _self._localeStr.WEB_NOAPPROVALRECORDS
}
$('#approveHisInfo ul')[0].innerHTML = _html
}
})
},
showbtn: function () {
waf('#dynamicSign').wafLinkButton('option', 'hidden', !assign.dynamicSign)
waf('#appendActivity').wafLinkButton(
'option',
'hidden',
!assign.allowAppendActivity || approvetype == 'manualdecision'
)
waf('#jumpto').wafLinkButton('option', 'hidden', !assign.allowJumpTo)
waf('#kickback').wafLinkButton('option', 'hidden', !assign.allowKickBack)
waf('#deliver').wafLinkButton('option', 'hidden', !assign.allowDeliver)
waf('#YZJShare').wafLinkButton('option', 'hidden', true)
if (assign.allowJumpTo || assign.allowKickBack) {
var assignId = assign.assignId
waf.doPost({
url:
waf.getContextPath() +
'/common/tree.do?method=getJumpAndKickBackModel',
async: false,
data: { assignId: assignId },
success: function (data) {
if (assign.allowJumpTo) {
waf('#jumpto').wafLinkButton('option', 'hidden', !data.jumpTo)
}
if (assign.allowKickBack) {
waf('#kickback').wafLinkButton('option', 'hidden', !data.kickBack)
}
}
})
}
if (
assign.canSpecifyNextPerformer ||
assign.mustShowPostActivities ||
assign.showNextP
) {
if (assign.mustShowPostActivities || assign.showNextP) {
waf(nextActIndex).wafCheckbox('option', 'checked', true)
}
} else {
waf(nextActIndex).wafCheckbox('option', 'hidden', true)
}
if (approvetype == 'batchapprove') {
waf('#btnImage').wafLinkButton('option', 'hidden', false)
waf('#btnBill').wafLinkButton('option', 'hidden', false)
}
if (approvetype == 'approve') {
waf('#save').wafLinkButton('option', 'hidden', false)
}
},
setselnextperson: function (actId, name, id) {
var ps = {}
if (selnextPersons[actId]) {
ps = selnextPersons[actId]
if (ps[id]) {
return
}
}
ps[id] = { number: '', name: name, id: id }
selnextPersons[actId] = ps
},
loadNextActs: function () {
_private.getnextacts()
var nextActs = assign.nextActs
_private.innerloadNextActs(nextActs)
},
innerloadNextActs: function (nextActs, selectAct) {
var table = $('#nextActList')
var _innerhtml = ''
if (nextActs) {
var actTitles = {}
if (nextActs.length == 0) {
_innerhtml +=
'
' + _self._localeStr.WEB_NOSETACTIVITYPERSON + '
'
$(_private.modifyNextAct).wafLinkButton('option', 'hidden', true)
} else {
var hasAct = false
var selectActobj = {}
if (selectAct) {
for (var actid in selectAct) {
selectActobj[actid] = actid
}
}
for (var i = 0; i != nextActs.length; i++) {
var act = nextActs[i]
var num = 0
var actId = act.actId
var candidateselected = act.candidateselected
if (!selectActobj[actId]) {
for (var id in candidateselected) {
_private.setselnextperson(actId, candidateselected[id], id)
num++
}
}
if (_private.isPredict && !act.isPredict) {
continue
}
hasAct = true
var actKey = act.actKey
var actName = act.actName
var isAllPersonAsPerformer = act.isAllPersonAsPerformer
var persons = act.persons
var count = act.count
var issel = false
var title = ''
if (num > 0) {
issel = true
}
_innerhtml +=
"
" +
actName +
"
"
if (issel) {
_innerhtml += _self._localeStr.WEB_SELECTED
var j = 0
for (var id in candidateselected) {
if (j > 0) {
title += '、'
}
title += candidateselected[id]
if (j > 2) {
j++
continue
}
if (j > 0) {
_innerhtml += '、'
}
_innerhtml +=
"" +
candidateselected[id] +
''
j++
}
actTitles[actId] = title
if (j > 2) {
_innerhtml +=
_self._localeStr.WEB_ANDSOON + j + _self._localeStr.WEB_PEOPLE
}
} else {
if (count > 0) {
_innerhtml += ''
var j = 0
for (var id in persons) {
if (j > 0) {
title += '、'
}
title += persons[id]
if (j > 2) {
_innerhtml +=
_self._localeStr.WEB_ANDSOON +
count +
_self._localeStr.WEB_PEOPLE
break
}
if (j > 0) {
_innerhtml += '、'
}
_innerhtml +=
"" +
persons[id] +
''
j++
}
actTitles[actId] = title
} else {
_innerhtml += _self._localeStr.WEB_UNSELECTEDPERSON
}
}
_innerhtml += '
'
}
if (!hasAct) {
_innerhtml += '
' + _self._localeStr.WEB_POINTNEXTTIP + '
'
}
$(_private.modifyNextAct).wafLinkButton('option', 'hidden', false)
}
table.html(_innerhtml)
for (var actTitle in actTitles) {
$('#' + actTitle).attr('title', actTitles[actTitle])
}
}
},
getOpinion: function (actInstId, assignId, billId) {
var params = {}
params.actInstId = actInstId
params.assignId = assignId
params.billId = billId
params.type = approvetype
waf.doPost({
url: waf.getContextPath() + '/workflow/approve.do?method=getOpinion',
data: params,
success: function (data) {
if (
data != null &&
data != '' &&
data.option != null &&
data.option != ''
) {
$('#approveOpinionInfo span').text(data.option)
} else {
$('#approveOpinionInfo').hide()
}
}
})
},
supportMulti: function () {
$('#approveDeliverBtn span').text(_self._localeStr.WEB_DELIVER)
$('#approvePassBtn span').text(_self._localeStr.WEB_CIRCULATEBTN)
$('#approveAppendBtn span').text(_self._localeStr.WEB_ADDSIGN)
$('#approveDynamicSignBtn span').text(_self._localeStr.WEB_CONTERSIGNED)
$('#approveSaveBtn span').text(_self._localeStr.WEB_SAVE)
$('#approveSubmitBtn span').text(_self._localeStr.WEB_SUBMIT)
$('#btnUpload').prepend(_self._localeStr.WEB_UPLOADATTACH)
$('#attachmul1').prepend(_self._localeStr.WEB_ATTCHNUM)
$('#attchmul2').prepend(_self._localeStr.WEB_VIEWDETAIL)
$('#attachmul3').prepend(_self._localeStr.WEB_ATTCHGE)
$('#attchment').append($('.attchmentnuminfo'))
$('#attchment').append($('#upload'))
$('#myPhraseInfo .edit').text(_self._localeStr.WEB_SAVE)
$('#myPhraseInfo .backprevious').text(_self._localeStr.WEB_BACK)
$('#myPhraseInfo .commit').text(_self._localeStr.WEB_DETERMINE)
$('#myPhrasetext').prop(
'placeholder',
_self._localeStr.WEB_ENTER_COMMENTS
)
},
initApprove: function () {
if (assign.riskInsight) {
_private.initRiskInsight()
} else {
waf('#riskInsight').wafTab('remove')
}
_private.initEsignature()
_private.initCCPerson()
_private.showbtn()
_private.initBillPage()
_private.initAttachment()
_private.initOperateIframe()
_private.initAbstractAndPhrase()
_private.initApprovePolicy()
},
initBatchapprove: function () {
_private.initEsignature()
_private.showbtn()
locationurl.billIds = decodeURIComponent(parent.window.billIDs)
locationurl.assignmentIds = parent.window.assignmentIDs
_private.getbatchlist()
_private.initAbstractAndPhrase()
_private.initApprovePolicy()
waf('#attchment').wafSection('option', 'hidden', true)
$('#upload').remove()
$('#operateInfo').remove()
$('.attchmentnuminfo').remove()
},
initManualdecision: function () {
_private.initManualdecisionNextAct()
_private.showbtn()
_private.initBillPage()
_private.initAttachment()
_private.initOperateIframe()
_private.initDecisionDescAndVal()
},
initPassComent: function () {
if (assign.passcoment != null) {
waf('#passComentOpinion').val(assign.passcoment)
}
if (assign.isFeedBack) {
waf('#sendmsgs').wafCheckbox('disable')
waf('#sendmails').wafCheckbox('disable')
}
waf('#submit').wafLinkButton('option', 'hidden', assign.isFeedBack)
waf('#passAssignment').wafLinkButton(
'option',
'hidden',
assign.againPass === 'false'
)
_private.initBillPage()
_private.initAttachment()
_private.initOperateIframe()
},
initManualdecisionNextAct: function () {
nextActIndex = '#nextAct1'
_private.modifyNextAct = '#modifynextAct1'
if (waf(nextActIndex).wafCheckbox('isChecked')) {
_private.loadNextActs()
}
},
initRiskInsight: function () {
try {
mod.use('billInsight', function () {
riskInsight = true
$('#form').append(
''
)
$('#li_approveTask').css('width', '50%')
$('#li_riskInsight').show()
billInsightOption = _private.getWeakRisk()
_private.updateBillInsightNum(billInsightOption)
$(window).resize(function () {
_private.resizeBillInsight(true)
})
})
} catch (e) {
console.log(_self._localeStr.WEB_CONSOLETEXT)
}
},
initCCPerson: function () {
if (assign.allowCC) {
$('#panelCC').show()
}
if (assign.ccPersonIds != null && assign.ccPersonName != null) {
waf('#textCC').prop('personIds', assign.ccPersonIds)
waf('#textCC').val(assign.ccPersonName)
}
},
initEsignature: function () {
if (
!assign.isEsignature ||
assign.esignatureAttachId == undefined ||
assign.esignatureAttachId == ''
) {
$('#panel6').remove()
} else {
var _html =
""
$('#esigndiv')[0].innerHTML = _html
}
},
initBillPage: function () {
if (assign.messageDigest) {
try {
_private.messageDigest()
} catch (e) {
console.log(_self._localeStr.WEB_BILLINITFAILED)
}
} else {
if (!assign.billEditUrl || assign.billEditUrl == 'nobill.html') {
assign.billEditUrl = '/easweb/webviews/workflow/nobill.html?'
}
if (approvetype == 'passComent' && msgId) {
assign.billEditUrl =
assign.billEditUrl + '&msgId=' + encodeURIComponent(msgId)
}
_private.displayBillInfo(assign.billEditUrl)
}
},
initAttachment: function () {
waf('#attachmentBtn').wafLinkButton(
'option',
'hidden',
assign.attachDisabled
)
_private.refreshAttachCountInner(assign.attachmentCount)
},
initOperateIframe: function () {
var url =
'/easweb/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.approveRelatedInfo&isshowapprove=true&assignmentId=' +
assign.assignId
waf('#operateiframe').wafIframe('option', 'src', url)
},
initApprovePolicy: function () {
_private.getPolicy(assign.approveValue)
_private.getDefaultOption()
if (assign.id) {
waf('#approveResult').wafRadioGroup('setValue', assign.approveResult)
waf('#policy').wafSelect('setValue', assign.handlerOpinion)
} else {
waf('#approveResult').wafRadioGroup('setValue', 'true')
}
},
initAbstractAndPhrase: function () {
if (assign.absStr) {
waf('#optionalSection').wafSection(
'option',
'title',
_self._localeStr.WEB_PROCESSSUMMARY
)
waf('#optionalSection').wafSection('option', 'hidden', false)
$('#description').text(assign.absStr)
}
_private.getphrase()
$('#myPhraseList').on('click', 'li', function (e) {
_private.clickPhrase(e)
})
$('#myPhraseList').on('dblclick', 'li', function (e) {
_private.dblclickPhrase(e)
})
$('#myPhraseList').on('click', 'li i', function (e) {
_private.phrasedel(e)
})
},
initDecisionDescAndVal: function () {
if (assign.decisionDesc) {
waf('#optionalSection').wafSection(
'option',
'title',
_self._localeStr.WEB_DECISONDESC
)
waf('#optionalSection').wafSection('option', 'hidden', false)
$('#description').text(assign.decisionDesc)
_private.changeBillHeight(85, false)
}
_private.setmanualdecision()
},
initCalProcDiagram: function () {
var url =
'/easweb/webviews/workflow/calProcDiagramNew.jsp?procInstId=' +
assign.procInstId +
'&actinstId=' +
assign.actInstId +
'&newPage=' +
assign.newPage
waf('#' + _private.charFrameId).wafIframe('option', 'src', url)
var urlWin =
'/easweb/webviews/workflow/calProcDiagram.jsp?procInstId=' +
assign.procInstId +
'&actinstId=' +
assign.actInstId
waf('#chartIframe').wafIframe('option', 'src', urlWin)
$('#chart').click(function () {
$('#chart').hide()
})
$('#chartClose').click(function () {
$('#chart').hide()
})
$('#openChartIframe').click(function () {
$('#chart').show()
})
var times = 0
var interval = setInterval(function () {
if (window.frames[_private.charFrameId]) {
var num = window.frames[_private.charFrameId].num
if (num > 0) {
var iWidth = window.innerWidth * (4 / 5)
var rowNum = parseInt(iWidth / 176)
var calcHeight = Math.ceil(num / rowNum) * 140
var winHeight = ''
if (top == parent.parent) {
winHeight = window.innerHeight
} else {
winHeight = window.screen.availHeight - 120
}
var iHeight = winHeight * (4 / 5)
if (calcHeight < iHeight) {
iHeight = calcHeight
}
var iTop = (winHeight - 70 - iHeight) / 2
var iLeft = (window.innerWidth - 10 - iWidth) / 2
$('#chartIframe').css({
'margin-left': iLeft,
'margin-top': iTop,
width: iWidth,
height: iHeight
})
}
}
times++
if (times > 100) {
clearInterval(interval)
}
}, 100)
},
initPageLayout: function () {
if (assign.newPage) {
$('#predictionChart').remove()
_private.charFrameId = 'predictionChartIframeNew'
_private.initBtnNew()
} else {
$('#predictionChartNew').remove()
}
if (
locationurl.isOpenNewTab != undefined &&
locationurl.isOpenNewTab == 'true'
) {
$('#nextActList').css('height', '20vh')
}
},
initCalProcDiagramPanel: function () {
if (approvetype == 'approve') {
_private.initCalProcDiagram()
} else {
$('#chart').remove()
$('#predictionChart').remove()
$('#predictionChartNew').remove()
}
},
initSection: function () {
if (approvetype != 'batchapprove') {
waf('#predictionChart').wafSection(
'option',
'onopen',
function (event) {
_private.changeBillHeight(50, false)
}
)
waf('#predictionChart').wafSection(
'option',
'onclose',
function (event) {
_private.changeBillHeight(50, true)
}
)
waf('#operateInfo').wafSection('option', 'onopen', function (event) {
_private.changeBillHeight(220, false)
})
waf('#operateInfo').wafSection('option', 'onclose', function (event) {
_private.changeBillHeight(220, true)
})
waf('#optionalSection').wafSection(
'option',
'onopen',
function (event) {
_private.changeBillHeight(60, false)
}
)
waf('#optionalSection').wafSection(
'option',
'onclose',
function (event) {
_private.changeBillHeight(60, true)
}
)
}
},
initZoomTool: function () {
$('#onClose').show()
$('#tabs_ul li')
.eq($('#tabs_ul li').length - 1)
.append($('#onClose'))
$('#splitPanel_LeftSplitPanel').prepend($('#onOpen'))
$('#onClose').bind('click', function () {
$('#splitPanel').height($('#splitPanel_LeftSplitPanel').height())
rightPanelWidth = $('#splitPanel_RightSplitPanel').width()
leftPanelWidth = $('#splitPanel_LeftSplitPanel').width()
$('#splitPanel_RightSplitPanel').css('width', '0%')
$('#splitPanel_LeftSplitPanel').css('width', '100%')
$('#onOpen').show()
if (riskInsight && _private.curTab == 'riskInsight') {
$('.billInsight_cardPanel').css('display', 'none')
}
if (approvetype == 'batchapprove' && !assign.batchApproveUrl) {
var newWidth = $('#queryGrid').wafGrid('getGridParentWidth')
$('#queryGrid').jqGrid('setGridWidth', newWidth)
}
})
$('#onOpen').bind('click', function () {
$('#onOpen').hide()
$('#splitPanel_RightSplitPanel').css('width', rightPanelWidth)
$('#splitPanel_LeftSplitPanel').css('width', leftPanelWidth)
if (riskInsight && _private.curTab == 'riskInsight') {
$('.billInsight_cardPanel').show()
}
if (approvetype == 'batchapprove' && !assign.batchApproveUrl) {
var newWidth = $('#queryGrid').wafGrid('getGridParentWidth')
$('#queryGrid').jqGrid('setGridWidth', newWidth)
}
})
$('#onOpen').bind('hover', function () {
$('#onOpen').css('opacity', 1)
})
},
pageOnload: function (e) {
$('body').ready(function () {
_private.supportMulti()
_private.showtab()
var billId = assign.billId
if (approvetype == 'approve') {
_private.initApprove()
} else {
if (approvetype == 'batchapprove') {
_private.initBatchapprove()
if (locationurl && locationurl.assignmentIds) {
var actionUrl =
waf.getContextPath() +
'/activityProperty.do?method=addAssignReadTime'
var params = {}
params.assignIds = locationurl.assignmentIds
waf.doPost({
url: actionUrl,
data: params,
async: true,
success: function (data) {}
})
}
} else {
if (approvetype == 'manualdecision') {
_private.initManualdecision()
} else {
if (approvetype == 'passComent') {
_private.initPassComent()
billId = passId
}
}
}
}
_private.initSection()
_private.initPageLayout()
_private.initCalProcDiagramPanel()
_private.getOpinion(assign.actInstId, assign.assignId, billId)
_private.setsendmailormsg(
assign.isOpenMessageSendOnUI,
assign.notifyNextBySMS,
assign.notifyNextByMail
)
if (assign.newPage) {
_private.initZoomTool()
}
_private.resizePage()
window.scrollTo(0, 0)
var newTab = waf.getUrlParams(document.URL).isOpenNewTab
if (newTab) {
$('#operateInfo').css('margin', '3px 5px 5px 0')
}
})
},
initBtnNew: function () {
var submitBtn = waf('#submit').wafLinkButton('option', 'hidden')
$('#toolBar .ui-toolbar-ul').css('float', 'right')
if (approvetype == 'approve' || approvetype == 'batchapprove') {
if (approvetype == 'approve') {
var offset =
$('#panelNew1').width() - ($('#approveSaveBtn').width() * 2 + 20)
if (offset > 0) {
$('#approveSaveBtn').css('margin-left', offset / 2)
}
} else {
$('#approveSubmitBtn').css('float', 'right')
}
$('#toolBarNew1').show()
$('#panelNew1').show()
$('#labelapproveResult_label').hide()
waf('#approveSubmitBtn').wafLinkButton('option', 'hidden', submitBtn)
waf('#approveSaveBtn').wafLinkButton(
'option',
'hidden',
waf('#save').wafLinkButton('option', 'hidden')
)
waf('#approveDeliverBtn').wafLinkButton(
'option',
'hidden',
waf('#deliver').wafLinkButton('option', 'hidden')
)
waf('#approvePassBtn').wafLinkButton(
'option',
'hidden',
waf('#passAssignment').wafLinkButton('option', 'hidden')
)
waf('#approveKickbackBtn').wafLinkButton(
'option',
'hidden',
waf('#kickback').wafLinkButton('option', 'hidden')
)
waf('#approveAppendBtn').wafLinkButton(
'option',
'hidden',
waf('#appendActivity').wafLinkButton('option', 'hidden')
)
waf('#approveDynamicSignBtn').wafLinkButton(
'option',
'hidden',
waf('#dynamicSign').wafLinkButton('option', 'hidden')
)
waf('#approveJumpBtn').wafLinkButton(
'option',
'hidden',
waf('#jumpto').wafLinkButton('option', 'hidden')
)
} else {
if (approvetype == 'manualdecision') {
$('#panelNew3').show()
var b = waf('#deliver').wafLinkButton('option', 'hidden')
if (!b) {
$('#toolBarNew3').show()
}
waf('#decisionDeliverBtn').wafLinkButton(
'option',
'hidden',
waf('#deliver').wafLinkButton('option', 'hidden')
)
waf('#decisionSubmitBtn').wafLinkButton('option', 'hidden', submitBtn)
} else {
if (approvetype == 'passComent') {
$('#panelNew2').show()
var b = waf('#passAssignment').wafLinkButton('option', 'hidden')
if (!b) {
$('#toolBarNew2').show()
}
waf('#passPassBtn').wafLinkButton('option', 'hidden', b)
waf('#passSubmitBtn').wafLinkButton('option', 'hidden', submitBtn)
}
}
}
waf('#submit').wafLinkButton('option', 'hidden', true)
waf('#save').wafLinkButton('option', 'hidden', true)
waf('#deliver').wafLinkButton('option', 'hidden', true)
waf('#passAssignment').wafLinkButton('option', 'hidden', true)
waf('#kickback').wafLinkButton('option', 'hidden', true)
waf('#appendActivity').wafLinkButton('option', 'hidden', true)
waf('#dynamicSign').wafLinkButton('option', 'hidden', true)
waf('#jumpto').wafLinkButton('option', 'hidden', true)
if (approvetype != 'batchapprove') {
$('#assignTitle').show()
$('#assignTitle').css(
'width',
$('#toolBar').width() - $('#toolBar .ui-toolbar-ul').width()
)
$('#assignTitle').text(assign.title)
$('#assignTitle').prop('title', assign.title)
}
},
changePolicy: function (event, ui) {
_private.setPolicy(ui.current)
if (ui.current == 'false') {
$('#panel').hide()
} else {
$('#panel').show()
}
},
deliver: function (event, value) {
var para = {}
if (approvetype == 'batchapprove') {
para.sourceID = _private.getbatchid().assignIds
} else {
para.sourceID = assign.assignId
}
wfCommonUtil.deliverAssignment(para)
},
passAssignment: function (event, value) {
var para = {}
if (approvetype == 'batchapprove') {
var info = _private.getbatchid()
para.sourceID = info.assignIds
para.bizObjID = info.billIds
} else {
para.sourceID = assign.assignId
para.bizObjID = assign.billId
}
wfCommonUtil.passComment(para)
},
kickback: function (event, value) {
var assignid = ''
if (approvetype == 'batchapprove') {
assignid = _private.getbatchid().assignIds
} else {
assignid = assign.assignId
}
var url =
waf.getContextPath() +
'/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.kickBackPage&assignmentId=' +
encodeURIComponent(assignid)
wfCommonUtil.windowopen(url, _self._localeStr.WEB_REJECT, 450, 320)
},
jumpto: function (event, value) {
var assignid = ''
if (approvetype == 'batchapprove') {
assignid = _private.getbatchid().assignIds
} else {
assignid = assign.assignId
}
var url =
waf.getContextPath() +
'/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.jump&assignmentId=' +
encodeURIComponent(assignid)
wfCommonUtil.windowopen(url, _self._localeStr.WEB_JUMP, 450, 281)
},
dynamicSign: function (event, value) {
var assignid = ''
if (approvetype == 'batchapprove') {
assignid = _private.getbatchid().assignIds
} else {
assignid = assign.assignId
}
var url =
waf.getContextPath() +
'/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.dynamicSignPage&assignmentId=' +
encodeURIComponent(assignid)
wfCommonUtil.windowopen(
url,
_self._localeStr.WEB_COUNTERSIGNPART,
450,
281
)
},
appendActivity: function (event, value) {
var billId = ''
var assignId = ''
if (approvetype == 'batchapprove') {
var info = _private.getbatchid()
assignId = info.assignIds
billId = info.billIds
} else {
assignId = assign.assignId
billId = assign.billId
}
var url =
waf.getContextPath() +
'/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.appendSignPage&assignmentId=' +
encodeURIComponent(assignId) +
'&billIds=' +
encodeURIComponent(billId) +
'&isAppended=' +
assign.isAppended
if (assign.appendMode) {
url += '&appendMode=' + assign.appendMode[0]
}
if (assign.routeMode) {
url += '&routeMode=' + assign.routeMode[0]
}
wfCommonUtil.windowopen(url, _self._localeStr.WEB_COUNTERSIGN, 520, 746)
},
modifynextAct: function (event, value) {
_private.setmodifynextAct()
},
setselnextactperson: function (resultStr) {
_private.innerloadNextActs(assign.nextActs, resultStr)
for (var actid in resultStr) {
var ps = resultStr[actid]
var _innerhtml = _self._localeStr.WEB_SELECTED
var j = 0
if (_private.isEmptyObject(ps)) {
delete selnextPersons[actid]
} else {
var title = ''
for (var id in ps) {
var person = ps[id]
var name = person.name
_private.setselnextperson(actid, name, id)
if (j > 0) {
title += '、'
}
title += name
if (j > 2) {
j++
continue
}
if (j > 0) {
_innerhtml += '、'
}
_innerhtml +=
"" + name + ''
j++
}
if (j > 2) {
_innerhtml +=
_self._localeStr.WEB_ANDSOON + j + _self._localeStr.WEB_PEOPLE
}
$('#' + actid).html(_innerhtml)
$('#' + actid).attr('title', title)
}
}
},
isEmptyObject: function (obj) {
for (var key in obj) {
return false
}
return true
},
getphrase: function () {
waf.doPost({
url:
waf.getContextPath() +
'/workflow/approve.do?method=getAppMyPhraseList',
success: function (data) {
var myPhraseList = $('#myPhraseList .showdel')
myPhraseList.html('')
for (var i = 0; i < data.length; i++) {
var row = $('')
row.attr({ 'data-id': data[i].id, title: data[i].phraseText })
row.text(data[i].phraseText)
row.append('')
myPhraseList.append(row)
}
}
})
},
clickPhrase: function (e) {
$('#myPhraseInfo li').removeClass('cur')
var targetElem = $(e.target)
targetElem.addClass('cur')
$('#myPhrasetext').val(targetElem.attr('title'))
$('#myPhrasetext').attr('data-id', targetElem.attr('data-id'))
},
dblclickPhrase: function (e) {
var itemval = $(e.target).attr('title')
$('#approveOpinion').val(itemval)
$('#myPhraseInfo li').removeClass('cur')
$('#myPhrasetext').attr('data-id', '')
$('#myPhrasetext').val('')
$('#phrasePanel').hide()
},
phrasesure: function (e) {
var text = $('#myPhrasetext').val()
if (text != null && text.length > 1000) {
_self.showInfo(_self._localeStr.WEB_APPROVALCOMMENTS_TOOLONG)
return null
}
$('#approveOpinion').val(text)
$('#myPhraseInfo li').removeClass('cur')
$('#myPhrasetext').attr('data-id', '')
$('#myPhrasetext').val('')
$('#phrasePanel').hide()
},
phraseback: function (e) {
$('#myPhraseInfo li').removeClass('cur')
$('#myPhrasetext').attr('data-id', '')
$('#myPhrasetext').val('')
$('#phrasePanel').hide()
},
myPhrase: function (event, value) {
$('#phrasePanel').show()
$('#myPhrasesection .ui-jqgrid-bdiv').css('height', 'auto')
},
addphrase: function () {
var text = $('#myPhrasetext').val()
if (text != null && text.length > 1000) {
_self.showInfo(_self._localeStr.WEB_APPROVALCOMMENTS_TOOLONG)
return null
}
var param = {}
var rowid = $('#myPhrasetext').attr('data-id')
var value = $('#myPhrasetext').val()
if (!value) {
return
}
if (rowid) {
param.method = 'updateOption'
param.opId = rowid
param.opName = value
} else {
param.phraseTxt = value
param.method = 'saveMyPhrase'
}
waf.doPost({
url: waf.getContextPath() + '/workflow/approve.do',
data: param,
success: function (data) {
_private.getphrase()
_self.showSuccess(_self._localeStr.WEB_ADDCOMMONCOMMENTS)
}
})
},
phrasedel: function (e) {
var param = {}
param.phraseIds = $(e.target).parent().attr('data-id')
$('#myPhrasetext').attr('data-id', '')
$('#myPhrasetext').val('')
waf.doPost({
url: waf.getContextPath() + '/workflow/approve.do?method=delMyPhrase',
data: param,
success: function (data) {
_private.getphrase()
_self.showSuccess(_self._localeStr.WEB_DELETECOMMONCOMMENTS)
}
})
},
pageOnRenderBefore: function (e) {
assign = _self.getPageInitData()
if (approvetype != 'passComent') {
_private.initCAConfig(assign.CAConfig)
}
var title = ''
if (approvetype == 'batchapprove') {
title = _self._localeStr.WEB_BATCHAPPROVAL
} else {
title = assign.title
}
_self.changeTitle(title)
},
phraseadd: function (e) {
var datarow = { phraseText: '' }
waf('#myPhrasegrid').wafGrid('addRow', { data: datarow })
},
viewProcessDiagram: function (event, value) {
var para = {}
if (approvetype == 'batchapprove') {
var assignIds = _private.getbatchid().assignIds
if (assignIds.split(';').length != 1) {
_self.showInfo(_self._localeStr.WEB_SELECTARECORD)
return false
}
para.sourceID = assignIds.split(';')[0]
} else {
para.sourceID = assign.assignId
}
wfCommonUtil.viewProcessDiagram(para)
},
reloadTranId: function () {
var approveResult = waf('#approveResult').wafRadioGroup('getValue')
var policy = waf('#policy').wafSelect('getValue')
var ispass
if (approveResult == 'false') {
ispass = false
} else {
if (approveResult == 'true') {
ispass = true
}
}
if (assign) {
var approveValueStr = assign.approveValue
if (approveValueStr == null || approveValueStr == '') {
approveValueStr =
'0;' +
_self._localeStr.WEB_AGREE +
';' +
_self._localeStr.WEB_AGREE +
';:1;' +
_self._localeStr.WEB_DISAGREE +
';' +
_self._localeStr.WEB_DISAGREE +
';'
}
var strs = approveValueStr.split(':')
for (var i = 0; i < strs.length; i++) {
var strTemp = strs[i].split(';')
if (strTemp.length != 4) {
continue
}
if (ispass && policy == strTemp[0]) {
transId = strTemp[3]
return
}
}
}
},
changeselPolicy: function (event, ui) {
_private.reloadTranId()
if (waf(nextActIndex).wafCheckbox('isChecked')) {
_private.loadNextActs()
}
},
getnextacts: function () {
var param = {}
param.assignId = assign.assignId
param.associatedLine = transId
param.isPredict = _private.isPredict
param.isNewProcessCenter = true
waf.doPost({
url:
waf.getContextPath() + '/common/tree.do?method=findPostParticipants',
data: param,
async: false,
success: function (data) {
assign.nextActs = data
}
})
},
showtab: function () {
if (approvetype == 'approve' || approvetype == 'batchapprove') {
$('#tabs').wafTabs('remove', '#manualdecision')
$('#tabs').wafTabs('remove', '#passComent')
} else {
if (approvetype == 'manualdecision') {
$('#tabs').wafTabs('remove', '#approveTask')
$('#tabs').wafTabs('remove', '#passComent')
} else {
if (approvetype == 'passComent') {
$('#tabs').wafTabs('remove', '#approveTask')
$('#tabs').wafTabs('remove', '#manualdecision')
}
}
}
if (approvetype != 'approve') {
waf('#riskInsight').wafTab('remove')
}
},
setmanualdecision: function () {
var items = assign.decisionItems
var opinions = assign.decisionOpinions
var _html = ''
var itemArr = items.split(';')
var opinionArr = new Array()
if (!opinions) {
var opinionItem = ''
for (var i = 0; i < itemArr.length; i++) {
opinionItem += i + 1
if (i < itemArr.length - 1) {
opinionItem += ';'
}
opinionArr.push(i + 1)
}
assign.decisionOpinions = opinionItem
} else {
opinionArr = opinions.split(';')
}
var json = []
for (var i = 0; i < itemArr.length; i++) {
var name = itemArr[i]
var val = opinionArr[i]
var para = {}
para.value = val + '_' + i
para.alias = name
json.push(para)
}
waf('#radioDecision').wafRadioGroup('setItems', null, json)
waf('#radioDecision').wafRadioGroup('setValue', json[0].value)
},
nextActs: function (event, ui) {
_private.shownextActs('modifynextAct1', ui)
},
nextAct: function (event, ui) {
_private.shownextActs('modifynextAct', ui)
},
modifynextActs: function (event, value) {
_private.setmodifynextAct()
},
setmodifynextAct: function () {
var jsonval = ''
if (selnextPersons == null || selnextPersons.length == 0) {
jsonval = ''
} else {
jsonval = JSON.stringify(selnextPersons)
}
waf.window.open({
url:
waf.getContextPath() +
'/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.setNextAct&debug=true&assignmentId=' +
encodeURIComponent(assign.assignId) +
'&selnextPersons=' +
encodeURIComponent(jsonval) +
'&asso=' +
transId +
'&isPredict=' +
_private.isPredict,
openType: 'iframe',
method: 'POST',
data: {},
modal: true,
title: _self._localeStr.WEB_NEXTACTIVITY,
position: 'center',
width: 1020,
height: 580,
minHeight: 560,
minWidth: 1020,
iconCls: 'waf-ui-icon',
draggable: true,
resizable: true,
close: function (event, ui) {},
retValCallBack: function (resultData) {
if (
resultData &&
resultData.resultStr &&
resultData.resultStr.length > 0
) {
var resultStr = JSON.parse(resultData.resultStr)
selnextPersons = {}
_private.isPredict = resultData.isPredict
_private.setselnextactperson(resultStr)
}
}
})
},
getbatchlist: function () {
if (assign.batchApproveUrl) {
var url =
waf.getContextPath() +
assign.batchApproveUrl +
'&hasToolbar=false&showCommonQuery=false'
var billIds = locationurl.billIds.split(';')
var temp = 'id%20in%20('
for (var i = 0; i < billIds.length; i++) {
if (billIds[i]) {
if (i == 0) {
temp += '%27' + encodeURIComponent(billIds[i]) + '%27'
} else {
temp += '%2C%27' + encodeURIComponent(billIds[i]) + '%27'
}
}
}
temp += ')'
$(
""
)
.insertAfter($('#billFrame'))
.append(
$("")
)
.append(
$("")
)
setTimeout(function () {
document.getElementById('framesrcbillform').submit()
}, 500)
var times = 0
var interval = setInterval(function () {
var frame = document.getElementById('billFrame')
$($(frame)[0].contentDocument.body)
.find('.ui-jqgrid')
.css({ margin: '0px', width: '100%' })
if (times > 600) {
clearInterval(interval)
}
times++
})
} else {
waf('#billFrame').remove()
var listinfo = {}
waf.doPost({
url:
waf.getContextPath() +
'/workflow/approve.do?method=getBatchApproveBillGrid',
data: { billIds: locationurl.billIds },
async: false,
success: function (data) {
listinfo = data
}
})
var headers = listinfo.headers
var list = listinfo.list
var fields = listinfo.fields
if (headers.length > 0) {
var colmodel = []
var paraid = { name: 'id', label: 'id', hidden: true, key: true }
colmodel.push(paraid)
for (var m = 0; m < headers.length; m++) {
var para = { name: fields[m], label: headers[m] }
colmodel.push(para)
}
var myGridoptions = {
id: 'queryGrid',
colModel: colmodel,
multiselect: true,
loadInit: false,
shrinkToFit: true
}
if (headers.length > 15) {
myGridoptions.shrinkToFit = false
}
var dom = waf.createDOM('grid', myGridoptions)
waf.appendDOM(waf('#panel5'), dom)
waf.initComponent('grid', myGridoptions, dom)
for (var i = 0; i < list.length; i++) {
for (var j in list[i]) {
if (list[i][j] != null && typeof list[i][j] == 'object') {
list[i][j] = list[i][j].alias
}
}
waf('#queryGrid').wafGrid('addRow', { data: list[i] })
}
}
}
},
shownextActs: function (nextactname, ui) {
if (ui.checked) {
$('.approve-next-persons').show()
_private.loadNextActs()
} else {
$('.approve-next-persons').hide()
waf('#' + nextactname).wafLinkButton('option', 'hidden', true)
selnextPersons = {}
}
},
submit: function (event, value) {
if (approvetype == 'approve') {
_private.confirmSumit('beforeInnerSubmit')
} else {
if (approvetype == 'manualdecision') {
_private.manualdecisionsubmit()
} else {
if (approvetype == 'batchapprove') {
_private.confirmSumit('batchSubmitForCA')
} else {
if (approvetype == 'passComent') {
_private.passComentsubmit()
}
}
}
}
},
confirmSumit: function (funcName) {
if (assign.enableMultiapproveConfirm == 'true') {
var ok = function () {
_private[funcName]()
}
var cancel = function () {
return
}
waf.msgBox.showConfirm({
title: _self._localeStr.WEB_MESSPROMPT,
summaryMsg: _self._localeStr.WEB_CONFIRMSUBMITAPPROVAL,
buttonType: 'ok-cancel',
buttonCallBack: [ok, cancel]
})
} else {
_private[funcName]()
}
},
passComentsubmit: function () {
var params = {}
params.parameter = sourceIDs
params.chksendMessage = 'yes'
if (waf('#sendmsgs').wafCheckbox('isChecked')) {
params.chksendMobile = 'yes'
}
if (waf('#sendmails').wafCheckbox('isChecked')) {
params.chksendMail = 'yes'
}
params.opinion = $('#passComentOpinion').val()
var option = $('#passComentOpinion').val()
if (option != null && option.length > 1000) {
_self.showInfo(_self._localeStr.WEB_FEEDBACKCOMMENTS_TOOLONG)
return null
}
waf.doPost({
url: waf.getContextPath() + '/passComment/get.do?method=commit',
data: params,
success: function (data) {
_self.showSuccess(_self._localeStr.WEB_DEEDBACKCIRCULATESUCCESS)
_private.backto()
}
})
},
initCAConfig: function (tCAConfig) {
caConfig.caConfigInfo = tCAConfig
if (
caConfig.caConfigInfo.isSignatureApprove === 'true' &&
caConfig.caConfigInfo.caType != '5'
) {
var initflag = initTopesa()
if (initflag != 0) {
waf.msgBox.showError(_self._localeStr.WEB_CAINITFAILED)
}
}
},
batchSubmitForCA: function () {
if (
caConfig.caConfigInfo.checkPassword === 'true' &&
caConfig.caConfigInfo.isSignatureApprove === 'true' &&
caConfig.caConfigInfo.caType != '5'
) {
_private.checkCAPassword(true)
} else {
_private.batchSubmit()
}
},
checkCAPassword: function (isBatch) {
var setcss = function () {
var item = parent.$('.ui-msgbox .ui-prompt .prompt')
if ($(item)) {
$(item).css({
height: '78px',
margin: '20px 0 20px 190px',
background:
'url(/easweb/webviews/workflow/img/waitpic.png) no-repeat'
})
}
}
setTimeout(setcss, 100)
var prmt = function (r, dialog) {
if (r) {
var res = -1
try {
res = checkPassword(r, caConfig.caConfigInfo.userName)
} catch (errMsg) {
_self.showInfo(
_self._localeStr.WEB_USBKEYCHECKPASSDETAIL + errMsg.message
)
return false
}
if (res != 0) {
_self.showInfo(_self._localeStr.WEB_USBKEYCHECKPASS)
} else {
if (isBatch) {
_private.batchSubmit()
} else {
_private.innerSubmit()
}
}
}
}
var cancel = function () {
return
}
waf.msgBox.showPrompt({
title: _self._localeStr.WEB_MESSPROMPT,
icon: 'prompt',
summaryMsg: _self._localeStr.WEB_INPUTUSBKEYPASSWORD,
buttonCallBack: [prmt, cancel]
})
parent.$('#waf-messageBox-prompt-input').prop('type', 'password')
},
batchSubmit: function () {
var info = _private.getbatchid()
if (info == null) {
return
}
_private._batchsubmit(info)
},
getbatchid: function () {
var info = {}
var assignIds = ''
var billIds = ''
var allbillIds = locationurl.billIds
var allassignmentIds = locationurl.assignmentIds
if (assign.batchApproveUrl) {
var frame = document.getElementById('billFrame')
billIds = $(frame)[0]
.contentWindow.waf('#queryGrid')
.dataGrid('getSelectedRows')
} else {
billIds = waf('#queryGrid').wafGrid('getSelectedRows')
}
if (billIds.length == 0) {
billIds = allbillIds
assignIds = allassignmentIds
} else {
for (var i = 0; i < allbillIds.split(';').length; i++) {
var allbillId = allbillIds.split(';')[i]
if (billIds.toString().indexOf(allbillId) > -1) {
if (assignIds != '') {
assignIds += ';'
}
assignIds += allassignmentIds.split(';')[i]
}
}
billIds = billIds.join(';')
}
info.billIds = billIds
info.assignIds = assignIds
return info
},
_batchsubmit: function (info) {
var approve = _private.getApprove()
if (!approve) {
return
}
var billIds = info.billIds
var assignIds = info.assignIds
approve.isSignatureApprove = caConfig.caConfigInfo.isSignatureApprove
if (
caConfig.caConfigInfo.isSignatureApprove === 'true' &&
caConfig.caConfigInfo.caType != '5'
) {
if (!_private.beforeBatchSubmitSigature(billIds)) {
return
}
approve.plainTextMap = caConfig.plainTextMap
approve.plainSignatureMap = caConfig.plainSignatureMap
}
var nextPersons = _private.getNextPersons()
if (!nextPersons) {
return
}
var ok = function () {
var params = {}
approve.nextActs = nextPersons
params.approve = JSON.stringify(approve)
params.assignIds = assignIds
params.billIds = billIds
waf.doPost({
url: waf.getContextPath() + '/common/tree.do?method=batchSubmits',
data: params,
success: function (data) {
if (data == 'OK') {
_self.showSuccess(_self._localeStr.WEB_BATCHAPPROVESUCCESS)
_private.backto()
} else {
_self.showInfo(_self._localeStr.WEB_PLEASEREFRESH)
}
}
})
}
var cancel = function () {
return
}
if (showerror != '') {
waf.msgBox.showConfirm({
title: _self._localeStr.WEB_MESSPROMPT,
summaryMsg: showerror,
buttonType: 'ok-cancel',
buttonCallBack: [ok, cancel]
})
} else {
ok()
}
},
getApprove: function () {
var opinion = waf('#approveOpinion').val()
if (
assign.needApproveOpinion &&
(opinion == null || opinion.trim() == '')
) {
_self.showInfo(_self._localeStr.WEB_APPROVALCOMMENTSNOBLANK)
return null
}
if (opinion != null && opinion.length > 1000) {
_self.showInfo(_self._localeStr.WEB_APPROVALCOMMENTSTOOLONG)
return null
}
var ispass = null
var approveResult = waf('#approveResult').wafRadioGroup('getValue')
if (approveResult == 'false') {
ispass = 'false'
if (assign.mustFillOpinionWhenDisagree == 'true') {
if (
opinion == null ||
opinion.trim() == '' ||
opinion == _self._localeStr.WEB_DISAGREE
) {
_self.showInfo(_self._localeStr.WEB_DISAGREEOPINION)
return null
}
}
} else {
if (approveResult == 'true') {
ispass = 'true'
}
}
var approve = {}
approve.assignId = assign.assignId
approve.id = assign.id
approve.opinion = opinion
var handlerOpinion = waf('#policy').wafSelect('getValue')
if (handlerOpinion) {
approve.handlerOpinion = handlerOpinion
} else {
approve.handlerOpinion = '0'
}
approve.handlerContent = waf('#policy').wafSelect('getSelectedAlias')
approve.approveResult = ispass
approve.transitionId = transId
approve.isSendSMS = waf('#sendmsg').wafCheckbox('isChecked')
? 'true'
: 'false'
approve.isSendMail = waf('#sendmail').wafCheckbox('isChecked')
? 'true'
: 'false'
if (assign.multiapproveinfoId) {
approve.id = assign.multiapproveinfoId
}
var isesignaturecheck = false
if (approvetype == 'approve' || approvetype == 'batchapprove') {
isesignaturecheck = waf('#esignature').wafCheckbox('isChecked')
} else {
if (approvetype == 'manualdecision') {
isesignaturecheck = waf('#esignature1').wafCheckbox('isChecked')
}
}
if (assign.isEsignature && isesignaturecheck) {
approve.esignatureid = assign.esignatureId
}
return approve
},
beforeBatchSubmitSigature: function (selectBillIds) {
var modelIDs = ''
var tbillIDs
if (Object.prototype.toString.call(selectBillIds) === '[object Array]') {
tbillIDs = selectBillIds
} else {
tbillIDs = selectBillIds.split(';')
}
for (var i = 0; i < tbillIDs.length; i++) {
if (modelIDs != '') {
modelIDs += ','
}
modelIDs += tbillIDs[i]
}
if (modelIDs === undefined || modelIDs == null || modelIDs === '') {
waf.msgBox.showError("bill id can't be null")
return false
}
var actionUrl =
waf.getContextPath() +
'/component/ca.do?method=getPlainTextFromDB&billIDs=' +
waf.encodeURIComponent(modelIDs) +
'&isFromWF=true'
waf.doPost({
url: actionUrl,
async: false,
success: function (data) {
if (data == null || data == '' || data == undefined) {
return false
} else {
caConfig.plainTextMap = data.plainTextMap
}
},
error: function (data) {
waf.msgBox.showError('getPlainTextFromDB failed')
return false
}
})
var arraySignature = ''
var billids = modelIDs.split(',')
for (var i = 0; i < billids.length; i++) {
var key = billids[i]
var signResult = -1
try {
signResult = signMessage(
caConfig.plainTextMap[key],
caConfig.caConfigInfo.userName
)
} catch (errMsg) {
_self.showInfo(_self._localeStr.WEB_SIGANATUREFAILED + errMsg.message)
return false
}
if (signResult == 1 || signResult == 2 || signResult == 3) {
if (signResult == 1 || signResult == 2) {
_self.showInfo(_self._localeStr.WEB_SIGAFAILEDUSBKEY)
}
return false
}
if (arraySignature != '') {
arraySignature += ','
}
arraySignature += signResult
}
caConfig.plainSignatureMap = arraySignature
return true
},
getNextPersons: function (isSave) {
var locale = waf.getContext().locale
var symbol = '。'
if (locale == 'l1') {
symbol = '.'
}
showerror = ''
var nextPersons = []
var ispass = waf('#approveResult').wafRadioGroup('getValue')
if (ispass == 'false') {
return nextPersons
}
var isnextact = waf(nextActIndex).wafCheckbox('isChecked')
var directActName = ''
if (isnextact) {
var num = 0
var index = 0
var directCount = 0
var directIsSel = false
for (var i = 0; i != assign.nextActs.length; i++) {
if (_private.isPredict && !assign.nextActs[i].isPredict) {
continue
}
var act = {}
act.actKey = assign.nextActs[i].actKey
act.persons = {}
var flag = false
directCount++
for (var actId in selnextPersons) {
if (actId == assign.nextActs[i].actId) {
var persons = selnextPersons[actId]
for (var id in persons) {
act.persons[id] = 'true'
flag = true
}
}
}
if (directCount == 1) {
directIsSel = flag
}
if (!flag) {
if (num < 3) {
if (showerror != '') {
showerror += '、'
}
showerror += assign.nextActs[i].actName
}
num++
if (num == 1) {
directActName = assign.nextActs[i].actName
}
} else {
nextPersons[index] = act
index++
}
}
if (num > 0) {
if (num > 2) {
showerror +=
_self._localeStr.WEB_ANDSOON + num + _self._localeStr.WEB_NODE
}
if (!isSave && assign.mustSetAllNextPerson) {
_self.showInfo(
_self._localeStr.WEB_NEXTACTIVITY + ':' + showerror + symbol
)
return null
}
if (
!isSave &&
assign.mustSetAllNextPersonDirectNull &&
!directIsSel
) {
_self.showInfo(
_self._localeStr.WEB_NEXTACTIVITY + ':' + directActName + symbol
)
return null
}
showerror += _self._localeStr.WEB_NOPARTICIPANTSUBMIT
}
}
return nextPersons
},
manualdecisionsubmit: function () {
var selectValue = waf('#radioDecision').wafRadioGroup('getValue')
if (selectValue) {
var selItems = $(
"#radioDecision input[value='" + selectValue + "']"
).next()[0].innerHTML
var params = {}
var nextPersons = _private.getNextPersons()
if (!nextPersons) {
return
}
var ok = function () {
nextPersons = JSON.stringify(nextPersons)
params.nextperson = nextPersons
params.assignId = assign.assignId
params.decisionTitle = assign.decisionName
params.decisionItems = assign.decisionItems
params.decisionDesc = assign.decisionDesc
params.decisionOpinions = assign.decisionOpinions
params.SelectedItems = selItems
params.SelectedOpinions = selectValue.substr(
0,
selectValue.indexOf('_')
)
waf.doPost({
url:
waf.getContextPath() + '/manualdecision/submit.do?method=submit',
data: params,
success: function (data) {
_self.showSuccess(_self._localeStr.WEB_DECISIONSUBMITSUCCESS)
_private.backto()
}
})
}
var cancel = function () {
return
}
if (showerror != '') {
waf.msgBox.showConfirm({
title: _self._localeStr.WEB_MESSPROMPT,
summaryMsg: showerror,
buttonType: 'ok-cancel',
buttonCallBack: [ok, cancel]
})
} else {
ok()
}
}
},
beforeInnerSubmit: function () {
if (
caConfig.caConfigInfo.checkPassword === 'true' &&
caConfig.caConfigInfo.isSignatureApprove === 'true' &&
caConfig.caConfigInfo.caType != '5'
) {
_private.checkCAPassword(false)
} else {
_private.innerSubmit()
}
},
innerSubmit: function () {
if (
assign.mustUploadAttachment &&
waf('#approveResult').wafRadioGroup('getValue') == 'true'
) {
var isCurAssignUploadAttach = false
waf.doPost({
url:
waf.getContextPath() +
'/iwebattachment.do?method=isCurAssignUploadAttach',
data: { assignId: assign.assignId },
async: false,
success: function (data) {
if (data == false) {
_self.showWarning(_self._localeStr.WEB_MUSTUPLOAD)
}
isCurAssignUploadAttach = data
}
})
if (!isCurAssignUploadAttach) {
return
}
}
assign.operation = 'approve'
var callback = function (isSuccess) {
if (isSuccess) {
_private._submit(false)
}
}
var issubmit = _private.checkIsSave(callback, 'submit')
if (issubmit == null) {
_self.jMessageAlert(_self._localeStr.WEB_CHECKERRORSUBMITEND)
return false
}
_private._submit(issubmit)
},
_submit: function (isReadOnly) {
var approve = _private.getApprove()
if (!approve) {
return
}
var nextPersons = _private.getNextPersons()
if (!nextPersons) {
return
}
var ok = function () {
approve.operation = assign.operation
var op = approve.operation
if (
caConfig.caConfigInfo.isSignatureApprove === 'true' &&
caConfig.caConfigInfo.caType != '5'
) {
if (!_private.beforeSubmitSigature()) {
return
}
approve.plainText = caConfig.CA_plainText
approve.signature = caConfig.CA_signature
}
if (
isReadOnly === undefined ||
isReadOnly === null ||
isReadOnly === ''
) {
isReadOnly = true
}
if (!isReadOnly) {
var frame = document.getElementById('billFrame')
if (
frame.contentDocument.getElementById('frame_tab_0') != null &&
frame.contentDocument.getElementById('frame_tab_0') != undefined
) {
frame = frame.contentDocument.getElementById('frame_tab_0')
}
if (frame.contentWindow._self.getCurrentModel) {
var modelInfo = frame.contentWindow._self.getCurrentModel()
var editModel = JSON.stringify(modelInfo)
approve.model = editModel
}
if (approve.model == null) {
if (frame.contentWindow._self.fireEvent) {
var s = frame.contentWindow._self.fireEvent('save')
if (!s) {
return false
}
}
}
}
approve.isReadOnly = isReadOnly.toString()
approve.isSignatureApprove = caConfig.caConfigInfo.isSignatureApprove
approve.nextActs = nextPersons
if ($('#textCC').prop('personIds')) {
approve.ccPersonIds = $('#textCC').prop('personIds')
}
var params = {}
params.approve = JSON.stringify(approve)
waf.doPost({
url: waf.getContextPath() + '/common/tree.do?method=submits',
data: params,
success: function (data) {
if (data) {
assign.id = data
_self.showSuccess(_self._localeStr.WEB_SUBMITSUCCESS)
_private.backto()
} else {
_self.showInfo(_self._localeStr.WEB_PLEASEREFRESH)
}
}
})
}
var cancel = function () {
return
}
if (showerror != '') {
waf.msgBox.showConfirm({
title: _self._localeStr.WEB_MESSPROMPT,
summaryMsg: showerror,
buttonType: 'ok-cancel',
buttonCallBack: [ok, cancel]
})
} else {
ok()
}
},
beforeSubmitSigature: function () {
var plainText = ''
var signatureField = caConfig.caConfigInfo.signatureFields
if (signatureField === null || signatureField === '') {
return true
}
var signatureFields = signatureField.split(';')
for (var i = 0; i < signatureFields.length; i++) {
var srcValue = 'CANOTSIGNATURE'
try {
srcValue = eval(
"document.getElementById('billFrame').contentWindow.document.getElementsByName('" +
signatureFields[i] +
"')[0].value"
)
} catch (e) {
srcValue = 'CANOTSIGNATURE'
}
if (typeof srcValue == 'undefined') {
srcValue = 'CANOTSIGNATURE'
}
if (
caConfig.caConfigInfo.precisionInfo &&
caConfig.caConfigInfo.precisionInfo[signatureFields[i]]
) {
var pos = parseInt(
caConfig.caConfigInfo.precisionInfo[signatureFields[i]]
)
if (pos < 0) {
pos = 2
} else {
if (pos > 4) {
pos = 4
}
}
srcValue = _private.toDecimal(srcValue, pos)
}
plainText = plainText + srcValue
}
var signResult = -1
try {
signResult = signMessage(plainText, caConfig.caConfigInfo.userName)
} catch (errMsg) {
_self.showInfo(_self._localeStr.WEB_SIGANATUREFAILED + errMsg.message)
return false
}
if (signResult == 1 || signResult == 2 || signResult == 3) {
if (signResult == 1 || signResult == 2) {
_self.showInfo(_self._localeStr.WEB_SIGAFAILEDUSBKEY)
return false
}
} else {
caConfig.CA_plainText = plainText
caConfig.CA_signature = signResult
}
return true
},
toDecimal: function (src, pos) {
var f = parseFloat(src)
if (isNaN(f)) {
return false
}
var src_rs = src.indexOf('.')
if (src_rs > 0) {
var src_zero = src.lastIndexOf('0')
while (src.length == src_zero + 1) {
src = src.substring(0, src_zero)
src_zero = src.lastIndexOf('0')
}
if (src.length == src_rs + 1) {
var src_int = src.substring(0, src_rs)
src = src_int
}
if (pos == 0) {
return src
}
}
var f = Math.round(src * Math.pow(10, pos)) / Math.pow(10, pos)
var s = f.toString()
var rs = s.indexOf('.')
if (rs < 0 && pos > 0) {
rs = s.length
s += '.'
}
while (s.length <= rs + pos) {
s += '0'
}
return s
},
save: function (event, value) {
var callback = function (isSuccess) {
if (isSuccess) {
_private._save()
}
}
var issubmit = _private.checkIsSave(callback, 'save')
if (issubmit == 'callBack') {
return
}
if (issubmit == null) {
_self.jMessageAlert(_self._localeStr.WEB_CHECKERRORSUBMITEND)
return false
}
_private._save(issubmit)
if (!issubmit && riskInsight) {
billInsightOption = _private.getWeakRisk()
_private.updateBillInsightNum(billInsightOption)
}
},
checkIsSave: function (callback, type) {
var issubmit = null
if (!assign.billIsReadOnly) {
if (
type == 'submit' &&
assign.disagreenotsave &&
waf('#approveResult').wafRadioGroup('getValue') == 'false'
) {
return true
}
var frame = document.getElementById('billFrame')
if (frame) {
if (
frame.contentWindow._self &&
frame.contentWindow._self.saveAndCallBack
) {
frame.contentWindow._self.saveAndCallBack(callback)
return 'callBack'
} else {
var canSaveBill = false
var haveChangeBill = null
var contentWindowSelf = null
if (frame.contentWindow._self) {
contentWindowSelf = frame.contentWindow._self
} else {
if (
frame.contentDocument.getElementById('frame_tab_0') &&
frame.contentDocument.getElementById('frame_tab_0')
.contentWindow._self
) {
contentWindowSelf =
frame.contentDocument.getElementById('frame_tab_0')
.contentWindow._self
}
}
if (contentWindowSelf) {
var WFBizSubmitCheckPriority = false
if (contentWindowSelf.isWFBizSubmitCheckPriority) {
WFBizSubmitCheckPriority =
contentWindowSelf.isWFBizSubmitCheckPriority()
}
if (WFBizSubmitCheckPriority) {
if (contentWindowSelf.fireEvent) {
haveChangeBill = contentWindowSelf.fireEvent(
'judgeDataModifyActionEvent',
['workflow']
)
} else {
if (contentWindowSelf.checkBillDataChanges) {
haveChangeBill = contentWindowSelf.checkBillDataChanges()
}
}
if (contentWindowSelf.beforeSubmit) {
canSaveBill = contentWindowSelf.beforeSubmit()
} else {
if (contentWindowSelf.fireEvent) {
canSaveBill =
contentWindowSelf.fireEvent('fieldOnStoreEvent') &&
contentWindowSelf.fireEvent('submitBeforeActionEvent')
}
}
} else {
if (contentWindowSelf.beforeSubmit) {
canSaveBill = contentWindowSelf.beforeSubmit()
} else {
if (contentWindowSelf.fireEvent) {
canSaveBill =
contentWindowSelf.fireEvent('fieldOnStoreEvent') &&
contentWindowSelf.fireEvent('submitBeforeActionEvent')
}
}
if (contentWindowSelf.fireEvent) {
haveChangeBill = contentWindowSelf.fireEvent(
'judgeDataModifyActionEvent',
['workflow']
)
} else {
if (contentWindowSelf.checkBillDataChanges) {
haveChangeBill = contentWindowSelf.checkBillDataChanges()
}
}
}
if (canSaveBill) {
if (typeof haveChangeBill == 'boolean') {
issubmit = !haveChangeBill
} else {
issubmit = false
}
}
} else {
issubmit = true
}
}
} else {
issubmit = true
}
} else {
issubmit = true
}
return issubmit
},
_save: function (isReadOnly) {
assign.operation = 'approve'
var approve = _private.getApprove()
if (!approve) {
return
}
if (
isReadOnly === undefined ||
isReadOnly === null ||
isReadOnly === ''
) {
isReadOnly = true
}
if (!isReadOnly) {
var frame = document.getElementById('billFrame')
if (
frame.contentDocument.getElementById('frame_tab_0') != null &&
frame.contentDocument.getElementById('frame_tab_0') != undefined
) {
frame = frame.contentDocument.getElementById('frame_tab_0')
}
if (frame.contentWindow._self.getCurrentModel) {
var modelInfo = frame.contentWindow._self.getCurrentModel()
var editModel = JSON.stringify(modelInfo)
approve.model = editModel
}
if (approve.model == null) {
if (frame.contentWindow._self.fireEvent) {
var s = frame.contentWindow._self.fireEvent('save')
if (!s) {
return false
}
}
}
}
approve.isReadOnly = isReadOnly.toString()
if ($('#textCC').prop('personIds')) {
approve.ccPersonIds = $('#textCC').prop('personIds')
approve.personName = $('#textCC').prop('value')
}
var params = {}
params.approve = JSON.stringify(approve)
waf.doPost({
url: waf.getContextPath() + '/common/tree.do?method=saves',
data: params,
success: function (data) {
if (data) {
assign.id = data
_self.showSuccess(_self._localeStr.WEB_SAVESUCCESS)
}
}
})
},
backto: function () {
try {
if (
$('#billFrame').length > 0 &&
$('#billFrame')[0].contentWindow._self.fireEvent
) {
$('#billFrame')[0].contentWindow._self.fireEvent('destroyEvent')
}
} catch (e) {
console.log('流程中心手动释放单据锁失败')
}
if (waf.isInFramePage()) {
waf.closeCurPageTab()
} else {
if (
top &&
top.jMessager &&
top.jMsgcenter &&
top.jMsgcenter.tab_post_add
) {
setTimeout(function () {
top.jMessager.sendMsg(top.jMsgcenter.tab_close)
}, 800)
} else {
setTimeout(function () {
try {
if (window.opener) {
if (window.opener.refreshCurrentPage) {
window.opener.refreshCurrentPage()
}
if (opener.waf && opener.waf('#queryGrid')[0] != undefined) {
opener.waf('#queryGrid').wafGrid('reloadGrid')
}
}
} catch (e) {}
try {
// 尝试关闭窗口
//window.close();
// 检查窗口是否仍然存在,如果存在则表示没有权限
//if (!window.closed) {
console.log("没有权限关闭窗口。");
waf.doGet({
url: '/shr/shr/msf/service.do?method=callService&serviceName=getSsoOAUrl&ssoPath=http%3a%2f%2foa.shichuangyi.cn%3a8080%2fwui%2findex.html%3fssoToken%3d%7b0%7d%23%2fmain%2fworkflow%2flistDoing%3fmenuIds%3d1%2c13%26menuPathIds%3d1%2c13%26_key%3dybt3pm',
success: function (data) {
location.href = data
}
});
//location.href = "/shr/dynamic.do?uipk=shr.workflow.view&inFrame=true";
//}
} catch (error) {
console.log("关闭窗口失败:", error.message);
_self.showSuccess(_self._localeStr.WEB_TASKHASDONE)
}
}, 500)
}
}
},
addUploadHtml: function () {
var attachmentUploadUrl =
waf.getContextPath() +
'/iwebattachment.do?method=upload&bosID=' +
encodeURIComponent(assign.billId) +
'&beizhu=' +
assign.assignId
var options = {
autoUpload: true,
url: attachmentUploadUrl,
multiSelect: true,
onComplete: function (e, data) {
_private.getAttchmentcount()
},
onAdd: function (e, data) {},
onFail: function (e, data) {
if (data.result.length > 0) {
if (data.result[0].error) {
_self.showInfo(data.result[0].error)
}
}
}
}
$('#upload').wafFileUploadUI(options)
_private.getAttchmentcount()
},
getAttchmentcount: function () {
var params = {}
params.assignId = assign.assignId
params.billId = assign.billId
var pageType = _self.getUrlParam('type')
if (pageType != null && 'passComent' === pageType) {
params.isPassAround = true
}
waf.doPost({
url: waf.getContextPath() + '/iwebattachment.do?method=getDataList',
data: params,
success: function (data) {
if (data.disabled) {
$('#attchment,.attchmentnuminfo,#upload').remove()
return
}
if (!data.canAdd) {
$('#upload').remove()
}
var len = data.list.length
$('#attchmentnum').html(len)
if (len > 0) {
waf('#attchment').wafSection('open')
} else {
waf('#attchment').wafSection('close')
}
var _html = ''
for (var i = 0; i < len; i++) {
var row = data.list[i]
var simpleName = row.simpleName
var classname = 'file'
var picFormat = ['jpg', 'gif', 'jpeg', 'png', 'bmp']
if (picFormat.indexOf(simpleName) > -1) {
classname = 'pic'
}
_html +=
'