Commit 2b91e754 authored by 邓春圆's avatar 邓春圆

新增汇率列表

parent 4fb0fa81
...@@ -42,7 +42,14 @@ export function getExchangeRatePage(query) { ...@@ -42,7 +42,14 @@ export function getExchangeRatePage(query) {
params: query params: query
}) })
} }
// 汇率日志查询
export function getExchangeRateLogList(params){
return request({
url:'/ecw/exchange-rate-log/list',
method:'get',
params,
})
}
// 导出汇率管理 Excel // 导出汇率管理 Excel
export function exportExchangeRateExcel(query) { export function exportExchangeRateExcel(query) {
return request({ return request({
......
...@@ -3,22 +3,18 @@ ...@@ -3,22 +3,18 @@
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="原币种" prop="sourceCurrencyId"> <el-form-item label="币种1" prop="sourceCurrencyId">
<el-select v-model="queryParams.sourceCurrencyId" placeholder="请选择币种" clearable size="small"> <el-select v-model="queryParams.sourceCurrencyId" placeholder="请选择币种" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_USER_SEX)" <el-option v-for="dict in currencyList"
:key="dict.value" :label="dict.label" :value="dict.value"/> :key="dict.id" :label="$l(dict,'title') + dict.fuhao" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="目标币种" prop="targetCurrencyId"> <el-form-item label="币种2" prop="targetCurrencyId">
<el-select v-model="queryParams.targetCurrencyId" placeholder="请选择目标币种" clearable size="small"> <el-select v-model="queryParams.targetCurrencyId" placeholder="请选择币种" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_USER_SEX)" <el-option v-for="dict in currencyList"
:key="dict.value" :label="dict.label" :value="dict.value"/> :key="dict.id" :label="$l(dict,'title') + dict.fuhao" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
...@@ -28,43 +24,58 @@ ...@@ -28,43 +24,58 @@
<!-- 操作工具栏 --> <!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
v-hasPermi="['ecw:exchange-rate:create']">新增</el-button> <!-- v-hasPermi="['ecw:exchange-rate:create']"-->
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['ecw:exchange-rate:export']">导出</el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"-->
<!-- v-hasPermi="['ecw:exchange-rate:export']">导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<!-- 列表 --> <!-- 列表 -->
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="" align="center" prop="id" /> <el-table-column label="" align="center" prop="id" />
<el-table-column label="原币种" align="center" prop="sourceCurrencyId"> <el-table-column label="币种1" align="center" prop="sourceCurrencyId">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.sourceCurrencyId" /> {{getCurrency(scope.row.sourceCurrencyId)}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="原币种代码" align="center" prop="sourceCurrencyCode" /> <el-table-column label="币种2">
<el-table-column label="目标币种" align="center" prop="targetCurrencyId"> <template v-slot="{row}">
<template slot-scope="scope"> {{getCurrency(row.targetCurrencyId)}}
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.targetCurrencyId" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="目标种代码" align="center" prop="targetCurrencyCode" /> <el-table-column label="币种1 金额">
<el-table-column label="汇率" align="center" prop="currencyRate" /> <template v-slot="{row}">
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> 1 {{getCurrency(row.sourceCurrencyId, true)}}
<template slot-scope="scope"> </template>
<span>{{ parseTime(scope.row.createTime) }}</span> </el-table-column>
<el-table-column label="币种1金额兑换币种2汇率" prop="currencyRate"></el-table-column>
<el-table-column label="币种2金额">
<template v-slot="{row}">
{{1 * row.currencyRate}}{{getCurrency(row.targetCurrencyId, true)}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="最后修改时间">
<template v-slot="{row}">
{{parseTime(row.updateTime)}}
</template>
</el-table-column>
<el-table-column label="最后修改人">
<template v-slot="{row}">
{{getOperator(row.updater)}}
</template>
</el-table-column>
<el-table-column label="备注" prop="note"></el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" <!-- v-hasPermi="['ecw:exchange-rate:update']"-->
v-hasPermi="['ecw:exchange-rate:update']">修改</el-button> <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
v-hasPermi="['ecw:exchange-rate:delete']">删除</el-button> <el-button size="mini" type="text" icon="el-icon-delete" @click="handleLog(scope.row)">日志</el-button>
<!-- v-hasPermi="['ecw:exchange-rate:delete']"-->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -74,48 +85,87 @@ ...@@ -74,48 +85,87 @@
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="原币种" prop="sourceCurrencyId"> <el-form-item label="币种1" prop="sourceCurrencyId">
<el-select v-model="form.sourceCurrencyId" placeholder="请选择原币种"> <el-select v-model="form.sourceCurrencyId" placeholder="请选择币种">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_USER_SEX)" <el-option @click.native="() => form.sourceCurrencyCode = dict.fuhao" v-for="dict in currencyList"
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)" /> :key="dict.id" :label="$l(dict,'title') + dict.fuhao" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="原币种代码" prop="sourceCurrencyCode"> <el-form-item label="币种2" prop="targetCurrencyId">
<el-input v-model="form.sourceCurrencyCode" placeholder="请输入原币种代码" /> <el-select v-model="form.targetCurrencyId" placeholder="请选择币种">
</el-form-item> <el-option @click.native="() => form.targetCurrencyCode = dict.fuhao" v-for="dict in currencyList"
<el-form-item label="目标币种" prop="targetCurrencyId"> :key="dict.id" :label="$l(dict,'title') + dict.fuhao" :value="dict.id" />
<el-select v-model="form.targetCurrencyId" placeholder="请选择目标币种">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_USER_SEX)"
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="目标种代码" prop="targetCurrencyCode">
<el-input v-model="form.targetCurrencyCode" placeholder="请输入目标种代码" />
</el-form-item>
<el-form-item label="汇率" prop="currencyRate"> <el-form-item label="汇率" prop="currencyRate">
<el-input v-model="form.currencyRate" placeholder="请输入汇率" /> <el-input v-model="form.currencyRate" placeholder="请输入汇率" />
<p style="margin: 0;">
例子:1RMB = 0.138611USD
</p>
</el-form-item>
<el-form-item label="备注">
<el-input type="textarea" v-model="form.note"></el-input>
</el-form-item> </el-form-item>
<template v-if="form.id">
<el-form-item label="创建人">{{getOperator(form.updater)}}</el-form-item>
<el-form-item label="创建时间">{{parseTime(form.createTime)}}</el-form-item>
<el-form-item label="最后更新人">{{parseTime(form.updateTime)}}</el-form-item>
<el-form-item label="最后更新人">{{getOperator(form.updater)}}</el-form-item>
</template>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button> <el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="openLog" >
<el-table :data="listLog">
<el-table-column label="修改人" prop="changeName"></el-table-column>
<el-table-column label="修改时间">
<template v-slot="{row}">
{{parseTime(row.createTime)}}
</template>
</el-table-column>
<el-table-column label="修改前内容">
<template v-slot="{row}">
币种1:【{{row.beforeChangeSourceValue}}<br/>
币种2:【{{row.beforeChangeTargetValue}}<br/>
汇率:【{{row.beforeChangeValue}}<br/>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { createExchangeRate, updateExchangeRate, deleteExchangeRate, getExchangeRate, getExchangeRatePage, exportExchangeRateExcel } from "@/api/ecw/exchangeRate"; import {
createExchangeRate,
updateExchangeRate,
deleteExchangeRate,
getExchangeRate,
getExchangeRatePage,
exportExchangeRateExcel,
getExchangeRateLogList
} from "@/api/ecw/exchangeRate";
import {getCurrencyPage} from "@/api/ecw/currency";
import {listAllSimpl} from "@/api/system/user";
import Template from "@/views/cms/template/index.vue";
export default { export default {
name: "ExchangeRate", name: "ExchangeRate",
components: { components: {
Template
}, },
data() { data() {
return { return {
currencyList:[],
allSimplList:[],
listLog:[],
openLog:false,
// 遮罩层 // 遮罩层
loading: true, loading:false,
// 导出遮罩层 // 导出遮罩层
exportLoading: false, exportLoading: false,
// 显示搜索条件 // 显示搜索条件
...@@ -140,24 +190,53 @@ export default { ...@@ -140,24 +190,53 @@ export default {
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
sourceCurrencyId: [{ required: true, message: "原币种不能为空", trigger: "change" }], sourceCurrencyId: [{ required: true, message: "币种1不能为空", trigger: "change" }],
sourceCurrencyCode: [{ required: true, message: "原币种代码不能为空", trigger: "blur" }], sourceCurrencyCode: [{ required: true, message: "原币种代码不能为空", trigger: "blur" }],
targetCurrencyId: [{ required: true, message: "目标币种不能为空", trigger: "change" }], targetCurrencyId: [{ required: true, message: "币种2不能为空", trigger: "change" }],
targetCurrencyCode: [{ required: true, message: "目标种代码不能为空", trigger: "blur" }], targetCurrencyCode: [{ required: true, message: "目标种代码不能为空", trigger: "blur" }],
currencyRate: [{ required: true, message: "汇率不能为空", trigger: "blur" }], currencyRate: [{ required: true, message: "汇率不能为空", trigger: "blur" }],
} }
}; };
}, },
created() { created() {
listAllSimpl().then(r => {
this.allSimplList = r.data
})
getCurrencyPage({ pageNo: 1, pageSize: 1000,}).then(res => this.currencyList = res.data.list)
this.getList(); this.getList();
}, },
methods: { methods: {
handleLog(row){
this.openLog = true;
getExchangeRateLogList({ids:row.id}).then(r => {
console.log(r,'rrr')
this.listLog = r.data;
})
},
getOperator(val){
if (val){
let n = this.allSimplList.find(i => i.id == val)
return n?.nickname
}
return ''
},
getCurrency(val, isEn = false){
if (val){
let r = this.currencyList.find(i => i.id === val)
if(isEn){
return r?.titleEn
}else {
return r?.titleZh + `(${r?.titleEn})`
}
}
return ''
},
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
// 处理查询参数 // 处理查询参数
let params = {...this.queryParams}; let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
// 执行查询 // 执行查询
getExchangeRatePage(params).then(response => { getExchangeRatePage(params).then(response => {
this.list = response.data.list; this.list = response.data.list;
...@@ -173,12 +252,13 @@ export default { ...@@ -173,12 +252,13 @@ export default {
/** 表单重置 */ /** 表单重置 */
reset() { reset() {
this.form = { this.form = {
id: undefined, "currencyRate": "",
sourceCurrencyId: undefined, "note": "",
sourceCurrencyCode: undefined, "sourceCurrencyCode": "",
targetCurrencyId: undefined, "sourceCurrencyId":'' ,
targetCurrencyCode: undefined, "targetCurrencyCode": "",
currencyRate: undefined, "targetCurrencyId": '',
id: null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
...@@ -197,7 +277,7 @@ export default { ...@@ -197,7 +277,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加汇率管理"; this.title = "新增";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
...@@ -206,7 +286,7 @@ export default { ...@@ -206,7 +286,7 @@ export default {
getExchangeRate(id).then(response => { getExchangeRate(id).then(response => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改汇率管理"; this.title = "修改";
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
...@@ -217,7 +297,16 @@ export default { ...@@ -217,7 +297,16 @@ export default {
} }
// 修改的提交 // 修改的提交
if (this.form.id != null) { if (this.form.id != null) {
updateExchangeRate(this.form).then(response => { let p = {
currencyRate: Number(this.form.currencyRate),
id: this.form.id,
note: this.form.no,
sourceCurrencyCode: this.form.sourceCurrencyCode,
sourceCurrencyId: this.form.sourceCurrencyId ,
targetCurrencyCode: this.form.targetCurrencyCode,
targetCurrencyId: this.form.targetCurrencyId
}
updateExchangeRate(p).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment