|
@@ -20,9 +20,9 @@
|
|
|
</el-input>
|
|
|
<el-button style="margin-left: 5px;" @click="searchReportEvent">查询</el-button>
|
|
|
</div>
|
|
|
-<!-- <el-button v-if="btnType === ''" type="primary" class="cy-nav-btn" icon="el-icon-circle-plus-outline"-->
|
|
|
-<!-- size="mini" @click="addReportEvent">新增-->
|
|
|
-<!-- </el-button>-->
|
|
|
+ <!-- <el-button v-if="btnType === ''" type="primary" class="cy-nav-btn" icon="el-icon-circle-plus-outline"-->
|
|
|
+ <!-- size="mini" @click="addReportEvent">新增-->
|
|
|
+ <!-- </el-button>-->
|
|
|
<!-- <el-button v-if="btnType === ''" type="success" class="cy-nav-btn" icon="el-icon-refresh"-->
|
|
|
<!-- size="mini" @click="refreshReportEvent">刷新</el-button>-->
|
|
|
<el-divider></el-divider>
|
|
@@ -77,12 +77,12 @@
|
|
|
icon="el-icon-setting"
|
|
|
@click="editReportItem(scope.row)">配置
|
|
|
</el-button>
|
|
|
-<!-- <el-button type="text"-->
|
|
|
-<!-- v-if="uid == scope.row.userId"-->
|
|
|
-<!-- size="small"-->
|
|
|
-<!-- icon="el-icon-edit"-->
|
|
|
-<!-- @click="editReportItem(scope.row)">修改-->
|
|
|
-<!-- </el-button>-->
|
|
|
+ <!-- <el-button type="text"-->
|
|
|
+ <!-- v-if="uid == scope.row.userId"-->
|
|
|
+ <!-- size="small"-->
|
|
|
+ <!-- icon="el-icon-edit"-->
|
|
|
+ <!-- @click="editReportItem(scope.row)">修改-->
|
|
|
+ <!-- </el-button>-->
|
|
|
<el-button type="text"
|
|
|
v-if="uid == scope.row.userId && scope.row.reportTableType == 1 && scope.row.runState == 0"
|
|
|
size="small"
|
|
@@ -98,6 +98,12 @@
|
|
|
<el-button type="text"
|
|
|
v-if="uid == scope.row.userId"
|
|
|
size="small"
|
|
|
+ icon="el-icon-printer"
|
|
|
+ @click="setAutoPrint(scope.row)">打印
|
|
|
+ </el-button>
|
|
|
+ <el-button type="text"
|
|
|
+ v-if="uid == scope.row.userId"
|
|
|
+ size="small"
|
|
|
icon="el-icon-user"
|
|
|
@click="setUserGroupEvent(scope.row)">授权
|
|
|
</el-button>
|
|
@@ -144,7 +150,9 @@
|
|
|
<el-row v-if="btnType == 'showShared'" style="margin: 10px 20px;">
|
|
|
<el-button type="primary" size="mini" icon="el-icon-download" @click="downloadReport">下载</el-button>
|
|
|
<el-button type="warning" size="mini" icon="el-icon-printer" @click="printExcel">打印</el-button>
|
|
|
- <el-button v-if="chooseMyReport && chooseMyReport.reportTableType != 0" type="info" size="mini" icon="el-icon-document" @click="historyReport">运行记录</el-button>
|
|
|
+ <el-button v-if="chooseMyReport && chooseMyReport.reportTableType != 0" type="info" size="mini"
|
|
|
+ icon="el-icon-document" @click="historyReport">运行记录
|
|
|
+ </el-button>
|
|
|
<el-button type="danger" size="mini" icon="el-icon-circle-close" @click="cancelSaveReport">关闭</el-button>
|
|
|
</el-row>
|
|
|
<el-row v-if="btnType == 'showChild'" style="margin: 10px 20px;">
|
|
@@ -208,8 +216,11 @@
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="运行时间" prop="cronLabel" v-if="reportForm.reportTableType == 1">
|
|
|
- <el-input placeholder="请设置运行时间" v-model="reportForm.cronLabel" style="width: calc(100% - 105px);" readonly></el-input>
|
|
|
- <el-button size="mini" @click="settingAutoReportTime" style="float: right;width: 100px;line-height: 20px;">设置运行时间</el-button>
|
|
|
+ <el-input placeholder="请设置运行时间" v-model="reportForm.cronLabel" style="width: calc(100% - 105px);"
|
|
|
+ readonly></el-input>
|
|
|
+ <el-button size="mini" @click="settingAutoReportTime" style="float: right;width: 100px;line-height: 20px;">
|
|
|
+ 设置运行时间
|
|
|
+ </el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<span slot='footer'>
|
|
@@ -218,6 +229,87 @@
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <!-- 配置打印定时任务 -->
|
|
|
+ <el-dialog
|
|
|
+ :title="printDialogTitle"
|
|
|
+ width="700px"
|
|
|
+ top="10vh"
|
|
|
+ center
|
|
|
+ v-dialog-drag
|
|
|
+ v-if="dialogAutoPrintVisible"
|
|
|
+ :before-close="dialogClose"
|
|
|
+ :visible.sync="dialogAutoPrintVisible"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :append-to-body="true">
|
|
|
+ <el-form ref="reportForm" :model="reportForm" :rules="reportRules" label-width="80px">
|
|
|
+ <el-radio-group v-model="radioByCron">
|
|
|
+ <el-form-item label="秒">
|
|
|
+ <el-radio :label="1">
|
|
|
+ <span style="margin-right: 10px;">每</span>
|
|
|
+ <el-input-number size="mini" v-model="radioByCronValS" :min="1" :max="59"></el-input-number>
|
|
|
+ <span style="margin-left: 10px;">秒执行一次</span>
|
|
|
+ </el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="分钟">
|
|
|
+ <el-radio :label="2">
|
|
|
+ <span style="margin-right: 10px;">每</span>
|
|
|
+ <el-input-number size="mini" v-model="radioByCronValM" :min="1" :max="59"></el-input-number>
|
|
|
+ <span style="margin-left: 10px;">分钟执行一次</span>
|
|
|
+ </el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="小时">
|
|
|
+ <el-radio :label="3">
|
|
|
+ <span style="margin-right: 10px;">每</span>
|
|
|
+ <el-input-number size="mini" v-model="radioByCronValH" :min="1" :max="2"></el-input-number>
|
|
|
+ <span style="margin-left: 10px;">小时执行一次</span>
|
|
|
+ </el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="指定时间">
|
|
|
+ <el-radio :label="4">
|
|
|
+ <span style="margin-right: 10px;">在每天的</span>
|
|
|
+ <el-time-picker v-model="radioByCronValD"
|
|
|
+ size="mini"
|
|
|
+ placeholder="请选择时间"
|
|
|
+ :clearable="false"
|
|
|
+ :editable="false"
|
|
|
+ value-format="HH:mm:ss"
|
|
|
+ :picker-options="{
|
|
|
+ format: 'HH:mm:ss'
|
|
|
+ }">
|
|
|
+ </el-time-picker>
|
|
|
+ <span style="margin-left: 10px;">执行一次</span>
|
|
|
+ </el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="">
|
|
|
+ <el-radio :label="5">
|
|
|
+ <span style="margin-right: 10px;">在每月</span>
|
|
|
+ <el-input-number size="mini" v-model="radioByCronValMo" :min="1" :max="31"></el-input-number>
|
|
|
+ <span style="margin-right: 10px; margin-left: 10px;">号的</span>
|
|
|
+ <el-time-picker v-model="radioByCronValMoD"
|
|
|
+ size="mini"
|
|
|
+ placeholder="请选择时间"
|
|
|
+ :clearable="false"
|
|
|
+ :editable="false"
|
|
|
+ value-format="HH:mm:ss"
|
|
|
+ :picker-options="{
|
|
|
+ format: 'HH:mm:ss'
|
|
|
+ }">
|
|
|
+ </el-time-picker>
|
|
|
+ <span style="margin-left: 10px;">执行一次</span>
|
|
|
+ </el-radio>
|
|
|
+ </el-form-item>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form>
|
|
|
+ <span slot='footer'>
|
|
|
+ <el-button type="primary" @click="chooseCronPrint" style="margin-top: 20px;">确定</el-button>
|
|
|
+ <el-button type="warning" v-if="printForm.runState==1" @click="stopAutoPrint"
|
|
|
+ style="margin-top: 20px;">停止</el-button>
|
|
|
+ <el-button type="warning" disabled v-if="printForm.runState!=1" @click="stopAutoPrint"
|
|
|
+ style="margin-top: 20px;">停止</el-button>
|
|
|
+ <el-button @click="dialogClose" style="margin-top: 20px;">取消</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
<!-- 用户组选择 -->
|
|
|
<el-dialog
|
|
|
title="选择用户组"
|
|
@@ -344,7 +436,7 @@
|
|
|
</el-form>
|
|
|
<span slot='footer'>
|
|
|
<el-button type="primary" @click="chooseCronEvent">确定</el-button>
|
|
|
-<!-- <el-button @click="dialogClose">取消</el-button>-->
|
|
|
+ <!-- <el-button @click="dialogClose">取消</el-button>-->
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
|
|
@@ -384,7 +476,7 @@
|
|
|
:append-to-body="true">
|
|
|
<div style="text-align: center;">
|
|
|
<el-radio v-model="downloadType" label="1">Excel</el-radio>
|
|
|
-<!-- <el-radio v-model="downloadType" label="2" disabled>PDF</el-radio>-->
|
|
|
+ <!-- <el-radio v-model="downloadType" label="2" disabled>PDF</el-radio>-->
|
|
|
</div>
|
|
|
<div style="text-align: center; margin-top: 40px;">
|
|
|
<el-button type="primary" @click="downloadReportEvent">确定</el-button>
|
|
@@ -439,13 +531,13 @@
|
|
|
<!-- type="warning" style="margin-right: 5px;">已分享</el-tag>-->
|
|
|
<!-- </template>-->
|
|
|
<!-- </el-table-column>-->
|
|
|
-<!-- <el-table-column-->
|
|
|
-<!-- align="center"-->
|
|
|
-<!-- label="当前版本"-->
|
|
|
-<!-- sortable="custom"-->
|
|
|
-<!-- prop="version"-->
|
|
|
-<!-- width="120">-->
|
|
|
-<!-- </el-table-column>-->
|
|
|
+ <!-- <el-table-column-->
|
|
|
+ <!-- align="center"-->
|
|
|
+ <!-- label="当前版本"-->
|
|
|
+ <!-- sortable="custom"-->
|
|
|
+ <!-- prop="version"-->
|
|
|
+ <!-- width="120">-->
|
|
|
+ <!-- </el-table-column>-->
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
label="运行时间"
|
|
@@ -541,7 +633,10 @@ import {
|
|
|
tableAssignUserById,
|
|
|
tableExchangeTypeById,
|
|
|
updateReportTable,
|
|
|
- updateTableNameById
|
|
|
+ updateTableNameById,
|
|
|
+ getPrintByReportId,
|
|
|
+ addPrint,
|
|
|
+ stopAutoPrintById
|
|
|
} from '@/api/datasource'
|
|
|
import Print from 'print-js'
|
|
|
import {getUsername} from '@/utils/auth'
|
|
@@ -579,6 +674,7 @@ export default {
|
|
|
dialogUserGroupVisible: false,
|
|
|
dialogHistoryReportVisible: false,
|
|
|
dialogGroupUserVisible: false,
|
|
|
+ dialogAutoPrintVisible: false,
|
|
|
reportType: '0',
|
|
|
downloadType: '1',
|
|
|
btnType: '',
|
|
@@ -611,6 +707,14 @@ export default {
|
|
|
cron: '',
|
|
|
dateRange: ''
|
|
|
},
|
|
|
+ printDialogTitle: '打印任务配置',
|
|
|
+ printForm: {
|
|
|
+ id: null,
|
|
|
+ reportTableId: null,
|
|
|
+ cronId: '',
|
|
|
+ cron: '',
|
|
|
+ runState: null
|
|
|
+ },
|
|
|
searchValue: null,
|
|
|
searchTxt: '',
|
|
|
searchHistoryTxt: '',
|
|
@@ -1400,6 +1504,64 @@ export default {
|
|
|
showAlertWin(this, null, e)
|
|
|
})
|
|
|
},
|
|
|
+ /** 设置自动打印 */
|
|
|
+ setAutoPrint(data) {
|
|
|
+ this.resetPrint();
|
|
|
+ const loading = showLoading(this, '设置中,请稍候···')
|
|
|
+ this.printForm.reportTableId = data.id;
|
|
|
+ getPrintByReportId(data.id).then(res => {
|
|
|
+ loading.close()
|
|
|
+ if (res.data) {
|
|
|
+ this.printForm.id = res.data.id;
|
|
|
+ this.printForm.cronId = res.data.cronId;
|
|
|
+ this.printForm.cron = res.data.cron;
|
|
|
+ this.printForm.runState = res.data.runState;
|
|
|
+ this.analysisCron(res.data.cron)
|
|
|
+ }
|
|
|
+ this.dialogAutoPrintVisible = true
|
|
|
+ }).catch((e) => {
|
|
|
+ loading.close()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ resetPrint() {
|
|
|
+ this.printForm.id = null;
|
|
|
+ this.printForm.reportTableId = null;
|
|
|
+ this.printForm.cronId = '';
|
|
|
+ this.printForm.cron = '';
|
|
|
+ this.printForm.runState = null;
|
|
|
+ },
|
|
|
+ /** 选择定时打印 */
|
|
|
+ chooseCronPrint() {
|
|
|
+ if (!this.getCron()) {
|
|
|
+ showAlertMsgWin(this, null, '请指定定时任务类型或运行时间!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.printForm.cron = this.getCron();
|
|
|
+ if (!this.validCron(this.printForm.cron)) {
|
|
|
+ showAlertMsgWin(this, null, '定时任务表达式格式不正确!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ addPrint(this.printForm).then(res => {
|
|
|
+ let msg = res.data ? '配置成功!' : '配置失败!'
|
|
|
+ showAlertMsgWin(this, null, msg)
|
|
|
+ this.showMainView = false
|
|
|
+ this.dialogAutoPrintVisible = false;
|
|
|
+ }).catch(e => {
|
|
|
+ showAlertWin(this, null, e)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 停止打印 */
|
|
|
+ stopAutoPrint() {
|
|
|
+ console.log(this.printForm.reportTableId)
|
|
|
+ stopAutoPrintById(this.printForm.reportTableId).then(res => {
|
|
|
+ showAlertWin(this, null, res.data)
|
|
|
+ if(res.code==200){
|
|
|
+ this.dialogAutoPrintVisible = false;
|
|
|
+ }
|
|
|
+ }).catch(e => {
|
|
|
+ showAlertWin(this, null, e)
|
|
|
+ })
|
|
|
+ },
|
|
|
/** 设置用户组信息 */
|
|
|
setUserGroupEvent(data) {
|
|
|
if (data.userId != this.uid) {
|
|
@@ -1677,7 +1839,7 @@ export default {
|
|
|
eventTables.forEach((data, i) => {
|
|
|
x += 1
|
|
|
y = 0
|
|
|
- let { dataList, dataTimeList, itemName } = data
|
|
|
+ let {dataList, dataTimeList, itemName} = data
|
|
|
itemName = (itemName != null && itemName != undefined) ? itemName : cqcyCode['invalidData']
|
|
|
luckysheet.setCellValue(x, y, itemName)
|
|
|
dataList.forEach((val, j) => {
|
|
@@ -1879,7 +2041,7 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- }catch (error){
|
|
|
+ } catch (error) {
|
|
|
console.log(error)
|
|
|
}
|
|
|
},
|
|
@@ -2170,6 +2332,7 @@ export default {
|
|
|
this.dialogAutoReportVisible = false
|
|
|
this.dialogReportTypeVisible = false
|
|
|
this.dialogUserGroupVisible = false
|
|
|
+ this.dialogAutoPrintVisible = false
|
|
|
}
|
|
|
},
|
|
|
/** 弹出层关闭事件 */
|
|
@@ -2302,4 +2465,4 @@ export default {
|
|
|
width: 300px;
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|