TabFormViewModal.vue 68 KB

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