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() {
}, this.$confirm('继续操作将永久删除, 是否继续?', '提示', {
methods: { confirmButtonText: '确定',
...mapActions({}), cancelButtonText: '取消',
del(){ type: 'warning'
this.$confirm('继续操作将永久删除, 是否继续?', '提示', { }).then(() => {
confirmButtonText: '确定', this.$emit("del")
cancelButtonText: '取消', }).catch(() => {
type: 'warning' warningAlert("取消删除")
}).then(() => { });
this.$emit("del") },
}).catch(() => { },
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()
}) })
} }
}, },
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
<div style="color: #666666"></div> <div style="color: #666666"></div>
<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,8 +178,8 @@ ...@@ -177,8 +178,8 @@
</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"
class="pagination" class="pagination"
...@@ -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: {
...@@ -232,7 +233,7 @@ export default { ...@@ -232,7 +233,7 @@ export default {
}), }),
}, },
methods: { methods: {
...mapActions({ ...mapActions({
asyncrailWayList: "railWay/asyncList", asyncrailWayList: "railWay/asyncList",
asyncstationList: "station/asyncList", asyncstationList: "station/asyncList",
...@@ -266,9 +267,9 @@ export default { ...@@ -266,9 +267,9 @@ export default {
this.getTableData(); this.getTableData();
}, },
searchQuery() { searchQuery() {
this.istrue=1 this.istrue = 1
this.getTableData(); this.getTableData();
}, },
reset() { reset() {
this.FSUForm = { this.FSUForm = {
...@@ -285,7 +286,7 @@ export default { ...@@ -285,7 +286,7 @@ export default {
}; };
}, },
exportData() {}, exportData() { },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
...@@ -302,22 +303,18 @@ export default { ...@@ -302,22 +303,18 @@ export default {
}); });
}, },
handlePageChange(pageData) { handlePageChange(pageData) {
this.FSUForm.size = pageData.size; this.FSUForm.size = pageData.size;
this.FSUForm.current = pageData.page; this.FSUForm.current = pageData.page;
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("查询结果为空");
...@@ -327,7 +324,7 @@ export default { ...@@ -327,7 +324,7 @@ export default {
}); });
}, },
}, },
created() { created() {
var that = this; var that = this;
document.onkeydown = function (e) { document.onkeydown = function (e) {
var key = window.event.keyCode; var key = window.event.keyCode;
......
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