| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- <template>
- <div>
- <div v-show="archiveAuthority">
- <div>
- <label>报表归档:</label>
- <button
- v-show="startArchive == false"
- class="btn btn-success"
- @click="startArchive = true"
- >
- 归档
- </button>
- <button
- v-show="startArchive == false"
- class="btn btn-success"
- @click="searchArchiveRecord"
- >
- 归档查询
- </button>
- <button
- v-show="startArchive == true"
- class="btn btn-success"
- @click="archive()"
- >
- 保存
- </button>
- <button
- v-show="startArchive == true"
- class="btn btn-warning"
- @click="startArchive = false"
- >
- 取消
- </button>
- </div>
- <div v-show="startArchive == true">
- <div class="form-group">
- <label>标题</label>
- <input
- v-model="title"
- autocomplete="off"
- type="text"
- class="form-control"
- />
- </div>
- <div class="form-group">
- <label>业务日期</label>
- <DateTime
- v-model="businessDate"
- class="form-control"
- />
- </div>
- <div class="form-group">
- <label>备注</label>
- <input
- v-model="description"
- autocomplete="off"
- type="description"
- class="form-control"
- />
- </div>
- <div class="form-group">
- <label>归档日期</label>
- <input
- v-model="archiveDate"
- autocomplete="off"
- type="text"
- class="form-control"
- :readonly="true"
- />
- </div>
- <div class="form-group">
- <label>归档人</label>
- <input
- v-model="userName"
- autocomplete="off"
- type="text"
- class="form-control"
- :readonly="true"
- />
- </div>
- <div
- v-for="item,index in processReportResult.reportResults"
- :key="'reportResult-' + index"
- class="form-group"
- >
- <label>报表路径{{ index + 1 }}</label>
- <input
- v-model="item.htmlPreviewUrl"
- autocomplete="off"
- type="text"
- class="form-control"
- :readonly="true"
- />
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import Common from '../../common/Common.js';
- import Notify from '../../common/Notify.js';
- import DateTime from '../../datetime/src/DateTime.vue';
- export default {
- components: {
- DateTime,
- },
- props: {
- 'processReportResult':{
- type: Object,
- default: null,
- }},
- data: function () {
- return {
- archiveAuthority: '',
- startArchive: false,
- title: '',
- businessDate: '',
- description: '',
- userName: '',
- archiveDate: '',
- interval: '',
- };
- },
- watch: {
- 'processReportResult': function () {
- this.initArchiveAuthority();
- },
- },
- mounted: function () {
- var _self = this;
- this.initArchiveAuthority();
- this.interval = window.setInterval(function () {
- _self.updateDate();
- }, 1000);
- },
- beforeUnmount: function () {
- clearInterval(this.interval);
- },
- methods: {
- initArchiveAuthority: function () {
- var _self = this;
- if (this.processReportResult) {
- this.title = this.processReportResult.processReportName;
- }
- var loginInfoJson = localStorage.getItem('json_LoginInfo');
- var loginInfo = JSON.parse(loginInfoJson);
- if (loginInfo != null) {
- _self.userName = loginInfo.userName;
- }
- if (_self.processReportResult == null || _self.processReportResult.processReportNo == null) {
- _self.archiveAuthority = false;
- return;
- }
- $.ajax({
- url: Common.getApiURL('ProcessReportResource/getArchiveAuthority'),
- type: 'get',
- dataType: 'json',
- data: {
- 'processReportNo': _self.processReportResult.processReportNo,
- },
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- success: function (data) {
- _self.archiveAuthority = data;
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- },
- archive: function () {
- var _self = this;
- var url = '';
- var reportNames = '';
- const hash = location.hash;
- const windowNo = hash.substring(34,49);
- var reportResults = this.processReportResult.reportResults;
- for (var i = 0; i < reportResults.length; i++) {
- var reportResult = reportResults[i];
- var pdfDownLoadUrl = reportResult.pdfDownLoadUrl;
- if (pdfDownLoadUrl && pdfDownLoadUrl.length > 4) {
- url += pdfDownLoadUrl.substring(0, pdfDownLoadUrl.length - 4);
- reportNames += reportResult.reportName;
- }
- if (i + 1 < reportResults.length) {
- url += ',';
- reportNames += ',';
- }
- }
- $.ajax({
- url: Common.getApiURL('ArchiveResource/archive'),
- type: 'get',
- dataType: 'json',
- data: {
- 'help': _self.title,
- 'businessDate': _self.businessDate,
- 'description': _self.description,
- 'url': url,
- 'reportNames': reportNames,
- 'windowNo': windowNo,
- },
- beforeSend: function (request) {
- Common.addTokenToRequest(request);
- },
- success: function (data) {
- Notify.success('归档成功', '归档成功,可以在【归档查询】页面查询所有归档信息', 1500);
- _self.startArchive = false;
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- Common.processException(XMLHttpRequest, textStatus, errorThrown);
- },
- });
- },
- //格式化日期成 "yyyy-MM-dd HH-mm-SS"格式
- updateDate: function () {
- var date = new Date();
- var seperator1 = '-';
- var seperator2 = ':';
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- if (month >= 1 && month <= 9) {
- month = '0' + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = '0' + strDate;
- }
- var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
- + ' ' + date.getHours() + seperator2 + date.getMinutes() + seperator2
- + (date.getSeconds() < 10 ? '0' : '') + date.getSeconds();
- this.archiveDate = currentdate;
- },
- searchArchiveRecord: function () {
- this.$router.push('/desktop/archive');
- },
- },
- };
- </script>
|