Commit d6f417bc by linjinhong

增加服务系统菜单功能项

parent 424df567
<script>
export default {
name: 'queryForm',
components: {},
props: {
formConfig: {
type: Array,
default: () => []
},
isCustomButton: {
type: Boolean,
default: true
}
},
computed: {
formColumns() {
return [...this.formConfig]
}
},
watch: {},
data() {
return {
loading: false,
formData: {}
}
},
methods: {
search() {
console.log(25, this.formData)
// this.$emit('search', this.formData)
},
addDialog(obj) {
this.$emit('addDialog')
},
handleSubmit(event) {
event.preventDefault()
},
showToggle() {
this.loading = !this.loading
}
},
render() {
// const { btnSlot } = this.$slots
return (
<el-form
ref="form"
props={{
model: this.formData
}}
size="mini"
inline
onSubmit={this.handleSubmit}
onKeyupenterCapture={this.search}>
{this.formColumns?.map((item, index) => (
<el-form-item key={index} label={item.name}>
{item.type === 'input' && (
<el-input
v-model={this.formData[item.prop]}
placeholder={item.placeholder || '请输入'}
clearable></el-input>
)}
{item.type === 'select' && (
<el-select
v-model={this.formData[item.prop]}
placeholder={item.placeholder || '请选择'}
clearable>
{item.options?.map((el, idx) => (
<el-option label={el} value={el} key={idx}>
{el}
</el-option>
))}
</el-select>
)}
{item.type === 'datePicker' && (
<el-date-picker
value-format="yyyy-MM-dd"
type={item.dateType || 'date'}
placeholder="选择日期"
v-model={this.formData[item.prop]}
clearable
style="width: 100%;"></el-date-picker>
)}
</el-form-item>
))}
{this.isCustomButton && (
<el-form-item>
<el-button
type="primary"
onClick={this.search}
icon="el-icon-search">
查询
</el-button>
<el-button type="success" onClick={this.addDialog}>
新增
</el-button>
</el-form-item>
)}
{!this.isCustomButton}
</el-form>
)
}
}
</script>
<style scoped></style>
...@@ -73,6 +73,12 @@ const routes = [ ...@@ -73,6 +73,12 @@ const routes = [
meta: { title: '公告管理' } meta: { title: '公告管理' }
}, },
{ {
path: '/saas/services',
component: () => import('@/views/system/services.vue'),
name: 'system_services',
meta: { title: '系统服务' }
},
{
path: '/saas/countryCode', path: '/saas/countryCode',
component: () => import('@/views/system/countryCode.vue'), component: () => import('@/views/system/countryCode.vue'),
name: 'system_countryCode', name: 'system_countryCode',
...@@ -149,7 +155,8 @@ const routes = [ ...@@ -149,7 +155,8 @@ const routes = [
component: () => import('@/views/production/AssistantManage.vue'), component: () => import('@/views/production/AssistantManage.vue'),
name: 'production_assistant_manage', name: 'production_assistant_manage',
meta: { title: '应用版本管理' } meta: { title: '应用版本管理' }
}, { },
{
path: '/saas/import-template', path: '/saas/import-template',
component: () => import('@/views/import-template/index.vue'), component: () => import('@/views/import-template/index.vue'),
name: 'import-template', name: 'import-template',
......
...@@ -107,10 +107,20 @@ ...@@ -107,10 +107,20 @@
<div class="sql-left"> <div class="sql-left">
<el-form :model="editForm"> <el-form :model="editForm">
<el-form-item required label="数据源"> <el-form-item required label="数据源">
<el-select @change="selectChange" style="width: 92%;" v-model="editForm.database" multiple clearable filterable> <el-select
@change="selectChange"
style="width: 92%"
v-model="editForm.database"
multiple
clearable
filterable>
<el-option label="all" value="all"></el-option> <el-option label="all" value="all"></el-option>
<el-option :disabled="editForm.database.includes('all')" v-for="it in dataBase" :key="it" :label="`${it.databaseName}(${it.dataHost})`" <el-option
:value="it.id"></el-option> :disabled="editForm.database.includes('all')"
v-for="it in dataBase"
:key="it"
:label="`${it.databaseName}(${it.dataHost})`"
:value="it.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item required> <el-form-item required>
...@@ -127,20 +137,28 @@ ...@@ -127,20 +137,28 @@
type="password" type="password"
placeholder="请输入管理密码" placeholder="请输入管理密码"
v-model="editForm.password"></el-input> v-model="editForm.password"></el-input>
<el-button :loading="loading" style="margin-left: 20px" type="primary" @click="submitOm">执行 <el-button
:loading="loading"
style="margin-left: 20px"
type="primary"
@click="submitOm">
执行
</el-button> </el-button>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="sql-right"> <div class="sql-right">
<ul v-if="msg_list.length>0"> <ul v-if="msg_list.length > 0">
<li v-for="(item,i) in msg_list" :key="i"> <li v-for="(item, i) in msg_list" :key="i">
<div class="flex"> <div class="flex">
<span>执行结果:</span> <span>执行结果:</span>
<el-tag size="mini" v-if="item.status==='SUCCESS'" type="success">执行成功</el-tag> <el-tag
size="mini"
v-if="item.status === 'SUCCESS'"
type="success">
执行成功
</el-tag>
<el-tag size="mini" v-else type="danger">执行失败</el-tag> <el-tag size="mini" v-else type="danger">执行失败</el-tag>
</div> </div>
<div class="flex"> <div class="flex">
...@@ -249,6 +267,14 @@ export default { ...@@ -249,6 +267,14 @@ export default {
icon: 'el-icon-s-promotion', icon: 'el-icon-s-promotion',
index: '/saas/announceManage', index: '/saas/announceManage',
children: [] children: []
},
{
id: 5,
path: '',
label: '系统服务',
icon: 'el-icon-s-order',
index: '/saas/services',
children: []
} }
] ]
}, },
...@@ -430,7 +456,6 @@ export default { ...@@ -430,7 +456,6 @@ export default {
...mapState(['userInfo']) ...mapState(['userInfo'])
}, },
watch: { watch: {
currentTag(v) { currentTag(v) {
if (!v) return if (!v) return
const parent = this.menuList.find((e) => { const parent = this.menuList.find((e) => {
...@@ -449,7 +474,10 @@ export default { ...@@ -449,7 +474,10 @@ export default {
selectChange(v) { selectChange(v) {
if (v.includes('all')) { if (v.includes('all')) {
this.editForm.database = ['all'] this.editForm.database = ['all']
} else if (this.dataBase.length > 0 && this.dataBase.length === v.length) { } else if (
this.dataBase.length > 0 &&
this.dataBase.length === v.length
) {
this.editForm.database = ['all'] this.editForm.database = ['all']
} }
console.log(v) console.log(v)
...@@ -508,7 +536,7 @@ export default { ...@@ -508,7 +536,7 @@ export default {
this.editForm.content = '' this.editForm.content = ''
this.editForm.password = '' this.editForm.password = ''
this.editForm.database = ['all'] this.editForm.database = ['all']
get('platform/tools/datasource-list').then(res => { get('platform/tools/datasource-list').then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.dataBase = res.data this.dataBase = res.data
} }
...@@ -607,7 +635,6 @@ export default { ...@@ -607,7 +635,6 @@ export default {
margin-right: 10px; margin-right: 10px;
font-size: 18px; font-size: 18px;
} }
</style> </style>
<style lang="scss"> <style lang="scss">
.sql-dialog { .sql-dialog {
...@@ -672,5 +699,4 @@ export default { ...@@ -672,5 +699,4 @@ export default {
} }
} }
} }
</style> </style>
<template>
<div class="wraper">
<QueryForm :formConfig="queryformConfig" @addDialog="addDialog"></QueryForm>
<div class="table_wrap" v-loading="loading">
<table-vue
:sourceData="sourceData"
ref="multipleTable"
:tableColumns="usersTableColumns"
@currentChange="currentTabFn"
:rowClassName="cellClass"
@selectionChange="selectionChange"></table-vue>
</div>
<div class="pagination">
<el-pagination
layout="sizes, total, prev, pager, next, jumper"
background
:total="total"
:page-size="pageSize"
:current-page="currentPage"
@size-change="sizeChange"
@current-change="onCurrentChange"></el-pagination>
</div>
<!-- 弹出层 -->
<el-dialog
:close-on-click-modal="false"
:title="is_title == 1 ? '新增' : '编辑'"
:visible.sync="dialogVisible"
width="590px">
<el-form
label-position="right"
label-width="100px"
size="mini"
:inline="true"
:model="addcurrencyform"
:rules="addrules"
ref="addcurrencyform">
<el-form-item label="登录账号" prop="account" required>
<el-input
style="width: 164px"
v-model="addcurrencyform.account"
placeholder="请输入登录账号"
maxlength="30"></el-input>
</el-form-item>
<el-form-item label="姓名" prop="" required>
<el-input
style="width: 164px"
v-model="addcurrencyform.realName"
placeholder="请输入姓名"
maxlength="30"></el-input>
</el-form-item>
<el-form-item label="是否启用" prop="enable">
<div style="width: 164px" placeholder="请选择">
<el-radio :label="true" v-model="addcurrencyform.enable">
</el-radio>
<el-radio :label="false" v-model="addcurrencyform.enable">
</el-radio>
</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button
@click="dialogVisible = false"
size="mini"
style="width: 100px">
取消
</el-button>
<el-button
type="primary"
@click="addUser()"
size="mini"
style="width: 100px">
确认
</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import axios from '../../common/api/axios'
import QueryForm from '@/common/components/base/queryForm.vue'
import { mapState } from 'vuex'
import tableVue from '@/common/components/base/tableView.vue'
export default {
name: 'system_users',
components: {
tableVue,
QueryForm
},
data() {
const validatePass = (rule, value, callback) => {
if (this.is_title === 1 && value === '') {
callback(new Error('请输入密码'))
} else {
callback()
}
}
const confirmPass = (rule, value, callback) => {
if (this.is_title === 1 && value === '') {
callback(new Error('确认密码不能为空'))
} else if (
this.is_title === 1 &&
value !== this.addcurrencyform.password
) {
callback(new Error('2次输入的密码不一致'))
} else {
callback()
}
}
return {
is_title: 1,
select: '',
sourceData: [],
searchForm: {
employeeName: '',
enable: true,
platform: ''
},
queryformConfig: [
{ prop: 'activityName', type: 'input', name: '名称' },
{
prop: 'region',
type: 'select',
options: ['区域1', '区域2'],
name: '区域'
},
{ prop: 'date', type: 'datePicker', name: '日期' }
],
dialogVisible: false,
addcurrencyform: {
id: '',
loginName: '',
password: '',
confirmpwd: '',
remark: '',
enable: true,
employeeId: '',
roleId: '',
funcRoleIds: [],
platform: ''
},
addcurrencyform2: null,
formId: null,
addrules: {
password: [{ validator: validatePass, trigger: 'blur' }],
confirmpwd: [{ validator: confirmPass, trigger: 'blur' }],
loginName: [
{
required: true,
message: '请输入登录账号',
trigger: 'blur'
}
],
employeeName: [
{
required: true,
message: '请选择员工',
trigger: 'change'
}
],
roleId: [
{
required: true,
message: '请选择角色',
trigger: 'change'
}
]
},
roleList: [],
paginationOptions: {
pageSize: 100,
currentPage: 1,
total: 0
},
details: [],
roleOptions: [],
platforms: [],
total: 0,
pageSize: 100,
currentPage: 1,
loading: false
}
},
created() {
this.getList(1)
this.addcurrencyform2 = JSON.parse(JSON.stringify(this.addcurrencyform))
// axios.get('sysRole/role_option')
// .then((res) => {
// if (res.code === 200) {
// this.roleOptions = res.data
// }
// })
// .catch((err) => {
// console.log(err)
// })
// axios.get('sysRole/all_list').then((res) => {
// this.roleList = res.data
// })
// axios.get('platform/user/employeePlatformList')
// .then((res) => {
// this.platforms = res.data
// })
// .catch((err) => {
// console.log(err)
// })
},
computed: {
...mapState(['reqMenu', 'employee']),
usersTableColumns() {
return [
{
label: '登录账户',
key: 'account',
width: '',
align: 'left',
render: (item) => (
<span>
<i
class="circle"
style={{
backgroundColor: item.enable ? 'green' : 'red'
}}></i>
{item.account}
</span>
)
},
{
label: '姓名',
key: 'realName',
width: ''
},
{
label: '相关操作',
key: '',
fixed: 'right',
width: '130',
render: (item) => (
<div>
<span title="编辑" class="icon-view ">
<i
class="el-icon-edit-outline"
style="color:#E6A23C"
onClick={(e) => this.addDialog(2, item, e)}></i>
</span>
<span title="重置密码" class="icon-view ">
<i
style="color:#67C23A"
class="el-icon-refresh-left"
onClick={(e) => this.resetPwd(e, item)}></i>
</span>
<span title="删除" class="icon-view ">
<i
style="color:#F56C6C"
class="el-icon-delete"
onClick={(e) => this.deleteSection(item)}></i>
</span>
</div>
)
}
]
},
funcRoleList() {
if (this.roleList.length > 0) {
return this.roleList.filter((item) => item.type === 'FUNCTION_ROLE')
}
return []
},
dataRoleList() {
if (this.roleList.length > 0) {
return this.roleList.filter((item) => item.type === 'DATA_ROLE')
}
return []
}
},
methods: {
onCurrentChange() {},
sizeChange() {},
spentChange(v, item) {
axios
.post('platform/user/update', {
...item,
cost: v
})
.then(() => {
this.getList()
})
},
cellClass({ row }) {
if (row.authAuditFlag === 1) {
return 'first'
} else {
return ''
}
},
selectionChange(selection) {
if (selection.length > 0) {
this.select = selection
}
},
authorization(item, e) {
e && e.stopPropagation()
},
authorizationDel(item, e) {
e && e.stopPropagation()
this.$confirm('确定删除选中的信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {})
.catch(() => {})
},
resetPwd(e, row) {
e && e.stopPropagation()
this.$confirm('确认要重置密码?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
axios.post('platform/user/resetPassword/' + row.id).then((res) => {
this.$alert('重置成功\n\r 新密码为:' + res.data.passWord)
})
})
.catch(() => {})
},
enableChange(val, row) {
axios
.post('platform/user/setEnableStatus', {
enable: val,
userId: row.id
})
.then((res) => {
this.$message.success(res.message)
this.getList()
})
},
bindChange(row) {
axios
.post('platform/user/setBindingStatus', {
bindStatus: !row.bindStatus,
userId: row.id
})
.then((res) => {
this.$message.success(res.message)
this.getList()
})
},
setempNo(id) {
for (const iterator of this.employee) {
if (iterator.id === id) {
this.addcurrencyform.empNumber = iterator.empNumber
break
}
}
},
search(value) {
console.log(409, value)
/* this.currentPage = 1
this.getList(1) */
},
currentTabFn(val) {
if (val.row) {
this.formId = val.row.id
}
},
// 修改新增
async addDialog(i, v = null, e) {
e && e.stopPropagation()
if (i === 2) {
if (v) this.formId = v.id
if (!this.formId) {
return this.$message('请勾选至少一条记录')
}
axios
.get('platform/user/get', {
params: {
id: v.id
}
})
.then((res) => {
const funcRoleIds = []
const dataRoleIds = []
if (res.data.roleIds) {
const roleIds = res?.data?.roleIds.split(',') || []
for (const iterator of roleIds) {
const item = this.roleList.find((item) => item.id === iterator)
if (item) {
if (item.type === 'FUNCTION_ROLE') {
funcRoleIds.push(Number(iterator))
} else {
dataRoleIds.push(Number(iterator))
}
}
}
}
this.addcurrencyform = {
...res.data,
funcRoleIds,
dataRoleIds
}
this.dialogVisible = true
})
} else {
this.addcurrencyform = JSON.parse(JSON.stringify(this.addcurrencyform2))
this.dialogVisible = true
}
this.is_title = i
this.$nextTick(() => {
this.$refs.addcurrencyform && this.$refs.addcurrencyform.clearValidate()
})
},
addUser() {
if (this.is_title === 1) {
this.addSection()
} else {
this.upSection()
}
},
setpaginationOptions(opt) {
for (const key in opt) {
this.paginationOptions[key] = opt[key]
}
this.getList()
},
// 查询
getList() {
this.loading = true
const { pageSize, currentPage } = this.paginationOptions
axios
.post('platform/user/list_page', {
pageSize,
currentPage,
...this.searchForm
})
.then((res) => {
this.loading = false
if (res.code === 200) {
this.sourceData = res.data.records
this.paginationOptions.total = res.data.total
} else {
this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true
})
}
})
},
// 修改
upSection() {
const url = 'platform/user/update'
this.$refs.addcurrencyform.validate((valid) => {
if (valid) {
const data = JSON.parse(JSON.stringify(this.addcurrencyform))
let roleIds = this.addcurrencyform.funcRoleIds.concat(
this.addcurrencyform.dataRoleIds
)
roleIds = roleIds.join()
data.roleIds = roleIds
axios.post(url, data).then((res) => {
if (res.code === 200) {
this.dialogVisible = false
this.$message({
message: '修改成功',
type: 'success'
})
this.getList(this.currentPage)
} else {
this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true
})
}
})
}
})
},
// 新增
addSection() {
const url = 'platform/user/add'
this.$refs.addcurrencyform.validate((valid) => {
if (valid) {
const data = JSON.parse(JSON.stringify(this.addcurrencyform))
let roleIds = this.addcurrencyform.funcRoleIds.concat(
this.addcurrencyform.dataRoleIds
)
roleIds = roleIds.join()
data.roleIds = roleIds
axios.post(url, data).then((res) => {
if (res.code === 200) {
this.dialogVisible = false
this.$alert(
'添加成功\n\r 用户密码为:' + res.data?.passWord || ''
)
this.getList(this.currentPage)
} else {
this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true
})
}
})
}
})
},
// 删除
deleteSection(v) {
let arr = []
if (v) arr.push(v)
else arr = this.select
const leng = arr.length
if (leng === 0) {
return this.$message('请勾选至少一条记录')
}
let ids = []
ids = arr.map((v) => {
return v.id
})
ids = ids.join()
this.$confirm('确定删除选中的信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
axios
.get('platform/user/delete', {
params: {
ids: ids
}
})
.then((res) => {
if (res.code === 200) {
this.$message({
type: 'success',
message: '删除成功!'
})
this.getList(this.currentPage)
} else {
this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true
})
}
})
})
.catch(() => {})
}
}
}
</script>
<style scoped>
.wraper {
display: flex;
flex-direction: column;
height: 100%;
}
.table_wrap {
flex: 1;
}
.circle {
display: inline-block;
height: 10px;
width: 10px;
border-radius: 5px;
margin-right: 5px;
}
.my-table >>> .first {
background-color: red !important;
color: #fff !important;
}
</style>
...@@ -6,12 +6,13 @@ module.exports = defineConfig({ ...@@ -6,12 +6,13 @@ module.exports = defineConfig({
host: '', host: '',
proxy: { proxy: {
'/api': { '/api': {
target: 'http://10.168.31.222:8096', // target: 'http://10.168.31.222:8096',
changeOrigin: true, target: 'http://10.168.1.132:8096',
changeOrigin: true
// pathRewrite: { // pathRewrite: {
// '^/api': '', // '^/api': '',
// }, // },
}, }
}, }
}, }
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment