mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-03 16:06:13 +00:00
[Update] 拆分路由
This commit is contained in:
168
src/components/DialogAction/index.vue
Normal file
168
src/components/DialogAction/index.vue
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<Dialog :title="$tc('Export')" :visible.sync="showExportDialog" center @confirm="handleDialogConfirm('export')" @cancel="handleDialogCancel('export')">
|
||||||
|
<el-form>
|
||||||
|
<el-form-item :label="this.$t('action.ExportRange')" :label-width="'100px'">
|
||||||
|
<el-radio v-model="exportOption" class="export-item" label="1">{{ this.$t('action.ExportAll') }}</el-radio>
|
||||||
|
<el-radio v-model="exportOption" class="export-item" label="2">{{ this.$t('action.ExportOnlySelectedItems') }}</el-radio>
|
||||||
|
<!-- <el-radio v-model="exportOption" class="export-item" label="3">仅导出搜索项</el-radio> -->
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</Dialog>
|
||||||
|
<Dialog :title="importTitle" :visible.sync="showImportDialog" center @confirm="handleDialogConfirm('import')" @cancel="handleDialogCancel('import')">
|
||||||
|
<el-form>
|
||||||
|
<el-form-item :label="importTitle" :label-width="'100px'">
|
||||||
|
<el-radio v-model="importOption" class="export-item" label="1">{{ this.$tc('Import') }}</el-radio>
|
||||||
|
<el-radio v-model="importOption" class="export-item" label="2">{{ this.$tc('Update') }}</el-radio>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div v-if="importOption==='1'" style="margin-bottom:20px;margin-left: 55px;">{{ this.$t('action.DownloadTheImportedTemplateOrUseTheExportedCSVFormat') }} <a style="color: #428bca;" :href="downloadImportTempUrl">{{ this.$t('action.DownloadImportTemplate') }}</a></div>
|
||||||
|
<div v-else style="margin-bottom:20px;margin-left: 55px;">{{ this.$t('action.DownloadTheUpdatedTemplateOrUsTheExportedCSVFormat') }} <a style="color: #428bca;" @click="downloadUpdateTempUrl">{{ this.$t('action.DownloadUpdateTemplate') }}</a></div>
|
||||||
|
|
||||||
|
<div style="margin-left:55px;">
|
||||||
|
<el-upload
|
||||||
|
class="upload-card"
|
||||||
|
action="string"
|
||||||
|
:http-request="upload"
|
||||||
|
list-type="text/csv"
|
||||||
|
:limit="1"
|
||||||
|
>
|
||||||
|
<el-button size="small" type="primary">{{ this.$t('action.Upload') }}</el-button>
|
||||||
|
<div slot="tip" class="el-upload__tip">{{ this.$t('action.OnlyCSVFilesCanBeUploaded') }}</div>
|
||||||
|
</el-upload>
|
||||||
|
</div>
|
||||||
|
</Dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Dialog from '../Dialog'
|
||||||
|
import { createSourceIdCache } from '@/api/common'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'DialogAction',
|
||||||
|
components: {
|
||||||
|
Dialog
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
selectedRows: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
type: String,
|
||||||
|
default: () => ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showExportDialog: false,
|
||||||
|
showImportDialog: false,
|
||||||
|
importOption: '1',
|
||||||
|
exportOption: '1',
|
||||||
|
meta: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
hasSelected() {
|
||||||
|
return this.selectedRows.length > 0
|
||||||
|
},
|
||||||
|
importTitle() {
|
||||||
|
if (this.importOption === '1') {
|
||||||
|
return this.$tc('Import')
|
||||||
|
} else {
|
||||||
|
return this.$tc('Update')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
upLoadUrl() {
|
||||||
|
return this.url
|
||||||
|
},
|
||||||
|
downloadImportTempUrl() {
|
||||||
|
return process.env.VUE_APP_BASE_API + this.url + '?format=csv&template=import&limit=1'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$eventBus.$on('showExportDialog', (row) => {
|
||||||
|
this.showExportDialog = true
|
||||||
|
})
|
||||||
|
this.$eventBus.$on('showImportDialog', (row) => {
|
||||||
|
this.showImportDialog = true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
upload(item) {
|
||||||
|
this.$axios.put(
|
||||||
|
this.upLoadUrl,
|
||||||
|
item.file
|
||||||
|
).then((res) => {
|
||||||
|
console.log('')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
downloadCsv(url) {
|
||||||
|
const a = document.createElement('a')
|
||||||
|
a.href = url
|
||||||
|
a.click()
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
},
|
||||||
|
async handleExport() {
|
||||||
|
let data
|
||||||
|
var resources = []
|
||||||
|
if (this.exportOption === '1') {
|
||||||
|
data = this.$parent.$parent.$refs.dataTable.$refs.dataTable.getData()
|
||||||
|
} else if (this.exportOption === '2') {
|
||||||
|
data = this.selectedRows
|
||||||
|
} else {
|
||||||
|
data = []
|
||||||
|
}
|
||||||
|
for (let index = 0; index < data.length; index++) {
|
||||||
|
resources.push(data[index].id)
|
||||||
|
}
|
||||||
|
const spm = await createSourceIdCache(resources)
|
||||||
|
const url = process.env.VUE_APP_BASE_API + `${this.url}?format=csv&?spm=` + spm.spm
|
||||||
|
return this.downloadCsv(url)
|
||||||
|
},
|
||||||
|
handleImport() {
|
||||||
|
},
|
||||||
|
async downloadUpdateTempUrl() {
|
||||||
|
var resources = []
|
||||||
|
const data = this.$parent.$parent.$refs.dataTable.$refs.dataTable.getData()
|
||||||
|
for (let index = 0; index < data.length; index++) {
|
||||||
|
resources.push(data[index].id)
|
||||||
|
}
|
||||||
|
const spm = await createSourceIdCache(resources)
|
||||||
|
const url = process.env.VUE_APP_BASE_API + `${this.url}?format=csv&template=update&spm=` + spm.spm
|
||||||
|
return this.downloadCsv(url)
|
||||||
|
},
|
||||||
|
async handleDialogConfirm(val) {
|
||||||
|
switch (val) {
|
||||||
|
case 'export':
|
||||||
|
await this.handleExport()
|
||||||
|
this.showExportDialog = false
|
||||||
|
break
|
||||||
|
case 'import':
|
||||||
|
await this.handleImport()
|
||||||
|
this.showImportDialog = false
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleDialogCancel(val) {
|
||||||
|
switch (val) {
|
||||||
|
case 'export':
|
||||||
|
this.showExportDialog = false
|
||||||
|
break
|
||||||
|
case 'import':
|
||||||
|
this.showImportDialog = false
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang='less' scoped>
|
||||||
|
|
||||||
|
</style>
|
@@ -7,13 +7,16 @@
|
|||||||
<div class="table-action-right-side">
|
<div class="table-action-right-side">
|
||||||
<AutoDataSearch v-if="hasSearch" class="right-side-item action-search" :config="searchConfig" :url="tableUrl" @tagSearch="handleTagSearch" />
|
<AutoDataSearch v-if="hasSearch" class="right-side-item action-search" :config="searchConfig" :url="tableUrl" @tagSearch="handleTagSearch" />
|
||||||
<ActionsGroup :is-fa="true" :actions="rightSideActions" class="right-side-actions right-side-item" />
|
<ActionsGroup :is-fa="true" :actions="rightSideActions" class="right-side-actions right-side-item" />
|
||||||
|
<DialogAction :selected-rows="selectedRows" :url="tableUrl" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AutoDataSearch from '@/components/AutoDataSearch'
|
import AutoDataSearch from '@/components/AutoDataSearch'
|
||||||
|
import DialogAction from '@/components/DialogAction'
|
||||||
import ActionsGroup from '@/components/ActionsGroup'
|
import ActionsGroup from '@/components/ActionsGroup'
|
||||||
import { createSourceIdCache } from '@/api/common'
|
import { createSourceIdCache } from '@/api/common'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
@@ -25,6 +28,7 @@ export default {
|
|||||||
name: 'TableAction',
|
name: 'TableAction',
|
||||||
components: {
|
components: {
|
||||||
ActionsGroup,
|
ActionsGroup,
|
||||||
|
DialogAction,
|
||||||
AutoDataSearch
|
AutoDataSearch
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@@ -3,48 +3,14 @@
|
|||||||
<TableAction :table-url="tableConfig.url" :search-table="search" v-bind="headerActions" :selected-rows="selectedRows" :reload-table="reloadTable" />
|
<TableAction :table-url="tableConfig.url" :search-table="search" v-bind="headerActions" :selected-rows="selectedRows" :reload-table="reloadTable" />
|
||||||
<IBox class="table-content">
|
<IBox class="table-content">
|
||||||
<AutoDataTable :key="tableConfig.url" ref="dataTable" :config="tableConfig" @selection-change="handleSelectionChange" />
|
<AutoDataTable :key="tableConfig.url" ref="dataTable" :config="tableConfig" @selection-change="handleSelectionChange" />
|
||||||
<Dialog :title="$tc('Export')" :visible.sync="showExportDialog" center @confirm="handleDialogConfirm('export')" @cancel="handleDialogCancel('export')">
|
|
||||||
<el-form>
|
|
||||||
<el-form-item :label="this.$t('action.ExportRange')" :label-width="'100px'">
|
|
||||||
<el-radio v-model="exportOption" class="export-item" label="1">{{ this.$t('action.ExportAll') }}</el-radio>
|
|
||||||
<el-radio v-model="exportOption" class="export-item" label="2">{{ this.$t('action.ExportOnlySelectedItems') }}</el-radio>
|
|
||||||
<!-- <el-radio v-model="exportOption" class="export-item" label="3">仅导出搜索项</el-radio> -->
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</Dialog>
|
|
||||||
<Dialog :title="importTitle" :visible.sync="showImportDialog" center @confirm="handleDialogConfirm('import')" @cancel="handleDialogCancel('import')">
|
|
||||||
<el-form>
|
|
||||||
<el-form-item :label="importTitle" :label-width="'100px'">
|
|
||||||
<el-radio v-model="importOption" class="export-item" label="1">{{ this.$tc('Import') }}</el-radio>
|
|
||||||
<el-radio v-model="importOption" class="export-item" label="2">{{ this.$tc('Update') }}</el-radio>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div v-if="importOption==='1'" style="margin-bottom:20px;margin-left: 55px;">{{ this.$t('action.DownloadTheImportedTemplateOrUseTheExportedCSVFormat') }} <a style="color: #428bca;" :href="downloadImportTempUrl">{{ this.$t('action.DownloadImportTemplate') }}</a></div>
|
|
||||||
<div v-else style="margin-bottom:20px;margin-left: 55px;">{{ this.$t('action.DownloadTheUpdatedTemplateOrUsTheExportedCSVFormat') }} <a style="color: #428bca;" @click="downloadUpdateTempUrl">{{ this.$t('action.DownloadUpdateTemplate') }}</a></div>
|
|
||||||
|
|
||||||
<div style="margin-left:55px;">
|
|
||||||
<el-upload
|
|
||||||
class="upload-card"
|
|
||||||
action="string"
|
|
||||||
:http-request="upload"
|
|
||||||
list-type="text/csv"
|
|
||||||
:limit="1"
|
|
||||||
>
|
|
||||||
<el-button size="small" type="primary">{{ this.$t('action.Upload') }}</el-button>
|
|
||||||
<div slot="tip" class="el-upload__tip">{{ this.$t('action.OnlyCSVFilesCanBeUploaded') }}</div>
|
|
||||||
</el-upload>
|
|
||||||
</div>
|
|
||||||
</Dialog>
|
|
||||||
</IBox>
|
</IBox>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AutoDataTable from '../AutoDataTable'
|
import AutoDataTable from '../AutoDataTable'
|
||||||
import Dialog from '../Dialog'
|
|
||||||
import IBox from '../IBox'
|
import IBox from '../IBox'
|
||||||
import TableAction from './TableAction'
|
import TableAction from './TableAction'
|
||||||
import { createSourceIdCache } from '@/api/common'
|
|
||||||
import Emitter from '@/mixins/emitter'
|
import Emitter from '@/mixins/emitter'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -52,7 +18,6 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
AutoDataTable,
|
AutoDataTable,
|
||||||
TableAction,
|
TableAction,
|
||||||
Dialog,
|
|
||||||
IBox
|
IBox
|
||||||
},
|
},
|
||||||
mixins: [Emitter],
|
mixins: [Emitter],
|
||||||
@@ -71,51 +36,10 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedRows: [],
|
selectedRows: []
|
||||||
showExportDialog: false,
|
|
||||||
showImportDialog: false,
|
|
||||||
importOption: '1',
|
|
||||||
exportOption: '1',
|
|
||||||
meta: {}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
hasSelected() {
|
|
||||||
return this.selectedRows.length > 0
|
|
||||||
},
|
|
||||||
upLoadUrl() {
|
|
||||||
return this.tableConfig.url
|
|
||||||
},
|
|
||||||
importTitle() {
|
|
||||||
if (this.importOption === '1') { return this.$tc('Import') } else { return this.$tc('Update') }
|
|
||||||
},
|
|
||||||
downloadImportTempUrl() {
|
|
||||||
return process.env.VUE_APP_BASE_API + this.tableConfig.url + '?format=csv&template=import&limit=1'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$eventBus.$on('showExportDialog', (row) => {
|
|
||||||
this.showExportDialog = true
|
|
||||||
})
|
|
||||||
this.$eventBus.$on('showImportDialog', (row) => {
|
|
||||||
this.showImportDialog = true
|
|
||||||
})
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
upload(item) {
|
|
||||||
this.$axios.put(
|
|
||||||
this.upLoadUrl,
|
|
||||||
item.file
|
|
||||||
).then((res) => {
|
|
||||||
console.log('')
|
|
||||||
})
|
|
||||||
},
|
|
||||||
downloadCsv(url) {
|
|
||||||
const a = document.createElement('a')
|
|
||||||
a.href = url
|
|
||||||
a.click()
|
|
||||||
window.URL.revokeObjectURL(url)
|
|
||||||
},
|
|
||||||
handleSelectionChange(val) {
|
handleSelectionChange(val) {
|
||||||
this.selectedRows = val
|
this.selectedRows = val
|
||||||
var obj = {}
|
var obj = {}
|
||||||
@@ -128,61 +52,6 @@ export default {
|
|||||||
},
|
},
|
||||||
search(attrs) {
|
search(attrs) {
|
||||||
return this.$refs.dataTable.$refs.dataTable.search(attrs)
|
return this.$refs.dataTable.$refs.dataTable.search(attrs)
|
||||||
},
|
|
||||||
async handleExport() {
|
|
||||||
let data
|
|
||||||
var resources = []
|
|
||||||
if (this.exportOption === '1') {
|
|
||||||
data = this.$refs.dataTable.$refs.dataTable.getData()
|
|
||||||
} else if (this.exportOption === '2') {
|
|
||||||
data = this.selectedRows
|
|
||||||
} else {
|
|
||||||
data = []
|
|
||||||
}
|
|
||||||
for (let index = 0; index < data.length; index++) {
|
|
||||||
resources.push(data[index].id)
|
|
||||||
}
|
|
||||||
const spm = await createSourceIdCache(resources)
|
|
||||||
const url = process.env.VUE_APP_BASE_API + `${this.tableConfig.url}?format=csv&?spm=` + spm.spm
|
|
||||||
return this.downloadCsv(url)
|
|
||||||
},
|
|
||||||
handleImport() {
|
|
||||||
},
|
|
||||||
async downloadUpdateTempUrl() {
|
|
||||||
var resources = []
|
|
||||||
const data = this.$refs.dataTable.$refs.dataTable.getData()
|
|
||||||
for (let index = 0; index < data.length; index++) {
|
|
||||||
resources.push(data[index].id)
|
|
||||||
}
|
|
||||||
const spm = await createSourceIdCache(resources)
|
|
||||||
const url = process.env.VUE_APP_BASE_API + `${this.tableConfig.url}?format=csv&template=update&spm=` + spm.spm
|
|
||||||
return this.downloadCsv(url)
|
|
||||||
},
|
|
||||||
async handleDialogConfirm(val) {
|
|
||||||
switch (val) {
|
|
||||||
case 'export':
|
|
||||||
await this.handleExport()
|
|
||||||
this.showExportDialog = false
|
|
||||||
break
|
|
||||||
case 'import':
|
|
||||||
await this.handleImport()
|
|
||||||
this.showImportDialog = false
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleDialogCancel(val) {
|
|
||||||
switch (val) {
|
|
||||||
case 'export':
|
|
||||||
this.showExportDialog = false
|
|
||||||
break
|
|
||||||
case 'import':
|
|
||||||
this.showImportDialog = false
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -76,7 +76,10 @@ const cn = {
|
|||||||
'Active selected': '激活所选',
|
'Active selected': '激活所选',
|
||||||
'rows': '行',
|
'rows': '行',
|
||||||
'Basic Info': '基本信息',
|
'Basic Info': '基本信息',
|
||||||
|
'Command filter': '命令过滤器',
|
||||||
'Add': '添加',
|
'Add': '添加',
|
||||||
|
'Auth': '认证',
|
||||||
|
'Others': '其他',
|
||||||
'Members': '成员'
|
'Members': '成员'
|
||||||
},
|
},
|
||||||
route: {
|
route: {
|
||||||
|
@@ -32,6 +32,7 @@ import SessionsRoute from '@/views/sessions'
|
|||||||
import OpsRoutes from '@/views/jobcenter'
|
import OpsRoutes from '@/views/jobcenter'
|
||||||
import TicketsRoutes from '@/views/tickets'
|
import TicketsRoutes from '@/views/tickets'
|
||||||
import AuditsRoutes from '@/views/audits'
|
import AuditsRoutes from '@/views/audits'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constantRoutes
|
* constantRoutes
|
||||||
* a base page that does not have permission requirements
|
* a base page that does not have permission requirements
|
||||||
|
@@ -1,29 +1,20 @@
|
|||||||
import Layout from '@/layout/index'
|
export default [
|
||||||
|
{
|
||||||
export default {
|
path: 'remote-apps',
|
||||||
path: '/applications/',
|
name: 'RemoteAppList',
|
||||||
component: Layout,
|
component: () => import('@/views/applications/RemoteAppList'),
|
||||||
redirect: '/applications/remote-apps/',
|
meta: { title: 'RemoteApp' }
|
||||||
name: 'applications',
|
},
|
||||||
meta: { title: 'Applications', icon: 'th' },
|
{
|
||||||
children: [
|
path: 'remote-apps/:id',
|
||||||
{
|
name: 'RemoteAppDetail',
|
||||||
path: 'remote-apps',
|
component: () => import('@/views/applications/RemoteAppList'),
|
||||||
name: 'RemoteAppList',
|
meta: { title: 'RemoteApp' }
|
||||||
component: () => import('@/views/applications/RemoteAppList'),
|
},
|
||||||
meta: { title: 'RemoteApp' }
|
{
|
||||||
},
|
path: 'database-apps',
|
||||||
{
|
name: 'DatabaseAppList',
|
||||||
path: 'remote-apps/:id',
|
component: () => import('@/views/applications/DatabaseAppList'),
|
||||||
name: 'RemoteAppDetail',
|
meta: { title: 'DatabaseApp' }
|
||||||
component: () => import('@/views/applications/RemoteAppList'),
|
}
|
||||||
meta: { title: 'RemoteApp' }
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'database-apps',
|
|
||||||
name: 'DatabaseAppList',
|
|
||||||
component: () => import('@/views/applications/DatabaseAppList'),
|
|
||||||
meta: { title: 'DatabaseApp' }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
@@ -16,10 +16,27 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
fields: [
|
fields: [
|
||||||
[this.$t('perms.' + 'Basic'), ['name', 'username', 'password', 'private_key', 'comment']]
|
['', ['name', 'username', 'password', 'private_key', 'comment']]
|
||||||
],
|
],
|
||||||
fieldsMeta: {
|
fieldsMeta: {
|
||||||
|
name: {
|
||||||
|
el: {
|
||||||
|
placeholder: this.$t('名称')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
username: {
|
||||||
|
el: {
|
||||||
|
placeholder: this.$t('用户名')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
password: {
|
||||||
|
helpText: this.$t('密码或密钥密码')
|
||||||
|
},
|
||||||
private_key: {
|
private_key: {
|
||||||
|
type: 'upload',
|
||||||
|
el: {
|
||||||
|
url: 'http://baiddu.com'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url: '/api/v1/assets/admin-users/'
|
url: '/api/v1/assets/admin-users/'
|
||||||
|
@@ -52,9 +52,10 @@ export default {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
updateRoute: 'AdminUserUpdate',
|
||||||
headerActions: {
|
headerActions: {
|
||||||
hasBulkDelete: false,
|
hasBulkDelete: false,
|
||||||
createRoute: 'AdminUserCreateUpdate'
|
createRoute: 'AdminUserCreate'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -49,6 +49,11 @@ export default {
|
|||||||
},
|
},
|
||||||
headerActions: {
|
headerActions: {
|
||||||
hasBulkDelete: false,
|
hasBulkDelete: false,
|
||||||
|
hasRightActions: false,
|
||||||
|
hasExport: false,
|
||||||
|
hasImport: false,
|
||||||
|
hasRefresh: true,
|
||||||
|
hasSearch: true,
|
||||||
createRoute: 'LabelCreate'
|
createRoute: 'LabelCreate'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
112
src/views/assets/SystemUser/SystemUserCreateUpdate.vue
Normal file
112
src/views/assets/SystemUser/SystemUserCreateUpdate.vue
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
<template>
|
||||||
|
<GenericCreateUpdatePage :fields="fields" :initial="initial" :fields-meta="fieldsMeta" :url="url" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage'
|
||||||
|
import select2 from '@/components/Select2'
|
||||||
|
export default {
|
||||||
|
name: 'SystemUserCreateUpdate',
|
||||||
|
components: { GenericCreateUpdatePage },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
initial: {
|
||||||
|
login_mode: 'auto',
|
||||||
|
priority: '20',
|
||||||
|
protocol: 'ssh',
|
||||||
|
username_same_with_user: false,
|
||||||
|
auto_generate_key: true,
|
||||||
|
auto_push: true,
|
||||||
|
sftp_root: 'tmp',
|
||||||
|
sudo: '/bin/whoami',
|
||||||
|
shell: '/bin/bash'
|
||||||
|
|
||||||
|
},
|
||||||
|
fields: [
|
||||||
|
[this.$tc('Basic Info'), ['name', 'login_mode', 'username', 'username_same_with_user', 'priority', 'protocol']],
|
||||||
|
[this.$tc('Auth'), ['auto_generate_key', 'password', 'auto_push']],
|
||||||
|
[this.$tc('Command filter'), ['cmd_filters']],
|
||||||
|
[this.$tc('Others'), ['sftp_root', 'sudo', 'shell', 'comment']]
|
||||||
|
],
|
||||||
|
fieldsMeta: {
|
||||||
|
login_mode: {
|
||||||
|
helpText: '如果选择手动登录模式,用户名和密码可以不填写'
|
||||||
|
},
|
||||||
|
username: {
|
||||||
|
el: {
|
||||||
|
disabled: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
username_same_with_user: {
|
||||||
|
type: 'switch',
|
||||||
|
helpText: '用户名是动态的,登录资产时使用当前用户的用户名登录',
|
||||||
|
hidden: (form) => {
|
||||||
|
this.fieldsMeta.username.el.disabled = form.username_same_with_user
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
auto_generate_key: {
|
||||||
|
type: 'switch',
|
||||||
|
hidden: form => {
|
||||||
|
this.$router.params || form.login_mode !== 'auto'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
protocol: {
|
||||||
|
rules: [
|
||||||
|
{ required: true }
|
||||||
|
],
|
||||||
|
el: {
|
||||||
|
style: 'width:100%'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cmd_filters: {
|
||||||
|
component: select2,
|
||||||
|
el: {
|
||||||
|
placeholder: '命令过滤器'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
priority: {
|
||||||
|
rules: [
|
||||||
|
{ required: true }
|
||||||
|
],
|
||||||
|
helpText: '1-100, 1最低优先级,100最高优先级。授权多个用户时,高优先级的系统用户将会作为默认登录用户'
|
||||||
|
},
|
||||||
|
auto_push: {
|
||||||
|
type: 'switch',
|
||||||
|
hidden: form => form.login_mode !== 'auto'
|
||||||
|
},
|
||||||
|
sftp_root: {
|
||||||
|
rules: [
|
||||||
|
{ required: true }
|
||||||
|
],
|
||||||
|
helpText: 'SFTP的起始路径,tmp目录, 用户home目录或者自定义'
|
||||||
|
},
|
||||||
|
sudo: {
|
||||||
|
rules: [
|
||||||
|
{ required: true }
|
||||||
|
],
|
||||||
|
helpText: '使用逗号分隔多个命令,如: /bin/whoami,/sbin/ifconfig'
|
||||||
|
},
|
||||||
|
password: {
|
||||||
|
helpText: '密码或密钥密码',
|
||||||
|
hidden: form => form.auto_generate_key === true || form.login_mode !== 'auto'
|
||||||
|
},
|
||||||
|
shell: {
|
||||||
|
rules: [
|
||||||
|
{ required: true }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
url: '/api/v1/assets/system-users/',
|
||||||
|
authHiden: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang='less' scoped>
|
||||||
|
|
||||||
|
</style>
|
@@ -53,6 +53,7 @@ export default {
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
formatter: ActionsFormatter,
|
formatter: ActionsFormatter,
|
||||||
width: '200px',
|
width: '200px',
|
||||||
|
updateRoute: 'SystemUserUpdate',
|
||||||
actions: {
|
actions: {
|
||||||
performDelete: ({ row, col }) => {
|
performDelete: ({ row, col }) => {
|
||||||
const id = row.id
|
const id = row.id
|
@@ -1,134 +1,148 @@
|
|||||||
export default {
|
export default [
|
||||||
path: '/assets',
|
{
|
||||||
redirect: '/assets/assets/',
|
path: 'assets',
|
||||||
name: 'assets',
|
name: 'AssetList',
|
||||||
meta: { title: 'Assets', icon: 'inbox' },
|
component: () => import('@/views/assets/AssetList.vue'),
|
||||||
children: [
|
meta: { title: 'AssetList' }
|
||||||
{
|
},
|
||||||
path: 'assets',
|
{
|
||||||
name: 'AssetList',
|
path: 'domains',
|
||||||
component: () => import('@/views/assets/AssetList.vue'),
|
name: 'DomainList',
|
||||||
meta: { title: 'AssetList' }
|
component: () => import('@/views/assets/Domain/DomainList.vue'),
|
||||||
},
|
meta: { title: 'DomainList' }
|
||||||
{
|
},
|
||||||
path: 'domains',
|
{
|
||||||
name: 'DomainList',
|
path: 'domains/create',
|
||||||
component: () => import('@/views/assets/Domain/DomainList.vue'),
|
name: 'DomainCreate',
|
||||||
meta: { title: 'DomainList' }
|
component: () => import('@/views/assets/Domain/DomainCreateUpdate.vue'),
|
||||||
},
|
meta: { title: 'DomainList' },
|
||||||
{
|
hidden: true
|
||||||
path: 'domains/create',
|
},
|
||||||
name: 'DomainCreate',
|
{
|
||||||
component: () => import('@/views/assets/Domain/DomainCreateUpdate.vue'),
|
path: 'domains/:id/gateway',
|
||||||
meta: { title: 'DomainList' },
|
name: 'GatewayList',
|
||||||
hidden: true
|
hidden: true,
|
||||||
},
|
component: () => import('@/views/assets/GatewayList'),
|
||||||
{
|
meta: { title: 'GatewayList' }
|
||||||
path: 'domains/:id/gateway',
|
},
|
||||||
name: 'GatewayList',
|
{
|
||||||
hidden: true,
|
path: 'admin-users',
|
||||||
component: () => import('@/views/assets/GatewayList'),
|
name: 'AdminUserList',
|
||||||
meta: { title: 'GatewayList' }
|
component: () => import('@/views/assets/AdminUser/AdminUserList'),
|
||||||
},
|
meta: { title: 'AdminUserList' }
|
||||||
{
|
},
|
||||||
path: 'admin-users',
|
{
|
||||||
name: 'AdminUserList',
|
path: 'admin-users/create',
|
||||||
component: () => import('@/views/assets/AdminUser/AdminUserList'),
|
component: () => import('@/views/assets/AdminUser/AdminUserCreateUpdate.vue'), // Parent router-view
|
||||||
meta: { title: 'AdminUserList' }
|
name: 'AdminUserCreate',
|
||||||
},
|
meta: { title: 'AdminUserCreate' },
|
||||||
{
|
hidden: true
|
||||||
path: 'admin-users/create',
|
},
|
||||||
component: () => import('@/views/assets/AdminUser/AdminUserCreateUpdate.vue'), // Parent router-view
|
{
|
||||||
name: 'AdminUserCreateUpdate',
|
path: 'admin-users/update/:id',
|
||||||
meta: { title: 'AdminUserCreate' },
|
component: () => import('@/views/assets/AdminUser/AdminUserCreateUpdate.vue'), // Parent router-view
|
||||||
hidden: true
|
name: 'AdminUserUpdate',
|
||||||
},
|
meta: { title: 'AdminUserUpdate' },
|
||||||
{
|
hidden: true
|
||||||
path: 'platform/update/:id',
|
},
|
||||||
component: () => import('@/views/assets/Platform/PlatformCreateUpdate.vue'), // Parent router-view
|
{
|
||||||
name: 'PlatformUpdate',
|
path: 'platform/update/:id',
|
||||||
meta: { title: 'PlatformUpdate' },
|
component: () => import('@/views/assets/Platform/PlatformCreateUpdate.vue'), // Parent router-view
|
||||||
hidden: true
|
name: 'PlatformUpdate',
|
||||||
},
|
meta: { title: 'PlatformUpdate' },
|
||||||
{
|
hidden: true
|
||||||
path: 'platform/detail/:id',
|
},
|
||||||
component: () => import('@/views/assets/Platform/PlatformDetail.vue'), // Parent router-view
|
{
|
||||||
name: 'PlatformDetail',
|
path: 'platform/detail/:id',
|
||||||
meta: { title: 'PlatformDetail' },
|
component: () => import('@/views/assets/Platform/PlatformDetail.vue'), // Parent router-view
|
||||||
hidden: true
|
name: 'PlatformDetail',
|
||||||
},
|
meta: { title: 'PlatformDetail' },
|
||||||
{
|
hidden: true
|
||||||
path: 'platform/create',
|
},
|
||||||
component: () => import('@/views/assets/Platform/PlatformCreateUpdate.vue'), // Parent router-view
|
{
|
||||||
name: 'PlatformCreate',
|
path: 'platform/create',
|
||||||
meta: { title: 'PlatformCreate' },
|
component: () => import('@/views/assets/Platform/PlatformCreateUpdate.vue'), // Parent router-view
|
||||||
hidden: true
|
name: 'PlatformCreate',
|
||||||
},
|
meta: { title: 'PlatformCreate' },
|
||||||
{
|
hidden: true
|
||||||
path: 'cmd-filters/update/:id',
|
},
|
||||||
component: () => import('@/views/assets/CommandFilter/CommandFilterCreateUpdate.vue'), // Parent router-view
|
{
|
||||||
name: 'CommandFilterUpdate',
|
path: 'cmd-filters/update/:id',
|
||||||
meta: { title: 'CommandFilterUpdate' },
|
component: () => import('@/views/assets/CommandFilter/CommandFilterCreateUpdate.vue'), // Parent router-view
|
||||||
hidden: true
|
name: 'CommandFilterUpdate',
|
||||||
},
|
meta: { title: 'CommandFilterUpdate' },
|
||||||
{
|
hidden: true
|
||||||
path: 'cmd-filters/create',
|
},
|
||||||
component: () => import('@/views/assets/CommandFilter/CommandFilterCreateUpdate.vue'), // Parent router-view
|
{
|
||||||
name: 'CommandFilterCreate',
|
path: 'cmd-filters/create',
|
||||||
meta: { title: 'CommandFilterCreate' },
|
component: () => import('@/views/assets/CommandFilter/CommandFilterCreateUpdate.vue'), // Parent router-view
|
||||||
hidden: true
|
name: 'CommandFilterCreate',
|
||||||
},
|
meta: { title: 'CommandFilterCreate' },
|
||||||
{
|
hidden: true
|
||||||
path: 'cmd-filters/:id',
|
},
|
||||||
component: () => import('@/views/assets/CommandFilter/CommandFilterDetail.vue'), // Parent router-view
|
{
|
||||||
name: 'CommandFilterDetail',
|
path: 'cmd-filters/:id',
|
||||||
meta: { title: 'CommandFilterDetail' },
|
component: () => import('@/views/assets/CommandFilter/CommandFilterDetail.vue'), // Parent router-view
|
||||||
hidden: true
|
name: 'CommandFilterDetail',
|
||||||
},
|
meta: { title: 'CommandFilterDetail' },
|
||||||
{
|
hidden: true
|
||||||
path: 'admin-users/:id',
|
},
|
||||||
component: () => import('@/views/assets/AdminUser/AdminUserDetail.vue'), // Parent router-view
|
{
|
||||||
name: 'AdminUserDetail',
|
path: 'admin-users/:id',
|
||||||
meta: { title: 'AdminUserDetail' },
|
component: () => import('@/views/assets/AdminUser/AdminUserDetail.vue'), // Parent router-view
|
||||||
hidden: true
|
name: 'AdminUserDetail',
|
||||||
},
|
meta: { title: 'AdminUserDetail' },
|
||||||
|
hidden: true
|
||||||
{
|
},
|
||||||
path: 'system-users',
|
{
|
||||||
name: 'SystemUserList',
|
path: 'system-users/create',
|
||||||
component: () => import('@/views/assets/SystemUserList.vue'),
|
name: 'SystemUserCreate',
|
||||||
meta: { title: 'SystemUserList' }
|
component: () => import('@/views/assets/SystemUser/SystemUserCreateUpdate.vue'),
|
||||||
},
|
meta: { title: 'SystemUserCreate' },
|
||||||
{
|
hidden: true
|
||||||
path: 'labels/create',
|
},
|
||||||
name: 'LabelCreate',
|
{
|
||||||
component: () => import('@/views/assets/Label/LabelCreateUpdate.vue'),
|
path: 'system-users/update/:id',
|
||||||
meta: { title: 'LabelCreate' },
|
name: 'SystemUserUpdate',
|
||||||
hidden: true
|
component: () => import('@/views/assets/SystemUser/SystemUserCreateUpdate.vue'),
|
||||||
},
|
meta: { title: 'SystemUserUpdate' },
|
||||||
{
|
hidden: true
|
||||||
path: 'labels/update/:id',
|
},
|
||||||
name: 'LabelUpdate',
|
{
|
||||||
component: () => import('@/views/assets/Label/LabelCreateUpdate.vue'),
|
path: 'system-users',
|
||||||
meta: { title: 'LabelUpdate' }, hidden: true
|
name: 'SystemUserList',
|
||||||
},
|
component: () => import('@/views/assets/SystemUser/SystemUserList.vue'),
|
||||||
{
|
meta: { title: 'SystemUserList' }
|
||||||
path: 'labels',
|
},
|
||||||
name: 'LabelList',
|
{
|
||||||
component: () => import('@/views/assets/Label/LabelList.vue'),
|
path: 'labels/create',
|
||||||
meta: { title: 'LabelList' }
|
name: 'LabelCreate',
|
||||||
},
|
component: () => import('@/views/assets/Label/LabelCreateUpdate.vue'),
|
||||||
{
|
meta: { title: 'LabelCreate' },
|
||||||
path: 'cmd-filters',
|
hidden: true
|
||||||
name: 'CommandFilterList',
|
},
|
||||||
component: () => import('@/views/assets/CommandFilter/CommandFilterList.vue'),
|
{
|
||||||
meta: { title: 'CommandFilterList' }
|
path: 'labels/update/:id',
|
||||||
},
|
name: 'LabelUpdate',
|
||||||
{
|
component: () => import('@/views/assets/Label/LabelCreateUpdate.vue'),
|
||||||
path: 'platforms',
|
meta: { title: 'LabelUpdate' }, hidden: true
|
||||||
name: 'PlatformList',
|
},
|
||||||
component: () => import('@/views/assets/Platform/PlatformList'),
|
{
|
||||||
meta: { title: 'PlatformList' }
|
path: 'labels',
|
||||||
}
|
name: 'LabelList',
|
||||||
]
|
component: () => import('@/views/assets/Label/LabelList.vue'),
|
||||||
}
|
meta: { title: 'LabelList' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'cmd-filters',
|
||||||
|
name: 'CommandFilterList',
|
||||||
|
component: () => import('@/views/assets/CommandFilter/CommandFilterList.vue'),
|
||||||
|
meta: { title: 'CommandFilterList' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'platforms',
|
||||||
|
name: 'PlatformList',
|
||||||
|
component: () => import('@/views/assets/Platform/PlatformList'),
|
||||||
|
meta: { title: 'PlatformList' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
Reference in New Issue
Block a user