QueryPage.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
  1. <template>
  2. <div
  3. class="flex-container" :class="{
  4. 'flex-container-modal': isSearchWidget == true,
  5. 'flex-container': isSearchWidget == null || isSearchWidget == false,
  6. }"
  7. >
  8. <div class="flex-header">
  9. <div>
  10. <div>
  11. <InfoHeader
  12. :html-help-url="infoWindowDto.htmlHelpUrl"
  13. :info-grid-fields="infoGridFieldsInstance.infoGridFields"
  14. :header-name="Language.getNameTrl($i18n.locale, infoWindowDto)"
  15. :sub-header-name="Language.getHelpTrl($i18n.locale, infoWindowDto)"
  16. :info-filter-fields="infoFilterFields"
  17. :info-window-no="infoWindowDto.no"
  18. @filter-field-property-changed="filterFieldPropertyChanged($event)"
  19. @grid-field-property-changed="gridFieldPropertyChanged($event)"
  20. />
  21. </div>
  22. <div>
  23. <QueryCondition
  24. ref="queryCondition" :info-filter-fields="infoFilterFields"
  25. :info-buttons="infoWindowDto.infoButtons" :is-search-widget="isSearchWidget"
  26. :info-window-no="infoWindowDto.no"
  27. :search-condition-instance="searchConditionInstance"
  28. @simple-search="simpleSearch" @complex-search="complexSearch"
  29. />
  30. </div>
  31. </div>
  32. <a-space warp style="margin-top: 5px;">
  33. <a-button type="link" @click="pageSearch">
  34. {{ $t('lang.QueryConditionSimple.refresh') }}
  35. <template #icon>
  36. <SyncOutlined />
  37. </template>
  38. </a-button>
  39. <a-button type="link" @click="executeExport">
  40. {{ $t('lang.QueryConditionSimple.export') }}
  41. <template #icon>
  42. <DownloadOutlined />
  43. </template>
  44. </a-button>
  45. </a-space>
  46. <div v-if="!isSearchWidget" style="display: inline-block">
  47. <template v-for="infoButton in infoButtons" :key="infoButton.name">
  48. <a-button
  49. v-tooltip.right="Language.getHelpTrl($i18n.locale, infoButton)" type="link"
  50. @click="executeProcess(infoButton)"
  51. >
  52. {{ Language.getNameTrl($i18n.locale, infoButton) }}
  53. </a-button>
  54. </template>
  55. </div>
  56. <a-segmented v-model:value="selectedView" :options="views" class="m-segmented" size="small">
  57. <template #label="{ value: val, payload = {} }">
  58. <div style="padding: 2px 2px">
  59. <a-avatar :src="payload.src" :alt="val" size="small" shape="square">
  60. {{ payload.content }}
  61. </a-avatar>
  62. </div>
  63. </template>
  64. </a-segmented>
  65. </div>
  66. <!-- xx -->
  67. <div
  68. style="padding:0;border-bottom: solid 1px #d1cfcf;margin-top:5px; margin-bottom: 5px;"
  69. />
  70. <div
  71. class="flex-content"
  72. >
  73. <component
  74. :is="selectedView"
  75. v-if="selectedView != null"
  76. :info-grid-fields-instance="infoGridFieldsInstance" :sort-instance="sortInstance"
  77. :info-window-data-instance="infoWindowDataInstance" :pagination="pagination" :multiple="multiple"
  78. :call-out-js-url="infoWindowDto.callOutJsUrl" @data-selected="$emit('dataSelected', $event)"
  79. @delete-selected="$emit('deleteSelected', $event)"
  80. />
  81. </div>
  82. <div class="flex-footer" style="margin-top: 10px">
  83. <div class="pull-left">
  84. <span>{{ $t("lang.QueryPage.the") }}
  85. {{ (pagination.current_page - 1) * pagination.per_page + 1 }}
  86. -
  87. {{ pagination.current_page * pagination.per_page }}
  88. {{ $t("lang.QueryPage.strip") }}
  89. ,
  90. {{ $t("lang.QueryPage.total") }}
  91. {{ pagination.total }}
  92. {{ $t("lang.QueryPage.strip") }}
  93. ,
  94. {{ $t("lang.QueryPage.displayOnEachPage") }}
  95. </span>
  96. <PageSizeSelect :size="pagination.per_page" @page-size-changed="gridSizeSelect" />
  97. <span>{{ $t("lang.QueryPage.strip") }}</span>
  98. </div>
  99. <div class="pull-right">
  100. <Pagination :pagination="pagination" :callback="pageSearch" />
  101. </div>
  102. </div>
  103. <Loading v-if="loading" />
  104. <Modal v-model:show="modal">
  105. <template #default>
  106. <ProcessReportResult :process-report-result="processReportResult" :pdf-only="pdfOnly" :excel-only="excelOnly" />
  107. </template>
  108. <template #header>
  109. <div>{{ $t("lang.QueryPage.resultsOfEnforcement") }}</div>
  110. </template>
  111. </Modal>
  112. </div>
  113. </template>
  114. <script>
  115. import Common from '../../common/Common.js';
  116. import Modal from '../../modal/src/Modal.vue';
  117. import PageSizeSelect from '../../page-size-select/src/PageSizeSelect.vue';
  118. import Pagination from '../../vue-bootstrap-pagination/src/vue-bootstrap-pagination.vue';
  119. import QueryCondition from './QueryCondition.vue';
  120. import InfoHeader from './InfoHeader.vue';
  121. import InfoUtil from './InfoUtil.js';
  122. import Notify from '../../common/Notify.js';
  123. import Loading from '../../loading/src/Loading.vue';
  124. import ProcessReportResult from '../../process/src/ProcessReportResult.vue';
  125. import Uuid from '../../common/Uuid.js';
  126. import DownloadService from '../../common/DownloadService.js';
  127. import HtmlWindowResource from '../../html-window/src/api/HtmlWindowResource.js';
  128. import CustomerWindowResource from '../../customer-window/src/api/CustomerWindowResource.js';
  129. import ProcessReportResource from '../../process/src/api/ProcessReportResource.js';
  130. import UserStorageResource from '../../common/UserStorageResource.js';
  131. import Language from '../../common/Language.js';
  132. import dayjs from 'dayjs';
  133. import QueryPageTable from './QueryPageTable.vue';
  134. import QueryPageDashboard from './QueryPageDashboard.vue';
  135. import { useSort, useInfoGridFields, useInfoWindowData, useSearchCondition } from './InfoWindowState.js';
  136. import { SyncOutlined, DownloadOutlined } from '@ant-design/icons-vue';
  137. export default {
  138. name: 'QueryPage',
  139. components: {
  140. Pagination,
  141. QueryCondition,
  142. Modal,
  143. InfoHeader,
  144. Loading,
  145. ProcessReportResult,
  146. PageSizeSelect,
  147. QueryPageTable,
  148. QueryPageDashboard,
  149. SyncOutlined,
  150. DownloadOutlined ,
  151. },
  152. props: {
  153. whereClauseSource: {
  154. type: Object,
  155. default() {
  156. return null;
  157. },
  158. },
  159. isSearchWidget: {
  160. type: Boolean,
  161. default: false,
  162. },
  163. parentModelData: {
  164. type: Object,
  165. default() {
  166. return null;
  167. },
  168. },
  169. modelData: {
  170. type: Object,
  171. default() {
  172. return null;
  173. },
  174. },
  175. fieldValue: {
  176. type: Object,
  177. default() {
  178. return null;
  179. },
  180. },
  181. /**
  182. * 查询窗口编号
  183. */
  184. windowNo: {
  185. type: String,
  186. default: null,
  187. },
  188. /**
  189. * 是否多选
  190. */
  191. multiple: {
  192. type: Boolean,
  193. default: false,
  194. },
  195. },
  196. emits: ['dataSelected', 'deleteSelected'],
  197. data: function () {
  198. this.Language = Language;
  199. return {
  200. infoWindowDto: {},
  201. queryResult: {},
  202. pagination: {
  203. total: 0,
  204. per_page: Common.pageSize, // required
  205. current_page: 1, // required
  206. last_page: 10, // required
  207. },
  208. infoQueryParam: [],
  209. processReportResult: [],
  210. uuid: Uuid.createUUID(),
  211. currentIsSimpleSearch: true,
  212. startX: '',
  213. startWidth: '',
  214. processReportDto: '',
  215. pdfOnly: '',
  216. excelOnly: '',
  217. infoFilterFields: [],
  218. loading: false,
  219. modal: false,
  220. searchType: 'simple',
  221. sortInstance: useSort(),
  222. searchConditionInstance: useSearchCondition(),
  223. infoGridFieldsInstance: useInfoGridFields(),
  224. infoWindowDataInstance: useInfoWindowData(),
  225. views: [
  226. {
  227. name: '表格视图',
  228. value: 'QueryPageTable',
  229. payload: {
  230. src: 'https://joeschmoe.io/api/v1/random',
  231. style: {
  232. backgroundColor: '#f56a00',
  233. },
  234. },
  235. },
  236. {
  237. name: '看板视图',
  238. value: 'QueryPageDashboard',
  239. payload: {
  240. src: 'https://joeschmoe.io/api/v1/random',
  241. style: {
  242. backgroundColor: '#f56a00',
  243. },
  244. },
  245. },
  246. ],
  247. selectedView: 'QueryPageTable', // 选中的视图
  248. };
  249. },
  250. watch: {
  251. 'sortInstance.sortSetting': {
  252. handler(newValue, oldValue) {
  253. this.infoQueryParam.sortClause = this.sortInstance.getSortString();
  254. if (this.currentIsSimpleSearch) {
  255. this.queryInfoWindowDataSimple();
  256. } else {
  257. this.queryInfoWindowDataComplex();
  258. }
  259. },
  260. deep: true,
  261. },
  262. selectedView: function(newValue, oldValue){
  263. console.log(newValue);
  264. console.log(oldValue);
  265. },
  266. },
  267. created: function () {
  268. const infoPageSize = localStorage.getItem(
  269. `InfoWindowPageSize${this.windowNo}`,
  270. );
  271. if (infoPageSize) {
  272. this.pagination.per_page = infoPageSize;
  273. }
  274. },
  275. mounted: function(){
  276. },
  277. methods: {
  278. /**
  279. * 页面显示数量改变
  280. * @param newPageSize
  281. */
  282. gridSizeSelect: function (newPageSize) {
  283. this.pagination.current_page = 1;
  284. this.pagination.per_page = newPageSize;
  285. localStorage.setItem(`InfoWindowPageSize${this.windowNo}`, newPageSize);
  286. },
  287. // 初始化数据
  288. initWidget: function (data) {
  289. var _self = this;
  290. if (data == undefined) {
  291. return;
  292. }
  293. _self.infoWindowDto = data;
  294. _self.infoFilterFields = data.infoFilterFields;
  295. _self.infoGridFieldsInstance.init(_self.infoWindowDto.no, data.infoGridFields);
  296. _self.infoFilterFields.forEach(function (item) {
  297. item.value = {
  298. infoFilterFieldId: item.id,
  299. value1: '',
  300. value2: '',
  301. };
  302. });
  303. InfoUtil.restoreInfoFilterFields(
  304. _self.infoWindowDto.no,
  305. _self.infoFilterFields,
  306. );
  307. _self.simpleSearch();
  308. },
  309. /**
  310. * 高级查询
  311. * @param value
  312. */
  313. complexSearch: function (value) {
  314. var _self = this;
  315. _self.searchType = value;
  316. _self.pagination.current_page = 1;
  317. var infoQueryParam = {
  318. infoWindowNo: _self.infoWindowDto.no,
  319. start: (_self.pagination.current_page - 1) * _self.pagination.per_page,
  320. length: _self.pagination.per_page,
  321. sortClause: '',
  322. infoFilterFieldValues: _self.$refs.queryCondition.getQueryCondition(),
  323. whereClauseSource: _self.whereClauseSource,
  324. parentModelData: _self.parentModelData,
  325. modelData: _self.modelData,
  326. isSearchWidget: _self.isSearchWidget,
  327. };
  328. _self.infoQueryParam = infoQueryParam;
  329. _self.currentIsSimpleSearch = false;
  330. _self.queryInfoWindowDataComplex();
  331. },
  332. /**
  333. * 分页查询
  334. */
  335. pageSearch: function () {
  336. var _self = this;
  337. _self.infoQueryParam.start =
  338. (_self.pagination.current_page - 1) * _self.pagination.per_page;
  339. _self.infoQueryParam.length = _self.pagination.per_page;
  340. _self.infoQueryParam.infoFilterFieldValues =
  341. _self.$refs.queryCondition.getQueryCondition();
  342. if (_self.searchType === 'complex') {
  343. _self.queryInfoWindowDataComplex();
  344. } else {
  345. _self.queryInfoWindowDataSimple();
  346. }
  347. },
  348. /**
  349. * 简单查询
  350. * @return {void}
  351. */
  352. simpleSearch: function (value) {
  353. var _self = this;
  354. _self.searchType = value;
  355. _self.pagination.current_page = 1;
  356. var infoQueryParam = {
  357. infoWindowNo: _self.infoWindowDto.no,
  358. start: (_self.pagination.current_page - 1) * _self.pagination.per_page,
  359. length: _self.pagination.per_page,
  360. sortClause: '',
  361. infoFilterFieldValues: _self.$refs.queryCondition.getQueryCondition(),
  362. whereClauseSource: _self.whereClauseSource,
  363. parentModelData: _self.parentModelData,
  364. modelData: _self.modelData,
  365. isSearchWidget: _self.isSearchWidget,
  366. };
  367. _self.infoQueryParam = infoQueryParam;
  368. _self.currentIsSimpleSearch = true;
  369. _self.queryInfoWindowDataSimple();
  370. },
  371. /**
  372. * 调用后端高级查询的接口
  373. */
  374. queryInfoWindowDataComplex: function () {
  375. var _self = this;
  376. _self.loading = true;
  377. $.ajax({
  378. url: Common.getApiURL('InfoWindowResource/queryInfoWindowDataComplex'),
  379. type: 'post',
  380. dataType: 'json',
  381. beforeSend: function (request) {
  382. Common.addTokenToRequest(request);
  383. },
  384. contentType: 'application/json',
  385. data: JSON.stringify(_self.infoQueryParam),
  386. success: function (data) {
  387. _self.loading = false;
  388. _self.setSelectedFlag(data);
  389. _self.infoWindowDataInstance.init(data.dataList);
  390. _self.pagination.total = data.totalSize;
  391. _self.pagination.last_page = Math.ceil(
  392. data.totalSize / data.range.length,
  393. );
  394. },
  395. error: function (XMLHttpRequest, textStatus, errorThrown) {
  396. _self.loading = false;
  397. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  398. },
  399. });
  400. },
  401. /**
  402. * 设置数据是否被已经被选中。
  403. */
  404. setSelectedFlag: function (data) {
  405. let _self = this;
  406. let selectedIds = null;
  407. let selectedId = null;
  408. if (_self.fieldValue != null) {
  409. selectedIds = _self.fieldValue.ids;
  410. selectedId = _self.fieldValue.id;
  411. }
  412. data.dataList.forEach(function (item) {
  413. if (selectedIds != null && selectedIds.indexOf(item.id) >= 0) {
  414. item.select = true;
  415. } else if (selectedId != null && selectedId == item.id) {
  416. item.select = true;
  417. } else {
  418. item.select = false;
  419. }
  420. });
  421. },
  422. /**
  423. * 调用后端简单查询接口
  424. */
  425. queryInfoWindowDataSimple: function () {
  426. var _self = this;
  427. _self.loading = true;
  428. _self.infoQueryParam.whereClauseSource = _self.whereClauseSource;
  429. $.ajax({
  430. url: Common.getApiURL('InfoWindowResource/queryInfoWindowDataSimple'),
  431. type: 'post',
  432. dataType: 'json',
  433. beforeSend: function (request) {
  434. Common.addTokenToRequest(request);
  435. },
  436. contentType: 'application/json',
  437. data: JSON.stringify(_self.infoQueryParam),
  438. success: function (data) {
  439. if (_self.$refs.loading) {
  440. _self.loading = false;
  441. }
  442. _self.setSelectedFlag(data);
  443. _self.infoWindowDataInstance.init(data.dataList);
  444. _self.pagination.total = data.totalSize;
  445. _self.pagination.last_page = Math.ceil(
  446. data.totalSize / data.range.length,
  447. );
  448. },
  449. error: function (XMLHttpRequest, textStatus, errorThrown) {
  450. _self.loading = false;
  451. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  452. },
  453. });
  454. },
  455. /**
  456. * 获取选择的数据
  457. */
  458. getSelectedModelDatas: function () {
  459. return this.infoWindowDataInstance.getSelected();
  460. },
  461. /**
  462. * 条件字段属性发生改变
  463. */
  464. filterFieldPropertyChanged: function (infoFilterFieldsClone) {
  465. let _self = this;
  466. InfoUtil.saveInfoFilterFields(
  467. _self.infoWindowDto.no,
  468. infoFilterFieldsClone,
  469. ).then(
  470. successData => {
  471. InfoUtil.restoreInfoFilterFields(
  472. _self.infoWindowDto.no,
  473. _self.infoFilterFields,
  474. );
  475. },
  476. errorData => {
  477. console.log(errorData);
  478. },
  479. );
  480. },
  481. /**
  482. * 表格字段属性发生改变
  483. */
  484. gridFieldPropertyChanged: function (infoGridFieldsClone) {
  485. let _self = this;
  486. _self.infoGridFieldsInstance.saveInfoGridFields(
  487. _self.infoWindowDto.no,
  488. infoGridFieldsClone,
  489. );
  490. },
  491. /**
  492. * 执行流程
  493. * @param {Object} infoButton
  494. * @return {void}
  495. */
  496. executeProcess: function (infoButton) {
  497. var _self = this;
  498. if (infoButton == null) {
  499. return;
  500. }
  501. let tempSelectedModelDatas = _self.getSelectedModelDatas();
  502. if (
  503. infoButton.htmlWindowNo != null &&
  504. infoButton.htmlWindowNo.length > 0
  505. ) {
  506. HtmlWindowResource.uniqueByNo(infoButton.htmlWindowNo).then(
  507. htmlWindowDto => {
  508. if (htmlWindowDto != undefined) {
  509. var htmlWindowUrl = htmlWindowDto.htmlFileName;
  510. var autoCloseInterval = htmlWindowDto.autoCloseInterval;
  511. var regExp = new RegExp('[{].*?[}]', 'g');
  512. var result = htmlWindowUrl.match(regExp);
  513. if (htmlWindowUrl != undefined && htmlWindowUrl != '') {
  514. for (var index = 0, len = result.length; index < len; index++) {
  515. var tempResult = result[index];
  516. console.log('{' + tempResult + '}匹配');
  517. if (tempResult == '{URL}') {
  518. htmlWindowUrl = htmlWindowUrl.replace(
  519. '{URL}',
  520. Common.getRedirectUrl(''),
  521. );
  522. console.log('{' + htmlWindowUrl + '}地址');
  523. } else if (tempResult == '{RecordId}') {
  524. if (tempSelectedModelDatas.length == 0) {
  525. Notify.error('错误', '未选择可操作的数据', true);
  526. return;
  527. }
  528. htmlWindowUrl = htmlWindowUrl.replace(
  529. '{RecordId}',
  530. _self.getFirstSelectRecordId(),
  531. );
  532. } else if (tempResult == '{RecordIds}') {
  533. if (tempSelectedModelDatas.length == 0) {
  534. Notify.error('错误', '未选择可操作的数据', true);
  535. return;
  536. }
  537. htmlWindowUrl = htmlWindowUrl.replace(
  538. '{RecordIds}',
  539. _self.getSelectedRecordIds(),
  540. );
  541. } else if (tempResult == '{Token}') {
  542. htmlWindowUrl = htmlWindowUrl.replace(
  543. '{Token}',
  544. Common.getToken(),
  545. );
  546. } else if (tempResult == '{infoWindowNo}') {
  547. htmlWindowUrl = htmlWindowUrl.replace(
  548. '{infoWindowNo}',
  549. _self.infoWindowDto.no,
  550. );
  551. } else {
  552. if (tempSelectedModelDatas.length == 0) {
  553. Notify.error('错误', '未选择可操作的数据', true);
  554. return;
  555. } else if (tempSelectedModelDatas.length > 1) {
  556. Notify.error('错误', '请选择一条数据', true);
  557. return;
  558. }
  559. var tempResult1 = tempResult
  560. .replace('{', '')
  561. .replace('}', '');
  562. htmlWindowUrl = htmlWindowUrl.replace(
  563. tempResult,
  564. _self.getFirstSelectModelDataFieldValue(tempResult1),
  565. );
  566. }
  567. }
  568. var openWindow = window.open(htmlWindowUrl);
  569. // 自动关闭
  570. if (autoCloseInterval != undefined) {
  571. setTimeout(function () {
  572. openWindow.close();
  573. openWindow = undefined;
  574. }, autoCloseInterval * 1000);
  575. }
  576. }
  577. }
  578. },
  579. errorData => {
  580. Common.processException(errorData);
  581. },
  582. );
  583. } else if (
  584. infoButton.customerWindowNo != null &&
  585. infoButton.customerWindowNo.length > 0
  586. ) {
  587. CustomerWindowResource.uniqueByNo(infoButton.customerWindowNo).then(
  588. customerWindowDto => {
  589. var customerWindowRouteUrl = customerWindowDto.routeUrl;
  590. if (
  591. customerWindowRouteUrl != undefined &&
  592. customerWindowRouteUrl != ''
  593. ) {
  594. if (customerWindowRouteUrl == 'exportInfoData') {
  595. var downloadUrl =
  596. Common.getApiURL('exportResource/exportInfoDataComplex') +
  597. '?infoWindowNo=' +
  598. _self.infoWindowDto.no +
  599. '&recordIds=' +
  600. _self.getSelectedRecordIds().join(',') +
  601. '&token=' +
  602. Common.getToken();
  603. window.open(downloadUrl);
  604. } else {
  605. if (tempSelectedModelDatas.length > 0) {
  606. let userStorageDtos = [
  607. {
  608. key: _self.uuid,
  609. value: JSON.stringify(tempSelectedModelDatas),
  610. },
  611. ];
  612. // 组装查询条件,然后放到后台数据库当中
  613. UserStorageResource.uploadUserStorage(userStorageDtos).then(
  614. successData => {
  615. _self.$router.push({
  616. path: customerWindowRouteUrl,
  617. query: {
  618. uuid: _self.uuid,
  619. },
  620. });
  621. },
  622. errorData => {
  623. Common.processException(errorData);
  624. },
  625. );
  626. } else {
  627. _self.$router.push({
  628. path: customerWindowRouteUrl,
  629. query: {
  630. uuid: _self.uuid,
  631. },
  632. });
  633. }
  634. }
  635. }
  636. },
  637. errorData => {
  638. Common.processException(errorData);
  639. },
  640. );
  641. } else if (
  642. infoButton.processReportNo != null &&
  643. infoButton.processReportNo.length > 0
  644. ) {
  645. var processReportNo = infoButton.processReportNo;
  646. if (processReportNo != undefined && processReportNo != '') {
  647. var ids = _self.getSelectedRecordIds();
  648. if (ids.length < 1) {
  649. Notify.error('错误', '未选择可操作的数据', true);
  650. return;
  651. }
  652. _self.loading = true;
  653. ProcessReportResource.uniqueByNo(infoButton.processReportNo).then(
  654. successData => {
  655. _self.processReportDto = successData;
  656. if (successData) {
  657. _self.pdfOnly = successData.pdfOnly;
  658. _self.excelOnly = successData.excelOnly;
  659. }
  660. ProcessReportResource.runProcessByIds(
  661. infoButton.processReportNo,
  662. ids,
  663. ).then(
  664. successData => {
  665. _self.modal = true;
  666. _self.loading = false;
  667. _self.processReportResult = successData;
  668. _self.$emit('processExecuteFinish');
  669. },
  670. errorData => {
  671. _self.loading = false;
  672. Common.processException(errorData);
  673. },
  674. );
  675. },
  676. errorData => {
  677. _self.loading = false;
  678. Common.processException(errorData);
  679. },
  680. );
  681. }
  682. } else if (
  683. infoButton.curdWindowNo != null &&
  684. infoButton.curdWindowNo.length > 0
  685. ) {
  686. _self.$router.push(
  687. '/desktop/window/' + infoButton.curdWindowNo + '?uuid=' + _self.uuid,
  688. );
  689. }
  690. },
  691. /**
  692. * 执行导出
  693. * @return {void}
  694. */
  695. executeExport: function (isSimple) {
  696. var _self = this;
  697. if (this.searchConditionInstance.state.isComplex == false) {
  698. let condition = _self.$refs.queryCondition.getQueryCondition();
  699. let downloadUrl =
  700. Common.getApiURL('exportResource/exportInfoDataSimple') +
  701. '?infoWindowNo=' +
  702. _self.infoWindowDto.no +
  703. '&recordIds=' +
  704. _self.getSelectedRecordIds().join(',') +
  705. '&infoFilterFieldValues=' +
  706. _self.uuid +
  707. '&condition=' +
  708. condition;
  709. let timeStr = dayjs().format('_YYYYMMDD_hhmmss');
  710. let fileName =
  711. _self.infoWindowDto == null
  712. ? '导出数据' + timeStr + '.xlsx'
  713. : _self.infoWindowDto.name + timeStr + '.xlsx';
  714. DownloadService.downloadFile(downloadUrl, fileName);
  715. } else {
  716. let infoFilterFieldValues =
  717. _self.$refs.queryCondition.getQueryCondition();
  718. let infoFilterFieldValueStrs = JSON.stringify(infoFilterFieldValues);
  719. let downloadUrl =
  720. Common.getApiURL('exportResource/exportInfoDataComplex') +
  721. '?infoWindowNo=' +
  722. _self.infoWindowDto.no +
  723. '&recordIds=' +
  724. _self.getSelectedRecordIds().join(',') +
  725. '&infoFilterFieldValues=' +
  726. _self.uuid;
  727. let timeStr = dayjs().format('_YYYYMMDD_hhmmss');
  728. let fileName =
  729. _self.infoWindowDto == null
  730. ? '导出数据' + timeStr + '.xlsx'
  731. : _self.infoWindowDto.name + timeStr + '.xlsx';
  732. let userStorageDtos = [
  733. {
  734. key: _self.uuid,
  735. value: infoFilterFieldValueStrs,
  736. },
  737. ];
  738. // 组装查询条件,然后放到后台数据库当中
  739. UserStorageResource.uploadUserStorage(userStorageDtos).then(
  740. successData => {
  741. DownloadService.downloadFile(downloadUrl, fileName);
  742. },
  743. errorData => {
  744. Common.processException(errorData);
  745. },
  746. );
  747. }
  748. },
  749. /**
  750. * 获取选择数据的Id集合
  751. */
  752. getSelectedRecordIds: function () {
  753. return this.infoWindowDataInstance.getSelectedRecordIds();
  754. },
  755. /**
  756. * 获取选中的第一个数据的Id
  757. */
  758. getFirstSelectRecordId: function () {
  759. var _self = this;
  760. let recordIds = _self.getSelectedRecordIds();
  761. if (recordIds.length > 0) {
  762. return recordIds[0];
  763. }
  764. return undefined;
  765. },
  766. /**
  767. * 获取选中的第一个数据的FieldValue
  768. */
  769. getFirstSelectModelDataFieldValue: function (name) {
  770. const firstData = this.infoWindowDataInstance.getFirstSelected();
  771. if (firstData == null) {
  772. return null;
  773. } else {
  774. if (firstData.data[name] != null) {
  775. return firstData.data[name].displayValue[0];
  776. }
  777. }
  778. return null;
  779. },
  780. },
  781. };
  782. </script>
  783. <style scoped>
  784. .sort-button {
  785. float: left;
  786. }
  787. .btn-process {
  788. float: right;
  789. margin-left: 15px;
  790. }
  791. .mulitiple-select {
  792. background-color: #6699cc !important;
  793. }
  794. .flex-container {
  795. display: flex;
  796. /* 垂直*/
  797. flex-direction: column;
  798. width: 100%;
  799. /*视口被均分为100单位的vh 占据整个窗口*/
  800. height: calc(100vh - 75px);
  801. }
  802. .flex-container-modal {
  803. display: flex;
  804. /* 垂直*/
  805. flex-direction: column;
  806. width: 100%;
  807. /*视口被均分为100单位的vh 占据整个窗口*/
  808. height: calc(100vh - 215px);
  809. }
  810. .flex-header {
  811. /*放大缩小比例为0 占据垂直方向80px*/
  812. height: 400px;
  813. flex: 0 0 100px;
  814. }
  815. .flex-footer {
  816. height: 40px;
  817. flex: 0 0 40px;
  818. }
  819. .flex-content {
  820. display: flex;
  821. flex: 1;
  822. height: 0;
  823. }
  824. </style>
  825. <style scoped>
  826. /** 修复分页的样式 By YangZhiJie 2021-07-06 11:23 */
  827. nav>>>ul.pagination {
  828. margin: 0 !important;
  829. }
  830. </style>
  831. <style scoped>
  832. .warning {
  833. background-color: #fcf8e3 !important;
  834. }
  835. .text-center {
  836. text-align: center !important;
  837. }
  838. .m-segmented{
  839. float: right;
  840. }
  841. .m-segmented >>> .ant-segmented-item{
  842. margin-bottom: 0px;
  843. }
  844. </style>