事件批量删除

This commit is contained in:
shijing 2024-02-19 17:08:05 +08:00
parent a2e91fa968
commit 594a217af2
1 changed files with 73 additions and 119 deletions

View File

@ -2,74 +2,30 @@
<el-container>
<el-header>
<div class="left-panel">
<el-select
v-model="query.cates"
placeholder="事件种类"
@change="handleQuery"
clearable
>
<el-option
v-for="item in cateOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
<el-select v-model="query.cates" placeholder="事件种类" @change="handleQuery" clearable>
<el-option v-for="item in cateOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
<el-select
v-model="query.area"
placeholder="发生区域"
@change="handleQuery"
style="margin-left:2px"
clearable
filterable
>
<el-option
v-for="item in areaOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
<el-select v-model="query.area" placeholder="发生区域" @change="handleQuery" style="margin-left:2px" clearable
filterable>
<el-option v-for="item in areaOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
<el-date-picker
v-model="timeRange"
type="datetimerange"
range-separator="至"
start-placeholder="发生时间始"
end-placeholder="发生时间止"
style="margin-left:2px"
value-format="YYYY-MM-DD HH:mm:ss"
@change="handleQuery"
clearable
/>
<el-date-picker v-model="timeRange" type="datetimerange" range-separator="" start-placeholder="发生时间始"
end-placeholder="发生时间止" style="margin-left:2px" value-format="YYYY-MM-DD HH:mm:ss" @change="handleQuery"
clearable />
<el-button type="danger" @click="handleDelete">批量删除</el-button>
</div>
<div class="right-panel">
<el-button
type="primary"
:loading = 'dLoading'
icon="el-icon-download"
@click="exportList"
>下载</el-button>
<el-button type="primary" :loading='dLoading' icon="el-icon-download" @click="exportList">下载</el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
fit
stripe
@resetQuery="resetQuery"
>
<scTable ref="table" :apiObj="apiObj" row-key="id" fit stripe @selection-change="handleSelectionChange"
@resetQuery="resetQuery">
<el-table-column type="selection" width="55" />
<el-table-column label="#" type="index" width="50"></el-table-column>
<el-table-column label="事件种类" width="240" :show-overflow-tooltip="true">
<template #default="scope">
<el-tag
v-for="item in scope.row.cates_"
:key="item.id"
type="warning"
effect="plain"
>{{ item.name }}</el-tag
>
<el-tag v-for="item in scope.row.cates_" :key="item.id" type="warning" effect="plain">{{ item.name }}</el-tag>
</template>
</el-table-column>
<el-table-column label="发生区域" prop="area_.name"></el-table-column>
@ -82,20 +38,14 @@
<template #default="scope">
<span v-if="scope.row.opl">{{ scope.row.operation_name }}</span>
<span v-else-if="scope.row.employee">
{{eTypeOptions[scope.row.employee_.type]}}-{{scope.row.employee_.name}}-{{ scope.row.employee_.belong_dept_name }}
{{ eTypeOptions[scope.row.employee_.type] }}-{{ scope.row.employee_.name }}-{{
scope.row.employee_.belong_dept_name }}
</span>
</template>
</el-table-column>
<el-table-column
label="发生时间"
prop="create_time"
width="150"
></el-table-column>
<el-table-column label="发生时间" prop="create_time" width="150"></el-table-column>
<el-table-column
label="处理人"
prop="handle_user_name"
></el-table-column>
<el-table-column label="处理人" prop="handle_user_name"></el-table-column>
<el-table-column label="事件标记" prop="mark">
<template #default="scope">
<el-tag v-if="scope.row.mark == 20" type="warning" effect="plain">误报</el-tag>
@ -111,21 +61,9 @@
<el-table-column label="操作" fixed="right" align="center">
<template #default="scope">
<el-button
link
type="info"
size="small"
@click="table_show(scope.row, scope.$index)"
>查看</el-button
>
<el-button
link
type="primary"
size="small"
v-if="scope.row.handle_user == null"
@click="table_handle(scope.row, scope.$index)"
>处理</el-button
>
<el-button link type="info" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
<el-button link type="primary" size="small" v-if="scope.row.handle_user == null"
@click="table_handle(scope.row, scope.$index)">处理</el-button>
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row)">
<template #reference>
<el-button link type="danger" size="small">删除</el-button>
@ -135,14 +73,8 @@
</el-table-column>
</scTable>
</el-main>
<detail-dialog
v-if="dialog.handle"
ref="handleDialog"
:eventID="eventID"
@oplDetail="oplDetail"
@success="handleSuccess"
@closed="dialog.handle = false"
></detail-dialog>
<detail-dialog v-if="dialog.handle" ref="handleDialog" :eventID="eventID" @oplDetail="oplDetail"
@success="handleSuccess" @closed="dialog.handle = false"></detail-dialog>
<el-drawer :size="'50%'" v-model="showLimited" title="作业许可证详情" :close-on-click-modal="false">
<sc-fire :id="oplId"></sc-fire>
</el-drawer>
@ -164,6 +96,7 @@ export default {
showLimited: false,
defaultTime: ['00:00:00', '23:59:59'],
timeRange: [],
selectionList: [],
objCateOptions: {
'people': '人员',
'opl': '作业',
@ -205,11 +138,32 @@ export default {
this.$refs.handleDialog.open("edit").setData(row);
});
},
handleSelectionChange(val) {
this.selectionList = val;
},
table_del(row) {
this.$API.ecm.event.delete.req(row.id).then(res => {
this.$refs.table.refresh();
})
},
handleDelete() {
let that = this;
if (that.selectionList.length > 0) {
that.$confirm(`确定删除选中的${that.selectionList.length}条数据吗?`, "提示", { type: "warning" }).then(() => {
let ids = [];
that.selectionList.forEach(function (item) {
ids.push(item.id);
});
that.$API.ecm.event.delete.req('bulk', { ids: ids }).then((res) => {
that.$message.success("批量删除成功");
that.$refs.table.refresh();
return res;
}).catch((err) => {
that.$message.warning(err);
});
})
}
},
//
table_show(row) {
this.eventID = row.id;