修改测试用例1
This commit is contained in:
@@ -1,20 +1,30 @@
|
||||
import createAxios from '@/utils/request'
|
||||
|
||||
// 更新问题状态
|
||||
export function auditFeedBack(data: any) {
|
||||
return createAxios({
|
||||
url: '/cs-system-boot/feedback/auditFeedBack',
|
||||
method: 'post',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
//下载文件
|
||||
export function downLoadFile(filePath: any) {
|
||||
return createAxios({
|
||||
url: '/system-boot/file/download',
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
params: { filePath: filePath }
|
||||
})
|
||||
import createAxios from '@/utils/request'
|
||||
|
||||
// 更新问题状态
|
||||
export function auditFeedBack(data: any) {
|
||||
return createAxios({
|
||||
url: '/cs-system-boot/feedback/auditFeedBack',
|
||||
method: 'post',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
//下载文件
|
||||
export function downLoadFile(filePath: any) {
|
||||
return createAxios({
|
||||
url: '/system-boot/file/download',
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
params: { filePath: filePath }
|
||||
})
|
||||
}
|
||||
|
||||
//获取文件的一个短期url
|
||||
export function getFileUrl(filePath: any) {
|
||||
return createAxios({
|
||||
url: '/system-boot/file/getFileUrl',
|
||||
method: 'get',
|
||||
// responseType: 'blob',
|
||||
params: { filePath: filePath }
|
||||
})
|
||||
}
|
||||
@@ -218,11 +218,12 @@ const updateNodeCheckStatus = (currentCount: number) => {
|
||||
const allNodes = treeRef.value.store._getAllNodes()
|
||||
allNodes.forEach((node: any) => {
|
||||
if (node.level === 3) { // 监测点层级
|
||||
|
||||
// 如果已达到最大数量且该节点未被选中,则禁用勾选
|
||||
if (isMaxSelected && !node.checked) {
|
||||
node.disabled = true
|
||||
if (isMaxSelected && !node.data.checked) {
|
||||
node.data.disabled = true
|
||||
} else {
|
||||
node.disabled = false
|
||||
node.data.disabled = false
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog class="cn-operate-dialog" width="700px" v-model.trim="dialogVisible" :title="title">
|
||||
<el-dialog class="cn-operate-dialog" width="500px" v-model.trim="dialogVisible" :title="title">
|
||||
<el-form :inline="false" ref="formRef" :model="form" label-width="auto" class="form-one" :rules="rules">
|
||||
<el-form-item label="角色名称" prop="name">
|
||||
<el-input maxlength="32" show-word-limit v-model.trim="form.name" placeholder="请输入菜单名称" />
|
||||
|
||||
@@ -646,7 +646,8 @@
|
||||
:controls="false"
|
||||
:min="1"
|
||||
style="width: 48%"
|
||||
v-model="lineItem.ptRatio"
|
||||
oninput="value=value.replace(/[^\d]/g,'')"
|
||||
v-model.number="lineItem.ptRatio"
|
||||
:disabled="
|
||||
!(
|
||||
(nodeLevel == 4 && pageStatus == 3) ||
|
||||
@@ -670,7 +671,8 @@
|
||||
:controls="false"
|
||||
:min="1"
|
||||
style="width: 48%"
|
||||
v-model="lineItem.pt2Ratio"
|
||||
oninput="value=value.replace(/[^\d]/g,'')"
|
||||
v-model.number="lineItem.pt2Ratio"
|
||||
:disabled="
|
||||
!(
|
||||
(nodeLevel == 4 && pageStatus == 3) ||
|
||||
@@ -694,7 +696,8 @@
|
||||
:controls="false"
|
||||
:min="1"
|
||||
style="width: 48%"
|
||||
v-model="lineItem.ctRatio"
|
||||
oninput="value=value.replace(/[^\d]/g,'')"
|
||||
v-model.number="lineItem.ctRatio"
|
||||
:disabled="
|
||||
!(
|
||||
(nodeLevel == 4 && pageStatus == 3) ||
|
||||
@@ -718,7 +721,8 @@
|
||||
:controls="false"
|
||||
:min="1"
|
||||
style="width: 48%"
|
||||
v-model="lineItem.ct2Ratio"
|
||||
oninput="value=value.replace(/[^\d]/g,'')"
|
||||
v-model.number="lineItem.ct2Ratio"
|
||||
:disabled="
|
||||
!(
|
||||
(nodeLevel == 4 && pageStatus == 3) ||
|
||||
@@ -1037,8 +1041,8 @@
|
||||
<Loading />
|
||||
</el-icon>
|
||||
<p style="margin-top: 15px; font-size: 16px">正在推送台账信息,请稍候...</p>
|
||||
<p style="margin-top: 10px; color: #999">预计需要30秒左右</p>
|
||||
<p style="margin-top: 10px; color: #999">已等待: {{ countdown }}秒</p>
|
||||
<!-- <p style="margin-top: 10px; color: #999">预计需要30秒左右</p>
|
||||
<p style="margin-top: 10px; color: #999">已等待: {{ countdown }}秒</p> -->
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
@@ -1360,7 +1364,7 @@ const onAdd = async () => {
|
||||
if (timer.value) clearInterval(timer.value)
|
||||
timer.value = window.setInterval(() => {
|
||||
countdown.value++
|
||||
if (countdown.value >= 30) {
|
||||
if (countdown.value >= 5) {
|
||||
clearInterval(timer.value!)
|
||||
timer.value = null
|
||||
}
|
||||
@@ -1388,7 +1392,7 @@ const onAdd = async () => {
|
||||
// 如果data不是"暂无需要推送的数据",则继续执行
|
||||
if (pushLogResponse.data === '成功') {
|
||||
// 等待30秒
|
||||
await new Promise(resolve => setTimeout(resolve, 30000))
|
||||
await new Promise(resolve => setTimeout(resolve, 5000))
|
||||
|
||||
// 30秒后调用查询推送结果接口
|
||||
const result = await queryPushResult()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -51,7 +51,7 @@
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
<PopupDictionary ref="popupDictionary" v-if="show" @close="show=false"></PopupDictionary>
|
||||
<PopupDictionary ref="popupDictionary" v-if="show" @close="show = false"></PopupDictionary>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@@ -90,7 +90,20 @@ const tableStore = new TableStore({
|
||||
{ title: '别名', field: 'otherName', minWidth: 220 },
|
||||
{ title: '展示名称', field: 'showName', minWidth: 170 },
|
||||
{ title: '告警码', field: 'defaultValue', minWidth: 170 },
|
||||
{ title: '相别', field: 'phaseName', minWidth: 80 },
|
||||
{
|
||||
title: '相别',
|
||||
field: 'phase',
|
||||
minWidth: 80,
|
||||
formatter: (row: any) => {
|
||||
return row.cellValue
|
||||
? row.cellValue == '/'
|
||||
? '/'
|
||||
: row.cellValue == 'M'
|
||||
? '无相别'
|
||||
: row.cellValue + '相'
|
||||
: '/'
|
||||
}
|
||||
},
|
||||
{ title: '单位', field: 'unit', minWidth: 80 },
|
||||
{ title: '基础数据类型', field: 'type', minWidth: 170 },
|
||||
{ title: '数据谐波次数', field: 'harmStartEnd', minWidth: 170 },
|
||||
@@ -143,7 +156,7 @@ const tableStore = new TableStore({
|
||||
tableStore.table.data.forEach((item: any) => {
|
||||
item.classIdName = DataSelect.find((child: any) => child.id == item.classId)?.name || '/'
|
||||
item.resourcesIdName = ResourcesIdSelect.find((child: any) => child.id == item.resourcesId)?.name || '/'
|
||||
item.phaseName = item.phase === 'M' ? '/' : item.phase || '/'
|
||||
// item.phaseName = item.phase === 'M' ? '无相别' : item.phase || '/'
|
||||
item.harmStartEnd = item.harmEnd ? item.harmStart + '-' + item.harmEnd : '/'
|
||||
for (let key in item) {
|
||||
if (typeof item[key] !== 'number') {
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
placeholder="请输入单位"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="基础数据类型:" >
|
||||
<el-form-item label="基础数据类型:">
|
||||
<el-input
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
@@ -284,7 +284,23 @@ const phaseSelect = [
|
||||
{
|
||||
name: 'T相',
|
||||
id: 'T'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'AB相',
|
||||
id: 'AB'
|
||||
},
|
||||
{
|
||||
name: 'BC相',
|
||||
id: 'BC'
|
||||
},
|
||||
{
|
||||
name: 'CA相',
|
||||
id: 'CA'
|
||||
},
|
||||
{
|
||||
name: '无相别',
|
||||
id: 'M'
|
||||
},
|
||||
]
|
||||
const StatMethodSelect = [
|
||||
{
|
||||
@@ -372,8 +388,8 @@ const open = (text: string, data?: anyObj) => {
|
||||
if (data) {
|
||||
for (let key in form) {
|
||||
if (key == 'statMethod') {
|
||||
form[key] = data[key].split(',')
|
||||
} else {
|
||||
form[key] = data[key] == '/' ? [] : data[key].split(',')
|
||||
} else {
|
||||
form[key] = data[key] === '/' ? null : data[key]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :model="form" label-width="100px" class="mt10 form-one" >
|
||||
<el-form :model="form" label-width="100px" class="mt10 form-one">
|
||||
<el-form-item label="描述:" prop="description">
|
||||
<el-input
|
||||
maxlength="300"
|
||||
@@ -103,6 +103,7 @@
|
||||
<el-form-item label="升级文件:" prop="file">
|
||||
<el-upload
|
||||
:limit="1"
|
||||
accept=".bin"
|
||||
:auto-upload="false"
|
||||
:on-change="fileChange"
|
||||
:on-exceed="fileExceed"
|
||||
@@ -212,12 +213,27 @@ const formDevModelOptionsFilter = computed(() => {
|
||||
})
|
||||
})
|
||||
const fileChange = (e: any) => {
|
||||
if (!beforeUpload(e.raw)) return
|
||||
form.file = e.raw
|
||||
fileList.value = [e.raw]
|
||||
}
|
||||
const fileExceed = (e: any) => {
|
||||
ElMessage.error('只能上传一个文件')
|
||||
}
|
||||
// 处理上传前检查
|
||||
const beforeUpload = (file: any) => {
|
||||
const isWord = file.name.endsWith('.bin')
|
||||
|
||||
if (!isWord) {
|
||||
ElMessage.error('请上传(.bin)格式文件!')
|
||||
fileList.value = []
|
||||
return false
|
||||
}
|
||||
|
||||
// 校验通过后允许上传,交由 http-request 处理
|
||||
return true
|
||||
}
|
||||
|
||||
const fileRemove = (e: any) => {
|
||||
form.file = null
|
||||
fileList.value = []
|
||||
|
||||
@@ -33,7 +33,7 @@ import { useDictData } from '@/stores/dictData'
|
||||
import PopupVersion from '@/views/govern/manage/basic/popupVersion.vue'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { auditEdData } from '@/api/cs-device-boot/edData'
|
||||
|
||||
import { getFileUrl, downLoadFile } from '@/api/cs-system-boot/manage'
|
||||
defineOptions({
|
||||
name: 'govern/manage/basic/version'
|
||||
})
|
||||
@@ -72,6 +72,16 @@ const tableStore = new TableStore({
|
||||
width: '180',
|
||||
render: 'buttons',
|
||||
buttons: [
|
||||
{
|
||||
name: 'productSetting',
|
||||
title: '下载文件',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
downloadTheReport(row.filePath)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '编辑',
|
||||
@@ -151,11 +161,30 @@ queryByCode('Device_Type').then(res => {
|
||||
res1.data.splice(index, 1)
|
||||
}
|
||||
})
|
||||
console.log('🚀 ~ res1.data.map ~ res1.data:', res1.data)
|
||||
|
||||
DevTypeOptions.value = res1.data
|
||||
})
|
||||
})
|
||||
// 下载报告
|
||||
const downloadTheReport = (name: string) => {
|
||||
getFileUrl(name).then((res: any) => {
|
||||
|
||||
downLoadFile(res.data).then(res => {
|
||||
let blob = new Blob([res], {
|
||||
type: 'application/octet-stream'
|
||||
})
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a') // 创建a标签
|
||||
link.href = url
|
||||
link.download = name.split('/').pop() || '升级文件' // 设置下载的文件名
|
||||
document.body.appendChild(link)
|
||||
link.click() //执行下载
|
||||
document.body.removeChild(link)
|
||||
ElMessage.success('下载成功')
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
tableStore.table.params.devType = ''
|
||||
provide('tableStore', tableStore)
|
||||
onMounted(() => {
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
<template>
|
||||
<div class="view" style="height: 100%">
|
||||
<TableHeader
|
||||
datePicker
|
||||
ref="headerRef"
|
||||
>
|
||||
<TableHeader datePicker ref="headerRef">
|
||||
<template v-slot:operation>
|
||||
<el-button type="primary" :icon="Setting" @click="exportTab">补召</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
<Table ref="tableRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted, provide, nextTick, defineEmits, watch } from 'vue'
|
||||
import { ref, onMounted, provide, nextTick, watch } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import { ElMessage, ElTree } from 'element-plus'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { Setting } from '@element-plus/icons-vue'
|
||||
|
||||
@@ -24,7 +22,7 @@ const props = defineProps({
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
const tableParams: any = ref({})
|
||||
const headerRef = ref()
|
||||
@@ -35,7 +33,9 @@ const tableStore: any = new TableStore({
|
||||
method: 'POST',
|
||||
column: [
|
||||
{
|
||||
title: '序号', width: 80, formatter: (row: any) => {
|
||||
title: '序号',
|
||||
width: 80,
|
||||
formatter: (row: any) => {
|
||||
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
||||
}
|
||||
},
|
||||
@@ -49,7 +49,7 @@ const tableStore: any = new TableStore({
|
||||
},
|
||||
{ field: 'successCount', title: '成功解析数', minWidth: 150 },
|
||||
{ field: 'startTime', title: '导入开始时间', minWidth: 170, sortable: true },
|
||||
{ field: 'endTime', title: '导入结束时间', minWidth: 170 , sortable: true},
|
||||
{ field: 'endTime', title: '导入结束时间', minWidth: 170, sortable: true },
|
||||
{
|
||||
title: '解析状态',
|
||||
field: 'status',
|
||||
@@ -79,30 +79,27 @@ const tableStore: any = new TableStore({
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
}
|
||||
click: row => {}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
beforeSearchFun: () => {
|
||||
|
||||
},
|
||||
loadCallback: () => {
|
||||
|
||||
}
|
||||
beforeSearchFun: () => {},
|
||||
loadCallback: () => {}
|
||||
})
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
|
||||
const exportTab = () => {
|
||||
ElMessage.info('稳态补召功能暂未开发!')
|
||||
}
|
||||
//获取请求参数
|
||||
const getTableParams = (val: any) => {
|
||||
tableParams.value = val
|
||||
tableStore.index()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
defineExpose({
|
||||
getTableParams
|
||||
})
|
||||
|
||||
@@ -129,4 +126,4 @@ onMounted(() => {
|
||||
.view :deep(.el-table) {
|
||||
height: calc(100% - 56px);
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -28,7 +28,13 @@
|
||||
<span style="display: flex; align-items: center">
|
||||
{{ item.name }}
|
||||
|
||||
<el-tooltip class="item" effect="dark" content="修改项目" placement="top" v-if="hasAdmin || item.createBy == adminInfo.id">
|
||||
<el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
content="修改项目"
|
||||
placement="top"
|
||||
v-if="hasAdmin || item.createBy == adminInfo.id"
|
||||
>
|
||||
<Edit
|
||||
style="margin-left: 5px; width: 16px"
|
||||
class="xiaoshou color"
|
||||
@@ -121,7 +127,9 @@ defineOptions({
|
||||
})
|
||||
const adminInfo = useAdminInfo()
|
||||
|
||||
const hasAdmin = adminInfo.roleCode.some(item => item.includes('operation_manager')|| item.includes('root'))
|
||||
const hasAdmin =
|
||||
adminInfo.userType.some(item => item.includes('operation_manager') || item.includes('root')) ||
|
||||
adminInfo.userType == 1
|
||||
const tableRef = ref()
|
||||
const popupRef = ref()
|
||||
let DOMIN = window.location.origin
|
||||
|
||||
@@ -81,7 +81,8 @@ const route = useRouter()
|
||||
const navTabs = useNavTabs()
|
||||
const adminInfo = useAdminInfo()
|
||||
const pageList: any = ref([])
|
||||
const hasAdmin = adminInfo.roleCode.some(item => item.includes('operation_manager') || item.includes('root'))
|
||||
const hasAdmin = adminInfo.roleCode.some(item => item.includes('operation_manager') || item.includes('root'))||
|
||||
adminInfo.userType == 1
|
||||
|
||||
const open = () => {
|
||||
dialogVisible.value = true
|
||||
|
||||
@@ -98,7 +98,8 @@ const route = useRoute()
|
||||
const timeCacheStore = useTimeCacheStore()
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
const adminInfo = useAdminInfo()
|
||||
const hasAdmin = adminInfo.roleCode.some(item => item.includes('operation_manager') || item.includes('root'))
|
||||
const hasAdmin = adminInfo.roleCode.some(item => item.includes('operation_manager') || item.includes('root'))||
|
||||
adminInfo.userType == 1
|
||||
defineOptions({
|
||||
// name: 'dashboard/index'
|
||||
})
|
||||
|
||||
@@ -177,7 +177,9 @@ import { id } from 'element-plus/es/locale'
|
||||
// name: 'cockpit/popup'
|
||||
// })
|
||||
const adminInfo = useAdminInfo()
|
||||
const hasAdmin = adminInfo.roleCode.some(item => item.includes('operation_manager') || item.includes('root'))
|
||||
const hasAdmin =
|
||||
adminInfo.roleCode.some(item => item.includes('operation_manager') || item.includes('root')) ||
|
||||
adminInfo.userType == 1
|
||||
|
||||
const { go } = useRouter()
|
||||
const navTabs = useNavTabs()
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
<el-form-item label="任务表达式" prop="cron">
|
||||
<el-input v-model.trim="form.cron" clearable placeholder="请输入任务表达式" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序">
|
||||
<el-form-item label="排序" prop="sort">
|
||||
|
||||
<el-input-number style="width: 100%" v-model.number="form.sort" :min="0" placeholder="请输入排序" />
|
||||
<el-input style="width: 100%" v-model.number.trim="form.sort" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model.trim="form.remark" clearable :rows="2" type="textarea" placeholder="请输入备注" />
|
||||
@@ -56,12 +56,13 @@ const actionClassesOptions = ref([])
|
||||
const rules = {
|
||||
actionClass: [{ required: true, message: '请选择任务执行器', trigger: 'change' }],
|
||||
timerName: [{ required: true, message: '请输入任务名称', trigger: 'blur' }],
|
||||
cron: [{ required: true, message: '任务表达式', trigger: 'blur' }],
|
||||
sort: [{ required: true, message: '排序号', trigger: 'blur' }],
|
||||
date: [{ required: true, message: '日期不可为空', trigger: 'blur' }],
|
||||
cron: [{ required: true, message: '请输入任务表达式', trigger: 'blur' }],
|
||||
sort: [{ required: true, message: '请输入排序', trigger: 'blur' }],
|
||||
date: [{ required: true, message: '请输入日期', trigger: 'blur' }],
|
||||
}
|
||||
|
||||
const open = (text: string, data?: anyObj) => {
|
||||
formRef.value?.resetFields()
|
||||
title.value = text
|
||||
dialogVisible.value = true
|
||||
if (data) {
|
||||
|
||||
@@ -1,206 +1,208 @@
|
||||
<template>
|
||||
<div class="default-main">
|
||||
<div>
|
||||
<TableHeader ref="TableHeaderRef">
|
||||
<template #select>
|
||||
<el-form-item label="任务名称">
|
||||
<el-input v-model="tableStore.table.params.searchValue" maxlength="32" show-word-limit clearable
|
||||
placeholder="请输入任务名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务状态:">
|
||||
<el-select v-model="tableStore.table.params.searchState" clearable placeholder="请选择任务状态">
|
||||
<el-option label="运行" :value="1"></el-option>
|
||||
<el-option label="停止" :value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="add">新增定时任务</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
</div>
|
||||
<!-- 新增 -->
|
||||
<taskForm ref="taskFormRef" @submit="tableStore.index()" />
|
||||
<!-- 补招 -->
|
||||
<el-dialog v-model="dialogVisible" title="选择补招时间" width="500">
|
||||
<el-date-picker v-model="formDate.date" type="date" value-format="YYYY-MM-DD" placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
<template #footer>
|
||||
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="okRun">
|
||||
确认
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, provide, } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import taskForm from '@/views/system/scheduledTasks/form.vue'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import { ElMessage, ElMessageBox, ElDatePicker } from 'element-plus'
|
||||
import { timerRun, runTimer, deleteTimer, stop, start } from '@/api/system-boot/csDictData'
|
||||
defineOptions({
|
||||
name: 'Distributedphotovoltaic/templateConfiguration'
|
||||
})
|
||||
const formDate = ref({
|
||||
date: '',
|
||||
id: ''
|
||||
})
|
||||
const taskFormRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const selectedTime = ref('')
|
||||
const tableStore: any = new TableStore({
|
||||
url: '/system-boot/timer/list',
|
||||
method: 'POST',
|
||||
isWebPaging: true,
|
||||
column: [
|
||||
{ field: 'timerName', title: '任务名称', },
|
||||
{ field: 'actionClass', title: '任务执行器' },
|
||||
{ field: 'cron', title: '定时任务表达式' },
|
||||
{ field: 'remark', title: '备注' },
|
||||
// {
|
||||
// field: 'jobStatus', title: '状态', width: '100',
|
||||
// render: 'tag',
|
||||
// custom: {
|
||||
// 0: 'danger',
|
||||
// 1: 'success',
|
||||
// 2: 'danger'
|
||||
// },
|
||||
// replaceValue: {
|
||||
// 0: '未启动',
|
||||
// 1: '运行中',
|
||||
// 2: '未启动',
|
||||
// }
|
||||
// },
|
||||
{
|
||||
title: '状态',
|
||||
render: 'switch',
|
||||
width: 100,
|
||||
field: 'jobStatus',
|
||||
activeText: '运行中',
|
||||
activeValue: '1',
|
||||
inactiveText: '未启动',
|
||||
inactiveValue: '2',
|
||||
onChangeField: (row: any, value: any) => {
|
||||
if (row.jobStatus == 1) {
|
||||
stop({ id: row.id }).then(res => {
|
||||
ElMessage.success(res.message)
|
||||
tableStore.index()
|
||||
})
|
||||
}else{
|
||||
start({ id: row.id }).then(res => {
|
||||
ElMessage.success(res.message)
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
{ field: 'sort', title: '排序', width: '80' },
|
||||
{
|
||||
title: '操作',
|
||||
width: '220',
|
||||
render: 'buttons',
|
||||
buttons: [
|
||||
{
|
||||
name: 'primary',
|
||||
title: '执行',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Delete',
|
||||
render: 'confirmButton',
|
||||
popconfirm: {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'primary',
|
||||
title: '是否确认执行该定时任务'
|
||||
},
|
||||
click: row => {
|
||||
timerRun({ id: row.id }).then(res => {
|
||||
ElMessage.success('执行成功')
|
||||
tableStore.index()
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
|
||||
click: async row => {
|
||||
taskFormRef.value.open('编辑定时任务', row)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '补招',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
|
||||
click: async row => {
|
||||
formDate.value.date = formatDate(new Date(), 'YYYY-MM-DD')
|
||||
formDate.value.id = row.id
|
||||
dialogVisible.value = true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'del',
|
||||
text: '删除',
|
||||
type: 'danger',
|
||||
icon: 'el-icon-Delete',
|
||||
render: 'confirmButton',
|
||||
popconfirm: {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'danger',
|
||||
title: '确定删除?'
|
||||
},
|
||||
click: row => {
|
||||
deleteTimer([row.id]).then(res => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
loadCallback: () => { }
|
||||
})
|
||||
tableStore.table.params.searchValue = ''
|
||||
tableStore.table.params.searchState = ''
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
const add = () => {
|
||||
|
||||
setTimeout(() => {
|
||||
taskFormRef.value.open('新增定时任务')
|
||||
}, 10)
|
||||
}
|
||||
const okRun = () => {
|
||||
runTimer(formDate.value).then(res => {
|
||||
ElMessage.success('操作成功')
|
||||
dialogVisible.value = false
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<div class="default-main">
|
||||
<div>
|
||||
<TableHeader ref="TableHeaderRef">
|
||||
<template #select>
|
||||
<el-form-item label="任务名称">
|
||||
<el-input
|
||||
v-model="tableStore.table.params.searchValue"
|
||||
maxlength="32"
|
||||
show-word-limit
|
||||
clearable
|
||||
placeholder="请输入任务名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务状态:">
|
||||
<el-select v-model="tableStore.table.params.searchState" clearable placeholder="请选择任务状态">
|
||||
<el-option label="运行" :value="1"></el-option>
|
||||
<el-option label="停止" :value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="add">新增定时任务</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
</div>
|
||||
<!-- 新增 -->
|
||||
<taskForm ref="taskFormRef" @submit="tableStore.index()" />
|
||||
<!-- 补招 -->
|
||||
<el-dialog v-model="dialogVisible" title="选择补招时间" width="500">
|
||||
<el-date-picker
|
||||
v-model="formDate.date"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择日期"
|
||||
></el-date-picker>
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="okRun">确认</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, provide } from 'vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import taskForm from '@/views/system/scheduledTasks/form.vue'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import { ElMessage, ElMessageBox, ElDatePicker } from 'element-plus'
|
||||
import { timerRun, runTimer, deleteTimer, stop, start } from '@/api/system-boot/csDictData'
|
||||
defineOptions({
|
||||
name: 'Distributedphotovoltaic/templateConfiguration'
|
||||
})
|
||||
const formDate = ref({
|
||||
date: '',
|
||||
id: ''
|
||||
})
|
||||
const taskFormRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const selectedTime = ref('')
|
||||
const tableStore: any = new TableStore({
|
||||
url: '/system-boot/timer/list',
|
||||
method: 'POST',
|
||||
isWebPaging: true,
|
||||
column: [
|
||||
{ field: 'timerName', title: '任务名称' },
|
||||
{ field: 'actionClass', title: '任务执行器' },
|
||||
{ field: 'cron', title: '定时任务表达式' },
|
||||
{ field: 'remark', title: '备注' },
|
||||
// {
|
||||
// field: 'jobStatus', title: '状态', width: '100',
|
||||
// render: 'tag',
|
||||
// custom: {
|
||||
// 0: 'danger',
|
||||
// 1: 'success',
|
||||
// 2: 'danger'
|
||||
// },
|
||||
// replaceValue: {
|
||||
// 0: '未启动',
|
||||
// 1: '运行中',
|
||||
// 2: '未启动',
|
||||
// }
|
||||
// },
|
||||
{
|
||||
title: '状态',
|
||||
render: 'switch',
|
||||
width: 100,
|
||||
field: 'jobStatus',
|
||||
activeText: '运行中',
|
||||
activeValue: '1',
|
||||
inactiveText: '未启动',
|
||||
inactiveValue: '2',
|
||||
onChangeField: (row: any, value: any) => {
|
||||
if (row.jobStatus == 1) {
|
||||
stop({ id: row.id }).then(res => {
|
||||
ElMessage.success(res.message)
|
||||
tableStore.index()
|
||||
})
|
||||
} else {
|
||||
start({ id: row.id }).then(res => {
|
||||
ElMessage.success(res.message)
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'sort', title: '排序', width: '80' },
|
||||
{
|
||||
title: '操作',
|
||||
width: '220',
|
||||
render: 'buttons',
|
||||
buttons: [
|
||||
{
|
||||
name: 'primary',
|
||||
title: '执行',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Delete',
|
||||
render: 'confirmButton',
|
||||
popconfirm: {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'primary',
|
||||
title: '是否确认执行该定时任务'
|
||||
},
|
||||
click: row => {
|
||||
timerRun({ id: row.id }).then(res => {
|
||||
ElMessage.success('执行成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
|
||||
click: async row => {
|
||||
taskFormRef.value.open('编辑定时任务', row)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '补招',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
|
||||
click: async row => {
|
||||
formDate.value.date = formatDate(new Date(), 'YYYY-MM-DD')
|
||||
formDate.value.id = row.id
|
||||
dialogVisible.value = true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'del',
|
||||
text: '删除',
|
||||
type: 'danger',
|
||||
icon: 'el-icon-Delete',
|
||||
render: 'confirmButton',
|
||||
popconfirm: {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'danger',
|
||||
title: '确定删除?'
|
||||
},
|
||||
click: row => {
|
||||
deleteTimer([row.id]).then(res => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
loadCallback: () => {}
|
||||
})
|
||||
tableStore.table.params.searchValue = ''
|
||||
tableStore.table.params.searchState = ''
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
const add = () => {
|
||||
setTimeout(() => {
|
||||
taskFormRef.value.open('新增定时任务')
|
||||
}, 10)
|
||||
}
|
||||
const okRun = () => {
|
||||
if (!formDate.value?.date) {
|
||||
ElMessage.warning('请选择补招时间')
|
||||
return
|
||||
}
|
||||
runTimer(formDate.value).then(res => {
|
||||
ElMessage.success('操作成功')
|
||||
dialogVisible.value = false
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user