fix: 新增投资交易记录页面。
This commit is contained in:
@@ -3,39 +3,24 @@
|
||||
<div class="search-con">
|
||||
<div class="title">查询条件</div>
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="记账账户" style="width: 500px;" prop="accountId">
|
||||
<el-form-item label="记账类型" style="width: 300px" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择记账类型" @change="handleQueryTypeChange" clearable>
|
||||
<el-option v-for="dict in account_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="记账账户" style="width: 500px" prop="accountId">
|
||||
<el-select v-model="queryParams.accountId" placeholder="请选择记账账户" clearable>
|
||||
<el-option v-for="account in accountList" :key="account.id" :label="account.nameCode" :value="account.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="记账类型" style="width: 300px;" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择记账类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in account_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="交易类型" style="width: 300px;" prop="dealType">
|
||||
<el-form-item label="交易类型" style="width: 300px" prop="dealType">
|
||||
<el-select v-model="queryParams.dealType" placeholder="请选择交易类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in deal_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
<el-option v-for="dict in deal_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="交易类别" style="width: 300px;" prop="dealCategory">
|
||||
<el-form-item label="交易类别" style="width: 300px" prop="dealCategory">
|
||||
<el-select v-model="queryParams.dealCategory" placeholder="请选择交易类别" clearable>
|
||||
<el-option
|
||||
v-for="dict in deal_category"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
<el-option v-for="dict in deal_category" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -48,32 +33,18 @@
|
||||
<div class="title-con">
|
||||
<div class="title">基本信息</div>
|
||||
<div class="operate-btn-con">
|
||||
<el-button
|
||||
@click="handleAdd"
|
||||
icon="Plus"
|
||||
v-hasPermi="['invest:accountDealRecord:add']"
|
||||
>新增</el-button>
|
||||
<el-button
|
||||
:disabled="multiple"
|
||||
icon="Delete"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['invest:accountDealRecord:remove']"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
@click="handleExport"
|
||||
icon="Download"
|
||||
v-hasPermi="['invest:accountDealRecord:export']"
|
||||
>导出</el-button>
|
||||
<el-button @click="handleAdd" icon="Plus" v-hasPermi="['invest:accountDealRecord:add']">新增</el-button>
|
||||
<el-button :disabled="multiple" icon="Delete" @click="handleDelete" v-hasPermi="['invest:accountDealRecord:remove']">删除</el-button>
|
||||
<el-button @click="handleExport" icon="Download" v-hasPermi="['invest:accountDealRecord:export']">导出</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-con" v-loading="loading">
|
||||
<el-scrollbar>
|
||||
<el-table v-loading="loading" :data="accountDealRecordList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="账户名称" align="center" prop="accountName" />
|
||||
<el-table-column label="记账类型" align="center" prop="type">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="account_type" :value="scope.row.type"/>
|
||||
<dict-tag :options="account_type" :value="scope.row.type" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="交易时间" align="center" prop="createTime" />
|
||||
@@ -81,20 +52,20 @@
|
||||
<el-table-column label="当前余额" align="center" prop="currentBalance" />
|
||||
<el-table-column label="交易类型" align="center" prop="dealType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="deal_type" :value="scope.row.dealType"/>
|
||||
<dict-tag :options="deal_type" :value="scope.row.dealType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="交易类别" align="center" prop="dealCategory">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="deal_category" :value="scope.row.dealCategory"/>
|
||||
<dict-tag :options="deal_category" :value="scope.row.dealCategory" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="备注" align="center" width="350" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<div class="ctrl-btn d-flex">
|
||||
<el-tooltip v-for="item in operateList" :key="item.id" class="item" effect="dark" :content="item.title" placement="top">
|
||||
<el-button :icon="item.icon" :v-hasPermi="item.hasPermi" circle @click="handleOperate(item.id,scope.row)"></el-button>
|
||||
<el-button :icon="item.icon" :v-hasPermi="item.hasPermi" circle @click="handleOperate(item.id, scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
@@ -109,12 +80,7 @@
|
||||
<el-form ref="accountDealRecordRef" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="记账类型" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择记账类型" @change="handleTypeChange">
|
||||
<el-option
|
||||
v-for="dict in account_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in account_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="记账账户" prop="accountId">
|
||||
@@ -124,33 +90,18 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="交易类型" prop="dealType">
|
||||
<el-select v-model="form.dealType" placeholder="请选择交易类型">
|
||||
<el-option
|
||||
v-for="dict in deal_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in deal_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="交易时间" prop="createTime">
|
||||
<el-date-picker clearable
|
||||
v-model="form.createTime"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择交易时间">
|
||||
</el-date-picker>
|
||||
<el-date-picker clearable v-model="form.createTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择交易时间"> </el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="交易金额" prop="amount">
|
||||
<el-input v-model="form.amount" placeholder="请输入交易金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="交易类别" prop="dealCategory">
|
||||
<el-select v-model="form.dealCategory" placeholder="请选择交易类别">
|
||||
<el-option
|
||||
v-for="dict in deal_category"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in deal_category" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
@@ -168,7 +119,13 @@
|
||||
</template>
|
||||
|
||||
<script setup name="AccountDealRecord">
|
||||
import { listAccountDealRecord, getAccountDealRecord, delAccountDealRecord, addAccountDealRecord, updateAccountDealRecord } from '@/api/invest/accountDealRecord'
|
||||
import {
|
||||
listAccountDealRecord,
|
||||
getAccountDealRecord,
|
||||
delAccountDealRecord,
|
||||
addAccountDealRecord,
|
||||
updateAccountDealRecord
|
||||
} from '@/api/invest/accountDealRecord'
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { listAccounts } from '@/api/invest/accounts'
|
||||
import { require } from '@/utils/require'
|
||||
@@ -214,24 +171,12 @@ const data = reactive({
|
||||
pageSize: 1000
|
||||
},
|
||||
rules: {
|
||||
type: [
|
||||
{ required: true, message: '记账类型不能为空', trigger: 'change' }
|
||||
],
|
||||
accountId: [
|
||||
{ required: true, message: '记账账户不能为空', trigger: 'blur' }
|
||||
],
|
||||
amount: [
|
||||
{ required: true, message: '交易金额不能为空', trigger: 'blur' }
|
||||
],
|
||||
dealType: [
|
||||
{ required: true, message: '交易类型不能为空', trigger: 'change' }
|
||||
],
|
||||
dealCategory: [
|
||||
{ required: true, message: '交易类别不能为空', trigger: 'change' }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: '交易时间不能为空', trigger: 'blur' }
|
||||
]
|
||||
type: [{ required: true, message: '记账类型不能为空', trigger: 'change' }],
|
||||
accountId: [{ required: true, message: '记账账户不能为空', trigger: 'blur' }],
|
||||
amount: [{ required: true, message: '交易金额不能为空', trigger: 'blur' }],
|
||||
dealType: [{ required: true, message: '交易类型不能为空', trigger: 'change' }],
|
||||
dealCategory: [{ required: true, message: '交易类别不能为空', trigger: 'change' }],
|
||||
createTime: [{ required: true, message: '交易时间不能为空', trigger: 'blur' }]
|
||||
}
|
||||
})
|
||||
|
||||
@@ -268,9 +213,9 @@ function getAddAccountList() {
|
||||
}
|
||||
|
||||
/** 查询账户交易记录列表 */
|
||||
function getList () {
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listAccountDealRecord(queryParams.value).then(response => {
|
||||
listAccountDealRecord(queryParams.value).then((response) => {
|
||||
accountDealRecordList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
@@ -284,7 +229,7 @@ function cancel() {
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset () {
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
name: null,
|
||||
@@ -304,13 +249,13 @@ function reset () {
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery () {
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery () {
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryRef')
|
||||
handleQuery()
|
||||
}
|
||||
@@ -323,14 +268,23 @@ const handleCurrentChange = (val) => {
|
||||
|
||||
const handleTypeChange = (type) => {
|
||||
queryAddAccountParams.value.type = type
|
||||
form.value.accountId = null
|
||||
listAccounts(queryAddAccountParams.value).then((response) => {
|
||||
addAccountList.value = response.rows
|
||||
})
|
||||
}
|
||||
|
||||
const handleQueryTypeChange = (type) => {
|
||||
queryAccountParams.value.type = type
|
||||
queryParams.value.accountId = null
|
||||
listAccounts(queryAccountParams.value).then((response) => {
|
||||
accountList.value = response.rows
|
||||
})
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange (selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.id)
|
||||
single.value = selection.length !== 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
@@ -343,17 +297,21 @@ const handleView = (row) => {
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd () {
|
||||
function handleAdd() {
|
||||
reset()
|
||||
queryAddAccountParams.value.type = ''
|
||||
getAddAccountList()
|
||||
open.value = true
|
||||
title.value = '添加账户交易记录'
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate (row) {
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
queryAddAccountParams.value.type = ''
|
||||
getAddAccountList()
|
||||
const _id = row.id || ids.value
|
||||
getAccountDealRecord(_id).then(response => {
|
||||
getAccountDealRecord(_id).then((response) => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = '修改账户交易记录'
|
||||
@@ -361,17 +319,17 @@ function handleUpdate (row) {
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm () {
|
||||
proxy.$refs.accountDealRecordRef.validate(valid => {
|
||||
function submitForm() {
|
||||
proxy.$refs.accountDealRecordRef.validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateAccountDealRecord(form.value).then(response => {
|
||||
updateAccountDealRecord(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('修改成功')
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addAccountDealRecord(form.value).then(response => {
|
||||
addAccountDealRecord(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('新增成功')
|
||||
open.value = false
|
||||
getList()
|
||||
@@ -382,21 +340,29 @@ function submitForm () {
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete (row) {
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除选中的数据项?').then(function() {
|
||||
proxy.$modal
|
||||
.confirm('是否确认删除选中的数据项?')
|
||||
.then(function () {
|
||||
return delAccountDealRecord(_ids)
|
||||
}).then(() => {
|
||||
})
|
||||
.then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport () {
|
||||
proxy.download('invest/accountDealRecord/export', {
|
||||
function handleExport() {
|
||||
proxy.download(
|
||||
'invest/accountDealRecord/export',
|
||||
{
|
||||
...queryParams.value
|
||||
}, `accountDealRecord_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
`accountDealRecord_${new Date().getTime()}.xlsx`
|
||||
)
|
||||
}
|
||||
getAccountList()
|
||||
getAddAccountList()
|
||||
|
||||
303
src/views/invest/investAccountDeal/index.vue
Normal file
303
src/views/invest/investAccountDeal/index.vue
Normal file
@@ -0,0 +1,303 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="search-con">
|
||||
<div class="title">查询条件</div>
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="投资账户" style="width: 500px" prop="accountId">
|
||||
<el-select v-model="queryParams.accountId" placeholder="请选择投资账户" clearable>
|
||||
<el-option v-for="account in accountList" :key="account.id" :label="account.nameCode" :value="account.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="交易类型" style="width: 300px" prop="dealType">
|
||||
<el-select v-model="queryParams.dealType" placeholder="请选择交易类型" clearable>
|
||||
<el-option v-for="dict in profit_loss" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="search-btn-con">
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button type="info" icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main-con">
|
||||
<div class="title-con">
|
||||
<div class="title">基本信息</div>
|
||||
<div class="operate-btn-con">
|
||||
<el-button @click="handleAdd" icon="Plus" v-hasPermi="['invest:accountDealRecord:add']">新增</el-button>
|
||||
<el-button :disabled="multiple" icon="Delete" @click="handleDelete" v-hasPermi="['invest:accountDealRecord:remove']">删除</el-button>
|
||||
<el-button @click="handleExport" icon="Download" v-hasPermi="['invest:accountDealRecord:export']">导出</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content-con" v-loading="loading">
|
||||
<el-scrollbar>
|
||||
<el-table v-loading="loading" :data="accountDealRecordList" @selection-change="handleSelectionChange">
|
||||
<el-table-column label="账户名称" align="center" prop="accountName" />
|
||||
<el-table-column label="交易时间" align="center" prop="createTime" />
|
||||
<el-table-column label="交易金额" align="center" prop="amount" />
|
||||
<el-table-column label="当前余额" align="center" prop="currentBalance" />
|
||||
<el-table-column label="交易类型" align="center" prop="dealType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="profit_loss" :value="scope.row.dealType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" width="350" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<div class="ctrl-btn d-flex">
|
||||
<el-tooltip v-for="item in operateList" :key="item.id" class="item" effect="dark" :content="item.title" placement="top">
|
||||
<el-button :icon="item.icon" :v-hasPermi="item.hasPermi" circle @click="handleOperate(item.id, scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination small background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" />
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 添加或修改投资交易记录对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
||||
<el-form ref="accountDealRecordRef" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="投资账户" prop="accountId">
|
||||
<el-select v-model="form.accountId" placeholder="请选择投资账户" clearable>
|
||||
<el-option v-for="account in accountList" :key="account.id" :label="account.nameCode" :value="account.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="交易类型" prop="dealType">
|
||||
<el-select v-model="form.dealType" placeholder="请选择交易类型">
|
||||
<el-option v-for="dict in profit_loss" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="交易时间" prop="createTime">
|
||||
<el-date-picker clearable v-model="form.createTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择交易时间"> </el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="交易金额" prop="amount">
|
||||
<el-input v-model="form.amount" placeholder="请输入交易金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template v-if="title !== '查看投资交易记录'" #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="AccountDealRecord">
|
||||
import {
|
||||
listAccountDealRecord,
|
||||
getAccountDealRecord,
|
||||
delAccountDealRecord,
|
||||
addAccountDealRecord,
|
||||
updateAccountDealRecord
|
||||
} from '@/api/invest/accountDealRecord'
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import { listAccounts } from '@/api/invest/accounts'
|
||||
import { require } from '@/utils/require'
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { profit_loss, account_type, deal_category } = proxy.useDict('profit_loss', 'account_type', 'deal_category')
|
||||
|
||||
const accountDealRecordList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref('')
|
||||
const accountList = ref([])
|
||||
const operateList = ref([
|
||||
{ id: 'view', icon: 'View', title: '查看', hasPermi: ['invest:accountDealRecord:query'] },
|
||||
{ id: 'edit', icon: 'Edit', title: '修改', hasPermi: ['invest:accountDealRecord:edit'] },
|
||||
{ id: 'delete', icon: 'Delete', title: '删除', hasPermi: ['invest:accountDealRecord:remove'] }
|
||||
])
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
type: '5',
|
||||
accountId: null,
|
||||
dealType: null,
|
||||
dealCategory: '2'
|
||||
},
|
||||
queryAccountParams: {
|
||||
pageNum: 1,
|
||||
type: '5',
|
||||
state: '1',
|
||||
pageSize: 1000
|
||||
},
|
||||
rules: {
|
||||
accountId: [{ required: true, message: '投资账户不能为空', trigger: 'blur' }],
|
||||
amount: [{ required: true, message: '交易金额不能为空', trigger: 'blur' }],
|
||||
dealType: [{ required: true, message: '交易类型不能为空', trigger: 'change' }],
|
||||
createTime: [{ required: true, message: '交易时间不能为空', trigger: 'blur' }]
|
||||
}
|
||||
})
|
||||
|
||||
const handleOperate = (operate, row) => {
|
||||
switch (operate) {
|
||||
case 'view':
|
||||
handleView(row)
|
||||
break
|
||||
case 'edit':
|
||||
handleUpdate(row)
|
||||
break
|
||||
case 'delete':
|
||||
handleDelete(row)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
const { queryParams, queryAccountParams, queryAddAccountParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询账户管理列表 */
|
||||
function getAccountList() {
|
||||
listAccounts(queryAccountParams.value).then((response) => {
|
||||
accountList.value = response.rows
|
||||
})
|
||||
}
|
||||
/** 查询投资交易记录列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listAccountDealRecord(queryParams.value).then((response) => {
|
||||
accountDealRecordList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
name: null,
|
||||
type: '5',
|
||||
accountId: null,
|
||||
amount: null,
|
||||
dealType: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
delFlag: null,
|
||||
remark: null,
|
||||
dealCategory: '2'
|
||||
}
|
||||
proxy.resetForm('accountDealRecordRef')
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryRef')
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 分页
|
||||
const handleCurrentChange = (val) => {
|
||||
queryParams.value.pageNum = val
|
||||
getList()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.id)
|
||||
single.value = selection.length !== 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
// 查看
|
||||
const handleView = (row) => {
|
||||
title.value = '查看投资交易记录'
|
||||
form.value = row
|
||||
open.value = true
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = '添加投资交易记录'
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getAccountDealRecord(_id).then((response) => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = '修改投资交易记录'
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs.accountDealRecordRef.validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateAccountDealRecord(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('修改成功')
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addAccountDealRecord(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess('新增成功')
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal
|
||||
.confirm('是否确认删除选中的数据项?')
|
||||
.then(function () {
|
||||
return delAccountDealRecord(_ids)
|
||||
})
|
||||
.then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download(
|
||||
'invest/accountDealRecord/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`accountDealRecord_${new Date().getTime()}.xlsx`
|
||||
)
|
||||
}
|
||||
getAccountList()
|
||||
getList()
|
||||
</script>
|
||||
Reference in New Issue
Block a user