|
@@ -8,9 +8,14 @@
|
|
|
:inline="true"
|
|
|
@submit.native.prevent
|
|
|
>
|
|
|
- <el-form-item>
|
|
|
- <el-input v-model="searchForm.code" placeholder="场站标识" />
|
|
|
- </el-form-item>
|
|
|
+ <el-select v-model="searchForm.stationCode" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in stations"
|
|
|
+ :key="item.stationCode"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.stationCode"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
<el-form-item>
|
|
|
<el-button
|
|
|
icon="el-icon-search"
|
|
@@ -62,11 +67,18 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column show-overflow-tooltip prop="name" label="任务名称" />
|
|
|
<el-table-column show-overflow-tooltip prop="jobName" label="任务标识" />
|
|
|
- <el-table-column show-overflow-tooltip prop="jobState" label="任务状态" />
|
|
|
- <el-table-column show-overflow-tooltip prop="executeClass" label="执行类" />
|
|
|
- <el-table-column show-overflow-tooltip prop="cronExpression" label="cronb表达式" />
|
|
|
- <el-table-column show-overflow-tooltip prop="executeClass" label="执行类" />
|
|
|
- <el-table-column show-overflow-tooltip prop="description" label="描述" />
|
|
|
+ <el-table-column show-overflow-tooltip prop="jobState" label="任务状态" />
|
|
|
+ <el-table-column
|
|
|
+ show-overflow-tooltip
|
|
|
+ prop="executeClass"
|
|
|
+ label="执行类"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ show-overflow-tooltip
|
|
|
+ prop="cronExpression"
|
|
|
+ label="cronb表达式"
|
|
|
+ />
|
|
|
+ <el-table-column show-overflow-tooltip prop="description" label="描述" />
|
|
|
|
|
|
<el-table-column show-overflow-tooltip label="操作" width="180px">
|
|
|
<template #default="{ row }">
|
|
@@ -96,26 +108,95 @@
|
|
|
@close="close"
|
|
|
>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
- <el-form-item label="公司名称" prop="name">
|
|
|
- <el-input v-model.trim="form.name" autocomplete="off"></el-input>
|
|
|
+ <el-form-item label="场站" prop="name">
|
|
|
+ <el-select
|
|
|
+ v-model="form.stationCode"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="selectStationChange($event)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in stations"
|
|
|
+ :key="item.stationCode"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.stationCode"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="公司编码" prop="code">
|
|
|
- <el-input v-model.trim="form.code" autocomplete="off"></el-input>
|
|
|
+
|
|
|
+ <el-form-item label="执行类" prop="executeClass">
|
|
|
+ <el-select
|
|
|
+ v-model="form.executeClass"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="selectExecuteClassChange($event)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in quartzBases"
|
|
|
+ :key="item.executeClass"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.executeClass"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="联系方式" prop="contact">
|
|
|
- <el-input v-model.trim="form.contact" autocomplete="off"></el-input>
|
|
|
+
|
|
|
+ <el-form-item label="cron" prop="cronExpression">
|
|
|
+ <el-popover v-model="cronPopover">
|
|
|
+ <cron
|
|
|
+ i18n="cn"
|
|
|
+ @change="changeCron"
|
|
|
+ @close="cronPopover = false"
|
|
|
+ ></cron>
|
|
|
+ <el-input
|
|
|
+ slot="reference"
|
|
|
+ style="margin-top: -50%"
|
|
|
+ v-model="form.cronExpression"
|
|
|
+ placeholder="请输入定时策略"
|
|
|
+ @click="cronPopover = true"
|
|
|
+ ></el-input>
|
|
|
+ </el-popover>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+ <el-form-item label="任务标识" prop="jobName">
|
|
|
+ <el-input
|
|
|
+ v-model.trim="form.jobName"
|
|
|
+ autocomplete="off"
|
|
|
+ :disabled="true"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <el-form-item label="任务名称" prop="name">
|
|
|
+ <el-input v-model.trim="form.name" autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="鉴权URL" prop="username">
|
|
|
- <el-input v-model.trim="form.comUrl" autocomplete="off"></el-input>
|
|
|
+ <el-form-item label="任务状态" prop="jobState">
|
|
|
+ <el-select
|
|
|
+ v-model="form.jobState"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in state"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="推送数据URL" prop="username">
|
|
|
- <el-input v-model.trim="form.pushUrl" autocomplete="off"></el-input>
|
|
|
+
|
|
|
+
|
|
|
+ <el-form-item label="开始时间" prop="startTime">
|
|
|
+ <el-date-picker
|
|
|
+ v-model.trim="form.startTime"
|
|
|
+ type="datetime"
|
|
|
+ placeholder="选择日期时间">
|
|
|
+ </el-date-picker>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="拉取数据URL" prop="username">
|
|
|
- <el-input v-model.trim="form.pullUrl" autocomplete="off"></el-input>
|
|
|
+ <el-form-item label="类型" prop="jobType">
|
|
|
+ <el-input v-model.trim="form.jobType" autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -127,49 +208,55 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {
|
|
|
- fetchList,
|
|
|
- addObj,
|
|
|
- putObj,
|
|
|
- delObj,
|
|
|
- getObj,
|
|
|
- getAll,
|
|
|
- } from '@/api/integrationCompany'
|
|
|
+ import { fetchList, addObj, putObj, delObj,getJobName } from '@/api/quartz'
|
|
|
+ import { getCode, getInCode } from "@/api/quartzBase";
|
|
|
|
|
|
+ import { getAll } from '@/api/station'
|
|
|
+ import { cron } from 'vue-cron'
|
|
|
export default {
|
|
|
- name: 'quartzInfo',
|
|
|
-
|
|
|
+ name: 'QuartzInfo',
|
|
|
+ components: { cron },
|
|
|
data() {
|
|
|
- const validateInCompanyCode = (rule, value, callback) => {
|
|
|
+
|
|
|
+ const validateJobName = (rule, value, callback) => {
|
|
|
if (!value) {
|
|
|
- return callback(new Error('请输入一体化公司编码'))
|
|
|
+ return callback(new Error('请输入任务标识'))
|
|
|
}
|
|
|
- getObj(this.form.code, value).then((response) => {
|
|
|
+ getJobName(this.form.code, value).then((response) => {
|
|
|
if (this.dialogType === 'edit') callback()
|
|
|
let result = response.data
|
|
|
if (result !== null) {
|
|
|
- callback(new Error('一体化公司编码已存在'))
|
|
|
+ callback(new Error('任务标识存在'))
|
|
|
} else {
|
|
|
callback()
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
return {
|
|
|
+ cronPopover: false,
|
|
|
+ cron: '',
|
|
|
+ stations: [],
|
|
|
+ quartzBases: [],
|
|
|
+ inCode: '',
|
|
|
dialogFormVisible: false,
|
|
|
dialogType: '',
|
|
|
title: '',
|
|
|
tableData: [],
|
|
|
companys: [],
|
|
|
- elType: [
|
|
|
- { label: '光电', value: 'E1' },
|
|
|
- { label: '风电', value: 'E2' },
|
|
|
+ state: [
|
|
|
+ { label: '启动', value: 'start' },
|
|
|
+ { label: '停止', value: 'stop' },
|
|
|
+ { label: '重载', value: 'restart' },
|
|
|
],
|
|
|
searchForm: {
|
|
|
- code: null,
|
|
|
- name: null,
|
|
|
+ stationCode: null,
|
|
|
+ },
|
|
|
+ form: {
|
|
|
+ stationCode: null,
|
|
|
+ executeClass: null,
|
|
|
+ jobName: null,
|
|
|
+ cronExpression: null,
|
|
|
},
|
|
|
- form: {},
|
|
|
imgShow: true,
|
|
|
list: [],
|
|
|
imageList: [],
|
|
@@ -185,16 +272,25 @@
|
|
|
pageSize: 20, // 每页显示多少条
|
|
|
},
|
|
|
rules: {
|
|
|
- name: [
|
|
|
- { required: true, trigger: 'blur', message: '请输入公司名称' },
|
|
|
+ name: [{ required: true, trigger: 'blur', message: '请输入名称' }],
|
|
|
+
|
|
|
+ executeClass: [
|
|
|
+ { required: true, trigger: 'blur', message: '请输入执行类' },
|
|
|
],
|
|
|
|
|
|
- code: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- trigger: 'blur',
|
|
|
- validator: validateInCompanyCode,
|
|
|
- },
|
|
|
+ jobName: [
|
|
|
+ { required: true, trigger: 'blur', validator: validateJobName, },
|
|
|
+ ],
|
|
|
+
|
|
|
+ cronExpression: [
|
|
|
+ { required: true, trigger: 'blur', message: '请输入时间表达式' },
|
|
|
+ ],
|
|
|
+
|
|
|
+ startTime: [
|
|
|
+ { required: true, trigger: 'blur', message: '请输入开始时间' },
|
|
|
+ ],
|
|
|
+ jobState: [
|
|
|
+ { required: true, trigger: 'blur', message: '请输入状态' },
|
|
|
],
|
|
|
},
|
|
|
}
|
|
@@ -205,9 +301,53 @@
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
- this.fetchData()
|
|
|
+ this.getStations()
|
|
|
},
|
|
|
methods: {
|
|
|
+ changeCron(v) {
|
|
|
+ this.form.cronExpression = v
|
|
|
+ },
|
|
|
+ getStations() {
|
|
|
+ this.listLoading = true
|
|
|
+ getAll()
|
|
|
+ .then((response) => {
|
|
|
+ this.stations = response.data
|
|
|
+ this.fetchData()
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getQuartzBaseInCode() {
|
|
|
+ getInCode(this.inCode)
|
|
|
+ .then((response) => {
|
|
|
+ this.quartzBases = response.data
|
|
|
+
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ selectStationChange(value) {
|
|
|
+ this.$set(this.form, 'executeClass', null)
|
|
|
+ const selectedItem = this.stations.find((item) => {
|
|
|
+ return item.stationCode === value
|
|
|
+ // 筛选出匹配数据,是对应数据的整个对象
|
|
|
+ })
|
|
|
+ this.inCode = selectedItem.inCode
|
|
|
+ this.getQuartzBaseInCode()
|
|
|
+ },
|
|
|
+
|
|
|
+ selectExecuteClassChange(value) {
|
|
|
+ const selectedItem = this.quartzBases.find((item) => {
|
|
|
+ return item.executeClass === value
|
|
|
+ // 筛选出匹配数据,是对应数据的整个对象
|
|
|
+ })
|
|
|
+ this.form.jobName = this.form.stationCode + '-' + selectedItem.code
|
|
|
+ },
|
|
|
async fetchData() {
|
|
|
this.listLoading = true
|
|
|
fetchList(
|
|
@@ -306,8 +446,8 @@
|
|
|
.then((response) => {
|
|
|
this.$message({
|
|
|
message: '修改成功',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
+ type: 'success',
|
|
|
+ })
|
|
|
this.dialogFormVisible = false
|
|
|
this.fetchData()
|
|
|
this.listLoading = false
|
|
@@ -315,8 +455,8 @@
|
|
|
.catch(() => {
|
|
|
this.$message({
|
|
|
message: '修改失败',
|
|
|
- type: 'warning'
|
|
|
- });
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
this.listLoading = false
|
|
|
})
|
|
|
} else {
|