123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <template>
- <el-row style="text-align: center">
- <el-col :span="4">
- <el-button type="primary" @click="toMethod('initES')">{{ $t('pages.systemFunc.initES') }}</el-button>
- </el-col>
- <el-col :span="4">
- <el-button type="primary" @click="toMethod('cid')">{{ $t('pages.systemFunc.cid') }}</el-button>
- </el-col>
- <el-col :span="4">
- <el-button type="primary" @click="toMethod('ism')">{{ $t('pages.systemFunc.ism') }}</el-button>
- </el-col>
- <el-col :span="4">
- <el-button type="primary" @click="toMethod('ium')">{{ $t('pages.systemFunc.ium') }}</el-button>
- </el-col>
- <el-col :span="4">
- <el-button type="primary" @click="toMethod('ir')">{{ $t('pages.systemFunc.ir') }}</el-button>
- </el-col>
- <el-col :span="4">
- <el-button type="primary" @click="toMethod('irm')">{{ $t('pages.systemFunc.irm') }}</el-button>
- </el-col>
- <el-col :span="4">
- <el-button type="primary" @click="toMethod('dbBackUp')">数据库备份</el-button>
- </el-col>
- <el-col :span="4">
- <el-button type="primary" @click="toMethod('dbRestore')">数据库还原</el-button>
- </el-col>
- </el-row>
- </template>
- <script setup>
- import { ElMessage, ElMessageBox } from 'element-plus'
- import { SystemFuncStore } from '@/store/api/systemFunc'
- const $checkRes = inject('$checkRes')
- const store = SystemFuncStore()
- const toMethod = async (method) => {
- let res
- switch (method) {
- case 'initES':
- res = await store.initES()
- $checkRes(res, true, res.errmsg)
- break
- case 'cid':
- res = await store.correctImportData()
- $checkRes(res, true, res.errmsg)
- break
- case 'ism':
- res = await store.initSystemMenus()
- $checkRes(res, true, res.errmsg)
- break
- case 'ium':
- res = await store.initUserMenus()
- $checkRes(res, true, res.errmsg)
- break
- case 'ir':
- res = await store.initRoleData()
- $checkRes(res, true, res.errmsg)
- break
- case 'irm':
- res = await store.initRoleMenus()
- $checkRes(res, true, res.errmsg)
- break
- case 'dbBackUp':
- res = await store.dbBackUp()
- $checkRes(res, true, res.errmsg)
- break
- case 'dbRestore':
- // 需要输入还原文件夹
- ElMessageBox.prompt('请输入json文件所在目录地址,默认地址为备份地址', '数据库还原', {
- confirmButtonText: '确认',
- cancelButtonText: '取消'
- })
- .then(async ({ value }) => {
- res = await store.dbRestore(value)
- console.log(res)
- $checkRes(res, true, res.errmsg)
- })
- .catch(() => {})
- //
- break
- default:
- break
- }
-
- }
- </script>
- <style scoped>
- .el-col {
- margin-top: 10px;
- }
- </style>
|