| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007 |
- <template>
- <div>
- <a-space
- v-if="
- showTabDto != undefined &&
- showTabDto.tabGridView &&
- tabButtons != undefined
- "
- >
- <template v-for="item in tabButtons" :key="item.id">
- <a-button
- v-if="
- item.subMenu != true &&
- (viewType == 'Grid' ||
- (viewType == 'EditForm' && item.editMode == true) ||
- (viewType == 'Form' && item.editMode != true)) &&
- item.invisible == false
- "
- @click="execute(item)"
- >
- {{ Language.getNameTrl($i18n.locale, item) }}
- </a-button>
- </template>
- </a-space>
- <a-space>
- <a-button v-if="'EditForm' != viewType" @click="exportConfirm">
- <template #icon>
- <ExportOutlined />
- </template>
- {{ $t("lang.tabButton.export") }}
- </a-button>
- <a-button
- v-if="mWindow && mWindow.dataTemplateIds != undefined"
- @click="importData"
- >
- <template #icon>
- <ImportOutlined />
- </template>
- {{ $t("lang.tabButton.import") }}
- </a-button>
- <a-button
- v-if="'Form' == viewType || 'Grid' == viewType"
- @click="notify"
- >
- <template #icon>
- <MessageOutlined />
- </template>
- {{ $t("lang.tabButton.notice") }}
- </a-button>
- <a-button
- v-if="'EditForm' != viewType && isOpen"
- @click="documentOpen"
- >
- <template #icon>
- <FileDoneOutlined />
- </template>
- {{ $t("lang.tabButton.open") }}
- </a-button>
- <a-button
- v-if="'EditForm' != viewType && isClose"
- @click="documentClose"
- >
- <template #icon>
- <FileExcelOutlined />
- </template>
- {{ $t("lang.tabButton.close") }}
- </a-button>
- <template v-for="item in tabButtons" :key="item.id">
- <a-button
- v-if="
- showTabDto.tabGridView &&
- item.subMenu == true &&
- (viewType == 'Grid' ||
- (viewType == 'EditForm' && item.editMode == true) ||
- (viewType == 'Form' && item.editMode != true)) &&
- item.invisible == false
- "
- @click="execute(item)"
- >
- {{ Language.getNameTrl($i18n.locale, item) }}
- </a-button>
- </template>
- </a-space>
- <a-modal v-model:open="modal" width="100%" :title="$t('lang.tabButton.executeResult')">
- <ProcessReportResultPreview
- v-if="
- processReportResult != null &&
- (processReportResult.reportResults != null ||
- processReportResult.processResult != null)
- "
- :process-report-result="processReportResult"
- :pdf-only="false"
- :excel-only="false"
- />
- </a-modal>
- <a-modal
- v-model:show="notificationModal"
- :title="$t('lang.tabButton.sendNotice')"
- >
- <NotificationPanel ref="notificationPanel" />
- <template #footer>
- <a-button @click="sendNotification">
- {{ $t("lang.tabButton.send") }}
- </a-button>
- <a-button
- @click="cancelNotification"
- >
- {{ $t("lang.tabButton.cancel") }}
- </a-button>
- </template>
- </a-modal>
- <Loading v-if="loading" />
- </div>
- </template>
- <script>
- import Common from '../../common/Common.js';
- import DownloadService from '../../resource/file/DownloadService.js';
- import CustomerWindowResource from '../../api/dic/CustomerWindowResource.js';
- import HtmlWindowResource from '../../api/dic/HtmlWindowResource.js';
- import ProcessReportResource from '../../api/dic/ProcessReportResource.js';
- import UserStorageResource from '../../api/base/UserStorageResource.js';
- import Language from '../../common/Language.js';
- import { Notify, Uuid } from 'pc-component-v3';
- import dayjs from 'dayjs';
- import NotificationPanel from '../../customer/NotificationPanel.vue';
- import { IFrameUtil } from 'pc-component-v3';
- import { ExportOutlined, ImportOutlined, MessageOutlined, FileDoneOutlined, FileExcelOutlined } from '@ant-design/icons-vue';
- export default {
- components: {
- NotificationPanel,
- ExportOutlined,
- ImportOutlined,
- MessageOutlined,
- FileDoneOutlined,
- FileExcelOutlined,
- },
- props: {
- showTabDto: {
- type: Object,
- default: function () {
- return null;
- },
- },
- parentModelData: {
- type: Object,
- default: function () {
- return null;
- },
- },
- modelData: {
- type: Object,
- default: function () {
- return null;
- },
- },
- modelDatas: {
- type: Array,
- default: function () {
- return null;
- },
- },
- uuid: {
- type: String,
- default: null,
- },
- viewType: {
- type: String,
- default: null,
- },
- type: {
- type: String,
- default: null,
- },
- simpleFilterParams: {
- type: String,
- default: null,
- },
- complexFilterParams: {
- type: Array,
- default: () => {
- return [];
- },
- },
- mWindow: {
- type: Object,
- default: function () {
- return null;
- },
- },
- tabButtons: {
- type: Array,
- default: function () {
- return null;
- },
- },
- curdWindowFunctionAccess: {
- type: Object,
- default: function () {
- return null;
- },
- },
- },
- emits: ['saveView', 'processExecuteFinish', 'modelDataChanged'],
- data: function () {
- this.Language = Language;
- return {
- processReportResult: {},
- openWindow: null,
- loading: false,
- modal: false,
- notificationModal: false,
- };
- },
- computed: {
- isShow: function () {
- if (this.showTabDto == undefined) {
- return false;
- } else if (this.tabButtons == undefined) {
- return false;
- } else if (this.tabButtons.length == 0) {
- return false;
- }
- return true;
- },
- /**
- * 判断打开按钮是否显示(单据处于已审批状态且关闭时间不为空)
- * @author LeiGuoXian
- * @date 2021-09-26
- */
- isOpen: function () {
- var _self = this;
- if (_self.parentModelData != undefined) {
- if (
- _self.parentModelData.data != undefined &&
- _self.parentModelData.data.documentStatus != undefined &&
- _self.parentModelData.data.documentStatus.displayValue[0] ==
- 'APPROVED' &&
- _self.parentModelData.data.closeDate != undefined
- ) {
- return true;
- } else {
- return false;
- }
- } else {
- if (
- _self.modelData != undefined &&
- _self.modelData.data != undefined &&
- _self.modelData.data.documentStatus != undefined &&
- _self.modelData.data.documentStatus.displayValue[0] == 'APPROVED' &&
- _self.modelData.data.closeDate != undefined &&
- _self.modelData.data.closeDate.displayValue.length != 0
- ) {
- return true;
- } else {
- return false;
- }
- }
- },
- /**
- * 判断关闭按钮是否显示(单据处于已审批状态且关闭时间为空)
- * @author LeiGuoXian
- * @date 2021-09-26
- */
- isClose: function () {
- var _self = this;
- if (_self.parentModelData != undefined) {
- if (
- _self.parentModelData.data != undefined &&
- _self.parentModelData.data.documentStatus != undefined &&
- _self.parentModelData.data.documentStatus.displayValue[0] ==
- 'APPROVED' &&
- _self.parentModelData.data.closeDate != undefined
- ) {
- return true;
- } else {
- return false;
- }
- } else {
- if (
- _self.modelData != undefined &&
- _self.modelData.data != undefined &&
- _self.modelData.data.documentStatus != undefined &&
- _self.modelData.data.documentStatus.displayValue[0] == 'APPROVED' &&
- _self.modelData.data.closeDate != undefined &&
- _self.modelData.data.closeDate.displayValue.length == 0
- ) {
- return true;
- } else {
- return false;
- }
- }
- },
- },
- watch: {},
- methods: {
- /**
- * CURD单据关闭(关闭后不能被下流单据引用,已经生单的单据不受影响)
- *
- * @author LeiGuoXian
- * @date 2021-09-26
- */
- documentClose: function () {
- var _self = this;
- var windowNo = this.$route.params.windowNo;
- var tabIndex = _self.showTabDto.tabIndex;
- var recordId = null;
- var closeRecordIds = [];
- if (tabIndex == 0) {
- recordId = _self.modelData.id;
- } else if (tabIndex == 1) {
- recordId = _self.parentModelData.id;
- if (_self.modelDatas == undefined || _self.modelDatas.length == 0) {
- Notify.error(
- _self.$t('lang.Notify.error'),
- _self.$t('lang.tabButton.describe1'),
- false,
- );
- return;
- } else {
- _self.modelDatas.forEach(function (item) {
- if (item.select == true) {
- closeRecordIds.push(item.id);
- }
- });
- if (closeRecordIds.length == 0) {
- Notify.error(
- _self.$t('lang.Notify.error'),
- _self.$t('lang.tabButton.describe2'),
- false,
- );
- return;
- }
- }
- }
- var documentCloseRequest = {
- windowNo: windowNo,
- tabIndex: tabIndex,
- documentRecordId: recordId,
- closeRecordIds: closeRecordIds,
- };
- $.ajax({
- url: Common.getApiURL('documentResource/documentClose'),
- type: 'post',
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- contentType: 'application/json',
- data: JSON.stringify(documentCloseRequest),
- success: function (data) {
- if (data.errcode == 0) {
- Notify.success(_self.$t('lang.Notify.success'), data.errmsg, false);
- } else {
- Notify.error(_self.$t('lang.Notify.prompt'), data.errmsg, false);
- }
- _self.$emit('processExecuteFinish');
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- },
- /**
- * CURD单据打开(打开后可以被下流单据引用)
- *
- * @author LeiGuoXian
- * @date 2021-09-26
- */
- documentOpen: function () {
- var _self = this;
- var windowNo = this.$route.params.windowNo;
- var tabIndex = _self.showTabDto.tabIndex;
- var recordId = null;
- var openRecordIds = [];
- if (tabIndex == 0) {
- recordId = _self.modelData.id;
- } else if (tabIndex == 1) {
- recordId = _self.parentModelData.id;
- if (_self.modelDatas == undefined || _self.modelDatas.length == 0) {
- Notify.error(
- _self.$t('lang.Notify.error'),
- _self.$t('lang.tabButton.describe1'),
- false,
- );
- return;
- } else {
- _self.modelDatas.forEach(function (item) {
- if (item.select == true) {
- openRecordIds.push(item.id);
- }
- });
- if (openRecordIds.length == 0) {
- Notify.error(
- _self.$t('lang.Notify.error'),
- _self.$t('lang.tabButton.describe2'),
- false,
- );
- return;
- }
- }
- }
- var documentOpenRequest = {
- windowNo: windowNo,
- tabIndex: tabIndex,
- documentRecordId: recordId,
- openRecordIds: openRecordIds,
- };
- $.ajax({
- url: Common.getApiURL('documentResource/documentOpen'),
- type: 'post',
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- contentType: 'application/json',
- data: JSON.stringify(documentOpenRequest),
- success: function (data) {
- if (data.errcode == 0) {
- Notify.success(_self.$t('lang.Notify.success'), data.errmsg, false);
- } else {
- Notify.error(_self.$t('lang.Notify.prompt'), data.errmsg, false);
- }
- _self.$emit('processExecuteFinish');
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- },
- //跳转或执行流程
- execute: function (tabButton) {
- var _self = this;
- if (
- tabButton.customerWindowNo != undefined &&
- tabButton.customerWindowNo != ''
- ) {
- CustomerWindowResource.uniqueByNo(tabButton.customerWindowNo).then(
- successData => {
- tabButton.customerWindowRouteUrl = successData.routeUrl;
- if (tabButton.customerWindowNo == '20221101_151823') {
- localStorage.setItem(
- 'AssetInstance_ComplexFilterParams',
- JSON.stringify(_self.complexFilterParams),
- );
- localStorage.setItem(
- 'AssetInstance_SimpleFilterParams',
- _self.simpleFilterParams,
- );
- }
- //跳转到tabButton.routeUrl
- if (this.viewType == 'Form' || this.viewType == 'EditForm') {
- this.switchFormRoute(tabButton);
- } else if (this.viewType == 'Grid') {
- this.switchFormRoute(tabButton);
- }
- },
- errorData => {
- Common.processException(errorData);
- },
- );
- } else if (
- tabButton.processReportNo != undefined &&
- tabButton.processReportNo != ''
- ) {
- // 判断流程报表是否有参数
- // 如果有参数则直接跳转到流程和报表的界面。
- if (
- tabButton.routerRedirect == undefined ||
- tabButton.routerRedirect == false
- ) {
- this.executeProcess(tabButton);
- } else {
- this.$router.push({
- path: '/desktop/process-report/' + tabButton.processReportNo,
- });
- }
- } else if (tabButton.htmlWindowNo != undefined) {
- HtmlWindowResource.uniqueByNo(tabButton.htmlWindowNo).then(
- htmlWindowDto => {
- if (htmlWindowDto != undefined) {
- var htmlWindowUrl = htmlWindowDto.htmlFileName;
- var autoCloseInterval = htmlWindowDto.autoCloseInterval;
- var regExp = new RegExp('[{].*?[}]', 'g');
- var result = htmlWindowUrl.match(regExp);
- if (htmlWindowUrl != undefined && htmlWindowUrl != '') {
- for (var index = 0, len = result.length; index < len; index++) {
- var tempResult = result[index];
- console.log('{' + tempResult + '}匹配');
- if (tempResult == '{URL}') {
- htmlWindowUrl = htmlWindowUrl.replace(
- '{URL}',
- Common.getHostPageBaseURL(),
- );
- } else if (tempResult == '{RecordIds}') {
- if (this.viewType == 'Grid') {
- var recordIds = '';
- if (_self.modelDatas && _self.modelDatas.length > 0) {
- _self.modelDatas.forEach(function (item) {
- if (item.select) {
- recordIds += item.id + ',';
- }
- });
- }
- if (recordIds != null && recordIds.length > 0) {
- recordIds = recordIds.substring(
- 0,
- recordIds.length - 1,
- );
- } else {
- Notify.error(
- _self.$t('lang.Notify.error'),
- _self.$t('lang.tabButton.describe3'),
- true,
- );
- return;
- }
- htmlWindowUrl = htmlWindowUrl.replace(
- '{RecordIds}',
- recordIds,
- );
- } else {
- var recordId = _self.modelData.id;
- htmlWindowUrl = htmlWindowUrl.replace(
- '{RecordIds}',
- recordId,
- );
- }
- } else if (tempResult == '{Token}') {
- htmlWindowUrl = htmlWindowUrl.replace(
- '{Token}',
- Common.getToken(),
- );
- } else {
- if (_self.selectedModelDatas.length == 0) {
- Notify.error(
- _self.$t('lang.Notify.error'),
- _self.$t('lang.tabButton.describe3'),
- true,
- );
- return;
- } else if (_self.selectedModelDatas.length > 1) {
- Notify.error(
- _self.$t('lang.Notify.error'),
- _self.$t('lang.tabButton.describe2'),
- true,
- );
- return;
- }
- var tempResult1 = tempResult
- .replace('{', '')
- .replace('}', '');
- htmlWindowUrl = htmlWindowUrl.replace(
- tempResult,
- _self.getFirstSelectModelDataFieldValue(tempResult1),
- );
- }
- }
- var openWindow = window.open(htmlWindowUrl);
- // 自动关闭
- if (autoCloseInterval != undefined) {
- setTimeout(function () {
- openWindow.close();
- openWindow = undefined;
- }, autoCloseInterval * 1000);
- }
- }
- }
- },
- errorData => {
- Common.processException(errorData);
- },
- );
- }
- },
- autoCloseOpenWindow: function () {
- if (this.openWindow != null) {
- this.openWindow.close();
- this.openWindow = null;
- }
- },
- /**
- * 导出确认
- */
- exportConfirm: function () {
- var _self = this;
- if (
- _self.curdWindowFunctionAccess.canExport != null &&
- _self.curdWindowFunctionAccess.canExport === true
- ) {
- BootstrapDialog.show({
- title: _self.$t('lang.TabButton.dataExport'), //title
- message: _self.$t('lang.TabButton.DataExport'),
- buttons: [
- {
- label: _self.$t('lang.TabButton.exportMasterTableData'),
- action: function (dialog) {
- _self.exportData(false);
- dialog.close();
- },
- },
- {
- label: _self.$t('lang.TabButton.exportAllData'),
- action: function (dialog) {
- _self.exportData(true);
- dialog.close();
- },
- },
- {
- label: _self.$t('lang.TabButton.cancel'),
- action: function (dialog) {
- dialog.close();
- },
- },
- ],
- });
- } else {
- Notify.error(
- _self.$t('lang.tabButton.describe4'),
- _self.$t('lang.tabButton.describe5'),
- false,
- );
- }
- },
- /**
- * 导出数据
- * @param exportSubTabData 是否导出子页签数据
- */
- exportData: function (exportSubTabData) {
- var _self = this;
- var downloadUrl = null;
- var token = Common.getToken();
- var windowNo = this.$route.params.windowNo;
- var recordId = null;
- if (_self.modelData != undefined) {
- recordId = _self.modelData.id;
- }
- var uuid = _self.uuid;
- var obj = {
- windowNo: windowNo,
- tabIndex: _self.showTabDto.tabIndex,
- recordId: recordId,
- token: token,
- simpleFilterCondition: _self.simpleFilterParams,
- filterParams: _self.complexFilterParams,
- };
- let url = null;
- if (recordId == null) {
- url = Common.getApiURL('exportResource/exportWindowData');
- } else {
- url = Common.getApiURL('exportResource/exportSingleWindowData');
- }
- url += '?exportSubTabData=' + exportSubTabData;
- let formParameterName = 'exportQueryParamStr';
- let formParameterValue = JSON.stringify(obj);
- var data = formParameterName + '=' + formParameterValue;
- var timeStr = dayjs().format('_YYYYMMDD_hhmmss');
- var fileName =
- _self.showTabDto == null
- ? '导出数据' + timeStr + '.xlsx'
- : _self.showTabDto.name + timeStr + '.xlsx';
- DownloadService.postDownloadFile(url, data, fileName);
- },
- importData: function () {
- var _self = this;
- var uuid = _self.uuid;
- if (
- _self.mWindow != undefined &&
- _self.mWindow.dataTemplateIds != undefined
- ) {
- var data = JSON.stringify(_self.mWindow.dataTemplateIds);
- this.$router.push({
- path: '/desktop/data-import-panel',
- query: { dataTemplateIds: data },
- });
- }
- },
- // 切换到Form表单的路由
- switchFormRoute: function (tabButton) {
- const _self = this;
- var routeDate = {
- path: tabButton.customerWindowRouteUrl,
- params: {
- processReportId: tabButton.processReportId,
- modelData: this.modelData,
- },
- };
- // 请勿修改,会影响生单的功能
- var uuid = _self.uuid;
- if (uuid != undefined) {
- routeDate.path = routeDate.path + '/' + uuid;
- }
- this.$emit('saveView');
- const frameUrl = Common.getRedirectUrl(
- '#' + routeDate.path + '?processReportId=' + tabButton.processReportId,
- );
- // 供子页面iframe调用,修改modelData,(举例:生单界面修改参数)。
- window.modelDataChanged = this.modelDataChanged;
- window.getModelData = this.getModelData;
- let modelData = JSON.stringify(this.modelData);
- console.log(modelData);
- localStorage.setItem(_self.uuid + '#GenerateDocumentTool', modelData);
- var iWidth = 1280; //弹出窗口的宽度;
- var iHeight = 720; //弹出窗口的高度;
- var iTop = (window.screen.availHeight - 30 - iHeight) / 2; //获得窗口的垂直位置;
- var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; //获得窗口的水平位置;
- 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',
- );
- // window.open(frameUrl);
- },
- modelDataChanged: function (newModelData) {
- const _self = this;
- _self.$emit('modelDataChanged', newModelData);
- },
- getModelData: function () {
- const _self = this;
- return _self.$parent.getModelData();
- },
- // 执行Form流程
- executeFormProcess: function (tabButton) {
- var _self = this;
- //执行流程
- if (_self.modelData.id == undefined) {
- Notify.error(
- _self.$t('lang.tabButton.describe6'),
- _self.$t('lang.tabButton.describe7'),
- false,
- );
- return;
- }
- //执行流程
- var processResultData = {
- processReportId: tabButton.processReportId,
- modelData: _self.modelData,
- };
- _self.loading = true;
- $.ajax({
- url: Common.getApiURL('ProcessReportResource/runProcess'),
- type: 'post',
- dataType: 'json',
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- contentType: 'application/json',
- data: JSON.stringify(processResultData),
- success: function (successData) {
- if (successData.errorCode == 0) {
- _self.modal = true;
- _self.loading = false;
- _self.processReportResult = successData.data;
- if (
- _self.processReportResult.reportResults != undefined &&
- _self.processReportResult.reportResults.length > 0
- ) {
- _self.processReportResult.reportResults.forEach(function (
- item,
- index,
- ) {
- item.previewIndex = 1;
- if (index == 0) {
- item.showPreview = true;
- } else {
- item.showPreview = false;
- }
- });
- }
- _self.$emit('processExecuteFinish');
- }
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- _self.loading = false;
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- },
- // 执行流程
- executeProcess: function (tabButton) {
- var _self = this;
- // if (_self.viewType == 'EditForm' || _self.viewType == 'Form') {
- // let processResultData = {
- // "processReportNo": tabButton.processReportNo,
- // "modelData": _self.modelData
- // }
- // _self.loading=true;
- // ProcessReportResource.runProcess(processResultData).then(successData => {
- // _self.modal = true;
- // _self.loading=false;
- // _self.processReportResult = successData;
- // _self.$emit("processExecuteFinish");
- // }, errorData => {
- // _self.loading=false;
- // Common.processException(errorData);
- // });
- // } else {
- var ids = [];
- if (_self.modelDatas) {
- _self.modelDatas.forEach(function (modelData) {
- if (modelData.select == true) {
- ids.push(modelData.id);
- }
- });
- } else if (_self.modelData) {
- ids.push(_self.modelData.id);
- }
- _self.loading = true;
- ProcessReportResource.runProcessByIds(
- tabButton.processReportNo,
- ids,
- ).then(
- successData => {
- _self.modal = true;
- _self.loading = false;
- _self.processReportResult = successData;
- if (
- _self.processReportResult.reportResults != undefined &&
- _self.processReportResult.reportResults.length > 0
- ) {
- _self.processReportResult.reportResults.forEach(function (
- item,
- index,
- ) {
- if (item.reportDefinitionType !== 'ExcelReport') {
- item.previewIndex = 1;
- } else {
- item.previewIndex = 2;
- }
- if (index == 0) {
- item.showPreview = true;
- } else {
- item.showPreview = false;
- }
- });
- }
- _self.$emit('processExecuteFinish');
- },
- errorData => {
- _self.loading = false;
- Common.processException(errorData);
- },
- );
- // }
- },
- // 通知
- notify: function () {
- var _self = this;
- _self.notificationModal = true;
- },
- // 发送通知
- sendNotification: function () {
- var _self = this;
- var notification = _self.$refs.notificationPanel.getNotification();
- var recordIds = [];
- if (_self.viewType == 'Grid') {
- if (_self.modelDatas && _self.modelDatas.length > 0) {
- _self.modelDatas.forEach(function (item) {
- if (item.select) {
- recordIds.push(item.id);
- }
- });
- }
- } else if (_self.viewType == 'Form') {
- recordIds.push(_self.$route.params.recordId);
- }
- if (recordIds.length == 0) {
- Notify.error(
- _self.$t('lang.Notify.error'),
- _self.$t('lang.tabButton.describe7'),
- true,
- );
- return;
- }
- if (notification.userIds == null || notification.userIds.length == 0) {
- Notify.error(
- _self.$t('lang.Notify.error'),
- _self.$t('lang.tabButton.describe8'),
- true,
- );
- return;
- }
- if (notification.theme == null || notification.theme.trim() == '') {
- Notify.error(
- _self.$t('lang.Notify.error'),
- _self.$t('lang.tabButton.describe9'),
- true,
- );
- return;
- }
- if (notification.content == null || notification.content.trim() == '') {
- Notify.error(
- _self.$t('lang.Notify.error'),
- _self.$t('lang.tabButton.describe10'),
- true,
- );
- return;
- }
- var windowNo = _self.$route.params.windowNo;
- var tabIndex = _self.showTabDto.tabIndex;
- notification.windowNo = windowNo;
- notification.tabIndex = tabIndex;
- notification.recordIds = recordIds;
- notification.className = _self.showTabDto.className;
- _self.loading = true;
- $.ajax({
- url: Common.getApiURL('notificationResource/send'),
- type: 'post',
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- contentType: 'application/json',
- data: JSON.stringify(notification),
- success: function (data) {
- _self.loading = false;
- _self.notificationModal = false;
- Notify.success(
- _self.$t('lang.tabButton.describe11'),
- _self.$t('lang.tabButton.describe12'),
- true,
- );
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- _self.loading = false;
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- },
- // 取消发送
- cancelNotification: function () {
- this.notificationModal = false;
- },
- },
- };
- </script>
- <style scoped>
- .floatTop {
- z-index: 1002;
- }
- :deep(.btn-group) {
- margin: -2px;
- }
- .tab_button {
- color: black;
- margin-left: 4px;
- }
- :deep(.ant-breadcrumb-link :first-child){
- color: #4ca4f7;
- }
- </style>
|