Commit 872045ff authored by yanzhongrong's avatar yanzhongrong

add delete confirm

parent 54122c6c
<template> <template>
<el-button
<el-button :type="multipleSelection.data.length ? 'primary' : 'info'" :type="multipleSelection.length ? 'primary' : 'info'"
:disabled="!multipleSelection.data.length" @click="del()">删 除</el-button> :disabled="!multipleSelection.length"
@click="del()"
>删 除</el-button
>
</template> </template>
<script> <script>
import {mapGetters,mapActions} from 'vuex';
import { warningAlert } from "../../utils/alert"; import { warningAlert } from "../../utils/alert";
export default { export default {
props: { props: {
multipleSelection2: { multipleSelection2: {
type: Array, type: Array,
default: () => {} default: () => []
} }
}, },
components: {}, components: {},
data() { data() {
return { return {
multipleSelection:formInit(), multipleSelection: [],
}; };
}, },
watch: { watch: {
multipleSelection2: { multipleSelection2: {
immediate: true, immediate: true,
handler(newV) { handler(newV) {
this.multipleSelection = !!newV this.multipleSelection = !!newV
this.multipleSelection = formInit(this.multipleSelection2) this.multipleSelection = this.multipleSelection2
}, },
}, },
}, },
computed: { methods: {
...mapGetters({}), del() {
},
methods: {
...mapActions({}),
del(){
this.$confirm('继续操作将永久删除, 是否继续?', '提示', { this.$confirm('继续操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -49,16 +42,10 @@ del(){ ...@@ -49,16 +42,10 @@ del(){
}).catch(() => { }).catch(() => {
warningAlert("取消删除") warningAlert("取消删除")
}); });
}, },
}, },
mounted() {},
}; };
function formInit(data = []) {
return {
data
}
}
</script> </script>
<style scoped> <style scoped>
</style> </style>
\ No newline at end of file
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
@click="toDelete" @click="toDelete"
>删除</el-button >删除</el-button
> >
<delids :multipleSelection2="multipleSelection" @del="toDelete"
>删除</delids>
<el-button type="primary" @click="getTableData">刷新</el-button> <el-button type="primary" @click="getTableData">刷新</el-button>
<el-button type="primary">查询</el-button> <el-button type="primary">查询</el-button>
<el-button type="primary">导出</el-button> <el-button type="primary">导出</el-button>
...@@ -92,6 +94,7 @@ export default { ...@@ -92,6 +94,7 @@ export default {
toDelete() { toDelete() {
ConnectMaintainDelete({ids: this.multipleSelection}).then(res => { ConnectMaintainDelete({ids: this.multipleSelection}).then(res => {
this.$message.success('删除成功!') this.$message.success('删除成功!')
this.getTableData()
}) })
}, },
cellClassFn({ row, column, rowIndex, columnIndex }) { cellClassFn({ row, column, rowIndex, columnIndex }) {
......
...@@ -4,11 +4,10 @@ ...@@ -4,11 +4,10 @@
<div class="leakage-top"> <div class="leakage-top">
<div style="color: #666666"></div> <div style="color: #666666"></div>
<div class="operate-btn"> <div class="operate-btn">
<el-button <delids
:type="multipleSelection.length ? 'primary' : 'info'" :multipleSelection2="multipleSelection"
:disabled="!multipleSelection.length"
@click="toDelete" @click="toDelete"
>删除</el-button >删除</delids
> >
<el-button type="primary" @click="getTableData">刷新</el-button> <el-button type="primary" @click="getTableData">刷新</el-button>
<el-button type="primary">查询</el-button> <el-button type="primary">查询</el-button>
...@@ -93,6 +92,7 @@ export default { ...@@ -93,6 +92,7 @@ export default {
toDelete() { toDelete() {
ConnectStatusDelete({ids: this.multipleSelection}).then(res => { ConnectStatusDelete({ids: this.multipleSelection}).then(res => {
this.$message.success('删除成功!') this.$message.success('删除成功!')
this.getTableData()
}) })
}, },
cellClassFn({ row, column, rowIndex, columnIndex }) { cellClassFn({ row, column, rowIndex, columnIndex }) {
......
...@@ -4,11 +4,10 @@ ...@@ -4,11 +4,10 @@
<div class="leakage-top"> <div class="leakage-top">
<div style="color: #666666"></div> <div style="color: #666666"></div>
<div class="operate-btn"> <div class="operate-btn">
<el-button <delids
:type="multipleSelection.length ? 'primary' : 'info'" :multipleSelection2="multipleSelection"
:disabled="!multipleSelection.length"
@click="deleteCable" @click="deleteCable"
>删除</el-button >删除</delids
> >
<el-button type="primary" @click="getTableData">刷新</el-button> <el-button type="primary" @click="getTableData">刷新</el-button>
<el-button type="primary">查询</el-button> <el-button type="primary">查询</el-button>
...@@ -87,6 +86,7 @@ export default { ...@@ -87,6 +86,7 @@ export default {
deleteCable() { deleteCable() {
MonitorMaintainDelete({ids: this.multipleSelection}).then(res => { MonitorMaintainDelete({ids: this.multipleSelection}).then(res => {
this.$message.success('删除成功!') this.$message.success('删除成功!')
this.getTableData()
}) })
}, },
cellClassFn({ row, column, rowIndex, columnIndex }) { cellClassFn({ row, column, rowIndex, columnIndex }) {
......
...@@ -4,11 +4,10 @@ ...@@ -4,11 +4,10 @@
<div class="leakage-top"> <div class="leakage-top">
<div style="color: #666666"></div> <div style="color: #666666"></div>
<div class="operate-btn"> <div class="operate-btn">
<el-button <delids
:type="multipleSelection.length ? 'primary' : 'info'" :multipleSelection2="multipleSelection"
:disabled="!multipleSelection.length"
@click="deleteCable" @click="deleteCable"
>删除</el-button >删除</delids
> >
<el-button type="primary" @click="getTableData">刷新</el-button> <el-button type="primary" @click="getTableData">刷新</el-button>
<el-button type="primary">查询</el-button> <el-button type="primary">查询</el-button>
...@@ -86,6 +85,7 @@ export default { ...@@ -86,6 +85,7 @@ export default {
deleteCable() { deleteCable() {
MonitorStatusDelete({ids: this.multipleSelection}).then(res => { MonitorStatusDelete({ids: this.multipleSelection}).then(res => {
this.$message.success('删除成功!') this.$message.success('删除成功!')
this.getTableData()
}) })
} }
}, },
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
<div class="operate-btn"> <div class="operate-btn">
<delids :multipleSelection2="multipleSelection" @del="del()" <delids :multipleSelection2="multipleSelection" @del="del()"
>删除</delids> >删除</delids
>
<el-button type="primary" @click="refresh">刷新</el-button> <el-button type="primary" @click="refresh">刷新</el-button>
<el-button type="primary" @click="block = !block">查询</el-button> <el-button type="primary" @click="block = !block">查询</el-button>
<el-button type="primary" @click="exportData">导出</el-button> <el-button type="primary" @click="exportData">导出</el-button>
...@@ -69,7 +70,7 @@ ...@@ -69,7 +70,7 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button class="seabtn" @click="searchQuery()">查询</el-button> <el-button class="seabtn" @click="searchQuery()">查询</el-button>
<el-button class="seabtn" @click="reset()">重置</el-button> <el-button class="seabtn" @click="reset">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
...@@ -177,7 +178,7 @@ ...@@ -177,7 +178,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <Pagination
:limit="FSUForm.size" :limit="FSUForm.size"
:page="FSUForm.current" :page="FSUForm.current"
:total="total" :total="total"
...@@ -193,7 +194,7 @@ import { successAlert, warningAlert } from "@/utils/alert"; ...@@ -193,7 +194,7 @@ import { successAlert, warningAlert } from "@/utils/alert";
import { mapGetters, mapActions } from "vuex"; import { mapGetters, mapActions } from "vuex";
export default { export default {
props: [], props: [],
components: { }, components: {},
data() { data() {
return { return {
railWaySelect: [], railWaySelect: [],
...@@ -222,7 +223,7 @@ export default { ...@@ -222,7 +223,7 @@ export default {
multipleSelection: [], multipleSelection: [],
ids: [], ids: [],
block: 0, block: 0,
istrue:0 istrue: 0
}; };
}, },
computed: { computed: {
...@@ -266,7 +267,7 @@ export default { ...@@ -266,7 +267,7 @@ export default {
this.getTableData(); this.getTableData();
}, },
searchQuery() { searchQuery() {
this.istrue=1 this.istrue = 1
this.getTableData(); this.getTableData();
}, },
...@@ -285,7 +286,7 @@ export default { ...@@ -285,7 +286,7 @@ export default {
}; };
}, },
exportData() {}, exportData() { },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
...@@ -307,17 +308,13 @@ export default { ...@@ -307,17 +308,13 @@ export default {
this.getTableData(); this.getTableData();
}, },
getTableData() { getTableData() {
let params = {
current: this.params.pageNum,
size: this.params.pageSize,
};
fsulist(this.FSUForm).then((res) => { fsulist(this.FSUForm).then((res) => {
let list = res.records || []; let list = res.records || [];
this.tableData = list; this.tableData = list;
this.total = res.total; this.total = res.total;
if (this.istrue == 1) { if (this.istrue == 1) {
if (this.tableData.length!=0) { if (this.tableData.length != 0) {
successAlert("查询成功"); successAlert("查询成功");
} else { } else {
warningAlert("查询结果为空"); warningAlert("查询结果为空");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment