| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- <template>
- <div>
- <ProcessReportDynamic
- v-if="reportType == 'DYNAMIC'"
- :process-report-dto="processReportDto"
- @value-changed="valueChanged"
- />
- <ProcessReportStatic
- v-if="reportType == 'STATIC'"
- :process-report-dto="processReportDto"
- @value-changed="valueChanged"
- />
- </div>
- </template>
- <script>
- var Common = require('../../common/Common.js').default;
- var ProcessReportDynamic = require('./ProcessReportDynamic.vue').default;
- var ProcessReportStatic = require('./ProcessReportStatic.vue').default;
- export default {
- name: 'ProcessReport',
- components: {
- ProcessReportDynamic,
- ProcessReportStatic,
- },
-
- data: function () {
- return {
- 'reportType': '',
- 'processReportDto': {},
- };
- },
- watch: {
- '$route': function (to, from) {
- this.processReportNo = this.$route.params.no;
- this.loadData();
- },
- },
- mounted: function () {
- this.processReportNo = this.$route.params.no;
- this.loadData();
- },
- methods: {
- /**
- * 根据流程报表ID加载流程报表数据
- * @return {void}
- */
- loadData: function () {
- var _self = this;
- $.ajax({
- url: Common.getApiURL('ProcessReportResource/uniqueByNo'),
- type: 'get',
- dataType: 'json',
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- data: {
- no: _self.processReportNo,
- },
- success: function (data) {
- console.log('参数结果' + data.reportType);
- _self.reportType = data.reportType;
- if (data.processReportParameters) {
- data.processReportParameters.forEach(function (item) {
- if (item.fieldValue == undefined) {
- item.fieldValue = {
- id: '',
- displayValue: [],
- fieldType: 'String',
- };
- }
- });
- }
- _self.processReportDto = data;
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- },
- // 值改变事件
- valueChanged: function (processReportParameter) {
- var _self = this;
- console.log('processReportParameter:' + JSON.stringify(processReportParameter));
- if (_self.processReportDto && _self.processReportDto.processReportParameters) {
- for (let i = 0; i < _self.processReportDto.processReportParameters.length; i++) {
- if (_self.processReportDto.processReportParameters[i].fieldName == processReportParameter.fieldName) {
- _self.processReportDto.processReportParameters[i].fieldValue = processReportParameter.fieldValue;
- }
- }
- }
- if (processReportParameter.calloutProcessNo && processReportParameter.calloutProcessNo != '') {
- _self.callout(processReportParameter.calloutProcessNo);
- }
- if (_self.processReportDto != null && _self.processReportDto.processReportParameters != null) {
- for (let i = 0; i < _self.processReportDto.processReportParameters.length; i++) {
- var item = _self.processReportDto.processReportParameters[i];
- if (item.fieldName != processReportParameter.fieldName
- && item.whereClause != null
- && item.whereClause.indexOf(':' + processReportParameter.fieldName) >= 0) {
- item.fieldValue.id = '';
- item.fieldValue.displayValue.splice(0, item.fieldValue.displayValue.length);
- _self.processReportDto.processReportParameters[i]=item;
- }
- }
- }
- },
- callout: function (calloutProcessNo) {
- var _self = this;
- $.ajax({
- url: Common.getApiURL('ProcessReportResource/runProcessReportCallout/') + calloutProcessNo,
- type: 'POST',
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- contentType: 'application/json',
- data: JSON.stringify(_self.processReportDto),
- success: function (data) {
- if (data && data.processReportParameterDtos) {
- var processReportParameterDtos = data.processReportParameterDtos;
- for (var i = 0; i < data.processReportParameterDtos.length; i++) {
- var fieldName = data.processReportParameterDtos[i].fieldName;
- for (var j = 0; j < _self.processReportDto.processReportParameters.length; j++) {
- if (_self.processReportDto.processReportParameters[j].fieldName == fieldName) {
- var parameter = _self.processReportDto.processReportParameters[j];
- var cloneObject = {
- 'index': 1,
- 'isMandatory': false,
- 'id': parameter.id,
- 'fieldName': parameter.fieldName,
- 'name': parameter.name,
- 'help': parameter.help,
- 'displayType': parameter.displayType,
- 'listDisplayFieldNames': parameter.listDisplayFieldNames,
- 'infoWindowId': parameter.infoWindowId,
- 'sortNo': parameter.sortNo,
- 'isShow': parameter.isShow,
- 'constraintEnum': parameter.constraintEnum,
- 'whereClause': parameter.whereClause,
- 'enumClass': parameter.enumClass,
- 'fieldValue': data.processReportParameterDtos[i].fieldValue,
- 'calloutProcessNo': parameter.calloutProcessNo,
- 'mandatory': parameter.mandatory,
- 'listDisplayFieldName': parameter.listDisplayFieldName,
- 'displayName': parameter.displayName,
- };
- _self.processReportDto.processReportParameters[j]=cloneObject;
- }
- }
- }
- }
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- },
- },
- };
- </script>
- <style scoped>
- .control-label {
- font-size: 15px;
- }
- .processResult-textarea {
- width: 100%;
- height: 200px;
- }
- </style>
|