32 changed files with 405 additions and 898 deletions
@ -1,76 +0,0 @@ |
|||
<template> |
|||
<q-editor v-model="editor" min-height="5rem" v-bind="attrs" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import { ref, computed, defineProps, useAttrs } from 'vue'; |
|||
import { FormValidators } from 'platform-core'; |
|||
|
|||
const editor = ref(); |
|||
const textareaRef = ref(); |
|||
const attrs = useAttrs(); |
|||
const inRules = attrs.rules; |
|||
const props = defineProps({ |
|||
hideIf: { |
|||
type: Function, |
|||
default: () => { |
|||
return false; |
|||
}, |
|||
}, |
|||
required: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
requiredIf: { |
|||
type: Function, |
|||
default: undefined, |
|||
}, |
|||
readonlyIf: { |
|||
type: Function, |
|||
default: () => { |
|||
return false; |
|||
}, |
|||
}, |
|||
disableIf: { |
|||
type: Function, |
|||
default: () => { |
|||
return false; |
|||
}, |
|||
}, |
|||
form: { |
|||
type: Object, |
|||
default: undefined, |
|||
}, |
|||
}); |
|||
|
|||
const rulesComputed = computed(() => { |
|||
let rules = inRules || <any>[]; |
|||
if (!hideIfComputed.value && requiredIfComputed.value) { |
|||
rules.push(FormValidators.required()); |
|||
} else if (hideIfComputed.value) { |
|||
rules = []; |
|||
} |
|||
if (textareaRef?.value) { |
|||
textareaRef.value.resetValidation(); |
|||
} |
|||
return rules; |
|||
}); |
|||
|
|||
const hideIfComputed = computed(() => { |
|||
return props.hideIf(props.form); |
|||
}); |
|||
const requiredIfComputed = computed(() => { |
|||
if (props.requiredIf) { |
|||
return props.requiredIf(props.form) || false; |
|||
} else if (props.required) { |
|||
return true; |
|||
} |
|||
return false; |
|||
}); |
|||
const readonlyIfComputed = computed(() => { |
|||
return props.readonlyIf(props.form); |
|||
}); |
|||
const disableIfComputed = computed(() => { |
|||
return props.disableIf(props.form); |
|||
}); |
|||
</script> |
@ -1,119 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<q-dialog ref="dialogRef" allow-focus-outside v-bind="attrs"> |
|||
<q-card |
|||
:style="{ |
|||
width: attrs.maximized ? '100vw' : width, |
|||
'max-width': '100vw', |
|||
height: attrs.maximized ? '100vh' : height, |
|||
'max-height': '100vh', |
|||
}" |
|||
> |
|||
<q-card-section :style="headerStyle"> |
|||
<div class="flex justify-between"> |
|||
<div class="text-h6">{{ title }}</div> |
|||
<div class="flex justify-end q-gutter-md"> |
|||
<q-btn :label="$t('confirm')" dense color="primary" style="width: 100px" @click="addMenu" /> |
|||
<q-btn v-close-popup dense flat icon="close" :title="$t('close')"> </q-btn> |
|||
</div> |
|||
</div> |
|||
</q-card-section> |
|||
<q-card-section class="q-pt-none" :style="bodyStyle"> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="name" type="input" label="名称" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="icon" type="input" label="图标" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-checkbox v-model="enable" label="是否可用" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="routeName" type="input" label="前端路由名称" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="routeQuery" type="input" label="前端路由参数" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="order" type="input" label="排序" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
</q-card-section> |
|||
</q-card> |
|||
</q-dialog> |
|||
</div> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { useAttrs, ref } from 'vue'; |
|||
import { useI18n } from 'vue-i18n'; |
|||
import { axios, Environment } from 'platform-core'; |
|||
|
|||
const attrs = useAttrs(); |
|||
|
|||
const props = defineProps({ |
|||
headerStyle: { type: String, default: 'width:100%;padding: 16px 8px 4px 16px' }, |
|||
bodyStyle: { type: String, default: 'padding: 0px 8px 0px 8px;height:calc(100%)' }, |
|||
title: { type: String, default: '' }, |
|||
width: { type: String, default: '70%' }, |
|||
height: { type: String, default: '70%' }, |
|||
}); |
|||
|
|||
const { t } = useI18n(); |
|||
|
|||
const dialogRef = ref(); |
|||
const parentIdRef = ref(); |
|||
const callbackRef = ref(); |
|||
|
|||
const name = ref(); |
|||
const icon = ref(); |
|||
const enable = ref(true); |
|||
const routeName = ref(); |
|||
const routeQuery = ref(); |
|||
const order = ref(0); |
|||
|
|||
const addMenu = () => { |
|||
const data = { |
|||
type: 'ROUTE', |
|||
enable: enable.value, |
|||
order: order.value, |
|||
parentId: parentIdRef.value, |
|||
name: name.value, |
|||
icon: icon.value, |
|||
routeName: routeName.value, |
|||
routeQuery: routeQuery.value, |
|||
}; |
|||
|
|||
axios.post(Environment.apiContextPath('/api/system/menu/addMenu'), data).then(() => { |
|||
dialogRef.value.hide(); |
|||
if (callbackRef.value) { |
|||
callbackRef.value(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const show = (parentId, callback) => { |
|||
parentIdRef.value = parentId; |
|||
callbackRef.value = callback; |
|||
dialogRef.value.show(); |
|||
}; |
|||
|
|||
const hide = () => { |
|||
dialogRef.value.hide(); |
|||
}; |
|||
|
|||
defineExpose({ |
|||
show, |
|||
hide, |
|||
}); |
|||
</script> |
@ -1,103 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<q-dialog ref="dialogRef" allow-focus-outside v-bind="attrs"> |
|||
<q-card |
|||
:style="{ |
|||
width: attrs.maximized ? '100vw' : width, |
|||
'max-width': '100vw', |
|||
height: attrs.maximized ? '100vh' : height, |
|||
'max-height': '100vh', |
|||
}" |
|||
> |
|||
<q-card-section :style="headerStyle"> |
|||
<div class="flex justify-between"> |
|||
<div class="text-h6">{{ title }}</div> |
|||
<div class="flex justify-end q-gutter-md"> |
|||
<q-btn :label="$t('confirm')" dense color="primary" style="width: 100px" @click="addMenu" /> |
|||
<q-btn v-close-popup dense flat icon="close" :title="$t('close')"> </q-btn> |
|||
</div> |
|||
</div> |
|||
</q-card-section> |
|||
<q-card-section class="q-pt-none" :style="bodyStyle"> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="name" type="input" label="名称" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="icon" type="input" label="图标" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-checkbox v-model="enable" label="是否可用" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="order" type="input" label="排序" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
</q-card-section> |
|||
</q-card> |
|||
</q-dialog> |
|||
</div> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { useAttrs, ref } from 'vue'; |
|||
import { useI18n } from 'vue-i18n'; |
|||
import { axios, Environment } from 'platform-core'; |
|||
|
|||
const attrs = useAttrs(); |
|||
|
|||
const props = defineProps({ |
|||
headerStyle: { type: String, default: 'width:100%;padding: 16px 8px 4px 16px' }, |
|||
bodyStyle: { type: String, default: 'padding: 0px 8px 0px 8px;height:calc(100%)' }, |
|||
title: { type: String, default: '' }, |
|||
width: { type: String, default: '70%' }, |
|||
height: { type: String, default: '70%' }, |
|||
}); |
|||
|
|||
const { t } = useI18n(); |
|||
|
|||
const dialogRef = ref(); |
|||
const callbackRef = ref(); |
|||
|
|||
const name = ref(); |
|||
const icon = ref(); |
|||
const enable = ref(true); |
|||
const order = ref(0); |
|||
|
|||
const addMenu = () => { |
|||
const data = { |
|||
type: 'ROUTE', |
|||
enable: enable.value, |
|||
order: order.value, |
|||
parentId: null, |
|||
name: name.value, |
|||
icon: icon.value, |
|||
}; |
|||
|
|||
axios.post(Environment.apiContextPath('/api/system/menu/addMenu'), data).then(() => { |
|||
dialogRef.value.hide(); |
|||
if (callbackRef.value) { |
|||
callbackRef.value(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const show = (callback) => { |
|||
callbackRef.value = callback; |
|||
dialogRef.value.show(); |
|||
}; |
|||
|
|||
const hide = () => { |
|||
dialogRef.value.hide(); |
|||
}; |
|||
|
|||
defineExpose({ |
|||
show, |
|||
hide, |
|||
}); |
|||
</script> |
@ -1,128 +0,0 @@ |
|||
<template> |
|||
<div> |
|||
<q-dialog ref="dialogRef" allow-focus-outside v-bind="attrs"> |
|||
<q-card |
|||
:style="{ |
|||
width: attrs.maximized ? '100vw' : width, |
|||
'max-width': '100vw', |
|||
height: attrs.maximized ? '100vh' : height, |
|||
'max-height': '100vh', |
|||
}" |
|||
> |
|||
<q-card-section :style="headerStyle"> |
|||
<div class="flex justify-between"> |
|||
<div class="text-h6">{{ title }}</div> |
|||
<div class="flex justify-end q-gutter-md"> |
|||
<q-btn :label="$t('confirm')" dense color="primary" style="width: 100px" @click="updateMenu" /> |
|||
<q-btn v-close-popup dense flat icon="close" :title="$t('close')"> </q-btn> |
|||
</div> |
|||
</div> |
|||
</q-card-section> |
|||
<q-card-section class="q-pt-none" :style="bodyStyle"> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="name" type="input" label="名称" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="icon" type="input" label="图标" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-checkbox v-model="enable" label="是否可用" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="routeName" type="input" label="前端路由名称" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="routeQuery" type="input" label="前端路由参数" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<q-input v-model="order" type="input" label="排序" outlined autocomplete="false" class="p-1" /> |
|||
</div> |
|||
</div> |
|||
</q-card-section> |
|||
</q-card> |
|||
</q-dialog> |
|||
</div> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { useAttrs, ref } from 'vue'; |
|||
import { useI18n } from 'vue-i18n'; |
|||
import { axios, Environment, Tools } from 'platform-core'; |
|||
|
|||
const attrs = useAttrs(); |
|||
|
|||
const props = defineProps({ |
|||
headerStyle: { type: String, default: 'width:100%;padding: 16px 8px 4px 16px' }, |
|||
bodyStyle: { type: String, default: 'padding: 0px 8px 0px 8px;height:calc(100%)' }, |
|||
title: { type: String, default: '' }, |
|||
width: { type: String, default: '70%' }, |
|||
height: { type: String, default: '70%' }, |
|||
}); |
|||
|
|||
const { t } = useI18n(); |
|||
|
|||
const dialogRef = ref(); |
|||
const parentIdRef = ref(); |
|||
const callbackRef = ref(); |
|||
|
|||
const id = ref(''); |
|||
const name = ref(''); |
|||
const icon = ref(''); |
|||
const enable = ref(true); |
|||
const routeName = ref(''); |
|||
const routeQuery = ref(''); |
|||
const order = ref(0); |
|||
|
|||
const updateMenu = () => { |
|||
const data = { |
|||
id: id.value, |
|||
type: 'ROUTE', |
|||
enable: enable.value, |
|||
order: order.value, |
|||
parentId: parentIdRef.value, |
|||
name: name.value, |
|||
icon: icon.value, |
|||
routeName: routeName.value, |
|||
routeQuery: routeQuery.value, |
|||
}; |
|||
|
|||
axios.post(Environment.apiContextPath('/api/system/menu/updateMenu'), data).then(() => { |
|||
dialogRef.value.hide(); |
|||
if (callbackRef.value) { |
|||
callbackRef.value(); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
const show = (node, callback) => { |
|||
callbackRef.value = callback; |
|||
|
|||
id.value = node.id; |
|||
name.value = node.name; |
|||
icon.value = node.icon; |
|||
enable.value = node.enable; |
|||
routeName.value = node.routeName; |
|||
routeQuery.value = Tools.object2Json(node.routeQuery || {}); |
|||
order.value = node.order; |
|||
dialogRef.value.show(); |
|||
}; |
|||
|
|||
const hide = () => { |
|||
dialogRef.value.hide(); |
|||
}; |
|||
|
|||
defineExpose({ |
|||
show, |
|||
hide, |
|||
}); |
|||
</script> |
@ -1,105 +0,0 @@ |
|||
<template> |
|||
<w-dialog |
|||
ref="dialogRef" |
|||
:title="$t('system.selectRoleByUserDialog.title')" |
|||
width="800px" |
|||
height="500px" |
|||
:can-maximize="false" |
|||
:buttons="[ |
|||
{ |
|||
label: $t('confirm'), |
|||
click: () => { |
|||
const roleIds = Tools.extractProperties(gridRef.getSelectedRows(), 'id'); |
|||
axios |
|||
.post(Environment.apiContextPath('/api/system/user/addRoles'), { |
|||
one: parentId, |
|||
many: roleIds, |
|||
}) |
|||
.then((response) => { |
|||
parentComponent?.refresh(); |
|||
close(); |
|||
}); |
|||
}, |
|||
}, |
|||
]" |
|||
> |
|||
<div class="px-2"> |
|||
<w-grid |
|||
ref="gridRef" |
|||
:title="$t('system.role.grid.title')" |
|||
selection="multiple" |
|||
:full-screen-button="false" |
|||
:toolbar-configure="{ noIcon: false }" |
|||
:toolbar-actions="['query', 'refresh']" |
|||
:query-form-fields="[ |
|||
{ name: 'code', label: $t('code'), type: 'text' }, |
|||
{ name: 'name', label: $t('name'), type: 'text' }, |
|||
{ |
|||
name: 'enable', |
|||
label: $t('enable'), |
|||
type: 'select', |
|||
options: Options.yesNo(), |
|||
queryOperator: 'equals', |
|||
}, |
|||
{ |
|||
name: 'dataComeFrom', |
|||
label: $t('dataComeFrom'), |
|||
type: 'select', |
|||
options: Options.enum(DataComeFromEnum), |
|||
queryOperator: 'equals', |
|||
}, |
|||
]" |
|||
:auto-fetch-data="false" |
|||
:fetch-data-url="Environment.apiContextPath('/api/system/role/queryOtherRolesByUser?userId=' + parentId)" |
|||
:columns="[ |
|||
{ name: 'code', label: $t('code') }, |
|||
{ name: 'name', label: $t('name') }, |
|||
{ |
|||
name: 'status', |
|||
label: t('status'), |
|||
format: Formater.enableTag(), |
|||
}, |
|||
{ name: 'lastModifier', label: t('lastModifier') }, |
|||
{ name: 'lastModifyDate', label: t('lastModifyDate') }, |
|||
]" |
|||
></w-grid> |
|||
</div> |
|||
</w-dialog> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { ref, nextTick } from 'vue'; |
|||
import { useI18n } from 'vue-i18n'; |
|||
import { axios, Environment, Tools, EnumTools, Options, Formater } from 'platform-core'; |
|||
|
|||
const { t } = useI18n(); |
|||
|
|||
const dialogRef = ref(); |
|||
const gridRef = ref(); |
|||
|
|||
let DataComeFromEnum = ref(); |
|||
EnumTools.fetch('io.sc.platform.orm.api.enums.DataComeFrom').then((data) => { |
|||
DataComeFromEnum.value = data; |
|||
}); |
|||
|
|||
let parentId, parentComponent; |
|||
|
|||
const open = (param: object) => { |
|||
parentId = param.parentId; |
|||
parentComponent = param.parentComponent; |
|||
|
|||
dialogRef.value.show(); |
|||
|
|||
nextTick(() => { |
|||
gridRef.value.refresh(); |
|||
}); |
|||
}; |
|||
|
|||
const close = () => { |
|||
dialogRef.value.hide(); |
|||
}; |
|||
|
|||
defineExpose({ |
|||
open, |
|||
close, |
|||
}); |
|||
</script> |
Loading…
Reference in new issue