Commit af76f920 authored by 332784038@qq.com's avatar 332784038@qq.com

Merge branch 'refactor-currency-rate' into pre-release

parents 8c6849d9 9f22e139
<template> <template>
<div> <div>
<div class="remarks">{{ row.remarks || '' }}</div> <div class="remarks">{{ row.remarks || $t('') }}</div>
<div><i>{{ row.updateAt }}</i> <b>{{ row.updateBy }}</b></div> <div><i>{{ row.updateAt }}</i> <b>{{ row.updateBy }}</b></div>
</div> </div>
</template> </template>
...@@ -8,13 +8,12 @@ ...@@ -8,13 +8,12 @@
<script> <script>
import Vue from 'vue' import Vue from 'vue'
const props = {
row: Object,
}
export default Vue.extend({ export default Vue.extend({
props: { props,
row: {
type: Object,
required: true,
},
},
}) })
</script> </script>
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<el-col :span="11"> <el-col :span="11">
<div> <div>
<i v-if="model.expiration && expires > 0" class="diff">{{ expires }}天后过期</i> <i v-if="model.expiration && expires > 0" class="diff">{{ expires }}天后过期</i>
<i v-if="model.expiration && expires <= 0" class="diff expired">已过期{{ 0 - expires }}天</i> <i v-if="model.expiration && expires < 0" class="diff expired">已过期{{ 0 - expires }}天</i>
</div> </div>
</el-col> </el-col>
</el-form-item> </el-form-item>
...@@ -146,8 +146,10 @@ export default Vue.extend({ ...@@ -146,8 +146,10 @@ export default Vue.extend({
if (await this.$refs['form'].validate().catch(() => {})) { if (await this.$refs['form'].validate().catch(() => {})) {
if (this.update) { if (this.update) {
await updateCurrencyRate(this.model.id, this.model) await updateCurrencyRate(this.model.id, this.model)
} else {
await createCurrencyRate(this.model)
} }
await createCurrencyRate(this.model)
this.$emit('update:model', this.model) this.$emit('update:model', this.model)
this.close() this.close()
} }
......
...@@ -61,35 +61,19 @@ import Query from './query.vue' ...@@ -61,35 +61,19 @@ import Query from './query.vue'
import Audit from './audit.vue' import Audit from './audit.vue'
import Decimal from 'decimal.js' import Decimal from 'decimal.js'
const components = { FormDialog, LogsDialog, Query, Audit, }
export default Vue.extend({ export default Vue.extend({
components: { components,
FormDialog, LogsDialog, Query, Audit,
},
data() { data() {
return { return {
map: { map: { countries: {}, currencies: {}, },
countries: {}, dict: { countries: [], currencies: [], },
currencies: {},
},
dict: {
countries: [],
currencies: [],
},
form: {
rules: {},
},
query: { query: {
show: true, show: true,
loading: false, loading: false,
params: { params: { page: 1, rows: 10, expiration: ['', ''], },
page: 1, result: { list: [], total: 0, },
rows: 10,
expiration: ['', ''],
},
result: {
list: [],
total: 0,
},
}, },
dialogs: { dialogs: {
form: { visible: false, update: false, data: {}, }, form: { visible: false, update: false, data: {}, },
...@@ -101,7 +85,7 @@ export default Vue.extend({ ...@@ -101,7 +85,7 @@ export default Vue.extend({
async pagination() { async pagination() {
this.query.loading = true this.query.loading = true
try { try {
this.query.result = (await getCurrencyRatePage(this.query.params)).data this.query.result = await getCurrencyRatePage(this.query.params).then(it => it.data)
} finally { } finally {
this.query.loading = false this.query.loading = false
} }
...@@ -150,7 +134,7 @@ export default Vue.extend({ ...@@ -150,7 +134,7 @@ export default Vue.extend({
this.dict.currencies = await getCurrencyList().then(it => it.data) this.dict.currencies = await getCurrencyList().then(it => it.data)
this.map.countries = this.dict.countries.reduce((m, e) => (m[e.id] = e, m), {}) this.map.countries = this.dict.countries.reduce((m, e) => (m[e.id] = e, m), {})
this.map.currencies = this.dict.currencies.reduce((m, e) => (m[e.id] = e, m), {}) this.map.currencies = this.dict.currencies.reduce((m, e) => (m[e.id] = e, m), {})
this.pagination() await this.pagination()
}, },
}) })
</script> </script>
......
...@@ -41,18 +41,6 @@ ...@@ -41,18 +41,6 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column :label="$t('修改前')" align="right" class-name="before">
<template v-slot="{ row }">
<div>{{ amount(row.sourceAmount1, row.targetAmount1) }}</div>
<div>1 : <i>{{ rate(row.sourceAmount1, row.targetAmount1) }}</i>, {{ row.sourceExpiration }}</div>
</template>
</el-table-column>
<el-table-column :label="$t('修改后')" align="right" class-name="after">
<template v-slot="{ row }">
<div>{{ amount(row.sourceAmount2, row.targetAmount2) }}</div>
<div>1 : <i>{{ rate(row.sourceAmount2, row.targetAmount2) }}</i>, {{ row.targetExpiration }}</div>
</template>
</el-table-column> -->
</el-table> </el-table>
<pagination v-show="total > 0" :background="false" small layout="total,prev,pager,next,jumper" :total="total" :page.sync="page" :limit.sync="limit" @pagination="pagination"/> <pagination v-show="total > 0" :background="false" small layout="total,prev,pager,next,jumper" :total="total" :page.sync="page" :limit.sync="limit" @pagination="pagination"/>
</el-dialog> </el-dialog>
...@@ -62,33 +50,25 @@ ...@@ -62,33 +50,25 @@
import { getCurrencyRateLogs } from '@/api/ecw/currencyRate' import { getCurrencyRateLogs } from '@/api/ecw/currencyRate'
import Decimal from 'decimal.js' import Decimal from 'decimal.js'
import Vue from 'vue' import Vue from 'vue'
import audit from './audit.vue' import Audit from './audit.vue'
const components = {
Audit,
}
const props = {
id: Number,
visible: { type: Boolean, default: false, },
source: Object,
target: Object,
}
export default Vue.extend({ export default Vue.extend({
components: { audit }, components,
props: { props,
visible: { model: { prop: 'visible', event: 'update', },
type: Boolean,
default: false,
},
id: Number,
source: {
},
target: {
},
},
model: {
prop: 'visible',
event: 'update',
},
data() { data() {
return { return { loading: false, page: 1, limit: 10, list: [], total: 0, }
loading: false,
page: 1,
limit: 10,
list: [],
total: 0,
}
}, },
methods: { methods: {
close() { close() {
......
...@@ -33,29 +33,16 @@ ...@@ -33,29 +33,16 @@
<script> <script>
import Vue from 'vue' import Vue from 'vue'
const props = {
show: { type: Boolean, default: false, },
value: { type: Object, default: {}, },
countries: { type: Array, default: [], },
currencies: { type: Array, default: [], },
}
export default Vue.extend({ export default Vue.extend({
props: { props,
show: { model: { prop: 'value', event: 'update', },
type: Boolean,
default: false,
},
value: {
type: Object,
default: {},
},
countries: {
type: Array,
default: [],
},
currencies: {
type: Array,
default: [],
},
},
model: {
prop: 'value',
event: 'update',
},
data() { data() {
return { return {
params: this.value, params: this.value,
...@@ -66,7 +53,6 @@ export default Vue.extend({ ...@@ -66,7 +53,6 @@ export default Vue.extend({
this.$emit('query', this.params) this.$emit('query', this.params)
}, },
clear() { clear() {
console.log('query', this.params)
this.$emit('update:value', this.params = {}) this.$emit('update:value', this.params = {})
}, },
}, },
......
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