QueryPage.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051
  1. <template>
  2. <div
  3. class="flex-container"
  4. :class="{'flex-container-modal': isSearchWidget == true, 'flex-container' : (isSearchWidget == null || isSearchWidget == false)}"
  5. >
  6. <div class="flex-header">
  7. <div
  8. class="panel panel-default"
  9. style="margin-bottom: 5px;"
  10. >
  11. <div
  12. class="panel-heading"
  13. style="padding: 0px;"
  14. >
  15. <InfoHeader
  16. :html-help-url="infoWindowDto.htmlHelpUrl"
  17. :info-grid-fields="infoGridFields"
  18. :header-name="infoWindowDto.name"
  19. :info-filter-fields="infoFilterFields"
  20. :info-window-no="infoWindowDto.no"
  21. @filter-field-property-changed="filterFieldPropertyChanged($event)"
  22. @grid-field-property-changed="gridFieldPropertyChanged($event)"
  23. />
  24. </div>
  25. <div
  26. class="panel-body"
  27. style="padding-bottom: 5px; padding-top: 8px;"
  28. >
  29. <QueryCondition
  30. ref="queryCondition"
  31. :info-filter-fields="infoFilterFields"
  32. :info-buttons="infoWindowDto.infoButtons"
  33. :is-search-widget="isSearchWidget"
  34. :show-button="true"
  35. :info-window-no="infoWindowDto.no"
  36. @simple-search="simpleSearch"
  37. @complex-search="complexSearch"
  38. @refresh-search="pageSearch"
  39. @execute-process="executeProcess($event)"
  40. @execute-export="executeExport"
  41. />
  42. </div>
  43. </div>
  44. </div>
  45. <div class="flex-content">
  46. <div
  47. :id="tableOutDivId"
  48. class="flex-main table-fix-head"
  49. >
  50. <table
  51. class="fixed-table table-striped table-bordered"
  52. :width="tableWidth"
  53. height="40px"
  54. >
  55. <thead>
  56. <tr height="40px">
  57. <th width="50px">{{ $t('lang.QueryPage.serialNumber') }}</th>
  58. <th
  59. width="30px"
  60. class="text-center"
  61. :class="{'mulitiple-select': multipleSelect}"
  62. @click.self="changeSelectMode"
  63. >
  64. <input
  65. v-model="isSelectAll"
  66. autocomplete="off"
  67. type="checkbox"
  68. />
  69. </th>
  70. <th
  71. v-for="(infoGridField) in infoGridFields"
  72. v-show="infoGridField.isShow"
  73. :key="infoGridField.fieldName"
  74. :width="infoGridField.width + 'px'"
  75. @dragover="ondragover($event, infoGridField)"
  76. @click="onSort(infoGridField)"
  77. >
  78. <div
  79. :id="'infoGridFieldId_' + infoGridField.fieldName"
  80. class="rz-handle"
  81. draggable="true"
  82. @dragstart="ondragstart($event, infoGridField)"
  83. @drag="ondrag($event, infoGridField)"
  84. @dragend="ondragend($event, infoGridField)"
  85. />
  86. <div
  87. v-tooltip.right="Language.getHelpTrl($i18n.locale, infoGridField)"
  88. class="td-max"
  89. >
  90. {{ Language.getNameTrl($i18n.locale, infoGridField) }}
  91. </div>
  92. </th>
  93. </tr>
  94. </thead>
  95. <tbody>
  96. <tr
  97. v-for="(item1,index) in infoWindowData.dataList"
  98. :key="'tr' + item1.id"
  99. height="40px"
  100. :class="{'warning':item1.select}"
  101. @dblclick="selectNode(item1)"
  102. >
  103. <td style="text-align: center;">{{ index+1+(pagination.current_page-1)*pagination.per_page }}</td>
  104. <td class="text-center">
  105. <input
  106. autocomplete="off"
  107. type="checkbox"
  108. :checked="item1.select"
  109. @click.self="selectNodeForSearch(item1)"
  110. />
  111. </td>
  112. <td
  113. v-for="item2 in infoGridFields"
  114. v-show="item2.isShow"
  115. id="item.id"
  116. :key="'td-' + item2.id"
  117. >
  118. <span v-if="item2.simpleDisplayType == 'Image'">
  119. <QueryPageImage
  120. v-if="item1.data[item2.fieldName] != undefined"
  121. :class-name="item2.selectClause"
  122. :image-names="item1.data[item2.fieldName].displayValue[0]"
  123. />
  124. </span>
  125. <span v-else>
  126. {{ item1.data[item2.fieldName] != undefined ? item1.data[item2.fieldName].displayValue[0] : "" }}
  127. </span>
  128. </td>
  129. </tr>
  130. </tbody>
  131. </table>
  132. </div>
  133. </div>
  134. <div
  135. class="flex-footer"
  136. style="margin-top: 10px;"
  137. >
  138. <div class="pull-left">
  139. <span>{{ $t('lang.QueryPage.the') }}
  140. {{ (pagination.current_page-1)*pagination.per_page+1 }}
  141. -
  142. {{ pagination.current_page*pagination.per_page }}
  143. {{ $t('lang.QueryPage.strip') }}
  144. ,
  145. {{ $t('lang.QueryPage.total') }}
  146. {{ pagination.total }}
  147. {{ $t('lang.QueryPage.strip') }}
  148. ,
  149. {{ $t('lang.QueryPage.displayOnEachPage') }}
  150. </span>
  151. <PageSizeSelect @page-size-changed="gridSizeSelect" />
  152. <span>{{ $t('lang.QueryPage.strip') }}</span>
  153. </div>
  154. <div class="pull-right">
  155. <Pagination
  156. :pagination="pagination"
  157. :callback="pageSearch"
  158. />
  159. </div>
  160. </div>
  161. <Loading v-if="loading" />
  162. <Modal v-model:show="modal">
  163. <template #default>
  164. <ProcessReportResult
  165. :process-report-result="processReportResult"
  166. :pdf-only="pdfOnly"
  167. :excel-only="excelOnly"
  168. />
  169. </template>
  170. <template #header>
  171. <div>{{ $t('lang.QueryPage.resultsOfEnforcement') }}</div>
  172. </template>
  173. </Modal>
  174. </div>
  175. </template>
  176. <script>
  177. import Common from '../../common/Common.js';
  178. import Modal from '../../modal/src/Modal.vue';
  179. import PageSizeSelect from '../../page-size-select/src/PageSizeSelect.vue';
  180. import Pagination from '../../vue-bootstrap-pagination/src/vue-bootstrap-pagination.vue';
  181. import QueryCondition from './QueryCondition.vue';
  182. import InfoHeader from './InfoHeader.vue';
  183. import InfoUtil from './InfoUtil.js';
  184. import Notify from '../../common/Notify.js';
  185. import Loading from '../../loading/src/Loading.vue';
  186. import ProcessReportResult from '../../process/src/ProcessReportResult.vue';
  187. import Uuid from '../../common/Uuid.js';
  188. import QueryPageImage from './QueryPageImage.vue';
  189. import DownloadService from '../../common/DownloadService.js';
  190. import HtmlWindowResource from '../../html-window/src/api/HtmlWindowResource.js';
  191. import CustomerWindowResource from '../../customer-window/src/api/CustomerWindowResource.js';
  192. import ProcessReportResource from '../../process/src/api/ProcessReportResource.js';
  193. import UserStorageResource from '../../common/UserStorageResource.js';
  194. import Language from '../../common/Language.js';
  195. import moment from 'moment';
  196. export default {
  197. name: 'QueryPage',
  198. components: {
  199. Pagination,
  200. QueryCondition,
  201. Modal,
  202. InfoHeader,
  203. Loading,
  204. ProcessReportResult,
  205. PageSizeSelect,
  206. QueryPageImage,
  207. },
  208. props: {
  209. 'whereClauseSource':{
  210. type: Object,
  211. default(){
  212. return null;
  213. },
  214. },
  215. 'isSearchWidget':{
  216. type: Boolean,
  217. default: false,
  218. },
  219. 'parentModelData': {
  220. type: Object,
  221. default(){
  222. return null;
  223. },
  224. },
  225. 'modelData': {
  226. type: Object,
  227. default(){
  228. return null;
  229. },
  230. },
  231. 'fieldValue': {
  232. type: Object,
  233. default(){
  234. return null;
  235. },
  236. },
  237. /**
  238. * 是否多选
  239. */
  240. 'multiple': {
  241. type: Boolean,
  242. default: false,
  243. },
  244. },
  245. emits: ['dataSelected'],
  246. data: function () {
  247. this.Language = Language;
  248. return {
  249. infoWindowDto: {},
  250. queryResult: {},
  251. infoWindowData: {},
  252. pagination: {
  253. total: 0,
  254. per_page: Common.pageSize, // required
  255. current_page: 1, // required
  256. last_page: 10, // required
  257. },
  258. isSelectAll: false,
  259. infoQueryParam: [],
  260. processReportResult: [],
  261. multipleSelect: false,
  262. uuid: Uuid.createUUID(),
  263. sortStr: '',// 排序
  264. sortStyle: ' ASC',
  265. currentIsSimpleSearch: true,
  266. startX: '',
  267. startWidth: '',
  268. processReportDto: '',
  269. pdfOnly: '',
  270. excelOnly: '',
  271. infoGridFields: [],
  272. infoFilterFields: [],
  273. // 表格外面的DIV的id
  274. tableOutDivId: Uuid.createUUID(),
  275. loading: false,
  276. modal: false,
  277. };
  278. },
  279. computed: {
  280. tableWidth: function () {
  281. var totalWidth = 50;
  282. if (this.infoWindowDto != undefined && this.infoGridFields != undefined) {
  283. this.infoGridFields.forEach(function (item) {
  284. if (item.isShow) {
  285. totalWidth += Number(item.width);
  286. }
  287. });
  288. }
  289. return totalWidth + 'px';
  290. },
  291. },
  292. watch: {
  293. /**
  294. * 是否选择了全部的数据
  295. */
  296. isSelectAll: function (val) {
  297. var _self = this;
  298. if (_self.multipleSelect) {
  299. if (_self.isSelectAll) {
  300. if (val) {
  301. _self.infoWindowData.dataList.forEach(function (item) {
  302. item.select = true;
  303. });
  304. }
  305. } else {
  306. _self.infoWindowData.dataList.forEach(function (item) {
  307. item.select = false;
  308. });
  309. }
  310. } else {
  311. _self.isSelectAll = false;
  312. }
  313. },
  314. // /**
  315. // * 路由发生改变
  316. // */
  317. // $route: function (to, from) {
  318. // var _self = this;
  319. // _self.infoWindowData = {};
  320. // },
  321. multiple: {
  322. handler: function(newValue, oldValue){
  323. this.multipleSelect = newValue;
  324. },
  325. immediate: true,
  326. },
  327. },
  328. methods: {
  329. // 页码数量改变
  330. gridSizeSelect: function (newPageSize) {
  331. this.pagination.per_page = newPageSize;
  332. this.pagination.current_page = 1;
  333. },
  334. ondragstart: function (event, gridFieldItem) {
  335. var _self = this;
  336. _self.startX = event.pageX;
  337. _self.startWidth = Number(gridFieldItem.width);
  338. event.dataTransfer.setDragImage(event.target, 0, 20);
  339. event.dataTransfer.effectAllowed = 'move';
  340. },
  341. ondrag: function (event, gridFieldItem) {
  342. var _self = this;
  343. gridFieldItem.width = _self.startWidth + (event.pageX - _self.startX);
  344. },
  345. ondragend: function (event, gridFieldItem, index) {
  346. var _self = this;
  347. let newWidth = _self.startWidth + (event.pageX - _self.startX);
  348. if (newWidth < 50) {
  349. newWidth = 50;
  350. }
  351. gridFieldItem.width = newWidth;
  352. InfoUtil.saveInfoGridFields(_self.infoWindowDto.no, _self.infoGridFields);
  353. },
  354. ondragover: function (event, gridFieldItem) {
  355. event.preventDefault();
  356. event.dataTransfer.dropEffect = 'move';
  357. },
  358. // 初始化数据
  359. initWidget: function (data) {
  360. var _self = this;
  361. if (data == undefined) {
  362. return;
  363. }
  364. _self.infoWindowDto = data;
  365. _self.infoFilterFields = data.infoFilterFields;
  366. _self.infoGridFields = data.infoGridFields;
  367. // var sortNo = 10;
  368. _self.infoGridFields.forEach(function (item) {
  369. item.width = 150;
  370. });
  371. _self.infoFilterFields.forEach(function (item) {
  372. item.value = {
  373. 'infoFilterFieldId': item.id,
  374. 'value1': '',
  375. 'value2': '',
  376. };
  377. });
  378. InfoUtil.restoreInfoFilterFields(_self.infoWindowDto.no, _self.infoFilterFields);
  379. InfoUtil.restoreInfoGridFields(_self.infoWindowDto.no, _self.infoGridFields);
  380. _self.simpleSearch();
  381. },
  382. complexSearch: function () {
  383. var _self = this;
  384. _self.pagination.current_page = 1;
  385. var infoQueryParam = {
  386. infoWindowNo: _self.infoWindowDto.no,
  387. start: (_self.pagination.current_page - 1) * _self.pagination.per_page,
  388. length: _self.pagination.per_page,
  389. sortClause: '',
  390. infoFilterFieldValues: _self.$refs.queryCondition.getQueryCondition(),
  391. whereClauseSource: _self.whereClauseSource,
  392. parentModelData: _self.parentModelData,
  393. modelData: _self.modelData,
  394. isSearchWidget: _self.isSearchWidget,
  395. };
  396. _self.infoQueryParam = infoQueryParam;
  397. _self.currentIsSimpleSearch = false;
  398. _self.queryInfoWindowDataComplex();
  399. },
  400. pageSearch: function () {
  401. var _self = this;
  402. _self.infoQueryParam.start = (_self.pagination.current_page - 1) * _self.pagination.per_page;
  403. _self.infoQueryParam.length = _self.pagination.per_page;
  404. var isSimpleQuery = _self.$refs.queryCondition.isSimpleQuery();
  405. if (isSimpleQuery) {
  406. _self.queryInfoWindowDataSimple();
  407. } else {
  408. _self.queryInfoWindowDataComplex();
  409. }
  410. },
  411. /**
  412. * 简单查询
  413. * @return {void}
  414. */
  415. simpleSearch: function () {
  416. var _self = this;
  417. _self.pagination.current_page = 1;
  418. var infoQueryParam = {
  419. infoWindowNo: _self.infoWindowDto.no,
  420. start: (_self.pagination.current_page - 1) * _self.pagination.per_page,
  421. length: _self.pagination.per_page,
  422. sortClause: '',
  423. infoFilterFieldValues: _self.$refs.queryCondition.getQueryCondition(),
  424. whereClauseSource: _self.whereClauseSource,
  425. parentModelData: _self.parentModelData,
  426. modelData: _self.modelData,
  427. isSearchWidget: _self.isSearchWidget,
  428. };
  429. _self.infoQueryParam = infoQueryParam;
  430. _self.currentIsSimpleSearch = true;
  431. _self.queryInfoWindowDataSimple();
  432. },
  433. queryInfoWindowDataComplex: function () {
  434. var _self = this;
  435. _self.loading=true;
  436. $.ajax({
  437. url: Common.getApiURL('InfoWindowResource/queryInfoWindowDataComplex'),
  438. type: 'post',
  439. dataType: 'json',
  440. beforeSend: function (request) {
  441. Common.addTokenToRequest(request);
  442. },
  443. contentType: 'application/json',
  444. data: JSON.stringify(_self.infoQueryParam),
  445. success: function (data) {
  446. _self.loading=false;
  447. _self.setSelectedFlag(data);
  448. _self.infoWindowData = data;
  449. _self.pagination.total = data.totalSize;
  450. _self.pagination.last_page = Math.ceil(data.totalSize / data.range.length);
  451. _self.fixedTableHeader();
  452. },
  453. error: function (XMLHttpRequest, textStatus, errorThrown) {
  454. _self.loading=false;
  455. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  456. },
  457. });
  458. },
  459. /**
  460. * 设置数据是否被已经被选中。
  461. */
  462. setSelectedFlag: function(data){
  463. let _self = this;
  464. let selectedIds = null;
  465. let selectedId =null;
  466. if(_self.fieldValue != null){
  467. selectedIds = _self.fieldValue.ids;
  468. selectedId = _self.fieldValue.id;
  469. }
  470. data.dataList.forEach(function (item) {
  471. if(selectedIds != null && selectedIds.indexOf(item.id) >= 0){
  472. item.select = true;
  473. }else if(selectedId != null && selectedId == item.id){
  474. item.select = true;
  475. }else{
  476. item.select = false;
  477. }
  478. });
  479. },
  480. queryInfoWindowDataSimple: function () {
  481. var _self = this;
  482. if (_self.$refs.loading) {
  483. _self.loading=true;
  484. }
  485. _self.infoQueryParam.whereClauseSource = _self.whereClauseSource;
  486. $.ajax({
  487. url: Common.getApiURL('InfoWindowResource/queryInfoWindowDataSimple'),
  488. type: 'post',
  489. dataType: 'json',
  490. beforeSend: function (request) {
  491. Common.addTokenToRequest(request);
  492. },
  493. contentType: 'application/json',
  494. data: JSON.stringify(_self.infoQueryParam),
  495. success: function (data) {
  496. if (_self.$refs.loading) {
  497. _self.loading=false;
  498. }
  499. _self.setSelectedFlag(data);
  500. _self.infoWindowData = data;
  501. _self.pagination.total = data.totalSize;
  502. _self.pagination.last_page = Math.ceil(data.totalSize / data.range.length);
  503. _self.fixedTableHeader();
  504. },
  505. error: function (XMLHttpRequest, textStatus, errorThrown) {
  506. if (_self.$refs.loading) {
  507. _self.loading=false;
  508. }
  509. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  510. },
  511. });
  512. },
  513. /**
  514. * 双击表格行事件
  515. */
  516. selectNode: function (modelData) {
  517. this.$emit('dataSelected', modelData);
  518. },
  519. /**
  520. * 选择/取消选择表格行中的复选框事件
  521. */
  522. selectNodeForSearch: function (modelData) {
  523. var _self = this;
  524. var currentStatus = modelData.select;
  525. if (!_self.multipleSelect) {
  526. _self.infoWindowData.dataList.forEach(function (item) {
  527. item.select = false;
  528. });
  529. }
  530. modelData.select = !currentStatus;
  531. if (modelData.select === true) {
  532. _self.$emit('dataSelected', modelData);
  533. } else {
  534. _self.$emit('deleteSelected', modelData);
  535. }
  536. },
  537. /**
  538. * 获取选择的数据
  539. */
  540. getSelectedModelDatas: function (data) {
  541. var _self = this;
  542. var tempSelectedModelDatas = [];
  543. if(_self.infoWindowData != null && _self.infoWindowData.dataList != null){
  544. _self.infoWindowData.dataList.forEach(function (item) {
  545. if(item.select == true){
  546. tempSelectedModelDatas.push(item);
  547. }
  548. });
  549. }
  550. return tempSelectedModelDatas;
  551. },
  552. /**
  553. * 条件字段属性发生改变
  554. */
  555. filterFieldPropertyChanged: function (infoFilterFieldsClone) {
  556. let _self = this;
  557. InfoUtil.saveInfoFilterFields(_self.infoWindowDto.no, infoFilterFieldsClone).then(successData => {
  558. InfoUtil.restoreInfoFilterFields(_self.infoWindowDto.no, _self.infoFilterFields);
  559. }, errorData => {
  560. console.log(errorData);
  561. });
  562. },
  563. /**
  564. * 表格字段属性发生改变
  565. */
  566. gridFieldPropertyChanged: function (infoGridFieldsClone) {
  567. let _self = this;
  568. InfoUtil.saveInfoGridFields(_self.infoWindowDto.no, infoGridFieldsClone).then(successData => {
  569. InfoUtil.restoreInfoGridFields(_self.infoWindowDto.no, _self.infoGridFields);
  570. }, errorData => {
  571. console.log(errorData);
  572. });
  573. },
  574. /**
  575. * 执行流程
  576. * @param {Object} infoButton
  577. * @return {void}
  578. */
  579. executeProcess: function (infoButton) {
  580. var _self = this;
  581. if (infoButton == null) {
  582. return;
  583. }
  584. let tempSelectedModelDatas = _self.getSelectedModelDatas();
  585. if (infoButton.htmlWindowNo != null && infoButton.htmlWindowNo.length > 0) {
  586. HtmlWindowResource.uniqueByNo(infoButton.htmlWindowNo).then(htmlWindowDto => {
  587. if (htmlWindowDto != undefined) {
  588. var htmlWindowUrl = htmlWindowDto.htmlFileName;
  589. var autoCloseInterval = htmlWindowDto.autoCloseInterval;
  590. var regExp = new RegExp('[{].*?[}]', 'g');
  591. var result = htmlWindowUrl.match(regExp);
  592. if (htmlWindowUrl != undefined && htmlWindowUrl != '') {
  593. for (var index = 0, len = result.length; index < len; index++) {
  594. var tempResult = result[index];
  595. console.log('{' + tempResult + '}匹配');
  596. if (tempResult == '{URL}') {
  597. htmlWindowUrl = htmlWindowUrl.replace('{URL}', Common.getRedirectUrl(''));
  598. console.log('{' + htmlWindowUrl + '}地址');
  599. } else if (tempResult == '{RecordId}') {
  600. if (tempSelectedModelDatas.length == 0) {
  601. Notify.error('错误', '未选择可操作的数据', true);
  602. return;
  603. }
  604. htmlWindowUrl = htmlWindowUrl.replace('{RecordId}', _self.getFirstSelectRecordId());
  605. } else if (tempResult == '{RecordIds}') {
  606. if (tempSelectedModelDatas.length == 0) {
  607. Notify.error('错误', '未选择可操作的数据', true);
  608. return;
  609. }
  610. htmlWindowUrl = htmlWindowUrl.replace('{RecordIds}', _self.getSelectedRecordIds());
  611. } else if (tempResult == '{Token}') {
  612. htmlWindowUrl = htmlWindowUrl.replace('{Token}', Common.getToken());
  613. } else if (tempResult == '{infoWindowNo}') {
  614. htmlWindowUrl = htmlWindowUrl.replace('{infoWindowNo}', _self.infoWindowDto.no);
  615. } else {
  616. if (tempSelectedModelDatas.length == 0) {
  617. Notify.error('错误', '未选择可操作的数据', true);
  618. return;
  619. } else if (tempSelectedModelDatas.length > 1) {
  620. Notify.error('错误', '请选择一条数据', true);
  621. return;
  622. }
  623. var tempResult1 = tempResult.replace('{', '').replace('}', '');
  624. htmlWindowUrl = htmlWindowUrl.replace(tempResult, _self.getFirstSelectModelDataFieldValue(tempResult1));
  625. }
  626. }
  627. var openWindow = window.open(htmlWindowUrl);
  628. // 自动关闭
  629. if (autoCloseInterval != undefined) {
  630. setTimeout(function () {
  631. openWindow.close();
  632. openWindow = undefined;
  633. }, autoCloseInterval * 1000);
  634. }
  635. }
  636. }
  637. }, errorData => {
  638. Common.processException(errorData);
  639. });
  640. } else if (infoButton.customerWindowNo != null && infoButton.customerWindowNo.length > 0) {
  641. CustomerWindowResource.uniqueByNo(infoButton.customerWindowNo).then(customerWindowDto => {
  642. var customerWindowRouteUrl = customerWindowDto.routeUrl;
  643. if (customerWindowRouteUrl != undefined && customerWindowRouteUrl != '') {
  644. if (customerWindowRouteUrl == 'exportInfoData') {
  645. var downloadUrl = Common.getApiURL('exportResource/exportInfoDataComplex') + '?infoWindowNo=' + _self.infoWindowDto.no
  646. + '&recordIds=' + _self.getSelectedRecordIds().join(',')
  647. + '&token=' + Common.getToken();
  648. window.open(downloadUrl);
  649. } else {
  650. if (tempSelectedModelDatas.length > 0) {
  651. let userStorageDtos = [
  652. {
  653. key: _self.uuid,
  654. value: JSON.stringify(tempSelectedModelDatas),
  655. },
  656. ];
  657. // 组装查询条件,然后放到后台数据库当中
  658. UserStorageResource.uploadUserStorage(userStorageDtos).then(successData => {
  659. _self.$router.push({
  660. path: customerWindowRouteUrl,
  661. query: {
  662. 'uuid': _self.uuid,
  663. },
  664. });
  665. }, errorData => {
  666. Common.processException(errorData);
  667. });
  668. }else{
  669. _self.$router.push({
  670. path: customerWindowRouteUrl,
  671. query: {
  672. 'uuid': _self.uuid,
  673. },
  674. });
  675. }
  676. }
  677. }
  678. }, errorData => {
  679. Common.processException(errorData);
  680. });
  681. } else if (infoButton.processReportNo != null && infoButton.processReportNo.length > 0) {
  682. var processReportNo = infoButton.processReportNo;
  683. if (processReportNo != undefined && processReportNo != '') {
  684. var ids = _self.getSelectedRecordIds();
  685. if (ids.length < 1) {
  686. Notify.error('错误', '未选择可操作的数据', true);
  687. return;
  688. }
  689. _self.loading=true;
  690. ProcessReportResource.uniqueByNo(infoButton.processReportNo).then(successData => {
  691. _self.processReportDto = successData;
  692. if (successData) {
  693. _self.pdfOnly = successData.pdfOnly;
  694. _self.excelOnly = successData.excelOnly;
  695. }
  696. ProcessReportResource.runProcessByIds(infoButton.processReportNo, ids).then(successData => {
  697. _self.modal = true;
  698. _self.loading=false;
  699. _self.processReportResult = successData;
  700. _self.$emit('processExecuteFinish');
  701. }, errorData => {
  702. _self.loading=false;
  703. Common.processException(errorData);
  704. });
  705. }, errorData => {
  706. _self.loading=false;
  707. Common.processException(errorData);
  708. });
  709. }
  710. }else if (infoButton.curdWindowNo != null && infoButton.curdWindowNo.length > 0){
  711. _self.$router.push(
  712. '/desktop/window/' + infoButton.curdWindowNo + '?uuid=' + _self.uuid,
  713. );
  714. }
  715. },
  716. /**
  717. * 执行导出
  718. * @return {void}
  719. */
  720. executeExport: function () {
  721. var _self = this;
  722. var isSimpleQuery = _self.$refs.queryCondition.isSimpleQuery();
  723. if(isSimpleQuery){
  724. let condition = _self.$refs.queryCondition.getQueryCondition();
  725. let downloadUrl = Common.getApiURL('exportResource/exportInfoDataSimple') + '?infoWindowNo=' + _self.infoWindowDto.no
  726. + '&recordIds=' + _self.getSelectedRecordIds().join(',')
  727. + '&infoFilterFieldValues=' + _self.uuid
  728. + '&condition=' + condition;
  729. let timeStr = moment().format('_YYYYMMDD_hhmmss');
  730. let fileName = (_self.infoWindowDto == null ? '导出数据' + timeStr + '.xls' : _self.infoWindowDto.name + timeStr + '.xls');
  731. DownloadService.downloadFile(downloadUrl, fileName);
  732. }else{
  733. let infoFilterFieldValues = _self.$refs.queryCondition.getQueryCondition();
  734. let infoFilterFieldValueStrs = JSON.stringify(infoFilterFieldValues);
  735. let downloadUrl = Common.getApiURL('exportResource/exportInfoDataComplex') + '?infoWindowNo=' + _self.infoWindowDto.no
  736. + '&recordIds=' + _self.getSelectedRecordIds().join(',')
  737. + '&infoFilterFieldValues=' + _self.uuid;
  738. let timeStr = moment().format('_YYYYMMDD_hhmmss');
  739. let fileName = (_self.infoWindowDto == null ? '导出数据' + timeStr + '.xls' : _self.infoWindowDto.name + timeStr + '.xls');
  740. let userStorageDtos = [
  741. {
  742. key: _self.uuid,
  743. value: infoFilterFieldValueStrs,
  744. },
  745. ];
  746. // 组装查询条件,然后放到后台数据库当中
  747. UserStorageResource.uploadUserStorage(userStorageDtos).then(successData => {
  748. DownloadService.downloadFile(downloadUrl, fileName);
  749. }, errorData => {
  750. Common.processException(errorData);
  751. });
  752. }
  753. },
  754. /**
  755. * 获取选择数据的Id集合
  756. */
  757. getSelectedRecordIds: function () {
  758. var _self = this;
  759. var recordIds = [];
  760. if(_self.infoWindowData != null && _self.infoWindowData.dataList != null){
  761. _self.infoWindowData.dataList.forEach(function (item) {
  762. if(item.select == true){
  763. recordIds.push(item.id);
  764. }
  765. });
  766. }
  767. return recordIds;
  768. },
  769. /**
  770. * 获取选中的第一个数据的Id
  771. */
  772. getFirstSelectRecordId: function () {
  773. var _self = this;
  774. let recordIds = _self.getSelectedRecordIds();
  775. if (recordIds.length > 0) {
  776. return recordIds[0];
  777. }
  778. return undefined;
  779. },
  780. /**
  781. * 获取选中的第一个数据的FieldValue
  782. */
  783. getFirstSelectModelDataFieldValue: function (name) {
  784. var _self = this;
  785. if(_self.infoWindowData != null && _self.infoWindowData.dataList != null){
  786. for(let i = 0; i < _self.infoWindowData.dataList.length; i ++){
  787. let item = _self.infoWindowData.dataList[i];
  788. if(item.select == true){
  789. return item.data[name].displayValue[0];
  790. }
  791. }
  792. }
  793. return undefined;
  794. },
  795. /**
  796. * 切换全选/单选
  797. */
  798. changeSelectMode: function () {
  799. this.multipleSelect = !this.multipleSelect;
  800. },
  801. /**
  802. * 排序
  803. */
  804. onSort: function (infoGridField) {
  805. var _self = this;
  806. var fieldName = null;
  807. if (infoGridField.sortFieldName != undefined && infoGridField.sortFieldName != '') {
  808. fieldName = infoGridField.sortFieldName;
  809. } else {
  810. fieldName = infoGridField.fieldName;
  811. }
  812. var sortStr = fieldName + _self.sortStyle;
  813. _self.infoQueryParam.sortClause = sortStr;
  814. if (_self.currentIsSimpleSearch) {
  815. _self.queryInfoWindowDataSimple();
  816. } else {
  817. _self.queryInfoWindowDataComplex();
  818. }
  819. _self.sortStyle = _self.sortStyle == ' ASC' ? ' DESC' : ' ASC';
  820. },
  821. /**
  822. * 冻结表头
  823. */
  824. fixedTableHeader: function () {
  825. let _self = this;
  826. _self.$nextTick(function () {
  827. var $th = $('#' + _self.tableOutDivId).find('thead');
  828. $('#' + _self.tableOutDivId).on('scroll', function () {
  829. $th.css('transform', 'translateY(' + this.scrollTop + 'px)');
  830. });
  831. });
  832. },
  833. },
  834. };
  835. </script>
  836. <style scoped>
  837. .sort-button {
  838. float: left;
  839. }
  840. .fixed-table {
  841. table-layout: fixed;
  842. }
  843. table.fixed-table tr th {
  844. text-align: center;
  845. }
  846. table.fixed-table td {
  847. text-align: center;
  848. word-wrap: break-word;
  849. word-break: normal;
  850. }
  851. .btn-process {
  852. float: right;
  853. margin-left: 15px;
  854. }
  855. .mulitiple-select {
  856. background-color: #6699cc !important;
  857. }
  858. table.fixed-table th {
  859. position: relative;
  860. min-width: 25px;
  861. }
  862. table.fixed-table th,
  863. table.fixed-table td {
  864. overflow: hidden;
  865. white-space: nowrap;
  866. text-overflow: ellipsis;
  867. border-right: 1px solid rgba(0, 0, 0, 0.05);
  868. }
  869. table.fixed-table th {
  870. min-width: 10px;
  871. background-color: #f8f8f8;
  872. }
  873. table.fixed-table th .rz-handle {
  874. width: 10px;
  875. height: 100%;
  876. position: absolute;
  877. top: 0;
  878. right: 0;
  879. background: repeating-linear-gradient(
  880. 45deg,
  881. transparent,
  882. transparent 2px,
  883. rgba(0, 0, 0, 0.05) 2px,
  884. rgba(0, 0, 0, 0.05) 4px
  885. );
  886. cursor: ew-resize !important;
  887. }
  888. table.fixed-table th .rz-handle.rz-handle-active {
  889. border-right: 2px solid #000;
  890. transform: scaleX(100);
  891. background: rgba(0, 0, 0, 0.05) 2px;
  892. }
  893. .rz-handle:hover {
  894. background: rgba(0, 0, 0, 0.2) 4px;
  895. }
  896. .flex-container {
  897. display: flex;
  898. /* 垂直*/
  899. flex-direction: column;
  900. width: 100%;
  901. /*视口被均分为100单位的vh 占据整个窗口*/
  902. height: calc(100vh - 75px);
  903. }
  904. .flex-container-modal {
  905. display: flex;
  906. /* 垂直*/
  907. flex-direction: column;
  908. width: 100%;
  909. /*视口被均分为100单位的vh 占据整个窗口*/
  910. height: calc(100vh - 215px);
  911. }
  912. .flex-header {
  913. /*放大缩小比例为0 占据垂直方向80px*/
  914. height: 400px;
  915. flex: 0 0 100px;
  916. }
  917. .flex-footer {
  918. height: 40px;
  919. flex: 0 0 40px;
  920. }
  921. .flex-content {
  922. display: flex;
  923. flex: 1;
  924. height: 0;
  925. }
  926. .flex-main {
  927. overflow: scroll;
  928. flex: 1;
  929. margin-bottom: 0px;
  930. }
  931. </style>
  932. <style scoped>
  933. /** 修复分页的样式 By YangZhiJie 2021-07-06 11:23 */
  934. nav >>> ul.pagination {
  935. margin: 0 !important;
  936. }
  937. </style>
  938. <style scoped>
  939. .warning {
  940. background-color: #fcf8e3 !important;
  941. }
  942. .text-center {
  943. text-align: center !important;
  944. }
  945. </style>