feat: 新丰江 回滚表单编辑按钮逻辑
This commit is contained in:
@ -497,37 +497,3 @@ export function changeSchemaDisabled(schemas) {
|
|||||||
});
|
});
|
||||||
return schemas;
|
return schemas;
|
||||||
}
|
}
|
||||||
// 辅助设置表单可以编辑
|
|
||||||
export function changeSchemaEnable(schemas) {
|
|
||||||
const layoutComponents = ['tab', 'grid', 'card'];
|
|
||||||
schemas?.map((info) => {
|
|
||||||
if (layoutComponents.includes(info.type!)) {
|
|
||||||
info.children?.map((childInfo) => {
|
|
||||||
childInfo.list.map((com) => {
|
|
||||||
if (layoutComponents.includes(com.type)) {
|
|
||||||
changeSchemaDisabled(childInfo.list);
|
|
||||||
} else {
|
|
||||||
com.dynamicDisabled = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else if (info.type == 'table-layout') {
|
|
||||||
info.children?.map((childInfo) => {
|
|
||||||
childInfo.list.map((com) => {
|
|
||||||
com.children.map((el) => {
|
|
||||||
if (layoutComponents.includes(el.type) || el.type == 'table-layout') {
|
|
||||||
changeSchemaDisabled(com.children);
|
|
||||||
} else {
|
|
||||||
el.dynamicDisabled = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else if (info.type == 'one-for-one') {
|
|
||||||
changeSchemaDisabled(info.componentProps.childSchemas);
|
|
||||||
} else {
|
|
||||||
info.dynamicDisabled = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return schemas;
|
|
||||||
}
|
|
||||||
@ -841,7 +841,6 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
|||||||
formIdComputedRef.value = currentRoute.value.meta.formId
|
formIdComputedRef.value = currentRoute.value.meta.formId
|
||||||
const schemaIdComputedRef = ref();
|
const schemaIdComputedRef = ref();
|
||||||
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||||
const menuId = currentRoute.value.meta.menuId;
|
|
||||||
|
|
||||||
${
|
${
|
||||||
hasStartWorkButton
|
hasStartWorkButton
|
||||||
@ -1019,8 +1018,7 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
|||||||
router.push({
|
router.push({
|
||||||
path: '/form/${lowerClassName}/' + record.id + '/viewForm',
|
path: '/form/${lowerClassName}/' + record.id + '/viewForm',
|
||||||
query: {
|
query: {
|
||||||
formPath: '${model.outputConfig.outputValue}/${lowerClassName}',
|
formPath: '${model.outputConfig.outputValue}/${lowerClassName}'
|
||||||
menuId: menuId
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1349,8 +1347,7 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
|||||||
router.push({
|
router.push({
|
||||||
path: '/form/${lowerClassName}/' + record.id + '/viewForm',
|
path: '/form/${lowerClassName}/' + record.id + '/viewForm',
|
||||||
query: {
|
query: {
|
||||||
formPath: '${model.outputConfig.outputValue}/${lowerClassName}',
|
formPath: '${model.outputConfig.outputValue}/${lowerClassName}'
|
||||||
menuId: menuId
|
|
||||||
}
|
}
|
||||||
});`
|
});`
|
||||||
: `
|
: `
|
||||||
@ -1481,7 +1478,6 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
|||||||
icon: button?.icon,
|
icon: button?.icon,
|
||||||
tooltip: button?.name,
|
tooltip: button?.name,
|
||||||
onClick: handleView.bind(null, record),
|
onClick: handleView.bind(null, record),
|
||||||
code: button.code
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (['edit', 'copyData', 'delete'].includes(button.code)) {
|
if (['edit', 'copyData', 'delete'].includes(button.code)) {
|
||||||
@ -1511,6 +1507,18 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
|||||||
act.onClick = handleStartwork.bind(null, record);
|
act.onClick = handleStartwork.bind(null, record);
|
||||||
}
|
}
|
||||||
actionsList.unshift(act);
|
actionsList.unshift(act);
|
||||||
|
${
|
||||||
|
hasFlowRecordButton
|
||||||
|
? `if (hasFlowRecord) {
|
||||||
|
actionsList.splice(1, 0, {
|
||||||
|
tooltip: '查看流转记录',
|
||||||
|
icon: 'liuzhuanxinxi|svg',
|
||||||
|
onClick: handleFlowRecord.bind(null, record),
|
||||||
|
});
|
||||||
|
}`
|
||||||
|
: ''
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
actionsList.unshift({
|
actionsList.unshift({
|
||||||
icon: 'faqishenpi|svg',
|
icon: 'faqishenpi|svg',
|
||||||
@ -1525,14 +1533,7 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
|||||||
actionsList = actionsList.concat(editAndDelBtn);
|
actionsList = actionsList.concat(editAndDelBtn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filterAction(actionsList, record);
|
return actionsList;
|
||||||
}
|
|
||||||
function filterAction(list, record) {
|
|
||||||
const result = list.filter((item)=> {
|
|
||||||
let conditions = item.code !== 'view'
|
|
||||||
return conditions
|
|
||||||
})
|
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
: `
|
: `
|
||||||
@ -1543,7 +1544,6 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
|||||||
tooltip: button?.name,
|
tooltip: button?.name,
|
||||||
color: button.code === 'delete' ? 'error' : undefined,
|
color: button.code === 'delete' ? 'error' : undefined,
|
||||||
onClick: btnEvent[button.code].bind(null, record),
|
onClick: btnEvent[button.code].bind(null, record),
|
||||||
code: button?.code
|
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (button.code === 'view') {
|
if (button.code === 'view') {
|
||||||
@ -1551,21 +1551,13 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
|||||||
icon: button?.icon,
|
icon: button?.icon,
|
||||||
tooltip: button?.name,
|
tooltip: button?.name,
|
||||||
onClick: btnEvent[button.code].bind(null, record),
|
onClick: btnEvent[button.code].bind(null, record),
|
||||||
code: button?.code
|
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return filterAction(actionsList, record);
|
return actionsList;
|
||||||
}
|
|
||||||
function filterAction(list, record) {
|
|
||||||
const result = list.filter((item)=> {
|
|
||||||
let conditions = item.code === 'view' || item.code === 'delete'
|
|
||||||
return conditions
|
|
||||||
})
|
|
||||||
return result
|
|
||||||
}`
|
}`
|
||||||
}
|
}
|
||||||
${
|
${
|
||||||
|
|||||||
@ -8,17 +8,11 @@
|
|||||||
</slot>
|
</slot>
|
||||||
关闭
|
关闭
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button style="margin-right: 10px" type="primary" @click="editForm" v-if="mode === 'view' && showEdit">
|
<a-button v-if="mode != 'view'" type="primary" @click="handleSubmit">
|
||||||
<slot name="icon">
|
|
||||||
<edit-outlined />
|
|
||||||
</slot>
|
|
||||||
编辑
|
|
||||||
</a-button>
|
|
||||||
<a-button type="primary" @click="handleSubmit" v-else-if="showEdit">
|
|
||||||
<slot name="icon">
|
<slot name="icon">
|
||||||
<check-circle-outlined />
|
<check-circle-outlined />
|
||||||
</slot>
|
</slot>
|
||||||
保存
|
确认
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
@ -29,14 +23,13 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { FromPageType } from '/@/enums/workflowEnum';
|
import { FromPageType } from '/@/enums/workflowEnum';
|
||||||
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive } from 'vue';
|
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent } from 'vue';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
import { CheckCircleOutlined, StopOutlined, CloseOutlined, EditOutlined } from '@ant-design/icons-vue';
|
import { CheckCircleOutlined, StopOutlined, CloseOutlined } from '@ant-design/icons-vue';
|
||||||
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
|
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
|
||||||
import useEventBus from '/@/hooks/event/useEventBus';
|
import useEventBus from '/@/hooks/event/useEventBus';
|
||||||
import { edit } from '../generator/order/api';
|
|
||||||
import { usePermissionStore } from '/@/store/modules/permission';
|
|
||||||
const dynamicComponent = ref(null);
|
const dynamicComponent = ref(null);
|
||||||
const formType = ref('2'); // 0 新建 1 修改 2 查看
|
const formType = ref('2'); // 0 新建 1 修改 2 查看
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
@ -46,14 +39,12 @@ const { bus, FORM_LIST_MODIFIED } = useEventBus();
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { currentRoute } = router;
|
const { currentRoute } = router;
|
||||||
|
|
||||||
const { formPath, menuId } = currentRoute.value.query;
|
const { formPath } = currentRoute.value.query;
|
||||||
const permissionStore = usePermissionStore();
|
|
||||||
const pathArr = formPath.split('/');
|
const pathArr = formPath.split('/');
|
||||||
|
|
||||||
const tabStore = useMultipleTabStore();
|
const tabStore = useMultipleTabStore();
|
||||||
const formProps = ref(null);
|
const formProps = ref(null);
|
||||||
const formId = ref(currentRoute.value?.params?.id);
|
const formId = ref(currentRoute.value?.params?.id);
|
||||||
const showEdit = ref(editButtonAuth())
|
|
||||||
|
|
||||||
const { notification } = useMessage();
|
const { notification } = useMessage();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@ -70,24 +61,6 @@ if (hash.indexOf('createForm') > 0) {
|
|||||||
dynamicComponent.value = defineAsyncComponent({
|
dynamicComponent.value = defineAsyncComponent({
|
||||||
loader: () => import(`./../../views/${pathArr[0]}/${pathArr[1]}/components/Form.vue`)
|
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'
|
|
||||||
formRef.value.setEnabledForm();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onFormMounted(_formProps) {
|
function onFormMounted(_formProps) {
|
||||||
formProps.value = _formProps;
|
formProps.value = _formProps;
|
||||||
@ -156,6 +129,10 @@ async function saveModal() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
.page-bg-wrap {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
.top-toolbar {
|
.top-toolbar {
|
||||||
min-height: 44px;
|
min-height: 44px;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
|
|||||||
Reference in New Issue
Block a user