Commit 872045ff authored by yanzhongrong's avatar yanzhongrong

add delete confirm

parent 54122c6c
<template>
<el-button :type="multipleSelection.data.length ? 'primary' : 'info'"
:disabled="!multipleSelection.data.length" @click="del()">删 除</el-button>
<el-button
:type="multipleSelection.length ? 'primary' : 'info'"
:disabled="!multipleSelection.length"
@click="del()"
>删 除</el-button
>
</template>
<script>
import {mapGetters,mapActions} from 'vuex';
import { warningAlert } from "../../utils/alert";
import { warningAlert } from "../../utils/alert";
export default {
props: {
props: {
multipleSelection2: {
type: Array,
default: () => {}
default: () => []
}
},
components: {},
data() {
return {
multipleSelection:formInit(),
};
},
components: {},
data() {
return {
multipleSelection: [],
};
},
watch: {
multipleSelection2: {
immediate: true,
immediate: true,
handler(newV) {
this.multipleSelection = !!newV
this.multipleSelection = formInit(this.multipleSelection2)
this.multipleSelection = this.multipleSelection2
},
},
},
computed: {
...mapGetters({}),
},
methods: {
...mapActions({}),
del(){
this.$confirm('继续操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$emit("del")
}).catch(() => {
warningAlert("取消删除")
});
},
},
mounted() {},
methods: {
del() {
this.$confirm('继续操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$emit("del")
}).catch(() => {
warningAlert("取消删除")
});
},
},
};
function formInit(data = []) {
return {
data
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
......@@ -10,6 +10,8 @@
@click="toDelete"
>删除</el-button
>
<delids :multipleSelection2="multipleSelection" @del="toDelete"
>删除</delids>
<el-button type="primary" @click="getTableData">刷新</el-button>
<el-button type="primary">查询</el-button>
<el-button type="primary">导出</el-button>
......@@ -92,6 +94,7 @@ export default {
toDelete() {
ConnectMaintainDelete({ids: this.multipleSelection}).then(res => {
this.$message.success('删除成功!')
this.getTableData()
})
},
cellClassFn({ row, column, rowIndex, columnIndex }) {
......
......@@ -4,11 +4,10 @@
<div class="leakage-top">
<div style="color: #666666"></div>
<div class="operate-btn">
<el-button
:type="multipleSelection.length ? 'primary' : 'info'"
:disabled="!multipleSelection.length"
<delids
:multipleSelection2="multipleSelection"
@click="toDelete"
>删除</el-button
>删除</delids
>
<el-button type="primary" @click="getTableData">刷新</el-button>
<el-button type="primary">查询</el-button>
......@@ -93,6 +92,7 @@ export default {
toDelete() {
ConnectStatusDelete({ids: this.multipleSelection}).then(res => {
this.$message.success('删除成功!')
this.getTableData()
})
},
cellClassFn({ row, column, rowIndex, columnIndex }) {
......
......@@ -4,11 +4,10 @@
<div class="leakage-top">
<div style="color: #666666"></div>
<div class="operate-btn">
<el-button
:type="multipleSelection.length ? 'primary' : 'info'"
:disabled="!multipleSelection.length"
<delids
:multipleSelection2="multipleSelection"
@click="deleteCable"
>删除</el-button
>删除</delids
>
<el-button type="primary" @click="getTableData">刷新</el-button>
<el-button type="primary">查询</el-button>
......@@ -87,6 +86,7 @@ export default {
deleteCable() {
MonitorMaintainDelete({ids: this.multipleSelection}).then(res => {
this.$message.success('删除成功!')
this.getTableData()
})
},
cellClassFn({ row, column, rowIndex, columnIndex }) {
......
......@@ -4,11 +4,10 @@
<div class="leakage-top">
<div style="color: #666666"></div>
<div class="operate-btn">
<el-button
:type="multipleSelection.length ? 'primary' : 'info'"
:disabled="!multipleSelection.length"
<delids
:multipleSelection2="multipleSelection"
@click="deleteCable"
>删除</el-button
>删除</delids
>
<el-button type="primary" @click="getTableData">刷新</el-button>
<el-button type="primary">查询</el-button>
......@@ -86,6 +85,7 @@ export default {
deleteCable() {
MonitorStatusDelete({ids: this.multipleSelection}).then(res => {
this.$message.success('删除成功!')
this.getTableData()
})
}
},
......
......@@ -4,8 +4,9 @@
<div style="color: #666666"></div>
<div class="operate-btn">
<delids :multipleSelection2="multipleSelection" @del="del()"
>删除</delids>
<delids :multipleSelection2="multipleSelection" @del="del()"
>删除</delids
>
<el-button type="primary" @click="refresh">刷新</el-button>
<el-button type="primary" @click="block = !block">查询</el-button>
<el-button type="primary" @click="exportData">导出</el-button>
......@@ -69,7 +70,7 @@
</el-form-item>
<el-form-item>
<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>
<el-table
......@@ -177,8 +178,8 @@
</el-table-column>
</el-table>
<pagination
:limit="FSUForm.size"
<Pagination
:limit="FSUForm.size"
:page="FSUForm.current"
:total="total"
class="pagination"
......@@ -193,7 +194,7 @@ import { successAlert, warningAlert } from "@/utils/alert";
import { mapGetters, mapActions } from "vuex";
export default {
props: [],
components: { },
components: {},
data() {
return {
railWaySelect: [],
......@@ -222,7 +223,7 @@ export default {
multipleSelection: [],
ids: [],
block: 0,
istrue:0
istrue: 0
};
},
computed: {
......@@ -232,7 +233,7 @@ export default {
}),
},
methods: {
...mapActions({
asyncrailWayList: "railWay/asyncList",
asyncstationList: "station/asyncList",
......@@ -266,9 +267,9 @@ export default {
this.getTableData();
},
searchQuery() {
this.istrue=1
this.istrue = 1
this.getTableData();
},
reset() {
this.FSUForm = {
......@@ -285,7 +286,7 @@ export default {
};
},
exportData() {},
exportData() { },
handleSelectionChange(val) {
this.multipleSelection = val;
......@@ -302,22 +303,18 @@ export default {
});
},
handlePageChange(pageData) {
this.FSUForm.size = pageData.size;
this.FSUForm.size = pageData.size;
this.FSUForm.current = pageData.page;
this.getTableData();
},
getTableData() {
let params = {
current: this.params.pageNum,
size: this.params.pageSize,
};
fsulist(this.FSUForm).then((res) => {
let list = res.records || [];
this.tableData = list;
this.total = res.total;
if (this.istrue == 1) {
if (this.tableData.length!=0) {
if (this.istrue == 1) {
if (this.tableData.length != 0) {
successAlert("查询成功");
} else {
warningAlert("查询结果为空");
......@@ -327,7 +324,7 @@ export default {
});
},
},
created() {
created() {
var that = this;
document.onkeydown = function (e) {
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