TabFormViewModal.vue 68 KB

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