|
@@ -10,7 +10,13 @@
|
|
|
<template v-for="(item, index) in opera">
|
|
|
<template v-if="display(item, row)">
|
|
|
<el-tooltip :key="index" effect="dark" :content="item.label" placement="bottom">
|
|
|
- <el-button :key="index" type="text" :icon="item.icon || ''" size="mini" @click="handleOpera(row, item.method)"></el-button>
|
|
|
+ <el-button
|
|
|
+ :key="index"
|
|
|
+ type="text"
|
|
|
+ :icon="item.icon || ''"
|
|
|
+ size="mini"
|
|
|
+ @click="handleOpera(row, item.method, item.confirm, item.methodZh)"
|
|
|
+ ></el-button>
|
|
|
</el-tooltip>
|
|
|
</template>
|
|
|
</template>
|
|
@@ -45,8 +51,20 @@ export default {
|
|
|
} else return cellValue;
|
|
|
}
|
|
|
},
|
|
|
- handleOpera(data, method) {
|
|
|
- this.$emit(method, data);
|
|
|
+ handleOpera(data, method, confirm = false, methodZh = '操作') {
|
|
|
+ if (confirm) {
|
|
|
+ this.$confirm(`您确认${methodZh}该数据?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$emit(method, data);
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ } else {
|
|
|
+ this.$emit(method, data);
|
|
|
+ }
|
|
|
},
|
|
|
display(item, row) {
|
|
|
let display = _.get(item, `display`, true);
|