millionfor
6 years ago
committed by
GitHub
48 changed files with 1085 additions and 693 deletions
@ -1,87 +0,0 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
const fs = require('fs'); |
||||
const path = require('path') |
||||
const glob = require('globby') |
||||
|
||||
function moduleName (modules) { |
||||
let filename = path.basename(modules) |
||||
let parts = filename.split('.') |
||||
parts.pop() |
||||
filename = parts.join('.') |
||||
return path.dirname(modules) + '/' + filename |
||||
} |
||||
|
||||
const jsEntry = () => { |
||||
const obj = {} |
||||
const files = glob.sync([ |
||||
'./src/js/conf/login/**/*.vue', |
||||
'./src/js/conf/login/**/*.js', |
||||
'./src/js/conf/home/**/**/**/**/**/**/**/**/*.vue', |
||||
'./src/js/conf/home/**/**/**/**/**/**/**/**/*.js', |
||||
'./src/js/module/**/**/**/**/**/*.vue', |
||||
'./src/js/module/**/**/**/**/**/*.js' |
||||
]) |
||||
files.forEach(val => { |
||||
let parts = val.split(/[\\/]/) |
||||
parts.shift() |
||||
parts.shift() |
||||
let modules = parts.join('/') |
||||
let entry = moduleName(modules) |
||||
obj[entry] = val |
||||
}) |
||||
return obj |
||||
} |
||||
/* eslint-disable */ |
||||
let reg = /\$t\([\w,""''“”~\-\s.?!,。:;《》、\+\/<>()?!\u4e00-\u9fa5]*\)/g |
||||
let map = {} |
||||
let entryPathList = '' |
||||
let matchPathList = '' |
||||
let jsEntryObj = jsEntry() |
||||
|
||||
for (let i in jsEntryObj) { |
||||
entryPathList += jsEntryObj[i] + '\n' |
||||
let data = fs.readFileSync(path.join(jsEntryObj[i]), 'utf-8') |
||||
if (reg.test(data)) { |
||||
matchPathList += jsEntryObj[i] + '\n' |
||||
let str = data.replace(/[""'']/g, '') |
||||
str.replace(reg, function () { |
||||
if (arguments && arguments[0]) { |
||||
let key = arguments[0] |
||||
key = key.substring(3, key.length - 1) |
||||
map[key] = key |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
let outPath = path.join(__dirname, '../src/js/module/i18n/locale/zh_CN.js') |
||||
fs.unlink(outPath, (err) => { |
||||
if (err) { |
||||
console.error('删除zh_CN.js文件出错 -- \n', err) |
||||
} else { |
||||
console.log('删除zh_CN.js文件成功') |
||||
} |
||||
}) |
||||
fs.writeFile(outPath, 'export default ' + JSON.stringify(map, null, 2), function (err) { |
||||
if (err) { |
||||
console.error('写入zh_CN.js文件出错 -- \n', err) |
||||
} else { |
||||
console.log('写入zh_CN.js文件成功') |
||||
} |
||||
}) |
@ -0,0 +1,40 @@
|
||||
<template> |
||||
<div class="index-model"> |
||||
index |
||||
</div> |
||||
</template> |
||||
<script> |
||||
export default { |
||||
name: 'monitor-index', |
||||
data () { |
||||
return {} |
||||
}, |
||||
props: {}, |
||||
methods: {}, |
||||
watch: {}, |
||||
beforeCreate () { |
||||
}, |
||||
created () { |
||||
}, |
||||
beforeMount () { |
||||
}, |
||||
mounted () { |
||||
}, |
||||
beforeUpdate () { |
||||
}, |
||||
updated () { |
||||
}, |
||||
beforeDestroy () { |
||||
}, |
||||
destroyed () { |
||||
}, |
||||
computed: {}, |
||||
components: {} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" rel="stylesheet/scss"> |
||||
.index-model { |
||||
|
||||
} |
||||
</style> |
@ -1,8 +1,13 @@
|
||||
<template> |
||||
<router-view></router-view> |
||||
<div class="main-layout-box"> |
||||
<m-secondary-menu :type="'resource'"></m-secondary-menu> |
||||
<router-view></router-view> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' |
||||
export default { |
||||
name: 'resource-index' |
||||
name: 'resource-index', |
||||
components: { mSecondaryMenu } |
||||
} |
||||
</script> |
||||
|
@ -1,8 +1,13 @@
|
||||
<template> |
||||
<router-view></router-view> |
||||
<div class="main-layout-box"> |
||||
<m-secondary-menu :type="'security'"></m-secondary-menu> |
||||
<router-view></router-view> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' |
||||
export default { |
||||
name: 'security-index' |
||||
name: 'security-index', |
||||
components: { mSecondaryMenu } |
||||
} |
||||
</script> |
||||
|
@ -1,8 +1,14 @@
|
||||
<template> |
||||
<router-view></router-view> |
||||
<div class="main-layout-box"> |
||||
<m-secondary-menu :type="'user'"></m-secondary-menu> |
||||
<router-view></router-view> |
||||
</div> |
||||
|
||||
</template> |
||||
<script> |
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' |
||||
export default { |
||||
name: 'user-index' |
||||
name: 'user-index', |
||||
components: { mSecondaryMenu } |
||||
} |
||||
</script> |
@ -1,20 +1,16 @@
|
||||
<template> |
||||
<div class="main-layout-box"> |
||||
<m-secondary-menu :type="'user'"></m-secondary-menu> |
||||
<m-list-construction :title="$t('User Information')"> |
||||
<template slot="content"> |
||||
<m-info></m-info> |
||||
</template> |
||||
</m-list-construction> |
||||
</div> |
||||
<m-list-construction :title="$t('User Information')"> |
||||
<template slot="content"> |
||||
<m-info></m-info> |
||||
</template> |
||||
</m-list-construction> |
||||
</template> |
||||
<script> |
||||
import mInfo from './_source/info' |
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' |
||||
import mListConstruction from '@/module/components/listConstruction/listConstruction' |
||||
|
||||
export default { |
||||
name: 'account-index', |
||||
components: { mSecondaryMenu, mListConstruction, mInfo } |
||||
components: { mListConstruction, mInfo } |
||||
} |
||||
</script> |
@ -1,20 +1,16 @@
|
||||
<template> |
||||
<div class="main-layout-box"> |
||||
<m-secondary-menu :type="'user'"></m-secondary-menu> |
||||
<m-list-construction :title="$t('Edit Password')"> |
||||
<template slot="content"> |
||||
<m-info></m-info> |
||||
</template> |
||||
</m-list-construction> |
||||
</div> |
||||
<m-list-construction :title="$t('Edit Password')"> |
||||
<template slot="content"> |
||||
<m-info></m-info> |
||||
</template> |
||||
</m-list-construction> |
||||
</template> |
||||
<script> |
||||
import mInfo from './_source/info' |
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' |
||||
import mListConstruction from '@/module/components/listConstruction/listConstruction' |
||||
|
||||
export default { |
||||
name: 'password-index', |
||||
components: { mSecondaryMenu, mListConstruction, mInfo } |
||||
components: { mListConstruction, mInfo } |
||||
} |
||||
</script> |
@ -0,0 +1,152 @@
|
||||
<template> |
||||
<m-popup |
||||
ref="popup" |
||||
:ok-text="item ? $t('Edit') : $t('Submit')" |
||||
:nameText="item ? '编辑令牌' : '创建令牌'" |
||||
@ok="_ok"> |
||||
<template slot="content"> |
||||
<div class="create-token-model"> |
||||
<m-list-box-f> |
||||
<template slot="name"><b>*</b>失效时间</template> |
||||
<template slot="content"> |
||||
<x-datepicker |
||||
:disabled-date="disabledDate" |
||||
v-model="expireTime" |
||||
@on-change="_onChange" |
||||
format="YYYY-MM-DD HH:mm:ss" |
||||
:panelNum="1"> |
||||
</x-datepicker> |
||||
</template> |
||||
</m-list-box-f> |
||||
<m-list-box-f> |
||||
<template slot="name"><b>*</b>用户</template> |
||||
<template slot="content"> |
||||
<x-select v-model="userId" @on-change="_onChange"> |
||||
<x-option |
||||
v-for="city in userIdList" |
||||
:key="city.id" |
||||
:value="city.id" |
||||
:label="city.userName"> |
||||
</x-option> |
||||
</x-select> |
||||
</template> |
||||
</m-list-box-f> |
||||
<m-list-box-f> |
||||
<template slot="name">Token</template> |
||||
<template slot="content"> |
||||
<x-input |
||||
readonly |
||||
style="width: 330px;" |
||||
type="input" |
||||
v-model="token" |
||||
placeholder="请输入Token"> |
||||
</x-input> |
||||
<x-button type="ghost" @click="_generateToken" :loading="tokenLoading">生成Token</x-button> |
||||
</template> |
||||
</m-list-box-f> |
||||
</div> |
||||
</template> |
||||
</m-popup> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import dayjs from 'dayjs' |
||||
// import i18n from '@/module/i18n' |
||||
import store from '@/conf/home/store' |
||||
import mPopup from '@/module/components/popup/popup' |
||||
import mListBoxF from '@/module/components/listBoxF/listBoxF' |
||||
|
||||
export default { |
||||
name: 'create-token', |
||||
data () { |
||||
return { |
||||
store, |
||||
expireTime: dayjs().format('YYYY-MM-DD 23:59:59'), |
||||
userId: null, |
||||
disabledDate: date => (date.getTime() - new Date(new Date().getTime() - 24 * 60 * 60 * 1000)) < 0, |
||||
token: '', |
||||
userIdList: [], |
||||
tokenLoading: false |
||||
} |
||||
}, |
||||
props: { |
||||
item: Object |
||||
}, |
||||
methods: { |
||||
_ok () { |
||||
if (this._verification()) { |
||||
this._submit() |
||||
} |
||||
}, |
||||
_verification () { |
||||
if (!this.token) { |
||||
this.$message.warning('请生成Token') |
||||
return false |
||||
} |
||||
return true |
||||
}, |
||||
_submit () { |
||||
let param = { |
||||
expireTime: dayjs(this.expireTime).format('YYYY-MM-DD HH:mm:ss'), |
||||
userId: this.userId, |
||||
token: this.token |
||||
} |
||||
if (this.item) { |
||||
param.id = this.item.id |
||||
} |
||||
this.$refs['popup'].spinnerLoading = true |
||||
this.store.dispatch(`user/${this.item ? 'updateToken' : 'createToken'}`, param).then(res => { |
||||
this.$emit('onUpdate') |
||||
this.$message.success(res.msg) |
||||
setTimeout(() => { |
||||
this.$refs['popup'].spinnerLoading = false |
||||
}, 800) |
||||
}).catch(e => { |
||||
this.$message.error(e.msg || '') |
||||
this.$refs['popup'].spinnerLoading = false |
||||
}) |
||||
}, |
||||
_generateToken () { |
||||
this.tokenLoading = true |
||||
this.store.dispatch(`user/generateToken`, { |
||||
userId: this.userId, |
||||
expireTime: this.expireTime |
||||
}).then(res => { |
||||
setTimeout(() => { |
||||
this.tokenLoading = false |
||||
this.token = res |
||||
}, 1200) |
||||
}).catch(e => { |
||||
this.token = '' |
||||
this.$message.error(e.msg || '') |
||||
this.tokenLoading = false |
||||
}) |
||||
}, |
||||
_onChange () { |
||||
this.token = '' |
||||
} |
||||
}, |
||||
watch: {}, |
||||
created () { |
||||
this.store.dispatch(`security/getUsersList`).then(res => { |
||||
this.userIdList = _.map(res, v => _.pick(v, ['id', 'userName'])) |
||||
if (this.item) { |
||||
this.expireTime = this.item.expireTime |
||||
this.userId = this.item.userId |
||||
this.token = this.item.token |
||||
} else { |
||||
this.userId = this.userIdList[0].id |
||||
} |
||||
}) |
||||
}, |
||||
mounted () { |
||||
}, |
||||
components: { mPopup, mListBoxF } |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" rel="stylesheet/scss"> |
||||
.create-token-model { |
||||
width: 640px; |
||||
} |
||||
</style> |
@ -0,0 +1,125 @@
|
||||
<template> |
||||
<div class="list-model"> |
||||
<div class="table-box"> |
||||
<table> |
||||
<tr> |
||||
<th> |
||||
<span>编号</span> |
||||
</th> |
||||
<th> |
||||
<span>用户</span> |
||||
</th> |
||||
<th> |
||||
<span>Token</span> |
||||
</th> |
||||
<th> |
||||
<span>开始时间</span> |
||||
</th> |
||||
<th> |
||||
<span>失效时间</span> |
||||
</th> |
||||
<th> |
||||
<span>创建时间</span> |
||||
</th> |
||||
<th> |
||||
<span>更新时间</span> |
||||
</th> |
||||
<th width="120"> |
||||
<span>{{$t('Operation')}}</span> |
||||
</th> |
||||
</tr> |
||||
<tr v-for="(item, $index) in list" :key="$index"> |
||||
<td> |
||||
<span>{{parseInt(pageNo === 1 ? ($index + 1) : (($index + 1) + (pageSize * (pageNo - 1))))}}</span> |
||||
</td> |
||||
<td> |
||||
<span> |
||||
<a href="javascript:" class="links">{{item.userName}}</a> |
||||
</span> |
||||
</td> |
||||
<td><span>{{item.token}}</span></td> |
||||
<td> |
||||
<span>{{item.createTime | formatDate}}</span> |
||||
</td> |
||||
<td> |
||||
<span>{{item.expireTime | formatDate}}</span> |
||||
</td> |
||||
<td><span>{{item.createTime | formatDate}}</span></td> |
||||
<td><span>{{item.updateTime | formatDate}}</span></td> |
||||
<td> |
||||
<x-button type="info" shape="circle" size="xsmall" data-toggle="tooltip" icon="iconfont icon-bianjixiugai" :title="$t('Edit')" @click="_edit(item)"> |
||||
</x-button> |
||||
<x-poptip |
||||
:ref="'poptip-delete-' + $index" |
||||
placement="bottom-end" |
||||
width="90"> |
||||
<p>{{$t('Delete?')}}</p> |
||||
<div style="text-align: right; margin: 0;padding-top: 4px;"> |
||||
<x-button type="text" size="xsmall" shape="circle" @click="_closeDelete($index)">{{$t('Cancel')}}</x-button> |
||||
<x-button type="primary" size="xsmall" shape="circle" @click="_delete(item,$index)">{{$t('Confirm')}}</x-button> |
||||
</div> |
||||
<template slot="reference"> |
||||
<x-button type="error" shape="circle" size="xsmall" data-toggle="tooltip" icon="iconfont icon-shanchu" :title="$t('delete')"> |
||||
</x-button> |
||||
</template> |
||||
</x-poptip> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import { mapActions } from 'vuex' |
||||
import '@/module/filter/formatDate' |
||||
import { findComponentDownward } from '@/module/util/' |
||||
|
||||
export default { |
||||
name: 'token-list', |
||||
data () { |
||||
return { |
||||
list: [] |
||||
} |
||||
}, |
||||
props: { |
||||
tokenList: Array, |
||||
pageNo: Number, |
||||
pageSize: Number |
||||
}, |
||||
methods: { |
||||
...mapActions('user', ['deleteToken']), |
||||
_closeDelete (i) { |
||||
this.$refs[`poptip-delete-${i}`][0].doClose() |
||||
}, |
||||
_delete (item, i) { |
||||
this.deleteToken({ |
||||
id: item.id |
||||
}).then(res => { |
||||
this.$refs[`poptip-delete-${i}`][0].doClose() |
||||
this.list.splice(i, 1) |
||||
this.$message.success(res.msg) |
||||
}).catch(e => { |
||||
this.$refs[`poptip-delete-${i}`][0].doClose() |
||||
this.$message.error(e.msg || '') |
||||
}) |
||||
}, |
||||
_edit (item) { |
||||
findComponentDownward(this.$root, 'token-index')._create(item) |
||||
} |
||||
}, |
||||
watch: { |
||||
tokenList (a) { |
||||
this.list = [] |
||||
setTimeout(() => { |
||||
this.list = a |
||||
}) |
||||
} |
||||
}, |
||||
created () { |
||||
this.list = this.tokenList |
||||
}, |
||||
mounted () { |
||||
}, |
||||
components: { } |
||||
} |
||||
</script> |
@ -0,0 +1,115 @@
|
||||
<template> |
||||
<m-list-construction :title="'令牌管理'"> |
||||
<template slot="conditions"> |
||||
<m-conditions @on-conditions="_onConditions"> |
||||
<template slot="button-group"> |
||||
<x-button type="ghost" size="small" @click="_create('')">创建令牌</x-button> |
||||
</template> |
||||
</m-conditions> |
||||
</template> |
||||
<template slot="content"> |
||||
<template v-if="tokenList.length"> |
||||
<m-list :token-list="tokenList" :page-no="searchParams.pageNo" :page-size="searchParams.pageSize"></m-list> |
||||
<div class="page-box"> |
||||
<x-page :current="parseInt(searchParams.pageNo)" :total="total" :page-size="searchParams.pageSize" show-elevator @on-change="_page"></x-page> |
||||
</div> |
||||
</template> |
||||
<template v-if="!tokenList.length"> |
||||
<m-no-data></m-no-data> |
||||
</template> |
||||
<m-spin :is-spin="isLoading"></m-spin> |
||||
</template> |
||||
</m-list-construction> |
||||
</template> |
||||
<script> |
||||
import _ from 'lodash' |
||||
import { mapActions } from 'vuex' |
||||
import mList from './_source/list' |
||||
import mSpin from '@/module/components/spin/spin' |
||||
import mCreateToken from './_source/createToken' |
||||
import mNoData from '@/module/components/noData/noData' |
||||
import listUrlParamHandle from '@/module/mixin/listUrlParamHandle' |
||||
import mConditions from '@/module/components/conditions/conditions' |
||||
import mSecondaryMenu from '@/module/components/secondaryMenu/secondaryMenu' |
||||
import mListConstruction from '@/module/components/listConstruction/listConstruction' |
||||
|
||||
export default { |
||||
name: 'token-index', |
||||
data () { |
||||
return { |
||||
total: null, |
||||
isLoading: false, |
||||
tokenList: [], |
||||
searchParams: { |
||||
pageSize: 10, |
||||
pageNo: 1, |
||||
searchVal: '' |
||||
} |
||||
} |
||||
}, |
||||
mixins: [listUrlParamHandle], |
||||
props: {}, |
||||
methods: { |
||||
...mapActions('user', ['getTokenListP']), |
||||
/** |
||||
* Inquire |
||||
*/ |
||||
_onConditions (o) { |
||||
this.searchParams = _.assign(this.searchParams, o) |
||||
this.searchParams.pageNo = 1 |
||||
}, |
||||
_page (val) { |
||||
this.searchParams.pageNo = val |
||||
}, |
||||
_create (item) { |
||||
let self = this |
||||
let modal = this.$modal.dialog({ |
||||
closable: false, |
||||
showMask: true, |
||||
escClose: true, |
||||
className: 'v-modal-custom', |
||||
transitionName: 'opacityp', |
||||
render (h) { |
||||
return h(mCreateToken, { |
||||
on: { |
||||
onUpdate () { |
||||
self._debounceGET('false') |
||||
modal.remove() |
||||
}, |
||||
close () { |
||||
modal.remove() |
||||
} |
||||
}, |
||||
props: { |
||||
item: item |
||||
} |
||||
}) |
||||
} |
||||
}) |
||||
}, |
||||
_getList (flag) { |
||||
this.isLoading = !flag |
||||
this.getTokenListP(this.searchParams).then(res => { |
||||
this.tokenList = [] |
||||
this.tokenList = res.totalList |
||||
this.total = res.total |
||||
this.isLoading = false |
||||
}).catch(e => { |
||||
this.isLoading = false |
||||
}) |
||||
} |
||||
}, |
||||
watch: { |
||||
// router |
||||
'$route' (a) { |
||||
// url no params get instance list |
||||
this.searchParams.pageNo = _.isEmpty(a.query) ? 1 : a.query.pageNo |
||||
} |
||||
}, |
||||
created () { |
||||
}, |
||||
mounted () { |
||||
}, |
||||
components: { mSecondaryMenu, mList, mListConstruction, mConditions, mSpin, mNoData } |
||||
} |
||||
</script> |
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 550 B |
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 586 B |
@ -0,0 +1,7 @@
|
||||
/** |
||||
* project external config |
||||
*/ |
||||
export default { |
||||
// qianfan task record switch
|
||||
recordSwitch:true |
||||
} |
Loading…
Reference in new issue