|
@@ -1,5 +1,522 @@
|
|
|
-<script setup lang="ts"></script>
|
|
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div
|
|
|
|
|
+ id="card_Blockchain"
|
|
|
|
|
+ v-loading="pictLoading"
|
|
|
|
|
+ class="view"
|
|
|
|
|
+ :element-loading-background="'rgba(43, 48, 67, 0.65)'"
|
|
|
|
|
+ :element-loading-spinner="'el-icon-loading'"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div class="crm_search">
|
|
|
|
|
+ <el-form ref="formRef" :model="search" label-width="">
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col :span="24" :md="24" :lg="24">
|
|
|
|
|
+ <el-form-item style="margin-right: 10px">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model.trim="search.currency"
|
|
|
|
|
+ class="crm-border-radius-no"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ :placeholder="t('Ucard.BlockchainRate.addP1')"
|
|
|
|
|
+ @keyup.enter="toSearch"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item style="margin-right: 10px">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model.trim="search.convertCurrency"
|
|
|
|
|
+ class="crm-border-radius-no"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ :placeholder="t('Ucard.BlockchainRate.addP2')"
|
|
|
|
|
+ @keyup.enter="toSearch"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="search.enableStatus"
|
|
|
|
|
+ class="crm-border-radius-no"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ :placeholder="t('Ucard.BlockchainRate.pageT3')"
|
|
|
|
|
+ @change="toSearch"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="(value, key) in enableStatus"
|
|
|
|
|
+ :key="key"
|
|
|
|
|
+ :label="t(value)"
|
|
|
|
|
+ :value="key"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ class="crm-border-radius-no crm-border-left-no"
|
|
|
|
|
+ :icon="Search"
|
|
|
|
|
+ @click="toSearch"
|
|
|
|
|
+ ></el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ v-if="display['R-Card-BlockchainRate-Add']?.show"
|
|
|
|
|
+ class=""
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ :icon="Plus"
|
|
|
|
|
+ @click="openAddDialog"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ t('R-Card-BlockchainRate-Add') }}
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ v-if="display['R-Card-BlockchainRate-Delete']?.show"
|
|
|
|
|
+ :disabled="!multipleSelection.length"
|
|
|
|
|
+ :type="multipleSelection.length ? 'primary' : 'info'"
|
|
|
|
|
+ :icon="Minus"
|
|
|
|
|
+ @click="toDelete"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ t('R-Card-BlockchainRate-Delete') }}
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-table
|
|
|
|
|
+ :data="mock_tableData"
|
|
|
|
|
+ stripe
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-table-column align="left" type="selection" width="55"> </el-table-column>
|
|
|
|
|
+ <el-table-column prop="currency" align="left" :label="t('Ucard.BlockchainRate.pageT1')">
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
|
+ {{ row.currency || '--' }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column
|
|
|
|
|
+ prop="convertCurrency"
|
|
|
|
|
+ align="left"
|
|
|
|
|
+ :label="t('Ucard.BlockchainRate.pageT2')"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
|
+ {{ row.convertCurrency || '--' }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="exchangeRate" align="left" :label="t('Ucard.BlockchainRate.pageT4')">
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
|
+ {{ row.exchangeRate || '--' }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="enableStatus" align="left" :label="t('Ucard.BlockchainRate.pageT3')">
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
|
+ <el-switch
|
|
|
|
|
+ v-model="row.enableStatus"
|
|
|
|
|
+ :disabled="!display['R-Card-BlockchainRate-Edit']?.show"
|
|
|
|
|
+ :active-text="t(enableStatus[1])"
|
|
|
|
|
+ :active-value="1"
|
|
|
|
|
+ :inactive-text="t(enableStatus[0])"
|
|
|
|
|
+ :inactive-value="0"
|
|
|
|
|
+ active-color="#368FEC"
|
|
|
|
|
+ inactive-color="#EB3F57"
|
|
|
|
|
+ class="crm_switch crm_switch_width"
|
|
|
|
|
+ @change="() => changeEnable(row)"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-switch>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="ctrl" align="center" :label="t('Label.Action')">
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
|
+ <el-dropdown trigger="click" @command="handleCommand">
|
|
|
|
|
+ <span class="el-dropdown-link crm-cursor">
|
|
|
|
|
+ <i style="font-weight: bold; font-size: 20px" class="iconfont iconcaidan"></i>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <template #dropdown>
|
|
|
|
|
+ <el-dropdown-menu>
|
|
|
|
|
+ <el-dropdown-item
|
|
|
|
|
+ v-if="display['R-Card-BlockchainRate-Edit']?.show"
|
|
|
|
|
+ :command="{ type: 'editor', row: row }"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-icon><Edit /></el-icon>
|
|
|
|
|
+ <span>{{ t('R-Card-Blockchain-Edit') }}</span>
|
|
|
|
|
+ </el-dropdown-item>
|
|
|
|
|
+ <el-dropdown-item
|
|
|
|
|
+ v-if="display['R-Card-BlockchainRate-Delete']?.show"
|
|
|
|
|
+ :command="{ type: 'delete', row: row }"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-icon><Delete /></el-icon>
|
|
|
|
|
+ <span>{{ t('R-Card-Blockchain-Delete') }}</span>
|
|
|
|
|
+ </el-dropdown-item>
|
|
|
|
|
+ </el-dropdown-menu>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dropdown>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ <PagePagination
|
|
|
|
|
+ :pager-info="pagerInfo"
|
|
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
|
|
+ @size-change="handleSizeChange"
|
|
|
|
|
+ />
|
|
|
|
|
|
|
|
-<template>1</template>
|
|
|
|
|
|
|
+ <!-- 新增 -->
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ v-model="addDialogVisible"
|
|
|
|
|
+ :title="t(isEdit ? 'Ucard.BlockchainRate.title1' : 'Ucard.BlockchainRate.title2')"
|
|
|
|
|
+ width="500px"
|
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-form ref="addFormRef" :model="addForm" :rules="addRules" label-width="120px">
|
|
|
|
|
+ <el-form-item :label="`${t('Ucard.BlockchainRate.pageT1')}:`" prop="currency">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="addForm.currency"
|
|
|
|
|
+ :disabled="isEdit"
|
|
|
|
|
+ :placeholder="t('Ucard.BlockchainRate.addP1')"
|
|
|
|
|
+ ></el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item :label="`${t('Ucard.BlockchainRate.pageT2')}:`" prop="convertCurrency">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="addForm.convertCurrency"
|
|
|
|
|
+ :disabled="isEdit"
|
|
|
|
|
+ :placeholder="t('Ucard.BlockchainRate.addP2')"
|
|
|
|
|
+ ></el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item :label="`${t('Ucard.BlockchainRate.pageT4')}:`" prop="exchangeRate">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="addForm.exchangeRate"
|
|
|
|
|
+ type="number"
|
|
|
|
|
+ :placeholder="t('Ucard.BlockchainRate.addP4')"
|
|
|
|
|
+ ></el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ style="text-align: left"
|
|
|
|
|
+ :label="`${t('Ucard.BlockchainRate.pageT3')}:`"
|
|
|
|
|
+ prop="enableStatus"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-switch
|
|
|
|
|
+ v-model="addForm.enableStatus"
|
|
|
|
|
+ :active-text="t(enableStatus[1])"
|
|
|
|
|
+ :active-value="1"
|
|
|
|
|
+ :inactive-text="t(enableStatus[0])"
|
|
|
|
|
+ :inactive-value="0"
|
|
|
|
|
+ active-color="#368FEC"
|
|
|
|
|
+ class="crm_switch crm_switch_width"
|
|
|
|
|
+ inactive-color="#EB3F57"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-switch>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <div class="dialog-footer">
|
|
|
|
|
+ <el-button @click="addDialogVisible = false">{{ t('Btn.Cancel') }} </el-button>
|
|
|
|
|
+ <el-button type="primary" :loading="addLoading" @click="handleAddConfirm"
|
|
|
|
|
+ >{{ t('Btn.Confirm') }}
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
|
|
|
-<style scoped lang="scss"></style>
|
|
|
|
|
|
|
+<script setup>
|
|
|
|
|
+ import { ref, reactive, computed, watch, onMounted, nextTick, inject } from 'vue'
|
|
|
|
|
+ import { useI18n } from 'vue-i18n'
|
|
|
|
|
+ import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
|
+ import Service from '@/service/ucard'
|
|
|
|
|
+ import Config from '@/config/index'
|
|
|
|
|
+ import { enableStatus } from '@/enum/enum'
|
|
|
|
|
+ import PagePagination from '@/components/pagePagination/index.vue'
|
|
|
|
|
+ import { Delete, Edit, Minus, Plus, Search } from '@element-plus/icons-vue'
|
|
|
|
|
+
|
|
|
|
|
+ const { t } = useI18n()
|
|
|
|
|
+ const { Code } = Config
|
|
|
|
|
+ const Session = inject('session')
|
|
|
|
|
+ const pigeon = inject('pigeon')
|
|
|
|
|
+
|
|
|
|
|
+ // 常量
|
|
|
|
|
+ const floatReg = /^\d+(\.\d{0,10})?$/
|
|
|
|
|
+
|
|
|
|
|
+ // 响应式数据
|
|
|
|
|
+ const pictLoading = ref(false)
|
|
|
|
|
+ const mock_tableData = ref([])
|
|
|
|
|
+ const formRef = ref(null)
|
|
|
|
|
+ const addFormRef = ref(null)
|
|
|
|
|
+ const addDialogVisible = ref(false)
|
|
|
|
|
+ const isEdit = ref(false)
|
|
|
|
|
+ const addLoading = ref(false)
|
|
|
|
|
+ const multipleSelection = ref([])
|
|
|
|
|
+
|
|
|
|
|
+ const search = reactive({
|
|
|
|
|
+ currency: '',
|
|
|
|
|
+ convertCurrency: '',
|
|
|
|
|
+ enableStatus: '',
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ const pagerInfo = reactive({
|
|
|
|
|
+ row: 10,
|
|
|
|
|
+ current: 1,
|
|
|
|
|
+ pageTotal: 0,
|
|
|
|
|
+ rowTotal: 0,
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ const addForm = reactive({
|
|
|
|
|
+ currency: '',
|
|
|
|
|
+ convertCurrency: '',
|
|
|
|
|
+ enableStatus: 0,
|
|
|
|
|
+ exchangeRate: '',
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ // 计算属性
|
|
|
|
|
+ const display = computed(() => {
|
|
|
|
|
+ return JSON.parse(Session.Get('display', true))
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ const addRules = computed(() => ({
|
|
|
|
|
+ currency: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: t('Ucard.BlockchainRate.addP1'),
|
|
|
|
|
+ trigger: 'blur',
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ convertCurrency: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: t('Ucard.BlockchainRate.addP2'),
|
|
|
|
|
+ trigger: 'blur',
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ exchangeRate: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
|
|
+ if (value) {
|
|
|
|
|
+ const test = floatReg.test(value)
|
|
|
|
|
+ if (test) {
|
|
|
|
|
+ return callback()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return callback(new Error(t('global.validator.v13')))
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return callback(new Error(t('Ucard.BlockchainRate.addP4')))
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ trigger: ['change', 'blur'],
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ enableStatus: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: t('Ucard.BlockchainRate.addP3'),
|
|
|
|
|
+ trigger: 'blur',
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ }))
|
|
|
|
|
+
|
|
|
|
|
+ // 监听器
|
|
|
|
|
+ watch(addDialogVisible, (val) => {
|
|
|
|
|
+ if (!val) {
|
|
|
|
|
+ Object.assign(addForm, {
|
|
|
|
|
+ currency: '',
|
|
|
|
|
+ convertCurrency: '',
|
|
|
|
|
+ enableStatus: 0,
|
|
|
|
|
+ exchangeRate: '',
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ // 生命周期
|
|
|
|
|
+ onMounted(() => {
|
|
|
|
|
+ searchFunc()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ // 方法
|
|
|
|
|
+ const keyDown = () => {
|
|
|
|
|
+ console.log(1)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 获取列表数据
|
|
|
|
|
+ const searchFunc = async () => {
|
|
|
|
|
+ pictLoading.value = true
|
|
|
|
|
+ if (!display.value['R-Card-BlockchainRate-Page']?.show) {
|
|
|
|
|
+ ElMessage.warning(t('Msg.NotDisplay'))
|
|
|
|
|
+ pictLoading.value = false
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const res = await Service.getBlockchainRatePage({
|
|
|
|
|
+ ...search,
|
|
|
|
|
+ page: {
|
|
|
|
|
+ current: pagerInfo.current,
|
|
|
|
|
+ row: pagerInfo.row,
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ if (res.code == Code.StatusOK) {
|
|
|
|
|
+ mock_tableData.value = res.data
|
|
|
|
|
+ if (res.page != null) {
|
|
|
|
|
+ pagerInfo.rowTotal = res.page.rowTotal
|
|
|
|
|
+ pagerInfo.pageTotal = res.page.pageTotal
|
|
|
|
|
+ } else {
|
|
|
|
|
+ pagerInfo.rowTotal = 0
|
|
|
|
|
+ }
|
|
|
|
|
+ ElMessage.success(t('Msg.SearchSuccess'))
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(res.msg)
|
|
|
|
|
+ }
|
|
|
|
|
+ pictLoading.value = false
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 选择多项
|
|
|
|
|
+ const handleSelectionChange = (val) => {
|
|
|
|
|
+ multipleSelection.value = val.map((item) => item.id)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 删除
|
|
|
|
|
+ const toDelete = () => {
|
|
|
|
|
+ handleDelete(multipleSelection.value)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 搜索
|
|
|
|
|
+ const toSearch = () => {
|
|
|
|
|
+ pagerInfo.current = 1
|
|
|
|
|
+ searchFunc()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 分页返回数据
|
|
|
|
|
+ const handleSizeChange = (val) => {
|
|
|
|
|
+ pagerInfo.row = val
|
|
|
|
|
+ searchFunc()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const handleCurrentChange = (val) => {
|
|
|
|
|
+ pagerInfo.current = val
|
|
|
|
|
+ searchFunc()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 处理下拉菜单命令
|
|
|
|
|
+ const handleCommand = (command) => {
|
|
|
|
|
+ if (command.type === 'editor') {
|
|
|
|
|
+ Object.assign(addForm, command.row)
|
|
|
|
|
+ isEdit.value = true
|
|
|
|
|
+ addDialogVisible.value = true
|
|
|
|
|
+ } else if (command.type === 'delete') {
|
|
|
|
|
+ handleDelete([command.row.id])
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 打开新增对话框
|
|
|
|
|
+ const openAddDialog = () => {
|
|
|
|
|
+ Object.assign(addForm, {
|
|
|
|
|
+ currency: '',
|
|
|
|
|
+ convertCurrency: '',
|
|
|
|
|
+ enableStatus: 0,
|
|
|
|
|
+ exchangeRate: '',
|
|
|
|
|
+ })
|
|
|
|
|
+ isEdit.value = false
|
|
|
|
|
+ addDialogVisible.value = true
|
|
|
|
|
+
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ // 新增 打开时清空一下
|
|
|
|
|
+ if (addFormRef.value) {
|
|
|
|
|
+ addFormRef.value.clearValidate()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 修改启用状态
|
|
|
|
|
+ const changeEnable = async (row) => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await Service.updateBlockchainRate({
|
|
|
|
|
+ id: row.id,
|
|
|
|
|
+ currency: row.currency,
|
|
|
|
|
+ convertCurrency: row.convertCurrency,
|
|
|
|
|
+ enableStatus: row.enableStatus,
|
|
|
|
|
+ exchangeRate: row.exchangeRate,
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ ElMessage.success(t('card.Info.t27'))
|
|
|
|
|
+ searchFunc()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(res.msg)
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ ElMessage.error(t('Msg.SystemError'))
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 确认新增/编辑
|
|
|
|
|
+ const handleAddConfirm = async () => {
|
|
|
|
|
+ if (!addFormRef.value) return
|
|
|
|
|
+
|
|
|
|
|
+ const valid = await addFormRef.value.validate()
|
|
|
|
|
+ if (!valid) return
|
|
|
|
|
+
|
|
|
|
|
+ addLoading.value = true
|
|
|
|
|
+ try {
|
|
|
|
|
+ const params = { ...addForm }
|
|
|
|
|
+ const res = isEdit.value
|
|
|
|
|
+ ? await Service.updateBlockchainRate(params)
|
|
|
|
|
+ : await Service.addBlockchainRate(params)
|
|
|
|
|
+
|
|
|
|
|
+ if (res.code == Code.StatusOK) {
|
|
|
|
|
+ ElMessage.success(t('Msg.SaveSuccess'))
|
|
|
|
|
+ addDialogVisible.value = false
|
|
|
|
|
+ searchFunc() // 刷新列表
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(res.msg)
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ ElMessage.error(t('Msg.SaveFail'))
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ addLoading.value = false
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 删除
|
|
|
|
|
+ const handleDelete = async (ids) => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ await ElMessageBox.confirm(
|
|
|
|
|
+ t('Ucard.Blockchain.deleteConfirm'),
|
|
|
|
|
+ t('Ucard.Blockchain.deleteTitle'),
|
|
|
|
|
+ {
|
|
|
|
|
+ confirmButtonText: t('Btn.Confirm'),
|
|
|
|
|
+ cancelButtonText: t('Btn.Cancel'),
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ const res = await Service.deleteBlockchainRate({ ids })
|
|
|
|
|
+ if (res.code == Code.StatusOK) {
|
|
|
|
|
+ ElMessage.success(t('Msg.DeleteSuccess'))
|
|
|
|
|
+ searchFunc() // 刷新列表
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(res.msg)
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ if (error !== 'cancel') {
|
|
|
|
|
+ ElMessage.error(t('Msg.DeleteFail'))
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+</script>
|
|
|
|
|
+<style scoped lang="scss">
|
|
|
|
|
+ #card_Blockchain {
|
|
|
|
|
+ .crm_search {
|
|
|
|
|
+ .search_action_btn {
|
|
|
|
|
+ .delete {
|
|
|
|
|
+ background-color: #a1a1a1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .delete.active {
|
|
|
|
|
+ background-color: #368fec;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+</style>
|
|
|
|
|
+<style lang="scss">
|
|
|
|
|
+ #card_Blockchain {
|
|
|
|
|
+ .dialog_header_w {
|
|
|
|
|
+ .crm_search_down {
|
|
|
|
|
+ width: 400px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+</style>
|