This commit is contained in:
墨大叔 2024-07-12 16:09:45 +08:00
parent ea2481dc5c
commit 8e37f74602
7 changed files with 120 additions and 71 deletions

View File

@ -1,5 +1,5 @@
# 页面标题
VUE_APP_TITLE = 智能开关管理系统
VUE_APP_TITLE = 智能开关-开发
# 开发环境配置
ENV = 'development'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -5,7 +5,7 @@ const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dyn
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
const state = {
title: '',
theme: storageSetting.theme || '#409EFF',
theme: storageSetting.theme || '#8883F0',
sideTheme: storageSetting.sideTheme || sideTheme,
showSettings: showSettings,
topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,

View File

@ -25,3 +25,32 @@ export const $view = {
}
}
}
/**
* 显隐列
**/
export const $showColumns = {
data() {
return {
columns: []
}
},
computed: {
showColumns() {
if (this.columns == null) {
return [];
}
return this.columns.filter(item => item.visible);
},
isShow() {
return (key) => {
if (this.columns == null) {
return false;
}
let column = this.columns.find(item => item.key === key);
return column != null && column.visible;
}
}
},
}

View File

@ -312,9 +312,6 @@ export default {
modelId: [
{ required: true, message: "型号不能为空", trigger: "change" }
],
deviceName: [
{ required: true, message: "设备名称不能为空", trigger: "change" }
],
mac: [
{ required: true, message: "设备MAC不能为空", trigger: "change" }
],

View File

@ -89,66 +89,61 @@
v-hasPermi="['system:smUser:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table ref="table" v-loading="loading" :data="smUserList" @row-click="changeSelection" @selection-change="handleSelectionChange">
<el-table
ref="table"
v-loading="loading"
:data="smUserList"
@row-click="changeSelection"
@selection-change="handleSelectionChange"
@sort-change="onSortChange"
:default-sort="defaultSort"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="用户ID" align="center" prop="userId" width="80"/>
<el-table-column label="头像" align="center" width="80">
<template slot-scope="d">
<el-avatar :src="d.row.avatar" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="用户账号" align="center" prop="userName" />
<el-table-column label="用户昵称" align="center" prop="nickName" />
<el-table-column label="用户类型" align="center" prop="isMch" width="100">
<template slot-scope="d">
<el-tag :type="d.row.isMch ? 'primary' : 'success'" >{{d.row.isMch ? '商户' : '普通用户'}}</el-tag>
</template>
</el-table-column>
<el-table-column label="手机号码" align="center" prop="phonenumber" width="120" />
<el-table-column label="用户性别" align="center" prop="sex">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex"/>
</template>
</el-table-column>
<el-table-column label="店铺数量" align="center" prop="storeCount" width="100">
<template slot-scope="d">
{{d.row.storeCount | defaultValue}}
</template>
</el-table-column>
<el-table-column label="充值金额" align="center" prop="rechargeAmount">
<template slot-scope="d">
{{d.row.rechargeAmount | money}}
</template>
</el-table-column>
<el-table-column label="提现金额" align="center" prop="withDrawlAmount">
<template slot-scope="d">
{{d.row.withDrawlAmount | money}}
</template>
</el-table-column>
<el-table-column label="账户余额" align="center" prop="balance" >
<template slot-scope="d">
{{d.row.balance | money}}
</template>
</el-table-column>
<el-table-column label="服务费费率" align="center" prop="serviceRate" width="150" >
<template slot-scope="d">
{{d.row.serviceRate == null ? '未设置' : d.row.serviceRate + '%'}}
</template>
</el-table-column>
<el-table-column label="帐号状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sm_user_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="设备数量" align="center" prop="deviceCount" >
<template slot-scope="d">
{{d.row.deviceCount | defaultValue}}
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
<template v-for="column of showColumns">
<el-table-column
:key="column.key"
:label="column.label"
:prop="column.key"
:align="column.align"
:min-width="column.minWidth"
:sort-orders="['ascending', 'descending', null]"
:sortable="column.sortable"
:show-overflow-tooltip="column.overflow"
>
<template slot-scope="d">
<template v-if="column.key === 'isMch'">
<el-tag :type="d.row.isMch ? 'primary' : 'success'" >{{d.row.isMch ? '商户' : '普通用户'}}</el-tag>
</template>
<template v-else-if="column.key === 'storeCount'">
{{d.row.storeCount | defaultValue}}
</template>
<template v-else-if="column.key === 'rechargeAmount'">
{{d.row.rechargeAmount | money}}
</template>
<template v-else-if="column.key === 'withDrawlAmount'">
{{d.row.withDrawlAmount | money}}
</template>
<template v-else-if="column.key === 'balance'">
{{d.row.balance | money}}
</template>
<template v-else-if="column.key === 'serviceRate'">
{{d.row.serviceRate == null ? '未设置' : d.row.serviceRate + '%'}}
</template>
<template v-else-if="column.key === 'status'">
<dict-tag :options="dict.type.sm_user_status" :value="d.row.status"/>
</template>
<template v-else-if="column.key === 'deviceCount'">
{{d.row.deviceCount | defaultValue}}
</template>
<template v-else>
{{d.row[column.key]}}
</template>
</template>
</el-table-column>
</template>
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width" fixed="right">
<template slot-scope="scope">
<el-button
@ -206,15 +201,8 @@
<el-input v-model="form.phonenumber" placeholder="请输入手机号" :maxlength="11" show-word-limit
clearable prefix-icon='el-icon-mobile' :style="{width: '100%'}"></el-input>
</el-form-item>
<el-form-item label="性别" prop="sex">
<el-select v-model="form.sex" placeholder="请选择性别" :style="{width: '100%'}">
<el-option
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" :maxlength="500" show-word-limit type="textarea"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -231,13 +219,36 @@
<script>
import { listSmUser, getSmUser, addSmUser, updateSmUser, delSmUser } from '@/api/system/smUser'
import ServiceRateForm from '@/views/system/smUser/components/serviceRateForm.vue'
import { $showColumns } from '@/utils/mixins'
const defaultSort = {
prop: "createTime",
order: "descending"
}
export default {
name: "SmUser",
mixins: [$showColumns],
components: { ServiceRateForm },
dicts: ['sm_user_status', 'user_type', 'sys_user_sex'],
data() {
return {
defaultSort,
columns: [
{key: 'userId', visible: true, label: '用户ID', align: 'center', minWidth: "80", sortable: true},
{key: 'phonenumber', visible: true, label: '手机号码', align: 'center', minWidth: null, sortable: true},
{key: 'userName', visible: false, label: '用户名称', align: 'center', minWidth: null, sortable: false},
{key: 'isMch', visible: true, label: '用户类型', align: 'center', minWidth: null, sortable: true},
{key: 'remark', visible: true, label: '备注', align: 'center', minWidth: null, sortable: false, overflow: true},
{key: 'createTime', visible: true, label: '创建时间', align: 'center', minWidth: "180", sortable: true},
{key: 'storeCount', visible: true, label: '店铺数量', align: 'center', minWidth: null, sortable: false},
{key: 'rechargeAmount', visible: true, label: '充值金额', align: 'center', minWidth: null, sortable: true},
{key: 'withDrawlAmount', visible: true, label: '提现金额', align: 'center', minWidth: null, sortable: true},
{key: 'balance', visible: true, label: '账户余额', align: 'center', minWidth: null, sortable: true},
{key: 'serviceRate', visible: true, label: '服务费费率', align: 'center', minWidth: null, sortable: true},
{key: 'status', visible: true, label: '账号状态', align: 'center', minWidth: null, sortable: true},
{key: 'deviceCount', visible: true, label: '设备数量', align: 'center', minWidth: null, sortable: false},
],
openServiceRate: false,
//
loading: true,
@ -261,6 +272,8 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
orderByColumn: defaultSort.prop,
isAsc: defaultSort.order,
userName: null,
nickName: null,
isMch: null,
@ -310,6 +323,16 @@ export default {
this.getList();
},
methods: {
onSortChange(column) {
if (column.order == null) {
this.queryParams.orderByColumn = defaultSort.prop;
this.queryParams.isAsc = defaultSort.order;
} else {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
}
this.getList();
},
//
changeSelection(row){
if (this.ids.includes(row.userId)){