|
@@ -8,7 +8,11 @@
|
|
:inline="true"
|
|
:inline="true"
|
|
@submit.native.prevent
|
|
@submit.native.prevent
|
|
>
|
|
>
|
|
- <el-select v-model="searchForm.stationCode" placeholder="请选择">
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="searchForm.stationCode"
|
|
|
|
+ clearable
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ >
|
|
<el-option
|
|
<el-option
|
|
v-for="item in stations"
|
|
v-for="item in stations"
|
|
:key="item.stationCode"
|
|
:key="item.stationCode"
|
|
@@ -63,10 +67,12 @@
|
|
{{ scope.$index + 1 }}
|
|
{{ scope.$index + 1 }}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
+ <el-table-column show-overflow-tooltip prop="stationCode" :formatter="formatStation" label="场站" />
|
|
<el-table-column show-overflow-tooltip prop="name" label="任务名称" />
|
|
<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="jobName" label="任务标识" />
|
|
<el-table-column show-overflow-tooltip prop="jobState" label="任务状态" />
|
|
<el-table-column show-overflow-tooltip prop="jobState" label="任务状态" />
|
|
<el-table-column
|
|
<el-table-column
|
|
|
|
+ :formatter="formatQuartz"
|
|
show-overflow-tooltip
|
|
show-overflow-tooltip
|
|
prop="executeClass"
|
|
prop="executeClass"
|
|
label="执行类"
|
|
label="执行类"
|
|
@@ -108,8 +114,8 @@
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
<el-form-item label="场站" prop="name">
|
|
<el-form-item label="场站" prop="name">
|
|
<el-select
|
|
<el-select
|
|
- :disabled="isEdit"
|
|
|
|
v-model="form.stationCode"
|
|
v-model="form.stationCode"
|
|
|
|
+ :disabled="isEdit"
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
@change="selectStationChange($event)"
|
|
@change="selectStationChange($event)"
|
|
>
|
|
>
|
|
@@ -124,21 +130,22 @@
|
|
|
|
|
|
<el-form-item label="执行类" prop="executeClass">
|
|
<el-form-item label="执行类" prop="executeClass">
|
|
<el-select
|
|
<el-select
|
|
|
|
+ v-model="form.executeClass"
|
|
:disabled="isEdit"
|
|
:disabled="isEdit"
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
- v-model="form.executeClass"
|
|
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
@change="selectExecuteClassChange($event)"
|
|
@change="selectExecuteClassChange($event)"
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
- v-for="item in quartzBases"
|
|
|
|
|
|
+ v-for="item in this.quartzBases"
|
|
:key="item.executeClass"
|
|
:key="item.executeClass"
|
|
:label="item.name"
|
|
:label="item.name"
|
|
:value="item.executeClass"
|
|
:value="item.executeClass"
|
|
>
|
|
>
|
|
-
|
|
|
|
<span style="float: left">{{ item.name }}</span>
|
|
<span style="float: left">{{ item.name }}</span>
|
|
- <span style="float: right; color: #8492a6; font-size: 13px">{{ item.type }}</span>
|
|
|
|
|
|
+ <span style="float: right; color: #8492a6; font-size: 13px">
|
|
|
|
+ {{ item.type }}
|
|
|
|
+ </span>
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -152,15 +159,14 @@
|
|
></cron>
|
|
></cron>
|
|
<el-input
|
|
<el-input
|
|
slot="reference"
|
|
slot="reference"
|
|
- style="margin-top: -50%"
|
|
|
|
v-model="form.cronExpression"
|
|
v-model="form.cronExpression"
|
|
|
|
+ style="margin-top: -50%"
|
|
placeholder="请输入定时策略"
|
|
placeholder="请输入定时策略"
|
|
@click="cronPopover = true"
|
|
@click="cronPopover = true"
|
|
></el-input>
|
|
></el-input>
|
|
</el-popover>
|
|
</el-popover>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
-
|
|
|
|
<el-form-item label="任务标识" prop="jobName">
|
|
<el-form-item label="任务标识" prop="jobName">
|
|
<el-input
|
|
<el-input
|
|
v-model.trim="form.jobName"
|
|
v-model.trim="form.jobName"
|
|
@@ -169,18 +175,12 @@
|
|
></el-input>
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<el-form-item label="任务名称" prop="name">
|
|
<el-form-item label="任务名称" prop="name">
|
|
<el-input v-model.trim="form.name" autocomplete="off"></el-input>
|
|
<el-input v-model.trim="form.name" autocomplete="off"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="任务操作" prop="operate">
|
|
<el-form-item label="任务操作" prop="operate">
|
|
- <el-select
|
|
|
|
- v-model="form.operate"
|
|
|
|
- placeholder="请选择"
|
|
|
|
- >
|
|
|
|
|
|
+ <el-select v-model="form.operate" placeholder="请选择">
|
|
<el-option
|
|
<el-option
|
|
v-for="item in operates"
|
|
v-for="item in operates"
|
|
:key="item.value"
|
|
:key="item.value"
|
|
@@ -190,17 +190,14 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<el-form-item label="开始时间" prop="startTime">
|
|
<el-form-item label="开始时间" prop="startTime">
|
|
<el-date-picker
|
|
<el-date-picker
|
|
v-model.trim="form.startTime"
|
|
v-model.trim="form.startTime"
|
|
value-format="timestamp"
|
|
value-format="timestamp"
|
|
type="datetime"
|
|
type="datetime"
|
|
- placeholder="选择日期时间">
|
|
|
|
- </el-date-picker>
|
|
|
|
|
|
+ placeholder="选择日期时间"
|
|
|
|
+ ></el-date-picker>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
-
|
|
|
|
</el-form>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="close">取 消</el-button>
|
|
<el-button @click="close">取 消</el-button>
|
|
@@ -211,16 +208,22 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
- import { fetchList, addObj, putObj, delObj,getJobName,getJobTime } from '@/api/quartz'
|
|
|
|
- import { getChoose } from "@/api/quartzBase";
|
|
|
|
-
|
|
|
|
- import { getAll } from '@/api/station'
|
|
|
|
|
|
+ import {
|
|
|
|
+ fetchList,
|
|
|
|
+ addObj,
|
|
|
|
+ putObj,
|
|
|
|
+ delObj,
|
|
|
|
+ getJobName,
|
|
|
|
+ getJobTime,
|
|
|
|
+ } from '@/api/quartz'
|
|
|
|
+ import { getChoose,getQuartzBaseAll} from '@/api/quartzBase'
|
|
|
|
+
|
|
|
|
+ import { getStationAll } from '@/api/station'
|
|
import { cron } from 'vue-cron'
|
|
import { cron } from 'vue-cron'
|
|
export default {
|
|
export default {
|
|
name: 'QuartzInfo',
|
|
name: 'QuartzInfo',
|
|
components: { cron },
|
|
components: { cron },
|
|
data() {
|
|
data() {
|
|
-
|
|
|
|
const validateJobName = (rule, value, callback) => {
|
|
const validateJobName = (rule, value, callback) => {
|
|
if (!value) {
|
|
if (!value) {
|
|
return callback(new Error('请输入任务标识'))
|
|
return callback(new Error('请输入任务标识'))
|
|
@@ -241,6 +244,7 @@
|
|
cron: '',
|
|
cron: '',
|
|
stations: [],
|
|
stations: [],
|
|
quartzBases: [],
|
|
quartzBases: [],
|
|
|
|
+ quartzBaseAll: [],
|
|
inCode: '',
|
|
inCode: '',
|
|
dialogFormVisible: false,
|
|
dialogFormVisible: false,
|
|
dialogType: '',
|
|
dialogType: '',
|
|
@@ -279,7 +283,7 @@
|
|
],
|
|
],
|
|
|
|
|
|
jobName: [
|
|
jobName: [
|
|
- { required: true, trigger: 'change', validator: validateJobName, },
|
|
|
|
|
|
+ { required: true, trigger: 'change', validator: validateJobName },
|
|
],
|
|
],
|
|
|
|
|
|
cronExpression: [
|
|
cronExpression: [
|
|
@@ -301,32 +305,40 @@
|
|
this.getStations()
|
|
this.getStations()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- expandChange(row, expandedRows){
|
|
|
|
- getJobTime(row.jobName)
|
|
|
|
- .then((response) => {
|
|
|
|
- row.nextFireTime = response.data.nextFireTime
|
|
|
|
- row.laetFireTime = response.data.previousFireTime
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
|
|
+ expandChange(row, expandedRows) {
|
|
|
|
+ getJobTime(row.jobName).then((response) => {
|
|
|
|
+ row.nextFireTime = response.data.nextFireTime
|
|
|
|
+ row.laetFireTime = response.data.previousFireTime
|
|
|
|
+ })
|
|
},
|
|
},
|
|
changeCron(v) {
|
|
changeCron(v) {
|
|
this.form.cronExpression = v
|
|
this.form.cronExpression = v
|
|
},
|
|
},
|
|
|
|
+ getQuartzBaseAll(){
|
|
|
|
+ getQuartzBaseAll()
|
|
|
|
+ .then((response) => {
|
|
|
|
+ this.quartzBaseAll = response.data
|
|
|
|
+ this.fetchData()
|
|
|
|
+ this.listLoading = false
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.listLoading = false
|
|
|
|
+ })
|
|
|
|
+ },
|
|
getStations() {
|
|
getStations() {
|
|
this.listLoading = true
|
|
this.listLoading = true
|
|
- getAll()
|
|
|
|
|
|
+ getStationAll()
|
|
.then((response) => {
|
|
.then((response) => {
|
|
this.stations = response.data
|
|
this.stations = response.data
|
|
- this.fetchData()
|
|
|
|
|
|
+ this.getQuartzBaseAll()
|
|
this.listLoading = false
|
|
this.listLoading = false
|
|
})
|
|
})
|
|
.catch(() => {
|
|
.catch(() => {
|
|
this.listLoading = false
|
|
this.listLoading = false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- getQuartzBaseInCode() {
|
|
|
|
- getChoose(this.inCode)
|
|
|
|
|
|
+ getQuartzBaseInCode(inCode) {
|
|
|
|
+ getChoose(inCode)
|
|
.then((response) => {
|
|
.then((response) => {
|
|
this.quartzBases = response.data
|
|
this.quartzBases = response.data
|
|
|
|
|
|
@@ -344,13 +356,12 @@
|
|
// 筛选出匹配数据,是对应数据的整个对象
|
|
// 筛选出匹配数据,是对应数据的整个对象
|
|
})
|
|
})
|
|
this.inCode = selectedItem.inCode
|
|
this.inCode = selectedItem.inCode
|
|
- this.getQuartzBaseInCode()
|
|
|
|
|
|
+ this.getQuartzBaseInCode(this.inCode)
|
|
},
|
|
},
|
|
|
|
|
|
selectExecuteClassChange(value) {
|
|
selectExecuteClassChange(value) {
|
|
const selectedItem = this.quartzBases.find((item) => {
|
|
const selectedItem = this.quartzBases.find((item) => {
|
|
return item.executeClass === value
|
|
return item.executeClass === value
|
|
- // 筛选出匹配数据,是对应数据的整个对象
|
|
|
|
})
|
|
})
|
|
this.form.jobName = this.form.stationCode + '-' + selectedItem.code
|
|
this.form.jobName = this.form.stationCode + '-' + selectedItem.code
|
|
},
|
|
},
|
|
@@ -401,28 +412,31 @@
|
|
this.$emit('fetch-data')
|
|
this.$emit('fetch-data')
|
|
},
|
|
},
|
|
handleAdd() {
|
|
handleAdd() {
|
|
|
|
+ this.isEdit = false
|
|
this.form = {}
|
|
this.form = {}
|
|
this.title = '新增'
|
|
this.title = '新增'
|
|
this.dialogType = 'add'
|
|
this.dialogType = 'add'
|
|
this.dialogFormVisible = true
|
|
this.dialogFormVisible = true
|
|
},
|
|
},
|
|
handleEdit(row) {
|
|
handleEdit(row) {
|
|
- this.isEdit = true
|
|
|
|
|
|
+ this.isEdit = true
|
|
|
|
+ //var newObj = JSON.parse(JSON.stringify(row))
|
|
this.form = row
|
|
this.form = row
|
|
this.title = '修改'
|
|
this.title = '修改'
|
|
this.dialogType = 'edit'
|
|
this.dialogType = 'edit'
|
|
this.dialogFormVisible = true
|
|
this.dialogFormVisible = true
|
|
|
|
+ this.getQuartzBaseInCode(row.inCode)
|
|
},
|
|
},
|
|
handleDelete(row) {
|
|
handleDelete(row) {
|
|
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
|
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
|
await delObj(row.id)
|
|
await delObj(row.id)
|
|
- this.$baseMessage("删除成功", 'success')
|
|
|
|
|
|
+ this.$baseMessage('删除成功', 'success')
|
|
this.fetchData()
|
|
this.fetchData()
|
|
})
|
|
})
|
|
},
|
|
},
|
|
saveOrUpdate() {
|
|
saveOrUpdate() {
|
|
- this.form.nextFireTime = null;
|
|
|
|
- this.form.laetFireTime = null;
|
|
|
|
|
|
+ this.form.nextFireTime = null
|
|
|
|
+ this.form.laetFireTime = null
|
|
if (this.dialogType == 'add') {
|
|
if (this.dialogType == 'add') {
|
|
this.save()
|
|
this.save()
|
|
} else {
|
|
} else {
|
|
@@ -448,7 +462,6 @@
|
|
})
|
|
})
|
|
},
|
|
},
|
|
update() {
|
|
update() {
|
|
- console.log(this.form)
|
|
|
|
this.$refs.form.validate((valid) => {
|
|
this.$refs.form.validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
this.listLoading = true
|
|
this.listLoading = true
|
|
@@ -474,6 +487,21 @@
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ formatQuartz(row, column){
|
|
|
|
+ const selectedItem = this.quartzBaseAll.find((item) => {
|
|
|
|
+ return item.executeClass === row.executeClass
|
|
|
|
+ })
|
|
|
|
+ return selectedItem.name
|
|
|
|
+ },
|
|
|
|
+ formatStation(row, column){
|
|
|
|
+ const selectedItem = this.stations.find((item) => {
|
|
|
|
+ return item.stationCode === row.stationCode
|
|
|
|
+ })
|
|
|
|
+ return selectedItem.name
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
},
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|