feat 批量删除

This commit is contained in:
lbw 2023-02-15 13:38:46 +08:00
parent 50ed4a0332
commit 26508ccec9
13 changed files with 223 additions and 234 deletions

View File

@ -69,10 +69,11 @@ export function getObj(id: string) {
})
}
export function delObj(row: any) {
export function delObj(ids: Object) {
return request({
url: '/admin/dict/' + row.id,
method: 'delete'
url: '/admin/dict',
method: 'delete',
data: ids
})
}

View File

@ -23,10 +23,11 @@ export function getObj(id?: string) {
})
}
export function delObj(id?: string) {
export function delObj(ids?: Object) {
return request({
url: '/admin/sys-file/' + id,
method: 'delete'
url: '/admin/sys-file',
method: 'delete',
data: ids
})
}

View File

@ -23,10 +23,11 @@ export function getObj(id?: string) {
})
}
export function delObj(id?: string) {
export function delObj(ids?: object) {
return request({
url: '/admin/i18n/' + id,
method: 'delete'
url: '/admin/i18n',
method: 'delete',
data: ids
})
}
@ -39,7 +40,7 @@ export function putObj(obj?: Object) {
}
export function info(){
export function info() {
return request({
url: '/admin/i18n/info',
method: 'get',

View File

@ -23,10 +23,11 @@ export function getObj(id?: string) {
})
}
export function delObj(id?: string) {
export function delObj(ids?: Object) {
return request({
url: '/admin/param/' + id,
method: 'delete'
url: '/admin/param',
method: 'delete',
data: ids
})
}

View File

@ -23,10 +23,11 @@ export function getObj(id?: string) {
})
}
export function delObj(id?: string) {
export function delObj(ids?: Object) {
return request({
url: '/admin/social/' + id,
method: 'delete'
url: '/admin/social',
method: 'delete',
data: ids
})
}

View File

@ -8,9 +8,10 @@ export function fetchList(query: object) {
})
}
export function delObj(token:string) {
export function delObj(accessTokens: string[]) {
return request({
url: '/admin/token/' + token,
method: 'delete'
url: '/admin/token/delete',
method: 'delete',
data: accessTokens
})
}

View File

@ -7,7 +7,7 @@
{{ $t('common.addBtn') }}
</el-button>
<right-toolbar :search='false' class="ml10" style="float: right;margin-right: 20px"
@queryTable="getDataList"></right-toolbar>
@queryTable="getDataList"></right-toolbar>
</div>
<el-table :data="state.dataList" v-loading="state.loading" style="width: 100%">
<el-table-column prop="dictType" label="类型" show-overflow-tooltip></el-table-column>
@ -20,7 +20,7 @@
<el-table-column :label="$t('common.action')" width="150">
<template #default="scope">
<el-button text type="primary" @click="dictformRef.openDialog(scope.row)"> {{$t('common.editBtn') }}
<el-button text type="primary" @click="dictformRef.openDialog(scope.row)"> {{ $t('common.editBtn') }}
</el-button>
<el-button text type="primary" @click="handleDelete(scope.row)">
{{ $t('common.delBtn') }}
@ -40,12 +40,12 @@
<script setup lang="ts" name="dict-item">
import {BasicTableProps, useTable} from "/@/hooks/table";
import {fetchItemList,delItemObj} from "/@/api/admin/dict";
import {useMessage, useMessageBox} from "/@/hooks/message";
import {useI18n} from "vue-i18n";
import { BasicTableProps, useTable } from "/@/hooks/table";
import { fetchItemList, delItemObj } from "/@/api/admin/dict";
import { useMessage, useMessageBox } from "/@/hooks/message";
import { useI18n } from "vue-i18n";
const { t } = useI18n()
const { t } = useI18n()
const visible = ref(false)
const DictForm = defineAsyncComponent(() => import("./form.vue"))
const dictformRef = ref()
@ -63,8 +63,7 @@ const {
} = useTable(state)
const handleDelete = (row: any) => {
useMessageBox().confirm(`${t('common.delConfirmText')}${row.name} ?`).then(() => {
//
useMessageBox().confirm(`${t('common.delConfirmText')} ?`).then(() => {
delItemObj(row.id).then(() => {
getDataList();
useMessage().success(t('common.delSuccessText'))

View File

@ -7,9 +7,9 @@
<el-input placeholder="请输入类型" v-model="state.queryForm.dictType" style="max-width: 180px" />
</el-form-item>
<el-form-item label="字典类型" prop="systemFlag">
<el-select v-model="state.queryForm.systemFlag" clearable>
<el-select v-model="state.queryForm.systemFlag" clearable>
<el-option v-for="(item, index) in dict_type" :label="item.label" :value="item.value"
:key="index" ></el-option>
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item class="ml2">
@ -26,16 +26,23 @@
{{ $t('common.addBtn') }}
</el-button>
<el-button :disabled="multiple" icon="Delete" type="primary" class="ml10" v-auth="'sys_dict_del'"
@click="handleDelete(undefined)">
@click="handleDelete(selectObjs)">
{{ $t('common.delBtn') }}
</el-button>
<right-toolbar v-model:showSearch="showSearch" class="ml10" style="float: right;margin-right: 20px"
@queryTable="getDataList"></right-toolbar>
</div>
</el-row>
<el-table :data="state.dataList" v-loading="state.loading" style="width: 100%">
<el-table :data="state.dataList" v-loading="state.loading" style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" :selectable='handleSelectable' width="50">
</el-table-column>
<el-table-column type="index" label="序号" width="50" />
<el-table-column prop="dictType" label="类型" show-overflow-tooltip></el-table-column>
<el-table-column label="类型" show-overflow-tooltip>
<template #default="scope">
<el-button text type="primary" @click="showDictITem(scope.row)">{{ scope.row.dictType }}</el-button>
</template>
</el-table-column>
<el-table-column prop="description" label="描述" show-overflow-tooltip sortable></el-table-column>
<el-table-column prop="systemFlag" label="字典类型" show-overflow-tooltip>
<template #default="scope">
@ -48,7 +55,8 @@
<el-table-column label="操作" width="200">
<template #default="scope">
<el-button text type="primary" @click="onOpenEditDic('edit', scope.row)">修改</el-button>
<el-button text type="primary" @click="onOpenEditDic('edit', scope.row)">修改</el-button>
<el-button text type="primary" v-if="scope.row.systemFlag !== '1'"
@click="handleDelete([scope.row.id])">删除</el-button>
<el-button text type="primary" @click="showDictITem(scope.row)">字典项</el-button>
</template>
</el-table-column>
@ -77,7 +85,7 @@ const dictItemDialogRef = ref()
const queryRef = ref()
const showSearch = ref(true)
//
const selectObjs = ref([])
const selectObjs = ref([]) as any
const multiple = ref(true)
@ -100,25 +108,32 @@ const showDictITem = (row: any) => {
dictItemDialogRef.value.open(row)
}
//
const resetQuery = () => {
queryRef.value.resetFields()
state.queryForm = {}
getDataList()
}
//
const handleDelete = (row: any) => {
if (!row) {
selectObjs.value.forEach((val: any) => {
handleDelete(val)
});
return
}
useMessageBox().confirm(t('common.delConfirmText') + row.postId)
//
const handleSelectable = (row: any) => {
//
return row.systemFlag !== '1'
}
//
const handleSelectionChange = (objs: any) => {
objs.forEach((val: any) => {
selectObjs.value.push(val.id)
});
multiple.value = !objs.length
}
//
const handleDelete = (ids: string[]) => {
useMessageBox().confirm(t('common.delConfirmText'))
.then(() => {
delObj(row.postId).then(() => {
delObj(ids).then(() => {
getDataList();
useMessage().success(t('common.delSuccessText'));
}).catch((err: any) => {

View File

@ -20,7 +20,7 @@
{{ $t('common.addBtn') }}
</el-button>
<el-button :disabled="multiple" icon="Delete" type="primary" class="ml10" v-auth="'sys_file_del'"
@click="handleDelete(undefined)">
@click="handleDelete(selectObjs)">
{{ $t('common.delBtn') }}
</el-button>
<right-toolbar v-model:showSearch="showSearch" class="ml10" style="float: right;margin-right: 20px"
@ -39,7 +39,7 @@
<el-table-column prop="createTime" :label="t('file.createTime')" show-overflow-tooltip />
<el-table-column :label="$t('common.action')" width="200">
<template #default="scope">
<el-button text type="primary" v-auth="'sys_file_del'" @click="handleDelete(scope.row)">{{
<el-button text type="primary" v-auth="'sys_file_del'" @click="handleDelete([scope.row.id])">{{
$t('common.delBtn')
}}</el-button>
<el-button type="primary" text @click="download(scope.row, scope.index)">{{
@ -73,7 +73,7 @@ const formDialogRef = ref()
//
const showSearch = ref(true)
//
const selectObjs = ref([])
const selectObjs = ref([]) as any
const multiple = ref(true)
const state: BasicTableProps = reactive<BasicTableProps>({
@ -88,13 +88,6 @@ const {
sizeChangeHandle,
} = useTable(state)
//
const handleSelectionChange = (val: any) => {
selectObjs.value = val
multiple.value = !val.length
}
//
const resetQuery = () => {
queryRef.value.resetFields()
@ -107,19 +100,19 @@ const download = (row: any) => {
);
}
//
const handleSelectionChange = (objs: any) => {
objs.forEach((val: any) => {
selectObjs.value.push(val.id)
});
multiple.value = !objs.length
}
//
const handleDelete = (row: any) => {
if (!row) {
selectObjs.value.forEach((val: any) => {
handleDelete(val)
});
return
}
useMessageBox().confirm(t('common.delConfirmText') + row.id)
const handleDelete = (ids: string[]) => {
useMessageBox().confirm(t('common.delConfirmText'))
.then(() => {
delObj(row.id).then(() => {
delObj(ids).then(() => {
getDataList();
useMessage().success(t('common.delSuccessText'));
}).catch((err: any) => {

View File

@ -3,17 +3,14 @@
<el-card class="layout-padding-auto">
<el-row v-show="showSearch" class="mb8">
<el-form :model="state.queryForm" ref="queryRef" :inline="true">
<el-form-item :label="$t('i18n.name')" prop="name" >
<el-input :placeholder="t('i18n.inputKeyTip')" v-model="state.queryForm.name"
style="max-width: 180px" />
<el-form-item :label="$t('i18n.name')" prop="name">
<el-input :placeholder="t('i18n.inputKeyTip')" v-model="state.queryForm.name" style="max-width: 180px" />
</el-form-item>
<el-form-item :label="$t('i18n.zhCn')" prop="zh-cn" >
<el-input :placeholder="t('i18n.inputZhCnTip')" v-model="state.queryForm.zhCn"
style="max-width: 180px" />
<el-form-item :label="$t('i18n.zhCn')" prop="zh-cn">
<el-input :placeholder="t('i18n.inputZhCnTip')" v-model="state.queryForm.zhCn" style="max-width: 180px" />
</el-form-item>
<el-form-item :label="$t('i18n.en')" prop="en" >
<el-input :placeholder="t('i18n.inputEnTip')" v-model="state.queryForm.en"
style="max-width: 180px" />
<el-form-item :label="$t('i18n.en')" prop="en">
<el-input :placeholder="t('i18n.inputEnTip')" v-model="state.queryForm.en" style="max-width: 180px" />
</el-form-item>
<el-form-item class="ml2">
<el-button formDialogRef icon="search" type="primary" @click="getDataList">
@ -34,7 +31,7 @@
{{ $t('common.exportBtn') }}
</el-button>
<el-button formDialogRef :disabled="multiple" icon="Delete" type="primary" class="ml10"
v-auth="'admin_i18n_del'" @click="handleDelete(undefined)">
v-auth="'admin_i18n_del'" @click="handleDelete(selectObjs)">
{{ $t('common.delBtn') }}
</el-button>
<right-toolbar v-model:showSearch="showSearch" class="ml10" style="float: right;margin-right: 20px"
@ -44,16 +41,17 @@
<el-table :data="state.dataList" v-loading="state.loading" style="width: 100%"
@selection-change="handleSelectionChange" @sort-change="sortChangeHandle">
<el-table-column type="selection" width="60" align="center" />
<el-table-column prop="name" :label="t('i18n.name')" show-overflow-tooltip/>
<el-table-column prop="zhCn" :label="t('i18n.zhCn')" show-overflow-tooltip/>
<el-table-column prop="en" :label="t('i18n.en')" show-overflow-tooltip/>
<el-table-column prop="createBy" :label="t('i18n.createBy')" show-overflow-tooltip/>
<el-table-column prop="createTime" :label="t('i18n.createTime')" show-overflow-tooltip/>
<el-table-column prop="name" :label="t('i18n.name')" show-overflow-tooltip />
<el-table-column prop="zhCn" :label="t('i18n.zhCn')" show-overflow-tooltip />
<el-table-column prop="en" :label="t('i18n.en')" show-overflow-tooltip />
<el-table-column prop="createBy" :label="t('i18n.createBy')" show-overflow-tooltip />
<el-table-column prop="createTime" :label="t('i18n.createTime')" show-overflow-tooltip />
<el-table-column :label="$t('common.action')" width="150">
<template #default="scope">
<el-button text type="primary" v-auth="'admin_i18n_edit'"
@click="formDialogRef.openDialog(scope.row.id)">{{ $t('common.editBtn') }}</el-button>
<el-button text type="primary" v-auth="'admin_i18n_del'" @click="handleDelete(scope.row)">{{
<el-button text type="primary" v-auth="'admin_i18n_edit'" @click="formDialogRef.openDialog(scope.row.id)">{{
$t('common.editBtn')
}}</el-button>
<el-button text type="primary" v-auth="'admin_i18n_del'" @click="handleDelete([scope.row.id])">{{
$t('common.delBtn')
}}</el-button>
</template>
@ -84,7 +82,7 @@ const formDialogRef = ref()
const queryRef = ref()
const showSearch = ref(true)
//
const selectObjs = ref([])
const selectObjs = ref([]) as any
const multiple = ref(true)
const state: BasicTableProps = reactive<BasicTableProps>({
@ -117,29 +115,24 @@ const resetQuery = () => {
getDataList()
}
//
const handleSelectionChange = (val: any) => {
selectObjs.value = val
multiple.value = !val.length
}
// excel
const exportExcel = () => {
downBlobFile('/admin/i18n/export', state.queryForm, 'i18n.xlsx')
}
//
const handleDelete = (row: any) => {
if (!row) {
selectObjs.value.forEach((val: any) => {
handleDelete(val)
});
return
}
//
const handleSelectionChange = (objs: any) => {
objs.forEach((val: any) => {
selectObjs.value.push(val.id)
});
multiple.value = !objs.length
}
useMessageBox().confirm(t('common.delConfirmText') + row.id)
//
const handleDelete = (ids: string[]) => {
useMessageBox().confirm(t('common.delConfirmText'))
.then(() => {
delObj(row.id).then(() => {
delObj(ids).then(() => {
getDataList();
useMessage().success(t('common.delSuccessText'));
}).catch((err: any) => {

View File

@ -6,7 +6,7 @@
<el-form-item :label="t('param.systemFlag')" class="ml2" prop="systemFlag">
<el-select v-model="state.queryForm.systemFlag" :placeholder="t('param.inputsystemFlagTip')">
<el-option v-for="(item, index) in dict_type" :key="index" :label="item.label"
:value="item.value"></el-option>
:value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item class="ml2">
@ -19,42 +19,34 @@
</el-row>
<el-row>
<div class="mb8" style="width: 100%">
<el-button class="ml10" formDialogRef icon="folder-add" type="primary"
@click="formDialogRef.openDialog()">
<el-button class="ml10" formDialogRef icon="folder-add" type="primary" @click="formDialogRef.openDialog()">
{{ $t('common.addBtn') }}
</el-button>
<el-button class="ml10" formDialogRef icon="Download" type="primary"
@click="exportExcel">
<el-button class="ml10" formDialogRef icon="Download" type="primary" @click="exportExcel">
{{ $t('common.exportBtn') }}
</el-button>
<el-button :disabled="multiple" class="ml10" formDialogRef icon="Delete"
type="primary" @click="handleDelete(undefined)">
<el-button :disabled="multiple" class="ml10" formDialogRef icon="Delete" type="primary"
@click="handleDelete(selectObjs)">
{{ $t('common.delBtn') }}
</el-button>
<right-toolbar v-model:showSearch="showSearch" class="ml10" style="float: right;margin-right: 20px"
@queryTable="getDataList"></right-toolbar>
@queryTable="getDataList"></right-toolbar>
</div>
</el-row>
<el-table v-loading="state.loading" :data="state.dataList" style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="50"/>
<el-table-column :label="t('param.index')" type="index" width="80"/>
<el-table-column :label="t('param.publicId')" prop="publicId" show-overflow-tooltip/>
<el-table-column :label="t('param.publicName')" prop="publicName" show-overflow-tooltip/>
<el-table-column :label="t('param.publicKey')" prop="publicKey" show-overflow-tooltip/>
<el-table-column :label="t('param.publicValue')" prop="publicValue" show-overflow-tooltip/>
@selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" :selectable='handleSelectable' width="50">
</el-table-column>
<el-table-column :label="t('param.index')" type="index" width="80" />
<el-table-column :label="t('param.publicName')" prop="publicName" show-overflow-tooltip />
<el-table-column :label="t('param.publicKey')" prop="publicKey" show-overflow-tooltip />
<el-table-column :label="t('param.publicValue')" prop="publicValue" show-overflow-tooltip />
<el-table-column :label="t('param.status')" prop="status" show-overflow-tooltip>
<template #default="scope">
<dict-tag :options="status_type" :value="scope.row.status"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="t('param.validateCode')" prop="validateCode" show-overflow-tooltip/>
<el-table-column :label="t('param.createTime')" prop="createTime" show-overflow-tooltip/>
<el-table-column :label="t('param.publicType')" prop="publicType" show-overflow-tooltip>
<template #default="scope">
<dict-tag :options="param_type" :value="scope.row.publicType"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="t('param.createTime')" prop="createTime" show-overflow-tooltip />
<el-table-column :label="t('param.systemFlag')" prop="systemFlag" show-overflow-tooltip>
<template #default="scope">
<dict-tag :options="dict_type" :value="scope.row.systemFlag"></dict-tag>
@ -62,45 +54,46 @@
</el-table-column>
<el-table-column :label="$t('common.action')" width="150">
<template #default="scope">
<el-button text type="primary"
@click="formDialogRef.openDialog(scope.row.publicId)">{{ $t('common.editBtn') }}
<el-button text type="primary" @click="formDialogRef.openDialog(scope.row.publicId)">{{
$t('common.editBtn')
}}
</el-button>
<el-button text type="primary" @click="handleDelete(scope.row)">{{
<el-button text v-if="scope.row.systemFlag !== '1'" type="primary"
@click="handleDelete([scope.row.publicId])">{{
$t('common.delBtn')
}}
</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-bind="state.pagination" @size-change="sizeChangeHandle" @current-change="currentChangeHandle"/>
<pagination v-bind="state.pagination" @size-change="sizeChangeHandle" @current-change="currentChangeHandle" />
</el-card>
<!-- 编辑新增 -->
<form-dialog ref="formDialogRef" @refresh="getDataList()"/>
<form-dialog ref="formDialogRef" @refresh="getDataList()" />
</div>
</template>
<script lang="ts" name="systemSysPublicParam" setup>
import {BasicTableProps, useTable} from "/@/hooks/table";
import {delObj, fetchList} from "/@/api/admin/param";
import {useMessage, useMessageBox} from "/@/hooks/message";
import {useDict} from '/@/hooks/dict';
import {useI18n} from "vue-i18n";
import { BasicTableProps, useTable } from "/@/hooks/table";
import { delObj, fetchList } from "/@/api/admin/param";
import { useMessage, useMessageBox } from "/@/hooks/message";
import { useDict } from '/@/hooks/dict';
import { useI18n } from "vue-i18n";
//
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
const {t} = useI18n()
const { t } = useI18n()
//
const {dict_type, status_type, param_type} = useDict('dict_type', 'status_type', 'param_type')
const { dict_type, status_type } = useDict('dict_type', 'status_type')
//
const formDialogRef = ref()
//
const queryRef = ref()
const showSearch = ref(true)
//
const selectObjs = ref([])
const selectObjs = ref([]) as any
const multiple = ref(true)
const state: BasicTableProps = reactive<BasicTableProps>({
@ -125,10 +118,10 @@ const resetQuery = () => {
getDataList()
}
//
const handleSelectionChange = (val: any) => {
selectObjs.value = val
multiple.value = !val.length
//
const handleSelectable = (row: any) => {
//
return row.systemFlag !== '1'
}
// excel
@ -136,23 +129,24 @@ const exportExcel = () => {
downBlobFile('/admin/param/export', state.queryForm, 'param.xlsx')
}
//
const handleDelete = (row: any) => {
if (!row) {
selectObjs.value.forEach((val: any) => {
handleDelete(val)
});
return
}
//
const handleSelectionChange = (objs: any) => {
objs.forEach((val: any) => {
selectObjs.value.push(val.publicId)
});
multiple.value = !objs.length
}
useMessageBox().confirm(t('common.delConfirmText') + row.publicId)
.then(() => {
delObj(row.publicId).then(() => {
getDataList();
useMessage().success(t('common.delSuccessText'));
}).catch((err: any) => {
useMessage().error(err.msg)
})
//
const handleDelete = (ids: string[]) => {
useMessageBox().confirm(t('common.delConfirmText'))
.then(() => {
delObj(ids).then(() => {
getDataList();
useMessage().success(t('common.delSuccessText'));
}).catch((err: any) => {
useMessage().error(err.msg)
})
})
};
</script>

View File

@ -6,7 +6,7 @@
<el-form-item :label="t('social.type')" class="ml2" prop="type">
<el-select v-model="state.queryForm.type" :placeholder="t('social.inputTypeTip')">
<el-option v-for="(item, index) in social_type" :key="index" :label="item.label"
:value="item.value"></el-option>
:value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item class="ml2">
@ -20,74 +20,73 @@
<el-row>
<div class="mb8" style="width: 100%">
<el-button v-auth="'sys_social_details_add'" class="ml10" formDialogRef icon="folder-add" type="primary"
@click="formDialogRef.openDialog()">
@click="formDialogRef.openDialog()">
{{ $t('common.addBtn') }}
</el-button>
<el-button class="ml10" formDialogRef icon="Download" type="primary"
@click="exportExcel">
<el-button class="ml10" formDialogRef icon="Download" type="primary" @click="exportExcel">
{{ $t('common.exportBtn') }}
</el-button>
<el-button v-auth="'sys_social_details_del'" :disabled="multiple" class="ml10" formDialogRef icon="Delete"
type="primary" @click="handleDelete(undefined)">
type="primary" @click="handleDelete(selectObjs)">
{{ $t('common.delBtn') }}
</el-button>
<right-toolbar v-model:showSearch="showSearch" class="ml10" style="float: right;margin-right: 20px"
@queryTable="getDataList"></right-toolbar>
@queryTable="getDataList"></right-toolbar>
</div>
</el-row>
<el-table v-loading="state.loading" :data="state.dataList" style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="60"/>
<el-table-column :label="t('social.index')" type="index" width="80"/>
@selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="60" />
<el-table-column :label="t('social.index')" type="index" width="80" />
<el-table-column :label="t('social.type')" prop="type" show-overflow-tooltip>
<template #default="scope">
<dict-tag :options="social_type" :value="scope.row.type"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="t('social.remark')" prop="remark" show-overflow-tooltip/>
<el-table-column :label="t('social.appId')" prop="appId" show-overflow-tooltip/>
<el-table-column :label="t('social.appSecret')" prop="appSecret" show-overflow-tooltip/>
<el-table-column :label="t('social.createTime')" prop="createTime" show-overflow-tooltip/>
<el-table-column :label="t('social.remark')" prop="remark" show-overflow-tooltip />
<el-table-column :label="t('social.appId')" prop="appId" show-overflow-tooltip />
<el-table-column :label="t('social.appSecret')" prop="appSecret" show-overflow-tooltip />
<el-table-column :label="t('social.createTime')" prop="createTime" show-overflow-tooltip />
<el-table-column :label="$t('common.action')" width="150">
<template #default="scope">
<el-button v-auth="'sys_social_details_edit'" text type="primary"
@click="formDialogRef.openDialog(scope.row.id)">{{ $t('common.editBtn') }}
@click="formDialogRef.openDialog(scope.row.id)">{{ $t('common.editBtn') }}
</el-button>
<el-button v-auth="'sys_social_details_del'" text type="primary" @click="handleDelete(scope.row)">{{
$t('common.delBtn')
}}
<el-button v-auth="'sys_social_details_del'" text type="primary" @click="handleDelete([scope.row.id])">{{
$t('common.delBtn')
}}
</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-bind="state.pagination" @size-change="sizeChangeHandle" @current-change="currentChangeHandle"/>
<pagination v-bind="state.pagination" @size-change="sizeChangeHandle" @current-change="currentChangeHandle" />
</el-card>
<!-- 编辑新增 -->
<form-dialog ref="formDialogRef" @refresh="getDataList()"/>
<form-dialog ref="formDialogRef" @refresh="getDataList()" />
</div>
</template>
<script lang="ts" name="systemAppSocialDetails" setup>
import {BasicTableProps, useTable} from "/@/hooks/table";
import {delObj, fetchList} from "/@/api/admin/social";
import {useMessage, useMessageBox} from "/@/hooks/message";
import {useDict} from '/@/hooks/dict';
import {useI18n} from "vue-i18n";
import { BasicTableProps, useTable } from "/@/hooks/table";
import { delObj, fetchList } from "/@/api/admin/social";
import { useMessage, useMessageBox } from "/@/hooks/message";
import { useDict } from '/@/hooks/dict';
import { useI18n } from "vue-i18n";
//
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
const {t} = useI18n()
const { t } = useI18n()
//
const {social_type} = useDict('social_type')
const { social_type } = useDict('social_type')
//
const formDialogRef = ref()
//
const queryRef = ref()
const showSearch = ref(true)
//
const selectObjs = ref([])
const selectObjs = ref([]) as any
const multiple = ref(true)
const state: BasicTableProps = reactive<BasicTableProps>({
@ -110,34 +109,29 @@ const resetQuery = () => {
getDataList()
}
//
const handleSelectionChange = (val: any) => {
selectObjs.value = val
multiple.value = !val.length
}
// excel
const exportExcel = () => {
downBlobFile('/admin/social/export', state.queryForm, 'social.xlsx')
}
//
const handleDelete = (row: any) => {
if (!row) {
selectObjs.value.forEach((val: any) => {
handleDelete(val)
});
return
}
//
const handleSelectionChange = (objs: any) => {
objs.forEach((val: any) => {
selectObjs.value.push(val.id)
});
multiple.value = !objs.length
}
useMessageBox().confirm(t('common.delConfirmText') + row.id)
.then(() => {
delObj(row.id).then(() => {
getDataList();
useMessage().success(t('common.delSuccessText'));
}).catch((err: any) => {
useMessage().error(err.msg)
})
//
const handleDelete = (ids: string[]) => {
useMessageBox().confirm(t('common.delConfirmText'))
.then(() => {
delObj(ids).then(() => {
getDataList();
useMessage().success(t('common.delSuccessText'));
}).catch((err: any) => {
useMessage().error(err.msg)
})
})
};
</script>

View File

@ -15,8 +15,8 @@
</el-row>
<el-row>
<div class="mb8" style="width: 100%">
<el-button :disabled="multiple" icon="Delete" type="primary" class="ml10"
v-auth="'sys_user_del'" @click="handleDelete(undefined)">
<el-button :disabled="multiple" icon="Delete" type="primary" class="ml10" v-auth="'sys_user_del'"
@click="handleDelete(selectObjs)">
{{ $t('common.delBtn') }}
</el-button>
<right-toolbar v-model:showSearch="showSearch" class="ml10" style="float: right;margin-right: 20px"
@ -34,7 +34,8 @@
<el-table-column :label="$t('systoken.expiresAt')" prop="expiresAt" show-overflow-tooltip></el-table-column>
<el-table-column :label="$t('common.action')" width="100">
<template #default="scope">
<el-button v-auth="'sys_user_del'" size="small" text type="primary" @click="handleDelete(scope.row)">
<el-button v-auth="'sys_user_del'" size="small" text type="primary"
@click="handleDelete([scope.row.accessToken])">
{{ $t('common.delBtn') }}
</el-button>
</template>
@ -49,19 +50,19 @@
<script lang="ts" setup>
import { BasicTableProps, useTable } from "/@/hooks/table";
import { fetchList,delObj } from "/@/api/admin/token";
import { fetchList, delObj } from "/@/api/admin/token";
import { useI18n } from 'vue-i18n'
import { useMessage, useMessageBox } from "/@/hooks/message";
const { t } = useI18n()
//
const queryRef = ref();
const queryRef = ref()
const showSearch = ref(true)
// rows
const selectObjs = ref([]);
const selectObjs = ref([]) as any
//
const multiple = ref(true);
const multiple = ref(true)
const state: BasicTableProps = reactive<BasicTableProps>({
@ -88,30 +89,24 @@ const resetQuery = () => {
}
//
const handleSelectionChange = (val: any) => {
selectObjs.value = val
multiple.value = !val.length
const handleSelectionChange = (objs: any) => {
objs.forEach((val: any) => {
selectObjs.value.push(val.accessToken)
});
multiple.value = !objs.length
}
//
const handleDelete = (row: any) => {
if (!row) {
selectObjs.value.forEach(val => {
handleDelete(val)
});
return
}
useMessageBox().confirm(`${t('common.delConfirmText')}${row.username} ?`).then(() => {
//
delObj(row.accessToken).then(() => {
getDataList();
useMessage().success(t('common.delSuccessText'))
}).catch(err => {
useMessage().error(err.msg)
//
const handleDelete = (accessTokens: string[]) => {
useMessageBox().confirm(t('common.delConfirmText'))
.then(() => {
delObj(accessTokens).then(() => {
getDataList();
useMessage().success(t('common.delSuccessText'));
}).catch((err: any) => {
useMessage().error(err.msg)
})
})
})
};
</script>