TabFormViewModal.vue 69 KB

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