TabFormView.vue 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182
  1. <template>
  2. <div class="container-fluid">
  3. <!-- header -->
  4. <div style="position: relative">
  5. <div class="row clearfix">
  6. <div class="col-md-12">
  7. <h3>
  8. <a class="a-back" @click="back()"><img class="m-image" src="/static/assets/client-base-v4/image/back.png" />{{
  9. Language.getNameTrl($i18n.locale, window)
  10. }}&nbsp;</a>/&nbsp;{{ subTitle() }}
  11. <div class="btn-group" role="group">
  12. <button type="button" class="btn btn-default" @click="pre">
  13. <span class="glyphicon glyphicon-chevron-left" aria-hidden="true" />
  14. </button>
  15. <button type="button" class="btn btn-default" @click="auditData">
  16. {{ currIndex }}/{{ totalCount }}
  17. </button>
  18. <button type="button" class="btn btn-default" @click="next">
  19. <span class="glyphicon glyphicon-chevron-right" aria-hidden="true" />
  20. </button>
  21. </div>
  22. </h3>
  23. </div>
  24. </div>
  25. <div v-show="showSpaceRow" class="row">
  26. <div class="col-md-12">
  27. <div class="m-space-btn-group" />
  28. </div>
  29. </div>
  30. <div ref="fixedButtonGroup" class="row m-row fixed-btn-group">
  31. <div class="col-md-12">
  32. <div class="btn-group">
  33. <button
  34. v-if="showCreateButton && windowDisplayType == 'Grid'" type="button" class="btn btn-primary"
  35. @click="createRecord"
  36. >
  37. {{ $t("lang.tabFormView.create") }}
  38. </button>
  39. <button
  40. v-if="showEditButton && windowDisplayType == 'Grid'" type="button" class="btn btn-info"
  41. @click="editRecord"
  42. >
  43. {{ $t("lang.tabFormView.edit") }}
  44. </button>
  45. <button type="button" class="btn btn-default" @click="refresh">
  46. {{ $t("lang.tabFormView.refresh") }}
  47. </button>
  48. <button
  49. v-if="isView == true && windowDisplayType == 'Grid'" type="button" class="btn btn-default"
  50. @click="changeWindowDisplayType"
  51. >
  52. {{ $t("lang.tabFormView.reportView") }}
  53. </button>
  54. <button
  55. v-if="isView == true && windowDisplayType == 'Report'" type="button" class="btn btn-default"
  56. @click="changeWindowDisplayType"
  57. >
  58. {{ $t("lang.tabFormView.formView") }}
  59. </button>
  60. <button
  61. v-if="showDeleteButton && windowDisplayType == 'Grid'" type="button" class="btn btn-danger"
  62. @click="deleteRecord(true)"
  63. >
  64. {{ $t("lang.tabFormView.remove") }}
  65. </button>
  66. <button v-if="showRedrawButton" type="button" class="btn btn-default" @click="abandonWorkflow">
  67. {{ $t("lang.tabFormView.redraw") }}
  68. </button>
  69. <TabButton
  70. :show-tab-dto="tab" :model-data="modelData" :uuid="uuid" :view-type="'Form'"
  71. :tab-buttons="tab.tabFormView ? tab.tabFormView.tabButtons : null"
  72. :curd-window-function-access="curdWindowFunctionAccess" @save-view="backupView"
  73. @process-execute-finish="refresh" @model-data-changed="modelDataChanged"
  74. />
  75. <FormFieldDef
  76. :tab-form-fields="tabFormFields" :window-no="windowNo" :tab-index="tabIndex"
  77. @tab-form-field-property-changed="
  78. tabFormFieldPropertyChanged($event)
  79. "
  80. />
  81. <button
  82. v-if="window.htmlHelpUrl != null && window.htmlHelpUrl != ''" class="btn btn-default"
  83. @click="openHtmlHelp(window.htmlHelpUrl)"
  84. >
  85. <span class="glyphicon glyphicon-question-sign" />
  86. </button>
  87. </div>
  88. </div>
  89. </div>
  90. <img
  91. v-if="processInstanceId != undefined" style="
  92. position: absolute;
  93. right: 0px;
  94. top: 118px;
  95. z-index: 2;
  96. width: 100px;
  97. " :src="getWorkFlowImageUrl()"
  98. />
  99. </div>
  100. <div v-if="windowDisplayType == 'Grid'">
  101. <!-- eslint-disable-next-line -->
  102. <div v-html="headerHtml" />
  103. <div v-if="tab != null && tab.tabFormView != null" class="m-row clearfix">
  104. <div class="col-xs-12">
  105. <div
  106. :class="{
  107. 'form-inline': tab.tabFormView.multipleColumn,
  108. 'form-horizontal': !tab.tabFormView.multipleColumn,
  109. }"
  110. >
  111. <template
  112. v-for="fieldItem in tabFormFields" :key="
  113. 'TabFormFieldView_' +
  114. windowNo +
  115. '_' +
  116. tabIndex +
  117. '_' +
  118. fieldItem.fieldName +
  119. '_' +
  120. fieldItem.entityFieldIndex
  121. "
  122. >
  123. <TabFormFieldView
  124. ref="fieldItem1" :class-name="tab.tabDataSource.className" :field="fieldItem"
  125. :model-data="modelData" :multiple-column="tab.tabFormView.multipleColumn"
  126. :js-url="jsUrl"
  127. :is-chinese-english="window.isChineseEnglish"
  128. @execute-callout="executeCallout(fieldItem)"
  129. />
  130. </template>
  131. </div>
  132. </div>
  133. </div>
  134. <div
  135. v-if="
  136. tab != null &&
  137. tab.tabFormView != null &&
  138. tab.tabFormView.fieldGroups != null &&
  139. tab.tabFormView.fieldGroups.length > 0
  140. " class="m-row clearfix"
  141. >
  142. <ul id="myTabs" class="nav nav-tabs" role="tablist">
  143. <li
  144. v-for="(fieldGroup, fieldGroupIndex) in tab.tabFormView.fieldGroups" :key="fieldGroup.groupName"
  145. role="presentation" :class="{ active: selectedTabIndex == fieldGroupIndex }"
  146. @click="selectedTabIndex = fieldGroupIndex"
  147. >
  148. <a
  149. :id="'tab-' + fieldGroupIndex" role="tab" data-toggle="tab"
  150. aria-controls="home" aria-expanded="true"
  151. >
  152. {{ Language.getGroupNameTrl($i18n.locale, fieldGroup) }}
  153. </a>
  154. </li>
  155. </ul>
  156. <div id="myTabContent" class="tab-content">
  157. <div
  158. v-for="(fieldGroup, fieldGroupIndex) in tab.tabFormView.fieldGroups"
  159. v-show="selectedTabIndex == fieldGroupIndex" id="home" :key="fieldGroup.groupName" role="tabpanel"
  160. class="tab-pane fade active in" aria-labelledby="home-tab"
  161. >
  162. <div v-if="fieldGroup.show">
  163. <div
  164. :class="{
  165. 'form-inline': tab.tabFormView.multipleColumn,
  166. 'form-horizontal': !tab.tabFormView.multipleColumn,
  167. }"
  168. >
  169. <template
  170. v-for="fieldItem in fieldGroup.fields" :key="
  171. 'TabFormFieldView_' +
  172. windowNo +
  173. '_' +
  174. tabIndex +
  175. '_' +
  176. fieldItem.fieldName +
  177. '_' +
  178. fieldItem.entityFieldIndex
  179. "
  180. >
  181. {{ window.isChineseEnglish }}
  182. <TabFormFieldView
  183. ref="fieldItem2" :class-name="tab.tabDataSource.className" :field="fieldItem"
  184. :model-data="modelData" :multiple-column="tab.tabFormView.multipleColumn" :js-url="jsUrl"
  185. :is-chinese-english="window.isChineseEnglish"
  186. @execute-callout="executeCallout(fieldItem)"
  187. />
  188. </template>
  189. </div>
  190. </div>
  191. </div>
  192. </div>
  193. </div>
  194. <!-- eslint-disable-next-line -->
  195. <div v-html="footerHtml" />
  196. <template v-if="modelData != null">
  197. <div
  198. v-for="subTab in tab.subTabs"
  199. :id="'SubTabGridEdit-' + windowNo + '-' + tabIndex + '-' + modelData.id + '-subTab-' + subTab.tabIndex"
  200. :key="'SubTabGridEdit-' + windowNo + '-' + tabIndex + '-' + modelData.id + '-subTab-' + subTab.tabIndex"
  201. class="row clearfix"
  202. >
  203. <div class="col-md-12">
  204. <SubTabGridEdit
  205. :ref="'subTab' + subTab.tabIndex" :window-no="windowNo" :tab-index="subTab.tabIndex"
  206. :fixed-button-group-height="fixedButtonGroupHeight" :is-show-edit="false" :tab="subTab"
  207. :parent-model-data="modelData" :parent-tab="tab" :js-url="jsUrl" :is-chinese-english="window.isChineseEnglish"
  208. @save-view="backupView"
  209. @process-execute-finish="refresh"
  210. />
  211. </div>
  212. </div>
  213. </template>
  214. <div v-if="attributeKey != null && attributeKey === true" class="row clearfix">
  215. <div class="col-md-12">
  216. <AttributeViewPanel
  217. ref="attributePanel" :attribute-key="attributeKey"
  218. :attribute-value-key="attributeValueKey" :window-no="windowNo"
  219. />
  220. </div>
  221. </div>
  222. </div>
  223. <div v-else style="height: 400px; overflow: scroll">
  224. <ProcessReportResultPreview
  225. v-if="
  226. processReportResult != null &&
  227. (processReportResult.reportResults != null ||
  228. processReportResult.processResult != null)
  229. " :process-report-result="processReportResult" :pdf-only="false" :excel-only="false"
  230. />
  231. </div>
  232. <div v-if="showApply" class="row clearfix">
  233. <div v-if="window.workflow.workflowType === 'UserDefine'" class="col-md-12">
  234. <WorkflowUserDefine
  235. ref="workflowUserDefine" :work-flow="window.workflow"
  236. :process-definition-id="processDefinitionId" :model-data="modelData" @apply="apply"
  237. />
  238. </div>
  239. <div v-else-if="window.workflow.workflowType === 'OTHER'" class="col-md-12">
  240. <WorkflowStart
  241. :work-flow="window.workflow"
  242. :process-definition-id="processDefinitionId" @apply="apply"
  243. />
  244. </div>
  245. <div v-else class="col-md-12">
  246. <WorkflowSelectUser
  247. ref="workflow" :work-flow="window.workflow" :window-no="windowNo"
  248. :process-definition-id="processDefinitionId" :model-data="modelData" :record-id="recordId" @apply="apply"
  249. />
  250. </div>
  251. </div>
  252. <div v-if="showApproveComment" class="row clearfix">
  253. <div class="col-md-12">
  254. <ApproveComment
  255. ref="approveComment" :parent-widget="'TabFormView'" :workflow-type="workflowType"
  256. :work-flow="window.workflow" :window-no="windowNo" :process-definition-id="processDefinitionId"
  257. :show-choice-button="showChoiceButton" :process-instance-id="processInstanceId" :task-info-id="taskInfoId"
  258. :record-id="modelData.id" :show-tab-dto="tab" :model-data="modelData" :uuid="uuid" :workflow-class-name="tab.tabDataSource.className"
  259. @save-view="backupView"
  260. />
  261. </div>
  262. </div>
  263. <!-- 历史审批记录 -->
  264. <div v-if="showHistoryApproveComment" class="row clearfix">
  265. <div class="col-md-12">
  266. <HistoryApproveComment :record-id="modelData.id" :process-instance-id="processInstanceId" />
  267. </div>
  268. </div>
  269. <div
  270. v-if="
  271. window != null &&
  272. tab != null &&
  273. tab.tabDataSource != null &&
  274. !window.hideCreateRecordButton && showAttachmentPanel == true
  275. " class="row clearfix"
  276. >
  277. <AttachmentPanel
  278. v-if="type == 'view'" :is-show-edit="true" :class-name="tab.tabDataSource.className"
  279. :record-id="recordId" :tab-index="tabIndex" :window-no="windowNo"
  280. :curd-window-function-access="curdWindowFunctionAccess"
  281. />
  282. </div>
  283. <Modal v-model:show="modal2" :large="true" @ok="showAuditPanel = false" @cancel="showAuditPanel = false">
  284. <template #header>
  285. {{ $t("lang.tabFormView.recordInformation") }}{{ currIndex }}/{{ totalCount }} - {{ tab.name }}
  286. </template>
  287. <TabAudit v-if="showAuditPanel" :window-no="windowNo" :tab-index="tabIndex" :tab="tab" :model-data="modelData" />
  288. </Modal>
  289. <Modal v-model:show="modal3" :large="true" :show-canel-button="false" :show-ok-button="false" title="创建评论">
  290. <CurdWindowCommentCreate ref="curdCommentCreate" :record-id="modelData.id" :window-no="modelData.windowNo" />
  291. <template #footer>
  292. <button type="submit" class="btn btn-default" @click="saveAndSendNotification">
  293. 确认
  294. </button>
  295. <button type="button" class="btn btn-default" @click="cancelNotification">
  296. 取消
  297. </button>
  298. </template>
  299. </Modal>
  300. <div>
  301. <div class="page-header">
  302. <h4>评论信息</h4>
  303. </div>
  304. <CurdWindowComment ref="curdComment" :record-id="modelData.id" />
  305. </div>
  306. <div>
  307. <button
  308. type="button"
  309. style="width: 100%; margin-top: 5px"
  310. class="btn btn-default"
  311. aria-label="Left Align"
  312. @click="openCurdWindowComment"
  313. >
  314. <span class="glyphicon glyphicon-pencil" aria-hidden="true" />
  315. <span style="margin-left: 10px">评论</span>
  316. </button>
  317. </div>
  318. <Loading v-if="loading" />
  319. </div>
  320. </template>
  321. <script>
  322. import Common from '../../common/Common.js';
  323. import WindowServerUtil from '../../resource/dictionary/WindowServerUtil.js';
  324. import WindowClientUtil from '../../resource/dictionary/WindowClientUtil.js';
  325. import TabFormView from './TabFormView.js';
  326. import FieldUtil from '../../resource/dictionary/FieldUtil.js';
  327. import ProcessReportResource from '../../api/dic/ProcessReportResource.js';
  328. import UserStorageResource from '../../api/base/UserStorageResource.js';
  329. import UserReadDocumentResource from '../../api/base/UserReadDocumentResource.js';
  330. import Language from '../../common/Language.js';
  331. import Context from '../common/Context.js';
  332. import CurdWindowResource from '../../api/dic/CurdWindowResource.js';
  333. import SubTabGridEdit from '../tabGridView/SubTabGridEdit.vue';
  334. import TabFormFieldView from './TabFormFieldView.vue';
  335. import TabButton from '../tabView/TabButton.vue';
  336. import FormFieldDef from '../tab-form-common/FormFieldDef.vue';
  337. import AttachmentPanel from '../attachment/AttachmentPanel.vue';
  338. import AttributeViewPanel from '../attribute/AttributeViewPanel.vue';
  339. import WorkflowSelectUser from '../../workflow/WorkflowSelectUser.vue';
  340. import WorkflowStart from '../../workflow/WorkflowStart.vue';
  341. import WorkflowUserDefine from '../../workflow/WorkflowUserDefine.vue';
  342. import TabAudit from '../tabView/TabAudit.vue';
  343. import ApproveComment from '../../workflow/ApproveComment.vue';
  344. import CurdWindowResourceV2 from '../../api/dic/CurdWindowResourceV2.js';
  345. import CurdWindowEditResource from '../../api/dic/CurdWindowEditResource.js';
  346. import JsUtil from '../../common/JsUtil.js';
  347. import { Notify, Uuid } from 'pc-component-v3';
  348. import CurdWindowComment from './CurdWindowComment.vue';
  349. import CurdWindowCommentCreate from './CurdWindowCommentCreate.vue';
  350. import NotificationPanel from '../../customer/NotificationPanel.vue';
  351. import HistoryApproveComment from '../../workflow/HistoryApproveComment.vue';
  352. export default {
  353. components: {
  354. SubTabGridEdit,
  355. TabFormFieldView,
  356. TabButton,
  357. FormFieldDef,
  358. AttachmentPanel,
  359. AttributeViewPanel,
  360. WorkflowSelectUser,
  361. WorkflowStart,
  362. ApproveComment,
  363. TabAudit,
  364. WorkflowUserDefine,
  365. CurdWindowComment,
  366. CurdWindowCommentCreate,
  367. NotificationPanel,
  368. HistoryApproveComment,
  369. },
  370. data: function () {
  371. this.Language = Language;
  372. return {
  373. type: '', // 窗口类型
  374. windowNo: '', // 窗口Id
  375. tabIndex: '', // 页签Id
  376. recordId: '', // 记录Id
  377. window: {}, // 窗口数据
  378. tab: {}, // 父页签
  379. tabFormFields: [],
  380. multipeColumnFields: [],
  381. modelData: {},
  382. errorCount: 0, // 校验错误数量
  383. errorMsg: '', // 校验错误信息
  384. error: 0,
  385. uuid: Uuid.createUUID(), // 创建UUID
  386. headerHtml: '', // Tab头HTML
  387. footerHtml: '', // Tab尾HTML
  388. headerApiUrl: '', // Tab头API URL
  389. footerApiUrl: '', // Tab尾API URL
  390. currPage: 1,
  391. attributeKey: undefined,
  392. attributeValueKey: undefined,
  393. processInstanceId: undefined,
  394. workflowType: undefined,
  395. taskInfoId: undefined,
  396. currIndex: 0,
  397. totalCount: 0,
  398. buttonGroupInitLeft: 0,
  399. buttonGroupInitTop: 0,
  400. showSpaceRow: false,
  401. // 工作流定义Id
  402. processDefinitionId: '',
  403. showAuditPanel: false,
  404. fixedButtonGroupHeight: 0,
  405. selectedTabIndex: 0, // 选择的页签序号
  406. // 允许后退
  407. canGoBack: true,
  408. windowDisplayType: 'Grid', //显示类型
  409. processReportResult: undefined,
  410. isView: true, //是否显示模式切换按钮
  411. curdWindowFunctionAccess: null, //权限
  412. jsUrl: null,
  413. loading: false,
  414. modal2: false,
  415. modal3: false,
  416. notificationModal: false,
  417. };
  418. },
  419. computed: {
  420. /**
  421. * 是否显示审批按钮
  422. */
  423. showApply: function () {
  424. // 判断是否显示审批按钮
  425. if (this.window == undefined) {
  426. return false;
  427. }
  428. if (this.window.workflow == undefined) {
  429. return false;
  430. }
  431. // 已经审批的单据,不显示审批按钮。
  432. if (
  433. this.modelData != undefined &&
  434. this.modelData.data != undefined &&
  435. this.modelData.data.processInstanceId != undefined &&
  436. this.modelData.data.processInstanceId.displayValue != undefined &&
  437. this.modelData.data.processInstanceId.displayValue[0] != undefined &&
  438. this.modelData.data.processInstanceId.displayValue[0].length > 0
  439. ) {
  440. return false;
  441. }
  442. if (this.modelData == undefined || this.modelData.data == undefined) {
  443. return false;
  444. }
  445. return true;
  446. },
  447. /**
  448. * 是否显示审批面板
  449. * 处于审批中的单据,显示审批面板
  450. */
  451. showApproveComment: function () {
  452. // 判断是否显示审批按钮
  453. if (
  454. this.window != undefined &&
  455. this.window.hasWorkflow != undefined &&
  456. this.modelData != undefined &&
  457. this.modelData.data != undefined &&
  458. this.modelData.data.processInstanceId != undefined &&
  459. this.modelData.data.processInstanceId.displayValue != undefined &&
  460. this.modelData.data.processInstanceId.displayValue[0] != undefined &&
  461. this.modelData.data.processInstanceId.displayValue[0].length > 0
  462. ) {
  463. return true;
  464. }
  465. return false;
  466. },
  467. /**
  468. * 是否显示历史审批记录面板
  469. * 处于审批中的单据,显示审批面板
  470. */
  471. showHistoryApproveComment: function(){
  472. if (
  473. this.window != null &&
  474. this.window.workflow != null &&
  475. this.modelData != null
  476. ) {
  477. return true;
  478. }
  479. return false;
  480. },
  481. /**
  482. * 是否显示审批评论面板
  483. * 审批完成的单据,显示审批评论面板
  484. */
  485. showChoiceButton: function () {
  486. if (
  487. this.window != undefined &&
  488. this.window.workflow != undefined &&
  489. this.modelData != undefined &&
  490. this.modelData.data != undefined &&
  491. this.modelData.data.processInstanceId != undefined &&
  492. this.modelData.data.processInstanceId.displayValue != undefined &&
  493. this.modelData.data.processInstanceId.displayValue[0] != undefined &&
  494. this.modelData.data.processInstanceId.displayValue[0].length > 0 &&
  495. this.modelData.data.documentStatus != undefined &&
  496. this.modelData.data.documentStatus.displayValue != undefined &&
  497. this.modelData.data.documentStatus.displayValue[0] != undefined &&
  498. this.modelData.data.documentStatus.displayValue[0].length > 0 &&
  499. this.modelData.data.documentStatus.displayValue[0] == 'PROCESSING' &&
  500. this.taskInfoId != undefined &&
  501. this.workflowType != 'copyTask'
  502. ) {
  503. return true;
  504. }
  505. return false;
  506. },
  507. /**
  508. * 是否显示编辑
  509. * 审批完成的单据,显示审批评论面板
  510. */
  511. showEditButton: function () {
  512. if (this.window == undefined || this.window.tabs == undefined) {
  513. return false;
  514. } else if (this.window.readOnly) {
  515. return false;
  516. }
  517. if (this.curdWindowFunctionAccess == undefined || this.curdWindowFunctionAccess.allowUpdate == undefined || this.curdWindowFunctionAccess.allowUpdate == false) {
  518. return false;
  519. }
  520. if (
  521. this.window != undefined &&
  522. this.window.workflow != undefined &&
  523. this.modelData != undefined &&
  524. this.modelData.data != undefined &&
  525. this.modelData.data.documentStatus != undefined &&
  526. this.modelData.data.documentStatus.displayValue != undefined &&
  527. this.modelData.data.documentStatus.displayValue[0] != undefined &&
  528. this.modelData.data.documentStatus.displayValue[0].length > 0 &&
  529. (this.modelData.data.documentStatus.displayValue[0] == 'APPROVED' ||
  530. this.modelData.data.documentStatus.displayValue[0] == 'REJECTED' ||
  531. this.modelData.data.documentStatus.displayValue[0] == 'PROCESSING')
  532. ) {
  533. return false;
  534. }
  535. return true;
  536. },
  537. /**
  538. * 是否显示附件上传按钮
  539. */
  540. showAttachmentPanel: function (){
  541. if (this.curdWindowFunctionAccess == undefined
  542. || this.curdWindowFunctionAccess.allowUploadAttachment == undefined
  543. || this.curdWindowFunctionAccess.allowUploadAttachment == false) {
  544. return false;
  545. }
  546. return true;
  547. },
  548. /**
  549. * 是否显示新建按钮
  550. */
  551. showCreateButton: function () {
  552. if (this.window == undefined || this.window.tabs == undefined) {
  553. return false;
  554. } else if (this.window.readOnly) {
  555. return false;
  556. }
  557. if (this.curdWindowFunctionAccess == undefined || this.curdWindowFunctionAccess.allowCreate == undefined || this.curdWindowFunctionAccess.allowCreate == false) {
  558. return false;
  559. }
  560. var _self = this;
  561. if (_self.tab.isReadOnly == true) {
  562. return false;
  563. }
  564. // 处于审批界面
  565. if (_self.$route.query.workflowType === 'approve') {
  566. return false;
  567. }
  568. return true;
  569. },
  570. /**
  571. * 是否显示删除按钮
  572. */
  573. showDeleteButton: function () {
  574. if (this.window == undefined || this.window.tabs == undefined) {
  575. return false;
  576. } else if (this.window.readOnly) {
  577. return false;
  578. }
  579. if (this.curdWindowFunctionAccess == undefined || this.curdWindowFunctionAccess.allowDelete == undefined || this.curdWindowFunctionAccess.allowDelete == false) {
  580. return false;
  581. }
  582. var _self = this;
  583. if (_self.tab.isReadOnly == true) {
  584. return false;
  585. }
  586. // 处于审批界面
  587. if (_self.$route.query.workflowType === 'approve') {
  588. return false;
  589. }
  590. return true;
  591. },
  592. /**
  593. * 是否显示弃审按钮
  594. */
  595. showRedrawButton: function () {
  596. if (this.window == undefined || this.window.tabs == undefined) {
  597. return false;
  598. } else if (this.window.readOnly) {
  599. return false;
  600. }
  601. var _self = this;
  602. if (_self.tab.isReadOnly == true) {
  603. return false;
  604. }
  605. // 处于审批界面
  606. if (_self.$route.query.workflowType === 'approve') {
  607. return false;
  608. }
  609. // 处于抄送界面
  610. if (_self.$route.query.workflowType === 'copyTask') {
  611. return false;
  612. }
  613. if (
  614. _self.modelData != undefined &&
  615. _self.modelData.data != undefined &&
  616. _self.modelData.data.documentStatus != undefined
  617. ) {
  618. let documentStatus =
  619. _self.modelData.data.documentStatus.displayValue[0];
  620. if(documentStatus == 'REJECTED' || documentStatus == 'APPROVED'){
  621. return false;
  622. }
  623. }
  624. if (
  625. _self.window.workflow != undefined &&
  626. _self.processInstanceId != undefined &&
  627. _self.processInstanceId != ''
  628. ) {
  629. return true;
  630. }
  631. return false;
  632. },
  633. },
  634. watch: {
  635. $route: function (to, from) {
  636. // 与 mounted 中的initView重复执行
  637. // this.initView();
  638. },
  639. modelData: {
  640. deep: true,
  641. handler(curVal, oldVal) {
  642. this.tabButtonsShowLogical();
  643. this.reportViewsShowLogical();
  644. },
  645. },
  646. /**
  647. * 显示界面发生改变的时候,重新执行显示逻辑
  648. */
  649. windowDisplayType: function(newValue, oldValue){
  650. this.reportViewsShowLogical();
  651. },
  652. },
  653. mounted: function () {
  654. console.log('WindowEdit mounted.');
  655. var _self = this;
  656. // 按钮栏实现滚动
  657. _self.$nextTick(function () {
  658. // var fixedButtonGroup = $(_self.$refs.fixedButtonGroup);
  659. // _self.computerButtonGroupLeftTop();
  660. // $(window).scroll(function (){
  661. // if ($(window).scrollTop() > _self.buttonGroupInitTop) {
  662. // _self.showSpaceRow = true;
  663. // _self.$nextTick(function (){
  664. // fixedButtonGroup.addClass('btn-group-fixed');
  665. // fixedButtonGroup.css('left', _self.buttonGroupInitLeft + 'px');
  666. // });
  667. // } else {
  668. // _self.showSpaceRow = false;
  669. // _self.$nextTick(function (){
  670. // fixedButtonGroup.removeClass('btn-group-fixed');
  671. // fixedButtonGroup.css('left', '');
  672. // });
  673. // }
  674. // if ($(window).scrollTop() <= 10){
  675. // _self.computerButtonGroupLeftTop();
  676. // }
  677. // });
  678. var fixedButtonGroup = $(_self.$refs.fixedButtonGroup);
  679. var buttonInitTop = fixedButtonGroup.offset().top;
  680. _self.fixedButtonGroupHeight = fixedButtonGroup.outerHeight();
  681. // 按钮组实现悬浮
  682. $(window).scroll(function () {
  683. var windowTop = $(window).scrollTop();
  684. if (windowTop > buttonInitTop + fixedButtonGroup.outerHeight()) {
  685. fixedButtonGroup.offset({
  686. top: windowTop,
  687. left: fixedButtonGroup.offset().left,
  688. });
  689. } else {
  690. fixedButtonGroup.offset({
  691. top: buttonInitTop,
  692. });
  693. }
  694. });
  695. });
  696. $(window).resize(function () {
  697. _self.$nextTick(function () {
  698. _self.computerButtonGroupLeftTop();
  699. });
  700. });
  701. // 获取待审阅的数据
  702. let userReadDocumentId = this.$route.query.userReadDocumentId;
  703. if (userReadDocumentId != null && userReadDocumentId != '') {
  704. UserReadDocumentResource.setProcessed(userReadDocumentId).then(
  705. successData => {
  706. if (successData.errorCode === 1) {
  707. Notify.error(_self.$t('lang.tabFormView.dataException'), _self.$t('lang.tabFormView.reviewDataHasBeenDeleted'), false);
  708. } else if (successData.errorCode === 2) {
  709. console.log('单据已经审阅');
  710. _self.initView();
  711. } else if (successData.errorCode === 3) {
  712. Notify.error(_self.$t('lang.tabFormView.dataException'), _self.$t('lang.tabFormView.describe1'), false);
  713. } else if (successData.errorCode === 0) {
  714. console.log('设置单据已经审阅成功。');
  715. _self.initView();
  716. }
  717. },
  718. errorData => {
  719. Common.processException(errorData);
  720. },
  721. );
  722. } else {
  723. _self.initView();
  724. }
  725. },
  726. methods: {
  727. /**
  728. * 打开评论界面进行评论
  729. * @author GuoZhiBo 20171201
  730. */
  731. openCurdWindowComment: function () {
  732. var _self = this;
  733. // this.$router.push('/record/curdCommentCreate/' + _self.recordId);
  734. _self.modal3 = true;
  735. console.log(_self.modelData);
  736. console.log(_self.modelData.id);
  737. },
  738. saveAndSendNotification: function () {
  739. var _self = this;
  740. _self.$refs.curdCommentCreate.photograph();
  741. _self.sendNotification();
  742. },
  743. // 发送通知
  744. sendNotification: function () {
  745. var _self = this;
  746. var notification = _self.$refs.curdCommentCreate.getNotification();
  747. var recordIds = [];
  748. recordIds.push(_self.modelData.id);
  749. if (recordIds.length == 0) {
  750. Notify.error(_self.$t('lang.Notify.error'), _self.$t('lang.tabButton.describe7'), true);
  751. return;
  752. }
  753. // if (notification.userIds == null || notification.userIds.length == 0) {
  754. // Notify.error(_self.$t('lang.Notify.error'), _self.$t('lang.tabButton.describe8'), true);
  755. // _self.modal3 = false;
  756. // return;
  757. // }
  758. if (notification.theme == null || notification.theme.trim() == '') {
  759. Notify.error(_self.$t('lang.Notify.error'), _self.$t('lang.tabButton.describe9'), true);
  760. return;
  761. }
  762. if (notification.contentText == null || notification.contentText.trim() == '') {
  763. Notify.error(_self.$t('lang.Notify.error'), _self.$t('lang.tabButton.describe10'), true);
  764. return;
  765. }
  766. notification.windowNo = _self.modelData.windowNo;
  767. notification.tabIndex = _self.tabIndex;
  768. notification.recordIds = recordIds;
  769. notification.className = _self.tab.tabDataSource.className;
  770. notification.category = 'CurdWindow';
  771. notification.documentName = 'view';
  772. if(_self.modelData.data.processInstanceId != undefined || _self.modelData.data.processInstanceId != null) {
  773. notification.processInstanceId = _self.modelData.data.processInstanceId.displayValue[0];
  774. }
  775. if(_self.modelData.data.documentNo != undefined || _self.modelData.data.documentNo != null) {
  776. notification.documentNo = _self.modelData.data.documentNo.displayValue[0];
  777. }
  778. if(_self.modelData.data.documentCreateUser != undefined || _self.modelData.data.documentCreateUser != null) {
  779. notification.documentUserNickName = _self.modelData.data.documentCreateUser.displayValue[0];
  780. }
  781. _self.loading=true;
  782. $.ajax({
  783. url: Common.getApiURL('notificationResource/send'),
  784. type: 'post',
  785. beforeSend: function (request) {
  786. Common.addTokenToRequest(request);
  787. },
  788. contentType: 'application/json',
  789. data: JSON.stringify(notification),
  790. success: function (data) {
  791. _self.loading=false;
  792. Notify.success(_self.$t('lang.tabButton.describe11'), '操作成功', true);
  793. _self.modal3 = false;
  794. _self.$refs.curdComment.getCurdComment();
  795. },
  796. error: function (XMLHttpRequest, textStatus, errorThrown) {
  797. _self.loading=false;
  798. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  799. },
  800. });
  801. },
  802. // 取消发送
  803. cancelNotification: function () {
  804. var _self = this;
  805. _self.modal3 = false;
  806. },
  807. /**
  808. * 获取审批图片
  809. */
  810. getWorkFlowImageUrl: function () {
  811. var _self = this;
  812. if (
  813. _self.modelData != undefined &&
  814. _self.modelData.data != undefined &&
  815. _self.modelData.data.documentStatus != undefined
  816. ) {
  817. var documentStatus =
  818. _self.modelData.data.documentStatus.displayValue[0];
  819. if (documentStatus == undefined || documentStatus == 'EDIT') {
  820. return '/static/assets/client-base-v4/image-workflow/edit.png';
  821. } else if (documentStatus == 'APPROVED') {
  822. return '/static/assets/client-base-v4/image-workflow/approved.png';
  823. } else if (documentStatus == 'REJECTED') {
  824. return '/static/assets/client-base-v4/image-workflow/rejected.png';
  825. } else if (documentStatus == 'PROCESSING') {
  826. return '/static/assets/client-base-v4/image-workflow/processing.png';
  827. } else if (documentStatus == 'WITHDRAW') {
  828. return '/static/assets/client-base-v4/image-workflow/withdraw.png';
  829. }
  830. }
  831. },
  832. /**
  833. * 切换显示模式
  834. * @author GuoZhiBo 20210419
  835. */
  836. changeWindowDisplayType: function () {
  837. var _self = this;
  838. if (_self.windowDisplayType == 'Grid') {
  839. _self.windowDisplayType = 'Report';
  840. } else {
  841. _self.windowDisplayType = 'Grid';
  842. _self.$nextTick(function () {
  843. for (var index = 0; index < _self.tab.subTabs.length; index++) {
  844. var subTabId = 'subTab' + this.tab.subTabs[index].tabIndex;
  845. _self.$refs[subTabId][0].queryGridData();
  846. }
  847. });
  848. }
  849. },
  850. // 执行流程
  851. executeProcess: function (processReportNo) {
  852. var _self = this;
  853. var ids = [];
  854. if (_self.modelDatas) {
  855. _self.modelDatas.forEach(function (modelData) {
  856. if (modelData.select == true) {
  857. ids.push(modelData.id);
  858. }
  859. });
  860. } else if (_self.modelData) {
  861. ids.push(_self.modelData.id);
  862. }
  863. ProcessReportResource.runProcessByIds(processReportNo, ids).then(
  864. successData => {
  865. var processReportResult = successData;
  866. if (_self.processReportResult == undefined) {
  867. if (
  868. processReportResult.reportResults != undefined &&
  869. processReportResult.reportResults.length > 0
  870. ) {
  871. processReportResult.reportResults.forEach(function (item, index) {
  872. if (item.reportDefinitionType!=='ExcelReport') {
  873. item.previewIndex=1;
  874. } else {
  875. item.previewIndex=2;
  876. }
  877. if (index == 0) {
  878. item.showPreview = true;
  879. } else {
  880. item.showPreview = false;
  881. }
  882. });
  883. }
  884. _self.processReportResult = processReportResult;
  885. } else {
  886. if (
  887. processReportResult.reportResults != undefined &&
  888. processReportResult.reportResults.length > 0
  889. ) {
  890. processReportResult.reportResults.forEach(function (item, index) {
  891. item.previewIndex = 1;
  892. if (index == 0) {
  893. item.showPreview = true;
  894. } else {
  895. item.showPreview = false;
  896. }
  897. _self.processReportResult.reportResults.push(item);
  898. });
  899. }
  900. }
  901. },
  902. errorData => {
  903. Common.processException(errorData);
  904. },
  905. );
  906. },
  907. getContext: Context,
  908. /**
  909. * 弃审
  910. */
  911. abandonWorkflow: function () {
  912. var _self = this;
  913. _self.loading = true;
  914. var obj = {
  915. className: _self.tab.tabDataSource.className,
  916. tabIndex: _self.tabIndex,
  917. windowNo: _self.window.no,
  918. recordId: _self.modelData.id,
  919. };
  920. $.ajax({
  921. url: Common.getApiURL('WorkflowResource/abandonWorkflow'),
  922. type: 'post',
  923. contentType: 'application/json',
  924. beforeSend: function (request) {
  925. Common.addTokenToRequest(request);
  926. },
  927. data: JSON.stringify(obj),
  928. success: function (data) {
  929. _self.loading = false;
  930. _self.refresh();
  931. },
  932. error: function (XMLHttpRequest, textStatus, errorThrown) {
  933. _self.loading = false;
  934. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  935. },
  936. });
  937. },
  938. /**
  939. * 打开帮助页面
  940. */
  941. openHtmlHelp: function (htmlHelpUrl) {
  942. window.open(htmlHelpUrl);
  943. },
  944. auditData: function () {
  945. var _self = this;
  946. _self.showAuditPanel = true;
  947. _self.modal2 = true;
  948. },
  949. // 初始化界面
  950. initView: function () {
  951. this.type = this.$route.params.type;
  952. this.windowNo = this.$route.params.windowNo;
  953. this.tabIndex = this.$route.params.tabIndex;
  954. this.recordId = this.$route.params.recordId;
  955. this.currPage = this.$route.query.currPage;
  956. this.currIndex = Number(this.$route.query.currIndex);
  957. this.totalCount = Number(this.$route.query.totalCount);
  958. this.workflowType = this.$route.query.workflowType;
  959. this.taskInfoId = this.$route.query.taskInfoId;
  960. if (this.$route.query.uuid != undefined) {
  961. this.uuid = this.$route.query.uuid;
  962. }
  963. // 是否允许返回
  964. if (this.$route.query.canGoBack != undefined) {
  965. this.canGoBack = this.$route.query.canGoBack != 'false';
  966. }
  967. if (this.type == 'view') {
  968. this.initReadView();
  969. } else if (this.type == 'restore') {
  970. // 恢复视图
  971. this.restoreView();
  972. }
  973. if (this.workflowType == 'copyTask') {
  974. $.ajax({
  975. url: Common.getApiURL('WorkflowResource/processTaskInfo'),
  976. type: 'get',
  977. dataType: 'json',
  978. contentType: 'application/json',
  979. beforeSend: function (request) {
  980. Common.addTokenToRequest(request);
  981. },
  982. data: {
  983. taskInfoId: this.taskInfoId,
  984. },
  985. success: function (data) { },
  986. error: function (XMLHttpRequest, textStatus, errorThrown) {
  987. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  988. },
  989. });
  990. }
  991. },
  992. // 初始化编辑界面
  993. initReadView: function () {
  994. var _self = this;
  995. _self.loading = true;
  996. if (_self.taskInfoId) {
  997. CurdWindowResource.uniqueByNoWithWorkflow(
  998. null,
  999. _self.taskInfoId,
  1000. _self.windowNo,
  1001. ).then(
  1002. successData => {
  1003. initWindowAfterLoaded(successData);
  1004. _self.uniqueByNoAccessControl();
  1005. },
  1006. errorData => {
  1007. _self.loading = false;
  1008. Common.processException(errorData);
  1009. },
  1010. );
  1011. } else {
  1012. WindowServerUtil.getWindowById(
  1013. _self.windowNo,
  1014. function (window) {
  1015. initWindowAfterLoaded(window);
  1016. _self.uniqueByNoAccessControl();
  1017. },
  1018. function () {
  1019. _self.loading = false;
  1020. },
  1021. );
  1022. }
  1023. function initWindowAfterLoaded(window) {
  1024. WindowClientUtil.parseFilterSchema(window);
  1025. var tab = WindowClientUtil.getTab(window, _self.tabIndex);
  1026. WindowClientUtil.parseSubTab(window, tab);
  1027. WindowClientUtil.parseFieldGroup(tab);
  1028. WindowClientUtil.restoreWindowTabFieldGroupsVisible(window);
  1029. _self.tabFormFields = WindowClientUtil.getDetailField(tab);
  1030. _self.window = window;
  1031. _self.jsUrl = window.jsUrl;
  1032. _self.tab = tab;
  1033. TabFormView.restoreTabFormFieldDef(
  1034. _self.windowNo,
  1035. _self.tabIndex,
  1036. _self.tabFormFields,
  1037. );
  1038. _self.loadData();
  1039. if (_self.window.workflow != undefined) {
  1040. _self.processDefinitionId = _self.window.workflow.deploymentId;
  1041. }
  1042. _self.initHeaderAndFooterApiUrl();
  1043. _self.loadHeaderAndFooterContent(_self.recordId);
  1044. _self.loading = false;
  1045. if (
  1046. _self.window.reportViewDto != null &&
  1047. _self.window.reportViewDto.reportViewItemDtos != null &&
  1048. _self.window.reportViewDto.reportViewItemDtos.length > 0
  1049. ) {
  1050. var isflag = false;
  1051. _self.window.reportViewDto.reportViewItemDtos.forEach(function (item) {
  1052. if (item.defaultDisplayReport) {
  1053. isflag = true;
  1054. }
  1055. });
  1056. if (isflag) {
  1057. _self.windowDisplayType = 'Report';
  1058. } else {
  1059. _self.windowDisplayType = 'Grid';
  1060. }
  1061. } else {
  1062. _self.windowDisplayType = 'Grid';
  1063. _self.isView = false;
  1064. }
  1065. }
  1066. },
  1067. // 恢复视图
  1068. restoreView: function () {
  1069. var _self = this;
  1070. _self.uuid = this.$route.query.uuid;
  1071. _self.loading = true;
  1072. WindowServerUtil.getWindowById(
  1073. _self.windowNo,
  1074. function (window) {
  1075. WindowClientUtil.parseFilterSchema(window);
  1076. var tab = WindowClientUtil.getTab(window, _self.tabIndex);
  1077. WindowClientUtil.parseSubTab(window, tab);
  1078. WindowClientUtil.parseFieldGroup(tab);
  1079. WindowClientUtil.restoreWindowTabFieldGroupsVisible(window);
  1080. _self.tabFormFields = WindowClientUtil.getDetailField(tab);
  1081. _self.window = window;
  1082. _self.jsUrl = window.jsUrl;
  1083. _self.tab = tab;
  1084. TabFormView.restoreTabFormFieldDef(
  1085. _self.windowNo,
  1086. _self.tabIndex,
  1087. _self.tabFormFields,
  1088. );
  1089. _self.uniqueByNoAccessControl();
  1090. let key = _self.uuid + '_modelData';
  1091. UserStorageResource.uniqueByKey(key).then(
  1092. successData => {
  1093. // if(successData.errorCode != 0) {
  1094. // Notify.error('提示', successData.errorMessage, false);
  1095. // return;
  1096. // }
  1097. if (successData.data != null && successData.data != '') {
  1098. let cacheModelData = JSON.parse(successData.data);
  1099. _self.$nextTick(function () {
  1100. if (
  1101. cacheModelData.saveDatas != undefined &&
  1102. cacheModelData.saveDatas.length > 0
  1103. ) {
  1104. cacheModelData.saveDatas.forEach(function (saveData) {
  1105. // 恢复子页签的数据
  1106. var subTabId = 'subTab' + saveData.tabIndex;
  1107. _self.$refs[subTabId][0].addModelData(saveData);
  1108. });
  1109. } else {
  1110. // BUG描述:父子页签,编辑以后撤销,子页签数据不显示
  1111. // BUG修复:刷新子页签的数据
  1112. // bug fixed by jack 20180203
  1113. for (
  1114. var index = 0; index < _self.tab.subTabs.length; index++
  1115. ) {
  1116. var subTabId =
  1117. 'subTab' + this.tab.subTabs[index].tabIndex;
  1118. _self.$refs[subTabId][0].queryGridData();
  1119. }
  1120. }
  1121. });
  1122. _self.initHeaderAndFooterApiUrl();
  1123. _self.loadHeaderAndFooterContent(_self.recordId);
  1124. }
  1125. },
  1126. errorData => {
  1127. Common.processException(errorData);
  1128. },
  1129. );
  1130. if (_self.window.workflow != undefined) {
  1131. _self.processDefinitionId = _self.window.workflow.deploymentId;
  1132. }
  1133. _self.loading = false;
  1134. },
  1135. function () {
  1136. _self.loading = false;
  1137. },
  1138. );
  1139. },
  1140. // 备份视图
  1141. backupView: function () {
  1142. var _self = this;
  1143. var subTabChangedData = _self.getSubTabChangedData();
  1144. if (subTabChangedData.length > 0) {
  1145. _self.modelData.saveDatas = subTabChangedData;
  1146. } else {
  1147. _self.modelData.saveDatas = null;
  1148. }
  1149. let key = _self.uuid + '_modelData';
  1150. let userStorageDtos = [{
  1151. key: key,
  1152. value: JSON.stringify(_self.modelData),
  1153. }];
  1154. // 组装查询条件,然后放到后台数据库当中
  1155. UserStorageResource.uploadUserStorage(userStorageDtos).then(
  1156. successData => { },
  1157. errorData => {
  1158. Common.processException(errorData);
  1159. },
  1160. );
  1161. },
  1162. uniqueByNoAccessControl: function () {
  1163. // 权限
  1164. CurdWindowResourceV2.uniqueByNoAccessControl(
  1165. this.windowNo,
  1166. ).then(successData => {
  1167. if (successData.errorCode === 0) {
  1168. this.curdWindowFunctionAccess = successData.data;
  1169. if (this.curdWindowFunctionAccess.readOnly != null && this.curdWindowFunctionAccess.readOnly === true) {
  1170. this.window.readOnly = true;
  1171. }
  1172. }
  1173. }, errorData => {
  1174. Common.processException(errorData);
  1175. });
  1176. },
  1177. /**
  1178. * 数据发生改变
  1179. * eg:生单界面回传了新的modelData数据
  1180. */
  1181. modelDataChanged: function (newModelData) {
  1182. this.refresh();
  1183. },
  1184. /**
  1185. * 获取界面的数据
  1186. * eg:生单界面获取modelData数据
  1187. */
  1188. getModelData: function () {
  1189. var _self = this;
  1190. var subTabChangedData = _self.getSubTabChangedData();
  1191. if (subTabChangedData.length > 0) {
  1192. _self.modelData.saveDatas = subTabChangedData;
  1193. } else {
  1194. _self.modelData.saveDatas = null;
  1195. }
  1196. return _self.modelData;
  1197. },
  1198. /**
  1199. * 初始化表头和表尾API方法
  1200. * @return {[type]} [description]
  1201. */
  1202. initHeaderAndFooterApiUrl: function () {
  1203. if (this.tab != undefined && this.tab.tabFormView != undefined) {
  1204. this.headerApiUrl = this.tab.tabFormView.headerApiUrl;
  1205. this.footerApiUrl = this.tab.tabFormView.footerApiUrl;
  1206. }
  1207. },
  1208. /**
  1209. * 加载表头和表位的方法
  1210. * @return {[type]} [description]
  1211. */
  1212. loadHeaderAndFooterContent: function (recordId) {
  1213. var _self = this;
  1214. if (this.headerApiUrl != undefined && this.headerApiUrl.length > 0) {
  1215. $.ajax({
  1216. url: Common.getApiURL(_self.headerApiUrl),
  1217. type: 'post',
  1218. contentType: 'application/json',
  1219. beforeSend: function (request) {
  1220. Common.addTokenToRequest(request);
  1221. },
  1222. data: JSON.stringify({
  1223. recordId: recordId,
  1224. }),
  1225. dataType: 'text',
  1226. success: function (data) {
  1227. _self.headerHtml = data;
  1228. },
  1229. error: function (XMLHttpRequest, textStatus, errorThrown) {
  1230. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  1231. },
  1232. });
  1233. } else {
  1234. _self.headerHtml = '';
  1235. }
  1236. if (this.footerApiUrl != undefined && this.footerApiUrl.length > 0) {
  1237. $.ajax({
  1238. url: Common.getApiURL(_self.footerApiUrl),
  1239. type: 'post',
  1240. contentType: 'application/json',
  1241. beforeSend: function (request) {
  1242. Common.addTokenToRequest(request);
  1243. },
  1244. data: JSON.stringify({
  1245. recordId: recordId,
  1246. }),
  1247. dataType: 'text',
  1248. success: function (data) {
  1249. _self.footerHtml = data;
  1250. },
  1251. error: function (XMLHttpRequest, textStatus, errorThrown) {
  1252. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  1253. },
  1254. });
  1255. } else {
  1256. _self.footerHtml = '';
  1257. }
  1258. },
  1259. /**
  1260. * 刷新数据
  1261. */
  1262. refresh: function () {
  1263. var _self = this;
  1264. _self.loadData();
  1265. // add by jack 2018-03-22
  1266. if (_self.recordId != null) {
  1267. _self.loadHeaderAndFooterContent(_self.recordId);
  1268. }
  1269. },
  1270. loadData: function () {
  1271. var _self = this;
  1272. if (_self.recordId == undefined) {
  1273. return;
  1274. }
  1275. var tabLoadParam = {
  1276. windowNo: _self.windowNo,
  1277. tabIndex: _self.tabIndex,
  1278. recordId: _self.recordId,
  1279. };
  1280. _self.processInstanceId = '';
  1281. _self.loading = true;
  1282. WindowServerUtil.loadTabSingleData(
  1283. tabLoadParam,
  1284. function (modelData) {
  1285. _self.modelData = modelData;
  1286. // 判断是否显示审批状态
  1287. if (
  1288. _self.modelData != null &&
  1289. _self.modelData.data != null &&
  1290. _self.modelData.data.processInstanceId != null
  1291. ) {
  1292. let displayValue =
  1293. _self.modelData.data.processInstanceId.displayValue;
  1294. if (displayValue != null && displayValue.length > 0) {
  1295. _self.processInstanceId = displayValue[0];
  1296. } else {
  1297. _self.processInstanceId = '';
  1298. }
  1299. } else {
  1300. _self.processInstanceId = '';
  1301. }
  1302. // 判断是否有属性
  1303. if (
  1304. _self.modelData != null &&
  1305. _self.modelData.data != null &&
  1306. _self.modelData.data.attributeKey != null &&
  1307. _self.modelData.data.attributeKey.displayValue != null
  1308. ) {
  1309. let displayValue = _self.modelData.data.attributeKey.displayValue;
  1310. if (displayValue.length > 0) {
  1311. _self.attributeKey = displayValue[0];
  1312. }
  1313. }
  1314. // 判断是否有属性值
  1315. if (
  1316. _self.modelData != null &&
  1317. _self.modelData.data != null &&
  1318. _self.modelData.data.attributeKey != null &&
  1319. _self.modelData.data.attributeValueKey != undefined &&
  1320. _self.modelData.data.attributeValueKey.displayValue != undefined
  1321. ) {
  1322. var displayValue1 =
  1323. _self.modelData.data.attributeValueKey.displayValue;
  1324. if (displayValue1.length > 0) {
  1325. _self.attributeValueKey = displayValue1[0];
  1326. }
  1327. }
  1328. _self.loading = false;
  1329. },
  1330. function () {
  1331. _self.loading = false;
  1332. },
  1333. );
  1334. },
  1335. // 改变字段分组的显示和隐藏
  1336. changeFieldGroupStatus: function (fieldGroup) {
  1337. fieldGroup.show = !fieldGroup.show;
  1338. var index = this.tab.tabFormView.fieldGroups.indexOf(fieldGroup);
  1339. if (index != -1) {
  1340. this.tab.tabFormView.fieldGroups[index] = fieldGroup;
  1341. localStorage.setItem(
  1342. 'FieldGroupStatus_' +
  1343. this.windowNo +
  1344. '_' +
  1345. this.tabIndex +
  1346. '_' +
  1347. fieldGroup.groupName,
  1348. fieldGroup.show,
  1349. );
  1350. }
  1351. },
  1352. // 获取子页签发生改变的数据
  1353. getSubTabChangedData: function () {
  1354. var subTabChangedRecords = [];
  1355. if (this.tab.subTabs != undefined) {
  1356. for (var index = 0; index < this.tab.subTabs.length; index++) {
  1357. var subTabId = 'subTab' + this.tab.subTabs[index].tabIndex;
  1358. var modelDatas = this.$refs[subTabId][0].getChangedModelData();
  1359. if (modelDatas != undefined && modelDatas.length > 0) {
  1360. modelDatas.forEach(function (modelData) {
  1361. subTabChangedRecords.push(modelData);
  1362. });
  1363. }
  1364. }
  1365. }
  1366. console.log(subTabChangedRecords);
  1367. return subTabChangedRecords;
  1368. },
  1369. // 获取子页签数据校验的Promise
  1370. getSubTabValidatePromise: function () {
  1371. var _self = this;
  1372. var validatePromises = [];
  1373. if (this.tab.subTabs != undefined) {
  1374. for (var index = 0; index < this.tab.subTabs.length; index++) {
  1375. var subTabId = 'subTab' + this.tab.subTabs[index].tabIndex;
  1376. var subTabValidates = this.$refs[subTabId][0].performValidate();
  1377. validatePromises = validatePromises.concat(subTabValidates);
  1378. }
  1379. }
  1380. return validatePromises;
  1381. },
  1382. /**
  1383. * 表单字段的属性(显示)属性发生改变事件
  1384. */
  1385. tabFormFieldPropertyChanged: function () {
  1386. TabFormView.restoreTabFormFieldDef(
  1387. this.windowNo,
  1388. this.tabIndex,
  1389. this.tabFormFields,
  1390. );
  1391. },
  1392. // 新建数据
  1393. createRecord: function () {
  1394. // this.modelData = WindowClientUtil.newModelData(this.tab);
  1395. var currIndex = this.currIndex;
  1396. var totalCount = this.totalCount;
  1397. if (this.curdWindowFunctionAccess.allowCreate != null && this.curdWindowFunctionAccess.allowCreate === true) {
  1398. this.$router.push(
  1399. '/desktop/window/window-edit/create/' +
  1400. this.windowNo +
  1401. '/' +
  1402. this.tabIndex +
  1403. '/' +
  1404. this.modelData.id +
  1405. '?currPage=' +
  1406. this.currPage +
  1407. '&currIndex=' +
  1408. currIndex +
  1409. '&totalCount=' +
  1410. totalCount +
  1411. '&uuid=' +
  1412. this.uuid,
  1413. );
  1414. } else {
  1415. Notify.error(this.$t('lang.tabFormView.clickNewError'), this.$t('lang.tabFormView.describe3'), false);
  1416. }
  1417. },
  1418. /**
  1419. * 编辑数据
  1420. * @return {void}
  1421. */
  1422. editRecord: function () {
  1423. var _self = this;
  1424. var currPage = _self.currPage;
  1425. var currIndex = _self.currIndex;
  1426. var totalCount = _self.totalCount;
  1427. if (this.curdWindowFunctionAccess.allowUpdate != null && this.curdWindowFunctionAccess.allowUpdate === true) {
  1428. this.backupView();
  1429. this.$router.push(
  1430. '/desktop/window/window-edit/edit/' +
  1431. this.windowNo +
  1432. '/' +
  1433. this.tabIndex +
  1434. '/' +
  1435. this.modelData.id +
  1436. '?currPage=' +
  1437. currPage +
  1438. '&currIndex=' +
  1439. currIndex +
  1440. '&totalCount=' +
  1441. totalCount +
  1442. '&uuid=' +
  1443. this.uuid,
  1444. );
  1445. } else {
  1446. Notify.error(_self.$t('lang.tabFormView.clickEditError'), _self.$t('lang.tabFormView.describe4'), false);
  1447. }
  1448. },
  1449. /**
  1450. * 删除当前的数据
  1451. * @return {[type]} [description]
  1452. */
  1453. deleteRecord: function (isAlert) {
  1454. var _self = this;
  1455. if (this.modelData == undefined || this.modelData.id == undefined) {
  1456. return;
  1457. }
  1458. if (this.curdWindowFunctionAccess.allowDelete != null && this.curdWindowFunctionAccess.allowDelete === true) {
  1459. if (isAlert) {
  1460. Notify.show({
  1461. title: _self.$t('lang.tabFormView.deleteConfirmation'),
  1462. message: _self.$t('lang.tabFormView.someWhat'),
  1463. buttons: [{
  1464. label: _self.$t('lang.tabFormView.determine'),
  1465. cssClass: 'btn-primary',
  1466. action: function (dialogItself) {
  1467. dialogItself.close();
  1468. _self.deleteRecord(false);
  1469. },
  1470. },
  1471. {
  1472. label: _self.$t('lang.tabFormView.cancel'),
  1473. action: function (dialogItself) {
  1474. dialogItself.close();
  1475. },
  1476. },
  1477. ],
  1478. });
  1479. return;
  1480. }
  1481. if (this.modelData.id < 0) {
  1482. _self.$router.push(
  1483. '/desktop/window/' +
  1484. _self.windowNo +
  1485. '?currPage=' +
  1486. _self.currPage +
  1487. '&uuid=' +
  1488. _self.uuid,
  1489. );
  1490. return;
  1491. }
  1492. var tabDeleteData = {
  1493. windowNo: _self.windowNo,
  1494. tabIndex: _self.tabIndex,
  1495. modelDatas: [_self.modelData],
  1496. };
  1497. WindowServerUtil.deleteTabData(tabDeleteData, function (result) {
  1498. _self.$router.push(
  1499. '/desktop/window/' +
  1500. _self.windowNo +
  1501. '?currPage=' +
  1502. _self.currPage +
  1503. '&uuid=' +
  1504. _self.uuid,
  1505. );
  1506. });
  1507. } else {
  1508. Notify.error(_self.$t('lang.tabFormView.clickDeleteError'), _self.$t('lang.tabFormView.describe5'), false);
  1509. }
  1510. },
  1511. /**
  1512. * 子标题
  1513. * @return {String} 子标题
  1514. */
  1515. subTitle: function () {
  1516. var _self = this;
  1517. var subTitle = '';
  1518. if (_self.modelData == null || _self.modelData.data == undefined) {
  1519. return subTitle;
  1520. }
  1521. if (_self.modelData.data.documentNo != undefined) {
  1522. subTitle =
  1523. _self.modelData.data.documentNo.displayValue == undefined ?
  1524. '' :
  1525. _self.modelData.data.documentNo.displayValue[0];
  1526. } else if (_self.modelData.data.no != undefined) {
  1527. subTitle =
  1528. _self.modelData.data.no.displayValue == undefined ?
  1529. '' :
  1530. _self.modelData.data.no.displayValue[0];
  1531. } else if (_self.modelData.data.name != undefined) {
  1532. subTitle =
  1533. _self.modelData.data.name.displayValue == undefined ?
  1534. '' :
  1535. _self.modelData.data.name.displayValue[0];
  1536. }
  1537. return subTitle;
  1538. },
  1539. back: function () {
  1540. var _self = this;
  1541. if (_self.canGoBack) {
  1542. _self.$router.push(
  1543. '/desktop/window/' +
  1544. _self.windowNo +
  1545. '?currPage=' +
  1546. _self.currPage +
  1547. '&uuid=' +
  1548. _self.uuid,
  1549. );
  1550. } else {
  1551. history.back();
  1552. }
  1553. },
  1554. /**
  1555. * 审批
  1556. * @return {void}
  1557. */
  1558. apply: function () {
  1559. var _self = this;
  1560. if (
  1561. _self.processInstanceId != null &&
  1562. _self.processInstanceId.length > 0
  1563. ) {
  1564. return;
  1565. }
  1566. var userData = null;
  1567. var approveUsers = null;
  1568. var copyUsers = null;
  1569. var userTaskDtos = null;
  1570. let userSelectDtos = null;
  1571. if (this.window.workflow.workflowType === 'UserDefine') {
  1572. try {
  1573. let param = this.$refs.workflowUserDefine.getData();
  1574. userSelectDtos = param.userSelectDtos;
  1575. copyUsers = param.copyUsers;
  1576. } catch (exception) {
  1577. Notify.error(_self.$t('lang.tabFormView.describe6'), exception.message, false);
  1578. return;
  1579. }
  1580. } else if (this.window.workflow.workflowType === 'OTHER') {
  1581. userSelectDtos = null;
  1582. copyUsers = null;
  1583. } else {
  1584. userData = _self.$refs.workflow.getUserData();
  1585. approveUsers = userData.applyUsers;
  1586. copyUsers = userData.copyUsers;
  1587. userTaskDtos = userData.userTaskDtos;
  1588. // 检查结点数据是否完整
  1589. for (var i = 0; i < userTaskDtos.length; i++) {
  1590. if (
  1591. userTaskDtos[i].assignees.length == undefined ||
  1592. userTaskDtos[i].assignees.length == 0
  1593. ) {
  1594. Notify.error(
  1595. _self.$t('lang.tabFormView.submitFailed'),
  1596. _self.$t('lang.tabFormView.describe7',{userTaskDtoName:userTaskDtos[i].name}),
  1597. false,
  1598. );
  1599. return;
  1600. }
  1601. }
  1602. }
  1603. var deploymentId = _self.window.workflow.deploymentId;
  1604. var recordId = _self.recordId;
  1605. var windowNo = _self.windowNo;
  1606. var workflowStartParam = {
  1607. deploymentId: deploymentId,
  1608. recordId: recordId,
  1609. windowNo: windowNo,
  1610. approveUsers: approveUsers,
  1611. copyUsers: copyUsers,
  1612. userTaskDtos: userTaskDtos,
  1613. tabIndex: _self.tab.tabIndex,
  1614. className: _self.tab.tabDataSource ?
  1615. _self.tab.tabDataSource.className :
  1616. null,
  1617. userSelectDtos: userSelectDtos,
  1618. };
  1619. _self.loading = true;
  1620. $.ajax({
  1621. url: Common.getApiURL('WorkflowExtResource/startWorkflow'),
  1622. type: 'post',
  1623. dataType: 'json',
  1624. beforeSend: function (request) {
  1625. Common.addTokenToRequest(request);
  1626. },
  1627. contentType: 'application/json',
  1628. data: JSON.stringify(workflowStartParam),
  1629. success: function (data) {
  1630. _self.loading = false;
  1631. Notify.success(_self.$t('lang.tabFormView.notice'), _self.$t('lang.tabFormView.describe8'), true);
  1632. _self.finishTask();
  1633. _self.refresh();
  1634. },
  1635. error: function (XMLHttpRequest, textStatus, errorThrown) {
  1636. _self.loading = false;
  1637. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  1638. },
  1639. });
  1640. },
  1641. /**
  1642. * 完成任务
  1643. */
  1644. finishTask: function () {
  1645. let _self = this;
  1646. let taskId = this.$route.query.taskId;
  1647. if (taskId == null) {
  1648. return;
  1649. }
  1650. $.ajax({
  1651. url: Common.getApiURL('WorkflowResource/finishTask'),
  1652. type: 'get',
  1653. dataType: 'json',
  1654. beforeSend: function (request) {
  1655. Common.addTokenToRequest(request);
  1656. },
  1657. contentType: 'application/json',
  1658. data: {taskId: taskId},
  1659. success: function (data) {
  1660. },
  1661. error: function (XMLHttpRequest, textStatus, errorThrown) {
  1662. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  1663. },
  1664. });
  1665. },
  1666. /**
  1667. * 上一条数据
  1668. * @return {void}
  1669. */
  1670. pre: function () {
  1671. var _self = this;
  1672. if (_self.currIndex <= 1) {
  1673. return;
  1674. }
  1675. _self.currIndex--;
  1676. var tabQueryParam = {
  1677. range: {
  1678. start: _self.currIndex - 1,
  1679. length: 1,
  1680. },
  1681. windowNo: _self.windowNo,
  1682. tabIndex: _self.tabIndex,
  1683. };
  1684. UserStorageResource.uniqueByKey(_self.uuid).then(
  1685. successData => {
  1686. // if(successData.errorCode != 0) {
  1687. // Notify.error('提示', successData.errorMessage, false);
  1688. // return;
  1689. // }
  1690. let simpleFilterParams = null;
  1691. let complexFilterParams = null;
  1692. if (successData.data != null && successData.data != '') {
  1693. let temp = JSON.parse(successData.data);
  1694. // 分页数据
  1695. // 简单过滤条件
  1696. tabQueryParam.simpleFilterCondition = temp.simpleFilterParams;
  1697. // 复杂过滤条件
  1698. tabQueryParam.filterParams = temp.complexFilterParams;
  1699. // 排序
  1700. tabQueryParam.sortStr = temp.sortStr;
  1701. }
  1702. _self.loadTabData(tabQueryParam);
  1703. },
  1704. errorData => {
  1705. Common.processException(errorData);
  1706. },
  1707. );
  1708. },
  1709. /**
  1710. * 下一条数据
  1711. * @return {void}
  1712. */
  1713. next: function () {
  1714. var _self = this;
  1715. var totalCount = _self.totalCount;
  1716. if (_self.currIndex >= totalCount) {
  1717. return;
  1718. }
  1719. _self.currIndex++;
  1720. var tabQueryParam = {
  1721. range: {
  1722. start: _self.currIndex - 1,
  1723. length: 1,
  1724. },
  1725. windowNo: _self.windowNo,
  1726. tabIndex: _self.tabIndex,
  1727. };
  1728. UserStorageResource.uniqueByKey(_self.uuid).then(
  1729. successData => {
  1730. // if(successData.errorCode != 0) {
  1731. // Notify.error('提示', successData.errorMessage, false);
  1732. // return;
  1733. // }
  1734. if (successData.data != null && successData.data != '') {
  1735. let temp = JSON.parse(successData.data);
  1736. // 分页数据
  1737. // 简单过滤条件
  1738. tabQueryParam.simpleFilterCondition = temp.simpleFilterParams;
  1739. // 复杂过滤条件
  1740. tabQueryParam.filterParams = temp.complexFilterParams;
  1741. // 排序
  1742. tabQueryParam.sortStr = temp.sortStr;
  1743. }
  1744. _self.loadTabData(tabQueryParam);
  1745. },
  1746. errorData => {
  1747. Common.processException(errorData);
  1748. },
  1749. );
  1750. },
  1751. /**
  1752. * 加载一条数据
  1753. * @param {Object} tabQueryParam 查询条件
  1754. * @return {void}
  1755. */
  1756. loadTabData: function (tabQueryParam) {
  1757. var _self = this;
  1758. _self.processInstanceId = '';
  1759. _self.loading = true;
  1760. WindowServerUtil.queryTabData(
  1761. tabQueryParam,
  1762. function (gridData) {
  1763. var dataLists = gridData.dataList;
  1764. if (dataLists != undefined && dataLists.length > 0) {
  1765. _self.modelData = dataLists[0];
  1766. if (_self.modelData) {
  1767. _self.recordId = _self.modelData.id;
  1768. _self.loadHeaderAndFooterContent(_self.recordId);
  1769. if (_self.modelData.data.processInstanceId != undefined) {
  1770. var displayValue =
  1771. _self.modelData.data.processInstanceId.displayValue;
  1772. if (displayValue != undefined && displayValue.length > 0) {
  1773. _self.processInstanceId = displayValue[0];
  1774. }
  1775. }
  1776. }
  1777. }
  1778. _self.loading = false;
  1779. },
  1780. function () {
  1781. _self.loading = false;
  1782. },
  1783. );
  1784. },
  1785. /**
  1786. * 计算按钮坐标
  1787. *
  1788. */
  1789. computerButtonGroupLeftTop: function () {
  1790. var _self = this;
  1791. var fixedButtonGroup = $(_self.$refs.fixedButtonGroup);
  1792. if (fixedButtonGroup != undefined) {
  1793. var offset = fixedButtonGroup.offset();
  1794. if (offset != undefined) {
  1795. _self.buttonGroupInitLeft = offset.left;
  1796. _self.buttonGroupInitTop = offset.top;
  1797. }
  1798. }
  1799. },
  1800. /**
  1801. * 执行Callout
  1802. */
  1803. executeCallout: function (fieldItem) {
  1804. var _self = this;
  1805. if (fieldItem.calloutProcessReportNo != null) {
  1806. _self.callout(fieldItem.calloutProcessReportNo);
  1807. }
  1808. },
  1809. /**
  1810. * callout
  1811. * @param {[type]} calloutProcessReportNo [description]
  1812. * @return {[type]} [description]
  1813. */
  1814. callout: function (calloutProcessReportNo) {
  1815. var _self = this;
  1816. // 查询流程和报表的定义
  1817. ProcessReportResource.uniqueByNo(calloutProcessReportNo).then(
  1818. successData => {
  1819. if (successData == null) {
  1820. return;
  1821. }
  1822. // 执行服务端的脚本
  1823. ProcessReportResource.runCallout(
  1824. calloutProcessReportNo,
  1825. _self.modelData,
  1826. ).then(
  1827. successData => {
  1828. if (successData && successData.modelData) {
  1829. _self.modelData = successData.modelData;
  1830. }
  1831. },
  1832. errorData => {
  1833. Common.processException(errorData);
  1834. },
  1835. );
  1836. },
  1837. errorData => {
  1838. Common.processException(errorData);
  1839. },
  1840. );
  1841. },
  1842. /**
  1843. * 页签按钮的显示逻辑
  1844. */
  1845. tabButtonsShowLogical: function () {
  1846. let _self = this;
  1847. if (
  1848. this.tab.tabFormView != null &&
  1849. this.tab.tabFormView.tabButtons != null
  1850. ) {
  1851. for (
  1852. let index = 0; index < this.tab.tabFormView.tabButtons.length; index++
  1853. ) {
  1854. let tabButton = this.tab.tabFormView.tabButtons[index];
  1855. if (tabButton.editMode != true) {
  1856. var logic = tabButton.showLogical;
  1857. if (logic == null || logic == '') {
  1858. tabButton.invisible = false;
  1859. return;
  1860. }
  1861. let functionName = 'form_view_show_logical_' + index;
  1862. let executeFunction = function(){
  1863. try {
  1864. let context = new _self.getContext(_self.modelData);
  1865. tabButton.invisible = !_self[functionName](context);
  1866. } catch (error) {
  1867. console.error(error);
  1868. Notify.error('数据字典定义异常', '【' + tabButton.name + '】页签按钮显示逻辑定义异常,请联系管理员检查数据字典的定义。', false);
  1869. }
  1870. };
  1871. if (_self[functionName] == null) {
  1872. const jsUrl = _self.jsUrl;
  1873. if (jsUrl == null || jsUrl == undefined) {
  1874. Notify.error('数据字典定义异常', '【' + tabButton.name + '】页签按钮显示逻辑的JS文件不存在,请联系管理员检查数据字典是否存在JS文件。', false);
  1875. return;
  1876. }
  1877. let promise = JsUtil.dynamicLoadJsFunction(jsUrl, logic);
  1878. promise.then(targetFunction => {
  1879. if (targetFunction == null) {
  1880. Notify.error('数据字典定义异常', '【' + tabButton.name + '】页签按钮显示逻辑不存在,请联系管理员检查数据字典的定义。', false);
  1881. return;
  1882. }
  1883. _self[functionName] = targetFunction;
  1884. executeFunction();
  1885. }, errorData => {
  1886. console.error(errorData);
  1887. });
  1888. } else {
  1889. executeFunction();
  1890. }
  1891. }
  1892. }
  1893. }
  1894. },
  1895. /**
  1896. * 报表视图显示逻辑
  1897. */
  1898. reportViewsShowLogical: function () {
  1899. var _self = this;
  1900. if(_self.windowDisplayType != 'Report'){
  1901. // add by jack 2023-12-05
  1902. // 如果不处于报表界面,那么不执行下述业务逻辑
  1903. return;
  1904. }
  1905. if (
  1906. _self.window.reportViewDto != null &&
  1907. _self.window.reportViewDto.reportViewItemDtos != null
  1908. ) {
  1909. _self.processReportResult = undefined;
  1910. for (
  1911. let index = 0; index < _self.window.reportViewDto.reportViewItemDtos.length; index++
  1912. ) {
  1913. let reportViewItemDto =
  1914. _self.window.reportViewDto.reportViewItemDtos[index];
  1915. var logic = reportViewItemDto.showLogical;
  1916. if (logic == null || logic == '') {
  1917. reportViewItemDto.invisible = false;
  1918. _self.executeProcess(reportViewItemDto.processReportNo);
  1919. return;
  1920. }
  1921. let executeFunction = function(){
  1922. let context = new _self.getContext(_self.modelData);
  1923. reportViewItemDto.invisible = !_self[functionName](context);
  1924. if (reportViewItemDto.invisible == false) {
  1925. _self.executeProcess(reportViewItemDto.processReportNo);
  1926. }
  1927. };
  1928. let functionName = 'form_view_showlogical_' + index;
  1929. if (this[functionName] == null) {
  1930. const jsUrl = _self.jsUrl;
  1931. if (jsUrl == null || jsUrl == undefined) {
  1932. Notify.error('数据字典定义异常', '【' + reportViewItemDto.processReportName + '】CURD报表显示逻辑的JS文件不存在,请联系管理员检查数据字典是否存在JS文件。', false);
  1933. return;
  1934. }
  1935. let promise = JsUtil.dynamicLoadJsFunction(jsUrl, logic);
  1936. promise.then(targetFunction => {
  1937. if (targetFunction == null) {
  1938. Notify.error('数据字典定义异常', '【' + reportViewItemDto.processReportName + '】CURD报表显示逻辑不存在,请联系管理员检查数据字典的定义。', false);
  1939. return;
  1940. }
  1941. _self[functionName] = targetFunction;
  1942. executeFunction();
  1943. });
  1944. }else{
  1945. executeFunction();
  1946. }
  1947. }
  1948. }
  1949. },
  1950. },
  1951. };
  1952. </script>
  1953. <style scoped>
  1954. .field-group {
  1955. padding-left: 30px;
  1956. padding-right: 30px;
  1957. }
  1958. .fieldGroup-head {
  1959. cursor: pointer;
  1960. }
  1961. .a-back {
  1962. cursor: pointer;
  1963. text-decoration: none;
  1964. }
  1965. h3 {
  1966. line-height: inherit !important;
  1967. }
  1968. .m-space-btn-group {
  1969. height: 34px;
  1970. }
  1971. .m-row {
  1972. margin-bottom: 15px;
  1973. }
  1974. .fixed-btn-group {
  1975. z-index: 3;
  1976. background-color: #f7f7f7;
  1977. }
  1978. </style>
  1979. <style>
  1980. .btn-group-fixed {
  1981. position: fixed;
  1982. top: 0;
  1983. left: 0;
  1984. z-index: 3;
  1985. }
  1986. .m-image {
  1987. height: 50px;
  1988. cursor: pointer;
  1989. }
  1990. </style>