feat:默认选中
This commit is contained in:
1 parent
f243e0330a
commit
f3cf7a5054
15 files changed
+730
-248
No files matched your search
@@ -14,7 +14,7 @@
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="目标商户" prop="targetMchId">
|
||||
<select-mch v-model="form.targetMchId" :apiParams="{ types: '1' }" />
|
||||
<select-mch v-model="form.targetMchId" autoFirst :apiParams="{ types: '1', notIds: [form.sourceMchId] }" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog width="50%" v-model="visible" :close-on-click-modal="false" @closed="dialogClosed" draggable>
|
||||
<el-dialog width="70%" v-model="visible" :close-on-click-modal="false" @closed="dialogClosed" draggable>
|
||||
<div>
|
||||
<el-tabs v-model="form.activeTab" class="demo-tabs">
|
||||
<div v-for="v in data.tabList" :key="v.id">
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
<template>
|
||||
<div class="size-full flex justify-start">
|
||||
<div class="size-full text-start">
|
||||
<span class="color-primary">{{ detail.deptName ? detail.deptName : "???" }}</span>
|
||||
<span>部门的用户将余额从</span>
|
||||
<span class="color-primary">{{ detail.sourceName ? detail.sourceName : "???" }}</span>
|
||||
<span>转到</span>
|
||||
<span class="color-primary">{{ detail.targetName ? detail.targetName : "???" }}</span>
|
||||
<span>百分比为</span>
|
||||
<span class="color-danger">{{ detail.balanceMultiple ? detail.balanceMultiple : "???" }}%</span>
|
||||
<span>,如100元从</span>
|
||||
<span class="color-primary">{{ detail.sourceName ? detail.sourceName : "???" }}</span>
|
||||
<span>转到</span>
|
||||
<span>,如</span>
|
||||
<span class="color-primary">100元</span>
|
||||
<span>总余额可转到</span>
|
||||
<span class="color-primary">{{ detail.targetName ? detail.targetName : "???" }}</span>
|
||||
<span>为{{ (100 * detail.balanceMultiple) / 100 }}元</span>
|
||||
<span class="color-success">{{ detail.targetName ? displayPrice(100 * detail.balanceMultiple) : "???元" }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -108,26 +108,38 @@
|
||||
<el-table-column
|
||||
label="操作"
|
||||
fixed="right"
|
||||
width="200"
|
||||
width="250"
|
||||
v-auths="['wallet_walletManage_edit', 'wallet_walletTransaction_update_balance']"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
icon="InfoFilled"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletManage_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)"
|
||||
>详情</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="Money"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletTransaction_update_balance'"
|
||||
@click="changeBalanceRef.openDialog(row.userId, row.id)"
|
||||
>充值/扣款</el-button
|
||||
>
|
||||
<div class="flex items-start">
|
||||
<el-button
|
||||
icon="InfoFilled"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletManage_edit'"
|
||||
@click="formDialogRef.openDialog(row.id)"
|
||||
>详情</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="Money"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletTransaction_update_balance'"
|
||||
@click="changeBalanceRef.openDialog(row.userId, row.id)"
|
||||
>充值/扣款</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="row.isRule == 1"
|
||||
icon="SwitchFilled"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletTransaction_update_balance'"
|
||||
@click="doTransferAccounts(row)"
|
||||
>
|
||||
转账
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -137,12 +149,13 @@
|
||||
</div>
|
||||
<transaction-list ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<change-balance ref="changeBalanceRef" @refresh="getDataList(false)" />
|
||||
<transfer-accounts ref="transferAccountsRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemWalletManage">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, fetchListJoin, delObjs } from "/@/api/wallet/wallet-manage"
|
||||
import * as walletManage from "/@/api/wallet/wallet-manage"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
@@ -150,22 +163,23 @@ import { displayPrice } from "/@/utils/formatMoney"
|
||||
// 引入组件
|
||||
const TransactionList = defineAsyncComponent(() => import("../components/transaction-list.vue"))
|
||||
const ChangeBalance = defineAsyncComponent(() => import("./change-balance.vue"))
|
||||
const TransferAccounts = defineAsyncComponent(() => import("./transfer-accounts.vue"))
|
||||
// 定义查询字典
|
||||
const { wallet_type, yes_no_type } = useDict("wallet_type", "yes_no_type")
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const changeBalanceRef = ref()
|
||||
const draggableDepTreeRef = ref()
|
||||
const transferAccountsRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchListJoin,
|
||||
pageList: walletManage.fetchListJoin,
|
||||
})
|
||||
|
||||
// table hook
|
||||
@@ -192,6 +206,12 @@ const exportExcel = () => {
|
||||
)
|
||||
}
|
||||
|
||||
// 转账
|
||||
const doTransferAccounts = (row: any) => {
|
||||
// 检查配置是否正确
|
||||
transferAccountsRef.value.openDialog(row.userId, row.id)
|
||||
}
|
||||
|
||||
const getSummaries = (param: any) => {
|
||||
const { columns, data } = param
|
||||
const totalColumns = ["balance", "totalExpense", "totalRecharge"]
|
||||
@@ -231,7 +251,7 @@ const handleDelete = async (ids: string[]) => {
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids)
|
||||
await walletManage.delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
<template>
|
||||
<el-dialog title="转账" v-model="visible" width="60%" :close-on-click-modal="false" draggable>
|
||||
<div>
|
||||
<el-alert title="错误" type="error">
|
||||
<span>{{ errorMsg }}</span>
|
||||
<span>请配置</span>
|
||||
</el-alert>
|
||||
<div v-if="!errorMsg">
|
||||
<el-descriptions :column="2" border title="用户">
|
||||
<el-descriptions-item :rowspan="1" label="用户名: ">
|
||||
<span>{{ userConfigDetail.username }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="手机号: ">
|
||||
<span>{{ userConfigDetail.userMobile }}</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="2" border title="钱包">
|
||||
<el-descriptions-item :rowspan="1" label="源钱包: ">
|
||||
<span class="color-primary">{{ walletDetail.walletTypeName }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="源余额: ">
|
||||
<span class="color-success">{{ displayPrice(walletDetail.balance) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="目标钱包: ">
|
||||
<span class="color-primary">{{ walletDetail.username }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :rowspan="1" label="目标余额: ">
|
||||
<span class="color-success">{{ walletDetail.username }}</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
<div class="flex justify-start items-center mt-5">
|
||||
<span>用户</span>
|
||||
<span class="color-primary">{{ walletDetail.username }}</span>
|
||||
<span>将</span>
|
||||
<el-input-number :disabled="errorMsg" class="mx-1" style="width: 200px" :min="1" :max="200" v-model="form.balance" placeholder="" />
|
||||
<span>元从</span>
|
||||
<span class="color-primary">{{ walletDetail.walletTypeName }}</span>
|
||||
<span>转到</span>
|
||||
<select-wallet-type
|
||||
class="mx-1"
|
||||
:clearable="false"
|
||||
:autoFirst="true"
|
||||
:apiParams="{ notWalletTypeIds: walletDetail.walletTypeId }"
|
||||
style="width: 200px"
|
||||
v-model="form.targetWalletTypeId"
|
||||
@change="selectWalletTypeChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="errorMsg || loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="transferAccounts">
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import * as walletApi from "/@/api/wallet/wallet-manage"
|
||||
import * as walletRuleJoin from "/@/api/wallet/wallet-rule-join"
|
||||
import * as walletTransactionApi from "/@/api/wallet/wallet-transaction"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import { convertToInteger } from "/@/utils/convert"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive<any>({
|
||||
id: undefined,
|
||||
balance: 10,
|
||||
changeType: 1,
|
||||
})
|
||||
|
||||
const walletDetail = reactive<any>({})
|
||||
|
||||
const userConfigDetail = reactive<any>({})
|
||||
|
||||
const errorMsg = ref<string>("")
|
||||
|
||||
/** 变动后的余额 */
|
||||
const balanceResult = computed(() => displayPrice(convertToInteger(form.balance) + convertToInteger(form.changeBalance) * form.changeType))
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
changeBalance: [{ required: true, message: "变动余额不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (userId: string, id: string) => {
|
||||
visible.value = true
|
||||
form.id = ""
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletManageData(userId, id)
|
||||
}
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
}
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
if (form.changeBalance <= 0) {
|
||||
useMessage().error("变动余额不能为零")
|
||||
return
|
||||
}
|
||||
if (convertToInteger(balanceResult.value) < 0) {
|
||||
useMessage().error("变动后的余额不能小于 0")
|
||||
return
|
||||
}
|
||||
try {
|
||||
loading.value = true
|
||||
const pa = {
|
||||
...form,
|
||||
userId: form.id,
|
||||
walletId: form.walletId,
|
||||
balance: form.changeBalance * 100,
|
||||
}
|
||||
if (pa.changeType == -1) {
|
||||
pa.balance = -1 * pa.balance
|
||||
}
|
||||
await walletTransactionApi.updateBalance(pa)
|
||||
useMessage().success("操作成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const getwalletManageData = async (userId: string, id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
try {
|
||||
const { data } = await walletApi.getObjDetails(id)
|
||||
Object.assign(walletDetail, data)
|
||||
getUserConfig(walletDetail.userId, walletDetail.walletTypeId, form.targetWalletTypeId)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const selectWalletTypeChange = (targetWalletTypeId: any) => {
|
||||
getUserConfig(walletDetail.userId, walletDetail.walletTypeId, targetWalletTypeId)
|
||||
}
|
||||
|
||||
// 用户配置
|
||||
const getUserConfig = async (userId: any, sourceWalletId: any, targetWalletId: any) => {
|
||||
if (!userId || !sourceWalletId || !targetWalletId) return
|
||||
const _pa = {
|
||||
userId: userId,
|
||||
sourceWalletTypeId: sourceWalletId,
|
||||
targetWalletTypeId: targetWalletId,
|
||||
}
|
||||
try {
|
||||
const { data } = await walletRuleJoin.userConfig(_pa)
|
||||
if (!data) return
|
||||
Object.assign(data, userConfigDetail)
|
||||
} catch (e: any) {
|
||||
errorMsg.value = e.msg
|
||||
useMessage().error(e.msg)
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-descriptions) {
|
||||
&:not(:nth-child(1)) {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.el-descriptions__cell.is-bordered-label {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.el-descriptions__cell.is-bordered-content {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.el-descriptions__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&::before {
|
||||
display: inline-block;
|
||||
width: 3px;
|
||||
height: 20px;
|
||||
margin-right: 10px;
|
||||
background-color: #409eff;
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
|
||||
.el-descriptions-item__container {
|
||||
margin: 0 10px;
|
||||
|
||||
.no-colon {
|
||||
margin: 0;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -9,7 +9,16 @@
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="目标钱包类型" prop="targetWalletTypeId">
|
||||
<select-wallet-type v-model="form.targetWalletTypeId" />
|
||||
<select-wallet-type
|
||||
v-model="form.targetWalletTypeId"
|
||||
:autoFirst="true"
|
||||
:apiParams="{ notWalletTypeIds: form.sourceWalletTypeId }"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20" v-if="!form.id">
|
||||
<el-form-item label="目标部门" prop="targetDeptIdList">
|
||||
<tree-multiple-select style="width: 400px" v-model="form.targetDeptIdList" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
@@ -17,11 +26,6 @@
|
||||
<el-input-number :min="1" :max="200" v-model="form.balanceMultiple" placeholder="" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-alert title="提示" type="info" :closable="false">
|
||||
<wallet-rule-desc :detail="form" />
|
||||
</el-alert>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -37,8 +41,6 @@
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import * as walletRuleJoinApi from "/@/api/wallet/wallet-rule-join"
|
||||
|
||||
const WalletRuleDesc = defineAsyncComponent(() => import("../../components/wallet-rule-desc.vue"))
|
||||
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
// 定义变量内容
|
||||
@@ -52,6 +54,8 @@ const defaultForm = {
|
||||
id: "",
|
||||
sourceWalletTypeId: "",
|
||||
targetWalletTypeId: "",
|
||||
targetDeptId: "",
|
||||
targetDeptIdList: [],
|
||||
balanceMultiple: 100,
|
||||
status: 0,
|
||||
}
|
||||
@@ -61,21 +65,21 @@ const form = reactive({
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
sourceWalletTypeId: [{ required: true, message: "请选择源钱包类型", trigger: "blur" }],
|
||||
targetWalletTypeId: [{ required: true, message: "请选择目标钱包类型", trigger: "blur" }],
|
||||
balanceMultiple: [{ required: true, message: "请输入钱包转换百分比", trigger: "blur" }],
|
||||
sourceWalletTypeId: [{ required: true, message: "请选择源钱包类型", trigger: "change" }],
|
||||
targetWalletTypeId: [{ required: true, message: "请选择目标钱包类型", trigger: "change" }],
|
||||
targetDeptId: [{ required: true, message: "请选择目标部门", trigger: "change" }],
|
||||
targetDeptIdList: [{ required: true, message: "请选择目标部门", trigger: "change" }],
|
||||
balanceMultiple: [{ required: true, message: "请输入钱包转换百分比", trigger: "change" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string, sourceWalletTypeId: string) => {
|
||||
visible.value = true
|
||||
Object.assign(form, defaultForm)
|
||||
form.sourceWalletTypeId = sourceWalletTypeId
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
Object.assign(form, { ...defaultForm, sourceWalletTypeId: sourceWalletTypeId })
|
||||
})
|
||||
// 获取walletRuleJoin信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletRuleJoinData(id)
|
||||
@@ -86,14 +90,11 @@ const openDialog = (id: string, sourceWalletTypeId: string) => {
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return false
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
const { data } = form.id ? await walletRuleJoinApi.putObj(form) : await walletRuleJoinApi.addObj(form)
|
||||
form.id ? await walletRuleJoinApi.putObj(form) : await walletRuleJoinApi.addObj(form)
|
||||
useMessage().success(form.id ? "修改成功" : "添加成功")
|
||||
// visible.value = false
|
||||
// 更新
|
||||
await getwalletRuleJoinData(data)
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog title="钱包规则" width="70%" v-model="visible" append-to-body :close-on-click-modal="false" draggable>
|
||||
<el-dialog title="钱包规则" width="75%" v-model="visible" append-to-body :close-on-click-modal="false" draggable>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="doAdd" v-auth="'dzc_walletRuleMchConfig_add'"> 新 增 </el-button>
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="120" label="目前钱包类型">
|
||||
<el-table-column min-width="120" label="目标钱包类型">
|
||||
<template #default="{ row }">
|
||||
<div class="flex items-center justify-center">
|
||||
<div class="color-primary">{{ row.targetName }}</div>
|
||||
@@ -36,6 +36,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="120" prop="deptName" label="目标部门" show-overflow-tooltip />
|
||||
<el-table-column prop="rulePriceConfigId" min-width="80" label="转换百分比">
|
||||
<template #default="{ row }">
|
||||
<span class="color-success">{{ row.balanceMultiple }}%</span>
|
||||
@@ -58,7 +59,7 @@
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'dzc_walletRuleMchConfig_edit'"
|
||||
@click="WalletRuleFormDialogRef.openDialog(row.id, state.queryForm.sourceWalletTypeId)"
|
||||
@click="WalletRuleFormDialogRef.openDialog(row.id, row.sourceWalletTypeId)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button icon="delete" text type="primary" v-auth="'dzc_walletRuleMchConfig_del'" @click="handleDelete([row.id])"
|
||||
|
||||
@@ -49,21 +49,37 @@
|
||||
<dict-tag :options="wallet_type" :value="row.uniqueCode" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isRule" label="是否启用钱包规则" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
v-auth="'wallet_walletManage_edit'"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
v-model="row.isRule"
|
||||
@change="isRuleChange(row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-auths="['wallet_walletType_edit', 'wallet_walletType_del']" label="操作" width="250">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
icon="InfoFilled"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletManage_edit'"
|
||||
@click="WalletRuleTableDialogRef.openDialog(row.id)"
|
||||
>
|
||||
钱包规则
|
||||
</el-button>
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'wallet_walletType_edit'" @click="formDialogRef.openDialog(row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'wallet_walletType_del'" @click="handleDelete([row.id])"> 删除 </el-button>
|
||||
<div class="flex items-start">
|
||||
<el-button
|
||||
v-if="row.isRule == 1"
|
||||
icon="InfoFilled"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'wallet_walletManage_edit'"
|
||||
@click="WalletRuleTableDialogRef.openDialog(row.id)"
|
||||
>
|
||||
钱包规则
|
||||
</el-button>
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'wallet_walletType_edit'" @click="formDialogRef.openDialog(row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'wallet_walletType_del'" @click="handleDelete([row.id])">
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -78,7 +94,7 @@
|
||||
|
||||
<script setup lang="ts" name="systemWalletType">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, delObjs } from "/@/api/wallet/wallet-type"
|
||||
import * as walletTypeApi from "/@/api/wallet/wallet-type"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
@@ -99,7 +115,7 @@ const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
pageList: walletTypeApi.fetchList,
|
||||
})
|
||||
|
||||
// table hook
|
||||
@@ -125,6 +141,17 @@ const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 修改是否启用钱包规则
|
||||
const isRuleChange = async (row: any) => {
|
||||
try {
|
||||
await walletTypeApi.putObj(row)
|
||||
getDataList()
|
||||
useMessage().success("操作成功")
|
||||
} catch (e) {
|
||||
useMessage().error("操作错误")
|
||||
}
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
@@ -134,7 +161,7 @@ const handleDelete = async (ids: string[]) => {
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids)
|
||||
await walletTypeApi.delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
|
||||
Reference in new issue
Block a user