feat: 新丰江 回滚表单编辑按钮逻辑
This commit is contained in:
@ -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