GridBody.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  1. <template>
  2. <tr v-if="showTabGridTitleFields" height="40px" :style="{ 'background-color': warningColor }" :class="{ 'warning': isSelected }">
  3. <td rowspan="2" class="sticky-col">{{ serialNumber }}</td>
  4. <td rowspan="2" class="text-center sticky-col" style="left:50px">
  5. <input v-model="isSelected" autocomplete="off" type="checkbox" @click="clickModelData(modelData)" />
  6. </td>
  7. <td v-if="isShowEdit == undefined || isShowEdit" rowspan="2" class="sticky-col" style="left:80px">
  8. <template v-if="showEditButton">
  9. <span class="operation-delete" aria-hidden="true" @click="editRecord">
  10. <i class="fa" :class="{ 'fa-pencil': !modelData.editMode, 'fa-check': modelData.editMode }" />
  11. </span>
  12. <span class="operation-edit" aria-hidden="true" @click="deleteRecord">
  13. <i class="fa fa-remove" />
  14. </span>
  15. </template>
  16. </td>
  17. <td :colspan="tabGridFields.length + 1" style="text-align: left; padding-left: 2rem;">
  18. <a-space align="center">
  19. <div v-for="tabGridTitleField in tabGridTitleFields" :key="tabGridTitleField.fieldName" @click="clickRecord">
  20. <a-space align="center">
  21. <span style="font-weight: normal;">{{ Language.getDisplayNameTrl($i18n.locale, tabGridTitleField) }}</span>
  22. <CellTextItem
  23. v-if="!modelData.editMode" :grid-field-item="tabGridTitleField" :model-data="modelData"
  24. :class-name="className" style="display: inline-block; font-weight: normal; padding-top: 3px;"
  25. @execute-callout="executeCallout(tabGridTitleField)"
  26. />
  27. <CellItem
  28. v-else :ref="'cellItem' + index" :scroll-object="scrollObject" :field-item="tabGridTitleField"
  29. :model-data="modelData" :parent-model-data="parentModelData" :class-name="className" :window-no="windowNo"
  30. :tab-index="tabIndex" style="display: inline-block; min-width: 200px;"
  31. :class="{ 'table-cell-searchwidget': fieldUtil.isSearchType(tabGridTitleField) }"
  32. @value-changed="valueChanged($event, tabGridTitleField)"
  33. @execute-callout="executeCallout(tabGridTitleField)"
  34. />
  35. </a-space>
  36. </div>
  37. </a-space>
  38. </td>
  39. </tr>
  40. <tr :style="{ 'background-color': warningColor }" :class="{ 'warning': isSelected }" height="40px">
  41. <template v-if="!showTabGridTitleFields">
  42. <td class="sticky-col">{{ serialNumber }}</td>
  43. <td class="text-center sticky-col" style="left:50px">
  44. <input v-model="isSelected" autocomplete="off" type="checkbox" @click="clickModelData(modelData)" />
  45. </td>
  46. <td v-if="isShowEdit == undefined || isShowEdit" class="sticky-col" style="left:80px">
  47. <template v-if="showEditButton">
  48. <span class="operation-delete" aria-hidden="true" @click="editRecord">
  49. <i class="fa" :class="{ 'fa-pencil': !modelData.editMode, 'fa-check': modelData.editMode }" />
  50. </span>
  51. <span class="operation-edit" aria-hidden="true" @click="deleteRecord">
  52. <i class="fa fa-remove" />
  53. </span>
  54. </template>
  55. </td>
  56. </template>
  57. <template
  58. v-for="(gridFieldItem, index) in tabGridFields"
  59. :key="'TabGridField_' + gridFieldItem.fieldName + '_' + index"
  60. >
  61. <td v-if="!modelData.editMode" v-show="gridFieldItem.visible" @click="clickRecord">
  62. <div v-if="gridFieldItem.displayType === 'GridButtonEditor'">
  63. <template
  64. v-for="tabGridButtonItem in gridFieldItem.tabGridButtonDtos" :key="tabGridButtonItem.name"
  65. >
  66. <a-button v-if="tabGridButtonItem.action === 'CREATE' || tabGridButtonItem.action === 'SAVE' || tabGridButtonItem.action === 'RUN' || tabGridButtonItem.action === 'EXPORT' || tabGridButtonItem.action === 'NOTICE' || tabGridButtonItem.action === 'REFRESH'" type="link" @click="buttonClick">{{ tabGridButtonItem.name }}</a-button>
  67. <a-button v-if="tabGridButtonItem.action === 'DELETE'" type="link" danger @click="deleteRecord">{{ tabGridButtonItem.name }}</a-button>
  68. <a-button v-if="tabGridButtonItem.action === 'EDIT'" type="link" @click="editRecord">{{ tabGridButtonItem.name }}</a-button>
  69. <a-button v-if="tabGridButtonItem.action === 'SEE'" type="link" @click="readRecord">{{ tabGridButtonItem.name }}</a-button>
  70. <a-button v-if="tabGridButtonItem.action === 'RUN_PROCESS_REPORT'" type="link" @click="execute(tabGridButtonItem)">{{ tabGridButtonItem.name }}</a-button>
  71. <a-button v-if="tabGridButtonItem.action === 'OPEN_CUSTOMER_WINDOW'" type="link" @click="execute(tabGridButtonItem)">{{ tabGridButtonItem.name }}</a-button>
  72. <a-button v-if="tabGridButtonItem.action === 'OPEN_HTML_WINDOW'" type="link" @click="execute(tabGridButtonItem)">{{ tabGridButtonItem.name }}</a-button>
  73. <a-button v-if="tabGridButtonItem.action === 'OPEN_REMOTE_COMPONENT_MODULE_IN_MODAL'" type="link" @click="openRemoteComponentModule(tabGridButtonItem)">{{ tabGridButtonItem.name }}</a-button>
  74. </template>
  75. </div>
  76. <div v-else>
  77. <CellTextItem
  78. :grid-field-item="gridFieldItem" :model-data="modelData" :class-name="className"
  79. @execute-callout="executeCallout(gridFieldItem)"
  80. />
  81. </div>
  82. </td>
  83. <td
  84. v-else v-show="gridFieldItem.visible"
  85. :class="{ 'table-cell-searchwidget': fieldUtil.isSearchType(gridFieldItem) }" @click="clickRecord"
  86. >
  87. <CellItem
  88. :ref="'cellItem' + index" :scroll-object="scrollObject" :field-item="gridFieldItem"
  89. :model-data="modelData" :parent-model-data="parentModelData" :class-name="className" :window-no="windowNo"
  90. :tab-index="tabIndex" @value-changed="valueChanged($event, gridFieldItem)"
  91. @execute-callout="executeCallout(gridFieldItem)"
  92. />
  93. </td>
  94. </template>
  95. </tr>
  96. <Modal v-model:show="modal" :full="true">
  97. <ProcessReportResultPreview
  98. v-if="
  99. processReportResult != null &&
  100. (processReportResult.reportResults != null ||
  101. processReportResult.processResult != null)
  102. "
  103. :process-report-result="processReportResult"
  104. :pdf-only="false"
  105. :excel-only="false"
  106. />
  107. <template #header>
  108. {{ $t("lang.tabButton.executeResult") }}
  109. </template>
  110. </Modal>
  111. <Modal
  112. v-model:show="titleModal"
  113. :show-canel-button="false"
  114. :show-ok-button="false"
  115. >
  116. <template #header>
  117. {{ tabButtonModel.tipsTitle }}
  118. </template>
  119. {{ tabButtonModel.tipsContent }}
  120. <template #footer>
  121. <button type="button" class="btn btn-default" @click="titleModalClose">
  122. {{ $t("lang.tabButton.cancel") }}
  123. </button>
  124. <button type="primary" class="btn btn-default" @click="executeProcess">
  125. 确认
  126. </button>
  127. </template>
  128. </Modal>
  129. <component :is="modal1Component" v-model:open="modal1Open" :model-data="modelData" @refresh-data="refreshDatas" />
  130. </template>
  131. <script>
  132. import {
  133. ref,
  134. defineAsyncComponent,
  135. } from 'vue';
  136. import WindowClientUtil from '../../resource/dictionary/WindowClientUtil.js';
  137. import FieldUtil from '../../resource/dictionary/FieldUtil.js';
  138. import CellItem from './CellItem.vue';
  139. import CellTextItem from './CellTextItem.vue';
  140. import Common from '../../common/Common.js';
  141. import CustomerWindowResource from '../../api/dic/CustomerWindowResource.js';
  142. import HtmlWindowResource from '../../api/dic/HtmlWindowResource.js';
  143. import ProcessReportResource from '../../api/dic/ProcessReportResource.js';
  144. import Context from '../common/Context.js';
  145. import JsUtil from '../../common/JsUtil.js';
  146. import Language from '../../common/Language.js';
  147. import { Notify, Uuid , CssUtil} from 'pc-component-v3';
  148. import { Spin as ASpin, Empty as AEmpty } from 'ant-design-vue';
  149. export default {
  150. components: {
  151. CellItem, CellTextItem,
  152. },
  153. props: {
  154. windowNo: {
  155. type: String,
  156. default: null,
  157. },
  158. tabIndex: {
  159. type: Number,
  160. default: null,
  161. },
  162. /** 表格标题字段 */
  163. tabGridTitleFields: {
  164. type: Array,
  165. default: function () {
  166. return null;
  167. },
  168. },
  169. /** 表格字段 */
  170. tabGridFields: {
  171. type: Array,
  172. default: function () {
  173. return null;
  174. },
  175. },
  176. modelData: {
  177. type: Object,
  178. default: function () {
  179. return null;
  180. },
  181. },
  182. parentModelData: {
  183. type: Object,
  184. default: function () {
  185. return null;
  186. },
  187. },
  188. className: {
  189. type: String,
  190. default: null,
  191. },
  192. isShowEdit: {
  193. type: Boolean,
  194. default: false,
  195. },
  196. scrollObject: {
  197. type: Object,
  198. default: null,
  199. },
  200. serialNumber: {
  201. type: Number,
  202. default: null,
  203. },
  204. jsUrl: {
  205. type: String,
  206. default: null,
  207. },
  208. simpleFilterParams: {
  209. type: String,
  210. default: null,
  211. },
  212. complexFilterParams: {
  213. type: Array,
  214. default: () => {
  215. return [];
  216. },
  217. },
  218. },
  219. emits: ['deleteRecord', 'editRecord', 'readRecord', 'clickModelData', 'executeCallout', 'valueChanged', 'refreshDatas'],
  220. data: function () {
  221. return {
  222. tabGridFields1: this.tabGridFields,
  223. lastClickTime: 0,
  224. fieldUtil: FieldUtil,
  225. Language: Language,
  226. modal1Open: false,
  227. modal1Component: null,
  228. processReportResult: {},
  229. modal: false,
  230. titleModal: false,
  231. tabButtonModel:{},
  232. };
  233. },
  234. computed: {
  235. modelDataCopy: function () {
  236. return JSON.parse(JSON.stringify(this.modelData));
  237. },
  238. isSelected: {
  239. get: function () {
  240. return this.modelData.select == true;
  241. },
  242. set: function () {
  243. },
  244. },
  245. /**
  246. * 获取报警颜色
  247. */
  248. warningColor: function () {
  249. if (this.modelData.data['warningColor'] != undefined && this.modelData.data['warningColor'].displayValue.length > 0) {
  250. return this.modelData.data['warningColor'].displayValue[0];
  251. } else {
  252. return 'none';
  253. }
  254. },
  255. /**
  256. * 是否显示编辑按钮
  257. */
  258. showEditButton: function () {
  259. if (this.isShowEdit == undefined || this.isShowEdit) {
  260. if (this.modelData != undefined
  261. && this.modelData.data != undefined
  262. && this.modelData.data['documentStatus'] != undefined
  263. && this.modelData.data['documentStatus'].displayValue != undefined
  264. && (this.modelData.data['documentStatus'].displayValue[0] == 'APPROVED'
  265. || this.modelData.data['documentStatus'].displayValue[0] == 'REJECTED'
  266. || this.modelData.data['documentStatus'].displayValue[0] == 'PROCESSING')) {
  267. return false;
  268. }
  269. return true;
  270. }
  271. return false;
  272. },
  273. /**
  274. * 是否显示标题行
  275. */
  276. showTabGridTitleFields: function () {
  277. if (this.tabGridTitleFields == null || this.tabGridTitleFields.length == 0) {
  278. return false;
  279. } else {
  280. return true;
  281. }
  282. },
  283. },
  284. watch: {
  285. 'parentModelData': {
  286. deep: true,
  287. handler(curVal, oldVal) {
  288. var _self = this;
  289. for (let index = 0; index < _self.tabGridFields.length; index++) {
  290. const tabGridField = _self.tabGridFields[index];
  291. let oldTabGridFieldString = JSON.stringify(tabGridField);
  292. const columnShowLogical = tabGridField.columnShowLogical;
  293. if (columnShowLogical != null && columnShowLogical.length > 0) {
  294. let functionName = tabGridField.fieldName.replace('.', '_') + '_showLogical';
  295. let executeFunction = function () {
  296. let parentCtx = new _self.getContext(_self.parentModelData);
  297. try {
  298. tabGridField.visible = _self[functionName](null, parentCtx.modelData);
  299. } catch (e) {
  300. console.error('js代码 %s 执行异常 %o', columnShowLogical, e);
  301. tabGridField.visible = true;
  302. }
  303. };
  304. if (_self[functionName] == null) {
  305. // 执行服务端的脚本
  306. const jsUrl = _self.jsUrl;
  307. if (jsUrl == null || jsUrl == undefined) {
  308. Notify.error('数据字典定义异常', '【' + tabGridField.fieldName + '】列显示逻辑的JS文件不存在,请联系管理员检查数据字典是否JS文件。', false);
  309. return;
  310. }
  311. let promise = JsUtil.dynamicLoadJsFunction(jsUrl, columnShowLogical);
  312. promise.then(dynamicFunction => {
  313. let targetFunction = dynamicFunction;
  314. if (targetFunction == null) {
  315. Notify.error('数据字典定义异常', '【' + tabGridField.fieldName + '】列显示逻辑定义异常,请联系管理员检查数据字典的定义。', false);
  316. return;
  317. }
  318. _self[functionName] = targetFunction;
  319. executeFunction();
  320. }, errorData => {
  321. console.error(errorData);
  322. });
  323. } else {
  324. executeFunction();
  325. }
  326. } else {
  327. tabGridField.visible = true;
  328. }
  329. let newTabGridFieldString = JSON.stringify(tabGridField);
  330. // bug fixed by jack 2022-01-17
  331. // 只有当数据发生改变以后,才重新设置数据,解决当子表数据量很打的时候,输入卡顿的问题。
  332. if (oldTabGridFieldString != newTabGridFieldString) {
  333. _self.tabGridFields[index] = tabGridField;
  334. }
  335. }
  336. console.log(_self.tabGridFields);
  337. },
  338. },
  339. },
  340. methods: {
  341. /**
  342. * 获取Context
  343. */
  344. getContext: Context,
  345. deleteRecord: function () {
  346. this.$emit('deleteRecord');
  347. },
  348. refreshDatas: function(){
  349. this.$emit('refreshDatas');
  350. },
  351. buttonClick: function(){
  352. Notify.error('提示', '暂不支持该组件', false);
  353. },
  354. closeModal: function(){
  355. var _self = this;
  356. _self.modal1Open.value = false;
  357. },
  358. // 改变表格行元素的编辑状态
  359. editRecord: function () {
  360. this.$emit('editRecord');
  361. },
  362. readRecord: function () {
  363. this.$emit('readRecord');
  364. },
  365. clickModelData: function () {
  366. this.$emit('clickModelData');
  367. },
  368. // 值发生改变
  369. valueChanged: function (newFieldValue, gridFieldItem) {
  370. var valueObject = {
  371. newFieldValue: newFieldValue,
  372. gridFieldItem: gridFieldItem,
  373. };
  374. this.$emit('valueChanged', valueObject);
  375. this.refreshSelectField(this.modelData, gridFieldItem.fieldName);
  376. },
  377. // 刷新下拉选择框keyValues
  378. refreshSelectField: function (modelData, valueChangedFieldName) {
  379. var _self = this;
  380. if (_self.tabGridFields1) {
  381. _self.tabGridFields1.forEach(function (item) {
  382. if (item.displayType == 'ListBoxEditor') {
  383. var name1 = ':' + valueChangedFieldName;
  384. var showLogical = item.showLogical;
  385. if (showLogical != undefined && showLogical.indexOf(name1) >= 0) {
  386. refresh(item);
  387. }
  388. }
  389. });
  390. }
  391. function refresh(item) {
  392. var obj = {
  393. fieldId: item.id,
  394. modelData: modelData,
  395. };
  396. console.log('GridBody RefreshField');
  397. $.ajax({
  398. url: Common.getApiURL('FieldResource/refreshField'),
  399. async: false,
  400. dataType: 'json',
  401. type: 'post',
  402. data: JSON.stringify(obj),
  403. contentType: 'application/json',
  404. beforeSend: function (request) {
  405. Common.addTokenToRequest(request);
  406. },
  407. success: function (data) {
  408. if (data != undefined) {
  409. item.keyValues = data.keyValues;
  410. }
  411. },
  412. error: function (XMLHttpRequest, textStatus, errorThrown) {
  413. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  414. },
  415. });
  416. }
  417. },
  418. performValidate: function () {
  419. var validateResults = [];
  420. for (var i = 0; i < this.tabGridFields1.length; i++) {
  421. let cellId = 'cellItem' + i;
  422. if (this.$refs[cellId] && this.$refs[cellId][0]) {
  423. var result = this.$refs[cellId][0].performValidate();
  424. validateResults.push(result);
  425. }
  426. }
  427. return validateResults;
  428. },
  429. clickRecord: function () {
  430. var now = new Date().getTime();
  431. if (now - this.lastClickTime < 500) {
  432. this.readRecord();
  433. }
  434. this.lastClickTime = now;
  435. },
  436. /**
  437. * 执行Callout
  438. */
  439. executeCallout: function (gridFieldItem) {
  440. this.$emit('executeCallout', gridFieldItem);
  441. },
  442. //跳转或执行流程
  443. execute: function (tabButton) {
  444. var _self = this;
  445. _self.tabButtonModel = tabButton;
  446. if (tabButton.customerWindowNo != undefined && tabButton.customerWindowNo != '') {
  447. CustomerWindowResource.uniqueByNo(tabButton.customerWindowNo).then(
  448. successData => {
  449. tabButton.customerWindowRouteUrl = successData.routeUrl;
  450. if(tabButton.customerWindowNo == '20221101_151823'){
  451. localStorage.setItem('AssetInstance_ComplexFilterParams',JSON.stringify(_self.complexFilterParams));
  452. localStorage.setItem('AssetInstance_SimpleFilterParams', _self.simpleFilterParams);
  453. }
  454. //跳转到tabButton.routeUrl
  455. _self.switchFormRoute(tabButton);
  456. },
  457. errorData => {
  458. Common.processException(errorData);
  459. },
  460. );
  461. } else if (
  462. tabButton.processReportNo != undefined &&
  463. tabButton.processReportNo != ''
  464. ) {
  465. // 判断流程报表是否有参数
  466. // 如果有参数则直接跳转到流程和报表的界面。
  467. if (tabButton.routerRedirect == undefined || tabButton.routerRedirect == false) {
  468. if(tabButton.tipsTitle == undefined || tabButton.tipsTitle.length == 0){
  469. _self.executeProcess();
  470. }else{
  471. _self.titleModal = true;
  472. }
  473. } else {
  474. this.$router.push({
  475. path: '/desktop/process-report/' + tabButton.processReportNo,
  476. });
  477. }
  478. } else if (tabButton.htmlWindowNo != undefined) {
  479. HtmlWindowResource.uniqueByNo(tabButton.htmlWindowNo).then(
  480. htmlWindowDto => {
  481. if (htmlWindowDto != undefined) {
  482. var htmlWindowUrl = htmlWindowDto.htmlFileName;
  483. var autoCloseInterval = htmlWindowDto.autoCloseInterval;
  484. var regExp = new RegExp('[{].*?[}]', 'g');
  485. var result = htmlWindowUrl.match(regExp);
  486. if (htmlWindowUrl != undefined && htmlWindowUrl != '') {
  487. for (var index = 0, len = result.length; index < len; index++) {
  488. var tempResult = result[index];
  489. console.log('{' + tempResult + '}匹配');
  490. if (tempResult == '{URL}') {
  491. htmlWindowUrl = htmlWindowUrl.replace(
  492. '{URL}',
  493. Common.getHostPageBaseURL(),
  494. );
  495. } else if (tempResult == '{RecordIds}') {
  496. var recordId = _self.modelData.id;
  497. htmlWindowUrl = htmlWindowUrl.replace('{RecordIds}', recordId);
  498. } else if (tempResult == '{Token}') {
  499. htmlWindowUrl = htmlWindowUrl.replace('{Token}', Common.getToken());
  500. } else {
  501. if (_self.selectedModelDatas.length == 0) {
  502. Notify.error(_self.$t('lang.Notify.error'), _self.$t('lang.tabButton.describe3'), true);
  503. return;
  504. } else if (_self.selectedModelDatas.length > 1) {
  505. Notify.error(_self.$t('lang.Notify.error'), _self.$t('lang.tabButton.describe2'), true);
  506. return;
  507. }
  508. var tempResult1 = tempResult.replace('{', '').replace('}', '');
  509. htmlWindowUrl = htmlWindowUrl.replace(
  510. tempResult,
  511. _self.getFirstSelectModelDataFieldValue(tempResult1),
  512. );
  513. }
  514. }
  515. var openWindow = window.open(htmlWindowUrl);
  516. // 自动关闭
  517. if (autoCloseInterval != undefined) {
  518. setTimeout(function () {
  519. openWindow.close();
  520. openWindow = undefined;
  521. }, autoCloseInterval * 1000);
  522. }
  523. }
  524. }
  525. },
  526. errorData => {
  527. Common.processException(errorData);
  528. },
  529. );
  530. }
  531. },
  532. // 切换到Form表单的路由
  533. switchFormRoute: function (tabButton) {
  534. const _self = this;
  535. var routeDate = {
  536. path: tabButton.customerWindowRouteUrl,
  537. params: {
  538. modelData: this.modelData,
  539. },
  540. };
  541. // 请勿修改,会影响生单的功能
  542. var uuid = _self.uuid;
  543. if (uuid != undefined) {
  544. routeDate.path = routeDate.path + '/' + uuid;
  545. }
  546. const frameUrl = Common.getRedirectUrl(
  547. '#' + routeDate.path,
  548. );
  549. // 供子页面iframe调用,修改modelData,(举例:生单界面修改参数)。
  550. // window.modelDataChanged = this.modelDataChanged;
  551. // window.getModelData = this.getModelData;
  552. let modelData = JSON.stringify(this.modelData);
  553. console.log(modelData);
  554. localStorage.setItem(_self.uuid + '#GenerateDocumentTool', modelData);
  555. var iWidth = 1280;//弹出窗口的宽度;
  556. var iHeight = 720; //弹出窗口的高度;
  557. var iTop = (window.screen.availHeight-30-iHeight)/2;//获得窗口的垂直位置;
  558. var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
  559. window.open(frameUrl,'_blank','height='+iHeight+',innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
  560. // window.open(frameUrl);
  561. },
  562. // 执行流程
  563. executeProcess: function () {
  564. var _self = this;
  565. var ids = [_self.modelData.id];
  566. ProcessReportResource.runProcessByIds(_self.tabButtonModel.processReportNo, ids).then(
  567. successData => {
  568. _self.modal = true;
  569. _self.processReportResult = successData;
  570. if (
  571. _self.processReportResult.reportResults != undefined &&
  572. _self.processReportResult.reportResults.length > 0
  573. ) {
  574. _self.processReportResult.reportResults.forEach(function (item, index) {
  575. if(item.reportDefinitionType!=='ExcelReport'){
  576. item.previewIndex=1;
  577. }else{
  578. item.previewIndex=2;
  579. }
  580. if (index == 0) {
  581. item.showPreview=true;
  582. } else {
  583. item.showPreview=false;
  584. }
  585. });
  586. }
  587. _self.titleModal = false;
  588. },
  589. errorData => {
  590. _self.titleModal = false;
  591. Common.processException(errorData);
  592. },
  593. );
  594. _self.refreshDatas();
  595. // }
  596. },
  597. /**
  598. * 获取字符串的哈希值
  599. * @param input
  600. */
  601. getHash: function (input) {
  602. let hash = 0;
  603. if (input.length === 0) {
  604. return hash;
  605. }
  606. for (let i = 0; i < input.length; i++) {
  607. const char = input.charCodeAt(i);
  608. hash = (hash << 5) - hash + char;
  609. hash = hash & hash; // 确保返回值是一个32位有符号整数
  610. }
  611. return Math.abs(hash).toString();
  612. },
  613. /**
  614. * 远程加载ES VUE组件模块,并在模态框中打开。
  615. * @param jsUrl js路径
  616. * @param cssUrl css路径
  617. */
  618. openRemoteComponentModule: function (tabButton) {
  619. var _self = this;
  620. let jsUrl = tabButton.remoteComponentModuleJsUrl;
  621. let cssUrl = tabButton.remoteComponentModuleCssUrl;
  622. // 显示模态框
  623. // 异步的加载js组件
  624. //let jsUrl = './static/client-eam-module-v3/dist/AssetCheckCreate.js';
  625. //let cssUrl = './static/client-eam-module-v3/dist/AssetCheckCreate.css';
  626. if (cssUrl != null && cssUrl.length > 0) {
  627. let cssUrlHash = _self.getHash(cssUrl);
  628. CssUtil.dynamicLoadCss(cssUrl, cssUrlHash);
  629. }
  630. // webpackIgnore:设置为 true 时,禁用动态导入解析。
  631. // const testAsyncRemoteComponent = await import(/* webpackIgnore: true */ jsUrl);
  632. // console.log(testAsyncRemoteComponent);
  633. if (jsUrl != null && jsUrl.length > 0) {
  634. const testAsyncRemoteComponent = defineAsyncComponent({
  635. // 加载函数
  636. loader: () => {
  637. return import(/* webpackIgnore: true */ jsUrl);
  638. },
  639. // 加载异步组件时使用的组件
  640. loadingComponent: ASpin,
  641. // 展示加载组件前的延迟时间,默认为 200ms
  642. delay: 200,
  643. // 加载失败后展示的组件
  644. errorComponent: AEmpty,
  645. // 如果提供了一个 timeout 时间限制,并超时了
  646. // 也会显示这里配置的报错组件,默认值是:Infinity
  647. timeout: 10000,
  648. });
  649. _self.modal1Component = testAsyncRemoteComponent;
  650. _self.modal1Open = true;
  651. console.log(_self.modal1Component);
  652. }
  653. },
  654. //关闭表头按钮提示框
  655. titleModalClose: function (){
  656. var _self = this;
  657. _self.titleModal = false;
  658. },
  659. },
  660. };
  661. </script>
  662. <style scoped>
  663. .table-cell-text {
  664. overflow: hidden;
  665. text-overflow: ellipsis;
  666. white-space: nowrap;
  667. text-align: center;
  668. }
  669. /** 搜索框,自动提示表格, */
  670. .table-cell-searchwidget {
  671. position: relative;
  672. }
  673. .text-center {
  674. text-align: center;
  675. }
  676. .warning {
  677. background-color: #fcf8e3 !important;
  678. }
  679. .operation-delete {
  680. margin-left: 10px;
  681. margin-right: 5px;
  682. }
  683. .operation-edit {
  684. margin-left: 5px;
  685. margin-right: 10px;
  686. }
  687. /* 固定列 */
  688. .sticky-col {
  689. position: -webkit-sticky; /* Safari */
  690. position: sticky;
  691. left: 0;
  692. background: #fafafa;
  693. z-index: 1; /* 确保固定列在其他内容之上 */
  694. }
  695. </style>