|
|
@ -2,7 +2,9 @@ |
|
|
|
import {onMounted, reactive, ref} from 'vue' |
|
|
|
import {ElMessage, ElMessageBox} from 'element-plus' |
|
|
|
import request from '@/util/http' |
|
|
|
|
|
|
|
import {useAdminStore} from "@/store/index.js"; |
|
|
|
import {storeToRefs} from "pinia"; |
|
|
|
import {findMenuById, permissionMapping} from "@/utils/menuTreePermission.js" |
|
|
|
/* |
|
|
|
====================工具方法========================= |
|
|
|
*/ |
|
|
@ -189,26 +191,34 @@ const getEditData = async function (row) { |
|
|
|
console.log('请求失败', error) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const adminStore = useAdminStore(); |
|
|
|
const {menuTree} = storeToRefs(adminStore); |
|
|
|
// 编辑汇率 |
|
|
|
const editRate = async function () { |
|
|
|
// 提交前验证 汇率是否为数字 |
|
|
|
rateEdit.value.num = parseFloat(rateEdit.value.num); |
|
|
|
try { |
|
|
|
console.log('搜索参数', rateEdit.value) |
|
|
|
// 发送POST请求 |
|
|
|
const result = await request({ |
|
|
|
url: '/rate/update', |
|
|
|
data: rateEdit.value |
|
|
|
}) |
|
|
|
// 将响应结果存储到响应式数据中 |
|
|
|
console.log('请求成功', result) |
|
|
|
await getAllRate() |
|
|
|
} catch (error) { |
|
|
|
console.log('请求失败', error) |
|
|
|
if (findMenuById(menuTree.value, permissionMapping.Exchange_Rate_Modification)) { |
|
|
|
|
|
|
|
// 提交前验证 汇率是否为数字 |
|
|
|
rateEdit.value.num = parseFloat(rateEdit.value.num); |
|
|
|
try { |
|
|
|
console.log('搜索参数', rateEdit.value) |
|
|
|
// 发送POST请求 |
|
|
|
const result = await request({ |
|
|
|
url: '/rate/update', |
|
|
|
data: rateEdit.value |
|
|
|
}) |
|
|
|
// 将响应结果存储到响应式数据中 |
|
|
|
console.log('请求成功', result) |
|
|
|
await getAllRate() |
|
|
|
} catch (error) { |
|
|
|
console.log('请求失败', error) |
|
|
|
} |
|
|
|
}else { |
|
|
|
ElMessage.error('没有权限') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 添加前验证 |
|
|
|
const edit = () => { |
|
|
|
editFormRef.value.validate(async (valid) => { |
|
|
|