|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="snapshot-config-sms-container layout-padding">
|
|
|
<div class="layout-padding-auto layout-padding-view pd20">
|
|
|
- <vxe-grid v-bind="gridOptions" ref="gridRef">
|
|
|
+ <vxe-grid v-bind="gridOptions" ref="gridRef" @checkbox-all="selectAllChangeEvent" @checkbox-change="selectChangeEvent">
|
|
|
<template #form>
|
|
|
<el-form :model="state.queryParams" ref="ruleFormRef" inline @submit.native.prevent :disabled="gridOptions.loading">
|
|
|
<el-form-item label="行业名称" prop="IndustryName">
|
|
@@ -21,6 +21,9 @@
|
|
|
</template>
|
|
|
<template #toolbar_buttons>
|
|
|
<el-button type="primary" @click="onAdd" v-auth="'snapshot:config:sms:add'"> <SvgIcon name="ele-Plus" class="mr5" />新增短信 </el-button>
|
|
|
+ <el-button type="danger" @click="onDelete" v-auth="'snapshot:config:sms:delete'" :disabled="isChecked" :loading="state.loading"
|
|
|
+ ><SvgIcon name="ele-Delete" class="mr5" />删除<span v-if="checkTable.length">({{ checkTable.length }})</span>
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
<template #action="{ row }">
|
|
|
<el-button link type="primary" @click="onEdit(row)" v-auth="'snapshot:config:sms:edit'" title="编辑"> 编辑 </el-button>
|
|
@@ -44,9 +47,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="tsx" setup name="snapshotConfigSms">
|
|
|
-import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
|
|
-import { FormInstance } from 'element-plus';
|
|
|
-import { getSmsList } from '@/api/snapshot/config';
|
|
|
+import { computed, defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
|
|
+import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
|
|
|
+import { delSmsTemplate, delVolunteer, getSmsList } from '@/api/snapshot/config';
|
|
|
|
|
|
// 引入组件
|
|
|
const pagination = defineAsyncComponent(() => import('@/components/ProTable/components/Pagination.vue')); // 分页
|
|
@@ -95,6 +98,7 @@ const gridOptions = reactive<any>({
|
|
|
rowConfig: { isHover: true, height: 30, isCurrent: true, useKey: true },
|
|
|
height: 'auto',
|
|
|
columns: [
|
|
|
+ { type: 'checkbox', width: 50, align: 'center' },
|
|
|
{
|
|
|
field: 'content',
|
|
|
title: '短信内容',
|
|
@@ -173,6 +177,52 @@ const smsEditRef = ref<RefType>();
|
|
|
const onEdit = (row: any) => {
|
|
|
smsEditRef.value.openDialog(row.id);
|
|
|
};
|
|
|
+const checkTable = ref<EmptyArrayType>([]);
|
|
|
+const gridRef = ref<RefType>();
|
|
|
+const selectAllChangeEvent = ({ checked }) => {
|
|
|
+ if (gridRef.value) {
|
|
|
+ const records = gridRef.value.getCheckboxRecords();
|
|
|
+ checkTable.value = records;
|
|
|
+ console.log(checked ? '所有勾选事件' : '所有取消事件', records);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const selectChangeEvent = ({ checked }) => {
|
|
|
+ if (gridRef.value) {
|
|
|
+ const records = gridRef.value.getCheckboxRecords();
|
|
|
+ checkTable.value = records;
|
|
|
+ console.log(checked ? '勾选事件' : '取消事件', records);
|
|
|
+ }
|
|
|
+};
|
|
|
+const isChecked = computed(() => {
|
|
|
+ return !Boolean(checkTable.value.length);
|
|
|
+});
|
|
|
+// 删除
|
|
|
+const onDelete = () => {
|
|
|
+ const ids = checkTable.value.map((item: any) => item.id);
|
|
|
+ ElMessageBox.confirm(`您确定删除选选中的短信审批模板吗?,是否继续?`, '提示', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ draggable: true,
|
|
|
+ cancelButtonClass: 'default-button',
|
|
|
+ autofocus: false,
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ state.loading = true;
|
|
|
+ delSmsTemplate(ids)
|
|
|
+ .then(() => {
|
|
|
+ ElMessage.success('删除成功');
|
|
|
+ queryList();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ state.loading = false;
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ state.loading = false;
|
|
|
+ });
|
|
|
+};
|
|
|
// 页面加载时
|
|
|
onMounted(() => {
|
|
|
queryList();
|