This commit is contained in:
duan 2025-03-20 14:07:37 +08:00
commit 112c0dfb8c
14 changed files with 369 additions and 101 deletions

View File

@ -8,37 +8,58 @@
<template v-if="typeof item === 'string'">
<!-- 新增 -->
<template v-if="item === 'add'">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]" type="primary" icon="plus"
@click="handleToolbar(item)">
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
type="primary"
icon="plus"
@click="handleToolbar(item)"
>
新增
</el-button>
</template>
<!-- 删除 -->
<template v-else-if="item === 'delete'">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]" type="danger" icon="delete"
:disabled="removeIds.length === 0" @click="handleToolbar(item)">
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
type="danger"
icon="delete"
:disabled="removeIds.length === 0"
@click="handleToolbar(item)"
>
删除
</el-button>
</template>
<!-- 导入 -->
<template v-else-if="item === 'import'">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]" type="default" icon="upload"
@click="handleToolbar(item)">
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
type="default"
icon="upload"
@click="handleToolbar(item)"
>
导入
</el-button>
</template>
<!-- 导出 -->
<template v-else-if="item === 'export'">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]" type="default" icon="download"
@click="handleToolbar(item)">
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
type="default"
icon="download"
@click="handleToolbar(item)"
>
导出
</el-button>
</template>
</template>
<!-- 其他 -->
<template v-else-if="typeof item === 'object'">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]" :icon="item.icon"
:type="item.type ?? 'default'" @click="handleToolbar(item.name)">
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
:icon="item.icon"
:type="item.type ?? 'default'"
@click="handleToolbar(item.name)"
>
{{ item.text }}
</el-button>
</template>
@ -67,36 +88,68 @@
</template>
<!-- 导出 -->
<template v-else-if="item === 'exports'">
<el-button v-hasPerm="[`${contentConfig.pageName}:export`]" icon="download" circle title="导出"
@click="handleToolbar(item)" />
<el-button
v-hasPerm="[`${contentConfig.pageName}:export`]"
icon="download"
circle
title="导出"
@click="handleToolbar(item)"
/>
</template>
<!-- 导入 -->
<template v-else-if="item === 'imports'">
<el-button v-hasPerm="[`${contentConfig.pageName}:import`]" icon="upload" circle title="导入"
@click="handleToolbar(item)" />
<el-button
v-hasPerm="[`${contentConfig.pageName}:import`]"
icon="upload"
circle
title="导入"
@click="handleToolbar(item)"
/>
</template>
<!-- 搜索 -->
<template v-else-if="item === 'search'">
<el-button v-hasPerm="[`${contentConfig.pageName}:query`]" icon="search" circle title="搜索"
@click="handleToolbar(item)" />
<el-button
v-hasPerm="[`${contentConfig.pageName}:query`]"
icon="search"
circle
title="搜索"
@click="handleToolbar(item)"
/>
</template>
</template>
<!-- 其他 -->
<template v-else-if="typeof item === 'object'">
<template v-if="item.auth">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]" :icon="item.icon" circle
:title="item.title" @click="handleToolbar(item.name)" />
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
:icon="item.icon"
circle
:title="item.title"
@click="handleToolbar(item.name)"
/>
</template>
<template v-else>
<el-button :icon="item.icon" circle :title="item.title" @click="handleToolbar(item.name)" />
<el-button
:icon="item.icon"
circle
:title="item.title"
@click="handleToolbar(item.name)"
/>
</template>
</template>
</template>
</div>
</div>
<!-- 列表 -->
<el-table ref="tableRef" v-loading="loading" v-bind="contentConfig.table" :data="pageData" :row-key="pk"
@selection-change="handleSelectionChange" @filter-change="handleFilterChange">
<el-table
ref="tableRef"
v-loading="loading"
v-bind="contentConfig.table"
:data="pageData"
:row-key="pk"
@selection-change="handleSelectionChange"
@filter-change="handleFilterChange"
>
<template v-for="col in cols" :key="col">
<el-table-column v-if="col.show" v-bind="col">
<template #default="scope">
@ -105,15 +158,24 @@
<template v-if="col.prop">
<template v-if="Array.isArray(scope.row[col.prop])">
<template v-for="(item, index) in scope.row[col.prop]" :key="item">
<el-image :src="item" :preview-src-list="scope.row[col.prop]" :initial-index="index"
:preview-teleported="true" :style="`width: ${col.imageWidth ?? 40}px; height: ${col.imageHeight ?? 40
}px`" />
<el-image
:src="item"
:preview-src-list="scope.row[col.prop]"
:initial-index="index"
:preview-teleported="true"
:style="`width: ${col.imageWidth ?? 40}px; height: ${
col.imageHeight ?? 40
}px`"
/>
</template>
</template>
<template v-else>
<el-image :src="scope.row[col.prop]" :preview-src-list="[scope.row[col.prop]]"
<el-image
:src="scope.row[col.prop]"
:preview-src-list="[scope.row[col.prop]]"
:preview-teleported="true"
:style="`width: ${col.imageWidth ?? 40}px; height: ${col.imageHeight ?? 40}px`" />
:style="`width: ${col.imageWidth ?? 40}px; height: ${col.imageHeight ?? 40}px`"
/>
</template>
</template>
</template>
@ -135,20 +197,30 @@
<template v-else-if="col.templet === 'switch'">
<template v-if="col.prop">
<!-- pageData.length>0: 解决el-switch组件会在表格初始化的时候触发一次change事件 -->
<el-switch v-model="scope.row[col.prop]" :active-value="col.activeValue ?? 1"
:inactive-value="col.inactiveValue ?? 0" :inline-prompt="true" :active-text="col.activeText ?? ''"
:inactive-text="col.inactiveText ?? ''" :validate-event="false"
:disabled="!hasAuth(`${contentConfig.pageName}:modify`)" @change="
<el-switch
v-model="scope.row[col.prop]"
:active-value="col.activeValue ?? 1"
:inactive-value="col.inactiveValue ?? 0"
:inline-prompt="true"
:active-text="col.activeText ?? ''"
:inactive-text="col.inactiveText ?? ''"
:validate-event="false"
:disabled="!hasAuth(`${contentConfig.pageName}:modify`)"
@change="
pageData.length > 0 && handleModify(col.prop, scope.row[col.prop], scope.row)
" />
"
/>
</template>
</template>
<!-- 生成输入框组件 -->
<template v-else-if="col.templet === 'input'">
<template v-if="col.prop">
<el-input v-model="scope.row[col.prop]" :type="col.inputType ?? 'text'"
<el-input
v-model="scope.row[col.prop]"
:type="col.inputType ?? 'text'"
:disabled="!hasAuth(`${contentConfig.pageName}:modify`)"
@blur="handleModify(col.prop, scope.row[col.prop], scope.row)" />
@blur="handleModify(col.prop, scope.row[col.prop], scope.row)"
/>
</template>
</template>
<!-- 格式化为价格 -->
@ -180,7 +252,7 @@
{{
scope.row[col.prop]
? useDateFormat(scope.row[col.prop], col.dateFormat ?? "YYYY-MM-DD HH:mm:ss")
.value
.value
: ""
}}
</template>
@ -191,44 +263,82 @@
<template v-if="typeof item === 'string'">
<!-- 编辑/删除 -->
<template v-if="item === 'edit' || item === 'delete'">
<el-button v-hasPerm="[`${contentConfig.pageName}:${item}`]"
:type="item === 'edit' ? 'primary' : 'danger'" :icon="item" size="small" link @click="
<el-button
v-hasPerm="[`${contentConfig.pageName}:${item}`]"
:type="item === 'edit' ? 'primary' : 'danger'"
:icon="item"
size="small"
link
@click="
handleOperat({
name: item,
row: scope.row,
column: scope.column,
$index: scope.$index,
})
">
"
>
{{ item === "edit" ? "编辑" : "删除" }}
</el-button>
</template>
</template>
<!-- 其他 -->
<template v-else-if="typeof item === 'object'">
<el-dropdown style="margin-top: 4px;">
<el-button v-if="item.render === undefined || item.render(scope.row)" v-bind="item.auth ? { 'v-hasPerm': [`${contentConfig.pageName}:${item.auth}`] } : {}
" :icon="item.icon" :type="item.type ?? 'primary'" size="small" link @click="
<el-button
v-if="item.isBtn"
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
:icon="item.icon"
:type="item.type ?? 'primary'"
size="small"
link
@click="
handleOperat({
name: item.name,
row: scope.row,
column: scope.column,
$index: scope.$index,
})
"
>
{{ item.text }}
</el-button>
<el-dropdown style="margin-top: 4px" v-else>
<el-button
v-if="item.render === undefined || item.render(scope.row)"
v-bind="
item.auth ? { 'v-hasPerm': [`${contentConfig.pageName}:${item.auth}`] } : {}
"
:icon="item.icon"
:type="item.type ?? 'primary'"
size="small"
link
@click="
handleOperat({
name: item.name,
row: scope.row,
column: scope.column,
$index: scope.$index,
})
">
"
>
{{ item.text }}
</el-button>
<template #dropdown v-if="item.options && item.options.length > 0">
<el-dropdown-menu>
<el-dropdown-item @click="
handleOperat({
name: item.name,
row: scope.row,
column: scope.column,
$index: scope.$index,
command: opt.command ? opt.command : '',
})
" v-for="opt in item.options" :key="opt.value">
<el-dropdown-item
@click="
handleOperat({
name: item.name,
row: scope.row,
column: scope.column,
$index: scope.$index,
command: opt.command ? opt.command : '',
})
"
v-for="opt in item.options"
:key="opt.value"
>
{{ opt.label }}
</el-dropdown-item>
</el-dropdown-menu>
@ -249,18 +359,33 @@
<template v-if="showPagination">
<el-scrollbar>
<div class="mt-[12px]">
<el-pagination v-bind="pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
<el-pagination
v-bind="pagination"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</el-scrollbar>
</template>
<!-- 导出弹窗 -->
<el-dialog v-model="exportsModalVisible" :align-center="true" title="导出数据" width="600px" style="padding-right: 0"
@close="handleCloseExportsModal">
<el-dialog
v-model="exportsModalVisible"
:align-center="true"
title="导出数据"
width="600px"
style="padding-right: 0"
@close="handleCloseExportsModal"
>
<!-- 滚动 -->
<el-scrollbar max-height="60vh">
<!-- 表单 -->
<el-form ref="exportsFormRef" label-width="auto" style="padding-right: var(--el-dialog-padding-primary)"
:model="exportsFormData" :rules="exportsFormRules">
<el-form
ref="exportsFormRef"
label-width="auto"
style="padding-right: var(--el-dialog-padding-primary)"
:model="exportsFormData"
:rules="exportsFormRules"
>
<el-form-item label="文件名" prop="filename">
<el-input v-model="exportsFormData.filename" clearable />
</el-form-item>
@ -270,10 +395,16 @@
<el-form-item label="数据源" prop="origin">
<el-select v-model="exportsFormData.origin">
<el-option label="当前数据 (当前页的数据)" :value="ExportsOriginEnum.CURRENT" />
<el-option label="选中数据 (所有选中的数据)" :value="ExportsOriginEnum.SELECTED"
:disabled="selectionData.length <= 0" />
<el-option label="全量数据 (所有分页的数据)" :value="ExportsOriginEnum.REMOTE"
:disabled="contentConfig.exportsAction === undefined" />
<el-option
label="选中数据 (所有选中的数据)"
:value="ExportsOriginEnum.SELECTED"
:disabled="selectionData.length <= 0"
/>
<el-option
label="全量数据 (所有分页的数据)"
:value="ExportsOriginEnum.REMOTE"
:disabled="contentConfig.exportsAction === undefined"
/>
</el-select>
</el-form-item>
<el-form-item label="字段" prop="fields">
@ -294,17 +425,35 @@
</template>
</el-dialog>
<!-- 导入弹窗 -->
<el-dialog v-model="importModalVisible" :align-center="true" title="导入数据" width="600px" style="padding-right: 0"
@close="handleCloseImportModal">
<el-dialog
v-model="importModalVisible"
:align-center="true"
title="导入数据"
width="600px"
style="padding-right: 0"
@close="handleCloseImportModal"
>
<!-- 滚动 -->
<el-scrollbar max-height="60vh">
<!-- 表单 -->
<el-form ref="importFormRef" label-width="auto" style="padding-right: var(--el-dialog-padding-primary)"
:model="importFormData" :rules="importFormRules">
<el-form
ref="importFormRef"
label-width="auto"
style="padding-right: var(--el-dialog-padding-primary)"
:model="importFormData"
:rules="importFormRules"
>
<el-form-item label="文件名" prop="files">
<el-upload ref="uploadRef" v-model:file-list="importFormData.files" class="w-full"
<el-upload
ref="uploadRef"
v-model:file-list="importFormData.files"
class="w-full"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
:drag="true" :limit="1" :auto-upload="false" :on-exceed="handleFileExceed">
:drag="true"
:limit="1"
:auto-upload="false"
:on-exceed="handleFileExceed"
>
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">
<span>将文件拖到此处</span>
@ -313,8 +462,13 @@
<template #tip>
<div class="el-upload__tip">
*.xlsx / *.xls
<el-link v-if="contentConfig.importTemplate" type="primary" icon="download" :underline="false"
@click="handleDownloadTemplate">
<el-link
v-if="contentConfig.importTemplate"
type="primary"
icon="download"
:underline="false"
@click="handleDownloadTemplate"
>
下载模板
</el-link>
</div>
@ -326,7 +480,11 @@
<!-- 弹窗底部操作按钮 -->
<template #footer>
<div style="padding-right: var(--el-dialog-padding-primary)">
<el-button type="primary" :disabled="importFormData.files.length === 0" @click="handleImportSubmit">
<el-button
type="primary"
:disabled="importFormData.files.length === 0"
@click="handleImportSubmit"
>
</el-button>
<el-button @click="handleCloseImportModal"> </el-button>
@ -802,10 +960,10 @@ function fetchPageData(formData: IObject = {}, isRestart = false) {
.indexAction(
showPagination
? {
[request.pageName]: pagination.currentPage,
[request.limitName]: pagination.pageSize,
...formData,
}
[request.pageName]: pagination.currentPage,
[request.limitName]: pagination.pageSize,
...formData,
}
: formData
)
.then((data) => {

View File

@ -214,6 +214,7 @@ export interface IContentConfig<T = any> {
icon?: string;
name: string;
text: string;
isBtn?: boolean;
type?: "primary" | "success" | "warning" | "danger" | "info";
render?: (row: IObject) => boolean;
options?: {

View File

@ -36,7 +36,7 @@ export const constantRoutes: RouteRecordRaw[] = [
{
path: "index",
component: () => import("@/views/data/index.vue"),
name: "dataStatistics",
name: "",
meta: {
title: "数据统计",
affix: false,
@ -45,7 +45,7 @@ export const constantRoutes: RouteRecordRaw[] = [
},
{
path: "sales",
name: "salesStatistics",
name: "",
component: () => import("@/views/data/sales.vue"),
meta: {
title: "销售统计",
@ -55,7 +55,7 @@ export const constantRoutes: RouteRecordRaw[] = [
},
{
path: "table",
name: "tableStatistics",
name: "",
component: () => import("@/views/data/table.vue"),
meta: {
title: "桌台统计",
@ -65,7 +65,7 @@ export const constantRoutes: RouteRecordRaw[] = [
},
{
path: "credit",
name: "creditStatistics",
name: "",
component: () => import("@/views/data/credit/index.vue"),
meta: {
title: "挂账管理",
@ -76,7 +76,7 @@ export const constantRoutes: RouteRecordRaw[] = [
},
{
path: "credit-detail",
name: "creditDetail",
name: "",
component: () => import("@/views/data/credit/detail.vue"),
meta: {
title: "挂账明细",
@ -87,7 +87,7 @@ export const constantRoutes: RouteRecordRaw[] = [
},
{
path: "work",
name: "workStatistics",
name: "",
component: () => import("@/views/data/work.vue"),
meta: {
title: "交班记录",

View File

@ -21,9 +21,9 @@
<el-card shadow="never">
<div class="mb-10px">
<el-button type="primary" icon="plus" @click="handleOpenDialog()">新增</el-button>
<el-button type="danger" :disabled="ids.length === 0" icon="delete" @click="handleDelete()">
<!-- <el-button type="danger" :disabled="ids.length === 0" icon="delete" @click="handleDelete()">
删除
</el-button>
</el-button> -->
</div>
<el-table
@ -34,7 +34,7 @@
:border="true"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="角色名称" prop="name" />
<el-table-column label="角色级别" prop="level" />
<el-table-column label="描述" prop="description" />

View File

@ -1,6 +1,6 @@
<template>
<!-- 广告模块 -->
<div style="padding: 15px;">
<div style="padding: 15px">
<!-- 广告模块 -->
<!-- 搜索 -->
<Search></Search>
<!-- 表格 -->
@ -8,6 +8,6 @@
</div>
</template>
<script setup>
import Search from './indexconfig/Search.vue'
import Content from './indexconfig/Content.vue'
import Search from "./indexconfig/Search.vue";
import Content from "./indexconfig/Content.vue";
</script>

View File

@ -43,10 +43,15 @@
</el-form-item>
<el-form-item label="下单抵扣积分比例">
<el-col :span="7">
<el-input v-model="Elform.equivalentPoints" type="number" placeholder="">
<template #prepend>1元等于</template>
<template #append>积分</template>
</el-input>
<span class="color-999">1元等于</span>
<el-input-number
class="u-m-l-10 u-m-r-10"
v-model="Elform.equivalentPoints"
type="number"
placeholder=""
min="1"
></el-input-number>
<span class="color-999">积分</span>
</el-col>
</el-form-item>
<el-form-item label="开启积分商城">

View File

@ -201,7 +201,7 @@
<div class="data_item_right">
<div class="t">
<span>新增会员数</span>
<span class="n">{{ trade.newMemberCoun || 0 }}()</span>
<span class="n">{{ trade.newMemberCount || 0 }}()</span>
</div>
<div class="t">
<span>会员消费笔数</span>

View File

@ -41,10 +41,10 @@ const searchConfig: ISearchConfig = {
},
{
type: "input",
label: "台桌编码",
prop: "tableCode",
label: "台桌名称",
prop: "tableName",
attrs: {
placeholder: "请输入台桌编码",
placeholder: "请输入台桌名称",
clearable: true,
style: {
width: "200px",

View File

@ -154,9 +154,10 @@ function returnOriginAmount(order: OrderInfoVo) {
const route = useRoute();
onMounted(() => {
const { orderNo, tableName, tableCode } = route.query;
handleQueryClick({ orderNo, tableName });
handleQueryClick({ orderNo, tableCode, tableName });
searchRef.value?.setQueryValue("orderNo", orderNo);
searchRef.value?.setQueryValue("tableCode", tableCode);
searchRef.value?.setQueryValue("tableName", tableName);
route;
});
//

View File

@ -70,7 +70,7 @@
<el-radio-button value="release">正式</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="激活码" prop="activateCode">
<el-form-item label="激活码">
<el-input v-model="state.form.activateCode" placeholder="请输入激活码"></el-input>
<div class="tips">输入有效激活码表示添加的同时直接激活该店铺</div>
</el-form-item>

View File

@ -97,9 +97,12 @@
</el-table-column>
<el-table-column prop="createdAt" label="到期时间">
<template v-slot="scope">
{{ dayjs(scope.row.expireAt).format("YYYY-MM-DD HH:mm:ss") }}
<span v-if="scope.row.expireTime">
{{ dayjs(scope.row.expireTime).format("YYYY-MM-DD HH:mm:ss") }}
</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150">
<template v-slot="scope">
<el-link @click="addShopShow(scope.row)">

View File

@ -0,0 +1,78 @@
<template>
<el-dialog title="修改密码" v-model="visible" width="400px" @close="reset">
<el-form :model="form" ref="refForm" :rules="rules">
<el-form-item label="新密码" prop="newPwd">
<el-input v-model="form.newPwd" show-password></el-input>
</el-form-item>
<el-form-item label="确认密码" prop="confirmPwd">
<el-input v-model="form.confirmPwd" show-password></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submit">提交</el-button>
<el-button @click="reset">取消</el-button>
</el-form-item>
</el-form>
</el-dialog>
</template>
<script setup>
import sysUserApi from "@/api/account/sysUser";
const visible = ref(false);
const form = reactive({
oldPwd: "",
newPwd: "",
confirmPwd: "",
});
const rules = {
newPwd: [{ required: true, message: "请输入新密码", trigger: "blur" }],
confirmPwd: [
{ required: true, message: "请再次输入新密码", trigger: "blur" },
{
validator: (rule, value, callback) => {
if (value !== form.newPwd) {
callback(new Error("两次输入密码不一致"));
} else {
callback();
}
},
trigger: "blur",
},
],
};
const emit = defineEmits(["update:visible"]);
function reset() {
visible.value = false;
form.oldPwd = "";
form.newPwd = "";
form.confirmPwd = "";
form.id = "";
}
const refForm = ref();
function submit() {
refForm.value.validate((valid) => {
if (valid) {
sysUserApi
.pwd({
id: form.id,
checkPassword: form.confirmPwd,
password: form.confirmPwd,
})
.then(() => {
ElMessage.success("修改成功");
close();
});
}
});
}
function open(data) {
visible.value = true;
form.id = data.id;
}
function close() {
visible.value = false;
}
defineExpose({
open,
close,
});
</script>

View File

@ -2,7 +2,7 @@ import ShopStaffApi, { type getListRequest } from "@/api/account/shopStaff";
import type { PageShopStaff } from "@/api/account/shopStaff";
import type { IContentConfig } from "@/components/CURD/types";
const contentConfig = {
const contentConfig: IContentConfig = {
pageName: "sys:user",
table: {
border: true,
@ -54,9 +54,17 @@ const contentConfig = {
{
label: "操作",
align: "center",
fixed: "right",
templet: "tool",
operat: ["edit", "delete"],
operat: ["edit", "delete",
{
name: "change_pwd",
auth: "password:reset",
icon: "refresh-left",
text: "修改密码",
type: "primary",
isBtn: true,
}
],
},
],
};

View File

@ -66,10 +66,14 @@
></selectPermission>
</template>
</page-modal>
<!-- 修改密码 -->
<changePwd ref="changePwdRef" />
</div>
</template>
<script setup lang="ts">
import changePwd from "./components/change-pwd.vue";
import type { IObject, IOperatData } from "@/components/CURD/types";
import usePage from "@/components/CURD/usePage";
import addModalConfig from "./config/add";
@ -183,8 +187,18 @@ function handleToolbarClick(name: string) {
ElMessage.success("点击了自定义1按钮");
}
}
const changePwdRef = ref();
function changePwdRefShow(row: IObject) {
changePwdRef.value?.open(row);
}
//
async function handleOperatClick(data: IOperatData) {}
async function handleOperatClick(data: IOperatData) {
console.log(data);
if (data.name === "change_pwd") {
changePwdRefShow(data.row);
}
}
//
</script>