feat: 代码过滤逻辑 修改

This commit is contained in:
GAOANG
2024-04-24 18:19:12 +08:00
parent a2ce42f862
commit 60458f1dc8
2 changed files with 19 additions and 70 deletions

View File

@ -8,18 +8,18 @@
</slot>
关闭
</a-button>
<a-button v-for="item in buttonList" type="primary" @click="btnEventHandle(item.code)">
<a-button style="margin-right: 10px" type="primary" @click="editForm" v-if="mode === 'view' && type === 'readonly'">
<slot name="icon">
<check-circle-outlined />
<edit-outlined />
</slot>
{{ item.name }}
编辑
</a-button>
<!-- <a-button v-if="mode != 'read'" type="primary" @click="handleSubmit">
<a-button type="primary" @click="handleSubmit" v-else>
<slot name="icon">
<check-circle-outlined />
</slot>
确认
</a-button> -->
保存
</a-button>
</a-space>
</div>
<component :is="dynamicComponent" ref="formRef" :fromPage="FromPageType.MENU" @form-mounted="onFormMounted" />
@ -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() {
</script>
<style lang="less" scoped>
.page-bg-wrap {
background-color: #fff;
}
.top-toolbar {
min-height: 44px;
margin-bottom: 12px;