approve.js 110 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427
  1. mod.definePage('workflow/metas/js/approve', function (waf, wfCommonUtil) {
  2. var _public = {},
  3. _private = {},
  4. me = _self
  5. var okPolicy = new Array()
  6. var noPolicy = new Array()
  7. var assign = {}
  8. var selnextPersons = {}
  9. var transId = null
  10. var locationurl = waf.getUrlParams(document.location.href)
  11. var approvetype = locationurl.type
  12. var passId = locationurl.passid
  13. var sourceIDs = locationurl.sourceIDs
  14. var msgId = locationurl.msgId
  15. var showerror = ''
  16. var nextActIndex = '#nextAct'
  17. var approveOpinions = {}
  18. var isFirst = true
  19. var approvePolicy = {}
  20. var riskInsight = false
  21. var billInsightOption = {}
  22. var caConfig = {
  23. caConfigInfo: null,
  24. rootDiv: null,
  25. CA_plainText: null,
  26. CA_signature: null,
  27. plainTextMap: null,
  28. plainSignatureMap: null
  29. }
  30. waf.extend(_public, {
  31. submit: function (event, value) {
  32. return _private.submit(event, value)
  33. },
  34. save: function (event, value) {
  35. return _private.save(event, value)
  36. },
  37. deliver: function (event, value) {
  38. return _private.deliver(event, value)
  39. },
  40. passAssignment: function (event, value) {
  41. return _private.passAssignment(event, value)
  42. },
  43. kickback: function (event, value) {
  44. return _private.kickback(event, value)
  45. },
  46. appendActivity: function (event, value) {
  47. return _private.appendActivity(event, value)
  48. },
  49. dynamicSign: function (event, value) {
  50. return _private.dynamicSign(event, value)
  51. },
  52. jumpto: function (event, value) {
  53. return _private.jumpto(event, value)
  54. },
  55. viewProcessDiagram: function (event, value) {
  56. return _private.viewProcessDiagram(event, value)
  57. },
  58. billImage: function (event, value) {
  59. return _private.billImage(event, value)
  60. },
  61. bill: function (event, value) {
  62. return _private.bill(event, value)
  63. },
  64. showoperate: function (event, value) {
  65. return _private.showoperate(event, value)
  66. },
  67. nextActs: function (event, ui) {
  68. return _private.nextActs(event, ui)
  69. },
  70. modifynextActs: function (event, value) {
  71. return _private.modifynextActs(event, value)
  72. },
  73. changePolicy: function (event, ui) {
  74. return _private.changePolicy(event, ui)
  75. },
  76. changeselPolicy: function (event, ui) {
  77. return _private.changeselPolicy(event, ui)
  78. },
  79. myPhrase: function (event, value) {
  80. return _private.myPhrase(event, value)
  81. },
  82. openPerson: function (event, value) {
  83. return _private.openPerson(event, value)
  84. },
  85. esignatureOnClick: function (event, ui) {
  86. return _private.esignatureOnClick(event, ui)
  87. },
  88. nextAct: function (event, ui) {
  89. return _private.nextAct(event, ui)
  90. },
  91. modifynextAct: function (event, value) {
  92. return _private.modifynextAct(event, value)
  93. },
  94. pageOnload: function (e) {
  95. return _private.pageOnload(e)
  96. },
  97. pageOnRenderBefore: function (e) {
  98. return _private.pageOnRenderBefore(e)
  99. },
  100. phrasedel: function (e) {
  101. return _private.phrasedel(e)
  102. },
  103. phrasesure: function (e) {
  104. return _private.phrasesure(e)
  105. },
  106. addphrase: function (e) {
  107. return _private.addphrase(e)
  108. },
  109. phraseback: function (e) {
  110. return _private.phraseback(e)
  111. },
  112. phraseadd: function (e) {
  113. return _private.phraseadd(e)
  114. },
  115. reloadTranId: function () {
  116. return _private.reloadTranId()
  117. },
  118. getnextacts: function () {
  119. return _private.getnextacts()
  120. },
  121. showtab: function () {
  122. return _private.showtab()
  123. },
  124. setmanualdecision: function () {
  125. return _private.setmanualdecision()
  126. },
  127. setmodifynextAct: function () {
  128. return _private.setmodifynextAct()
  129. },
  130. getbatchlist: function () {
  131. return _private.getbatchlist()
  132. },
  133. displayBillInfo: function (url) {
  134. return _private.displayBillInfo(url)
  135. },
  136. getPolicy: function (approveValueStr) {
  137. return _private.getPolicy(approveValueStr)
  138. },
  139. setPolicy: function (val) {
  140. return _private.setPolicy(val)
  141. },
  142. isNeedDefaultOption: function (vals) {
  143. return _private.isNeedDefaultOption(vals)
  144. },
  145. setsendmailormsg: function (
  146. isOpenMessageSendOnUI,
  147. notifyNextBySMS,
  148. notifyNextByMail
  149. ) {
  150. return _private.setsendmailormsg(
  151. isOpenMessageSendOnUI,
  152. notifyNextBySMS,
  153. notifyNextByMail
  154. )
  155. },
  156. resizePage: function () {
  157. return _private.resizePage()
  158. },
  159. showapprovehis: function (procInstId) {
  160. return _private.showapprovehis(procInstId)
  161. },
  162. showbtn: function () {
  163. return _private.showbtn()
  164. },
  165. setselnextperson: function (actId, name, id) {
  166. return _private.setselnextperson(actId, name, id)
  167. },
  168. loadNextActs: function () {
  169. return _private.loadNextActs()
  170. },
  171. getOpinion: function (actInstId, assignId, billId) {
  172. return _private.getOpinion(actInstId, assignId, billId)
  173. },
  174. getphrase: function () {
  175. return _private.getphrase()
  176. },
  177. setselnextactperson: function (resultStr) {
  178. return _private.setselnextactperson(resultStr)
  179. },
  180. shownextActs: function (nextactname, ui) {
  181. return _private.shownextActs(nextactname, ui)
  182. },
  183. passComentsubmit: function () {
  184. return _private.passComentsubmit()
  185. },
  186. initCAConfig: function (tCAConfig) {
  187. return _private.initCAConfig(tCAConfig)
  188. },
  189. batchSubmitForCA: function () {
  190. return _private.batchSubmitForCA()
  191. },
  192. checkCAPassword: function (isBatch) {
  193. return _private.checkCAPassword(isBatch)
  194. },
  195. batchSubmit: function () {
  196. return _private.batchSubmit()
  197. },
  198. getbatchid: function () {
  199. return _private.getbatchid()
  200. },
  201. _batchsubmit: function (info) {
  202. return _private._batchsubmit(info)
  203. },
  204. getApprove: function () {
  205. return _private.getApprove()
  206. },
  207. beforeBatchSubmitSigature: function (selectBillIds) {
  208. return _private.beforeBatchSubmitSigature(selectBillIds)
  209. },
  210. getNextPersons: function (isSave) {
  211. return _private.getNextPersons(isSave)
  212. },
  213. manualdecisionsubmit: function () {
  214. return _private.manualdecisionsubmit()
  215. },
  216. beforeInnerSubmit: function () {
  217. return _private.beforeInnerSubmit()
  218. },
  219. innerSubmit: function () {
  220. return _private.innerSubmit()
  221. },
  222. _submit: function (isReadOnly) {
  223. return _private._submit(isReadOnly)
  224. },
  225. beforeSubmitSigature: function () {
  226. return _private.beforeSubmitSigature()
  227. },
  228. toDecimal: function (src, pos) {
  229. return _private.toDecimal(src, pos)
  230. },
  231. checkIsSave: function (callback, type) {
  232. return _private.checkIsSave(callback, type)
  233. },
  234. _save: function (isReadOnly) {
  235. return _private._save(isReadOnly)
  236. },
  237. backto: function () {
  238. return _private.backto()
  239. },
  240. addUploadHtml: function () {
  241. return _private.addUploadHtml()
  242. },
  243. getAttchmentcount: function () {
  244. return _private.getAttchmentcount()
  245. },
  246. selattachment: function (item, attcreater, beizhu) {
  247. return _private.selattachment(item, attcreater, beizhu)
  248. },
  249. attachmentDelete: function (item, id) {
  250. return _private.attachmentDelete(item, id)
  251. },
  252. attachmentView: function (id, type) {
  253. return _private.attachmentView(id, type)
  254. },
  255. isWaf1Bill: function (url) {
  256. return _private.isWaf1Bill(url)
  257. },
  258. messageDigest: function () {
  259. return _private.messageDigest()
  260. },
  261. jMessageAlert: function (message) {
  262. return _private.jMessageAlert(message)
  263. },
  264. onselect: function (event, ui) {
  265. return _private.onselect(event, ui)
  266. },
  267. addphrase: function () {
  268. return _private.addphrase()
  269. },
  270. openAttachmentPage: function (event, value) {
  271. return _private.openAttachmentPage(event, value)
  272. },
  273. getAssignInfo: function () {
  274. return _private.getAssignInfo()
  275. }
  276. })
  277. _self.subscribeEvent('pageOnLoadEvent', _public.pageOnload, 'after')
  278. _self.subscribeEvent(
  279. 'pageOnRenderEvent',
  280. _public.pageOnRenderBefore,
  281. 'before'
  282. )
  283. _self.subscribeEvent('phrasedelActionEvent', _public.phrasedel, 'overwrite')
  284. _self.subscribeEvent('phrasesureActionEvent', _public.phrasesure, 'overwrite')
  285. _self.subscribeEvent('phrasebackActionEvent', _public.phraseback, 'overwrite')
  286. _self.subscribeEvent('phraseaddActionEvent', _public.phraseadd, 'overwrite')
  287. waf.extend(_private, {
  288. modifyNextAct: '#modifynextAct',
  289. charFrameId: 'predictionChartIframe',
  290. curTab: '',
  291. leftPanelWidth: '',
  292. rightPanelWidth: '',
  293. isPredict: true,
  294. displayBillInfo: function (url) {
  295. if (assign.attachmentMode) {
  296. if (!url.endsWith('nobill.html')) {
  297. url += '&hasAttachment=false'
  298. }
  299. }
  300. waf('#billFrame').wafIframe('option', 'src', url)
  301. },
  302. getPolicy: function (approveValueStr) {
  303. if (approveValueStr == null || approveValueStr == '') {
  304. approveValueStr =
  305. '0;' +
  306. _self._localeStr.WEB_AGREE +
  307. ';' +
  308. _self._localeStr.WEB_AGREE +
  309. ';:1;' +
  310. _self._localeStr.WEB_DISAGREE +
  311. ';' +
  312. _self._localeStr.WEB_DISAGREE +
  313. ';'
  314. }
  315. var strs = approveValueStr.split(':')
  316. for (var i = 0; i < strs.length; i++) {
  317. var strTemp = strs[i].split(';')
  318. var key = strTemp[0]
  319. var text = strTemp[1]
  320. var type = strTemp.length == 2 ? _self._localeStr.WEB_ALL : strTemp[2]
  321. var line = strTemp.length < 4 ? '' : strTemp[3]
  322. var o = {}
  323. o.alias = text
  324. o.value = key
  325. if (
  326. 'agree' == type ||
  327. type == _self._localeStr.WEB_AGREE ||
  328. '同意' == type
  329. ) {
  330. okPolicy.push(o)
  331. } else {
  332. if (
  333. 'disagree' == type ||
  334. type == _self._localeStr.WEB_DISAGREE ||
  335. '不同意' == type
  336. ) {
  337. noPolicy.push(o)
  338. } else {
  339. if (
  340. 'all' == type ||
  341. type == _self._localeStr.WEB_ALL ||
  342. '全部' == type
  343. ) {
  344. okPolicy.push(o)
  345. noPolicy.push(o)
  346. }
  347. }
  348. }
  349. }
  350. },
  351. setPolicy: function (val) {
  352. if (val == 'true') {
  353. if (isFirst) {
  354. isFirst = false
  355. } else {
  356. approveOpinions.disagree = $('#approveOpinion').val()
  357. approvePolicy.disagree = waf('#policy').wafSelect('getValue')
  358. }
  359. if (approvePolicy.agree) {
  360. waf('#policy').wafSelect('setValue', approvePolicy.agree)
  361. }
  362. $('#approveOpinion').val(approveOpinions.agree)
  363. waf('#policy').wafSelect('option', 'enumSource', okPolicy)
  364. } else {
  365. if (isFirst) {
  366. isFirst = false
  367. } else {
  368. approveOpinions.agree = $('#approveOpinion').val()
  369. approvePolicy.agree = waf('#policy').wafSelect('getValue')
  370. }
  371. if (approvePolicy.disagree) {
  372. waf('#policy').wafSelect('setValue', approvePolicy.disagree)
  373. }
  374. $('#approveOpinion').val(approveOpinions.disagree)
  375. waf('#policy').wafSelect('option', 'enumSource', noPolicy)
  376. }
  377. _private.reloadTranId()
  378. if (waf(nextActIndex).wafCheckbox('isChecked')) {
  379. _private.loadNextActs()
  380. }
  381. },
  382. isNeedDefaultOption: function (vals) {
  383. if (assign.isNeedDefaultOption) {
  384. waf('#approveOpinion').val(vals)
  385. }
  386. if (assign.defaultOpinion != null && assign.defaultOpinion != '') {
  387. waf('#approveOpinion').val(assign.defaultOpinion)
  388. }
  389. },
  390. getDefaultOption: function (vals) {
  391. if (assign.isNeedDefaultOption) {
  392. approveOpinions = {
  393. agree: _self._localeStr.WEB_AGREE,
  394. disagree: _self._localeStr.WEB_DISAGREE
  395. }
  396. }
  397. if (assign.defaultOpinion != null && assign.defaultOpinion != '') {
  398. approveOpinions = {
  399. agree: assign.defaultOpinion,
  400. disagree: assign.defaultOpinion
  401. }
  402. }
  403. },
  404. setsendmailormsg: function (
  405. isOpenMessageSendOnUI,
  406. notifyNextBySMS,
  407. notifyNextByMail
  408. ) {
  409. waf('#issendmsgormail').wafPanel(
  410. 'option',
  411. 'hidden',
  412. !isOpenMessageSendOnUI
  413. )
  414. waf('#sendmsg').wafCheckbox('option', 'hidden', !isOpenMessageSendOnUI)
  415. waf('#sendmail').wafCheckbox('option', 'hidden', !isOpenMessageSendOnUI)
  416. waf('#sendmsg').wafCheckbox('setChecked', notifyNextBySMS)
  417. waf('#sendmail').wafCheckbox('setChecked', notifyNextByMail)
  418. },
  419. resizePage: function () {
  420. var rightwidth = Math.ceil((300 / window.innerWidth) * 100)
  421. if (window.screen.width <= 1366) {
  422. rightwidth = 21
  423. }
  424. var leftwidth = 100 - rightwidth
  425. waf('#splitPanel').wafSplitPanel('option', {
  426. split: false,
  427. leftWidth: leftwidth,
  428. rightWidth: rightwidth
  429. })
  430. var billHeightOffset = 220
  431. var tabOffset = 100
  432. if (assign.newPage && approvetype == 'approve') {
  433. billHeightOffset = 160
  434. tabOffset = 155
  435. }
  436. if (approvetype != 'approve') {
  437. billHeightOffset -= 120
  438. }
  439. $('#tabs .ui-waftabs-panel')
  440. .eq(0)
  441. .height(window.innerHeight - tabOffset)
  442. if (approvetype == 'batchapprove') {
  443. if (assign.batchApproveUrl) {
  444. var times = 0
  445. waf('#billFrame').wafIframe(
  446. 'option',
  447. 'height',
  448. window.innerHeight - 100
  449. )
  450. var interval = setInterval(function () {
  451. try {
  452. window.frames.billFrame
  453. .$('#gview_queryGrid .ui-jqgrid-bdiv')
  454. .eq(0)
  455. .css('height', window.innerHeight - 220)
  456. if (times > 4) {
  457. clearInterval(interval)
  458. }
  459. times++
  460. } catch (e) {}
  461. }, 500)
  462. waf('#billFrame').wafIframe('option', 'scrolling', 'auto')
  463. } else {
  464. $('#gview_queryGrid .ui-jqgrid-bdiv').height(
  465. $('#tabs').height() - 100
  466. )
  467. $('#gview_queryGrid .ui-jqgrid-bdiv').css('overflow-y', 'auto')
  468. $('#panel5 .ui-jqgrid').height($('#tabs').height())
  469. }
  470. } else {
  471. if (assign.messageDigest) {
  472. $('#panel5').css({
  473. height: window.innerHeight - billHeightOffset,
  474. 'overflow-y': 'auto',
  475. 'overflow-x': 'hidden'
  476. })
  477. $('#bill_content').css({
  478. height: window.innerHeight - billHeightOffset,
  479. overflow: 'auto'
  480. })
  481. } else {
  482. waf('#billFrame').wafIframe(
  483. 'option',
  484. 'height',
  485. window.innerHeight - billHeightOffset
  486. )
  487. waf('#billFrame').wafIframe('option', 'scrolling', 'auto')
  488. }
  489. }
  490. if (assign.absStr || assign.decisionDesc) {
  491. _private.changeBillHeight(90, false)
  492. }
  493. if (approvetype == 'batchapprove' || approvetype == 'approve') {
  494. $('#myPhraseList .scrollhid').height($('#approveTask').height() - 100)
  495. }
  496. },
  497. changeBillHeight: function (height, isClose) {
  498. var billHeight = 0
  499. if (assign.messageDigest) {
  500. billHeight = $('#panel5').height()
  501. } else {
  502. billHeight = waf('#billFrame').wafIframe('option', 'height')
  503. }
  504. if (isClose) {
  505. billHeight += height
  506. } else {
  507. billHeight -= height
  508. }
  509. if (assign.messageDigest) {
  510. $('#panel5').css({ height: billHeight, 'overflow-y': 'auto' })
  511. } else {
  512. waf('#billFrame').wafIframe('option', 'height', billHeight)
  513. waf('#billFrame').wafIframe('option', 'scrolling', 'auto')
  514. }
  515. },
  516. showapprovehis: function (procInstId) {
  517. var params = {}
  518. params.embed = 'true'
  519. params.proInstId = procInstId
  520. waf.doPost({
  521. url: waf.getContextPath() + '/flowRelated.do?method=getFlowRealted',
  522. data: params,
  523. success: function (data) {
  524. var _html = ''
  525. for (var i = 0; i < data.length; i++) {
  526. var action = data[i].action
  527. var node = data[i].node
  528. if (node == null) {
  529. node = ''
  530. }
  531. var operatorResult = data[i].operatorResult
  532. if (operatorResult == '' || operatorResult == null) {
  533. operatorResult = action
  534. }
  535. var op = ''
  536. var operatorOpinion = data[i].operatorOpinion
  537. if (operatorOpinion == '' || operatorOpinion == null) {
  538. operatorOpinion = ''
  539. }
  540. var classname = 'agree'
  541. var type = data[i].type
  542. var titlename = ''
  543. if (type == 9 || type == 10) {
  544. var operatorResults = operatorResult.split(',')
  545. if (operatorResults.length == 2) {
  546. op +=
  547. '<span title=' +
  548. _self._localeStr.WEB_APPROVALRESULTS +
  549. '>' +
  550. _self._localeStr.WEB_APPROVALRESULTS +
  551. ":</span><span title='" +
  552. operatorResults[0] +
  553. "'>" +
  554. operatorResults[0] +
  555. '</span><br/>'
  556. op +=
  557. '<span title=' +
  558. _self._localeStr.WEB_HANDLEROPINIONS +
  559. '>' +
  560. _self._localeStr.WEB_HANDLEROPINIONS +
  561. ":</span><span title='" +
  562. operatorResults[1] +
  563. "'>" +
  564. operatorResults[1] +
  565. '</span><br/>'
  566. if (
  567. operatorResults[0] == _self._localeStr.WEB_DISAGREE ||
  568. operatorResults[0] == 'Disagree'
  569. ) {
  570. classname = 'disagree'
  571. }
  572. } else {
  573. op +=
  574. "<span title='" +
  575. operatorResult +
  576. "'>" +
  577. operatorResult +
  578. '</span><br/>'
  579. }
  580. titlename = _self._localeStr.WEB_APPROVALCOMMENTS
  581. } else {
  582. op +=
  583. "<span title='" +
  584. operatorResult +
  585. "'>" +
  586. operatorResult +
  587. '</span><br/>'
  588. if (type == 1) {
  589. classname = 'jump'
  590. titlename = _self._localeStr.WEB_JUMPCOMMENTS
  591. } else {
  592. if (type == 2) {
  593. classname = 'append'
  594. titlename = _self._localeStr.WEB_COUNTERSIGNCOMMENTS
  595. } else {
  596. if (type == 4) {
  597. classname = 'stop'
  598. titlename = _self._localeStr.WEB_ENDCOMMENTS
  599. } else {
  600. if (type == 3) {
  601. classname = 'deliver'
  602. titlename = _self._localeStr.WEB_TRANSFERRCOMMENTS
  603. } else {
  604. if (type == 0) {
  605. classname = 'jump'
  606. titlename = _self._localeStr.WEB_REJECTCOMMENTS
  607. }
  608. }
  609. }
  610. }
  611. }
  612. }
  613. if (titlename != '') {
  614. op +=
  615. "<span title='" +
  616. titlename +
  617. "'>" +
  618. titlename +
  619. ":</span><span title='" +
  620. operatorOpinion +
  621. "'>" +
  622. operatorOpinion +
  623. '</span><br/>'
  624. }
  625. if (i > 0) {
  626. if (data[i].node == data[i - 1].node) {
  627. _html +=
  628. '<div class="infos"> <div class="content"> <div class="title"> <i></i> <span style="float:left;">' +
  629. data[i].operatorTime +
  630. '</span> <span style="float:right;">' +
  631. data[i].operator +
  632. '</span> </div> <div class="op">' +
  633. op +
  634. '</div> </div></div>'
  635. if (i != data.length - 1) {
  636. if (data[i].node != data[i + 1].node) {
  637. _html += '</div></li>'
  638. }
  639. }
  640. continue
  641. }
  642. }
  643. _html +=
  644. '<li><div class="node"> <i class="' +
  645. classname +
  646. '"></i> <span>' +
  647. node +
  648. '</span></div>'
  649. if (i != data.length - 1) {
  650. if (data[i].node == data[i + 1].node) {
  651. _html += '<div class="info"><div class="infos">'
  652. } else {
  653. _html += '<div class="info">'
  654. }
  655. } else {
  656. _html += '<div class="info">'
  657. }
  658. _html += ' <div class="content"> <div class="title">'
  659. if (i != data.length - 1) {
  660. if (data[i].node == data[i + 1].node) {
  661. _html += '<i></i>'
  662. }
  663. }
  664. _html +=
  665. ' <span style="float:left;">' +
  666. data[i].operatorTime +
  667. '</span> <span style="float:right;">' +
  668. data[i].operator +
  669. '</span> </div> <div class="op">' +
  670. op +
  671. '</div> </div></div>'
  672. if (i != data.length - 1) {
  673. if (data[i].node != data[i + 1].node) {
  674. _html += '</li>'
  675. }
  676. }
  677. }
  678. if (!_html) {
  679. _html = _self._localeStr.WEB_NOAPPROVALRECORDS
  680. }
  681. $('#approveHisInfo ul')[0].innerHTML = _html
  682. }
  683. })
  684. },
  685. showbtn: function () {
  686. waf('#dynamicSign').wafLinkButton('option', 'hidden', !assign.dynamicSign)
  687. waf('#appendActivity').wafLinkButton(
  688. 'option',
  689. 'hidden',
  690. !assign.allowAppendActivity || approvetype == 'manualdecision'
  691. )
  692. waf('#jumpto').wafLinkButton('option', 'hidden', !assign.allowJumpTo)
  693. waf('#kickback').wafLinkButton('option', 'hidden', !assign.allowKickBack)
  694. waf('#deliver').wafLinkButton('option', 'hidden', !assign.allowDeliver)
  695. waf('#YZJShare').wafLinkButton('option', 'hidden', true)
  696. if (assign.allowJumpTo || assign.allowKickBack) {
  697. var assignId = assign.assignId
  698. waf.doPost({
  699. url:
  700. waf.getContextPath() +
  701. '/common/tree.do?method=getJumpAndKickBackModel',
  702. async: false,
  703. data: { assignId: assignId },
  704. success: function (data) {
  705. if (assign.allowJumpTo) {
  706. waf('#jumpto').wafLinkButton('option', 'hidden', !data.jumpTo)
  707. }
  708. if (assign.allowKickBack) {
  709. waf('#kickback').wafLinkButton('option', 'hidden', !data.kickBack)
  710. }
  711. }
  712. })
  713. }
  714. if (
  715. assign.canSpecifyNextPerformer ||
  716. assign.mustShowPostActivities ||
  717. assign.showNextP
  718. ) {
  719. if (assign.mustShowPostActivities || assign.showNextP) {
  720. waf(nextActIndex).wafCheckbox('option', 'checked', true)
  721. }
  722. } else {
  723. waf(nextActIndex).wafCheckbox('option', 'hidden', true)
  724. }
  725. if (approvetype == 'batchapprove') {
  726. waf('#btnImage').wafLinkButton('option', 'hidden', false)
  727. waf('#btnBill').wafLinkButton('option', 'hidden', false)
  728. }
  729. if (approvetype == 'approve') {
  730. waf('#save').wafLinkButton('option', 'hidden', false)
  731. }
  732. },
  733. setselnextperson: function (actId, name, id) {
  734. var ps = {}
  735. if (selnextPersons[actId]) {
  736. ps = selnextPersons[actId]
  737. if (ps[id]) {
  738. return
  739. }
  740. }
  741. ps[id] = { number: '', name: name, id: id }
  742. selnextPersons[actId] = ps
  743. },
  744. loadNextActs: function () {
  745. _private.getnextacts()
  746. var nextActs = assign.nextActs
  747. _private.innerloadNextActs(nextActs)
  748. },
  749. innerloadNextActs: function (nextActs, selectAct) {
  750. var table = $('#nextActList')
  751. var _innerhtml = ''
  752. if (nextActs) {
  753. var actTitles = {}
  754. if (nextActs.length == 0) {
  755. _innerhtml +=
  756. '<div>' + _self._localeStr.WEB_NOSETACTIVITYPERSON + '</div>'
  757. $(_private.modifyNextAct).wafLinkButton('option', 'hidden', true)
  758. } else {
  759. var hasAct = false
  760. var selectActobj = {}
  761. if (selectAct) {
  762. for (var actid in selectAct) {
  763. selectActobj[actid] = actid
  764. }
  765. }
  766. for (var i = 0; i != nextActs.length; i++) {
  767. var act = nextActs[i]
  768. var num = 0
  769. var actId = act.actId
  770. var candidateselected = act.candidateselected
  771. if (!selectActobj[actId]) {
  772. for (var id in candidateselected) {
  773. _private.setselnextperson(actId, candidateselected[id], id)
  774. num++
  775. }
  776. }
  777. if (_private.isPredict && !act.isPredict) {
  778. continue
  779. }
  780. hasAct = true
  781. var actKey = act.actKey
  782. var actName = act.actName
  783. var isAllPersonAsPerformer = act.isAllPersonAsPerformer
  784. var persons = act.persons
  785. var count = act.count
  786. var issel = false
  787. var title = ''
  788. if (num > 0) {
  789. issel = true
  790. }
  791. _innerhtml +=
  792. "<div class='actInfo' actId='" +
  793. actId +
  794. "' actKey='" +
  795. actKey +
  796. "' title='" +
  797. actName +
  798. "'>" +
  799. actName +
  800. "</div><div class='actInfoperson' id='" +
  801. actId +
  802. "'>"
  803. if (issel) {
  804. _innerhtml += _self._localeStr.WEB_SELECTED
  805. var j = 0
  806. for (var id in candidateselected) {
  807. if (j > 0) {
  808. title += '、'
  809. }
  810. title += candidateselected[id]
  811. if (j > 2) {
  812. j++
  813. continue
  814. }
  815. if (j > 0) {
  816. _innerhtml += '、'
  817. }
  818. _innerhtml +=
  819. "<span class='persons' personid='" +
  820. id +
  821. "'>" +
  822. candidateselected[id] +
  823. '</span>'
  824. j++
  825. }
  826. actTitles[actId] = title
  827. if (j > 2) {
  828. _innerhtml +=
  829. _self._localeStr.WEB_ANDSOON + j + _self._localeStr.WEB_PEOPLE
  830. }
  831. } else {
  832. if (count > 0) {
  833. _innerhtml += ''
  834. var j = 0
  835. for (var id in persons) {
  836. if (j > 0) {
  837. title += '、'
  838. }
  839. title += persons[id]
  840. if (j > 2) {
  841. _innerhtml +=
  842. _self._localeStr.WEB_ANDSOON +
  843. count +
  844. _self._localeStr.WEB_PEOPLE
  845. break
  846. }
  847. if (j > 0) {
  848. _innerhtml += '、'
  849. }
  850. _innerhtml +=
  851. "<span class='persons' personid='" +
  852. id +
  853. "'>" +
  854. persons[id] +
  855. '</span>'
  856. j++
  857. }
  858. actTitles[actId] = title
  859. } else {
  860. _innerhtml += _self._localeStr.WEB_UNSELECTEDPERSON
  861. }
  862. }
  863. _innerhtml += '</div>'
  864. }
  865. if (!hasAct) {
  866. _innerhtml += '<div>' + _self._localeStr.WEB_POINTNEXTTIP + '</div>'
  867. }
  868. $(_private.modifyNextAct).wafLinkButton('option', 'hidden', false)
  869. }
  870. table.html(_innerhtml)
  871. for (var actTitle in actTitles) {
  872. $('#' + actTitle).attr('title', actTitles[actTitle])
  873. }
  874. }
  875. },
  876. getOpinion: function (actInstId, assignId, billId) {
  877. var params = {}
  878. params.actInstId = actInstId
  879. params.assignId = assignId
  880. params.billId = billId
  881. params.type = approvetype
  882. waf.doPost({
  883. url: waf.getContextPath() + '/workflow/approve.do?method=getOpinion',
  884. data: params,
  885. success: function (data) {
  886. if (
  887. data != null &&
  888. data != '' &&
  889. data.option != null &&
  890. data.option != ''
  891. ) {
  892. $('#approveOpinionInfo span').text(data.option)
  893. } else {
  894. $('#approveOpinionInfo').hide()
  895. }
  896. }
  897. })
  898. },
  899. supportMulti: function () {
  900. $('#approveDeliverBtn span').text(_self._localeStr.WEB_DELIVER)
  901. $('#approvePassBtn span').text(_self._localeStr.WEB_CIRCULATEBTN)
  902. $('#approveAppendBtn span').text(_self._localeStr.WEB_ADDSIGN)
  903. $('#approveDynamicSignBtn span').text(_self._localeStr.WEB_CONTERSIGNED)
  904. $('#approveSaveBtn span').text(_self._localeStr.WEB_SAVE)
  905. $('#approveSubmitBtn span').text(_self._localeStr.WEB_SUBMIT)
  906. $('#btnUpload').prepend(_self._localeStr.WEB_UPLOADATTACH)
  907. $('#attachmul1').prepend(_self._localeStr.WEB_ATTCHNUM)
  908. $('#attchmul2').prepend(_self._localeStr.WEB_VIEWDETAIL)
  909. $('#attachmul3').prepend(_self._localeStr.WEB_ATTCHGE)
  910. $('#attchment').append($('.attchmentnuminfo'))
  911. $('#attchment').append($('#upload'))
  912. $('#myPhraseInfo .edit').text(_self._localeStr.WEB_SAVE)
  913. $('#myPhraseInfo .backprevious').text(_self._localeStr.WEB_BACK)
  914. $('#myPhraseInfo .commit').text(_self._localeStr.WEB_DETERMINE)
  915. $('#myPhrasetext').prop(
  916. 'placeholder',
  917. _self._localeStr.WEB_ENTER_COMMENTS
  918. )
  919. },
  920. initApprove: function () {
  921. if (assign.riskInsight) {
  922. _private.initRiskInsight()
  923. } else {
  924. waf('#riskInsight').wafTab('remove')
  925. }
  926. _private.initEsignature()
  927. _private.initCCPerson()
  928. _private.showbtn()
  929. _private.initBillPage()
  930. _private.initAttachment()
  931. _private.initOperateIframe()
  932. _private.initAbstractAndPhrase()
  933. _private.initApprovePolicy()
  934. },
  935. initBatchapprove: function () {
  936. _private.initEsignature()
  937. _private.showbtn()
  938. locationurl.billIds = decodeURIComponent(parent.window.billIDs)
  939. locationurl.assignmentIds = parent.window.assignmentIDs
  940. _private.getbatchlist()
  941. _private.initAbstractAndPhrase()
  942. _private.initApprovePolicy()
  943. waf('#attchment').wafSection('option', 'hidden', true)
  944. $('#upload').remove()
  945. $('#operateInfo').remove()
  946. $('.attchmentnuminfo').remove()
  947. },
  948. initManualdecision: function () {
  949. _private.initManualdecisionNextAct()
  950. _private.showbtn()
  951. _private.initBillPage()
  952. _private.initAttachment()
  953. _private.initOperateIframe()
  954. _private.initDecisionDescAndVal()
  955. },
  956. initPassComent: function () {
  957. if (assign.passcoment != null) {
  958. waf('#passComentOpinion').val(assign.passcoment)
  959. }
  960. if (assign.isFeedBack) {
  961. waf('#sendmsgs').wafCheckbox('disable')
  962. waf('#sendmails').wafCheckbox('disable')
  963. }
  964. waf('#submit').wafLinkButton('option', 'hidden', assign.isFeedBack)
  965. waf('#passAssignment').wafLinkButton(
  966. 'option',
  967. 'hidden',
  968. assign.againPass === 'false'
  969. )
  970. _private.initBillPage()
  971. _private.initAttachment()
  972. _private.initOperateIframe()
  973. },
  974. initManualdecisionNextAct: function () {
  975. nextActIndex = '#nextAct1'
  976. _private.modifyNextAct = '#modifynextAct1'
  977. if (waf(nextActIndex).wafCheckbox('isChecked')) {
  978. _private.loadNextActs()
  979. }
  980. },
  981. initRiskInsight: function () {
  982. try {
  983. mod.use('billInsight', function () {
  984. riskInsight = true
  985. $('#form').append(
  986. '<div id="billInsight" class="" ctrlrole="waf.billInsight" data-domcreated="true"></div>'
  987. )
  988. $('#li_approveTask').css('width', '50%')
  989. $('#li_riskInsight').show()
  990. billInsightOption = _private.getWeakRisk()
  991. _private.updateBillInsightNum(billInsightOption)
  992. $(window).resize(function () {
  993. _private.resizeBillInsight(true)
  994. })
  995. })
  996. } catch (e) {
  997. console.log(_self._localeStr.WEB_CONSOLETEXT)
  998. }
  999. },
  1000. initCCPerson: function () {
  1001. if (assign.allowCC) {
  1002. $('#panelCC').show()
  1003. }
  1004. if (assign.ccPersonIds != null && assign.ccPersonName != null) {
  1005. waf('#textCC').prop('personIds', assign.ccPersonIds)
  1006. waf('#textCC').val(assign.ccPersonName)
  1007. }
  1008. },
  1009. initEsignature: function () {
  1010. if (
  1011. !assign.isEsignature ||
  1012. assign.esignatureAttachId == undefined ||
  1013. assign.esignatureAttachId == ''
  1014. ) {
  1015. $('#panel6').remove()
  1016. } else {
  1017. var _html =
  1018. "<img src='/easweb/webviews/webframework/webcom/attachment/view.jsp?bosID=" +
  1019. assign.esignatureAttachId +
  1020. "'/>"
  1021. $('#esigndiv')[0].innerHTML = _html
  1022. }
  1023. },
  1024. initBillPage: function () {
  1025. if (assign.messageDigest) {
  1026. try {
  1027. _private.messageDigest()
  1028. } catch (e) {
  1029. console.log(_self._localeStr.WEB_BILLINITFAILED)
  1030. }
  1031. } else {
  1032. if (!assign.billEditUrl || assign.billEditUrl == 'nobill.html') {
  1033. assign.billEditUrl = '/easweb/webviews/workflow/nobill.html?'
  1034. }
  1035. if (approvetype == 'passComent' && msgId) {
  1036. assign.billEditUrl =
  1037. assign.billEditUrl + '&msgId=' + encodeURIComponent(msgId)
  1038. }
  1039. _private.displayBillInfo(assign.billEditUrl)
  1040. }
  1041. },
  1042. initAttachment: function () {
  1043. waf('#attachmentBtn').wafLinkButton(
  1044. 'option',
  1045. 'hidden',
  1046. assign.attachDisabled
  1047. )
  1048. _private.refreshAttachCountInner(assign.attachmentCount)
  1049. },
  1050. initOperateIframe: function () {
  1051. var url =
  1052. '/easweb/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.approveRelatedInfo&isshowapprove=true&assignmentId=' +
  1053. assign.assignId
  1054. waf('#operateiframe').wafIframe('option', 'src', url)
  1055. },
  1056. initApprovePolicy: function () {
  1057. _private.getPolicy(assign.approveValue)
  1058. _private.getDefaultOption()
  1059. if (assign.id) {
  1060. waf('#approveResult').wafRadioGroup('setValue', assign.approveResult)
  1061. waf('#policy').wafSelect('setValue', assign.handlerOpinion)
  1062. } else {
  1063. waf('#approveResult').wafRadioGroup('setValue', 'true')
  1064. }
  1065. },
  1066. initAbstractAndPhrase: function () {
  1067. if (assign.absStr) {
  1068. waf('#optionalSection').wafSection(
  1069. 'option',
  1070. 'title',
  1071. _self._localeStr.WEB_PROCESSSUMMARY
  1072. )
  1073. waf('#optionalSection').wafSection('option', 'hidden', false)
  1074. $('#description').text(assign.absStr)
  1075. }
  1076. _private.getphrase()
  1077. $('#myPhraseList').on('click', 'li', function (e) {
  1078. _private.clickPhrase(e)
  1079. })
  1080. $('#myPhraseList').on('dblclick', 'li', function (e) {
  1081. _private.dblclickPhrase(e)
  1082. })
  1083. $('#myPhraseList').on('click', 'li i', function (e) {
  1084. _private.phrasedel(e)
  1085. })
  1086. },
  1087. initDecisionDescAndVal: function () {
  1088. if (assign.decisionDesc) {
  1089. waf('#optionalSection').wafSection(
  1090. 'option',
  1091. 'title',
  1092. _self._localeStr.WEB_DECISONDESC
  1093. )
  1094. waf('#optionalSection').wafSection('option', 'hidden', false)
  1095. $('#description').text(assign.decisionDesc)
  1096. _private.changeBillHeight(85, false)
  1097. }
  1098. _private.setmanualdecision()
  1099. },
  1100. initCalProcDiagram: function () {
  1101. var url =
  1102. '/easweb/webviews/workflow/calProcDiagramNew.jsp?procInstId=' +
  1103. assign.procInstId +
  1104. '&actinstId=' +
  1105. assign.actInstId +
  1106. '&newPage=' +
  1107. assign.newPage
  1108. waf('#' + _private.charFrameId).wafIframe('option', 'src', url)
  1109. var urlWin =
  1110. '/easweb/webviews/workflow/calProcDiagram.jsp?procInstId=' +
  1111. assign.procInstId +
  1112. '&actinstId=' +
  1113. assign.actInstId
  1114. waf('#chartIframe').wafIframe('option', 'src', urlWin)
  1115. $('#chart').click(function () {
  1116. $('#chart').hide()
  1117. })
  1118. $('#chartClose').click(function () {
  1119. $('#chart').hide()
  1120. })
  1121. $('#openChartIframe').click(function () {
  1122. $('#chart').show()
  1123. })
  1124. var times = 0
  1125. var interval = setInterval(function () {
  1126. if (window.frames[_private.charFrameId]) {
  1127. var num = window.frames[_private.charFrameId].num
  1128. if (num > 0) {
  1129. var iWidth = window.innerWidth * (4 / 5)
  1130. var rowNum = parseInt(iWidth / 176)
  1131. var calcHeight = Math.ceil(num / rowNum) * 140
  1132. var winHeight = ''
  1133. if (top == parent.parent) {
  1134. winHeight = window.innerHeight
  1135. } else {
  1136. winHeight = window.screen.availHeight - 120
  1137. }
  1138. var iHeight = winHeight * (4 / 5)
  1139. if (calcHeight < iHeight) {
  1140. iHeight = calcHeight
  1141. }
  1142. var iTop = (winHeight - 70 - iHeight) / 2
  1143. var iLeft = (window.innerWidth - 10 - iWidth) / 2
  1144. $('#chartIframe').css({
  1145. 'margin-left': iLeft,
  1146. 'margin-top': iTop,
  1147. width: iWidth,
  1148. height: iHeight
  1149. })
  1150. }
  1151. }
  1152. times++
  1153. if (times > 100) {
  1154. clearInterval(interval)
  1155. }
  1156. }, 100)
  1157. },
  1158. initPageLayout: function () {
  1159. if (assign.newPage) {
  1160. $('#predictionChart').remove()
  1161. _private.charFrameId = 'predictionChartIframeNew'
  1162. _private.initBtnNew()
  1163. } else {
  1164. $('#predictionChartNew').remove()
  1165. }
  1166. if (
  1167. locationurl.isOpenNewTab != undefined &&
  1168. locationurl.isOpenNewTab == 'true'
  1169. ) {
  1170. $('#nextActList').css('height', '20vh')
  1171. }
  1172. },
  1173. initCalProcDiagramPanel: function () {
  1174. if (approvetype == 'approve') {
  1175. _private.initCalProcDiagram()
  1176. } else {
  1177. $('#chart').remove()
  1178. $('#predictionChart').remove()
  1179. $('#predictionChartNew').remove()
  1180. }
  1181. },
  1182. initSection: function () {
  1183. if (approvetype != 'batchapprove') {
  1184. waf('#predictionChart').wafSection(
  1185. 'option',
  1186. 'onopen',
  1187. function (event) {
  1188. _private.changeBillHeight(50, false)
  1189. }
  1190. )
  1191. waf('#predictionChart').wafSection(
  1192. 'option',
  1193. 'onclose',
  1194. function (event) {
  1195. _private.changeBillHeight(50, true)
  1196. }
  1197. )
  1198. waf('#operateInfo').wafSection('option', 'onopen', function (event) {
  1199. _private.changeBillHeight(220, false)
  1200. })
  1201. waf('#operateInfo').wafSection('option', 'onclose', function (event) {
  1202. _private.changeBillHeight(220, true)
  1203. })
  1204. waf('#optionalSection').wafSection(
  1205. 'option',
  1206. 'onopen',
  1207. function (event) {
  1208. _private.changeBillHeight(60, false)
  1209. }
  1210. )
  1211. waf('#optionalSection').wafSection(
  1212. 'option',
  1213. 'onclose',
  1214. function (event) {
  1215. _private.changeBillHeight(60, true)
  1216. }
  1217. )
  1218. }
  1219. },
  1220. initZoomTool: function () {
  1221. $('#onClose').show()
  1222. $('#tabs_ul li')
  1223. .eq($('#tabs_ul li').length - 1)
  1224. .append($('#onClose'))
  1225. $('#splitPanel_LeftSplitPanel').prepend($('#onOpen'))
  1226. $('#onClose').bind('click', function () {
  1227. $('#splitPanel').height($('#splitPanel_LeftSplitPanel').height())
  1228. rightPanelWidth = $('#splitPanel_RightSplitPanel').width()
  1229. leftPanelWidth = $('#splitPanel_LeftSplitPanel').width()
  1230. $('#splitPanel_RightSplitPanel').css('width', '0%')
  1231. $('#splitPanel_LeftSplitPanel').css('width', '100%')
  1232. $('#onOpen').show()
  1233. if (riskInsight && _private.curTab == 'riskInsight') {
  1234. $('.billInsight_cardPanel').css('display', 'none')
  1235. }
  1236. if (approvetype == 'batchapprove' && !assign.batchApproveUrl) {
  1237. var newWidth = $('#queryGrid').wafGrid('getGridParentWidth')
  1238. $('#queryGrid').jqGrid('setGridWidth', newWidth)
  1239. }
  1240. })
  1241. $('#onOpen').bind('click', function () {
  1242. $('#onOpen').hide()
  1243. $('#splitPanel_RightSplitPanel').css('width', rightPanelWidth)
  1244. $('#splitPanel_LeftSplitPanel').css('width', leftPanelWidth)
  1245. if (riskInsight && _private.curTab == 'riskInsight') {
  1246. $('.billInsight_cardPanel').show()
  1247. }
  1248. if (approvetype == 'batchapprove' && !assign.batchApproveUrl) {
  1249. var newWidth = $('#queryGrid').wafGrid('getGridParentWidth')
  1250. $('#queryGrid').jqGrid('setGridWidth', newWidth)
  1251. }
  1252. })
  1253. $('#onOpen').bind('hover', function () {
  1254. $('#onOpen').css('opacity', 1)
  1255. })
  1256. },
  1257. pageOnload: function (e) {
  1258. $('body').ready(function () {
  1259. _private.supportMulti()
  1260. _private.showtab()
  1261. var billId = assign.billId
  1262. if (approvetype == 'approve') {
  1263. _private.initApprove()
  1264. } else {
  1265. if (approvetype == 'batchapprove') {
  1266. _private.initBatchapprove()
  1267. if (locationurl && locationurl.assignmentIds) {
  1268. var actionUrl =
  1269. waf.getContextPath() +
  1270. '/activityProperty.do?method=addAssignReadTime'
  1271. var params = {}
  1272. params.assignIds = locationurl.assignmentIds
  1273. waf.doPost({
  1274. url: actionUrl,
  1275. data: params,
  1276. async: true,
  1277. success: function (data) {}
  1278. })
  1279. }
  1280. } else {
  1281. if (approvetype == 'manualdecision') {
  1282. _private.initManualdecision()
  1283. } else {
  1284. if (approvetype == 'passComent') {
  1285. _private.initPassComent()
  1286. billId = passId
  1287. }
  1288. }
  1289. }
  1290. }
  1291. _private.initSection()
  1292. _private.initPageLayout()
  1293. _private.initCalProcDiagramPanel()
  1294. _private.getOpinion(assign.actInstId, assign.assignId, billId)
  1295. _private.setsendmailormsg(
  1296. assign.isOpenMessageSendOnUI,
  1297. assign.notifyNextBySMS,
  1298. assign.notifyNextByMail
  1299. )
  1300. if (assign.newPage) {
  1301. _private.initZoomTool()
  1302. }
  1303. _private.resizePage()
  1304. window.scrollTo(0, 0)
  1305. var newTab = waf.getUrlParams(document.URL).isOpenNewTab
  1306. if (newTab) {
  1307. $('#operateInfo').css('margin', '3px 5px 5px 0')
  1308. }
  1309. })
  1310. },
  1311. initBtnNew: function () {
  1312. var submitBtn = waf('#submit').wafLinkButton('option', 'hidden')
  1313. $('#toolBar .ui-toolbar-ul').css('float', 'right')
  1314. if (approvetype == 'approve' || approvetype == 'batchapprove') {
  1315. if (approvetype == 'approve') {
  1316. var offset =
  1317. $('#panelNew1').width() - ($('#approveSaveBtn').width() * 2 + 20)
  1318. if (offset > 0) {
  1319. $('#approveSaveBtn').css('margin-left', offset / 2)
  1320. }
  1321. } else {
  1322. $('#approveSubmitBtn').css('float', 'right')
  1323. }
  1324. $('#toolBarNew1').show()
  1325. $('#panelNew1').show()
  1326. $('#labelapproveResult_label').hide()
  1327. waf('#approveSubmitBtn').wafLinkButton('option', 'hidden', submitBtn)
  1328. waf('#approveSaveBtn').wafLinkButton(
  1329. 'option',
  1330. 'hidden',
  1331. waf('#save').wafLinkButton('option', 'hidden')
  1332. )
  1333. waf('#approveDeliverBtn').wafLinkButton(
  1334. 'option',
  1335. 'hidden',
  1336. waf('#deliver').wafLinkButton('option', 'hidden')
  1337. )
  1338. waf('#approvePassBtn').wafLinkButton(
  1339. 'option',
  1340. 'hidden',
  1341. waf('#passAssignment').wafLinkButton('option', 'hidden')
  1342. )
  1343. waf('#approveKickbackBtn').wafLinkButton(
  1344. 'option',
  1345. 'hidden',
  1346. waf('#kickback').wafLinkButton('option', 'hidden')
  1347. )
  1348. waf('#approveAppendBtn').wafLinkButton(
  1349. 'option',
  1350. 'hidden',
  1351. waf('#appendActivity').wafLinkButton('option', 'hidden')
  1352. )
  1353. waf('#approveDynamicSignBtn').wafLinkButton(
  1354. 'option',
  1355. 'hidden',
  1356. waf('#dynamicSign').wafLinkButton('option', 'hidden')
  1357. )
  1358. waf('#approveJumpBtn').wafLinkButton(
  1359. 'option',
  1360. 'hidden',
  1361. waf('#jumpto').wafLinkButton('option', 'hidden')
  1362. )
  1363. } else {
  1364. if (approvetype == 'manualdecision') {
  1365. $('#panelNew3').show()
  1366. var b = waf('#deliver').wafLinkButton('option', 'hidden')
  1367. if (!b) {
  1368. $('#toolBarNew3').show()
  1369. }
  1370. waf('#decisionDeliverBtn').wafLinkButton(
  1371. 'option',
  1372. 'hidden',
  1373. waf('#deliver').wafLinkButton('option', 'hidden')
  1374. )
  1375. waf('#decisionSubmitBtn').wafLinkButton('option', 'hidden', submitBtn)
  1376. } else {
  1377. if (approvetype == 'passComent') {
  1378. $('#panelNew2').show()
  1379. var b = waf('#passAssignment').wafLinkButton('option', 'hidden')
  1380. if (!b) {
  1381. $('#toolBarNew2').show()
  1382. }
  1383. waf('#passPassBtn').wafLinkButton('option', 'hidden', b)
  1384. waf('#passSubmitBtn').wafLinkButton('option', 'hidden', submitBtn)
  1385. }
  1386. }
  1387. }
  1388. waf('#submit').wafLinkButton('option', 'hidden', true)
  1389. waf('#save').wafLinkButton('option', 'hidden', true)
  1390. waf('#deliver').wafLinkButton('option', 'hidden', true)
  1391. waf('#passAssignment').wafLinkButton('option', 'hidden', true)
  1392. waf('#kickback').wafLinkButton('option', 'hidden', true)
  1393. waf('#appendActivity').wafLinkButton('option', 'hidden', true)
  1394. waf('#dynamicSign').wafLinkButton('option', 'hidden', true)
  1395. waf('#jumpto').wafLinkButton('option', 'hidden', true)
  1396. if (approvetype != 'batchapprove') {
  1397. $('#assignTitle').show()
  1398. $('#assignTitle').css(
  1399. 'width',
  1400. $('#toolBar').width() - $('#toolBar .ui-toolbar-ul').width()
  1401. )
  1402. $('#assignTitle').text(assign.title)
  1403. $('#assignTitle').prop('title', assign.title)
  1404. }
  1405. },
  1406. changePolicy: function (event, ui) {
  1407. _private.setPolicy(ui.current)
  1408. if (ui.current == 'false') {
  1409. $('#panel').hide()
  1410. } else {
  1411. $('#panel').show()
  1412. }
  1413. },
  1414. deliver: function (event, value) {
  1415. var para = {}
  1416. if (approvetype == 'batchapprove') {
  1417. para.sourceID = _private.getbatchid().assignIds
  1418. } else {
  1419. para.sourceID = assign.assignId
  1420. }
  1421. wfCommonUtil.deliverAssignment(para)
  1422. },
  1423. passAssignment: function (event, value) {
  1424. var para = {}
  1425. if (approvetype == 'batchapprove') {
  1426. var info = _private.getbatchid()
  1427. para.sourceID = info.assignIds
  1428. para.bizObjID = info.billIds
  1429. } else {
  1430. para.sourceID = assign.assignId
  1431. para.bizObjID = assign.billId
  1432. }
  1433. wfCommonUtil.passComment(para)
  1434. },
  1435. kickback: function (event, value) {
  1436. var assignid = ''
  1437. if (approvetype == 'batchapprove') {
  1438. assignid = _private.getbatchid().assignIds
  1439. } else {
  1440. assignid = assign.assignId
  1441. }
  1442. var url =
  1443. waf.getContextPath() +
  1444. '/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.kickBackPage&assignmentId=' +
  1445. encodeURIComponent(assignid)
  1446. wfCommonUtil.windowopen(url, _self._localeStr.WEB_REJECT, 450, 320)
  1447. },
  1448. jumpto: function (event, value) {
  1449. var assignid = ''
  1450. if (approvetype == 'batchapprove') {
  1451. assignid = _private.getbatchid().assignIds
  1452. } else {
  1453. assignid = assign.assignId
  1454. }
  1455. var url =
  1456. waf.getContextPath() +
  1457. '/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.jump&assignmentId=' +
  1458. encodeURIComponent(assignid)
  1459. wfCommonUtil.windowopen(url, _self._localeStr.WEB_JUMP, 450, 281)
  1460. },
  1461. dynamicSign: function (event, value) {
  1462. var assignid = ''
  1463. if (approvetype == 'batchapprove') {
  1464. assignid = _private.getbatchid().assignIds
  1465. } else {
  1466. assignid = assign.assignId
  1467. }
  1468. var url =
  1469. waf.getContextPath() +
  1470. '/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.dynamicSignPage&assignmentId=' +
  1471. encodeURIComponent(assignid)
  1472. wfCommonUtil.windowopen(
  1473. url,
  1474. _self._localeStr.WEB_COUNTERSIGNPART,
  1475. 450,
  1476. 281
  1477. )
  1478. },
  1479. appendActivity: function (event, value) {
  1480. var billId = ''
  1481. var assignId = ''
  1482. if (approvetype == 'batchapprove') {
  1483. var info = _private.getbatchid()
  1484. assignId = info.assignIds
  1485. billId = info.billIds
  1486. } else {
  1487. assignId = assign.assignId
  1488. billId = assign.billId
  1489. }
  1490. var url =
  1491. waf.getContextPath() +
  1492. '/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.appendSignPage&assignmentId=' +
  1493. encodeURIComponent(assignId) +
  1494. '&billIds=' +
  1495. encodeURIComponent(billId) +
  1496. '&isAppended=' +
  1497. assign.isAppended
  1498. if (assign.appendMode) {
  1499. url += '&appendMode=' + assign.appendMode[0]
  1500. }
  1501. if (assign.routeMode) {
  1502. url += '&routeMode=' + assign.routeMode[0]
  1503. }
  1504. wfCommonUtil.windowopen(url, _self._localeStr.WEB_COUNTERSIGN, 520, 746)
  1505. },
  1506. modifynextAct: function (event, value) {
  1507. _private.setmodifynextAct()
  1508. },
  1509. setselnextactperson: function (resultStr) {
  1510. _private.innerloadNextActs(assign.nextActs, resultStr)
  1511. for (var actid in resultStr) {
  1512. var ps = resultStr[actid]
  1513. var _innerhtml = _self._localeStr.WEB_SELECTED
  1514. var j = 0
  1515. if (_private.isEmptyObject(ps)) {
  1516. delete selnextPersons[actid]
  1517. } else {
  1518. var title = ''
  1519. for (var id in ps) {
  1520. var person = ps[id]
  1521. var name = person.name
  1522. _private.setselnextperson(actid, name, id)
  1523. if (j > 0) {
  1524. title += '、'
  1525. }
  1526. title += name
  1527. if (j > 2) {
  1528. j++
  1529. continue
  1530. }
  1531. if (j > 0) {
  1532. _innerhtml += '、'
  1533. }
  1534. _innerhtml +=
  1535. "<span class='persons' personid='" + id + "'>" + name + '</span>'
  1536. j++
  1537. }
  1538. if (j > 2) {
  1539. _innerhtml +=
  1540. _self._localeStr.WEB_ANDSOON + j + _self._localeStr.WEB_PEOPLE
  1541. }
  1542. $('#' + actid).html(_innerhtml)
  1543. $('#' + actid).attr('title', title)
  1544. }
  1545. }
  1546. },
  1547. isEmptyObject: function (obj) {
  1548. for (var key in obj) {
  1549. return false
  1550. }
  1551. return true
  1552. },
  1553. getphrase: function () {
  1554. waf.doPost({
  1555. url:
  1556. waf.getContextPath() +
  1557. '/workflow/approve.do?method=getAppMyPhraseList',
  1558. success: function (data) {
  1559. var myPhraseList = $('#myPhraseList .showdel')
  1560. myPhraseList.html('')
  1561. for (var i = 0; i < data.length; i++) {
  1562. var row = $('<li></li>')
  1563. row.attr({ 'data-id': data[i].id, title: data[i].phraseText })
  1564. row.text(data[i].phraseText)
  1565. row.append('<i></i>')
  1566. myPhraseList.append(row)
  1567. }
  1568. }
  1569. })
  1570. },
  1571. clickPhrase: function (e) {
  1572. $('#myPhraseInfo li').removeClass('cur')
  1573. var targetElem = $(e.target)
  1574. targetElem.addClass('cur')
  1575. $('#myPhrasetext').val(targetElem.attr('title'))
  1576. $('#myPhrasetext').attr('data-id', targetElem.attr('data-id'))
  1577. },
  1578. dblclickPhrase: function (e) {
  1579. var itemval = $(e.target).attr('title')
  1580. $('#approveOpinion').val(itemval)
  1581. $('#myPhraseInfo li').removeClass('cur')
  1582. $('#myPhrasetext').attr('data-id', '')
  1583. $('#myPhrasetext').val('')
  1584. $('#phrasePanel').hide()
  1585. },
  1586. phrasesure: function (e) {
  1587. var text = $('#myPhrasetext').val()
  1588. if (text != null && text.length > 1000) {
  1589. _self.showInfo(_self._localeStr.WEB_APPROVALCOMMENTS_TOOLONG)
  1590. return null
  1591. }
  1592. $('#approveOpinion').val(text)
  1593. $('#myPhraseInfo li').removeClass('cur')
  1594. $('#myPhrasetext').attr('data-id', '')
  1595. $('#myPhrasetext').val('')
  1596. $('#phrasePanel').hide()
  1597. },
  1598. phraseback: function (e) {
  1599. $('#myPhraseInfo li').removeClass('cur')
  1600. $('#myPhrasetext').attr('data-id', '')
  1601. $('#myPhrasetext').val('')
  1602. $('#phrasePanel').hide()
  1603. },
  1604. myPhrase: function (event, value) {
  1605. $('#phrasePanel').show()
  1606. $('#myPhrasesection .ui-jqgrid-bdiv').css('height', 'auto')
  1607. },
  1608. addphrase: function () {
  1609. var text = $('#myPhrasetext').val()
  1610. if (text != null && text.length > 1000) {
  1611. _self.showInfo(_self._localeStr.WEB_APPROVALCOMMENTS_TOOLONG)
  1612. return null
  1613. }
  1614. var param = {}
  1615. var rowid = $('#myPhrasetext').attr('data-id')
  1616. var value = $('#myPhrasetext').val()
  1617. if (!value) {
  1618. return
  1619. }
  1620. if (rowid) {
  1621. param.method = 'updateOption'
  1622. param.opId = rowid
  1623. param.opName = value
  1624. } else {
  1625. param.phraseTxt = value
  1626. param.method = 'saveMyPhrase'
  1627. }
  1628. waf.doPost({
  1629. url: waf.getContextPath() + '/workflow/approve.do',
  1630. data: param,
  1631. success: function (data) {
  1632. _private.getphrase()
  1633. _self.showSuccess(_self._localeStr.WEB_ADDCOMMONCOMMENTS)
  1634. }
  1635. })
  1636. },
  1637. phrasedel: function (e) {
  1638. var param = {}
  1639. param.phraseIds = $(e.target).parent().attr('data-id')
  1640. $('#myPhrasetext').attr('data-id', '')
  1641. $('#myPhrasetext').val('')
  1642. waf.doPost({
  1643. url: waf.getContextPath() + '/workflow/approve.do?method=delMyPhrase',
  1644. data: param,
  1645. success: function (data) {
  1646. _private.getphrase()
  1647. _self.showSuccess(_self._localeStr.WEB_DELETECOMMONCOMMENTS)
  1648. }
  1649. })
  1650. },
  1651. pageOnRenderBefore: function (e) {
  1652. assign = _self.getPageInitData()
  1653. if (approvetype != 'passComent') {
  1654. _private.initCAConfig(assign.CAConfig)
  1655. }
  1656. var title = ''
  1657. if (approvetype == 'batchapprove') {
  1658. title = _self._localeStr.WEB_BATCHAPPROVAL
  1659. } else {
  1660. title = assign.title
  1661. }
  1662. _self.changeTitle(title)
  1663. },
  1664. phraseadd: function (e) {
  1665. var datarow = { phraseText: '' }
  1666. waf('#myPhrasegrid').wafGrid('addRow', { data: datarow })
  1667. },
  1668. viewProcessDiagram: function (event, value) {
  1669. var para = {}
  1670. if (approvetype == 'batchapprove') {
  1671. var assignIds = _private.getbatchid().assignIds
  1672. if (assignIds.split(';').length != 1) {
  1673. _self.showInfo(_self._localeStr.WEB_SELECTARECORD)
  1674. return false
  1675. }
  1676. para.sourceID = assignIds.split(';')[0]
  1677. } else {
  1678. para.sourceID = assign.assignId
  1679. }
  1680. wfCommonUtil.viewProcessDiagram(para)
  1681. },
  1682. reloadTranId: function () {
  1683. var approveResult = waf('#approveResult').wafRadioGroup('getValue')
  1684. var policy = waf('#policy').wafSelect('getValue')
  1685. var ispass
  1686. if (approveResult == 'false') {
  1687. ispass = false
  1688. } else {
  1689. if (approveResult == 'true') {
  1690. ispass = true
  1691. }
  1692. }
  1693. if (assign) {
  1694. var approveValueStr = assign.approveValue
  1695. if (approveValueStr == null || approveValueStr == '') {
  1696. approveValueStr =
  1697. '0;' +
  1698. _self._localeStr.WEB_AGREE +
  1699. ';' +
  1700. _self._localeStr.WEB_AGREE +
  1701. ';:1;' +
  1702. _self._localeStr.WEB_DISAGREE +
  1703. ';' +
  1704. _self._localeStr.WEB_DISAGREE +
  1705. ';'
  1706. }
  1707. var strs = approveValueStr.split(':')
  1708. for (var i = 0; i < strs.length; i++) {
  1709. var strTemp = strs[i].split(';')
  1710. if (strTemp.length != 4) {
  1711. continue
  1712. }
  1713. if (ispass && policy == strTemp[0]) {
  1714. transId = strTemp[3]
  1715. return
  1716. }
  1717. }
  1718. }
  1719. },
  1720. changeselPolicy: function (event, ui) {
  1721. _private.reloadTranId()
  1722. if (waf(nextActIndex).wafCheckbox('isChecked')) {
  1723. _private.loadNextActs()
  1724. }
  1725. },
  1726. getnextacts: function () {
  1727. var param = {}
  1728. param.assignId = assign.assignId
  1729. param.associatedLine = transId
  1730. param.isPredict = _private.isPredict
  1731. param.isNewProcessCenter = true
  1732. waf.doPost({
  1733. url:
  1734. waf.getContextPath() + '/common/tree.do?method=findPostParticipants',
  1735. data: param,
  1736. async: false,
  1737. success: function (data) {
  1738. assign.nextActs = data
  1739. }
  1740. })
  1741. },
  1742. showtab: function () {
  1743. if (approvetype == 'approve' || approvetype == 'batchapprove') {
  1744. $('#tabs').wafTabs('remove', '#manualdecision')
  1745. $('#tabs').wafTabs('remove', '#passComent')
  1746. } else {
  1747. if (approvetype == 'manualdecision') {
  1748. $('#tabs').wafTabs('remove', '#approveTask')
  1749. $('#tabs').wafTabs('remove', '#passComent')
  1750. } else {
  1751. if (approvetype == 'passComent') {
  1752. $('#tabs').wafTabs('remove', '#approveTask')
  1753. $('#tabs').wafTabs('remove', '#manualdecision')
  1754. }
  1755. }
  1756. }
  1757. if (approvetype != 'approve') {
  1758. waf('#riskInsight').wafTab('remove')
  1759. }
  1760. },
  1761. setmanualdecision: function () {
  1762. var items = assign.decisionItems
  1763. var opinions = assign.decisionOpinions
  1764. var _html = ''
  1765. var itemArr = items.split(';')
  1766. var opinionArr = new Array()
  1767. if (!opinions) {
  1768. var opinionItem = ''
  1769. for (var i = 0; i < itemArr.length; i++) {
  1770. opinionItem += i + 1
  1771. if (i < itemArr.length - 1) {
  1772. opinionItem += ';'
  1773. }
  1774. opinionArr.push(i + 1)
  1775. }
  1776. assign.decisionOpinions = opinionItem
  1777. } else {
  1778. opinionArr = opinions.split(';')
  1779. }
  1780. var json = []
  1781. for (var i = 0; i < itemArr.length; i++) {
  1782. var name = itemArr[i]
  1783. var val = opinionArr[i]
  1784. var para = {}
  1785. para.value = val + '_' + i
  1786. para.alias = name
  1787. json.push(para)
  1788. }
  1789. waf('#radioDecision').wafRadioGroup('setItems', null, json)
  1790. waf('#radioDecision').wafRadioGroup('setValue', json[0].value)
  1791. },
  1792. nextActs: function (event, ui) {
  1793. _private.shownextActs('modifynextAct1', ui)
  1794. },
  1795. nextAct: function (event, ui) {
  1796. _private.shownextActs('modifynextAct', ui)
  1797. },
  1798. modifynextActs: function (event, value) {
  1799. _private.setmodifynextAct()
  1800. },
  1801. setmodifynextAct: function () {
  1802. var jsonval = ''
  1803. if (selnextPersons == null || selnextPersons.length == 0) {
  1804. jsonval = ''
  1805. } else {
  1806. jsonval = JSON.stringify(selnextPersons)
  1807. }
  1808. waf.window.open({
  1809. url:
  1810. waf.getContextPath() +
  1811. '/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.setNextAct&debug=true&assignmentId=' +
  1812. encodeURIComponent(assign.assignId) +
  1813. '&selnextPersons=' +
  1814. encodeURIComponent(jsonval) +
  1815. '&asso=' +
  1816. transId +
  1817. '&isPredict=' +
  1818. _private.isPredict,
  1819. openType: 'iframe',
  1820. method: 'POST',
  1821. data: {},
  1822. modal: true,
  1823. title: _self._localeStr.WEB_NEXTACTIVITY,
  1824. position: 'center',
  1825. width: 1020,
  1826. height: 580,
  1827. minHeight: 560,
  1828. minWidth: 1020,
  1829. iconCls: 'waf-ui-icon',
  1830. draggable: true,
  1831. resizable: true,
  1832. close: function (event, ui) {},
  1833. retValCallBack: function (resultData) {
  1834. if (
  1835. resultData &&
  1836. resultData.resultStr &&
  1837. resultData.resultStr.length > 0
  1838. ) {
  1839. var resultStr = JSON.parse(resultData.resultStr)
  1840. selnextPersons = {}
  1841. _private.isPredict = resultData.isPredict
  1842. _private.setselnextactperson(resultStr)
  1843. }
  1844. }
  1845. })
  1846. },
  1847. getbatchlist: function () {
  1848. if (assign.batchApproveUrl) {
  1849. var url =
  1850. waf.getContextPath() +
  1851. assign.batchApproveUrl +
  1852. '&hasToolbar=false&showCommonQuery=false'
  1853. var billIds = locationurl.billIds.split(';')
  1854. var temp = 'id%20in%20('
  1855. for (var i = 0; i < billIds.length; i++) {
  1856. if (billIds[i]) {
  1857. if (i == 0) {
  1858. temp += '%27' + encodeURIComponent(billIds[i]) + '%27'
  1859. } else {
  1860. temp += '%2C%27' + encodeURIComponent(billIds[i]) + '%27'
  1861. }
  1862. }
  1863. }
  1864. temp += ')'
  1865. $(
  1866. "<form id='framesrcbillform' method='POST' type='hidden' target='billFrame' action='" +
  1867. url +
  1868. "'></form>"
  1869. )
  1870. .insertAfter($('#billFrame'))
  1871. .append(
  1872. $("<input type='hidden' name='filterInfo' value='" + temp + "'>")
  1873. )
  1874. .append(
  1875. $("<input type='hidden' name='botpFilter' value='" + temp + "'>")
  1876. )
  1877. setTimeout(function () {
  1878. document.getElementById('framesrcbillform').submit()
  1879. }, 500)
  1880. var times = 0
  1881. var interval = setInterval(function () {
  1882. var frame = document.getElementById('billFrame')
  1883. $($(frame)[0].contentDocument.body)
  1884. .find('.ui-jqgrid')
  1885. .css({ margin: '0px', width: '100%' })
  1886. if (times > 600) {
  1887. clearInterval(interval)
  1888. }
  1889. times++
  1890. })
  1891. } else {
  1892. waf('#billFrame').remove()
  1893. var listinfo = {}
  1894. waf.doPost({
  1895. url:
  1896. waf.getContextPath() +
  1897. '/workflow/approve.do?method=getBatchApproveBillGrid',
  1898. data: { billIds: locationurl.billIds },
  1899. async: false,
  1900. success: function (data) {
  1901. listinfo = data
  1902. }
  1903. })
  1904. var headers = listinfo.headers
  1905. var list = listinfo.list
  1906. var fields = listinfo.fields
  1907. if (headers.length > 0) {
  1908. var colmodel = []
  1909. var paraid = { name: 'id', label: 'id', hidden: true, key: true }
  1910. colmodel.push(paraid)
  1911. for (var m = 0; m < headers.length; m++) {
  1912. var para = { name: fields[m], label: headers[m] }
  1913. colmodel.push(para)
  1914. }
  1915. var myGridoptions = {
  1916. id: 'queryGrid',
  1917. colModel: colmodel,
  1918. multiselect: true,
  1919. loadInit: false,
  1920. shrinkToFit: true
  1921. }
  1922. if (headers.length > 15) {
  1923. myGridoptions.shrinkToFit = false
  1924. }
  1925. var dom = waf.createDOM('grid', myGridoptions)
  1926. waf.appendDOM(waf('#panel5'), dom)
  1927. waf.initComponent('grid', myGridoptions, dom)
  1928. for (var i = 0; i < list.length; i++) {
  1929. for (var j in list[i]) {
  1930. if (list[i][j] != null && typeof list[i][j] == 'object') {
  1931. list[i][j] = list[i][j].alias
  1932. }
  1933. }
  1934. waf('#queryGrid').wafGrid('addRow', { data: list[i] })
  1935. }
  1936. }
  1937. }
  1938. },
  1939. shownextActs: function (nextactname, ui) {
  1940. if (ui.checked) {
  1941. $('.approve-next-persons').show()
  1942. _private.loadNextActs()
  1943. } else {
  1944. $('.approve-next-persons').hide()
  1945. waf('#' + nextactname).wafLinkButton('option', 'hidden', true)
  1946. selnextPersons = {}
  1947. }
  1948. },
  1949. submit: function (event, value) {
  1950. if (approvetype == 'approve') {
  1951. _private.confirmSumit('beforeInnerSubmit')
  1952. } else {
  1953. if (approvetype == 'manualdecision') {
  1954. _private.manualdecisionsubmit()
  1955. } else {
  1956. if (approvetype == 'batchapprove') {
  1957. _private.confirmSumit('batchSubmitForCA')
  1958. } else {
  1959. if (approvetype == 'passComent') {
  1960. _private.passComentsubmit()
  1961. }
  1962. }
  1963. }
  1964. }
  1965. },
  1966. confirmSumit: function (funcName) {
  1967. if (assign.enableMultiapproveConfirm == 'true') {
  1968. var ok = function () {
  1969. _private[funcName]()
  1970. }
  1971. var cancel = function () {
  1972. return
  1973. }
  1974. waf.msgBox.showConfirm({
  1975. title: _self._localeStr.WEB_MESSPROMPT,
  1976. summaryMsg: _self._localeStr.WEB_CONFIRMSUBMITAPPROVAL,
  1977. buttonType: 'ok-cancel',
  1978. buttonCallBack: [ok, cancel]
  1979. })
  1980. } else {
  1981. _private[funcName]()
  1982. }
  1983. },
  1984. passComentsubmit: function () {
  1985. var params = {}
  1986. params.parameter = sourceIDs
  1987. params.chksendMessage = 'yes'
  1988. if (waf('#sendmsgs').wafCheckbox('isChecked')) {
  1989. params.chksendMobile = 'yes'
  1990. }
  1991. if (waf('#sendmails').wafCheckbox('isChecked')) {
  1992. params.chksendMail = 'yes'
  1993. }
  1994. params.opinion = $('#passComentOpinion').val()
  1995. var option = $('#passComentOpinion').val()
  1996. if (option != null && option.length > 1000) {
  1997. _self.showInfo(_self._localeStr.WEB_FEEDBACKCOMMENTS_TOOLONG)
  1998. return null
  1999. }
  2000. waf.doPost({
  2001. url: waf.getContextPath() + '/passComment/get.do?method=commit',
  2002. data: params,
  2003. success: function (data) {
  2004. _self.showSuccess(_self._localeStr.WEB_DEEDBACKCIRCULATESUCCESS)
  2005. _private.backto()
  2006. }
  2007. })
  2008. },
  2009. initCAConfig: function (tCAConfig) {
  2010. caConfig.caConfigInfo = tCAConfig
  2011. if (
  2012. caConfig.caConfigInfo.isSignatureApprove === 'true' &&
  2013. caConfig.caConfigInfo.caType != '5'
  2014. ) {
  2015. var initflag = initTopesa()
  2016. if (initflag != 0) {
  2017. waf.msgBox.showError(_self._localeStr.WEB_CAINITFAILED)
  2018. }
  2019. }
  2020. },
  2021. batchSubmitForCA: function () {
  2022. if (
  2023. caConfig.caConfigInfo.checkPassword === 'true' &&
  2024. caConfig.caConfigInfo.isSignatureApprove === 'true' &&
  2025. caConfig.caConfigInfo.caType != '5'
  2026. ) {
  2027. _private.checkCAPassword(true)
  2028. } else {
  2029. _private.batchSubmit()
  2030. }
  2031. },
  2032. checkCAPassword: function (isBatch) {
  2033. var setcss = function () {
  2034. var item = parent.$('.ui-msgbox .ui-prompt .prompt')
  2035. if ($(item)) {
  2036. $(item).css({
  2037. height: '78px',
  2038. margin: '20px 0 20px 190px',
  2039. background:
  2040. 'url(/easweb/webviews/workflow/img/waitpic.png) no-repeat'
  2041. })
  2042. }
  2043. }
  2044. setTimeout(setcss, 100)
  2045. var prmt = function (r, dialog) {
  2046. if (r) {
  2047. var res = -1
  2048. try {
  2049. res = checkPassword(r, caConfig.caConfigInfo.userName)
  2050. } catch (errMsg) {
  2051. _self.showInfo(
  2052. _self._localeStr.WEB_USBKEYCHECKPASSDETAIL + errMsg.message
  2053. )
  2054. return false
  2055. }
  2056. if (res != 0) {
  2057. _self.showInfo(_self._localeStr.WEB_USBKEYCHECKPASS)
  2058. } else {
  2059. if (isBatch) {
  2060. _private.batchSubmit()
  2061. } else {
  2062. _private.innerSubmit()
  2063. }
  2064. }
  2065. }
  2066. }
  2067. var cancel = function () {
  2068. return
  2069. }
  2070. waf.msgBox.showPrompt({
  2071. title: _self._localeStr.WEB_MESSPROMPT,
  2072. icon: 'prompt',
  2073. summaryMsg: _self._localeStr.WEB_INPUTUSBKEYPASSWORD,
  2074. buttonCallBack: [prmt, cancel]
  2075. })
  2076. parent.$('#waf-messageBox-prompt-input').prop('type', 'password')
  2077. },
  2078. batchSubmit: function () {
  2079. var info = _private.getbatchid()
  2080. if (info == null) {
  2081. return
  2082. }
  2083. _private._batchsubmit(info)
  2084. },
  2085. getbatchid: function () {
  2086. var info = {}
  2087. var assignIds = ''
  2088. var billIds = ''
  2089. var allbillIds = locationurl.billIds
  2090. var allassignmentIds = locationurl.assignmentIds
  2091. if (assign.batchApproveUrl) {
  2092. var frame = document.getElementById('billFrame')
  2093. billIds = $(frame)[0]
  2094. .contentWindow.waf('#queryGrid')
  2095. .dataGrid('getSelectedRows')
  2096. } else {
  2097. billIds = waf('#queryGrid').wafGrid('getSelectedRows')
  2098. }
  2099. if (billIds.length == 0) {
  2100. billIds = allbillIds
  2101. assignIds = allassignmentIds
  2102. } else {
  2103. for (var i = 0; i < allbillIds.split(';').length; i++) {
  2104. var allbillId = allbillIds.split(';')[i]
  2105. if (billIds.toString().indexOf(allbillId) > -1) {
  2106. if (assignIds != '') {
  2107. assignIds += ';'
  2108. }
  2109. assignIds += allassignmentIds.split(';')[i]
  2110. }
  2111. }
  2112. billIds = billIds.join(';')
  2113. }
  2114. info.billIds = billIds
  2115. info.assignIds = assignIds
  2116. return info
  2117. },
  2118. _batchsubmit: function (info) {
  2119. var approve = _private.getApprove()
  2120. if (!approve) {
  2121. return
  2122. }
  2123. var billIds = info.billIds
  2124. var assignIds = info.assignIds
  2125. approve.isSignatureApprove = caConfig.caConfigInfo.isSignatureApprove
  2126. if (
  2127. caConfig.caConfigInfo.isSignatureApprove === 'true' &&
  2128. caConfig.caConfigInfo.caType != '5'
  2129. ) {
  2130. if (!_private.beforeBatchSubmitSigature(billIds)) {
  2131. return
  2132. }
  2133. approve.plainTextMap = caConfig.plainTextMap
  2134. approve.plainSignatureMap = caConfig.plainSignatureMap
  2135. }
  2136. var nextPersons = _private.getNextPersons()
  2137. if (!nextPersons) {
  2138. return
  2139. }
  2140. var ok = function () {
  2141. var params = {}
  2142. approve.nextActs = nextPersons
  2143. params.approve = JSON.stringify(approve)
  2144. params.assignIds = assignIds
  2145. params.billIds = billIds
  2146. waf.doPost({
  2147. url: waf.getContextPath() + '/common/tree.do?method=batchSubmits',
  2148. data: params,
  2149. success: function (data) {
  2150. if (data == 'OK') {
  2151. _self.showSuccess(_self._localeStr.WEB_BATCHAPPROVESUCCESS)
  2152. _private.backto()
  2153. } else {
  2154. _self.showInfo(_self._localeStr.WEB_PLEASEREFRESH)
  2155. }
  2156. }
  2157. })
  2158. }
  2159. var cancel = function () {
  2160. return
  2161. }
  2162. if (showerror != '') {
  2163. waf.msgBox.showConfirm({
  2164. title: _self._localeStr.WEB_MESSPROMPT,
  2165. summaryMsg: showerror,
  2166. buttonType: 'ok-cancel',
  2167. buttonCallBack: [ok, cancel]
  2168. })
  2169. } else {
  2170. ok()
  2171. }
  2172. },
  2173. getApprove: function () {
  2174. var opinion = waf('#approveOpinion').val()
  2175. if (
  2176. assign.needApproveOpinion &&
  2177. (opinion == null || opinion.trim() == '')
  2178. ) {
  2179. _self.showInfo(_self._localeStr.WEB_APPROVALCOMMENTSNOBLANK)
  2180. return null
  2181. }
  2182. if (opinion != null && opinion.length > 1000) {
  2183. _self.showInfo(_self._localeStr.WEB_APPROVALCOMMENTSTOOLONG)
  2184. return null
  2185. }
  2186. var ispass = null
  2187. var approveResult = waf('#approveResult').wafRadioGroup('getValue')
  2188. if (approveResult == 'false') {
  2189. ispass = 'false'
  2190. if (assign.mustFillOpinionWhenDisagree == 'true') {
  2191. if (
  2192. opinion == null ||
  2193. opinion.trim() == '' ||
  2194. opinion == _self._localeStr.WEB_DISAGREE
  2195. ) {
  2196. _self.showInfo(_self._localeStr.WEB_DISAGREEOPINION)
  2197. return null
  2198. }
  2199. }
  2200. } else {
  2201. if (approveResult == 'true') {
  2202. ispass = 'true'
  2203. }
  2204. }
  2205. var approve = {}
  2206. approve.assignId = assign.assignId
  2207. approve.id = assign.id
  2208. approve.opinion = opinion
  2209. var handlerOpinion = waf('#policy').wafSelect('getValue')
  2210. if (handlerOpinion) {
  2211. approve.handlerOpinion = handlerOpinion
  2212. } else {
  2213. approve.handlerOpinion = '0'
  2214. }
  2215. approve.handlerContent = waf('#policy').wafSelect('getSelectedAlias')
  2216. approve.approveResult = ispass
  2217. approve.transitionId = transId
  2218. approve.isSendSMS = waf('#sendmsg').wafCheckbox('isChecked')
  2219. ? 'true'
  2220. : 'false'
  2221. approve.isSendMail = waf('#sendmail').wafCheckbox('isChecked')
  2222. ? 'true'
  2223. : 'false'
  2224. if (assign.multiapproveinfoId) {
  2225. approve.id = assign.multiapproveinfoId
  2226. }
  2227. var isesignaturecheck = false
  2228. if (approvetype == 'approve' || approvetype == 'batchapprove') {
  2229. isesignaturecheck = waf('#esignature').wafCheckbox('isChecked')
  2230. } else {
  2231. if (approvetype == 'manualdecision') {
  2232. isesignaturecheck = waf('#esignature1').wafCheckbox('isChecked')
  2233. }
  2234. }
  2235. if (assign.isEsignature && isesignaturecheck) {
  2236. approve.esignatureid = assign.esignatureId
  2237. }
  2238. return approve
  2239. },
  2240. beforeBatchSubmitSigature: function (selectBillIds) {
  2241. var modelIDs = ''
  2242. var tbillIDs
  2243. if (Object.prototype.toString.call(selectBillIds) === '[object Array]') {
  2244. tbillIDs = selectBillIds
  2245. } else {
  2246. tbillIDs = selectBillIds.split(';')
  2247. }
  2248. for (var i = 0; i < tbillIDs.length; i++) {
  2249. if (modelIDs != '') {
  2250. modelIDs += ','
  2251. }
  2252. modelIDs += tbillIDs[i]
  2253. }
  2254. if (modelIDs === undefined || modelIDs == null || modelIDs === '') {
  2255. waf.msgBox.showError("bill id can't be null")
  2256. return false
  2257. }
  2258. var actionUrl =
  2259. waf.getContextPath() +
  2260. '/component/ca.do?method=getPlainTextFromDB&billIDs=' +
  2261. waf.encodeURIComponent(modelIDs) +
  2262. '&isFromWF=true'
  2263. waf.doPost({
  2264. url: actionUrl,
  2265. async: false,
  2266. success: function (data) {
  2267. if (data == null || data == '' || data == undefined) {
  2268. return false
  2269. } else {
  2270. caConfig.plainTextMap = data.plainTextMap
  2271. }
  2272. },
  2273. error: function (data) {
  2274. waf.msgBox.showError('getPlainTextFromDB failed')
  2275. return false
  2276. }
  2277. })
  2278. var arraySignature = ''
  2279. var billids = modelIDs.split(',')
  2280. for (var i = 0; i < billids.length; i++) {
  2281. var key = billids[i]
  2282. var signResult = -1
  2283. try {
  2284. signResult = signMessage(
  2285. caConfig.plainTextMap[key],
  2286. caConfig.caConfigInfo.userName
  2287. )
  2288. } catch (errMsg) {
  2289. _self.showInfo(_self._localeStr.WEB_SIGANATUREFAILED + errMsg.message)
  2290. return false
  2291. }
  2292. if (signResult == 1 || signResult == 2 || signResult == 3) {
  2293. if (signResult == 1 || signResult == 2) {
  2294. _self.showInfo(_self._localeStr.WEB_SIGAFAILEDUSBKEY)
  2295. }
  2296. return false
  2297. }
  2298. if (arraySignature != '') {
  2299. arraySignature += ','
  2300. }
  2301. arraySignature += signResult
  2302. }
  2303. caConfig.plainSignatureMap = arraySignature
  2304. return true
  2305. },
  2306. getNextPersons: function (isSave) {
  2307. var locale = waf.getContext().locale
  2308. var symbol = '。'
  2309. if (locale == 'l1') {
  2310. symbol = '.'
  2311. }
  2312. showerror = ''
  2313. var nextPersons = []
  2314. var ispass = waf('#approveResult').wafRadioGroup('getValue')
  2315. if (ispass == 'false') {
  2316. return nextPersons
  2317. }
  2318. var isnextact = waf(nextActIndex).wafCheckbox('isChecked')
  2319. var directActName = ''
  2320. if (isnextact) {
  2321. var num = 0
  2322. var index = 0
  2323. var directCount = 0
  2324. var directIsSel = false
  2325. for (var i = 0; i != assign.nextActs.length; i++) {
  2326. if (_private.isPredict && !assign.nextActs[i].isPredict) {
  2327. continue
  2328. }
  2329. var act = {}
  2330. act.actKey = assign.nextActs[i].actKey
  2331. act.persons = {}
  2332. var flag = false
  2333. directCount++
  2334. for (var actId in selnextPersons) {
  2335. if (actId == assign.nextActs[i].actId) {
  2336. var persons = selnextPersons[actId]
  2337. for (var id in persons) {
  2338. act.persons[id] = 'true'
  2339. flag = true
  2340. }
  2341. }
  2342. }
  2343. if (directCount == 1) {
  2344. directIsSel = flag
  2345. }
  2346. if (!flag) {
  2347. if (num < 3) {
  2348. if (showerror != '') {
  2349. showerror += '、'
  2350. }
  2351. showerror += assign.nextActs[i].actName
  2352. }
  2353. num++
  2354. if (num == 1) {
  2355. directActName = assign.nextActs[i].actName
  2356. }
  2357. } else {
  2358. nextPersons[index] = act
  2359. index++
  2360. }
  2361. }
  2362. if (num > 0) {
  2363. if (num > 2) {
  2364. showerror +=
  2365. _self._localeStr.WEB_ANDSOON + num + _self._localeStr.WEB_NODE
  2366. }
  2367. if (!isSave && assign.mustSetAllNextPerson) {
  2368. _self.showInfo(
  2369. _self._localeStr.WEB_NEXTACTIVITY + ':' + showerror + symbol
  2370. )
  2371. return null
  2372. }
  2373. if (
  2374. !isSave &&
  2375. assign.mustSetAllNextPersonDirectNull &&
  2376. !directIsSel
  2377. ) {
  2378. _self.showInfo(
  2379. _self._localeStr.WEB_NEXTACTIVITY + ':' + directActName + symbol
  2380. )
  2381. return null
  2382. }
  2383. showerror += _self._localeStr.WEB_NOPARTICIPANTSUBMIT
  2384. }
  2385. }
  2386. return nextPersons
  2387. },
  2388. manualdecisionsubmit: function () {
  2389. var selectValue = waf('#radioDecision').wafRadioGroup('getValue')
  2390. if (selectValue) {
  2391. var selItems = $(
  2392. "#radioDecision input[value='" + selectValue + "']"
  2393. ).next()[0].innerHTML
  2394. var params = {}
  2395. var nextPersons = _private.getNextPersons()
  2396. if (!nextPersons) {
  2397. return
  2398. }
  2399. var ok = function () {
  2400. nextPersons = JSON.stringify(nextPersons)
  2401. params.nextperson = nextPersons
  2402. params.assignId = assign.assignId
  2403. params.decisionTitle = assign.decisionName
  2404. params.decisionItems = assign.decisionItems
  2405. params.decisionDesc = assign.decisionDesc
  2406. params.decisionOpinions = assign.decisionOpinions
  2407. params.SelectedItems = selItems
  2408. params.SelectedOpinions = selectValue.substr(
  2409. 0,
  2410. selectValue.indexOf('_')
  2411. )
  2412. waf.doPost({
  2413. url:
  2414. waf.getContextPath() + '/manualdecision/submit.do?method=submit',
  2415. data: params,
  2416. success: function (data) {
  2417. _self.showSuccess(_self._localeStr.WEB_DECISIONSUBMITSUCCESS)
  2418. _private.backto()
  2419. }
  2420. })
  2421. }
  2422. var cancel = function () {
  2423. return
  2424. }
  2425. if (showerror != '') {
  2426. waf.msgBox.showConfirm({
  2427. title: _self._localeStr.WEB_MESSPROMPT,
  2428. summaryMsg: showerror,
  2429. buttonType: 'ok-cancel',
  2430. buttonCallBack: [ok, cancel]
  2431. })
  2432. } else {
  2433. ok()
  2434. }
  2435. }
  2436. },
  2437. beforeInnerSubmit: function () {
  2438. if (
  2439. caConfig.caConfigInfo.checkPassword === 'true' &&
  2440. caConfig.caConfigInfo.isSignatureApprove === 'true' &&
  2441. caConfig.caConfigInfo.caType != '5'
  2442. ) {
  2443. _private.checkCAPassword(false)
  2444. } else {
  2445. _private.innerSubmit()
  2446. }
  2447. },
  2448. innerSubmit: function () {
  2449. if (
  2450. assign.mustUploadAttachment &&
  2451. waf('#approveResult').wafRadioGroup('getValue') == 'true'
  2452. ) {
  2453. var isCurAssignUploadAttach = false
  2454. waf.doPost({
  2455. url:
  2456. waf.getContextPath() +
  2457. '/iwebattachment.do?method=isCurAssignUploadAttach',
  2458. data: { assignId: assign.assignId },
  2459. async: false,
  2460. success: function (data) {
  2461. if (data == false) {
  2462. _self.showWarning(_self._localeStr.WEB_MUSTUPLOAD)
  2463. }
  2464. isCurAssignUploadAttach = data
  2465. }
  2466. })
  2467. if (!isCurAssignUploadAttach) {
  2468. return
  2469. }
  2470. }
  2471. assign.operation = 'approve'
  2472. var callback = function (isSuccess) {
  2473. if (isSuccess) {
  2474. _private._submit(false)
  2475. }
  2476. }
  2477. var issubmit = _private.checkIsSave(callback, 'submit')
  2478. if (issubmit == null) {
  2479. _self.jMessageAlert(_self._localeStr.WEB_CHECKERRORSUBMITEND)
  2480. return false
  2481. }
  2482. _private._submit(issubmit)
  2483. },
  2484. _submit: function (isReadOnly) {
  2485. var approve = _private.getApprove()
  2486. if (!approve) {
  2487. return
  2488. }
  2489. var nextPersons = _private.getNextPersons()
  2490. if (!nextPersons) {
  2491. return
  2492. }
  2493. var ok = function () {
  2494. approve.operation = assign.operation
  2495. var op = approve.operation
  2496. if (
  2497. caConfig.caConfigInfo.isSignatureApprove === 'true' &&
  2498. caConfig.caConfigInfo.caType != '5'
  2499. ) {
  2500. if (!_private.beforeSubmitSigature()) {
  2501. return
  2502. }
  2503. approve.plainText = caConfig.CA_plainText
  2504. approve.signature = caConfig.CA_signature
  2505. }
  2506. if (
  2507. isReadOnly === undefined ||
  2508. isReadOnly === null ||
  2509. isReadOnly === ''
  2510. ) {
  2511. isReadOnly = true
  2512. }
  2513. if (!isReadOnly) {
  2514. var frame = document.getElementById('billFrame')
  2515. if (
  2516. frame.contentDocument.getElementById('frame_tab_0') != null &&
  2517. frame.contentDocument.getElementById('frame_tab_0') != undefined
  2518. ) {
  2519. frame = frame.contentDocument.getElementById('frame_tab_0')
  2520. }
  2521. if (frame.contentWindow._self.getCurrentModel) {
  2522. var modelInfo = frame.contentWindow._self.getCurrentModel()
  2523. var editModel = JSON.stringify(modelInfo)
  2524. approve.model = editModel
  2525. }
  2526. if (approve.model == null) {
  2527. if (frame.contentWindow._self.fireEvent) {
  2528. var s = frame.contentWindow._self.fireEvent('save')
  2529. if (!s) {
  2530. return false
  2531. }
  2532. }
  2533. }
  2534. }
  2535. approve.isReadOnly = isReadOnly.toString()
  2536. approve.isSignatureApprove = caConfig.caConfigInfo.isSignatureApprove
  2537. approve.nextActs = nextPersons
  2538. if ($('#textCC').prop('personIds')) {
  2539. approve.ccPersonIds = $('#textCC').prop('personIds')
  2540. }
  2541. var params = {}
  2542. params.approve = JSON.stringify(approve)
  2543. waf.doPost({
  2544. url: waf.getContextPath() + '/common/tree.do?method=submits',
  2545. data: params,
  2546. success: function (data) {
  2547. if (data) {
  2548. assign.id = data
  2549. _self.showSuccess(_self._localeStr.WEB_SUBMITSUCCESS)
  2550. _private.backto()
  2551. } else {
  2552. _self.showInfo(_self._localeStr.WEB_PLEASEREFRESH)
  2553. }
  2554. }
  2555. })
  2556. }
  2557. var cancel = function () {
  2558. return
  2559. }
  2560. if (showerror != '') {
  2561. waf.msgBox.showConfirm({
  2562. title: _self._localeStr.WEB_MESSPROMPT,
  2563. summaryMsg: showerror,
  2564. buttonType: 'ok-cancel',
  2565. buttonCallBack: [ok, cancel]
  2566. })
  2567. } else {
  2568. ok()
  2569. }
  2570. },
  2571. beforeSubmitSigature: function () {
  2572. var plainText = ''
  2573. var signatureField = caConfig.caConfigInfo.signatureFields
  2574. if (signatureField === null || signatureField === '') {
  2575. return true
  2576. }
  2577. var signatureFields = signatureField.split(';')
  2578. for (var i = 0; i < signatureFields.length; i++) {
  2579. var srcValue = 'CANOTSIGNATURE'
  2580. try {
  2581. srcValue = eval(
  2582. "document.getElementById('billFrame').contentWindow.document.getElementsByName('" +
  2583. signatureFields[i] +
  2584. "')[0].value"
  2585. )
  2586. } catch (e) {
  2587. srcValue = 'CANOTSIGNATURE'
  2588. }
  2589. if (typeof srcValue == 'undefined') {
  2590. srcValue = 'CANOTSIGNATURE'
  2591. }
  2592. if (
  2593. caConfig.caConfigInfo.precisionInfo &&
  2594. caConfig.caConfigInfo.precisionInfo[signatureFields[i]]
  2595. ) {
  2596. var pos = parseInt(
  2597. caConfig.caConfigInfo.precisionInfo[signatureFields[i]]
  2598. )
  2599. if (pos < 0) {
  2600. pos = 2
  2601. } else {
  2602. if (pos > 4) {
  2603. pos = 4
  2604. }
  2605. }
  2606. srcValue = _private.toDecimal(srcValue, pos)
  2607. }
  2608. plainText = plainText + srcValue
  2609. }
  2610. var signResult = -1
  2611. try {
  2612. signResult = signMessage(plainText, caConfig.caConfigInfo.userName)
  2613. } catch (errMsg) {
  2614. _self.showInfo(_self._localeStr.WEB_SIGANATUREFAILED + errMsg.message)
  2615. return false
  2616. }
  2617. if (signResult == 1 || signResult == 2 || signResult == 3) {
  2618. if (signResult == 1 || signResult == 2) {
  2619. _self.showInfo(_self._localeStr.WEB_SIGAFAILEDUSBKEY)
  2620. return false
  2621. }
  2622. } else {
  2623. caConfig.CA_plainText = plainText
  2624. caConfig.CA_signature = signResult
  2625. }
  2626. return true
  2627. },
  2628. toDecimal: function (src, pos) {
  2629. var f = parseFloat(src)
  2630. if (isNaN(f)) {
  2631. return false
  2632. }
  2633. var src_rs = src.indexOf('.')
  2634. if (src_rs > 0) {
  2635. var src_zero = src.lastIndexOf('0')
  2636. while (src.length == src_zero + 1) {
  2637. src = src.substring(0, src_zero)
  2638. src_zero = src.lastIndexOf('0')
  2639. }
  2640. if (src.length == src_rs + 1) {
  2641. var src_int = src.substring(0, src_rs)
  2642. src = src_int
  2643. }
  2644. if (pos == 0) {
  2645. return src
  2646. }
  2647. }
  2648. var f = Math.round(src * Math.pow(10, pos)) / Math.pow(10, pos)
  2649. var s = f.toString()
  2650. var rs = s.indexOf('.')
  2651. if (rs < 0 && pos > 0) {
  2652. rs = s.length
  2653. s += '.'
  2654. }
  2655. while (s.length <= rs + pos) {
  2656. s += '0'
  2657. }
  2658. return s
  2659. },
  2660. save: function (event, value) {
  2661. var callback = function (isSuccess) {
  2662. if (isSuccess) {
  2663. _private._save()
  2664. }
  2665. }
  2666. var issubmit = _private.checkIsSave(callback, 'save')
  2667. if (issubmit == 'callBack') {
  2668. return
  2669. }
  2670. if (issubmit == null) {
  2671. _self.jMessageAlert(_self._localeStr.WEB_CHECKERRORSUBMITEND)
  2672. return false
  2673. }
  2674. _private._save(issubmit)
  2675. if (!issubmit && riskInsight) {
  2676. billInsightOption = _private.getWeakRisk()
  2677. _private.updateBillInsightNum(billInsightOption)
  2678. }
  2679. },
  2680. checkIsSave: function (callback, type) {
  2681. var issubmit = null
  2682. if (!assign.billIsReadOnly) {
  2683. if (
  2684. type == 'submit' &&
  2685. assign.disagreenotsave &&
  2686. waf('#approveResult').wafRadioGroup('getValue') == 'false'
  2687. ) {
  2688. return true
  2689. }
  2690. var frame = document.getElementById('billFrame')
  2691. if (frame) {
  2692. if (
  2693. frame.contentWindow._self &&
  2694. frame.contentWindow._self.saveAndCallBack
  2695. ) {
  2696. frame.contentWindow._self.saveAndCallBack(callback)
  2697. return 'callBack'
  2698. } else {
  2699. var canSaveBill = false
  2700. var haveChangeBill = null
  2701. var contentWindowSelf = null
  2702. if (frame.contentWindow._self) {
  2703. contentWindowSelf = frame.contentWindow._self
  2704. } else {
  2705. if (
  2706. frame.contentDocument.getElementById('frame_tab_0') &&
  2707. frame.contentDocument.getElementById('frame_tab_0')
  2708. .contentWindow._self
  2709. ) {
  2710. contentWindowSelf =
  2711. frame.contentDocument.getElementById('frame_tab_0')
  2712. .contentWindow._self
  2713. }
  2714. }
  2715. if (contentWindowSelf) {
  2716. var WFBizSubmitCheckPriority = false
  2717. if (contentWindowSelf.isWFBizSubmitCheckPriority) {
  2718. WFBizSubmitCheckPriority =
  2719. contentWindowSelf.isWFBizSubmitCheckPriority()
  2720. }
  2721. if (WFBizSubmitCheckPriority) {
  2722. if (contentWindowSelf.fireEvent) {
  2723. haveChangeBill = contentWindowSelf.fireEvent(
  2724. 'judgeDataModifyActionEvent',
  2725. ['workflow']
  2726. )
  2727. } else {
  2728. if (contentWindowSelf.checkBillDataChanges) {
  2729. haveChangeBill = contentWindowSelf.checkBillDataChanges()
  2730. }
  2731. }
  2732. if (contentWindowSelf.beforeSubmit) {
  2733. canSaveBill = contentWindowSelf.beforeSubmit()
  2734. } else {
  2735. if (contentWindowSelf.fireEvent) {
  2736. canSaveBill =
  2737. contentWindowSelf.fireEvent('fieldOnStoreEvent') &&
  2738. contentWindowSelf.fireEvent('submitBeforeActionEvent')
  2739. }
  2740. }
  2741. } else {
  2742. if (contentWindowSelf.beforeSubmit) {
  2743. canSaveBill = contentWindowSelf.beforeSubmit()
  2744. } else {
  2745. if (contentWindowSelf.fireEvent) {
  2746. canSaveBill =
  2747. contentWindowSelf.fireEvent('fieldOnStoreEvent') &&
  2748. contentWindowSelf.fireEvent('submitBeforeActionEvent')
  2749. }
  2750. }
  2751. if (contentWindowSelf.fireEvent) {
  2752. haveChangeBill = contentWindowSelf.fireEvent(
  2753. 'judgeDataModifyActionEvent',
  2754. ['workflow']
  2755. )
  2756. } else {
  2757. if (contentWindowSelf.checkBillDataChanges) {
  2758. haveChangeBill = contentWindowSelf.checkBillDataChanges()
  2759. }
  2760. }
  2761. }
  2762. if (canSaveBill) {
  2763. if (typeof haveChangeBill == 'boolean') {
  2764. issubmit = !haveChangeBill
  2765. } else {
  2766. issubmit = false
  2767. }
  2768. }
  2769. } else {
  2770. issubmit = true
  2771. }
  2772. }
  2773. } else {
  2774. issubmit = true
  2775. }
  2776. } else {
  2777. issubmit = true
  2778. }
  2779. return issubmit
  2780. },
  2781. _save: function (isReadOnly) {
  2782. assign.operation = 'approve'
  2783. var approve = _private.getApprove()
  2784. if (!approve) {
  2785. return
  2786. }
  2787. if (
  2788. isReadOnly === undefined ||
  2789. isReadOnly === null ||
  2790. isReadOnly === ''
  2791. ) {
  2792. isReadOnly = true
  2793. }
  2794. if (!isReadOnly) {
  2795. var frame = document.getElementById('billFrame')
  2796. if (
  2797. frame.contentDocument.getElementById('frame_tab_0') != null &&
  2798. frame.contentDocument.getElementById('frame_tab_0') != undefined
  2799. ) {
  2800. frame = frame.contentDocument.getElementById('frame_tab_0')
  2801. }
  2802. if (frame.contentWindow._self.getCurrentModel) {
  2803. var modelInfo = frame.contentWindow._self.getCurrentModel()
  2804. var editModel = JSON.stringify(modelInfo)
  2805. approve.model = editModel
  2806. }
  2807. if (approve.model == null) {
  2808. if (frame.contentWindow._self.fireEvent) {
  2809. var s = frame.contentWindow._self.fireEvent('save')
  2810. if (!s) {
  2811. return false
  2812. }
  2813. }
  2814. }
  2815. }
  2816. approve.isReadOnly = isReadOnly.toString()
  2817. if ($('#textCC').prop('personIds')) {
  2818. approve.ccPersonIds = $('#textCC').prop('personIds')
  2819. approve.personName = $('#textCC').prop('value')
  2820. }
  2821. var params = {}
  2822. params.approve = JSON.stringify(approve)
  2823. waf.doPost({
  2824. url: waf.getContextPath() + '/common/tree.do?method=saves',
  2825. data: params,
  2826. success: function (data) {
  2827. if (data) {
  2828. assign.id = data
  2829. _self.showSuccess(_self._localeStr.WEB_SAVESUCCESS)
  2830. }
  2831. }
  2832. })
  2833. },
  2834. backto: function () {
  2835. try {
  2836. if (
  2837. $('#billFrame').length > 0 &&
  2838. $('#billFrame')[0].contentWindow._self.fireEvent
  2839. ) {
  2840. $('#billFrame')[0].contentWindow._self.fireEvent('destroyEvent')
  2841. }
  2842. } catch (e) {
  2843. console.log('流程中心手动释放单据锁失败')
  2844. }
  2845. if (waf.isInFramePage()) {
  2846. waf.closeCurPageTab()
  2847. } else {
  2848. if (
  2849. top &&
  2850. top.jMessager &&
  2851. top.jMsgcenter &&
  2852. top.jMsgcenter.tab_post_add
  2853. ) {
  2854. setTimeout(function () {
  2855. top.jMessager.sendMsg(top.jMsgcenter.tab_close)
  2856. }, 800)
  2857. } else {
  2858. setTimeout(function () {
  2859. try {
  2860. if (window.opener) {
  2861. if (window.opener.refreshCurrentPage) {
  2862. window.opener.refreshCurrentPage()
  2863. }
  2864. if (opener.waf && opener.waf('#queryGrid')[0] != undefined) {
  2865. opener.waf('#queryGrid').wafGrid('reloadGrid')
  2866. }
  2867. }
  2868. } catch (e) {}
  2869. try {
  2870. // 尝试关闭窗口
  2871. window.close();
  2872. // 检查窗口是否仍然存在,如果存在则表示没有权限
  2873. if (!window.closed) {
  2874. console.log("没有权限关闭窗口。");
  2875. location.href = "/shr/dynamic.do?uipk=shr.workflow.view&inFrame=true";
  2876. }
  2877. } catch (error) {
  2878. console.log("关闭窗口失败:", error.message);
  2879. _self.showSuccess(_self._localeStr.WEB_TASKHASDONE)
  2880. }
  2881. }, 500)
  2882. }
  2883. }
  2884. },
  2885. addUploadHtml: function () {
  2886. var attachmentUploadUrl =
  2887. waf.getContextPath() +
  2888. '/iwebattachment.do?method=upload&bosID=' +
  2889. encodeURIComponent(assign.billId) +
  2890. '&beizhu=' +
  2891. assign.assignId
  2892. var options = {
  2893. autoUpload: true,
  2894. url: attachmentUploadUrl,
  2895. multiSelect: true,
  2896. onComplete: function (e, data) {
  2897. _private.getAttchmentcount()
  2898. },
  2899. onAdd: function (e, data) {},
  2900. onFail: function (e, data) {
  2901. if (data.result.length > 0) {
  2902. if (data.result[0].error) {
  2903. _self.showInfo(data.result[0].error)
  2904. }
  2905. }
  2906. }
  2907. }
  2908. $('#upload').wafFileUploadUI(options)
  2909. _private.getAttchmentcount()
  2910. },
  2911. getAttchmentcount: function () {
  2912. var params = {}
  2913. params.assignId = assign.assignId
  2914. params.billId = assign.billId
  2915. var pageType = _self.getUrlParam('type')
  2916. if (pageType != null && 'passComent' === pageType) {
  2917. params.isPassAround = true
  2918. }
  2919. waf.doPost({
  2920. url: waf.getContextPath() + '/iwebattachment.do?method=getDataList',
  2921. data: params,
  2922. success: function (data) {
  2923. if (data.disabled) {
  2924. $('#attchment,.attchmentnuminfo,#upload').remove()
  2925. return
  2926. }
  2927. if (!data.canAdd) {
  2928. $('#upload').remove()
  2929. }
  2930. var len = data.list.length
  2931. $('#attchmentnum').html(len)
  2932. if (len > 0) {
  2933. waf('#attchment').wafSection('open')
  2934. } else {
  2935. waf('#attchment').wafSection('close')
  2936. }
  2937. var _html = ''
  2938. for (var i = 0; i < len; i++) {
  2939. var row = data.list[i]
  2940. var simpleName = row.simpleName
  2941. var classname = 'file'
  2942. var picFormat = ['jpg', 'gif', 'jpeg', 'png', 'bmp']
  2943. if (picFormat.indexOf(simpleName) > -1) {
  2944. classname = 'pic'
  2945. }
  2946. _html +=
  2947. '<li><div><i class="' +
  2948. classname +
  2949. '"></i><span class="name" title="' +
  2950. row.name +
  2951. '.' +
  2952. simpleName +
  2953. '">' +
  2954. row.name +
  2955. '.' +
  2956. simpleName +
  2957. '</span><span class="size">(' +
  2958. row.size +
  2959. ')</span><a class="download" href="/easweb/webviews/workflow/download.jsp?bosID=' +
  2960. row.id +
  2961. '" download="' +
  2962. row.name +
  2963. '.' +
  2964. simpleName +
  2965. '" target="_blank"></a>'
  2966. if (classname == 'pic') {
  2967. _html +=
  2968. '<i class="preview" onclick="javascript:_self.attachmentView(\'' +
  2969. row.id +
  2970. "','pic')\"></i>"
  2971. } else {
  2972. if (simpleName == 'pdf') {
  2973. _html +=
  2974. '<i class="preview" onclick="javascript:_self.attachmentView(\'' +
  2975. row.id +
  2976. "','pdf')\"></i>"
  2977. }
  2978. }
  2979. if (row.canDelete) {
  2980. _html +=
  2981. '<i class="delete" onclick="javascript:_self.attachmentDelete(\'' +
  2982. row['boAttchAsso.id'] +
  2983. "','" +
  2984. row.id +
  2985. '\')"></i>'
  2986. }
  2987. _html += '</div></li>'
  2988. }
  2989. $('#attachmentContent ul')[0].innerHTML = _html
  2990. }
  2991. })
  2992. },
  2993. attachmentDelete: function (bosId, attachId) {
  2994. var ok = function () {
  2995. waf.doPost({
  2996. url: waf.getContextPath() + '/iwebattachment.do?method=delete',
  2997. data: { bosId: bosId, attachId: attachId },
  2998. success: function (data) {
  2999. _self.showSuccess(_self._localeStr.WEB_ATTACHMENTDELETESUCESS)
  3000. _self.getAttchmentcount()
  3001. }
  3002. })
  3003. }
  3004. var cancel = function () {
  3005. return
  3006. }
  3007. waf.msgBox.showConfirm({
  3008. title: _self._localeStr.WEB_MESSPROMPT,
  3009. summaryMsg: _self._localeStr.WEB_DeleteFile,
  3010. buttonType: 'ok-cancel',
  3011. buttonCallBack: [ok, cancel]
  3012. })
  3013. },
  3014. attachmentView: function (id, type) {
  3015. var url = ''
  3016. if (type == 'pic') {
  3017. url = '/easweb/webviews/workflow/viewpic.jsp?bosID=' + id
  3018. } else {
  3019. if (type == 'pdf') {
  3020. url =
  3021. '/easweb/webviews/webframework/webcom/attachment/view.jsp?bosID=' +
  3022. id
  3023. }
  3024. }
  3025. window.open(url, '_blank')
  3026. },
  3027. billImage: function (event, value) {
  3028. var params = {}
  3029. params.billID = assign.billId
  3030. params.method = 'getimageurl'
  3031. waf.doPost({
  3032. url: waf.getContextPath() + '/workflow/approve.do',
  3033. data: params,
  3034. success: function (data) {
  3035. var url = data.imgurl
  3036. if (url == '') {
  3037. _self.showWarning(
  3038. _self._localeStr.WEB_IMAGESTATE +
  3039. data.state +
  3040. _self._localeStr.WEB_SUPPORTSTATE
  3041. )
  3042. } else {
  3043. if (url == 'noImg') {
  3044. _self.showWarning(_self._localeStr.WEB_HASNOIMAGE)
  3045. } else {
  3046. window.open(url, '_blank')
  3047. }
  3048. }
  3049. }
  3050. })
  3051. },
  3052. bill: function (event, value) {
  3053. var para = {}
  3054. if (approvetype == 'batchapprove') {
  3055. var assignIds = _private.getbatchid().assignIds
  3056. if (assignIds.split(';').length != 1) {
  3057. _self.showInfo(_self._localeStr.WEB_SELECTARECORD)
  3058. return false
  3059. }
  3060. para.sourceID = assignIds
  3061. } else {
  3062. para.sourceID = assign.assignId
  3063. }
  3064. para.msgId = msgId
  3065. wfCommonUtil.showBill(para)
  3066. },
  3067. messageDigest: function () {
  3068. var messageDigest = assign.messageDigest
  3069. if (messageDigest.toString().indexOf('table') > 0) {
  3070. waf('#panel5').wafPanel('option', 'hidden', true)
  3071. waf('#bill').wafSection('option', 'hidden', false)
  3072. document.getElementById('bill_content').innerHTML = messageDigest
  3073. } else {
  3074. waf('#billFrame').remove()
  3075. waf('#billAttachment').remove()
  3076. var billDigest = eval('(' + messageDigest + ')')
  3077. var options = {
  3078. title: _self._localeStr.WEB_BASICINFO,
  3079. id: 'billBaseInfo',
  3080. name: 'billBaseInfo',
  3081. openIconCls: 'ui-section-minus',
  3082. closeIconCls: 'ui-section-plus',
  3083. autoOpen: true,
  3084. style: 'margin-right: 0px;'
  3085. }
  3086. var billBaseInfo = waf.createDOM('section', options)
  3087. waf.appendDOM(waf('#panel5'), billBaseInfo)
  3088. waf.initComponent('section', options, billBaseInfo)
  3089. var items = billDigest.items
  3090. for (var i = 0; i < items.length; i++) {
  3091. var labeloptions = {
  3092. id: 'labelContainer' + i,
  3093. caption: items[i][0],
  3094. style: 'width: 33%;float: left;'
  3095. }
  3096. var labeldom = waf.createDOM('labelContainer', labeloptions)
  3097. waf('#billBaseInfo').wafSection('appendChildren', labeldom)
  3098. waf.initComponent('labelContainer', labeloptions, labeldom)
  3099. var txtoptions = { id: 'billbase' + i, caption: items[i][1] }
  3100. var textDom = waf.createDOM('label', txtoptions)
  3101. labeldom.wafLabelContainer('append', textDom)
  3102. waf.initComponent('label', txtoptions, textDom)
  3103. }
  3104. var entries = billDigest.entrys
  3105. for (var j = 0; j < entries.length; j++) {
  3106. var obj = entries[j]
  3107. var billEntriesoptions = {
  3108. title: obj.alias.l2,
  3109. id: 'billEntriesInfo' + j,
  3110. name: 'billEntriesInfo' + j,
  3111. openIconCls: 'ui-section-minus',
  3112. closeIconCls: 'ui-section-plus',
  3113. autoOpen: true,
  3114. style: 'margin-right: 0px;'
  3115. }
  3116. var billEntriesInfo = waf.createDOM('section', billEntriesoptions)
  3117. waf.appendDOM(waf('#panel5'), billEntriesInfo)
  3118. waf.initComponent('section', billEntriesoptions, billEntriesInfo)
  3119. if (obj.values.length > 0) {
  3120. var colmodel = []
  3121. var env = obj.values[0].items
  3122. for (var m = 0; m < env.length; m++) {
  3123. var para = { name: env[m][3], label: env[m][0] }
  3124. colmodel.push(para)
  3125. }
  3126. var myGridoptions = { id: 'myGrid' + j, colModel: colmodel }
  3127. var dom = waf.createDOM('grid', myGridoptions)
  3128. waf('#billEntriesInfo' + j).wafSection('appendChildren', dom)
  3129. waf.initComponent('grid', myGridoptions, dom)
  3130. var rowData = obj.values
  3131. var gridData = new Array()
  3132. for (var n = 0; n < rowData.length; n++) {
  3133. var rr = rowData[n].items
  3134. var rowdata = {}
  3135. for (var h = 0; h < rr.length; h++) {
  3136. var colname = rr[h][3]
  3137. rowdata[colname] = rr[h][1]
  3138. }
  3139. gridData.push(rowdata)
  3140. }
  3141. waf('#myGrid' + j).wafGrid('addRow', { data: gridData })
  3142. }
  3143. }
  3144. }
  3145. },
  3146. initMsgDigestBillAttach: function () {
  3147. var billAttachmentList = assign.billAttachments
  3148. var billAttachmentOptions = {
  3149. title: _self._localeStr.WEB_ATTACHMENT,
  3150. id: 'billAttachment',
  3151. name: 'billAttachment',
  3152. openIconCls: 'ui-section-minus',
  3153. closeIconCls: 'ui-section-plus',
  3154. autoOpen: true,
  3155. style: 'margin-right: 0px;'
  3156. }
  3157. var billAttachment = waf.createDOM('section', billAttachmentOptions)
  3158. waf.appendDOM(waf('#panel5'), billAttachment)
  3159. waf.initComponent('section', billAttachmentOptions, billAttachment)
  3160. $('#billAttachment .title').after(
  3161. '<span id="billAttachTitle">' +
  3162. _self._localeStr.WEB_TOTALATCHMNT +
  3163. '<i></i><span>' +
  3164. billAttachmentList.length +
  3165. '</span>个</span>'
  3166. )
  3167. var _html = "<div class='attachmentContent'><ul>"
  3168. for (var i = 0; i < billAttachmentList.length; i++) {
  3169. var row = billAttachmentList[i]
  3170. var simpleName = row.simpleName
  3171. var classname = 'file'
  3172. var picFormat = ['jpg', 'gif', 'jpeg', 'png', 'bmp']
  3173. if (picFormat.indexOf(simpleName) > -1) {
  3174. classname = 'pic'
  3175. }
  3176. var judgeAttachType = ''
  3177. if (row.attachTypeEnum == 1) {
  3178. judgeAttachType =
  3179. "<span class='procAttach'>" +
  3180. _self._localeStr.WEB_PROCESSATTACHMENTS +
  3181. '</span>'
  3182. }
  3183. _html +=
  3184. '<li><div><i class="' +
  3185. classname +
  3186. '"></i><span class="name" title="' +
  3187. row.name +
  3188. '.' +
  3189. simpleName +
  3190. '">' +
  3191. judgeAttachType +
  3192. row.name +
  3193. '.' +
  3194. simpleName +
  3195. '</span><span class="size">(' +
  3196. row.size +
  3197. ')</span><a class="download" href="/easweb/webviews/workflow/download.jsp?bosID=' +
  3198. row.id +
  3199. '" download="' +
  3200. row.name +
  3201. '.' +
  3202. simpleName +
  3203. '" target="_blank"></a>'
  3204. if (classname == 'pic') {
  3205. _html +=
  3206. '<i class="preview" onclick="javascript:_self.attachmentView(\'' +
  3207. row.id +
  3208. "','pic')\"></i>"
  3209. } else {
  3210. if (simpleName == 'pdf') {
  3211. _html +=
  3212. '<i class="preview" onclick="javascript:_self.attachmentView(\'' +
  3213. row.id +
  3214. "','pdf')\"></i>"
  3215. }
  3216. }
  3217. _html += '</div></li>'
  3218. }
  3219. _html += '</ul></div>'
  3220. return _html
  3221. },
  3222. selattachment: function (item, attcreater, beizhu) {},
  3223. showoperate: function (event, value) {
  3224. var para = {}
  3225. if (approvetype == 'batchapprove') {
  3226. var assignIds = _private.getbatchid().assignIds
  3227. if (assignIds.split(';').length != 1) {
  3228. _self.showInfo(_self._localeStr.WEB_SELECTARECORD)
  3229. return false
  3230. }
  3231. para.assignmentId = assignIds.split(';')[0]
  3232. } else {
  3233. para.assignmentId = assign.assignId
  3234. }
  3235. if (wfCommonUtil.getOperationRecordsPerm(para.assignmentId)) {
  3236. wfCommonUtil.showApproveDetail(para)
  3237. } else {
  3238. waf.msgBox.showInfo({
  3239. title: _self._localeStr.WEB_MESSAGEALERT,
  3240. summaryMsg: _self._localeStr.WEB_FORBIDVIEW
  3241. })
  3242. $('.ui-msgbox .content').width('330px')
  3243. }
  3244. },
  3245. esignatureOnClick: function (event, ui) {
  3246. if (ui.checked) {
  3247. $('#esigndiv').show()
  3248. } else {
  3249. $('#esigndiv').hide()
  3250. }
  3251. },
  3252. isWaf1Bill: function (url) {},
  3253. jMessageAlert: function (message) {
  3254. _self.showInfo(message)
  3255. },
  3256. onselect: function (event, ui) {
  3257. if (riskInsight) {
  3258. if (ui.panel.id == 'riskInsight') {
  3259. waf('#billInsight').billInsight(
  3260. 'intelligentInspection',
  3261. billInsightOption.list
  3262. )
  3263. waf('body').unbind('click')
  3264. $('.billInsight_cardPanel').draggable('disable')
  3265. _private.updateBillInsightNum(billInsightOption)
  3266. _private.resizeBillInsight(false)
  3267. _private.curTab = 'riskInsight'
  3268. } else {
  3269. $('.billInsight_cardPanel').css('display', 'none')
  3270. _private.curTab = ''
  3271. }
  3272. }
  3273. },
  3274. resizeBillInsight: function (windowResize) {
  3275. var top = $('#li_approveTask').offset().top + 44
  3276. var left = $('#li_approveTask').offset().left
  3277. if (!windowResize) {
  3278. left += 10
  3279. }
  3280. var width = $('#tabs_ul').width()
  3281. var t =
  3282. $('.ui-cardPanel').attr('style') + 'width:' + width + 'px !important'
  3283. $('.billInsight_cardPanel').css('cssText', t)
  3284. $('.billInsight_cardPanel').css({ top: top, left: left })
  3285. $(
  3286. '.ui-cardPanel .noRecords,.ui-cardPanel .noRecordsImage,.ui-cardPanel .noRecordsText'
  3287. ).css({ width: '100%', margin: '0px', 'min-width': '160px' })
  3288. },
  3289. getWeakRisk: function () {
  3290. var urlParams = waf.getUrlParam(assign.billEditUrl)
  3291. var billId = urlParams.billId
  3292. var uipk = urlParams.uipk
  3293. var billInsightOption = {}
  3294. waf.doPost({
  3295. async: false,
  3296. url:
  3297. waf.getContextPath() + '/risk/ForWebController.do?method=getWeakRisk',
  3298. data: { uipk: uipk, id: billId, riskIds: assign.riskInsight },
  3299. success: function (data) {
  3300. if (data != null) {
  3301. billInsightOption = data
  3302. }
  3303. }
  3304. })
  3305. return billInsightOption
  3306. },
  3307. updateBillInsightNum: function (billInsightOption) {
  3308. if (!billInsightOption.allExecSuccess) {
  3309. $('#li_riskInsight span')
  3310. .eq(0)
  3311. .text(
  3312. _self._localeStr.WEB_RISKINSIGHT +
  3313. '(' +
  3314. billInsightOption.failSize +
  3315. ')'
  3316. )
  3317. } else {
  3318. $('#li_riskInsight span').eq(0).text(_self._localeStr.WEB_RISKINSIGHT)
  3319. }
  3320. },
  3321. openPerson: function (event, value) {
  3322. var selectedIds = waf('#textCC').prop('personIds')
  3323. var height = 552
  3324. if (window.screen.height < 800) {
  3325. height = 500
  3326. }
  3327. var tempWin
  3328. if (parent.waf) {
  3329. tempWin = parent.waf.window
  3330. } else {
  3331. tempWin = waf.window
  3332. }
  3333. var params = {}
  3334. params.f7Type = encodeURIComponent('person')
  3335. params.singleSelect = false
  3336. tempWin.open({
  3337. url:
  3338. waf.getContextPath() +
  3339. '/webviews/workflow/commonSelectF7.jsp?selectedIds=' +
  3340. encodeURIComponent(selectedIds),
  3341. openType: 'iframe',
  3342. method: 'POST',
  3343. data: params,
  3344. style: { padding: '0px' },
  3345. modal: true,
  3346. title: _self._localeStr.WEB_CC,
  3347. position: 'center',
  3348. width: 1000,
  3349. height: height,
  3350. minHeight: height,
  3351. minWidth: 1000,
  3352. iconCls: 'waf-ui-icon',
  3353. draggable: true,
  3354. resizable: true,
  3355. close: function (event, ui) {},
  3356. retValCallBack: function (resultData) {
  3357. if (
  3358. resultData &&
  3359. resultData.resultStr &&
  3360. resultData.resultStr.length > 0
  3361. ) {
  3362. var val = resultData.resultStr.split('||')
  3363. waf('#textCC').prop('personIds', val[1])
  3364. waf('#textCC').val(val[2])
  3365. }
  3366. }
  3367. })
  3368. },
  3369. _pageLoadCompletedEventHandler: function () {},
  3370. openAttachmentPage: function (event, value) {
  3371. var url =
  3372. '/easweb/dynamicPage.do?event=initialize&method=doEvent&uipk=com.kingdee.bos.workflow.metas.AttachmentList&assignId=' +
  3373. assign.assignId +
  3374. '&billId=' +
  3375. encodeURIComponent(assign.billId)
  3376. var pageType = _self.getUrlParam('type')
  3377. if (pageType != null && 'passComent' === pageType) {
  3378. url += '&isPassAround=true'
  3379. }
  3380. waf.window.open({
  3381. url: url,
  3382. openType: 'iframe',
  3383. modal: true,
  3384. title: _self._localeStr.WEB_ATCHMNTMANAGE,
  3385. position: 'center',
  3386. width: 900,
  3387. height: 600,
  3388. iconCls: 'waf-ui-icon',
  3389. draggable: true,
  3390. resizable: true,
  3391. close: function (event, ui) {
  3392. waf.window.close()
  3393. _private.refreshAttachCount()
  3394. }
  3395. })
  3396. },
  3397. refreshAttachCount: function () {
  3398. waf.doPost({
  3399. url:
  3400. waf.getContextPath() +
  3401. '/iwebattachment.do?method=getAttachCountByBill',
  3402. data: { billId: assign.billId },
  3403. async: false,
  3404. success: function (data) {
  3405. _private.refreshAttachCountInner(data)
  3406. }
  3407. })
  3408. },
  3409. refreshAttachCountInner: function (count) {
  3410. var attachmentBtnTitle = _self._localeStr.WEB_ATCHMNTMANAGE
  3411. if (count > 0) {
  3412. attachmentBtnTitle =
  3413. _self._localeStr.WEB_ATCHMNTMANAGE + '(' + count + ')'
  3414. }
  3415. $('#attachmentBtn span').text(attachmentBtnTitle)
  3416. },
  3417. getAssignInfo: function () {
  3418. return assign
  3419. }
  3420. })
  3421. _self.subscribeEvent(
  3422. 'pageLoadCompletedEvent',
  3423. _private._pageLoadCompletedEventHandler,
  3424. 'after'
  3425. )
  3426. return _public
  3427. })