feat: 表单编辑按钮修改为传入menuid查询是否有权限
This commit is contained in:
@ -841,6 +841,7 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
||||
formIdComputedRef.value = currentRoute.value.meta.formId
|
||||
const schemaIdComputedRef = ref();
|
||||
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||
const menuId = currentRoute.value.meta.menuId;
|
||||
|
||||
${
|
||||
hasStartWorkButton
|
||||
@ -1019,15 +1020,11 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
||||
path: '/form/${lowerClassName}/' + record.id + '/viewForm',
|
||||
query: {
|
||||
formPath: '${model.outputConfig.outputValue}/${lowerClassName}',
|
||||
canEdit: canEdit()
|
||||
menuId: menuId
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// 判断是否显示编辑按钮编辑
|
||||
function canEdit() {
|
||||
return filterButtonAuth([{"code":"view"}]).length
|
||||
}
|
||||
|
||||
function buttonClick(code) {
|
||||
${
|
||||
@ -1353,7 +1350,7 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
||||
path: '/form/${lowerClassName}/' + record.id + '/viewForm',
|
||||
query: {
|
||||
formPath: '${model.outputConfig.outputValue}/${lowerClassName}',
|
||||
canEdit: canEdit()
|
||||
menuId: menuId
|
||||
}
|
||||
});`
|
||||
: `
|
||||
|
||||
@ -36,6 +36,7 @@ import { CheckCircleOutlined, StopOutlined, CloseOutlined, EditOutlined } from '
|
||||
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
import { edit } from '../generator/order/api';
|
||||
import { usePermissionStore } from '/@/store/modules/permission';
|
||||
const dynamicComponent = ref(null);
|
||||
const formType = ref('2'); // 0 新建 1 修改 2 查看
|
||||
const formRef = ref();
|
||||
@ -45,13 +46,14 @@ const { bus, FORM_LIST_MODIFIED } = useEventBus();
|
||||
const router = useRouter();
|
||||
const { currentRoute } = router;
|
||||
|
||||
const { formPath, canEdit } = currentRoute.value.query;
|
||||
const showEdit = ref(canEdit === '0' ? false : true)
|
||||
const { formPath, menuId } = currentRoute.value.query;
|
||||
const permissionStore = usePermissionStore();
|
||||
const pathArr = formPath.split('/');
|
||||
|
||||
const tabStore = useMultipleTabStore();
|
||||
const formProps = ref(null);
|
||||
const formId = ref(currentRoute.value?.params?.id);
|
||||
const showEdit = ref(editButtonAuth())
|
||||
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
@ -68,6 +70,19 @@ if (hash.indexOf('createForm') > 0) {
|
||||
dynamicComponent.value = defineAsyncComponent({
|
||||
loader: () => import(`./../../views/${pathArr[0]}/${pathArr[1]}/components/Form.vue`)
|
||||
});
|
||||
function editButtonAuth() {
|
||||
const perm = permissionStore.getPermCodeList.find((x) => x.menuId === menuId);
|
||||
let buttonAuth = perm?.buttonAuthCode || [];
|
||||
if (!buttonAuth || buttonAuth?.length === 0) {
|
||||
return [];
|
||||
}
|
||||
buttonAuth = buttonAuth.map((x) => {
|
||||
const btnList = x.split(':');
|
||||
btnList.shift();
|
||||
return btnList.join('');
|
||||
});
|
||||
return buttonAuth.includes('edit');
|
||||
}
|
||||
|
||||
function editForm() {
|
||||
mode.value = 'update'
|
||||
|
||||
Reference in New Issue
Block a user