Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
db497976c2
8 files changed
+279
-46
No files matched your search
@@ -112,15 +112,13 @@ export const resetUserPassword = (userInfo: object) => {
|
||||
}
|
||||
|
||||
export function validateUsername(rule: any, value: any, callback: any, isEdit: boolean) {
|
||||
if (isEdit) {
|
||||
return callback()
|
||||
}
|
||||
const flag = new RegExp(/^([a-z\d]+?)$/).test(value)
|
||||
if (!flag) {
|
||||
callback(new Error("用户名支持小写英文、数字"))
|
||||
}
|
||||
|
||||
if (isEdit) {
|
||||
return callback()
|
||||
}
|
||||
|
||||
getDetails({ username: value }).then((response) => {
|
||||
const result = response.data
|
||||
if (result !== null) {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function pageListDept(query?: Object) {
|
||||
return request({
|
||||
url: "/hard/hard-total/page-list-dept",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function pageListSb(query?: Object) {
|
||||
return request({
|
||||
url: "/hard/hard-total/page-list-sb",
|
||||
|
||||
@@ -190,9 +190,10 @@ defineExpose({
|
||||
align-items: center;
|
||||
padding-top: 10px;
|
||||
box-shadow: 0 -8px 8px -8px rgba(0, 0, 0, 0.1);
|
||||
z-index: 10;
|
||||
z-index: 999;
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -149,7 +149,7 @@ const dataRules = ref({
|
||||
// 用户名校验,不能为空 、长度 5-20、不能和已有数据重复
|
||||
username: [
|
||||
{ required: true, message: "用户名不能为空", trigger: "blur" },
|
||||
{ min: 5, max: 20, message: "用户名称长度必须介于 5 和 20 之间", trigger: "blur" },
|
||||
{ min: 5, max: 60, message: "用户名称长度必须介于 5 和 20 之间", trigger: "blur" },
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validateUsername(rule, value, callback, dataForm.userId !== "")
|
||||
|
||||
@@ -1,40 +1,51 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<splitpanes>
|
||||
<pane size="30">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<!-- <el-scrollbar> -->
|
||||
<dep-tree
|
||||
ref="depTreeRef"
|
||||
:placeholder="$t('common.queryDeptTip')"
|
||||
:query="deptData.queryList"
|
||||
:show-expand="true"
|
||||
@node-click="handleNodeClick"
|
||||
@treeDeepSearch="treeDeepSearch"
|
||||
switch-inactive-text="当前部门"
|
||||
switch-active-text="当前部门及子部门"
|
||||
>
|
||||
<!-- 没有数据权限提示 -->
|
||||
<template #default="{ node, data }">
|
||||
<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>
|
||||
<span v-if="!data.isLock">{{ node.label }}</span>
|
||||
</template>
|
||||
</dep-tree>
|
||||
<!-- </el-scrollbar> -->
|
||||
</div>
|
||||
<Splitpanes @resize="depTreeWidth = $event[0].size">
|
||||
<pane :size="depTreeWidth">
|
||||
<dep-tree
|
||||
class="p-2"
|
||||
ref="depTreeRef"
|
||||
:placeholder="$t('common.queryDeptTip')"
|
||||
:query="deptData.queryList"
|
||||
:show-expand="true"
|
||||
@node-click="handleNodeClick"
|
||||
@treeDeepSearch="treeDeepSearch"
|
||||
switch-inactive-text="当前部门"
|
||||
switch-active-text="当前部门及子部门"
|
||||
>
|
||||
<!-- 没有数据权限提示 -->
|
||||
<template #default="{ node, data }">
|
||||
<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>
|
||||
<span v-if="!data.isLock">{{ node.label }}</span>
|
||||
</template>
|
||||
</dep-tree>
|
||||
</pane>
|
||||
<pane class="ml8">
|
||||
|
||||
<pane :size="100 - depTreeWidth" class="pl8 relative">
|
||||
<div
|
||||
class="w-[12px] h-[56px] absolute left-0 top-[44vh] translate-y-[-50%] transition-all cursor-pointer"
|
||||
@click="handleClickDepTreeDrawer(isOpen)"
|
||||
style="background-color: #e3e9ed; border-top-right-radius: 15px; border-bottom-right-radius: 15px"
|
||||
>
|
||||
<i class="drawer-icon">
|
||||
<el-icon>
|
||||
<ArrowLeftBold v-if="depTreeWidth > 0.5" />
|
||||
<ArrowRightBold v-else />
|
||||
</el-icon>
|
||||
</i>
|
||||
</div>
|
||||
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row v-show="showSearch">
|
||||
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||
@@ -209,11 +220,13 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-bind="state.pagination" @current-change="currentChangeHandle" @size-change="sizeChangeHandle">
|
||||
</pagination>
|
||||
</div>
|
||||
</pane>
|
||||
</splitpanes>
|
||||
</Splitpanes>
|
||||
|
||||
<user-form ref="userDialogRef" @refresh="getDataList(false)" :deptId="state.queryForm.deptId" />
|
||||
<face-manage ref="faceManageRef" @refresh="getDataList(false)" />
|
||||
<upload-excel
|
||||
@@ -250,6 +263,7 @@ const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
const inputPassword = ref()
|
||||
const depTreeRef = ref() // 树组件ref引用
|
||||
const depTreeWidth = ref<number>(20) // 部门树组件宽度
|
||||
|
||||
// 多选rows
|
||||
const selectObjs = ref([]) as any
|
||||
@@ -360,4 +374,47 @@ const changePassword = async (row: any) => {
|
||||
useMessage().success(t("common.optSuccessText"))
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const isOpen = ref(true)
|
||||
const temp = ref()
|
||||
const handleClickDepTreeDrawer = (isDrawerOpen: boolean) => {
|
||||
if (isDrawerOpen) {
|
||||
temp.value = depTreeWidth.value
|
||||
depTreeWidth.value = 0.5
|
||||
} else {
|
||||
depTreeWidth.value = temp.value
|
||||
}
|
||||
isOpen.value = !isOpen.value
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.splitpanes--vertical > .splitpanes__splitter {
|
||||
background: #cccccc;
|
||||
min-width: 2px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.splitpanes--vertical > .splitpanes__splitter:active {
|
||||
background: #1890ff;
|
||||
}
|
||||
.splitpanes--vertical > .splitpanes__splitter:hover {
|
||||
background: #1890ff;
|
||||
}
|
||||
.drawer-icon {
|
||||
color: #b7bdc8;
|
||||
font-size: 1rem;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
line-height: 64px;
|
||||
}
|
||||
.drawer-icon:hover {
|
||||
opacity: 0.5;
|
||||
}
|
||||
/* .drawer-icon::before {
|
||||
content: "<";
|
||||
background: none;
|
||||
box-sizing: inherit;
|
||||
color: #b7bdc8;
|
||||
font-size: 1em;
|
||||
} */
|
||||
</style>
|
||||
@@ -79,7 +79,22 @@ const getSummaries = (param: SummaryMethodProps) => {
|
||||
sums[index] = "合计"
|
||||
return
|
||||
}
|
||||
if (column.property === "productPrice" || column.property === "totalPrice") {
|
||||
if (column.property === "productCount") {
|
||||
const values = data.map((item) => Number(item[column.property]))
|
||||
if (!values.every((value) => Number.isNaN(value))) {
|
||||
sums[index] =
|
||||
values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!Number.isNaN(value)) {
|
||||
return prev + curr
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0) + "份"
|
||||
} else {
|
||||
sums[index] = "N/A"
|
||||
}
|
||||
} else if (column.property === "totalPrice") {
|
||||
const values = data.map((item) => Number(item[column.property]))
|
||||
if (!values.every((value) => Number.isNaN(value))) {
|
||||
sums[index] = displayPrice(
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
<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="8">
|
||||
<el-form-item class="w100" label="时间" prop="createTimeList">
|
||||
<el-date-picker
|
||||
v-model="state.queryForm.createTimeList"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="datetimerange"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<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-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<right-toolbar
|
||||
:search="false"
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'hard_hardTotal_export_dept'"
|
||||
@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"
|
||||
:summary-method="getSummaries"
|
||||
show-summary
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="80" />
|
||||
<el-table-column prop="deptName" min-width="150" label="部门" />
|
||||
<el-table-column prop="walletPrice" label="充值金额" align="center">
|
||||
<template #default="{ row }">
|
||||
<div :class="{ 'color-success': row.walletPrice != 0 }">{{ displayPrice(row.walletPrice) }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="walletCount" label="充值次数" align="center">
|
||||
<template #default="{ row }">
|
||||
<div :class="{ 'color-success': row.walletCount != 0 }">{{ row.walletCount }}次</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="orderPayPrice" label="消费金额" align="center">
|
||||
<template #default="{ row }">
|
||||
<div :class="{ 'color-primary': row.orderPayPrice != 0 }">{{ displayPrice(row.orderPayPrice) }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="orderPayCount" label="消费次数" align="center">
|
||||
<template #default="{ row }">
|
||||
<div :class="{ 'color-primary': row.orderPayCount != 0 }">{{ row.orderPayCount }}次</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="orderRefundPrice" label="退款金额" align="center">
|
||||
<template #default="{ row }">
|
||||
<div :class="{ 'color-danger': row.orderRefundPrice != 0 }">
|
||||
{{ displayPrice(row.orderRefundPrice) }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="orderRefundCont" label="退款次数" align="center">
|
||||
<template #default="{ row }">
|
||||
<div :class="{ 'color-danger': row.orderRefundCont != 0 }">{{ row.orderRefundCont }}次</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="false" label="操作" width="300"> </el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="hard-dept-total">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import * as hardTotalApi from "/@/api/hard/hard-total"
|
||||
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
// 表格变量
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
isPage: false,
|
||||
queryForm: {},
|
||||
pageList: hardTotalApi.pageListDept,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/hard/hard-total/export-dept", Object.assign(state.queryForm), "部门交易记录导出.xlsx")
|
||||
}
|
||||
|
||||
const getSummaries = (param: any) => {
|
||||
const { columns, data } = param
|
||||
const totalColumns = [
|
||||
"walletPrice",
|
||||
"walletCount",
|
||||
"orderPayPrice",
|
||||
"orderPayCount",
|
||||
"orderRefundPrice",
|
||||
"orderRefundCont",
|
||||
]
|
||||
const totalRow = Array.from({ length: columns.length })
|
||||
columns.forEach((i: any, index: number) => {
|
||||
if (totalColumns.includes(i.property)) {
|
||||
const total = data
|
||||
.filter((v: any) => v[i.property] != null)
|
||||
.map((v: any) => Number(v[i.property]))
|
||||
.reduce((pren: number, next: number) => pren + next, 0)
|
||||
if (i.property.includes("Price")) {
|
||||
totalRow[index] = displayPrice(total)
|
||||
} else {
|
||||
totalRow[index] = total + "次"
|
||||
}
|
||||
}
|
||||
})
|
||||
return totalRow
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
</script>
|
||||
@@ -150,9 +150,6 @@ const multiple = ref(true)
|
||||
// 表格变量
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pagination: {
|
||||
pageSizes: [10, 20, 50, 100, 200, 500, 1000, 2000],
|
||||
},
|
||||
pageList: walletRechargeImportApi.pageJoin,
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user