Merge branch 'master' of https://codeup.aliyun.com/bsdtec/biz-pc-cloud
This commit is contained in:
commit
6ca8b29bde
31 files changed
+2022
-124
No files matched your search
+2
-1
@@ -12,7 +12,8 @@ VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/
|
||||
#VITE_ADMIN_PROXY_PATH = http://192.168.110.156:9999
|
||||
|
||||
# 图片访问基础地址
|
||||
VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api
|
||||
# VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api
|
||||
VITE_IMAGE_BASE_PATH = http://localhost:9999
|
||||
|
||||
# 代码生成服务地址
|
||||
VITE_GEN_PROXY_PATH = http://192.168.110.156:5003
|
||||
@@ -0,0 +1,49 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function pageJoin(query?: Object) {
|
||||
return request({
|
||||
url: '/admin/user-face/page-join',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/admin/user-face/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/admin/user-face',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/admin/user-face/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/admin/user-face',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/admin/user-face',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/merchantManage/mchManage/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/mch/mchManage',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/mch/mchManage/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/mch/mchManage',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/mch/mchManage',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-manage/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchListJoin(query?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-manage/page-join',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-manage',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/wallet/wallet-manage/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-manage',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-manage',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-recharge-apply/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-recharge-apply',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/wallet/wallet-recharge-apply/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-recharge-apply',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/wallet-recharge-apply',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function updateBalance(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/walletTransaction/update-balance',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/wallet/walletTransaction/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function pageJoin(query?: Object) {
|
||||
return request({
|
||||
url: '/wallet/walletTransaction/page-join',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/walletTransaction',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/wallet/walletTransaction/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/wallet/walletTransaction',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/walletTransaction',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/wallet/walletType/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/walletType',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/wallet/walletType/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/wallet/walletType',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/wallet/walletType',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<el-select style="width: 100%;" v-model="state.selectId" :placeholder="props.placeholder" clearable
|
||||
@visible-change="(e: boolean) => e && getDictOptions()">
|
||||
<el-option v-for="v in state.dictList" :key="v.code" :label="v.label" :value="v.value" />
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="dict-select">
|
||||
import { reactive, computed, defineModel, withDefaults, defineProps } from 'vue';
|
||||
import { dict } from '/@/stores/dict';
|
||||
import { getDicts } from '/@/api/admin/dict';
|
||||
|
||||
const selectId = defineModel()
|
||||
|
||||
export type Props = {
|
||||
dictCode: string,
|
||||
placeholder?: string,
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
placeholder: "请选择",
|
||||
})
|
||||
|
||||
const state = reactive<any>({
|
||||
selectId: selectId,
|
||||
dictList: []
|
||||
})
|
||||
|
||||
watch(selectId, (newVal, oldValue) => {
|
||||
if (newVal == oldValue) return
|
||||
state.selectId = newVal
|
||||
getDictOptions()
|
||||
}, { immediate: true })
|
||||
|
||||
async function getDictOptions() {
|
||||
if (!props.dictCode) return []
|
||||
const dicts = dict().getDict(props.dictCode)
|
||||
if (dicts) return dicts
|
||||
const res = await getDicts(props.dictCode)
|
||||
if (!res) return []
|
||||
state.dictList = res.data.map((p: any) => ({ label: p.label, value: p.value, elTagType: p.listClass, elTagClass: p.cssClass }));
|
||||
dict().setDict(props.dictCode, state.dictList);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-tag+.el-tag {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,72 @@
|
||||
<!-- 图片预览 -->
|
||||
<script lang="ts" setup name="PreviewImage">
|
||||
|
||||
type Props = {
|
||||
src?: string
|
||||
width?: string | number
|
||||
height?: string | number
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
width: 50,
|
||||
height: 50,
|
||||
})
|
||||
|
||||
const realSrc = computed(() => {
|
||||
if (!props.src) return "";
|
||||
let real_src = props.src.split(",")[0];
|
||||
return dispatchUrl(real_src) ?? "";
|
||||
})
|
||||
const realSrcList = computed(() => {
|
||||
if (!props.src) return "";
|
||||
let real_src = props.src.split(",")?.map(v => dispatchUrl(v));
|
||||
return real_src ?? [];
|
||||
})
|
||||
const realWidth = computed(() => typeof props.width == "string" ? props.width : `${props.width}px`)
|
||||
const realHeight = computed(() => typeof props.height == "string" ? props.height : `${props.height}px`)
|
||||
|
||||
function dispatchUrl(url?: string) {
|
||||
if (!url) return ""
|
||||
return url.includes('http') ? url : import.meta.env.VITE_IMAGE_BASE_PATH + url
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-image v-if="props.src" hide-on-click-modal preview-teleported :src="`${realSrc}`" fit="cover"
|
||||
:style="`width:${realWidth};height:${realHeight};`" :preview-src-list="realSrcList">
|
||||
<template #error>
|
||||
<div class="image-slot">
|
||||
<i class="el-icon-picture-outline"></i>
|
||||
</div>
|
||||
</template>
|
||||
</el-image>
|
||||
<div v-else :style="`width:${realWidth};height:${realHeight};`" />
|
||||
</template>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-image {
|
||||
border-radius: 5px;
|
||||
background-color: #ebeef5;
|
||||
box-shadow: 0 0 5px 1px #ccc;
|
||||
|
||||
:deep(.el-image__inner) {
|
||||
transition: all 0.3s;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.image-slot) {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
color: #909399;
|
||||
font-size: 30px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<el-select style="width: 100%;" v-model="state.selectId" :placeholder="props.placeholder" clearable
|
||||
remote-show-suffix filterable remote :remote-method="remoteSearch" :loading="state.loading"
|
||||
@visible-change="(e: boolean) => e && getOptions()">
|
||||
<el-option v-for="v in state.options" :key="v.userId" :label="`${v.name}-${v.phone}`" :value="v.userId">
|
||||
<div class="flex items-center">
|
||||
<div class="color-primary">{{ v.name }}</div>
|
||||
<div class="pl5 color-success">{{ v.phone }}</div>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="select-user">
|
||||
import { reactive, computed, defineModel, withDefaults, defineProps } from 'vue'
|
||||
import * as userApi from '/@/api/admin/user'
|
||||
|
||||
const selectId = defineModel()
|
||||
|
||||
export type Props = {
|
||||
placeholder?: string,
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
placeholder: "请选择",
|
||||
})
|
||||
|
||||
const queryForm = reactive<any>({
|
||||
name: "",
|
||||
current: 1,
|
||||
size: 10,
|
||||
})
|
||||
|
||||
const state = reactive<any>({
|
||||
loading: true,
|
||||
selectId: selectId,
|
||||
options: []
|
||||
})
|
||||
|
||||
watch(selectId, (newVal, oldValue) => {
|
||||
if (newVal == oldValue) return
|
||||
state.selectId = newVal
|
||||
getOptions()
|
||||
}, { immediate: true })
|
||||
|
||||
async function getOptions() {
|
||||
try {
|
||||
state.loading = true
|
||||
const _pa = {
|
||||
...queryForm
|
||||
}
|
||||
const { data } = await userApi.pageList(_pa)
|
||||
state.options = data.records ?? []
|
||||
} finally {
|
||||
setTimeout(() => state.loading = false, 500);
|
||||
}
|
||||
}
|
||||
|
||||
function remoteSearch(params: string) {
|
||||
if (params != queryForm.name) {
|
||||
queryForm.name = params
|
||||
getOptions()
|
||||
}
|
||||
}
|
||||
|
||||
function clear() {
|
||||
state.selectId = null
|
||||
getOptions()
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<el-select style="width: 100%;" v-model="state.selectId" :placeholder="props.placeholder" clearable
|
||||
remote-show-suffix filterable remote :remote-method="remoteSearch" :loading="state.loading"
|
||||
@visible-change="(e: boolean) => e && getOptions()">
|
||||
<el-option v-for="v in state.options" :key="v.id" :label="`${v.name}`" :value="v.id">
|
||||
<div class="flex items-center justify-center">
|
||||
<div class="color-primary">{{ v.name }}</div>
|
||||
<div class="flex items-center just ml5">
|
||||
<el-tag size="small">{{ state.walletType.find((i: any) => i.value == v.uniqueCode).label }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="select-wallet-type">
|
||||
import { reactive, computed, defineModel, withDefaults, defineProps } from 'vue'
|
||||
import * as walletTypeApi from '/@/api/wallet/wallet-type'
|
||||
import { useDict } from '/@/hooks/dict'
|
||||
|
||||
const selectId = defineModel()
|
||||
|
||||
export type Props = {
|
||||
placeholder?: string,
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
placeholder: "请选择",
|
||||
})
|
||||
|
||||
const queryForm = reactive<any>({
|
||||
name: "",
|
||||
current: 1,
|
||||
size: 10,
|
||||
})
|
||||
|
||||
const state = reactive<any>({
|
||||
loading: true,
|
||||
selectId: selectId,
|
||||
options: [],
|
||||
walletType: []
|
||||
})
|
||||
|
||||
watch(selectId, (newVal, oldValue) => {
|
||||
if (newVal == oldValue) return
|
||||
state.selectId = newVal
|
||||
getOptions()
|
||||
}, { immediate: true })
|
||||
|
||||
async function getOptions() {
|
||||
try {
|
||||
state.loading = true
|
||||
const _pa = {
|
||||
...queryForm
|
||||
}
|
||||
const { data } = await walletTypeApi.fetchList(_pa)
|
||||
state.options = data.records ?? []
|
||||
|
||||
const { wallet_type } = useDict('wallet_type')
|
||||
state.walletType = wallet_type
|
||||
} finally {
|
||||
setTimeout(() => state.loading = false, 500);
|
||||
}
|
||||
}
|
||||
|
||||
function remoteSearch(params: string) {
|
||||
if (params != queryForm.name) {
|
||||
queryForm.name = params
|
||||
getOptions()
|
||||
}
|
||||
}
|
||||
|
||||
function clear() {
|
||||
state.selectId = null
|
||||
getOptions()
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -1,6 +1,7 @@
|
||||
import Pagination from '/@/components/Pagination/index.vue';
|
||||
import RightToolbar from '/@/components/RightToolbar/index.vue';
|
||||
import DictTag from '/@/components/DictTag/index.vue';
|
||||
import DictSelect from "/@/components/DictSelect/index.vue"
|
||||
import UploadExcel from '/@/components/Upload/Excel.vue';
|
||||
import UploadFile from '/@/components/Upload/index.vue';
|
||||
import UploadImg from '/@/components/Upload/Image.vue';
|
||||
@@ -10,6 +11,12 @@ import Editor from '/@/components/Editor/index.vue';
|
||||
import Tip from '/@/components/Tip/index.vue';
|
||||
import TagList from '/@/components/TagList/index.vue';
|
||||
import SvgIcon from '/@/components/SvgIcon/index.vue';
|
||||
import PreviewImage from "/@/components/PreviewImage/index.vue"
|
||||
|
||||
// 业务组件
|
||||
import SelectUser from '/@/components/Select/SelectUser.vue'
|
||||
import SelectWalletType from '/@/components/Select/SelectWalletType.vue'
|
||||
|
||||
|
||||
// 第三方组件
|
||||
import ElementPlus from 'element-plus';
|
||||
@@ -32,6 +39,7 @@ import { App } from 'vue';
|
||||
export default {
|
||||
install(app: App) {
|
||||
app.component('DictTag', DictTag);
|
||||
app.component('DictSelect', DictSelect)
|
||||
app.component('Pagination', Pagination);
|
||||
app.component('RightToolbar', RightToolbar);
|
||||
app.component('uploadExcel', UploadExcel);
|
||||
@@ -43,6 +51,9 @@ export default {
|
||||
app.component('DelWrap', DelWrap);
|
||||
app.component('TagList', TagList);
|
||||
app.component('SvgIcon', SvgIcon);
|
||||
app.component('PreviewImage', PreviewImage)
|
||||
app.component('SelectUser', SelectUser)
|
||||
app.component('SelectWalletType', SelectWalletType)
|
||||
|
||||
// 导入全部的elmenet-plus的图标
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// 定义通用内容
|
||||
export default {
|
||||
common: {
|
||||
confirmTitle: '警告',
|
||||
queryBtn: '查询',
|
||||
addBtn: '新 增',
|
||||
editBtn: '修 改',
|
||||
|
||||
@@ -7,6 +7,7 @@ import Components from '/@/components';
|
||||
import { i18n } from '/@/i18n';
|
||||
import { properties } from '/@/utils/globalProperties';
|
||||
import { initAntiDebug } from '/@/utils/anti-debug';
|
||||
import "/@/assets/styles/global.scss"
|
||||
|
||||
// Initialize anti-debug protection
|
||||
initAntiDebug();
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export const convertToInteger = (num: number | string | undefined): number => {
|
||||
if (typeof num === 'undefined') return 0
|
||||
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
|
||||
return Math.round(parsedNumber * 100)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 显示价格把分转换到元
|
||||
* @param price
|
||||
* @returns
|
||||
*/
|
||||
export function displayPrice(price: any, suffix: string = "元") {
|
||||
if (typeof price === 'undefined') return '0.0' + suffix
|
||||
const parsedNumber = typeof price === 'string' ? parseFloat(price) : price
|
||||
return (parsedNumber / 100.0).toFixed(1) + suffix
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<div class="system-user-dialog-container">
|
||||
<el-dialog :close-on-click-modal="false" title="人脸管理" draggable v-model="dialogVisible">
|
||||
<el-button icon="folder-add" type="primary" @click="addFace">
|
||||
新增
|
||||
</el-button>
|
||||
<div class="h-4" />
|
||||
<el-table v-loading="state.loading" :data="state.dataList" row-key="userId" border
|
||||
:cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle">
|
||||
<el-table-column prop="username" align="center" label="用户名" />
|
||||
<el-table-column prop="date" align="center" label="人脸">
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.faceImg" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="address" align="center" label="操作">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="editFace(row)">
|
||||
<Icon icon="ep:edit" />修改
|
||||
</el-button>
|
||||
<el-button link type="danger" @click="delFace(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog v-model="uploadDialogVisible" :close-on-click-modal="false" :title="faceUploadTitle" width="30%"
|
||||
@close="uploadDialogClone">
|
||||
<el-form v-loading="formLoading" ref="formRef" :model="formData" :rules="formRules" label-width="80px">
|
||||
<el-form-item label="人脸" prop="uploadFace">
|
||||
<upload-img v-model:image-url="formData.uploadFace" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitFace" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="uploadDialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="face-manage">
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import * as userFaceApi from "/@/api/admin/userFace"
|
||||
import { useMessage } from '/@/hooks/message';
|
||||
|
||||
// 定义刷新表格emit
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const formRef = ref()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const uploadDialogVisible = ref(false)
|
||||
|
||||
const faceUploadTitle = ref<"上传人脸" | "修改人脸">("上传人脸")
|
||||
|
||||
const formLoading = ref(false)
|
||||
const faceTableLoading = ref(false)
|
||||
|
||||
const formData = ref<any>({
|
||||
id: undefined,
|
||||
uploadFace: undefined,
|
||||
})
|
||||
const detailId = ref<any>(null)
|
||||
|
||||
// 定义表格查询、后台调用的API
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
deptId: '',
|
||||
username: '',
|
||||
phone: '',
|
||||
},
|
||||
pageList: userFaceApi.pageJoin,
|
||||
});
|
||||
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
||||
|
||||
const formRules = reactive({
|
||||
uploadFace: [{ required: true, message: '请上传人脸', trigger: 'blur' }],
|
||||
})
|
||||
|
||||
const submitForm = async () => {
|
||||
dialogVisible.value = false
|
||||
emit('refresh')
|
||||
}
|
||||
|
||||
const addFace = (row: any) => {
|
||||
faceUploadTitle.value = "上传人脸"
|
||||
formData.value.uploadFace = ""
|
||||
uploadDialogVisible.value = true
|
||||
}
|
||||
|
||||
const editFace = (row: any) => {
|
||||
faceUploadTitle.value = "修改人脸"
|
||||
formData.value.id = row.id
|
||||
formData.value.uploadFace = row.faceImg
|
||||
uploadDialogVisible.value = true
|
||||
}
|
||||
|
||||
const delFace = async (row: any) => {
|
||||
try {
|
||||
await useMessage().delConfirm('是否删除人脸?')
|
||||
userFaceApi.delObjs(row.id)
|
||||
useMessage().success("删除成功")
|
||||
getDataList()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
const openDialog = async (id: number) => {
|
||||
if (!id) return;
|
||||
dialogVisible.value = true
|
||||
resetForm()
|
||||
detailId.value = id
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const submitFace = async () => {
|
||||
if (!formRef) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
formLoading.value = true
|
||||
const pa: any = {
|
||||
userId: detailId.value,
|
||||
faceImg: formData.value.uploadFace,
|
||||
}
|
||||
if (faceUploadTitle.value == "修改人脸") {
|
||||
pa.id = formData.value.id
|
||||
}
|
||||
try {
|
||||
const fc = faceUploadTitle.value == "上传人脸" ? userFaceApi.addObj : userFaceApi.putObj
|
||||
await fc(pa)
|
||||
useMessage().success("操作成功")
|
||||
uploadDialogClone()
|
||||
getDataList()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const uploadDialogClone = () => {
|
||||
uploadDialogVisible.value = false
|
||||
resetForm()
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
uploadFace: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
defineExpose({ openDialog })
|
||||
</script>
|
||||
@@ -1,16 +1,19 @@
|
||||
<template>
|
||||
<div class="system-user-dialog-container">
|
||||
<el-dialog :close-on-click-modal="false" :title="dataForm.userId ? $t('common.editBtn') : $t('common.addBtn')" draggable v-model="visible">
|
||||
<el-dialog :close-on-click-modal="false" :title="dataForm.userId ? $t('common.editBtn') : $t('common.addBtn')"
|
||||
draggable v-model="visible">
|
||||
<el-form :model="dataForm" :rules="dataRules" label-width="90px" ref="dataFormRef" v-loading="loading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.username')" prop="username">
|
||||
<el-input :disabled="dataForm.userId !== ''" placeholder="请输入用户名" v-model="dataForm.username"></el-input>
|
||||
<el-input :disabled="dataForm.userId !== ''" placeholder="请输入用户名"
|
||||
v-model="dataForm.username"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.password')" prop="password">
|
||||
<el-input clearable placeholder="请输入密码" type="password" v-model="dataForm.password"></el-input>
|
||||
<el-input clearable placeholder="请输入密码" type="password"
|
||||
v-model="dataForm.password"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
@@ -26,28 +29,24 @@
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.role')" prop="role">
|
||||
<el-select clearable multiple placeholder="请选择角色" v-model="dataForm.role">
|
||||
<el-option :key="item.roleId" :label="item.roleName" :value="item.roleId" v-for="item in roleData" />
|
||||
<el-option :key="item.roleId" :label="item.roleName" :value="item.roleId"
|
||||
v-for="item in roleData" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.post')" prop="post">
|
||||
<el-select clearable multiple placeholder="请选择岗位" v-model="dataForm.post">
|
||||
<el-option :key="item.postId" :label="item.postName" :value="item.postId" v-for="item in postData" />
|
||||
<el-option :key="item.postId" :label="item.postName" :value="item.postId"
|
||||
v-for="item in postData" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.dept')" prop="deptId">
|
||||
<el-tree-select
|
||||
:data="deptData"
|
||||
:props="{ value: 'id', label: 'name', children: 'children' }"
|
||||
check-strictly
|
||||
class="w100"
|
||||
clearable
|
||||
placeholder="请选择所属部门"
|
||||
v-model="dataForm.deptId"
|
||||
>
|
||||
<el-tree-select :data="deptData"
|
||||
:props="{ value: 'id', label: 'name', children: 'children' }" check-strictly
|
||||
class="w100" clearable placeholder="请选择所属部门" v-model="dataForm.deptId">
|
||||
</el-tree-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -65,7 +64,8 @@
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.lockFlag')" prop="lockFlag">
|
||||
<el-radio-group v-model="dataForm.lockFlag">
|
||||
<el-radio :key="index" :label="item.value" border v-for="(item, index) in lock_flag">{{ item.label }} </el-radio>
|
||||
<el-radio :key="index" :label="item.value" border v-for="(item, index) in lock_flag">{{
|
||||
item.label }} </el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -74,7 +74,8 @@
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ $t('common.cancelButtonText') }}</el-button>
|
||||
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText') }}</el-button>
|
||||
<el-button @click="onSubmit" type="primary" :disabled="loading">{{ $t('common.confirmButtonText')
|
||||
}}</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -107,10 +108,10 @@ const postData = ref<any[]>([]);
|
||||
const loading = ref(false);
|
||||
|
||||
const props = defineProps({
|
||||
deptId: {
|
||||
type: String,
|
||||
default: '',
|
||||
}
|
||||
deptId: {
|
||||
type: String,
|
||||
default: '',
|
||||
}
|
||||
});
|
||||
|
||||
const dataForm = reactive({
|
||||
@@ -155,7 +156,7 @@ const dataRules = ref({
|
||||
],
|
||||
// 姓名校验,不能为空、只能是中文
|
||||
name: [
|
||||
{ validator: rule.overLength, trigger: 'blur' },
|
||||
{ validator: rule.overLength, trigger: 'blur' },
|
||||
{ required: true, message: '姓名不能为空', trigger: 'blur' },
|
||||
{ validator: rule.chinese, trigger: 'blur' },
|
||||
],
|
||||
@@ -173,7 +174,7 @@ const dataRules = ref({
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] },{ validator: rule.overLength, trigger: 'blur' }],
|
||||
email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }, { validator: rule.overLength, trigger: 'blur' }],
|
||||
lockFlag: [{ required: true, message: '状态不能为空', trigger: 'blur' }],
|
||||
});
|
||||
|
||||
@@ -202,7 +203,7 @@ const openDialog = async (id: string) => {
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||
const valid = await dataFormRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
@@ -263,9 +264,9 @@ const getDeptData = () => {
|
||||
deptTree().then((res) => {
|
||||
deptData.value = res.data;
|
||||
// 默认选择在树中选中的部门
|
||||
if (!dataForm.userId) {
|
||||
dataForm.deptId = props.deptId;
|
||||
}
|
||||
if (!dataForm.userId) {
|
||||
dataForm.deptId = props.deptId;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -274,9 +275,9 @@ const getPostData = () => {
|
||||
postList().then((res) => {
|
||||
postData.value = res.data;
|
||||
// 默认选择第一个
|
||||
if (!dataForm.userId) {
|
||||
dataForm.post = [res.data[0].postId];
|
||||
}
|
||||
if (!dataForm.userId) {
|
||||
dataForm.post = [res.data[0].postId];
|
||||
}
|
||||
});
|
||||
};
|
||||
// 角色数据
|
||||
@@ -284,9 +285,9 @@ const getRoleData = () => {
|
||||
roleList().then((res) => {
|
||||
roleData.value = res.data;
|
||||
// 默认选择第一个
|
||||
if (!dataForm.userId) {
|
||||
dataForm.role = [res.data[0].roleId];
|
||||
}
|
||||
if (!dataForm.userId) {
|
||||
dataForm.role = [res.data[0].roleId];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -4,12 +4,13 @@
|
||||
<pane size="15">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-scrollbar>
|
||||
<query-tree :placeholder="$t('common.queryDeptTip')" :query="deptData.queryList" :show-expand="true" @node-click="handleNodeClick">
|
||||
<query-tree :placeholder="$t('common.queryDeptTip')" :query="deptData.queryList"
|
||||
:show-expand="true" @node-click="handleNodeClick">
|
||||
<!-- 没有数据权限提示 -->
|
||||
<template #default="{ node, data }">
|
||||
<el-tooltip v-if="data.isLock" class="item" effect="dark" :content="$t('sysuser.noDataScopeTip')" placement="right-start">
|
||||
<span
|
||||
>{{ node.label }}
|
||||
<el-tooltip v-if="data.isLock" class="item" effect="dark"
|
||||
:content="$t('sysuser.noDataScopeTip')" placement="right-start">
|
||||
<span>{{ node.label }}
|
||||
<SvgIcon name="ele-Lock" />
|
||||
</span>
|
||||
</el-tooltip>
|
||||
@@ -24,103 +25,99 @@
|
||||
<el-row v-show="showSearch">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-form-item :label="$t('sysuser.username')" prop="username">
|
||||
<el-input v-model="state.queryForm.username" :placeholder="$t('sysuser.inputUsernameTip')" clearable />
|
||||
<el-input v-model="state.queryForm.username"
|
||||
:placeholder="$t('sysuser.inputUsernameTip')" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('sysuser.phone')" prop="phone">
|
||||
<el-input v-model="state.queryForm.phone" :placeholder="$t('sysuser.inputPhoneTip')" clearable />
|
||||
<el-input v-model="state.queryForm.phone" :placeholder="$t('sysuser.inputPhoneTip')"
|
||||
clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t('common.queryBtn') }}</el-button>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t('common.queryBtn')
|
||||
}}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button v-auth="'sys_user_add'" icon="folder-add" type="primary" @click="userDialogRef.openDialog()">
|
||||
<el-button v-auth="'sys_user_add'" icon="folder-add" type="primary"
|
||||
@click="userDialogRef.openDialog()">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button plain v-auth="'sys_user_add'" class="ml10" icon="upload-filled" type="primary" @click="excelUploadRef.show()">
|
||||
<el-button plain v-auth="'sys_user_add'" class="ml10" icon="upload-filled" type="primary"
|
||||
@click="excelUploadRef.show()">
|
||||
{{ $t('common.importBtn') }}
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
plain
|
||||
v-auth="'sys_user_del'"
|
||||
:disabled="multiple"
|
||||
class="ml10"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
<el-button plain v-auth="'sys_user_del'" :disabled="multiple" class="ml10" icon="Delete"
|
||||
type="primary" @click="handleDelete(selectObjs)">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'sys_user_export'"
|
||||
@exportExcel="exportExcel"
|
||||
@queryTable="getDataList"
|
||||
class="ml10 mr20"
|
||||
style="float: right"
|
||||
/>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'sys_user_export'"
|
||||
@exportExcel="exportExcel" @queryTable="getDataList" class="ml10 mr20"
|
||||
style="float: right" />
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
v-loading="state.loading"
|
||||
:data="state.dataList"
|
||||
@selection-change="handleSelectionChange"
|
||||
row-key="userId"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
>
|
||||
<el-table v-loading="state.loading" :data="state.dataList" @selection-change="handleSelectionChange"
|
||||
row-key="userId" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle">
|
||||
<el-table-column :selectable="handleSelectable" type="selection" width="40" />
|
||||
<el-table-column :label="$t('sysuser.index')" type="index" width="60" fixed="left" />
|
||||
<el-table-column :label="$t('sysuser.username')" prop="username" fixed="left" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysuser.name')" prop="name" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysuser.phone')" prop="phone" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysuser.username')" prop="username" fixed="left"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysuser.name')" prop="name"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysuser.phone')" prop="phone"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysuser.post')" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-tag v-for="(item, index) in scope.row.postList" :key="index">{{ item.postName }}</el-tag>
|
||||
<el-tag v-for="(item, index) in scope.row.postList" :key="index">{{ item.postName
|
||||
}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('sysuser.role')" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-tag v-for="(item, index) in scope.row.roleList" :key="index">{{ item.roleName }}</el-tag>
|
||||
<el-tag v-for="(item, index) in scope.row.roleList" :key="index">{{ item.roleName
|
||||
}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('sysuser.lockFlag')" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.lockFlag" @change="changeSwitch(scope.row)" active-value="0" inactive-value="9"></el-switch>
|
||||
<el-switch v-model="scope.row.lockFlag" @change="changeSwitch(scope.row)"
|
||||
active-value="0" inactive-value="9"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('common.action')" width="200" fixed="right">
|
||||
<el-table-column :label="$t('common.action')" width="300" fixed="right">
|
||||
<template #default="scope">
|
||||
<div style="display: flex">
|
||||
<!-- 重置密码 -->
|
||||
<popover-input v-model="inputPassword" @confirm="changePassword(scope.row)">
|
||||
<template #default>
|
||||
<el-button v-auth="'sys_user_edit'" icon="RefreshLeft" text type="primary" class="mr-4">
|
||||
<el-button v-auth="'sys_user_edit'" icon="RefreshLeft" text type="primary"
|
||||
class="mr-4">
|
||||
{{ $t('sysuser.passwordBtn') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</popover-input>
|
||||
<!-- 修改信息 -->
|
||||
<el-button v-auth="'sys_user_edit'" icon="edit-pen" text type="primary" @click="userDialogRef.openDialog(scope.row.userId)">
|
||||
<el-button v-auth="'sys_user_edit'" icon="edit-pen" text type="primary"
|
||||
@click="userDialogRef.openDialog(scope.row.userId)">
|
||||
{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<!-- 人脸管理 -->
|
||||
<el-button icon="User" text type="primary"
|
||||
@click="faceManageRef.openDialog(scope.row.userId)">
|
||||
人脸管理
|
||||
</el-button>
|
||||
<!-- 删除用户 -->
|
||||
<el-tooltip :content="$t('sysuser.deleteDisabledTip')" :disabled="scope.row.userId !== '1'" placement="top">
|
||||
<el-tooltip :content="$t('sysuser.deleteDisabledTip')"
|
||||
:disabled="scope.row.userId !== '1'" placement="top">
|
||||
<span style="margin-left: 12px">
|
||||
<el-button
|
||||
icon="delete"
|
||||
v-auth="'sys_user_del'"
|
||||
:disabled="scope.row.username === 'admin'"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleDelete([scope.row.userId])"
|
||||
>{{ $t('common.delBtn') }}
|
||||
<el-button icon="delete" v-auth="'sys_user_del'"
|
||||
:disabled="scope.row.username === 'admin'" text type="primary"
|
||||
@click="handleDelete([scope.row.userId])">{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
@@ -128,20 +125,19 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-bind="state.pagination" @current-change="currentChangeHandle" @size-change="sizeChangeHandle"> </pagination>
|
||||
<pagination v-bind="state.pagination" @current-change="currentChangeHandle"
|
||||
@size-change="sizeChangeHandle">
|
||||
</pagination>
|
||||
</div>
|
||||
</pane>
|
||||
</splitpanes>
|
||||
|
||||
<user-form ref="userDialogRef" @refresh="getDataList(false)" :deptId="state.queryForm.deptId" />
|
||||
|
||||
<upload-excel
|
||||
ref="excelUploadRef"
|
||||
:title="$t('sysuser.importUserTip')"
|
||||
temp-url="/admin/sys-file/local/file/user.xlsx"
|
||||
url="/admin/user/import"
|
||||
@refreshDataList="getDataList"
|
||||
/>
|
||||
<face-manage ref="faceManageRef" @refresh="getDataList(false)" />
|
||||
|
||||
<upload-excel ref="excelUploadRef" :title="$t('sysuser.importUserTip')"
|
||||
temp-url="/admin/sys-file/local/file/user.xlsx" url="/admin/user/import" @refreshDataList="getDataList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -154,6 +150,7 @@ import { useI18n } from 'vue-i18n';
|
||||
|
||||
// 动态引入组件
|
||||
const UserForm = defineAsyncComponent(() => import('./form.vue'));
|
||||
const FaceManage = defineAsyncComponent(() => import('./face-manage.vue'));
|
||||
const QueryTree = defineAsyncComponent(() => import('/@/components/QueryTree/index.vue'));
|
||||
const PopoverInput = defineAsyncComponent(() => import('/@/components/PopoverInput/index.vue'));
|
||||
|
||||
@@ -161,6 +158,7 @@ const { t } = useI18n();
|
||||
|
||||
// 定义变量内容
|
||||
const userDialogRef = ref();
|
||||
const faceManageRef = ref();
|
||||
const excelUploadRef = ref();
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
|
||||
@@ -21,17 +21,17 @@
|
||||
<upload-img v-model:imageUrl="form.picUrl"></upload-img>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商品简介" prop="introduction">
|
||||
<el-input type="textarea" v-model="form.introduction" placeholder="请输入商品简介" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="商品简介" prop="introduction">-->
|
||||
<!-- <el-input type="textarea" v-model="form.introduction" placeholder="请输入商品简介" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商品轮播图" prop="sliderPicUrls">
|
||||
<upload-imgs v-model:imageUrls="form.sliderPicUrls"></upload-imgs>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="24" class="mb20">-->
|
||||
<!-- <el-form-item label="商品轮播图" prop="sliderPicUrls">-->
|
||||
<!-- <upload-imgs v-model:imageUrls="form.sliderPicUrls"></upload-imgs>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
|
||||
<el-col :span="8" class="mb20">
|
||||
<el-form-item label="排序" prop="sort">
|
||||
@@ -65,23 +65,23 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8" class="mb20">
|
||||
<el-form-item label="赠送积分" prop="giveIntegral">
|
||||
<el-input v-model="form.giveIntegral" placeholder="请输入赠送积分" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8" class="mb20">-->
|
||||
<!-- <el-form-item label="赠送积分" prop="giveIntegral">-->
|
||||
<!-- <el-input v-model="form.giveIntegral" placeholder="请输入赠送积分" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
|
||||
<el-col :span="8" class="mb20">
|
||||
<el-form-item label="虚拟销量" prop="virtualSalesCount">
|
||||
<el-input v-model="form.virtualSalesCount" placeholder="请输入虚拟销量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8" class="mb20">-->
|
||||
<!-- <el-form-item label="虚拟销量" prop="virtualSalesCount">-->
|
||||
<!-- <el-input v-model="form.virtualSalesCount" placeholder="请输入虚拟销量" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商品详情" prop="description">
|
||||
<editor v-if="visible" v-model:get-html="form.description" placeholder="请输入商品详情"></editor>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="24" class="mb20">-->
|
||||
<!-- <el-form-item label="商品详情" prop="description">-->
|
||||
<!-- <editor v-if="visible" v-model:get-html="form.description" placeholder="请输入商品详情"></editor>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
|
||||
@@ -60,13 +60,13 @@
|
||||
<dict-tag :options="spu_status" :value="scope.row.status"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="price" label="商品价格,单位使用:分" show-overflow-tooltip />
|
||||
<el-table-column prop="marketPrice" label="市场价,单位使用:分" show-overflow-tooltip />
|
||||
<el-table-column prop="costPrice" label="成本价,单位: 分" show-overflow-tooltip />
|
||||
<el-table-column prop="price" label="商品价格" show-overflow-tooltip />
|
||||
<el-table-column prop="marketPrice" label="市场价" show-overflow-tooltip />
|
||||
<el-table-column prop="costPrice" label="成本价" show-overflow-tooltip />
|
||||
<el-table-column prop="stock" label="库存" show-overflow-tooltip />
|
||||
<el-table-column prop="giveIntegral" label="赠送积分" show-overflow-tooltip />
|
||||
<!-- <el-table-column prop="giveIntegral" label="赠送积分" show-overflow-tooltip />-->
|
||||
<el-table-column prop="salesCount" label="商品销量" show-overflow-tooltip />
|
||||
<el-table-column prop="virtualSalesCount" label="虚拟销量" show-overflow-tooltip />
|
||||
<!-- <el-table-column prop="virtualSalesCount" label="虚拟销量" show-overflow-tooltip />-->
|
||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<template #default="scope">
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="绑定的部门id" prop="deptId">
|
||||
<el-select v-model="form.deptId" placeholder="请选择绑定的部门id">
|
||||
<el-option label="请选择">0</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商户名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入商户名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="店铺类型,逗号分隔" prop="types">
|
||||
<el-select v-model="form.types" placeholder="请选择店铺类型,逗号分隔">
|
||||
<el-option label="请选择">0</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商户logo图片" prop="logoPic">
|
||||
<upload-img v-model="form.logoPic"></upload-img>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商户轮播图,逗号分隔" prop="swiperPic">
|
||||
<upload-img v-model="form.swiperPic"></upload-img>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商户手机号" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入商户手机号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商户开始营业时间" prop="jobStartTime">
|
||||
<el-input v-model="form.jobStartTime" placeholder="请输入商户开始营业时间" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商户结束营业时间" prop="jobEndTime">
|
||||
<el-input v-model="form.jobEndTime" placeholder="请输入商户结束营业时间" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商户地址" prop="addressDes">
|
||||
<el-input type="textarea" v-model="form.addressDes" placeholder="请输入商户地址" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MchManageDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '../../../api/mch/mch-manage'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
deptId: '',
|
||||
name: '',
|
||||
types: '',
|
||||
logoPic: '',
|
||||
swiperPic: '',
|
||||
phone: '',
|
||||
jobStartTime: '',
|
||||
jobEndTime: '',
|
||||
addressDes: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
name: [{ required: true, message: '商户名不能为空', trigger: 'blur' }, { validator: rule.chinese, trigger: 'blur' }],
|
||||
types: [{ required: true, message: '店铺类型,逗号分隔不能为空', trigger: 'blur' }],
|
||||
logoPic: [{ required: true, message: '商户logo图片不能为空', trigger: 'blur' }],
|
||||
phone: [{ validator: rule.mobilePhone, trigger: 'blur' }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取mchManage信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getmchManageData(id)
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 初始化表单数据
|
||||
const getmchManageData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'mch_mchManage_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'mch_mchManage_del'"
|
||||
@click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'mch_mchManage_export'" @exportExcel="exportExcel"
|
||||
class="ml10 mr20" style="float: right;" @queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="deptId" label="绑定的部门id" show-overflow-tooltip />
|
||||
<el-table-column prop="name" label="商户名" show-overflow-tooltip />
|
||||
<el-table-column prop="types" label="店铺类型,逗号分隔" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'mch_mchManage_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'mch_mchManage_del'"
|
||||
@click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemMchManage">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "../../../api/mch/mch-manage";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 定义查询字典
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/mch/mchManage/export', Object.assign(state.queryForm, { ids: selectObjs }), 'mchManage.xlsx')
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<el-dialog title="修改余额" v-model="visible" width="30%" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="120px"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="用户编号" prop="id">
|
||||
<el-input v-model="form.id" placeholder="" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="用户昵称" prop="nickname">
|
||||
<el-input v-model="form.nickname" placeholder="" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="变动前余额(元)" prop="balance">
|
||||
<el-input v-model="form.balance" placeholder="" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="变动类型" prop="changeType">
|
||||
<el-radio-group v-model="form.changeType">
|
||||
<el-radio :label="1">充值</el-radio>
|
||||
<el-radio :label="-1">减少</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="变动余额(元)" prop="changeBalance">
|
||||
<el-input-number v-model="form.changeBalance" :min="0" :precision="2" :step="0.1"
|
||||
class="!w-240px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="变动后余额(元)" prop="balanceResult">
|
||||
<el-input v-model="balanceResult" placeholder="" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WalletManageDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import * as walletApi from "/@/api/wallet/wallet-manage"
|
||||
import * as walletTransactionApi from "/@/api/wallet/wallet-transaction"
|
||||
import * as AdminUserApi from '/@/api/admin/user'
|
||||
import { rule } from '/@/utils/validate';
|
||||
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,
|
||||
walletId: undefined,
|
||||
nickname: undefined,
|
||||
balance: '0',
|
||||
changeBalance: 0,
|
||||
changeType: 1
|
||||
});
|
||||
|
||||
/** 变动后的余额 */
|
||||
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 = ''
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
// 获取walletManage信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletManageData(userId, id)
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
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,
|
||||
}
|
||||
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: user } = await AdminUserApi.getObj(userId)
|
||||
const { data: wallet } = await walletApi.getObj(id)
|
||||
form.id = user.userId
|
||||
form.walletId = wallet.id
|
||||
form.nickname = user.nickname
|
||||
form.balance = displayPrice(wallet.balance, "")
|
||||
form.changeType = 1
|
||||
form.changeBalance = 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="用户" prop="userIds">
|
||||
<select-user v-model="state.queryForm.userIds" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item class="w100" label="饭卡卡号" prop="cardNumber">
|
||||
<el-input v-model="state.queryForm.cardNumber" placeholder="饭卡卡号" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="getDataList">{{ $t('common.queryBtn')
|
||||
}}</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'wallet_walletManage_del'"
|
||||
@click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'wallet_walletManage_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="username" label="用户" show-overflow-tooltip />
|
||||
<el-table-column prop="userAvatar" label="头像" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.userAvatar" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="userMobile" width="120" label="手机号" show-overflow-tooltip />
|
||||
<el-table-column prop="deptName" label="部门" show-overflow-tooltip />
|
||||
<el-table-column prop="walletTypeUniqueCode" label="饭卡类型" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="wallet_type" :value="row.walletTypeUniqueCode" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="cardNumber" label="饭卡卡号" show-overflow-tooltip />
|
||||
<el-table-column prop="balance" label="余额" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div class="color-primary">{{ displayPrice(row.balance) }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="totalExpense" label="累计支出" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div class="color-danger">{{ displayPrice(row.totalExpense) }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="totalRecharge" label="累计充值" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<div class="color-warning">{{ displayPrice(row.totalRecharge) }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isFreeze" width="120" label="是否冻结饭卡" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="yes_no_type" :value="row.isFreeze" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="activeBindStatus" width="120" label="饭卡绑定状态" show-overflow-tooltip />
|
||||
<el-table-column prop="createTime" width="200" label="创建时间" show-overflow-tooltip />
|
||||
<el-table-column label="操作" fixed="right" width="200">
|
||||
<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_walletManage_edit'"
|
||||
@click="changeBalanceRef.openDialog(row.userId, row.id)">充值/扣款</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<transaction-list ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<change-balance ref="changeBalanceRef" @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 { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
|
||||
// 引入组件
|
||||
const TransactionList = defineAsyncComponent(() => import('./transaction-list.vue'));
|
||||
const ChangeBalance = defineAsyncComponent(() => import('./change-balance.vue'));
|
||||
// 定义查询字典
|
||||
const { wallet_type, yes_no_type } = useDict('wallet_type', 'yes_no_type');
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const changeBalanceRef = 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
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/wallet/walletManage/export', Object.assign(state.queryForm, { ids: selectObjs }), 'walletManage.xlsx')
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<el-dialog title="钱包余额明细" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @sort-change="sortChangeHandle">
|
||||
<el-table-column align="center" width="200" label="编号" prop="id" />
|
||||
<el-table-column align="center" width="200" label="钱包编号" prop="walletId" />
|
||||
<el-table-column align="center" label="交易类型" prop="title" />
|
||||
<el-table-column align="center" label="交易金额" prop="price">
|
||||
<template #default="{ row }"> {{ displayPrice(row.price) }} </template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="钱包余额" prop="balance">
|
||||
<template #default="{ row }"> {{ displayPrice(row.balance) }} </template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="交易时间" prop="createTime" width="180px" />
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<Pagination v-model:limit="state.queryForm.pageSize" v-model:page="state.queryForm.pageNo" :total="total"
|
||||
@pagination="getDataList" />
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WalletManageDialog">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import * as walletTransactionApi from '/@/api/wallet/wallet-transaction'
|
||||
import { rule } from '/@/utils/validate';
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
});
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
pagination: { size: 5, },
|
||||
queryForm: {},
|
||||
pageList: walletTransactionApi.pageJoin
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
if (id) {
|
||||
state.queryForm.walletId = id
|
||||
state.dataList = []
|
||||
getDataList()
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" width="30%" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="充值时间" prop="importTime">
|
||||
<el-date-picker v-model="form.importTime" type="month" value-format="x" placeholder="请选择充值时间" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="充值类型" prop="bizType">
|
||||
<dict-select v-model="form.bizType" dict-code="wallet_biz_recharge" placeholder="请选择饭卡类型" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="钱包" prop="walletTypeId">
|
||||
<select-wallet-type v-model="form.walletTypeId" placeholder="请选择钱包" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" type="textarea" :autosize="{ minRows: 6 }" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WalletRechargeApplyDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/wallet/wallet-recharge-apply'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
userId: '',
|
||||
bizType: '',
|
||||
walletTypeId: '',
|
||||
deptId: '',
|
||||
importTime: '',
|
||||
remark: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
importTime: [{ required: true, message: '导入时间(手动选择)不能为空', trigger: 'change' }],
|
||||
bizType: [{ required: true, message: '请选择充值类型', trigger: 'change' }],
|
||||
walletTypeId: [{ required: true, message: '请选择钱包类型', trigger: 'change' }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取walletRechargeApply信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletRechargeApplyData(id)
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 初始化表单数据
|
||||
const getwalletRechargeApplyData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'wallet_walletRechargeApply_add'">
|
||||
申 请
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'wallet_walletRechargeApply_del'"
|
||||
@click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'wallet_walletRechargeApply_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="userId" label="申请人ID" show-overflow-tooltip />
|
||||
<el-table-column prop="bizType" label="充值类型" show-overflow-tooltip />
|
||||
<el-table-column prop="walletTypeId" label="饭卡类型id" show-overflow-tooltip />
|
||||
<el-table-column prop="deptId" label="部门ID" show-overflow-tooltip />
|
||||
<el-table-column prop="importTime" label="导入时间(手动选择)" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'wallet_walletRechargeApply_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'wallet_walletRechargeApply_del'"
|
||||
@click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemWalletRechargeApply">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/wallet/wallet-recharge-apply";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 定义查询字典
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/wallet/walletRechargeApply/export', Object.assign(state.queryForm, { ids: selectObjs }), 'walletRechargeApply.xlsx')
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" width="30%" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="钱包名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入钱包名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="饭卡类型" prop="uniqueCode">
|
||||
<dict-select v-model="form.uniqueCode" dict-code="wallet_type" placeholder="请选择饭卡类型" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="钱包图标" prop="icon">
|
||||
<upload-img v-model:image-url="form.icon" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WalletTypeDialog">
|
||||
import { defineEmits } from 'vue'
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/wallet/wallet-type'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
icon: '',
|
||||
uniqueCode: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
name: [
|
||||
{ required: true, message: '钱包名不能为空', trigger: 'blur' },
|
||||
],
|
||||
uniqueCode: [
|
||||
{ required: true, message: '饭卡类型不能为空', trigger: 'change' },
|
||||
],
|
||||
icon: [
|
||||
{ required: true, message: '钱包图标不能为空', trigger: 'blur' },
|
||||
],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取walletType信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getwalletTypeData(id)
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => { });
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 初始化表单数据
|
||||
const getwalletTypeData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,123 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'wallet_walletType_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'wallet_walletType_del'"
|
||||
@click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar :search="false" v-model:showSearch="showSearch" :export="'wallet_walletType_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="name" label="钱包名" show-overflow-tooltip />
|
||||
<el-table-column prop="uniqueCode" label="饭卡类型" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="wallet_type" :value="row.uniqueCode" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="icon" label="钱包图标" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<preview-image :src="row.icon" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'wallet_walletType_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'wallet_walletType_del'"
|
||||
@click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemWalletType">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from '/@/api/wallet/wallet-type'
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 定义查询字典
|
||||
const { wallet_type } = useDict('wallet_type');
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/wallet/walletType/export', Object.assign(state.queryForm, { ids: selectObjs }), 'walletType.xlsx')
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in new issue
Block a user