95 lines
3.5 KiB
Vue
95 lines
3.5 KiB
Vue
|
|
<template>
|
|||
|
|
<div class="app-container">
|
|||
|
|
<!--工具栏-->
|
|||
|
|
<div class="head-container">
|
|||
|
|
<div v-if="crud.props.searchToggle">
|
|||
|
|
<!-- 搜索 -->
|
|||
|
|
<el-input v-model="query.name" clearable size="mini" placeholder="输入名称" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
|||
|
|
<date-range-picker v-model="query.createTime" class="date-item" />
|
|||
|
|
<rrOperation />
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!--表格渲染-->
|
|||
|
|
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
|||
|
|
<el-table-column :selectable="checkboxT" type="selection" width="55" />
|
|||
|
|
<el-table-column show-overflow-tooltip prop="name" label="名称" />
|
|||
|
|
<el-table-column :show-overflow-tooltip="false" prop="code" label="编号" width="200" />
|
|||
|
|
<el-table-column show-overflow-tooltip prop="status" label="状态" />
|
|||
|
|
<el-table-column show-overflow-tooltip prop="thread_name" label="线程名" />
|
|||
|
|
<el-table-column show-overflow-tooltip prop="thread_state" label="线程状态" />
|
|||
|
|
<el-table-column show-overflow-tooltip prop="usedStatus" label="使用状态" />
|
|||
|
|
<el-table-column show-overflow-tooltip prop="stopMessage" width="90px" label="停止信息" />
|
|||
|
|
<el-table-column v-permission="['admin','timing:edit','timing:del']" label="操作" width="170px" align="center" fixed="right">
|
|||
|
|
<template slot-scope="scope">
|
|||
|
|
<el-button v-permission="['admin','timing:edit']" style="margin-left: -2px" type="text" size="mini" @click="start(scope.row.code)">启动</el-button>
|
|||
|
|
<el-popover
|
|||
|
|
:ref="scope.row.code"
|
|||
|
|
placement="top"
|
|||
|
|
width="200"
|
|||
|
|
>
|
|||
|
|
<p>确定停止该线程吗?</p>
|
|||
|
|
<div style="text-align: right; margin: 0">
|
|||
|
|
<el-button size="mini" type="text" @click="$refs[scope.row.code].doClose()">取消</el-button>
|
|||
|
|
<el-button :loading="delLoading" type="primary" size="mini" @click="stop(scope.row.code)">确定</el-button>
|
|||
|
|
</div>
|
|||
|
|
<el-button slot="reference" type="text" size="mini">停止</el-button>
|
|||
|
|
</el-popover>
|
|||
|
|
|
|||
|
|
</template>
|
|||
|
|
</el-table-column>
|
|||
|
|
</el-table>
|
|||
|
|
<!--分页组件-->
|
|||
|
|
<pagination />
|
|||
|
|
</div>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
import crudAutoRun from '@/api/system/autorun'
|
|||
|
|
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
|||
|
|
import rrOperation from '@crud/RR.operation'
|
|||
|
|
import crudOperation from '@crud/CRUD.operation'
|
|||
|
|
import pagination from '@crud/Pagination'
|
|||
|
|
import crudJob from '@/api/system/timing'
|
|||
|
|
|
|||
|
|
export default {
|
|||
|
|
name: 'Autorun',
|
|||
|
|
components: { pagination, crudOperation, rrOperation },
|
|||
|
|
cruds() {
|
|||
|
|
return CRUD({ title: '自动线程', url: 'api/autorun', crudMethod: { ...crudAutoRun }})
|
|||
|
|
},
|
|||
|
|
mixins: [presenter(), header(), crud()],
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
stopLoading: false,
|
|||
|
|
permission: {
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
rules: {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
start(id) {
|
|||
|
|
crudAutoRun.start(id).then(res => {
|
|||
|
|
this.crud.notify('启动成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
|||
|
|
this.crud.toQuery()
|
|||
|
|
}).catch(err => {
|
|||
|
|
console.log(err.response.data.message)
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
stop(id) {
|
|||
|
|
this.stopLoading = true
|
|||
|
|
crudAutoRun.stop([id]).then(() => {
|
|||
|
|
this.stopLoading = false
|
|||
|
|
this.$refs[id].doClose()
|
|||
|
|
this.crud.toQuery()
|
|||
|
|
}).catch(() => {
|
|||
|
|
this.stopLoading = false
|
|||
|
|
this.$refs[id].doClose()
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</script>
|