TabFormView.vue 70 KB

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