diff --git a/src/utils/helper/generatorHelper.ts b/src/utils/helper/generatorHelper.ts index 3eb822d..ab6adf6 100644 --- a/src/utils/helper/generatorHelper.ts +++ b/src/utils/helper/generatorHelper.ts @@ -1478,6 +1478,7 @@ ${hasTemplatePrint ? ' reactive ' : ''} icon: button?.icon, tooltip: button?.name, onClick: handleView.bind(null, record), + code: button.code }); } if (['edit', 'copyData', 'delete'].includes(button.code)) { @@ -1507,18 +1508,6 @@ ${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', @@ -1537,12 +1526,7 @@ ${hasTemplatePrint ? ' reactive ' : ''} } function filterAction(list, record) { const result = list.filter((item)=> { - let conditions = item.tooltip !== '查看流转记录' - if (record.workflowData.enabled) { - conditions = conditions && item.tooltip !== '查看' - } else { - conditions = conditions && (item.tooltip === '查看' || item.tooltip === '删除') - } + let conditions = item.code !== 'view' return conditions }) return result @@ -1556,6 +1540,7 @@ ${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') { @@ -1563,13 +1548,21 @@ ${hasTemplatePrint ? ' reactive ' : ''} icon: button?.icon, tooltip: button?.name, onClick: btnEvent[button.code].bind(null, record), + code: button?.code }; } else { return {}; } } }); - return actionsList; + 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 }` } ${ diff --git a/src/views/secondDev/formCreatePage.vue b/src/views/secondDev/formCreatePage.vue index 76db627..917d29c 100644 --- a/src/views/secondDev/formCreatePage.vue +++ b/src/views/secondDev/formCreatePage.vue @@ -8,18 +8,18 @@ 关闭 - + - + - {{ item.name }} + 编辑 - + 保存 + @@ -32,31 +32,10 @@ import { FromPageType } from '/@/enums/workflowEnum'; import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive } from 'vue'; import { useMessage } from '/@/hooks/web/useMessage'; import { useI18n } from '/@/hooks/web/useI18n'; -import { CheckCircleOutlined, StopOutlined, CloseOutlined } from '@ant-design/icons-vue'; +import { CheckCircleOutlined, StopOutlined, CloseOutlined, EditOutlined } from '@ant-design/icons-vue'; import { useMultipleTabStore } from '/@/store/modules/multipleTab'; import useEventBus from '/@/hooks/event/useEventBus'; import { edit } from '../generator/order/api'; - -// const buttonList = reactive([]) -const allButtonList = [ - { - "isUse": true, - "name": "编辑", - "code": "edit", - "isDefault": true - }, - { - "isUse": true, - "name": "确认", - "code": "submit", - "isDefault": true - } -] -const btnEvent = { - edit: editForm, - submit: handleSubmit, - delete: deleteForm -} const dynamicComponent = ref(null); const formType = ref('2'); // 0 新建 1 修改 2 查看 const formRef = ref(); @@ -87,34 +66,15 @@ if (hash.indexOf('createForm') > 0) { mode.value = 'view'; } const type = ref('readonly') -const buttonList = computed(() => { - let buttonArr = [] - if (mode.value === 'create') { - buttonArr = allButtonList.filter(item => item.name === '确认') - } else { - if (type.value === 'readonly') { - buttonArr = allButtonList.filter(item => item.name !== '确认') - } else { - buttonArr = allButtonList.filter(item => item.name !== '编辑') - } - } - return buttonArr; -}); dynamicComponent.value = defineAsyncComponent({ loader: () => import(`./../../views/${pathArr[0]}/${pathArr[1]}/components/Form.vue`) }); -function btnEventHandle(code) { - btnEvent[code]() - -} function editForm() { type.value = 'edit' setFormType() } -function deleteForm() { -} function onFormMounted(_formProps) { formProps.value = _formProps; @@ -187,10 +147,6 @@ async function saveModal() {