style: lint格式化文件
This commit is contained in:
@ -1,110 +1,108 @@
|
||||
<template>
|
||||
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
|
||||
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
|
||||
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
|
||||
</BasicModal>
|
||||
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, reactive } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { formProps } from './config';
|
||||
import ModalForm from './Form.vue';
|
||||
import { FromPageType } from '/@/enums/workflowEnum';
|
||||
import { ref, computed, reactive } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { formProps } from './config';
|
||||
import ModalForm from './Form.vue';
|
||||
import { FromPageType } from '/@/enums/workflowEnum';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { notification } = useMessage();
|
||||
const formRef = ref();
|
||||
const state = reactive({
|
||||
formModel: {},
|
||||
isUpdate: true,
|
||||
isView: false,
|
||||
isCopy: false,
|
||||
rowId: '',
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
state.isUpdate = !!data?.isUpdate;
|
||||
state.isView = !!data?.isView;
|
||||
state.isCopy = !!data?.isCopy;
|
||||
|
||||
setModalProps({
|
||||
destroyOnClose: true,
|
||||
maskClosable: false,
|
||||
showCancelBtn: !state.isView,
|
||||
showOkBtn: !state.isView,
|
||||
canFullscreen: true,
|
||||
width: 900,
|
||||
const { notification } = useMessage();
|
||||
const formRef = ref();
|
||||
const state = reactive({
|
||||
formModel: {},
|
||||
isUpdate: true,
|
||||
isView: false,
|
||||
isCopy: false,
|
||||
rowId: ''
|
||||
});
|
||||
if (state.isUpdate || state.isView || state.isCopy) {
|
||||
state.rowId = data.id;
|
||||
if (state.isView) {
|
||||
await formRef.value.setDisabledForm();
|
||||
}
|
||||
await formRef.value.setFormDataFromId(state.rowId);
|
||||
} else {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
});
|
||||
|
||||
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
|
||||
const { t } = useI18n();
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
state.isUpdate = !!data?.isUpdate;
|
||||
state.isView = !!data?.isView;
|
||||
state.isCopy = !!data?.isCopy;
|
||||
|
||||
async function saveModal() {
|
||||
let saveSuccess = false;
|
||||
try {
|
||||
const values = await formRef.value?.validate();
|
||||
//添加隐藏组件
|
||||
if (formProps.hiddenComponent?.length) {
|
||||
formProps.hiddenComponent.forEach((component) => {
|
||||
values[component.bindField] = component.value;
|
||||
setModalProps({
|
||||
destroyOnClose: true,
|
||||
maskClosable: false,
|
||||
showCancelBtn: !state.isView,
|
||||
showOkBtn: !state.isView,
|
||||
canFullscreen: true,
|
||||
width: 900
|
||||
});
|
||||
}
|
||||
if (values !== false) {
|
||||
try {
|
||||
if (!state.isUpdate || state.isCopy) {
|
||||
saveSuccess = await formRef.value.add(values);
|
||||
} else {
|
||||
saveSuccess = await formRef.value.update({ values, rowId: state.rowId });
|
||||
}
|
||||
return saveSuccess;
|
||||
} catch (error) {}
|
||||
}
|
||||
} catch (error) {
|
||||
return saveSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const saveSuccess = await saveModal();
|
||||
setModalProps({ confirmLoading: true });
|
||||
if (saveSuccess) {
|
||||
if (!state.isUpdate || state.isCopy) {
|
||||
//false 新增
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('新增成功!'),
|
||||
}); //提示消息
|
||||
if (state.isUpdate || state.isView || state.isCopy) {
|
||||
state.rowId = data.id;
|
||||
if (state.isView) {
|
||||
await formRef.value.setDisabledForm();
|
||||
}
|
||||
await formRef.value.setFormDataFromId(state.rowId);
|
||||
} else {
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('修改成功!'),
|
||||
}); //提示消息
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
});
|
||||
|
||||
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
|
||||
|
||||
async function saveModal() {
|
||||
let saveSuccess = false;
|
||||
try {
|
||||
const values = await formRef.value?.validate();
|
||||
//添加隐藏组件
|
||||
if (formProps.hiddenComponent?.length) {
|
||||
formProps.hiddenComponent.forEach((component) => {
|
||||
values[component.bindField] = component.value;
|
||||
});
|
||||
}
|
||||
if (values !== false) {
|
||||
try {
|
||||
if (!state.isUpdate || state.isCopy) {
|
||||
saveSuccess = await formRef.value.add(values);
|
||||
} else {
|
||||
saveSuccess = await formRef.value.update({ values, rowId: state.rowId });
|
||||
}
|
||||
return saveSuccess;
|
||||
} catch (error) {}
|
||||
}
|
||||
} catch (error) {
|
||||
return saveSuccess;
|
||||
}
|
||||
closeModal();
|
||||
formRef.value.resetFields();
|
||||
emit('success');
|
||||
}
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
</script>
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const saveSuccess = await saveModal();
|
||||
setModalProps({ confirmLoading: true });
|
||||
if (saveSuccess) {
|
||||
if (!state.isUpdate || state.isCopy) {
|
||||
//false 新增
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('新增成功!')
|
||||
}); //提示消息
|
||||
} else {
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('修改成功!')
|
||||
}); //提示消息
|
||||
}
|
||||
closeModal();
|
||||
formRef.value.resetFields();
|
||||
emit('success');
|
||||
}
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -1,206 +1,180 @@
|
||||
<template>
|
||||
<SimpleForm
|
||||
ref="systemFormRef"
|
||||
:formProps="data.formDataProps"
|
||||
:formModel="{}"
|
||||
:isWorkFlow="props.fromPage!=FromPageType.MENU"
|
||||
/>
|
||||
<SimpleForm ref="systemFormRef" :formProps="data.formDataProps" :formModel="{}" :isWorkFlow="props.fromPage != FromPageType.MENU" />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref, onMounted, createVNode } from 'vue';
|
||||
import { formProps, formEventConfigs } from './config';
|
||||
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
||||
import { addXjrWorkflowApproveRecord, getXjrWorkflowApproveRecord, updateXjrWorkflowApproveRecord, deleteXjrWorkflowApproveRecord } from '/@/api/auditOpt/auditRecord';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { FormDataProps } from '/@/components/Designer/src/types';
|
||||
import { usePermission } from '/@/hooks/web/usePermission';
|
||||
import { FromPageType } from '/@/enums/workflowEnum';
|
||||
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
|
||||
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
|
||||
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { Modal} from "ant-design-vue";
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
|
||||
const { filterFormSchemaAuth } = usePermission();
|
||||
import { reactive, ref, onMounted, createVNode } from 'vue';
|
||||
import { formProps, formEventConfigs } from './config';
|
||||
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
||||
import { addXjrWorkflowApproveRecord, getXjrWorkflowApproveRecord, updateXjrWorkflowApproveRecord, deleteXjrWorkflowApproveRecord } from '/@/api/auditOpt/auditRecord';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { FormDataProps } from '/@/components/Designer/src/types';
|
||||
import { usePermission } from '/@/hooks/web/usePermission';
|
||||
import { FromPageType } from '/@/enums/workflowEnum';
|
||||
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent } from '/@/hooks/web/useFormEvent';
|
||||
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
|
||||
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
|
||||
const RowKey = 'id';
|
||||
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
|
||||
const props = defineProps({
|
||||
fromPage: {
|
||||
type: Number,
|
||||
default: FromPageType.MENU,
|
||||
},
|
||||
});
|
||||
const systemFormRef = ref();
|
||||
const data: { formDataProps: FormDataProps } = reactive({
|
||||
formDataProps: cloneDeep(formProps),
|
||||
});
|
||||
const state = reactive({
|
||||
formModel: {},
|
||||
});
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
const { filterFormSchemaAuth } = usePermission();
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
if (props.fromPage == FromPageType.MENU) {
|
||||
setMenuPermission();
|
||||
await createFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:初始化表单
|
||||
await loadFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:加载表单
|
||||
} else if (props.fromPage == FromPageType.FLOW) {
|
||||
emits('loadingCompleted'); //告诉系统表单已经加载完毕
|
||||
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
|
||||
} else if (props.fromPage == FromPageType.PREVIEW) {
|
||||
// 预览 无需权限,表单事件也无需执行
|
||||
} else if (props.fromPage == FromPageType.DESKTOP) {
|
||||
// 桌面设计 表单事件需要执行
|
||||
emits('loadingCompleted'); //告诉系统表单已经加载完毕
|
||||
await createFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:初始化表单
|
||||
await loadFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:加载表单
|
||||
}
|
||||
emits('form-mounted', formProps);
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
});
|
||||
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
|
||||
function setMenuPermission() {
|
||||
data.formDataProps.schemas = filterFormSchemaAuth(formProps.schemas!);
|
||||
}
|
||||
|
||||
// 校验form 通过返回表单数据
|
||||
async function validate() {
|
||||
let values = [];
|
||||
try {
|
||||
values = await systemFormRef.value?.validate();
|
||||
//添加隐藏组件
|
||||
if (data.formDataProps.hiddenComponent?.length) {
|
||||
data.formDataProps.hiddenComponent.forEach((component) => {
|
||||
values[component.bindField] = component.value;
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
return values;
|
||||
}
|
||||
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
|
||||
async function setFormDataFromId(rowId, skipUpdate) {
|
||||
try {
|
||||
const record = await getXjrWorkflowApproveRecord(rowId);
|
||||
if (skipUpdate) {
|
||||
return record;
|
||||
}
|
||||
setFieldsValue(record);
|
||||
state.formModel = record;
|
||||
await getFormDataEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
|
||||
return record;
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
}
|
||||
// 辅助设置表单数据
|
||||
function setFieldsValue(record) {
|
||||
systemFormRef.value.setFieldsValue(record);
|
||||
}
|
||||
// 重置表单数据
|
||||
async function resetFields() {
|
||||
await systemFormRef.value.resetFields();
|
||||
}
|
||||
// 设置表单数据全部为Disabled 【查看】
|
||||
async function setDisabledForm(isDisabled) {
|
||||
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas),isDisabled);
|
||||
}
|
||||
// 获取行键值
|
||||
function getRowKey() {
|
||||
return RowKey;
|
||||
}
|
||||
// 更新api表单数据
|
||||
async function update({ values, rowId }) {
|
||||
try {
|
||||
values[RowKey] = rowId;
|
||||
state.formModel = values;
|
||||
let saveVal = await updateXjrWorkflowApproveRecord(values);
|
||||
await submitFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:提交表单
|
||||
return saveVal;
|
||||
} catch (error) {}
|
||||
}
|
||||
// 新增api表单数据
|
||||
async function add(values) {
|
||||
try {
|
||||
state.formModel = values;
|
||||
let saveVal = await addXjrWorkflowApproveRecord(values);
|
||||
await submitFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:提交表单
|
||||
return saveVal;
|
||||
} catch (error) {}
|
||||
}
|
||||
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
|
||||
async function setWorkFlowForm(obj: WorkFlowFormParams) {
|
||||
try {
|
||||
let flowData = changeWorkFlowForm(cloneDeep(formProps), obj);
|
||||
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
|
||||
data.formDataProps = buildOptionJson;
|
||||
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
|
||||
if (isViewProcess) {
|
||||
setDisabledForm(); //查看
|
||||
}
|
||||
state.formModel = formModels;
|
||||
setFieldsValue(formModels);
|
||||
} catch (error) {}
|
||||
await createFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:初始化表单
|
||||
await loadFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:加载表单
|
||||
}
|
||||
// 详情页删除功能
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteList([record]);
|
||||
}
|
||||
function deleteList(ids) {
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
content: '是否确认删除?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
deleteXjrWorkflowApproveRecord(ids).then((_) => {
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('删除成功!'),
|
||||
});
|
||||
});
|
||||
},
|
||||
onCancel() {
|
||||
},
|
||||
const RowKey = 'id';
|
||||
const emits = defineEmits(['changeUploadComponentIds', 'loadingCompleted', 'form-mounted']);
|
||||
const props = defineProps({
|
||||
fromPage: {
|
||||
type: Number,
|
||||
default: FromPageType.MENU
|
||||
}
|
||||
});
|
||||
}
|
||||
defineExpose({
|
||||
setFieldsValue,
|
||||
resetFields,
|
||||
validate,
|
||||
add,
|
||||
update,
|
||||
setFormDataFromId,
|
||||
setDisabledForm,
|
||||
setMenuPermission,
|
||||
setWorkFlowForm,
|
||||
getRowKey,
|
||||
handleDelete
|
||||
});
|
||||
</script>
|
||||
const systemFormRef = ref();
|
||||
const data: { formDataProps: FormDataProps } = reactive({
|
||||
formDataProps: cloneDeep(formProps)
|
||||
});
|
||||
const state = reactive({
|
||||
formModel: {}
|
||||
});
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
if (props.fromPage == FromPageType.MENU) {
|
||||
setMenuPermission();
|
||||
await createFormEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:初始化表单
|
||||
await loadFormEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:加载表单
|
||||
} else if (props.fromPage == FromPageType.FLOW) {
|
||||
emits('loadingCompleted'); //告诉系统表单已经加载完毕
|
||||
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
|
||||
} else if (props.fromPage == FromPageType.PREVIEW) {
|
||||
// 预览 无需权限,表单事件也无需执行
|
||||
} else if (props.fromPage == FromPageType.DESKTOP) {
|
||||
// 桌面设计 表单事件需要执行
|
||||
emits('loadingCompleted'); //告诉系统表单已经加载完毕
|
||||
await createFormEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:初始化表单
|
||||
await loadFormEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:加载表单
|
||||
}
|
||||
emits('form-mounted', formProps);
|
||||
} catch (error) {}
|
||||
});
|
||||
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
|
||||
function setMenuPermission() {
|
||||
data.formDataProps.schemas = filterFormSchemaAuth(formProps.schemas!);
|
||||
}
|
||||
|
||||
// 校验form 通过返回表单数据
|
||||
async function validate() {
|
||||
let values = [];
|
||||
try {
|
||||
values = await systemFormRef.value?.validate();
|
||||
//添加隐藏组件
|
||||
if (data.formDataProps.hiddenComponent?.length) {
|
||||
data.formDataProps.hiddenComponent.forEach((component) => {
|
||||
values[component.bindField] = component.value;
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
return values;
|
||||
}
|
||||
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
|
||||
async function setFormDataFromId(rowId, skipUpdate) {
|
||||
try {
|
||||
const record = await getXjrWorkflowApproveRecord(rowId);
|
||||
if (skipUpdate) {
|
||||
return record;
|
||||
}
|
||||
setFieldsValue(record);
|
||||
state.formModel = record;
|
||||
await getFormDataEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
|
||||
return record;
|
||||
} catch (error) {}
|
||||
}
|
||||
// 辅助设置表单数据
|
||||
function setFieldsValue(record) {
|
||||
systemFormRef.value.setFieldsValue(record);
|
||||
}
|
||||
// 重置表单数据
|
||||
async function resetFields() {
|
||||
await systemFormRef.value.resetFields();
|
||||
}
|
||||
// 设置表单数据全部为Disabled 【查看】
|
||||
async function setDisabledForm(isDisabled) {
|
||||
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas), isDisabled);
|
||||
}
|
||||
// 获取行键值
|
||||
function getRowKey() {
|
||||
return RowKey;
|
||||
}
|
||||
// 更新api表单数据
|
||||
async function update({ values, rowId }) {
|
||||
try {
|
||||
values[RowKey] = rowId;
|
||||
state.formModel = values;
|
||||
let saveVal = await updateXjrWorkflowApproveRecord(values);
|
||||
await submitFormEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:提交表单
|
||||
return saveVal;
|
||||
} catch (error) {}
|
||||
}
|
||||
// 新增api表单数据
|
||||
async function add(values) {
|
||||
try {
|
||||
state.formModel = values;
|
||||
let saveVal = await addXjrWorkflowApproveRecord(values);
|
||||
await submitFormEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:提交表单
|
||||
return saveVal;
|
||||
} catch (error) {}
|
||||
}
|
||||
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
|
||||
async function setWorkFlowForm(obj: WorkFlowFormParams) {
|
||||
try {
|
||||
let flowData = changeWorkFlowForm(cloneDeep(formProps), obj);
|
||||
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
|
||||
data.formDataProps = buildOptionJson;
|
||||
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
|
||||
if (isViewProcess) {
|
||||
setDisabledForm(); //查看
|
||||
}
|
||||
state.formModel = formModels;
|
||||
setFieldsValue(formModels);
|
||||
} catch (error) {}
|
||||
await createFormEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:初始化表单
|
||||
await loadFormEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:加载表单
|
||||
}
|
||||
// 详情页删除功能
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteList([record]);
|
||||
}
|
||||
function deleteList(ids) {
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
content: '是否确认删除?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
deleteXjrWorkflowApproveRecord(ids).then((_) => {
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('删除成功!')
|
||||
});
|
||||
});
|
||||
},
|
||||
onCancel() {}
|
||||
});
|
||||
}
|
||||
defineExpose({
|
||||
setFieldsValue,
|
||||
resetFields,
|
||||
validate,
|
||||
add,
|
||||
update,
|
||||
setFormDataFromId,
|
||||
setDisabledForm,
|
||||
setMenuPermission,
|
||||
setWorkFlowForm,
|
||||
getRowKey,
|
||||
handleDelete
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -1,396 +1,371 @@
|
||||
<template>
|
||||
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
|
||||
|
||||
|
||||
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
|
||||
<template #toolbar>
|
||||
<template v-for="button in tableButtonConfig" :key="button.code">
|
||||
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
|
||||
<template #icon>
|
||||
<Icon :icon="button.icon" />
|
||||
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
|
||||
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
|
||||
<template #toolbar>
|
||||
<template v-for="button in tableButtonConfig" :key="button.code">
|
||||
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
|
||||
<template #icon>
|
||||
<Icon :icon="button.icon" />
|
||||
</template>
|
||||
{{ button.name }}
|
||||
</a-button>
|
||||
<a-button v-else :type="button.type">
|
||||
<template #icon>
|
||||
<Icon :icon="button.icon" />
|
||||
</template>
|
||||
{{ button.name }}
|
||||
</a-button>
|
||||
</template>
|
||||
</template>
|
||||
{{ button.name }}
|
||||
</a-button>
|
||||
<a-button v-else :type="button.type">
|
||||
<template #icon>
|
||||
<Icon :icon="button.icon" />
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<TableAction :actions="getActions(record)" />
|
||||
</template>
|
||||
</template>
|
||||
{{ button.name }}
|
||||
</a-button>
|
||||
</template>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
</BasicTable>
|
||||
|
||||
<AuditRecordModal @register="registerModal" @success="handleSuccess" />
|
||||
|
||||
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<TableAction :actions="getActions(record)" />
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
|
||||
|
||||
|
||||
<AuditRecordModal @register="registerModal" @success="handleSuccess" />
|
||||
|
||||
<opinionDialog ref="opinionDlg" />
|
||||
</PageWrapper>
|
||||
<opinionDialog ref="opinionDlg" />
|
||||
</PageWrapper>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
ref, computed, onMounted, onUnmounted, createVNode,
|
||||
import { ref, computed, onMounted, onUnmounted, createVNode } from 'vue';
|
||||
|
||||
} from 'vue';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||
import { getXjrWorkflowApproveRecordPage, deleteXjrWorkflowApproveRecord, getAllApproveRecord, addApproveRecord, deleteApproveRecord, updateApproveRecord } from '/@/api/auditOpt/auditRecord';
|
||||
import { PageWrapper } from '/@/components/Page';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { usePermission } from '/@/hooks/web/usePermission';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { getXjrWorkflowApproveRecord } from '/@/api/auditOpt/auditRecord';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import AuditRecordModal from './components/AuditRecordModal.vue';
|
||||
import { searchFormSchema, columns } from './components/config';
|
||||
import Icon from '/@/components/Icon/index';
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
import CustomModeler from '/@bpmn/modeler';
|
||||
import dayjs, { Dayjs } from 'dayjs';
|
||||
import opinionDialog from '/@/components/SecondDev/OpinionDialogSelected.vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||
import { getXjrWorkflowApproveRecordPage, deleteXjrWorkflowApproveRecord, getAllApproveRecord, addApproveRecord, deleteApproveRecord, updateApproveRecord } from '/@/api/auditOpt/auditRecord';
|
||||
import { PageWrapper } from '/@/components/Page';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { usePermission } from '/@/hooks/web/usePermission';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { getXjrWorkflowApproveRecord } from '/@/api/auditOpt/auditRecord';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import AuditRecordModal from './components/AuditRecordModal.vue';
|
||||
import { searchFormSchema, columns } from './components/config';
|
||||
import Icon from '/@/components/Icon/index';
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
import CustomModeler from '/@bpmn/modeler';
|
||||
import dayjs, { Dayjs } from 'dayjs';
|
||||
import opinionDialog from '/@/components/SecondDev/OpinionDialogSelected.vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||
|
||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
defineEmits(['register']);
|
||||
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
||||
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
defineEmits(['register']);
|
||||
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
||||
// const filterColumns = filterColumnAuth(columns);
|
||||
const filterColumns = columns;
|
||||
const tableRef = ref();
|
||||
|
||||
// const filterColumns = filterColumnAuth(columns);
|
||||
const filterColumns = columns;
|
||||
const tableRef = ref();
|
||||
|
||||
const props = defineProps({
|
||||
processId: String,
|
||||
xml: String,
|
||||
schemaId: String,
|
||||
});
|
||||
const opinionDlg = ref();
|
||||
|
||||
//展示在列表内的按钮
|
||||
const actionButtons = ref<string[]>(['view', 'edit', 'copyData', 'delete', 'startwork', 'flowRecord']);
|
||||
const buttonConfigs = computed(() => {
|
||||
// { "name": "查看", "code": "view", "icon": "ant-design:eye-outlined", "isDefault": true, "isUse": true },
|
||||
// { "name": "查看详情", "code": "detail", "icon": "ant-design:eye-outlined", "isDefault": true, "isUse": true },
|
||||
const list = [{ "name": "新增", "code": "add", "icon": "ant-design:plus-outlined", "isDefault": true, "isUse": true }, { "name": "编辑", "code": "edit", "icon": "ant-design:form-outlined", "isDefault": true, "isUse": true }, { "name": "刷新", "code": "refresh", "icon": "ant-design:reload-outlined", "isDefault": true, "isUse": true }, { "name": "删除", "code": "delete", "icon": "ant-design:delete-outlined", "isDefault": true, "isUse": true }]
|
||||
// return filterButtonAuth(list);
|
||||
return list;
|
||||
})
|
||||
|
||||
const tableButtonConfig = computed(() => {
|
||||
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
|
||||
});
|
||||
|
||||
const actionButtonConfig = computed(() => {
|
||||
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
|
||||
});
|
||||
|
||||
const btnEvent = { add: handleAdd, edit: handleEdit, refresh: handleRefresh, view: handleView, detail: handleDetail, delete: handleDelete, }
|
||||
|
||||
const { currentRoute } = useRouter();
|
||||
const router = useRouter();
|
||||
|
||||
|
||||
const formIdComputedRef = ref();
|
||||
formIdComputedRef.value = currentRoute.value.meta.formId
|
||||
const schemaIdComputedRef = ref();
|
||||
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||
|
||||
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const allTaskNodes = ref<Array<{ 'taskId': string, 'taskName': string }>>([]);
|
||||
|
||||
const formName = '审批意见';
|
||||
const [registerTable, { reload, }] = useTable({
|
||||
title: '' || (formName + '列表'),
|
||||
api: getXjrWorkflowApproveRecordPage,
|
||||
rowKey: 'id',
|
||||
columns: filterColumns,
|
||||
formConfig: {
|
||||
rowProps: {
|
||||
gutter: 16,
|
||||
},
|
||||
schemas: searchFormSchema,
|
||||
fieldMapToTime: [['approveTime', ['approveTimeStart', 'approveTimeEnd'], 'YYYY-MM-DD HH:mm:ss ', true],],
|
||||
showResetButton: false,
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return { ...params, FormId: formIdComputedRef.value, 'processInstanceId': props.processId };
|
||||
},
|
||||
afterFetch: (res) => {
|
||||
tableRef.value.setToolBarWidth();
|
||||
},
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
striped: false,
|
||||
actionColumn: {
|
||||
width: 160,
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
slots: { customRender: 'action' },
|
||||
},
|
||||
tableSetting: {
|
||||
size: false,
|
||||
setting: false,
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
function dbClickRow(record) {
|
||||
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||
if (taskIds && taskIds.length) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||
query: {
|
||||
taskId: taskIds[0],
|
||||
formName: formName
|
||||
}
|
||||
const props = defineProps({
|
||||
processId: String,
|
||||
xml: String,
|
||||
schemaId: String
|
||||
});
|
||||
} else if (schemaId && !taskIds && processId) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||
query: {
|
||||
readonly: 1,
|
||||
taskId: '',
|
||||
formName: formName
|
||||
}
|
||||
const opinionDlg = ref();
|
||||
|
||||
//展示在列表内的按钮
|
||||
const actionButtons = ref<string[]>(['view', 'edit', 'copyData', 'delete', 'startwork', 'flowRecord']);
|
||||
const buttonConfigs = computed(() => {
|
||||
// { "name": "查看", "code": "view", "icon": "ant-design:eye-outlined", "isDefault": true, "isUse": true },
|
||||
// { "name": "查看详情", "code": "detail", "icon": "ant-design:eye-outlined", "isDefault": true, "isUse": true },
|
||||
const list = [
|
||||
{ name: '新增', code: 'add', icon: 'ant-design:plus-outlined', isDefault: true, isUse: true },
|
||||
{ name: '编辑', code: 'edit', icon: 'ant-design:form-outlined', isDefault: true, isUse: true },
|
||||
{ name: '刷新', code: 'refresh', icon: 'ant-design:reload-outlined', isDefault: true, isUse: true },
|
||||
{ name: '删除', code: 'delete', icon: 'ant-design:delete-outlined', isDefault: true, isUse: true }
|
||||
];
|
||||
// return filterButtonAuth(list);
|
||||
return list;
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/auditRecord/' + record.id + '/viewForm',
|
||||
query: {
|
||||
formPath: 'auditOpt/auditRecord',
|
||||
formName: formName
|
||||
}
|
||||
|
||||
const tableButtonConfig = computed(() => {
|
||||
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function init() {
|
||||
const bpmnViewer = await new CustomModeler({
|
||||
container: '',
|
||||
additionalModules: [
|
||||
{
|
||||
labelEditingProvider: ['value', ''], //禁用节点编辑
|
||||
paletteProvider: ['value', ''], //禁用/清空左侧工具栏
|
||||
contextPadProvider: ['value', ''], //禁用图形菜单
|
||||
bendpoints: ['value', {}], //禁用连线拖动
|
||||
move: ['value', ''], //禁用单个图形拖动
|
||||
},
|
||||
],
|
||||
});
|
||||
await bpmnViewer.importXML(props.xml);
|
||||
bpmnViewer.get('elementRegistry').getAll().forEach(ele => {
|
||||
if ((ele.di.get('bpmnElement').id as String).startsWith('Activity')) {
|
||||
allTaskNodes.value.push({ 'taskName': ele.di.get('bpmnElement').name, 'taskId': ele.di.get('bpmnElement').id })
|
||||
}
|
||||
});
|
||||
}
|
||||
const actionButtonConfig = computed(() => {
|
||||
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
|
||||
});
|
||||
|
||||
function buttonClick(code) {
|
||||
const btnEvent = { add: handleAdd, edit: handleEdit, refresh: handleRefresh, view: handleView, detail: handleDetail, delete: handleDelete };
|
||||
|
||||
btnEvent[code]();
|
||||
}
|
||||
const { currentRoute } = useRouter();
|
||||
const router = useRouter();
|
||||
|
||||
function handleAdd() {
|
||||
opinionDlg.value.toggleDialog({
|
||||
action: 'select',
|
||||
schemaId: props.schemaId,
|
||||
choseTime: true,
|
||||
multiple: false,
|
||||
taskNode: allTaskNodes.value,
|
||||
title: '新增审批记录',
|
||||
callback(args) {
|
||||
submit(args.info)
|
||||
}
|
||||
});
|
||||
}
|
||||
const formIdComputedRef = ref();
|
||||
formIdComputedRef.value = currentRoute.value.meta.formId;
|
||||
const schemaIdComputedRef = ref();
|
||||
schemaIdComputedRef.value = currentRoute.value.meta.schemaId;
|
||||
|
||||
function submit(info) {
|
||||
addApproveRecord({
|
||||
'schemaId': props.schemaId,
|
||||
'processId': props.processId,
|
||||
'taskDefinitionKey': info.taskId,
|
||||
'approveUserId': info.selectedList[0]['id'],
|
||||
'approveTime': dayjs(info.time).format('YYYY-MM-DD HH:mm:ss'),
|
||||
'approveComment': info.opinion
|
||||
}).then(async res => {
|
||||
if (res) {
|
||||
message.info("新增成功!")
|
||||
reload();
|
||||
} else {
|
||||
message.info("新增失败!")
|
||||
}
|
||||
})
|
||||
}
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const allTaskNodes = ref<Array<{ taskId: string; taskName: string }>>([]);
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
console.log(77777, record);
|
||||
opinionDlg.value.toggleDialog({
|
||||
action: 'select',
|
||||
schemaId: props.schemaId,
|
||||
choseTime: true,
|
||||
multiple: false,
|
||||
taskNode: allTaskNodes.value,
|
||||
taskId: record.taskDefinitionKey,
|
||||
title: '编辑审批记录',
|
||||
edit: true,
|
||||
record: record,
|
||||
callback(args) {
|
||||
editAction(args.info, record)
|
||||
}
|
||||
});
|
||||
// router.push({
|
||||
// path: '/form/auditRecord/' + record.id + '/updateForm',
|
||||
// query: {
|
||||
// formPath: 'auditOpt/auditRecord',
|
||||
// formName: formName
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
function editAction(info, record) {
|
||||
updateApproveRecord({
|
||||
'id': record.id,
|
||||
'approveComment': info.opinion,
|
||||
'approveTime': dayjs(info.time).format('YYYY-MM-DD HH:mm:ss'),
|
||||
}).then(async res => {
|
||||
if (res) {
|
||||
message.info("修改成功!")
|
||||
reload();
|
||||
} else {
|
||||
message.info("修改失败!")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteList([record.id]);
|
||||
}
|
||||
|
||||
function deleteList(ids) {
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
content: '是否确认删除?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
deleteApproveRecord(ids).then((res) => {
|
||||
if (res) {
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('删除成功!'),
|
||||
});
|
||||
handleSuccess();
|
||||
} else {
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('删除失败!'),
|
||||
});
|
||||
const formName = '审批意见';
|
||||
const [registerTable, { reload }] = useTable({
|
||||
title: '' || formName + '列表',
|
||||
api: getXjrWorkflowApproveRecordPage,
|
||||
rowKey: 'id',
|
||||
columns: filterColumns,
|
||||
formConfig: {
|
||||
rowProps: {
|
||||
gutter: 16
|
||||
},
|
||||
schemas: searchFormSchema,
|
||||
fieldMapToTime: [['approveTime', ['approveTimeStart', 'approveTimeEnd'], 'YYYY-MM-DD HH:mm:ss ', true]],
|
||||
showResetButton: false
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return { ...params, FormId: formIdComputedRef.value, processInstanceId: props.processId };
|
||||
},
|
||||
afterFetch: (res) => {
|
||||
tableRef.value.setToolBarWidth();
|
||||
},
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
striped: false,
|
||||
actionColumn: {
|
||||
width: 160,
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
slots: { customRender: 'action' }
|
||||
},
|
||||
tableSetting: {
|
||||
size: false,
|
||||
setting: false
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
onCancel() { },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function handleRefresh() {
|
||||
reload();
|
||||
}
|
||||
function handleSuccess() {
|
||||
|
||||
reload();
|
||||
}
|
||||
|
||||
function handleView(record: Recordable) {
|
||||
|
||||
dbClickRow(record);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
if (schemaIdComputedRef.value) {
|
||||
bus.on(FLOW_PROCESSED, handleRefresh);
|
||||
bus.on(CREATE_FLOW, handleRefresh);
|
||||
} else {
|
||||
bus.on(FORM_LIST_MODIFIED, handleRefresh);
|
||||
}
|
||||
init();
|
||||
});
|
||||
onUnmounted(() => {
|
||||
if (schemaIdComputedRef.value) {
|
||||
bus.off(FLOW_PROCESSED, handleRefresh);
|
||||
bus.off(CREATE_FLOW, handleRefresh);
|
||||
} else {
|
||||
bus.off(FORM_LIST_MODIFIED, handleRefresh);
|
||||
}
|
||||
});
|
||||
function getActions(record: Recordable): ActionItem[] {
|
||||
|
||||
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
|
||||
if (!record.workflowData?.processId) {
|
||||
return {
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
color: button.code === 'delete' ? 'error' : undefined,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
};
|
||||
} else {
|
||||
if (button.code === 'view') {
|
||||
return {
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
function dbClickRow(record) {
|
||||
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||
if (taskIds && taskIds.length) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||
query: {
|
||||
taskId: taskIds[0],
|
||||
formName: formName
|
||||
}
|
||||
});
|
||||
} else if (schemaId && !taskIds && processId) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||
query: {
|
||||
readonly: 1,
|
||||
taskId: '',
|
||||
formName: formName
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/auditRecord/' + record.id + '/viewForm',
|
||||
query: {
|
||||
formPath: 'auditOpt/auditRecord',
|
||||
formName: formName
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return actionsList;
|
||||
}
|
||||
|
||||
async function init() {
|
||||
const bpmnViewer = await new CustomModeler({
|
||||
container: '',
|
||||
additionalModules: [
|
||||
{
|
||||
labelEditingProvider: ['value', ''], //禁用节点编辑
|
||||
paletteProvider: ['value', ''], //禁用/清空左侧工具栏
|
||||
contextPadProvider: ['value', ''], //禁用图形菜单
|
||||
bendpoints: ['value', {}], //禁用连线拖动
|
||||
move: ['value', ''] //禁用单个图形拖动
|
||||
}
|
||||
]
|
||||
});
|
||||
await bpmnViewer.importXML(props.xml);
|
||||
bpmnViewer
|
||||
.get('elementRegistry')
|
||||
.getAll()
|
||||
.forEach((ele) => {
|
||||
if ((ele.di.get('bpmnElement').id as String).startsWith('Activity')) {
|
||||
allTaskNodes.value.push({ taskName: ele.di.get('bpmnElement').name, taskId: ele.di.get('bpmnElement').id });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function buttonClick(code) {
|
||||
btnEvent[code]();
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
opinionDlg.value.toggleDialog({
|
||||
action: 'select',
|
||||
schemaId: props.schemaId,
|
||||
choseTime: true,
|
||||
multiple: false,
|
||||
taskNode: allTaskNodes.value,
|
||||
title: '新增审批记录',
|
||||
callback(args) {
|
||||
submit(args.info);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function submit(info) {
|
||||
addApproveRecord({
|
||||
schemaId: props.schemaId,
|
||||
processId: props.processId,
|
||||
taskDefinitionKey: info.taskId,
|
||||
approveUserId: info.selectedList[0]['id'],
|
||||
approveTime: dayjs(info.time).format('YYYY-MM-DD HH:mm:ss'),
|
||||
approveComment: info.opinion
|
||||
}).then(async (res) => {
|
||||
if (res) {
|
||||
message.info('新增成功!');
|
||||
reload();
|
||||
} else {
|
||||
message.info('新增失败!');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
console.log(77777, record);
|
||||
opinionDlg.value.toggleDialog({
|
||||
action: 'select',
|
||||
schemaId: props.schemaId,
|
||||
choseTime: true,
|
||||
multiple: false,
|
||||
taskNode: allTaskNodes.value,
|
||||
taskId: record.taskDefinitionKey,
|
||||
title: '编辑审批记录',
|
||||
edit: true,
|
||||
record: record,
|
||||
callback(args) {
|
||||
editAction(args.info, record);
|
||||
}
|
||||
});
|
||||
// router.push({
|
||||
// path: '/form/auditRecord/' + record.id + '/updateForm',
|
||||
// query: {
|
||||
// formPath: 'auditOpt/auditRecord',
|
||||
// formName: formName
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
function editAction(info, record) {
|
||||
updateApproveRecord({
|
||||
id: record.id,
|
||||
approveComment: info.opinion,
|
||||
approveTime: dayjs(info.time).format('YYYY-MM-DD HH:mm:ss')
|
||||
}).then(async (res) => {
|
||||
if (res) {
|
||||
message.info('修改成功!');
|
||||
reload();
|
||||
} else {
|
||||
message.info('修改失败!');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {}
|
||||
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteList([record.id]);
|
||||
}
|
||||
|
||||
function deleteList(ids) {
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
content: '是否确认删除?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
deleteApproveRecord(ids).then((res) => {
|
||||
if (res) {
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('删除成功!')
|
||||
});
|
||||
handleSuccess();
|
||||
} else {
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('删除失败!')
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel() {}
|
||||
});
|
||||
}
|
||||
|
||||
function handleRefresh() {
|
||||
reload();
|
||||
}
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
}
|
||||
|
||||
function handleView(record: Recordable) {
|
||||
dbClickRow(record);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (schemaIdComputedRef.value) {
|
||||
bus.on(FLOW_PROCESSED, handleRefresh);
|
||||
bus.on(CREATE_FLOW, handleRefresh);
|
||||
} else {
|
||||
bus.on(FORM_LIST_MODIFIED, handleRefresh);
|
||||
}
|
||||
init();
|
||||
});
|
||||
onUnmounted(() => {
|
||||
if (schemaIdComputedRef.value) {
|
||||
bus.off(FLOW_PROCESSED, handleRefresh);
|
||||
bus.off(CREATE_FLOW, handleRefresh);
|
||||
} else {
|
||||
bus.off(FORM_LIST_MODIFIED, handleRefresh);
|
||||
}
|
||||
});
|
||||
function getActions(record: Recordable): ActionItem[] {
|
||||
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
|
||||
if (!record.workflowData?.processId) {
|
||||
return {
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
color: button.code === 'delete' ? 'error' : undefined,
|
||||
onClick: btnEvent[button.code].bind(null, record)
|
||||
};
|
||||
} else {
|
||||
if (button.code === 'view') {
|
||||
return {
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record)
|
||||
};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
});
|
||||
return actionsList;
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-table-selection-col) {
|
||||
width: 50px;
|
||||
}
|
||||
:deep(.ant-table-selection-col) {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.show {
|
||||
display: flex;
|
||||
}
|
||||
.show {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none !important;
|
||||
}
|
||||
.hide {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user