|
|
@@ -1,37 +1,37 @@
|
|
|
<template>
|
|
|
- <app-drawer :title="t('system.menu.edit.title')" width="600" v-model:show="show" :refresh="refresh">
|
|
|
+ <app-drawer title="编辑" width="600" v-model:show="show" :refresh="refresh">
|
|
|
<el-form ref="formRef" class="el-form--vertical" label-width="90px" :model="formData" :rules="formRules"
|
|
|
:show-message="false">
|
|
|
- <el-form-item :label="t('system.menu.edit.authType')" prop="authType">
|
|
|
+ <el-form-item label="权限类型" prop="authType">
|
|
|
<el-radio-group v-model="formData.authType">
|
|
|
<template v-for="(item, index) in getAuthTypeList()" :key="index">
|
|
|
<el-radio :label="item.label" :value="item.value" />
|
|
|
</template>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
- <el-form-item :label="t('system.menu.edit.resourceLevel')">
|
|
|
+ <el-form-item label="所属层级">
|
|
|
<el-tree-select v-model="formData.parentCode" :data="menus" :empty-values="[null, undefined]"
|
|
|
value-key="resourceCode" default-expand-all>
|
|
|
<template #default="{ data }">
|
|
|
- <el-option :label="data.title || t('system.menu.edit.invalidTitle')" :value="data.resourceCode" />
|
|
|
+ <el-option :label="data.title || '[无效的标题]'" :value="data.resourceCode" />
|
|
|
</template>
|
|
|
</el-tree-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item :label="t('system.menu.edit.resourceTitle')" prop="title">
|
|
|
- <el-input v-model="formData.title" :placeholder="t('common.pleaseenter')" />
|
|
|
+ <el-form-item label="权限标题" prop="title">
|
|
|
+ <el-input v-model="formData.title" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item :label="t('system.menu.edit.resourceCode')" prop="resourceCode">
|
|
|
- <el-input v-model="formData.resourceCode" :placeholder="t('common.pleaseenter')" :disabled="!!record?.resourceCode" />
|
|
|
+ <el-form-item label="权限代码" prop="resourceCode">
|
|
|
+ <el-input v-model="formData.resourceCode" placeholder="请输入" :disabled="!!record?.resourceCode" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item :label="t('system.menu.edit.buttontype')" v-if="formData.authType === AuthType.Operate">
|
|
|
+ <el-form-item label="按钮样式" v-if="formData.authType === AuthType.Operate">
|
|
|
<div class="el-form-item--col">
|
|
|
<el-select v-model="formData.className" clearable>
|
|
|
- <el-option :label="t('system.menu.edit.default')" value="default" />
|
|
|
- <el-option :label="t('system.menu.edit.primary')" value="primary" />
|
|
|
- <el-option :label="t('system.menu.edit.success')" value="success" />
|
|
|
- <el-option :label="t('system.menu.edit.info')" value="info" />
|
|
|
- <el-option :label="t('system.menu.edit.warning')" value="warning" />
|
|
|
- <el-option :label="t('system.menu.edit.danger')" value="danger" />
|
|
|
+ <el-option label="默认" value="default" />
|
|
|
+ <el-option label="主要" value="primary" />
|
|
|
+ <el-option label="成功" value="success" />
|
|
|
+ <el-option label="信息" value="info" />
|
|
|
+ <el-option label="警告" value="warning" />
|
|
|
+ <el-option label="危险" value="danger" />
|
|
|
</el-select>
|
|
|
<el-button :type="formData.className">
|
|
|
<component :is="components.appIcon" :icon="formData.icon" />
|
|
|
@@ -39,11 +39,11 @@
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
- <el-form-item :label="t('system.menu.edit.icon')">
|
|
|
+ <el-form-item label="图标">
|
|
|
<component :is="components.appIconSelect" v-model="formData.icon" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item :label="t('system.menu.edit.url')" prop="url" v-if="formData.authType === AuthType.Menu">
|
|
|
- <el-input v-model="formData.url" :placeholder="t('common.pleaseenter')">
|
|
|
+ <el-form-item label="链接地址" prop="url" v-if="formData.authType === AuthType.Menu">
|
|
|
+ <el-input v-model="formData.url" placeholder="请输入">
|
|
|
<template #prepend>
|
|
|
<el-select v-model="formData.urlType" style="width: 120px">
|
|
|
<el-option :label="item.label" :value="item.value" v-for="(item, index) in getUrlTypeList()"
|
|
|
@@ -52,23 +52,23 @@
|
|
|
</template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item :label="t('system.menu.edit.component')" prop="component"
|
|
|
+ <el-form-item label="组件地址" prop="component"
|
|
|
v-if="formData.authType !== AuthType.Menu || formData.urlType === UrlType.Path">
|
|
|
- <el-input v-model="formData.component" :placeholder="t('common.pleaseenter')" />
|
|
|
+ <el-input v-model="formData.component" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
- <!-- <el-form-item :label="t('system.menu.edit.remark')" prop="remark">
|
|
|
- <el-input type="textarea" :rows="2" v-model="formData.remark" :placeholder="t('common.pleaseenter')" />
|
|
|
+ <!-- <el-form-item label="备注" prop="remark">
|
|
|
+ <el-input type="textarea" :rows="2" v-model="formData.remark" placeholder="请输入" />
|
|
|
</el-form-item> -->
|
|
|
- <el-form-item :label="t('system.menu.edit.sort')" prop="sort">
|
|
|
- <el-input-number v-model="formData.sort" :placeholder="t('common.pleaseenter')" />
|
|
|
+ <el-form-item label="排序" prop="sort">
|
|
|
+ <el-input-number v-model="formData.sort" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item :label="t('system.menu.edit.show')">
|
|
|
+ <el-form-item label="是否显示">
|
|
|
<el-switch v-model="formData.show" :active-value="1" :inactive-value="0" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
- <el-button @click="onCancel(false)">{{ t('operation.cancel') }}</el-button>
|
|
|
- <el-button type="primary" @click="onSubmit">{{ t('operation.submit') }}</el-button>
|
|
|
+ <el-button @click="onCancel(false)">取消</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit">提交</el-button>
|
|
|
</template>
|
|
|
</app-drawer>
|
|
|
</template>
|
|
|
@@ -79,7 +79,7 @@ import { ElMessage, FormInstance, FormRules } from 'element-plus'
|
|
|
import { hasValueInTree } from '@/filters'
|
|
|
import { AuthType, UrlType, getAuthTypeList, getUrlTypeList } from '@/constants/menu'
|
|
|
import { dealMenus } from '@/services/api/user'
|
|
|
-import { i18n, useRouterStore } from '@/stores'
|
|
|
+import { useRouterStore } from '@/stores'
|
|
|
import AppDrawer from '@pc/components/base/drawer/index.vue'
|
|
|
|
|
|
const components = {
|
|
|
@@ -93,7 +93,6 @@ const props = defineProps({
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-const { global: { t } } = i18n
|
|
|
const routerStore = useRouterStore()
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
|
const show = shallowRef(true)
|
|
|
@@ -104,7 +103,7 @@ const menus = computed(() => {
|
|
|
resourceCode: '',
|
|
|
parentCode: '',
|
|
|
authType: AuthType.Menu,
|
|
|
- title: t('system.menu.edit.parentitle'),
|
|
|
+ title: '一级菜单',
|
|
|
urlType: UrlType.Path,
|
|
|
url: '',
|
|
|
component: '',
|
|
|
@@ -181,13 +180,13 @@ const onSubmit = () => {
|
|
|
dealMenus({
|
|
|
data: rawData
|
|
|
}).then(() => {
|
|
|
- ElMessage.success(t('common.tips3'))
|
|
|
+ ElMessage.success('保存成功')
|
|
|
onCancel(true)
|
|
|
}).catch((err) => {
|
|
|
- ElMessage.error(t('common.tips4') + err)
|
|
|
+ ElMessage.error('保存失败:' + err)
|
|
|
})
|
|
|
} else {
|
|
|
- ElMessage.warning(t('system.menu.edit.code') + rawData.resourceCode + t('system.menu.edit.exist'))
|
|
|
+ ElMessage.warning('代码 ' + rawData.resourceCode + ' 已存在')
|
|
|
}
|
|
|
}
|
|
|
})
|