<template>
|
<div class="JobRelatedEvents">
|
<div class="machineTableDetailsTitle">
|
<p>
|
关联事件
|
<span>{{ total }}</span>
|
件
|
</p>
|
</div>
|
<div class="search">
|
<div class="searchBox">
|
<div class="item">
|
<div class="itemchild">模糊查询:</div>
|
<el-input v-model="params.event_name" placeholder="请输入事件名称" clearable></el-input>
|
</div>
|
<!-- <div class="item">
|
<div class="itemchild">任务执行日期:</div>
|
<el-date-picker
|
popper-class="custom-date-picker"
|
class="tasktimer"
|
v-model="taskData"
|
type="date"
|
placeholder="请选择日期"
|
value-format="YYYY-MM-DD"
|
:disabled-date="disabledDate"
|
@change="changeselect"
|
/>
|
</div> -->
|
<div class="item">
|
<div class="itemchild">关联算法:</div>
|
<TaskAlgorithmBusiness :setWidth="186" :showAlgorithm="true" @algorithmChange="algorithmChange" />
|
</div>
|
</div>
|
<div class="search-btn">
|
<div class="btn search" @click="handleSearch"><img src="@/assets/images/task/search.png"/>搜索</div>
|
<div class="btn clear" @click="handleReset"><img src="@/assets/images/task/clear.png"/>清空</div>
|
</div>
|
</div>
|
|
<div class="ztzf-table">
|
<el-table
|
v-loading="loading"
|
:row-class-name="tableRowClassName"
|
:data="list"
|
style="width: 100%"
|
:row-style="{ height: '38px', fontSize: '14px', 'text-align': 'center' }"
|
:header-cell-style="{ 'text-align': 'center', height: '36px', fontSize: '14px' }"
|
>
|
<el-table-column label="序号" type="index" width="60" align="center">
|
<template #default="{ $index }">
|
{{ ($index + 1 + (sizeParams.current - 1) * sizeParams.size).toString().padStart(2, '0') }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="event_num" label="事件编号" align="center"/>
|
<el-table-column show-overflow-tooltip prop="event_name" label="事件名称" align="center"/>
|
<el-table-column show-overflow-tooltip prop="remark" label="事件地址" align="center"/>
|
<el-table-column show-overflow-tooltip prop="ai_types" label="关联算法" align="center"/>
|
<el-table-column show-overflow-tooltip prop="job_create_time" label="事件时间" align="center"/>
|
<el-table-column prop="status" label="事件状态" align="center">
|
<template #default="scope">
|
<div class="pending" v-if="scope.row.status === 0">待处理</div>
|
<div class="reviewed" v-if="scope.row.status === 2">待审核</div>
|
<div class="processing" v-if="scope.row.status === 3">处理中</div>
|
<div class="done" v-if="scope.row.status === 4">已完成</div>
|
<div class="ended" v-if="scope.row.status === 5">已完结</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" width="90" align="center">
|
<template #default="scope">
|
<div class="ztzf-view btnItem" @click="examine(scope.row)">查看</div>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<el-pagination
|
class="ztzf-pagination"
|
popper-class="custom-pagination-dropdown"
|
background
|
:page-sizes="[10, 20, 30, 50]"
|
v-model:current-page="sizeParams.current"
|
v-model:page-size="sizeParams.size"
|
layout=" prev, pager, next,sizes, jumper"
|
:total="total"
|
@change="pageChange"
|
/>
|
</div>
|
</template>
|
<script setup>
|
import { useStore } from 'vuex'
|
import { getDeviceEventList } from '@/api/job/task'
|
import { dayjs, ElMessage } from 'element-plus'
|
import { useRouter } from 'vue-router';
|
import { pxToRem } from '@/utils/rem'
|
import TaskAlgorithmBusiness from './TaskAlgorithmBusiness.vue'
|
const router = useRouter();
|
const emit = defineEmits(['refresh'])
|
const props = defineProps({
|
jobTimes: Array,
|
batchNo: Number,
|
})
|
const taskData = ref('')
|
const algorithmChange = val => {
|
params.value.ai_types = val
|
}
|
const loading = ref(false)
|
const list = ref()
|
const params = ref({
|
way_line_jod_info_id: null,
|
event_name: '',
|
ai_types: [], // 算法类型
|
start_date: null,
|
end_date: null,
|
})
|
const sizeParams = ref({
|
current: 1,
|
size: 10,
|
})
|
// 日期选择
|
const changeselect = () => {
|
params.value.start_date = taskData.value.length ? `${taskData.value} 00:00:00` : null
|
params.value.end_date = taskData.value.length ? `${taskData.value} 23:59:59` : null
|
}
|
const store = useStore()
|
const child_sn = computed(() => store.state.home.singleUavHome.child_sn)
|
const total = ref(0)
|
const examine = row => {
|
const orderNumber = row.event_num
|
router.push({
|
path: `/tickets/ticket`,
|
query: {
|
orderNumber,
|
},
|
});
|
}
|
const wayLineJodInfoId = inject('wayLineJodInfoId')
|
|
const getList = () => {
|
if (!wayLineJodInfoId.value) return
|
params.value.way_line_jod_info_id = wayLineJodInfoId.value
|
params.value.batchNo = props.batchNo
|
loading.value = true
|
getDeviceEventList(params.value, sizeParams.value).then(res => {
|
const resData = res?.data?.data || {}
|
list.value = resData.records
|
total.value = resData.total
|
loading.value = false
|
})
|
}
|
|
const pageChange = val => {
|
sizeParams.value.current = val
|
getList()
|
}
|
// 表格隔行变色
|
const tableRowClassName = ({ row, rowIndex }) => {
|
if (rowIndex % 2 === 1) {
|
return 'warning-row'
|
} else {
|
return 'success-row'
|
}
|
}
|
// 禁用当天之前的日期
|
const disabledDate = time => {
|
const curTime = dayjs(time).format('YYYY-MM-DD')
|
// console.log(curTime)
|
return !(props.jobTimes || []).includes(curTime)
|
}
|
const handleReset = () => {
|
params.value.ai_types = []
|
params.value.event_name = ''
|
params.value.end_date = null
|
params.value.start_date = null
|
taskData.value = ''
|
algorithmChange([])
|
getList()
|
}
|
const handleSearch = () => {
|
// console.log('sousuo', params.value)
|
|
getList()
|
}
|
onMounted(() => {
|
getList()
|
})
|
</script>
|
<style lang="scss">
|
// .custom-date-picker .el-picker-panel__content .el-date-table td.disabled div {
|
// background-color: #00193b !important;
|
// color: #505050 !important;
|
// cursor: not-allowed;
|
// }
|
</style>
|
<style scoped lang="scss">
|
.JobRelatedEvents {
|
.machineTableDetailsTitle {
|
margin-bottom: 16px;
|
background: url('/src/assets/images/task/detailtitle.png') no-repeat center;
|
background-size: 100% 100%;
|
p {
|
display: inline-block;
|
margin-left: 30px;
|
font-size: 16px;
|
color: #363636;
|
line-height: 20px;
|
text-align: left;
|
margin-bottom: 8px;
|
span {
|
font-size: 26px;
|
color: #0282ff;
|
font-weight: bold;
|
}
|
}
|
}
|
|
// 待处理
|
.pending {
|
color: #ff7411;
|
}
|
// 待审核
|
.reviewed {
|
color: #ff472f;
|
}
|
// 处理中
|
.processing {
|
color: #FFC300;
|
}
|
// 已完成
|
.done {
|
color: #06d957;
|
}
|
// 已完结
|
.ended {
|
color: #06d957;
|
}
|
.search {
|
display: flex;
|
justify-content: space-between;
|
margin-bottom: 19px; // 添加底部间距
|
.item {
|
position: relative;
|
display: flex;
|
align-items: center;
|
font-size: 14px;
|
color: #363636;
|
margin-right: 20px;
|
.itemchild {
|
white-space: nowrap;
|
margin-right: 5px;
|
}
|
:deep(.el-date-editor.el-input__wrapper) {
|
width: 200px; // 调整日期选择器宽度
|
}
|
}
|
.item:nth-last-child {
|
margin-right: 113px;
|
}
|
}
|
.searchBox {
|
display: flex;
|
}
|
|
.search-btn {
|
display: flex;
|
justify-content: space-between;
|
font-size: 14px;
|
|
.btn {
|
width: 80px;
|
height: 32px;
|
border-radius: 4px 4px 4px 4px;
|
line-height: 32px;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
|
img {
|
width: 14px;
|
height: 14px;
|
}
|
}
|
.search {
|
background: #409EFF;
|
color: #fff;
|
margin-right: 10px;
|
cursor: pointer;
|
}
|
.clear {
|
border: 1px solid #D2D1D1;
|
color: #676767;
|
margin-right: 10px;
|
cursor: pointer;
|
}
|
.add {
|
background: #FF9243;
|
color: #fff;
|
}
|
}
|
.btnItem {
|
height: 27px;
|
line-height: 27px;
|
border-radius: 0px 0px 0px 0px;
|
border: 1px solid #51a8ff;
|
font-family: Segoe UI, Segoe UI;
|
font-weight: 400;
|
font-size: 14px;
|
color: #1C5CFF;
|
padding: 0 10px;
|
display: inline-block;
|
margin-right: 10px;
|
cursor: pointer;
|
}
|
}
|
|
</style>
|