mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2026-04-26 00:00:04 +08:00
验证,组件优化,样式优化等
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
"groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a",
|
"groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a",
|
||||||
"name" : "删除",
|
"name" : "删除",
|
||||||
"createTime" : null,
|
"createTime" : null,
|
||||||
"updateTime" : 1646553121622,
|
"updateTime" : 1647618260057,
|
||||||
"lock" : "0",
|
"lock" : "0",
|
||||||
"createBy" : null,
|
"createBy" : null,
|
||||||
"updateBy" : null,
|
"updateBy" : null,
|
||||||
@@ -48,6 +48,10 @@
|
|||||||
================================
|
================================
|
||||||
import org.ssssssss.magicapi.modules.db.cache.SqlCache
|
import org.ssssssss.magicapi.modules.db.cache.SqlCache
|
||||||
|
|
||||||
|
if(Arrays.asList(id.split(',')).contains('1')){
|
||||||
|
exit 500, '不允许删除超级管理员'
|
||||||
|
}
|
||||||
|
|
||||||
for(userId in id.split(',')){
|
for(userId in id.split(',')){
|
||||||
SqlCache.delete(`permissions:${userId}`)
|
SqlCache.delete(`permissions:${userId}`)
|
||||||
db.table("sys_user").logic().where().eq("id",userId).delete();
|
db.table("sys_user").logic().where().eq("id",userId).delete();
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
"script" : null,
|
"script" : null,
|
||||||
"groupId" : "8295fc13678d4144bf7363c465247a50",
|
"groupId" : "8295fc13678d4144bf7363c465247a50",
|
||||||
"name" : "保存",
|
"name" : "保存",
|
||||||
"createTime" : 1646490239492,
|
"createTime" : null,
|
||||||
"updateTime" : 1644121675551,
|
"updateTime" : 1647615397163,
|
||||||
"lock" : "0",
|
"lock" : "0",
|
||||||
"createBy" : null,
|
"createBy" : null,
|
||||||
"updateBy" : null,
|
"updateBy" : null,
|
||||||
@@ -42,7 +42,19 @@
|
|||||||
"paths" : [ ],
|
"paths" : [ ],
|
||||||
"responseBody" : null,
|
"responseBody" : null,
|
||||||
"description" : null,
|
"description" : null,
|
||||||
"requestBodyDefinition" : null,
|
"requestBodyDefinition" : {
|
||||||
|
"name" : "",
|
||||||
|
"value" : "",
|
||||||
|
"description" : "",
|
||||||
|
"required" : false,
|
||||||
|
"dataType" : "Object",
|
||||||
|
"type" : null,
|
||||||
|
"defaultValue" : null,
|
||||||
|
"validateType" : "",
|
||||||
|
"error" : "",
|
||||||
|
"expression" : "",
|
||||||
|
"children" : [ ]
|
||||||
|
},
|
||||||
"responseBodyDefinition" : null
|
"responseBodyDefinition" : null
|
||||||
}
|
}
|
||||||
================================
|
================================
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"groupId" : "8295fc13678d4144bf7363c465247a50",
|
"groupId" : "8295fc13678d4144bf7363c465247a50",
|
||||||
"name" : "删除",
|
"name" : "删除",
|
||||||
"createTime" : null,
|
"createTime" : null,
|
||||||
"updateTime" : 1646553126039,
|
"updateTime" : 1647615807925,
|
||||||
"lock" : "0",
|
"lock" : "0",
|
||||||
"createBy" : null,
|
"createBy" : null,
|
||||||
"updateBy" : null,
|
"updateBy" : null,
|
||||||
@@ -118,5 +118,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
================================
|
================================
|
||||||
|
var pCount = db.selectInt("select count(1) from sys_office where is_del = 0 and pid = #{id}")
|
||||||
|
if(pCount > 0){
|
||||||
|
exit 500,'存在下级机构,不允许删除'
|
||||||
|
}
|
||||||
|
var userCount = db.selectInt("select count(1) from sys_user where is_del = 0 and office_id = #{id}")
|
||||||
|
if(userCount > 0){
|
||||||
|
exit 500, '机构存在用户,不允许删除'
|
||||||
|
}
|
||||||
|
var root = db.selectValue("select pid from sys_office where is_del = 0 and id = #{id}")
|
||||||
|
if(root == '0'){
|
||||||
|
exit 500, '不能删除根节点'
|
||||||
|
}
|
||||||
// db.table('sys_user_office').where().eq("office_id",id).delete();
|
// db.table('sys_user_office').where().eq("office_id",id).delete();
|
||||||
return db.table("sys_office").logic().where().eq("id",id).delete();
|
return db.table("sys_office").logic().where().eq("id",id).delete();
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
"groupId" : "89130d496f6f467c88b22ae4a7f688eb",
|
"groupId" : "89130d496f6f467c88b22ae4a7f688eb",
|
||||||
"name" : "删除",
|
"name" : "删除",
|
||||||
"createTime" : null,
|
"createTime" : null,
|
||||||
"updateTime" : 1646553106085,
|
"updateTime" : 1647615829916,
|
||||||
"lock" : "0",
|
"lock" : "0",
|
||||||
"createBy" : null,
|
"createBy" : null,
|
||||||
"updateBy" : null,
|
"updateBy" : null,
|
||||||
@@ -47,6 +47,12 @@
|
|||||||
}
|
}
|
||||||
================================
|
================================
|
||||||
import '@get:/role/cache/delete' as cacheDelete
|
import '@get:/role/cache/delete' as cacheDelete
|
||||||
|
|
||||||
|
var userCount = db.selectInt("select count(1) from sys_user_role where role_id = #{id}")
|
||||||
|
if(userCount > 0){
|
||||||
|
exit 500, '角色已分配,不允许删除'
|
||||||
|
}
|
||||||
|
|
||||||
var roleId = id
|
var roleId = id
|
||||||
cacheDelete()
|
cacheDelete()
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ body{
|
|||||||
--mb-main-icon-color: #909399;
|
--mb-main-icon-color: #909399;
|
||||||
--mb-header-height: 60px;
|
--mb-header-height: 60px;
|
||||||
--mb-avatar-text-size: 18px;
|
--mb-avatar-text-size: 18px;
|
||||||
|
/*--mb-menu-item-height: 50px;*/
|
||||||
}
|
}
|
||||||
.el-header{
|
.el-header{
|
||||||
--el-header-height: var(--mb-header-height);
|
--el-header-height: var(--mb-header-height);
|
||||||
@@ -40,6 +41,9 @@ body{
|
|||||||
.el-dialog__body{
|
.el-dialog__body{
|
||||||
padding: 5px 20px;
|
padding: 5px 20px;
|
||||||
}
|
}
|
||||||
|
/*.el-sub-menu__title, .el-menu-item{*/
|
||||||
|
/* height: var(--mb-menu-item-height) !important;*/
|
||||||
|
/*}*/
|
||||||
.app-container hr {
|
.app-container hr {
|
||||||
border: none;
|
border: none;
|
||||||
height: 1px;
|
height: 1px;
|
||||||
|
|||||||
@@ -69,8 +69,7 @@
|
|||||||
var data = {}
|
var data = {}
|
||||||
props.form.rows.forEach(row => {
|
props.form.rows.forEach(row => {
|
||||||
row.cols.forEach(col => {
|
row.cols.forEach(col => {
|
||||||
// data[col.name] = col.defaultValue === null ? col.defaultValue : col.defaultValue || ''
|
data[col.name] = col.defaultValue || undefined
|
||||||
data[col.name] = undefined
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -92,12 +92,20 @@ function reset() {
|
|||||||
for(var key in props.where){
|
for(var key in props.where){
|
||||||
if(props.notReset.indexOf(key) == -1){
|
if(props.notReset.indexOf(key) == -1){
|
||||||
if(props.where[key] instanceof Object){
|
if(props.where[key] instanceof Object){
|
||||||
|
if(props.where[key].value instanceof Array){
|
||||||
|
props.where[key].value = []
|
||||||
|
}else{
|
||||||
props.where[key].value = null
|
props.where[key].value = null
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(props.where[key] instanceof Array){
|
||||||
|
props.where[key] = []
|
||||||
}else{
|
}else{
|
||||||
props.where[key] = null
|
props.where[key] = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
nextTick(() => emit('search'))
|
nextTick(() => emit('search'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,15 @@
|
|||||||
{{ $common.getDictLabel(col.dictType, scope.row[col.field] + '') }}
|
{{ $common.getDictLabel(col.dictType, scope.row[col.field] + '') }}
|
||||||
</span>
|
</span>
|
||||||
<slot v-else-if="col.type == 'dynamic'" :name="col.field" :row="scope.row" :index="scope.$index" />
|
<slot v-else-if="col.type == 'dynamic'" :name="col.field" :row="scope.row" :index="scope.$index" />
|
||||||
|
<div v-else-if="col.type == 'switch'">
|
||||||
<el-switch
|
<el-switch
|
||||||
v-else-if="col.type == 'switch'"
|
v-if="col.if === undefined ? true : col.if(scope.row)"
|
||||||
v-model="scope.row[col.field]"
|
v-model="scope.row[col.field]"
|
||||||
:active-value="col.activeValue || 1"
|
:active-value="col.activeValue || 1"
|
||||||
:inactive-value="col.inactiveValue || 0"
|
:inactive-value="col.inactiveValue || 0"
|
||||||
@change="col.change(scope.row)"
|
@change="col.change(scope.row)"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
<div v-else-if="col.type == 'btns'">
|
<div v-else-if="col.type == 'btns'">
|
||||||
<template v-for="btn in col.btns">
|
<template v-for="btn in col.btns">
|
||||||
<el-button v-if="btn.if === undefined ? true : btn.if(scope.row)" :icon="btn.icon" :key="btn.label" v-permission="btn.permission" :type="btn.type" :size="btn.size || 'small'" :class="btn.class" @click="btn.click(scope.row, scope.$index)">
|
<el-button v-if="btn.if === undefined ? true : btn.if(scope.row)" :icon="btn.icon" :key="btn.label" v-permission="btn.permission" :type="btn.type" :size="btn.size || 'small'" :class="btn.class" @click="btn.click(scope.row, scope.$index)">
|
||||||
|
|||||||
@@ -118,18 +118,22 @@ function getList() {
|
|||||||
} else {
|
} else {
|
||||||
newWhere.size = 99999999
|
newWhere.size = 99999999
|
||||||
}
|
}
|
||||||
request({
|
var then = (res) => {
|
||||||
url: props.url,
|
|
||||||
method: props.method,
|
|
||||||
params: newWhere,
|
|
||||||
data: newWhere
|
|
||||||
}).then(res => {
|
|
||||||
const { data } = res
|
const { data } = res
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
listLoading.value = false
|
listLoading.value = false
|
||||||
props.done()
|
props.done()
|
||||||
|
}
|
||||||
|
if(props.method.toLowerCase() == 'post'){
|
||||||
|
proxy.$post(props.url, newWhere).then(res => {
|
||||||
|
then(res)
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
proxy.$get(props.url, newWhere).then(res => {
|
||||||
|
then(res)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortChange(column) {
|
function sortChange(column) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-checkbox-group
|
<el-checkbox-group
|
||||||
v-model="modelValue"
|
v-model="selectValue"
|
||||||
:size="size"
|
:size="size"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:min="min"
|
:min="min"
|
||||||
@@ -9,25 +9,24 @@
|
|||||||
:fill="fill"
|
:fill="fill"
|
||||||
@change="change"
|
@change="change"
|
||||||
>
|
>
|
||||||
<el-checkbox-button v-if="button" v-for="it in options" v-bind="it" :label="it[valueField]">
|
<el-checkbox-button v-if="button" v-for="it in checkboxOptions" v-bind="it" :label="it[valueField]">
|
||||||
{{ it[labelField] }}
|
{{ it[labelField] }}
|
||||||
</el-checkbox-button>
|
</el-checkbox-button>
|
||||||
<el-checkbox v-if="!button" v-for="it in options" v-bind="it" :label="it[valueField]">
|
<el-checkbox v-if="!button" v-for="it in checkboxOptions" v-bind="it" :label="it[valueField]">
|
||||||
{{ it[labelField] }}
|
{{ it[labelField] }}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {watch, ref, getCurrentInstance} from "vue";
|
import {watch, ref, getCurrentInstance, onMounted} from "vue";
|
||||||
import request from '@/scripts/request'
|
import request from '@/scripts/request'
|
||||||
const emit = defineEmits(['update:modelValue', 'change'])
|
const emit = defineEmits(['update:modelValue', 'change'])
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Array,
|
required: true
|
||||||
default: () => []
|
|
||||||
},
|
},
|
||||||
type: String,
|
type: String,
|
||||||
button: {
|
button: {
|
||||||
@@ -36,7 +35,7 @@ import {watch, ref, getCurrentInstance} from "vue";
|
|||||||
},
|
},
|
||||||
options: Array,
|
options: Array,
|
||||||
url: String,
|
url: String,
|
||||||
params: Object,
|
data: Object,
|
||||||
method: {
|
method: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'get'
|
default: 'get'
|
||||||
@@ -63,31 +62,72 @@ import {watch, ref, getCurrentInstance} from "vue";
|
|||||||
fill: {
|
fill: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '#409EFF'
|
default: '#409EFF'
|
||||||
|
},
|
||||||
|
join: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const options = ref([])
|
const selectValue = ref([])
|
||||||
|
const checkboxOptions = ref([])
|
||||||
|
|
||||||
if(props.type){
|
watch(() => [props.type, props.url, props.options], () => {
|
||||||
options.value = proxy.$common.getDictType(props.type)
|
loadData()
|
||||||
}else if(props.url){
|
}, { deep: true })
|
||||||
request({
|
|
||||||
url: props.url,
|
watch(() => props.modelValue, (value) => {
|
||||||
method: props.method,
|
setValue(value)
|
||||||
params: props.params,
|
|
||||||
data: props.params
|
|
||||||
}).then(res => {
|
|
||||||
options.value = res.data.list || res.data
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(selectValue, (value) => {
|
||||||
|
if(props.join){
|
||||||
|
emit('update:modelValue', value.join(','))
|
||||||
|
emit('change', value.join(','))
|
||||||
|
}else{
|
||||||
|
emit('update:modelValue', value)
|
||||||
|
emit('change', value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadData()
|
||||||
|
})
|
||||||
|
|
||||||
|
function setValue(value){
|
||||||
|
if(value){
|
||||||
|
if(props.join){
|
||||||
|
selectValue.value = value.split(',')
|
||||||
|
}else{
|
||||||
|
selectValue.value = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadData(){
|
||||||
|
if(props.type){
|
||||||
|
checkboxOptions.value = proxy.$common.getDictType(props.type)
|
||||||
|
setValue(props.modelValue)
|
||||||
|
}else if(props.url){
|
||||||
|
if(props.method.toLowerCase() == 'post'){
|
||||||
|
proxy.$post(props.url, props.data).then(res => {
|
||||||
|
checkboxOptions.value = res.data.list || res.data
|
||||||
|
setValue(props.modelValue)
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
proxy.$get(props.url, props.data).then(res => {
|
||||||
|
checkboxOptions.value = res.data.list || res.data
|
||||||
|
setValue(props.modelValue)
|
||||||
|
})
|
||||||
|
}
|
||||||
}else if(props.options){
|
}else if(props.options){
|
||||||
options.value = props.options
|
checkboxOptions.value = props.options
|
||||||
|
setValue(props.modelValue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function change(value){
|
function change(value){
|
||||||
emit('change', value)
|
emit('change', value)
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => props.modelValue, (value) => {
|
|
||||||
emit('update:modelValue', value)
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
},
|
},
|
||||||
options: Array,
|
options: Array,
|
||||||
url: String,
|
url: String,
|
||||||
params: Object,
|
data: Object,
|
||||||
method: {
|
method: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'get'
|
default: 'get'
|
||||||
@@ -64,14 +64,18 @@
|
|||||||
if(props.type){
|
if(props.type){
|
||||||
options.value = proxy.$common.getDictType(props.type)
|
options.value = proxy.$common.getDictType(props.type)
|
||||||
}else if(props.url){
|
}else if(props.url){
|
||||||
request({
|
var then = (res) => {
|
||||||
url: props.url,
|
|
||||||
method: props.method,
|
|
||||||
params: props.params,
|
|
||||||
data: props.params
|
|
||||||
}).then(res => {
|
|
||||||
options.value = res.data.list || res.data
|
options.value = res.data.list || res.data
|
||||||
|
}
|
||||||
|
if(props.method.toLowerCase() == 'post'){
|
||||||
|
proxy.$post(props.url, props.data).then(res => {
|
||||||
|
then(res)
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
proxy.$get(props.url, props.data).then(res => {
|
||||||
|
then(res)
|
||||||
|
})
|
||||||
|
}
|
||||||
}else if(props.options){
|
}else if(props.options){
|
||||||
options.value = props.options
|
options.value = props.options
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-select v-if="mbType === 'select'" v-model="selectValue" v-bind="el" :style="{ width }" :placeholder="placeholder || '请选择'" filterable clearable>
|
<el-select v-model="selectValue" v-bind="props.props" :multiple="multiple" :style="{ width }" :placeholder="placeholder || (itemLabel && '请输入' + itemLabel)" filterable clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in selectList"
|
v-for="item in selectList"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@@ -7,11 +7,6 @@
|
|||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-radio-group v-if="mbType === 'radio'" v-model="selectValue">
|
|
||||||
<el-radio v-for="item in selectList" :key="item.value" :label="item.value">
|
|
||||||
{{ item.label }}
|
|
||||||
</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -23,25 +18,16 @@ const { proxy } = getCurrentInstance()
|
|||||||
const emit = defineEmits(['update:modelValue', 'change'])
|
const emit = defineEmits(['update:modelValue', 'change'])
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
modelValue: {
|
||||||
type: Array,
|
required: true
|
||||||
default: () => []
|
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
// eslint-disable-next-line vue/require-prop-types
|
options: {
|
||||||
modelValue: {
|
type: Array,
|
||||||
required: true
|
default: () => []
|
||||||
},
|
|
||||||
width: {
|
|
||||||
type: String,
|
|
||||||
default: '100%'
|
|
||||||
},
|
|
||||||
allOption: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
},
|
||||||
url: {
|
url: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -59,72 +45,77 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'value'
|
default: 'value'
|
||||||
},
|
},
|
||||||
mbType: {
|
props: {
|
||||||
type: String,
|
|
||||||
default: 'select'
|
|
||||||
},
|
|
||||||
el: {
|
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {}
|
default: () => {}
|
||||||
},
|
},
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '100%'
|
||||||
|
},
|
||||||
|
allOption: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
placeholder: {
|
placeholder: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
itemLabel: String,
|
||||||
|
multiple: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
join: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const selectList = ref([])
|
const selectList = ref([])
|
||||||
const selectValue = ref('')
|
const selectValue = ref(props.multiple ? [] : '')
|
||||||
|
|
||||||
watch(() => props.type, () => {
|
watch(() => [props.type, props.url, props.options], () => {
|
||||||
if (props.modelValue instanceof Array || props.modelValue.toString().indexOf(',') !== -1) {
|
|
||||||
selectValue.value = []
|
|
||||||
} else {
|
|
||||||
selectValue.value = ''
|
|
||||||
}
|
|
||||||
loadData()
|
loadData()
|
||||||
})
|
}, { deep: true })
|
||||||
|
|
||||||
watch(() => props.modelValue, () => {
|
watch(() => props.modelValue, (value) => {
|
||||||
loadData()
|
setValue(value)
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(selectValue, (value) => {
|
watch(selectValue, (value) => {
|
||||||
if (props.el && props.el.multiple && value.length > 0) {
|
if(props.multiple && props.join){
|
||||||
value = value.join(',')
|
emit('update:modelValue', value.join(','))
|
||||||
}
|
emit('change', value.join(','))
|
||||||
|
}else{
|
||||||
emit('update:modelValue', value)
|
emit('update:modelValue', value)
|
||||||
emit('change', value)
|
emit('change', value)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadData()
|
loadData()
|
||||||
})
|
})
|
||||||
|
|
||||||
async function loadData() {
|
function setValue(value){
|
||||||
if (props.modelValue || props.modelValue == '') {
|
if(value){
|
||||||
if ((!(props.modelValue instanceof Array) && props.modelValue.toString().indexOf(',') !== -1)) {
|
if(props.multiple && props.join){
|
||||||
selectValue.value = props.modelValue.split(',')
|
selectValue.value = value.split(',')
|
||||||
}else{
|
}else{
|
||||||
if (props.el && props.el.multiple && !(props.modelValue instanceof Array)) {
|
selectValue.value = value
|
||||||
selectValue.value = [props.modelValue]
|
|
||||||
} else {
|
|
||||||
selectValue.value = props.modelValue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (props.el && props.el.multiple) {
|
|
||||||
selectValue.value = []
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (props.data && props.data.length > 0) {
|
function loadData() {
|
||||||
listConcat(handlerData(props.data))
|
if(props.type){
|
||||||
|
listConcat(proxy.$common.getDictType(props.type))
|
||||||
}else if(props.url){
|
}else if(props.url){
|
||||||
proxy.$get(props.url, props.params).then(res => {
|
proxy.$get(props.url, props.params).then(res => {
|
||||||
listConcat(handlerData(res.data.list || res.data))
|
listConcat(handlerData(res.data.list || res.data))
|
||||||
})
|
})
|
||||||
} else {
|
}else if(props.options && props.options.length > 0){
|
||||||
listConcat(proxy.$common.getDictType(props.type))
|
listConcat(handlerData(props.options))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,6 +129,7 @@ function listConcat(dictData) {
|
|||||||
} else {
|
} else {
|
||||||
selectList.value = dictData
|
selectList.value = dictData
|
||||||
}
|
}
|
||||||
|
setValue(props.modelValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlerData(data) {
|
function handlerData(data) {
|
||||||
|
|||||||
@@ -171,4 +171,8 @@ common.setDefaultValue = (obj, attr, value) => {
|
|||||||
obj[attr] = obj[attr] === undefined ? value : obj[attr]
|
obj[attr] = obj[attr] === undefined ? value : obj[attr]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.isComma = (value) => {
|
||||||
|
return value.toString().indexOf(',') !== -1
|
||||||
|
}
|
||||||
|
|
||||||
export default common
|
export default common
|
||||||
|
|||||||
@@ -1,138 +0,0 @@
|
|||||||
<template>
|
|
||||||
<el-form
|
|
||||||
ref="dataForm"
|
|
||||||
:rules="rules"
|
|
||||||
:model="temp"
|
|
||||||
v-bind="form.el"
|
|
||||||
:label-position="form.el.labelPosition === undefined ? 'right' : form.el.labelPosition"
|
|
||||||
:label-width="form.el.labelWidth === undefined ? '120px' : form.el.labelWidth"
|
|
||||||
:style="form.el.style === undefined ? '' : form.el.style"
|
|
||||||
>
|
|
||||||
<el-row v-for="(row,i) in form.rows" :key="i" :gutter="row.gutter">
|
|
||||||
<el-col v-for="(col,j) in row.cols" :key="j" :span="col.span" v-bind="col.colEl">
|
|
||||||
<el-form-item :label="col.label" :label-width="col.labelWidth" :prop="col.name" v-bind="col.formItemEl">
|
|
||||||
<el-switch
|
|
||||||
v-if="col.type === 'switch'"
|
|
||||||
v-model="temp[col.name]"
|
|
||||||
:active-value="col.activeValue"
|
|
||||||
:inactive-value="col.inactiveValue"
|
|
||||||
/>
|
|
||||||
<el-checkbox-group v-else-if="col.type === 'checkboxGroup'" v-model="temp[col.name]" size="small">
|
|
||||||
<el-checkbox v-for="checkboxIt in temp['_'+col.name]" :key="checkboxIt[col.defaultValue.value]" :label="checkboxIt[col.defaultValue.value]">{{ checkboxIt[col.defaultValue.text] }}</el-checkbox>
|
|
||||||
</el-checkbox-group>
|
|
||||||
<mb-select v-else-if="col.type === 'select'" v-model="temp[col.name]" v-bind="col.el" />
|
|
||||||
<el-input v-else v-model="temp[col.name]" :type="col.type" :value="col.defaultValue" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'CommonForm',
|
|
||||||
props: {
|
|
||||||
visible: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
form: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
},
|
|
||||||
detail: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
},
|
|
||||||
params: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
rules: {
|
|
||||||
},
|
|
||||||
temp: this.getTemp()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
dialogVisible: {
|
|
||||||
get() {
|
|
||||||
return this.visible
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
this.$emit('update:visible', val)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
visible(newVal) {
|
|
||||||
this.temp = this.getTemp()
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$refs['dataForm'].clearValidate()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.form.el = this.form.el || {}
|
|
||||||
this.form.rows.forEach(row => {
|
|
||||||
row.cols.forEach(col => {
|
|
||||||
if (col.rule) {
|
|
||||||
this.$set(this.rules, col.name, col.rule)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getTemp() {
|
|
||||||
var _temp = {}
|
|
||||||
this.form.rows.forEach(row => {
|
|
||||||
row.cols.forEach(col => {
|
|
||||||
if (col.type === 'checkboxGroup') {
|
|
||||||
_temp[col.name] = []
|
|
||||||
this.$request({
|
|
||||||
url: col.defaultValue.request.url,
|
|
||||||
method: col.defaultValue.request.method
|
|
||||||
}).then(res => {
|
|
||||||
const { data } = res
|
|
||||||
this.$set(this.temp, '_' + col.name, data)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
_temp[col.name] = col.defaultValue || ''
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
return _temp
|
|
||||||
},
|
|
||||||
save() {
|
|
||||||
this.$refs['dataForm'].validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
this.$post(this.form.request.url, this.temp).then(res => {
|
|
||||||
this.dialogVisible = false
|
|
||||||
this.$notify({
|
|
||||||
title: '成功',
|
|
||||||
message: (!this.temp.id ? '创建' : '修改') + '成功',
|
|
||||||
type: 'success',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
this.$emit('reload-table')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getDetail(row) {
|
|
||||||
this.temp.id = row.id
|
|
||||||
this.$get(this.detail.request.url, { id: row.id }).then(res => {
|
|
||||||
const { data } = res
|
|
||||||
for (var t in this.temp) {
|
|
||||||
if (data[t] && (!this.detail.excludeAssign || this.detail.excludeAssign.indexOf(t) === -1)) {
|
|
||||||
this.$set(this.temp, t, data[t])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<div class="filter-container">
|
|
||||||
<el-form :inline="true">
|
|
||||||
<el-form-item v-for="col in queryOptions.cols" :key="col.field" :label="col.title">
|
|
||||||
<el-input v-if="col.type === 'input'" v-model="tableOptions.where[col.field]" v-bind="col.el" :placeholder="'请输入'+col.title" :style="col.style" />
|
|
||||||
<mb-select v-else-if="col.type === 'select'" v-model="tableOptions.where[col.field]" v-bind="col.el" width="100%" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item v-for="(btn, i) in queryOptions.btns" :key="i">
|
|
||||||
<el-button v-if="btn.type == 'query'" class="filter-item" type="primary" icon="el-icon-search" @click="reloadTable">
|
|
||||||
搜索
|
|
||||||
</el-button>
|
|
||||||
<el-button v-if="btn.type == 'export'" :loading="downloadLoading" class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload">
|
|
||||||
导出
|
|
||||||
</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<template v-if="toolOptions && toolOptions.btns">
|
|
||||||
<hr>
|
|
||||||
<el-row class="tool-row">
|
|
||||||
<div v-for="(btn, i) in toolOptions.btns" :key="'toolBtn' + i">
|
|
||||||
<el-button v-if="btn.btnType == 'add'" class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">
|
|
||||||
添加
|
|
||||||
</el-button>
|
|
||||||
<mb-button
|
|
||||||
v-else
|
|
||||||
:el="btn.el || {}"
|
|
||||||
:request-url="btn.request.url"
|
|
||||||
:request-data="toolBtnData[i]"
|
|
||||||
:btn-type="btn.btnType"
|
|
||||||
:before-confirm="btn.beforeConfirm"
|
|
||||||
:is-open="btn.isOpen"
|
|
||||||
:success-tips="btn.successTips"
|
|
||||||
:fail-tips="btn.failTips"
|
|
||||||
:after-handler="btn.afterHandler"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</el-row>
|
|
||||||
<hr>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<mb-table ref="table" v-bind="tableOptions" @selection-change="selectionChange" />
|
|
||||||
|
|
||||||
<mb-dialog :params="formParams" v-bind="formConfig && formConfig.dialog" :visible.sync="dialogFormVisible" @confirm-click="$refs.inputForm.save()">
|
|
||||||
<template #content>
|
|
||||||
<common-form ref="inputForm" v-bind="formConfig" :visible.sync="dialogFormVisible" :dialog-status="dialogStatus" @reload-table="reloadTable" />
|
|
||||||
</template>
|
|
||||||
</mb-dialog>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import CommonForm from './form'
|
|
||||||
|
|
||||||
var _this
|
|
||||||
export default {
|
|
||||||
name: 'CommonList',
|
|
||||||
components: { CommonForm },
|
|
||||||
props: {
|
|
||||||
formConfig: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
},
|
|
||||||
queryOptions: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
},
|
|
||||||
toolOptions: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
},
|
|
||||||
tableOptions: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
formParams: {},
|
|
||||||
formComponent: '',
|
|
||||||
dialogFormVisible: false,
|
|
||||||
dialogStatus: 'create',
|
|
||||||
downloadLoading: false,
|
|
||||||
selectionData: [],
|
|
||||||
toolBtnData: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
_this = this
|
|
||||||
if (this.toolOptions && this.toolOptions.btns) {
|
|
||||||
this.toolOptions.btns.forEach((it, i) => {
|
|
||||||
if (it.btnType) {
|
|
||||||
if (it.btnType === 'delete') {
|
|
||||||
it.afterHandler = () => {
|
|
||||||
_this.reloadTable()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.tableOptions.where = this.tableOptions.where || _this.$set(this.tableOptions, 'where', {})
|
|
||||||
this.queryOptions.cols.forEach(it => this.$set(_this.tableOptions.where, it.field, ''))
|
|
||||||
this.tableOptions.cols.forEach(it => {
|
|
||||||
if (it.type === 'switch') {
|
|
||||||
it.change = (row) => {
|
|
||||||
this.$request(this.handlerRequest(it, row, {
|
|
||||||
id: row.id,
|
|
||||||
[it.field]: row[it.field]
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (it.type === 'btns') {
|
|
||||||
it.btns.forEach(btn => {
|
|
||||||
btn.click = (row) => {
|
|
||||||
if (btn.btnType === 'delete') {
|
|
||||||
this.$common.handleDelete({
|
|
||||||
url: btn.request.url,
|
|
||||||
id: row.id,
|
|
||||||
done: () => this.reloadTable()
|
|
||||||
})
|
|
||||||
} else if (btn.btnType === 'update') {
|
|
||||||
this.handleUpdate(row)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
selectionChange(columns) {
|
|
||||||
if (this.toolOptions && this.toolOptions.btns) {
|
|
||||||
this.toolOptions.btns.forEach((it, i) => { it && it.request && it.request.data && this.$set(this.toolBtnData, i, ({ ...it.request.data })) })
|
|
||||||
this.toolBtnData.forEach((it, i) => Object.keys(it).filter(key => it[key] === 'rowField').forEach(key => { this.$set(this.toolBtnData[i], key, columns.map(it => it[key]).join(',')) }))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handlerRequest(it, row, defaultData) {
|
|
||||||
var requestOptions = {}
|
|
||||||
requestOptions.url = it.request.url
|
|
||||||
requestOptions.method = it.request.method || 'get'
|
|
||||||
|
|
||||||
var requestData = {}
|
|
||||||
if (!it.request.data && defaultData) {
|
|
||||||
requestData = defaultData
|
|
||||||
} else {
|
|
||||||
requestData = it.request.data
|
|
||||||
for (var d in it.request.data) {
|
|
||||||
var value = requestData[d]
|
|
||||||
if (value === 'rowField') {
|
|
||||||
requestData[d] = row[d]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (requestOptions.method === 'get') {
|
|
||||||
requestOptions.params = requestData
|
|
||||||
} else {
|
|
||||||
requestOptions.data = requestData
|
|
||||||
}
|
|
||||||
return requestOptions
|
|
||||||
},
|
|
||||||
reloadTable() {
|
|
||||||
this.$refs.table.reloadList()
|
|
||||||
},
|
|
||||||
handleCreate() {
|
|
||||||
this.dialogStatus = 'create'
|
|
||||||
this.dialogFormVisible = true
|
|
||||||
},
|
|
||||||
handleUpdate(row) {
|
|
||||||
this.dialogStatus = 'update'
|
|
||||||
this.dialogFormVisible = true
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$refs['inputForm'].getDetail(row)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleDownload() {
|
|
||||||
this.$common.exportExcel({
|
|
||||||
url: this.tableOptions.url,
|
|
||||||
headers: this.queryOptions.btns.filter(it => it.type === 'export')[0].headers,
|
|
||||||
columns: this.queryOptions.btns.filter(it => it.type === 'export')[0].columns,
|
|
||||||
where: this.tableOptions.where
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.tool-row {
|
|
||||||
margin-bottom: 6px
|
|
||||||
}
|
|
||||||
.tool-row > div {
|
|
||||||
display: inline-block;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<div style="padding: 50px;">
|
<div style="padding: 50px;">
|
||||||
<h2>多选</h2>
|
<h2>多选</h2>
|
||||||
<el-button type="primary" @click="getData" style="margin-bottom: 10px">获取数据</el-button>
|
<el-button type="primary" @click="getData" style="margin-bottom: 10px">获取数据</el-button>
|
||||||
<mb-select v-model="dictType" type="dict_type" :el="{ multiple: true }" />
|
<mb-select v-model="dictType" type="dict_type" multiple />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ const formOptions = reactive({
|
|||||||
cols: [{
|
cols: [{
|
||||||
span: 12,
|
span: 12,
|
||||||
name: 'input',
|
name: 'input',
|
||||||
label: 'input'
|
label: 'input',
|
||||||
|
rules: [{ required: true, message: '请输入input', trigger: 'change' }]
|
||||||
},{
|
},{
|
||||||
span: 12,
|
span: 12,
|
||||||
name: 'switch',
|
name: 'switch',
|
||||||
@@ -114,7 +115,7 @@ const formOptions = reactive({
|
|||||||
props: {
|
props: {
|
||||||
url: 'role/all',
|
url: 'role/all',
|
||||||
placeholder: '请选择角色',
|
placeholder: '请选择角色',
|
||||||
el: { multiple: true }
|
multiple: true
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
span: 12,
|
span: 12,
|
||||||
@@ -127,6 +128,6 @@ const formOptions = reactive({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
function getFormData(){
|
function getFormData(){
|
||||||
console.log(magicForm.value.getFormData())
|
console.log(magicForm.value.getFormData().select)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ const menuData = ref([])
|
|||||||
let searchValue = ref('')
|
let searchValue = ref('')
|
||||||
const tableOptions = reactive({
|
const tableOptions = reactive({
|
||||||
el: {
|
el: {
|
||||||
'default-expand-all': true,
|
|
||||||
'tree-props': { children: 'children', hasChildren: 'hasChildren' },
|
'tree-props': { children: 'children', hasChildren: 'hasChildren' },
|
||||||
'row-key': 'id'
|
'row-key': 'id'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -29,13 +29,19 @@
|
|||||||
{
|
{
|
||||||
field: 'type',
|
field: 'type',
|
||||||
label: '登录状态',
|
label: '登录状态',
|
||||||
|
width: '100px',
|
||||||
templet: (row) => {
|
templet: (row) => {
|
||||||
return row.type == '成功' ? '<b style="color: #409EFF">成功</b>' : '<b style="color: red">失败</b>'
|
return row.type == '成功' ? '<b style="color: #409EFF">成功</b>' : '<b style="color: red">失败</b>'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'address',
|
||||||
|
label: '登录地址'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'ip',
|
field: 'ip',
|
||||||
label: 'ip'
|
label: 'ip',
|
||||||
|
width: '150px'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'browser',
|
field: 'browser',
|
||||||
@@ -50,7 +56,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'createDate',
|
field: 'createDate',
|
||||||
label: '操作时间'
|
label: '操作时间',
|
||||||
|
width: '180px'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -28,15 +28,18 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'apiMethod',
|
field: 'apiMethod',
|
||||||
label: '方法'
|
label: '方法',
|
||||||
|
width: '100px'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'userIp',
|
field: 'userIp',
|
||||||
label: 'ip'
|
label: 'ip',
|
||||||
|
width: '150px'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'costTime',
|
field: 'costTime',
|
||||||
label: '耗时'
|
label: '耗时',
|
||||||
|
width: '100px'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'userAgent',
|
field: 'userAgent',
|
||||||
@@ -47,11 +50,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'username',
|
field: 'username',
|
||||||
label: '操作人'
|
label: '操作人',
|
||||||
|
width: '150px'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'createDate',
|
field: 'createDate',
|
||||||
label: '操作时间'
|
label: '操作时间',
|
||||||
|
width: '180px'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -182,6 +182,9 @@ const tableOptions = reactive({
|
|||||||
type: 'text',
|
type: 'text',
|
||||||
permission: 'office:delete',
|
permission: 'office:delete',
|
||||||
icon: 'ElDelete',
|
icon: 'ElDelete',
|
||||||
|
if: (row) => {
|
||||||
|
return row.pid != '0';
|
||||||
|
},
|
||||||
click: (row) => {
|
click: (row) => {
|
||||||
proxy.$common.handleDelete({
|
proxy.$common.handleDelete({
|
||||||
url: 'office/delete',
|
url: 'office/delete',
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="数据权限" prop="permission">
|
<el-form-item label="数据权限" prop="permission">
|
||||||
<mb-select v-model="temp.permission" :data="permissionData" />
|
<mb-select v-model="temp.permission" :options="permissionData" />
|
||||||
<mb-tree v-if="temp.permission == 1" max-height="270px" :el="{ 'check-strictly': true, 'show-checkbox': true }" ref="office" url="office/tree" v-model:select-values="temp.offices" />
|
<mb-tree v-if="temp.permission == 1" max-height="270px" :el="{ 'check-strictly': true, 'show-checkbox': true }" ref="office" url="office/tree" v-model:select-values="temp.offices" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</mb-dialog>
|
</mb-dialog>
|
||||||
|
|
||||||
<mb-dialog ref="assignPermissionsDialog" title="分配权限" width="750px" @confirm-click="assignPermissions.save($event)">
|
<mb-dialog ref="assignPermissionsDialog" title="分配权限" width="550px" @confirm-click="assignPermissions.save($event)">
|
||||||
<template #content>
|
<template #content>
|
||||||
<role-assign-permissions ref="assignPermissions" :key="Math.random()" :id="temp.id" @close="() => { assignPermissionsDialog.value.hide(); temp.id = '' }" />
|
<role-assign-permissions ref="assignPermissions" :key="Math.random()" :id="temp.id" @close="() => { assignPermissionsDialog.value.hide(); temp.id = '' }" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -32,11 +32,11 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="选择角色" prop="roles">
|
<el-form-item label="选择角色" prop="roles">
|
||||||
<mb-select v-model="temp.roles" url="role/all" placeholder="请选择角色" :el="{ multiple: true }" />
|
<mb-select v-model="temp.roles" url="role/all" placeholder="请选择角色" multiple />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-form-item label="登录状态" prop="isLogin">
|
<el-form-item label="登录状态" prop="isLogin" v-if="temp.id != '1'">
|
||||||
<el-radio-group v-model="temp.isLogin">
|
<el-radio-group v-model="temp.isLogin">
|
||||||
<el-radio-button label="0">有效</el-radio-button>
|
<el-radio-button label="0">有效</el-radio-button>
|
||||||
<el-radio-button label="1">锁定</el-radio-button>
|
<el-radio-button label="1">锁定</el-radio-button>
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ const tableOptions = reactive({
|
|||||||
value: '',
|
value: '',
|
||||||
properties: {
|
properties: {
|
||||||
url: 'role/all',
|
url: 'role/all',
|
||||||
el: { multiple: true }
|
multiple: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
officeId: ''
|
officeId: ''
|
||||||
@@ -118,6 +118,9 @@ const tableOptions = reactive({
|
|||||||
label: '禁止登录',
|
label: '禁止登录',
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
width: 100,
|
width: 100,
|
||||||
|
if: (row) => {
|
||||||
|
return row.id != '1'
|
||||||
|
},
|
||||||
change: (row) => {
|
change: (row) => {
|
||||||
proxy.$get('/user/change/login/status', {
|
proxy.$get('/user/change/login/status', {
|
||||||
id: row.id,
|
id: row.id,
|
||||||
@@ -150,6 +153,9 @@ const tableOptions = reactive({
|
|||||||
label: '删除',
|
label: '删除',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
icon: 'ElDelete',
|
icon: 'ElDelete',
|
||||||
|
if: (row) => {
|
||||||
|
return row.id != '1'
|
||||||
|
},
|
||||||
click: (row) => {
|
click: (row) => {
|
||||||
proxy.$common.handleDelete({
|
proxy.$common.handleDelete({
|
||||||
url: 'user/delete',
|
url: 'user/delete',
|
||||||
|
|||||||
Reference in New Issue
Block a user