feat 钱包日志, 用户和角色选择器新增数据源属性, eslint 规则微调, 恢复sass依赖

This commit is contained in:
xxm
2022-12-03 13:43:02 +08:00
parent e4a62d7301
commit 53fec7ea04
11 changed files with 182 additions and 41 deletions

View File

@@ -54,6 +54,7 @@ module.exports = {
'vue/singleline-html-element-content-newline': 'off',
'vue/attribute-hyphenation': 'off',
'vue/require-default-prop': 'off',
'vue/no-setup-props-destructure': 'off',
'vue/require-explicit-emits': 'off',
'vue/html-self-closing': [
'error',

View File

@@ -109,7 +109,7 @@
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.6.0",
"eslint-plugin-vue": "^8.7.1",
"esno": "^0.14.1",
"fs-extra": "^10.1.0",
"husky": "^7.0.4",
@@ -126,6 +126,7 @@
"rollup": "^2.70.2",
"rollup-plugin-visualizer": "^5.6.0",
"stylelint": "^14.7.1",
"sass": "^1.56.1",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-recommended": "^7.0.0",
"stylelint-config-recommended-vue": "^1.4.0",

View File

@@ -60,23 +60,23 @@
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const props = withDefaults(
defineProps<{
// 名称
title: string
// 是否是查询看状态
multiple: boolean
// 宽度
width?: number | string
}>(),
{
title: '选择角色',
multiple: false,
width: 640,
},
)
const emits = defineEmits(['ok'])
const {
title = '选择角色',
multiple = false,
width = 640,
dataSource = page,
} = defineProps<{
// 名称
title: string
// 是否是查询看状态
multiple: boolean
// 宽度
width?: number | string
// 数据源
dataSource?: Function
}>()
const emits = defineEmits(['ok'])
let visible = $ref(false)
let selectRoleIds = $ref<string[]>([])
let selectRoleId = $ref<string>()
@@ -86,7 +86,7 @@
{ field: 'code', type: STRING, name: '编号', placeholder: '请输入角色编号' },
]
const checkboxConfig = computed(() => {
return props.multiple
return multiple
? {
reserve: true,
checkMethod: banCheckbox,
@@ -94,7 +94,7 @@
: {}
})
const radioConfig = computed(() => {
return !props.multiple
return !multiple
? {
reserve: true,
checkRowKey: selectRoleId,
@@ -108,7 +108,7 @@
*/
function init(param) {
visible = true
if (props.multiple) {
if (multiple) {
selectRoleIds = param || selectRoleId
} else {
selectRoleId = param || selectRoleId
@@ -121,7 +121,7 @@
*/
function queryPage() {
loading.value = true
page({
dataSource({
...model.queryParam,
...pages,
}).then(({ data }) => {
@@ -132,7 +132,7 @@
* 选中确定回调
*/
function handleOk() {
if (props.multiple) {
if (multiple) {
checkboxCallback()
} else {
radioCallback()
@@ -175,7 +175,7 @@
* 禁止选中的行 复选
*/
function banCheckbox({ row }) {
return !selectUserIds.includes(row.id)
return !selectRoleIds.includes(row.id)
}
defineExpose({ init })
</script>

View File

@@ -70,11 +70,14 @@
multiple: boolean
// 宽度
width?: number | string
// 数据源
dataSource?: Function
}
const props = withDefaults(defineProps<Props>(), {
title: '选择用户',
multiple: false,
width: 640,
dataSource: page,
})
const emits = defineEmits(['ok'])
@@ -125,12 +128,14 @@
*/
function queryPage() {
loading.value = true
page({
...model.queryParam,
...pages,
}).then(({ data }) => {
pageQueryResHandel(data)
})
props
.dataSource({
...model.queryParam,
...pages,
})
.then(({ data }) => {
pageQueryResHandel(data)
})
}
/**
* 选中确定回调

View File

@@ -99,7 +99,7 @@
</template>
<script lang="ts" setup>
import { computed, nextTick, reactive } from 'vue'
import { computed, nextTick } from 'vue'
import { $ref } from 'vue/macros'
import useFormEdit from '/@/hooks/bootx/useFormEdit'
import { add, get, update, BpmModelNode } from './ModelNode.api'

View File

@@ -12,6 +12,16 @@ export function page(params) {
})
}
/**
* 分页(未开通钱包的用户)
*/
export function pageByNotWallet(params) {
return defHttp.get<Result<PageResult<Wallet>>>({
url: '/wallet/pageByNotWallet',
params: params,
})
}
/**
* 查询全部
*/

View File

@@ -57,7 +57,8 @@
@page-change="handleTableChange"
/>
<wallet-info ref="walletInfo" />
<b-user-select-modal ref="userSelectModal" multiple @ok="createBatchWallet" />
<wallet-log-list ref="walletLogList" />
<b-user-select-modal ref="userSelectModal" multiple :data-source="pageByNotWallet" @ok="createBatchWallet" />
</div>
</div>
</template>
@@ -65,7 +66,7 @@
<script lang="ts" setup>
import { onMounted } from 'vue'
import { $ref } from 'vue/macros'
import { createWalletBatch, del, lock, page, unlock } from './Wallet.api'
import { createWalletBatch, del, lock, page, pageByNotWallet, unlock } from './Wallet.api'
import useTablePage from '/@/hooks/bootx/useTablePage'
import WalletInfo from './WalletInfo.vue'
import { VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
@@ -73,8 +74,8 @@
import { useMessage } from '/@/hooks/web/useMessage'
import { QueryField, STRING } from '/@/components/Bootx/Query/Query'
import { useDict } from '/@/hooks/bootx/useDict'
import BUserSelectModal from "/@/components/Bootx/UserSelectModal/BUserSelectModal.vue";
import BUserSelectModal from '/@/components/Bootx/UserSelectModal/BUserSelectModal.vue'
import WalletLogList from "/@/views/modules/payment/wallet/list/WalletLogList.vue";
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()

View File

@@ -0,0 +1,47 @@
import { defHttp } from '/@/utils/http/axios'
import { PageResult, Result } from '/#/axios'
import { BaseEntity } from '/#/web'
/**
* 分页
*/
export function pageByWalletId(params) {
return defHttp.get<Result<PageResult<WalletLog>>>({
url: '/wallet/log/pageByWalletId',
params,
})
}
/**
* 获取单条
*/
export function get(id) {
return defHttp.get<Result<WalletLog>>({
url: '/wallet/log/findById',
params: { id },
})
}
/**
* 钱包日志
*/
export interface WalletLog extends BaseEntity {
// 钱包id
walletId?: string
// 用户id
userId?: string
// 类型
type?: number
// 交易记录ID
paymentId?: string
// 操作终端ip
clientIp?: string
// 备注
remark?: string
// 业务ID
businessId?: string
// 操作源
operationSource?: number
// 金额
amount?: number
}

View File

@@ -0,0 +1,76 @@
<template>
<basic-drawer forceRender showFooter v-bind="$attrs" title="钱包日志列表" width="60%" :visible="visible" @close="visible = false">
<vxe-toolbar ref="xToolbar" custom :refresh="{ query: queryPage }" />
<vxe-table row-id="id" ref="xTable" :data="pagination.records" :loading="loading">
<vxe-column type="seq" title="序号" width="60" />
<vxe-column field="type" title="类型">
<template #default="{ row }">
{{ dictConvert('WalletLogType', row.type) }}
</template>
</vxe-column>
<vxe-column field="amount" title="金额" />
<vxe-column field="operationSource" title="操作类型">
<template #default="{ row }">
{{ dictConvert('WalletLogOperation', row.operationSource) }}
</template>
</vxe-column>
<vxe-column field="remark" title="备注" />
</vxe-table>
<vxe-pager
size="medium"
:loading="loading"
:current-page="pagination.current"
:page-size="pagination.size"
:total="pagination.total"
@page-change="handleTableChange"
/>
</basic-drawer>
</template>
<script lang="ts" setup>
import BasicDrawer from '/@/components/Drawer/src/BasicDrawer.vue'
import useTablePage from '/@/hooks/bootx/useTablePage'
import { useMessage } from '/@/hooks/web/useMessage'
import { QueryField } from '/@/components/Bootx/Query/Query'
import { $ref } from 'vue/macros'
import { VxeTableInstance, VxeToolbarInstance } from 'vxe-table'
import { nextTick } from 'vue'
import { pageByWalletId } from '/@/views/modules/payment/wallet/list/WalletLog.api'
import { useDict } from '/@/hooks/bootx/useDict'
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage } = useMessage()
const { dictConvert } = useDict()
// 查询条件
const fields = [] as QueryField[]
let visible = $ref(false)
let walletId = $ref<string>()
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
nextTick(() => {
xTable?.connect(xToolbar as VxeToolbarInstance)
})
function init(id) {
visible = true
walletId = id
queryPage()
}
// 分页查询
function queryPage() {
pageByWalletId({
...model.queryParam,
...pages,
walletId,
}).then(({ data }) => {
pageQueryResHandel(data)
})
}
defineExpose({ init })
</script>
<style scoped></style>

View File

@@ -57,7 +57,7 @@
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createWarningModal, createMessage } = useMessage()
const { notification, createMessage } = useMessage()
// 查询条件
const fields = [] as QueryField[]
@@ -84,7 +84,7 @@
page({
...model.queryParam,
...pages,
dictId: dictInfo.id,
dictId: dictInfo?.id,
}).then(({ data }) => {
pageQueryResHandel(data)
})

View File

@@ -4451,7 +4451,7 @@ eslint-plugin-prettier@^4.0.0:
dependencies:
prettier-linter-helpers "^1.0.0"
eslint-plugin-vue@^8.6.0:
eslint-plugin-vue@^8.7.1:
version "8.7.1"
resolved "https://registry.npmmirror.com/eslint-plugin-vue/-/eslint-plugin-vue-8.7.1.tgz#f13c53547a0c9d64588a675cc5ecc6ccaf63703f"
integrity sha512-28sbtm4l4cOzoO1LtzQPxfxhQABararUb1JtqusQqObJpWX2e/gmVyeYVfepizPFne0Q5cILkYGiBoV36L12Wg==
@@ -8294,10 +8294,10 @@ safe-regex@^1.1.0:
resolved "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
sass@^1.55.0:
version "1.55.0"
resolved "https://registry.npmmirror.com/sass/-/sass-1.55.0.tgz#0c4d3c293cfe8f8a2e8d3b666e1cf1bff8065d1c"
integrity sha512-Pk+PMy7OGLs9WaxZGJMn7S96dvlyVBwwtToX895WmCpAOr5YiJYEUJfiJidMuKb613z2xNWcXCHEuOvjZbqC6A==
sass@^1.56.1:
version "1.56.1"
resolved "https://registry.npmmirror.com/sass/-/sass-1.56.1.tgz#94d3910cd468fd075fa87f5bb17437a0b617d8a7"
integrity sha512-VpEyKpyBPCxE7qGDtOcdJ6fFbcpOM+Emu7uZLxVrkX8KVU/Dp5UF7WLvzqRuUhB6mqqQt1xffLoG+AndxTZrCQ==
dependencies:
chokidar ">=3.0.0 <4.0.0"
immutable "^4.0.0"