feat: 新丰江 回滚表单编辑按钮逻辑
This commit is contained in:
@ -497,37 +497,3 @@ export function changeSchemaDisabled(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
|
||||
const schemaIdComputedRef = ref();
|
||||
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||
const menuId = currentRoute.value.meta.menuId;
|
||||
|
||||
${
|
||||
hasStartWorkButton
|
||||
@ -1019,8 +1018,7 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
||||
router.push({
|
||||
path: '/form/${lowerClassName}/' + record.id + '/viewForm',
|
||||
query: {
|
||||
formPath: '${model.outputConfig.outputValue}/${lowerClassName}',
|
||||
menuId: menuId
|
||||
formPath: '${model.outputConfig.outputValue}/${lowerClassName}'
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1349,8 +1347,7 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
||||
router.push({
|
||||
path: '/form/${lowerClassName}/' + record.id + '/viewForm',
|
||||
query: {
|
||||
formPath: '${model.outputConfig.outputValue}/${lowerClassName}',
|
||||
menuId: menuId
|
||||
formPath: '${model.outputConfig.outputValue}/${lowerClassName}'
|
||||
}
|
||||
});`
|
||||
: `
|
||||
@ -1481,7 +1478,6 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: handleView.bind(null, record),
|
||||
code: button.code
|
||||
});
|
||||
}
|
||||
if (['edit', 'copyData', 'delete'].includes(button.code)) {
|
||||
@ -1511,6 +1507,18 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
||||
act.onClick = handleStartwork.bind(null, record);
|
||||
}
|
||||
actionsList.unshift(act);
|
||||
${
|
||||
hasFlowRecordButton
|
||||
? `if (hasFlowRecord) {
|
||||
actionsList.splice(1, 0, {
|
||||
tooltip: '查看流转记录',
|
||||
icon: 'liuzhuanxinxi|svg',
|
||||
onClick: handleFlowRecord.bind(null, record),
|
||||
});
|
||||
}`
|
||||
: ''
|
||||
}
|
||||
|
||||
} else {
|
||||
actionsList.unshift({
|
||||
icon: 'faqishenpi|svg',
|
||||
@ -1525,14 +1533,7 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
||||
actionsList = actionsList.concat(editAndDelBtn);
|
||||
}
|
||||
}
|
||||
return filterAction(actionsList, record);
|
||||
}
|
||||
function filterAction(list, record) {
|
||||
const result = list.filter((item)=> {
|
||||
let conditions = item.code !== 'view'
|
||||
return conditions
|
||||
})
|
||||
return result
|
||||
return actionsList;
|
||||
}
|
||||
`
|
||||
: `
|
||||
@ -1543,7 +1544,6 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
||||
tooltip: button?.name,
|
||||
color: button.code === 'delete' ? 'error' : undefined,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
code: button?.code
|
||||
};
|
||||
} else {
|
||||
if (button.code === 'view') {
|
||||
@ -1551,21 +1551,13 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
code: button?.code
|
||||
};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
});
|
||||
return filterAction(actionsList, record);
|
||||
}
|
||||
function filterAction(list, record) {
|
||||
const result = list.filter((item)=> {
|
||||
let conditions = item.code === 'view' || item.code === 'delete'
|
||||
return conditions
|
||||
})
|
||||
return result
|
||||
return actionsList;
|
||||
}`
|
||||
}
|
||||
${
|
||||
|
||||
@ -8,17 +8,11 @@
|
||||
</slot>
|
||||
关闭
|
||||
</a-button>
|
||||
<a-button style="margin-right: 10px" type="primary" @click="editForm" v-if="mode === 'view' && showEdit">
|
||||
<slot name="icon">
|
||||
<edit-outlined />
|
||||
</slot>
|
||||
编辑
|
||||
</a-button>
|
||||
<a-button type="primary" @click="handleSubmit" v-else-if="showEdit">
|
||||
<a-button v-if="mode != 'view'" type="primary" @click="handleSubmit">
|
||||
<slot name="icon">
|
||||
<check-circle-outlined />
|
||||
</slot>
|
||||
保存
|
||||
确认
|
||||
</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
@ -29,14 +23,13 @@
|
||||
<script setup>
|
||||
import { useRouter } from 'vue-router';
|
||||
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 { 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 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();
|
||||
@ -46,14 +39,12 @@ const { bus, FORM_LIST_MODIFIED } = useEventBus();
|
||||
const router = useRouter();
|
||||
const { currentRoute } = router;
|
||||
|
||||
const { formPath, menuId } = currentRoute.value.query;
|
||||
const permissionStore = usePermissionStore();
|
||||
const { formPath } = currentRoute.value.query;
|
||||
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();
|
||||
@ -70,24 +61,6 @@ 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'
|
||||
formRef.value.setEnabledForm();
|
||||
}
|
||||
|
||||
function onFormMounted(_formProps) {
|
||||
formProps.value = _formProps;
|
||||
@ -156,6 +129,10 @@ async function saveModal() {
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.page-bg-wrap {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.top-toolbar {
|
||||
min-height: 44px;
|
||||
margin-bottom: 12px;
|
||||
|
||||
Reference in New Issue
Block a user