123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <template>
- <div class="intellReport" :class="!theme ? 'themeDark' : 'themeLight'">
- <el-row :gutter="50" justify="space-evenly" :style="pageHeight">
- <el-col :span="8" class="warn-table">
- <existing @getExistingData="getData" :height="tableHeight" />
- </el-col>
- <el-col :span="2" style="text-align: center;">
- <div :style="btnHeight">
- <el-button type="primary" @click="onAddItem1">
- <el-icon class="el-icon--right">
- <ArrowRight />
- </el-icon>
- </el-button>
- </div>
- <div :style="btnHeight">
- <el-button type="primary" @click="onAddItem2">
- <el-icon class="el-icon--right">
- <ArrowRight />
- </el-icon>
- </el-button>
- </div>
- </el-col>
- <el-col :span="12">
- <div class="listTop warn-table">
- <el-table :data="tableData" :height="listHeight">
- <el-table-column type="index" width="30" />
- <el-table-column label="脚本列表">
- <template #default="scope">
- <el-button v-if="scope.row.scriptName !==''" type="warning" round>
- {{ scope.row.scriptName}}
- </el-button>
- </template>
- </el-table-column>
- <el-table-column align="right">
- <template #default="scope">
- <el-button type="primary" :disabled="btnloading" @click="handleRun(scope.$index)">运行
- </el-button>
- <el-button type="danger" @click="handleDelete(scope.$index)">删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-button class="run-all-script" type="primary" :disabled="btnloading" @click="runAllScript">运行所有脚本
- </el-button>
- </div>
- <div class="listBot warn-table">
- <p class="tableTit">每天运行一次</p>
- <el-table :data="tableData4" :height="listHeight">
- <el-table-column label="时间" width="300">
- <el-time-select v-model="timeValue" start="00:05" step="00:05" end="23:55"
- placeholder="选择时间" />
- </el-table-column>
- <el-table-column label="脚本名称">
- <template #default="scope">
- <el-button v-if="scope.row.scriptName !==''" type="warning" round>
- {{ scope.row.scriptName}}
- </el-button>
- </template>
- </el-table-column>
- <el-table-column align="right">
- <template #default="scope">
- <el-button type="primary" @click="handleDelete(scope.$index)">运行</el-button>
- <el-button type="danger" @click="handleDelete(scope.$index)">取消
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import {
- run
- } from '@/api/report';
- import existing from "../existing.vue";
- export default {
- components: {
- existing
- },
- data() {
- return {
- childCurrentRow: [],
- tableData: [],
- tableData4: [],
- timeValue: '',
- theme: null,
- tableHeight: document.documentElement.clientHeight - 115,
- listHeight: (document.documentElement.clientHeight - 160) / 2,
- btnloading: false
- }
- },
- watch: {
- '$store.state.theme': {
- handler: function (newVal, oldVal) {
- this.theme = newVal
- },
- immediate: true
- }
- },
- computed: {
- pageHeight() {
- return {
- 'height': document.documentElement.clientHeight - 115 + 'px'
- }
- },
- btnHeight() {
- return {
- 'height': (document.documentElement.clientHeight - 160) / 4 + 'px',
- 'padding-top': (document.documentElement.clientHeight - 160) / 4 + 'px'
- }
- }
- },
- methods: {
- onAddItem1() {
- this.tableData.push(this.childCurrentRow)
- },
- onAddItem2() {
- this.tableData4.push(this.childCurrentRow)
- },
- runAllScript() {
- this.btnloading = true
- run(this.tableData).then(res => {
- console.log(res)
- this.btnloading = false
- });
- },
- handleRun(index) {
- this.btnloading = true
- run(new Array(this.tableData[index])).then(res => {
- console.log(res)
- this.btnloading = false
- })
- },
- handleDelete(index) {
- this.tableData.splice(index, 1)
- },
- getData(data) {
- console.log("data:", data)
- this.childCurrentRow = data
- }
- }
- }
- </script>
- <style scoped lang="less">
- .intellReport {
- .listTop {
- margin-bottom: 20px;
- }
- .run-all-script {
- position: absolute;
- right: 120px;
- }
- }
- .themeDark {
- padding: 20px 0;
- background: #161f1e;
- border-radius: 10px;
- .tableTit {
- color: #fff;
- }
- }
- .themeLight {
- padding: 20px 0;
- background: #edeffb;
- border-radius: 10px;
- .tableTit {
- color: #161f1e;
- }
- }
- </style>
|