提交 1f1c527f authored 作者: kxjia's avatar kxjia

完善问题

上级 89bf837f
<template> <template>
<BasicDrawer v-bind="$attrs" title="流程追踪" width="100%" <BasicDrawer v-bind="$attrs" title="流程追踪" width="100%" @register="registerBasicDrawer" :header-style="{ backgroundColor: '#018ffb', borderBottom: '1px solid #e8eef2' }">
@register="registerBasicDrawer"
:header-style="{ backgroundColor: '#018ffb', borderBottom: '1px solid #e8eef2' }">
<div class="drawer-content"> <div class="drawer-content">
<a-tabs v-model:activeKey="activeKey" type="card" @change="handleTabChange"> <a-tabs v-model:activeKey="activeKey" type="card" @change="handleTabChange">
<a-tab-pane key="chart" tab="流程图"> <a-tab-pane key="chart" tab="流程图">
...@@ -21,45 +19,30 @@ ...@@ -21,45 +19,30 @@
import FlowHistoryChart from './FlowHistoryChart.vue'; import FlowHistoryChart from './FlowHistoryChart.vue';
import FlowHistoryRecord from './FlowHistoryRecord.vue'; import FlowHistoryRecord from './FlowHistoryRecord.vue';
const activeKey = ref('chart'); const activeKey = ref('chart');
const procInsId = ref('');
const dataId = ref('');
const deployId = ref('');
const refFlowHistoryChart = ref(); const refFlowHistoryChart = ref();
const refFlowHistoryRecord = ref(); const refFlowHistoryRecord = ref();
const curData = ref({}); const curData = ref({});
const callback = (data) => { const callback = (data) => {
curData.value = data; curData.value = data;
handleTabChange('chart'); handleTabChange('chart');
} }
const handleTabChange = (key) => { const handleTabChange = (key) => {
if (key === 'chart') { if (key === 'chart') {
nextTick(() => { nextTick(() => refFlowHistoryChart.value?.loadData(curData.value));
refFlowHistoryChart.value.loadData(curData.value);
})
} else if (key === 'record') { } else if (key === 'record') {
nextTick(() => { nextTick(() => refFlowHistoryRecord.value?.loadData(curData.value));
refFlowHistoryRecord.value.loadData(curData.value);
})
} }
activeKey.value = key; activeKey.value = key;
} }
const [registerBasicDrawer, { closeDrawer, setDrawerProps }] = useDrawerInner(callback);
const [registerBasicDrawer, { closeDrawer }] = useDrawerInner(callback);
</script> </script>
<style scoped> <style scoped>
.drawer-content { .drawer-content { height: 100%; }
height: 100%; .drawer-content :deep(.ant-tabs) { height: 100%; }
} .drawer-content :deep(.ant-tabs-content) { height: calc(100% - 40px); overflow-y: auto; }
.drawer-content :deep(.ant-tabs) {
height: 100%;
}
.drawer-content :deep(.ant-tabs-content) {
height: calc(100% - 40px);
overflow-y: auto;
}
</style> </style>
...@@ -14,20 +14,11 @@ ...@@ -14,20 +14,11 @@
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="用户类型" required> <a-form-item label="用户类型" required>
<a-radio-group v-model:value="localUserType" disabled> <a-radio-group v-model:value="localUserType" disabled>
<a-radio value="user"> <a-radio value="user"><UserOutlined /> 用户</a-radio>
<UserOutlined /> 用户 <a-radio value="role"><TeamOutlined /> 角色</a-radio>
</a-radio>
<a-radio value="role">
<TeamOutlined /> 角色
</a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item v-if="!assigneeId" :label="localUserType === 'user' ? '选择用户' : '选择角色'">
<!-- 用户/角色选择区域(未选择时) -->
<a-form-item
v-if="!assigneeId"
:label="localUserType === 'user' ? '选择用户' : '选择角色'"
>
<div class="assignee-selector"> <div class="assignee-selector">
<a-input <a-input
:value="assigneeDisplayName" :value="assigneeDisplayName"
...@@ -41,8 +32,6 @@ ...@@ -41,8 +32,6 @@
</a-input> </a-input>
</div> </div>
</a-form-item> </a-form-item>
<!-- 已指定信息展示 -->
<div v-if="assigneeId" class="assignee-info-wrapper"> <div v-if="assigneeId" class="assignee-info-wrapper">
<div class="assignee-info-label">已指定{{ localUserType === 'user' ? '用户' : '角色' }}:</div> <div class="assignee-info-label">已指定{{ localUserType === 'user' ? '用户' : '角色' }}:</div>
<a-descriptions :column="1" size="small" bordered> <a-descriptions :column="1" size="small" bordered>
...@@ -53,12 +42,9 @@ ...@@ -53,12 +42,9 @@
{{ assigneeDisplayName || '--' }} {{ assigneeDisplayName || '--' }}
</a-descriptions-item> </a-descriptions-item>
</a-descriptions> </a-descriptions>
<a-button type="link" size="small" @click="clearAssignee" class="change-btn"> <a-button type="link" size="small" @click="clearAssignee" class="change-btn">重新选择</a-button>
重新选择
</a-button>
</div> </div>
</a-form> </a-form>
<div class="assignee-actions"> <div class="assignee-actions">
<a-space> <a-space>
<a-button @click="handleClose">取消</a-button> <a-button @click="handleClose">取消</a-button>
...@@ -68,27 +54,13 @@ ...@@ -68,27 +54,13 @@
</a-card> </a-card>
</div> </div>
<RoleSelectModal <RoleSelectModal rowKey="id" @register="registerSelRoleModal" @getSelectResult="onSelectRoleOk" isRadioSelection :showButton="false" labelKey="roleName" />
rowKey="id" <UserSelectModal rowKey="id" @register="registerSelUserModal" @getSelectResult="onSelectUserOk" isRadioSelection :showButton="false" labelKey="realname" />
@register="registerSelRoleModal"
@getSelectResult="onSelectRoleOk"
isRadioSelection
:showButton="false"
labelKey="roleName"
/>
<UserSelectModal
rowKey="id"
@register="registerSelUserModal"
@getSelectResult="onSelectUserOk"
isRadioSelection
:showButton="false"
labelKey="realname"
/>
</BasicDrawer> </BasicDrawer>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, watch, nextTick } from 'vue' import { ref } from 'vue'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { useModal } from '/@/components/Modal' import { useModal } from '/@/components/Modal'
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer' import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'
...@@ -97,43 +69,26 @@ import UserSelectModal from '/@/components/Form/src/jeecg/components/modal/UserS ...@@ -97,43 +69,26 @@ import UserSelectModal from '/@/components/Form/src/jeecg/components/modal/UserS
import RoleSelectModal from '/@/components/Form/src/jeecg/components/modal/RoleSelectModal.vue' import RoleSelectModal from '/@/components/Form/src/jeecg/components/modal/RoleSelectModal.vue'
import { complete, getMyTaskFlow } from '/@/components/Process/api/todo' import { complete, getMyTaskFlow } from '/@/components/Process/api/todo'
interface formDadta {
assignee: string
userType: string
deployId?: string
required?: string
assigneeName?: string
dataId?: string
}
const emit = defineEmits(['success', 'error', 'close']) const emit = defineEmits(['success', 'error', 'close'])
const [registerSelUserModal, { openModal: userOpenModal }] = useModal() const [registerSelUserModal, { openModal: userOpenModal }] = useModal()
const [registerSelRoleModal, { openModal: roleOpenModal }] = useModal() const [registerSelRoleModal, { openModal: roleOpenModal }] = useModal()
// 状态
const localUserType = ref<'user' | 'role'>('user') const localUserType = ref<'user' | 'role'>('user')
const assigneeId = ref('') const assigneeId = ref('')
const assigneeDisplayName = ref('') const assigneeDisplayName = ref('')
const confirmLoading = ref(false) const confirmLoading = ref(false)
const dataId = ref('') const dataId = ref('')
const deployId = ref('') const deployId = ref('')
const taskId = ref('')
const hasAssignee = ref(false)
// 使用 useDrawerInner 接收外部传入的数据 const [registerBasicDrawer, { closeDrawer }] = useDrawerInner((data) => {
const [registerBasicDrawer, { closeDrawer, setDrawerProps }] = useDrawerInner((data) => {
alert(JSON.stringify(data))
if (data) { if (data) {
dataId.value = data.dataId || '' dataId.value = data.dataId || ''
deployId.value = data.deployId || '' deployId.value = data.deployId || ''
if (data.assignee) { if (data.assignee) {
localUserType.value = data.userType === 'role' ? 'role' : 'user' localUserType.value = data.userType === 'role' ? 'role' : 'user'
assigneeId.value = data.assignee assigneeId.value = data.assignee
if (data.assigneeName) { assigneeDisplayName.value = data.assigneeName || ''
assigneeDisplayName.value = data.assigneeName
}
} else { } else {
localUserType.value = data.userType === 'role' ? 'role' : 'user' localUserType.value = data.userType === 'role' ? 'role' : 'user'
} }
...@@ -146,14 +101,9 @@ const clearAssignee = () => { ...@@ -146,14 +101,9 @@ const clearAssignee = () => {
} }
const handleSelect = () => { const handleSelect = () => {
if (localUserType.value === 'user') { localUserType.value === 'user' ? userOpenModal() : roleOpenModal()
userOpenModal()
} else {
roleOpenModal()
}
} }
// 选择用户回调
const onSelectUserOk = (options: any[], values: any[]) => { const onSelectUserOk = (options: any[], values: any[]) => {
if (!values?.length) return if (!values?.length) return
assigneeId.value = values[0] assigneeId.value = values[0]
...@@ -161,7 +111,6 @@ const onSelectUserOk = (options: any[], values: any[]) => { ...@@ -161,7 +111,6 @@ const onSelectUserOk = (options: any[], values: any[]) => {
localUserType.value = 'user' localUserType.value = 'user'
} }
// 选择角色回调
const onSelectRoleOk = (options: any[], values: any[]) => { const onSelectRoleOk = (options: any[], values: any[]) => {
if (!values?.length) return if (!values?.length) return
assigneeId.value = values[0] assigneeId.value = values[0]
...@@ -175,7 +124,6 @@ const handleClose = () => { ...@@ -175,7 +124,6 @@ const handleClose = () => {
} }
const handleConfirm = async () => { const handleConfirm = async () => {
confirmLoading.value = true confirmLoading.value = true
try { try {
if (dataId.value && deployId.value) { if (dataId.value && deployId.value) {
...@@ -187,28 +135,20 @@ const handleConfirm = async () => { ...@@ -187,28 +135,20 @@ const handleConfirm = async () => {
taskId: myTaskFlow.taskId, taskId: myTaskFlow.taskId,
dataId: dataId.value, dataId: dataId.value,
comment: '', comment: '',
values: { values: { approval: assigneeId.value, approvalType: localUserType.value },
approval: assigneeId.value,
approvalType: localUserType.value
},
}) })
} }
} }
emit('success', dataId.value) emit('success', dataId.value)
nextTick(() => {
message.success('任务发送成功') message.success('任务发送成功')
handleClose() handleClose()
}) } catch (error) {
} catch (error: any) {
emit('error', error) emit('error', error)
} finally { } finally {
confirmLoading.value = false confirmLoading.value = false
} }
} }
// 对外暴露的方法
const getAssigneeData = () => ({ const getAssigneeData = () => ({
userType: localUserType.value, userType: localUserType.value,
assignee: assigneeId.value, assignee: assigneeId.value,
...@@ -228,110 +168,13 @@ const setRoleInfo = (roleId: string, roleNameValue: string) => { ...@@ -228,110 +168,13 @@ const setRoleInfo = (roleId: string, roleNameValue: string) => {
localUserType.value = 'role' localUserType.value = 'role'
} }
defineExpose({ defineExpose({ getAssigneeData, submit: handleConfirm, setUserInfo, setRoleInfo })
getAssigneeData,
submit: handleConfirm,
setUserInfo,
setRoleInfo
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.drawer-content { .drawer-content { height: 100%; overflow-y: auto; padding: 16px 20px; &::-webkit-scrollbar { width: 4px; } &::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 2px; } &::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 2px; &:hover { background: #a8a8a8; } } }
height: 100%; .assignee-card { height: 100%; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); :deep(.ant-card-head) { background-color: #fafbfc; border-bottom: 1px solid #e8eef2; .ant-card-head-title { font-size: 16px; font-weight: 500; } } :deep(.ant-card-body) { padding: 24px; height: calc(100% - 57px); display: flex; flex-direction: column; } }
overflow-y: auto; .assignee-selector { display: flex; align-items: center; gap: 8px; .assignee-input { flex: 1; :deep(.ant-input) { background-color: #fafafa; cursor: pointer; &:hover { background-color: #fff; } } } }
padding: 16px 20px; .assignee-info-wrapper { margin-top: 12px; padding: 12px; background-color: #fafbfc; border-radius: 8px; .assignee-info-label { margin-bottom: 8px; font-weight: 500; color: #1f2f3d; } .change-btn { margin-top: 8px; padding-left: 0; } :deep(.ant-descriptions) { .ant-descriptions-item-label { background-color: #f5f5f5; width: 80px; } } }
.assignee-actions { margin-top: auto; padding-top: 24px; text-align: center; border-top: 1px solid #f0f0f0; }
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 2px;
}
&::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 2px;
&:hover {
background: #a8a8a8;
}
}
}
.assignee-card {
height: 100%;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
:deep(.ant-card-head) {
background-color: #fafbfc;
border-bottom: 1px solid #e8eef2;
.ant-card-head-title {
font-size: 16px;
font-weight: 500;
}
}
:deep(.ant-card-body) {
padding: 24px;
height: calc(100% - 57px);
display: flex;
flex-direction: column;
}
}
.assignee-selector {
display: flex;
align-items: center;
gap: 8px;
.assignee-input {
flex: 1;
:deep(.ant-input) {
background-color: #fafafa;
cursor: pointer;
&:hover {
background-color: #fff;
}
}
}
}
.assignee-info-wrapper {
margin-top: 12px;
padding: 12px;
background-color: #fafbfc;
border-radius: 8px;
.assignee-info-label {
margin-bottom: 8px;
font-weight: 500;
color: #1f2f3d;
}
.change-btn {
margin-top: 8px;
padding-left: 0;
}
:deep(.ant-descriptions) {
.ant-descriptions-item-label {
background-color: #f5f5f5;
width: 80px;
}
}
}
.assignee-actions {
margin-top: auto;
padding-top: 24px;
text-align: center;
border-top: 1px solid #f0f0f0;
}
</style> </style>
...@@ -8,33 +8,38 @@ ...@@ -8,33 +8,38 @@
:minHeight="400" :minHeight="400"
:useWrapper="true" :useWrapper="true"
:wrapperFooterOffset="20" :wrapperFooterOffset="20"
@cancel=""
@ok="handleOk" @ok="handleOk"
> >
<ApprovalPanel ref="approvalPanelRef" /> <ApprovalPanel ref="approvalPanelRef" @success="handleSuccess" @approval-fail="handleApprovalFail"/>
</BasicModal> </BasicModal>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watch, nextTick } from 'vue' import { ref } from 'vue'
import { BasicModal, useModalInner } from '/@/components/Modal'; import { BasicModal, useModalInner } from '/@/components/Modal';
import ApprovalPanel from './ApprovalPanel.vue'; import ApprovalPanel from './ApprovalPanel.vue';
import { complete, getMyTaskFlow,rejectTask, assignRead,assign } from '/@/components/Process/api/todo';
const approvalPanelRef = ref(); const approvalPanelRef = ref();
const emit = defineEmits(['success','approval-fail','update-form-data']) const emit = defineEmits(['success', 'approval-fail', 'update-form-data'])
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false, showCancelBtn: !!data?.showFooter, showOkBtn: !!data?.showFooter });
approvalPanelRef.value?.initFormData?.(data);
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
}); });
function handleOk() { function handleOk() {
alert('handleOk'); setModalProps({ confirmLoading: true });
setModalProps({confirmLoading: true}); approvalPanelRef.value?.handleSaveApp?.();
approvalPanelRef.value.handleSaveApp(); setModalProps({ confirmLoading: false });
setModalProps({confirmLoading: false});
} }
function handleSuccess(data: any) {
emit('success', data)
closeModal()
}
function handleApprovalFail(data: any) {
emit('approval-fail', data)
closeModal()
}
</script> </script>
...@@ -30,23 +30,19 @@ ...@@ -30,23 +30,19 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted, nextTick } from 'vue'; import { ref, nextTick } from 'vue';
import { useForm, BasicForm, FormSchema } from '/@/components/Form'; import { useForm, BasicForm, FormSchema } from '/@/components/Form';
import { CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons-vue'; import { CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons-vue';
import { complete, getMyTaskFlow, getRejectNode, rejectTask } from '/@/components/Process/api/todo'; import { complete, getMyTaskFlow, rejectTask } from '/@/components/Process/api/todo';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
const emit = defineEmits(['update:visible', 'success', 'error', 'close', 'approval-fail']); const emit = defineEmits(['update:visible', 'success', 'error', 'close', 'approval-fail']);
const props = defineProps({
beforeFlowNode: { const beforeFlowNode = ref<any>({})
type: Object, const assignee = ref()
default: () => ({}), const userType = ref('')
}, const deployId = ref('')
assignee: { type: String, default: null }, const dataId = ref('')
userType: { type: String, default: '' },
deployId: { type: String, default: '' },
dataId: { type: String, default: '' },
});
const formSchemas: FormSchema[] = [ const formSchemas: FormSchema[] = [
{ {
...@@ -60,7 +56,7 @@ ...@@ -60,7 +56,7 @@
label: '用户类型', label: '用户类型',
field: 'userType', field: 'userType',
component: 'Input', component: 'Input',
defaultValue: props.userType, defaultValue: '',
ifShow: false, ifShow: false,
}, },
{ {
...@@ -112,16 +108,17 @@ ...@@ -112,16 +108,17 @@
labelWidth: '120px', labelWidth: '120px',
size: 'large', size: 'large',
baseColProps: {style: { width: '100%' } }, baseColProps: {style: { width: '100%' } },
}); });
const handleClose = () => { const handleClose = () => {
emit('update:visible', false); // emit('update:visible', false);
emit('close'); // emit('close');
}; };
const handleSaveApp = async () => { const handleSaveApp = async () => {
const formDataTmp = await validate(); const formDataTmp = await validate();
const myTaskFlow = await getMyTaskFlow({ deploymentId: props.deployId, dataId: props.dataId }); const myTaskFlow = await getMyTaskFlow({ deploymentId: deployId.value, dataId: dataId.value });
if (myTaskFlow?.taskId) { if (myTaskFlow?.taskId) {
const reviewStatus = formDataTmp.reviewStatus; const reviewStatus = formDataTmp.reviewStatus;
if (reviewStatus === true) { if (reviewStatus === true) {
...@@ -132,9 +129,13 @@ ...@@ -132,9 +129,13 @@
comment: formDataTmp.comment, comment: formDataTmp.comment,
values: { values: {
approval: formDataTmp.approvalUser || formDataTmp.approvalRole, approval: formDataTmp.approvalUser || formDataTmp.approvalRole,
approvalType: props.userType, approvalType: userType.value,
}, },
}); });
emit('success', {
dataId: dataId.value,
bpmNodeId: myTaskFlow.taskDefinitionKey || '',
});
} else { } else {
await rejectTask({ await rejectTask({
instanceId: myTaskFlow.procInsId || '', instanceId: myTaskFlow.procInsId || '',
...@@ -142,18 +143,18 @@ ...@@ -142,18 +143,18 @@
taskId: myTaskFlow.taskId, taskId: myTaskFlow.taskId,
comment: formDataTmp.comment, comment: formDataTmp.comment,
values: { values: {
rejectNode: props.beforeFlowNode, rejectNode: beforeFlowNode.value,
}, },
}); });
emit('approval-fail', {
emit('approval-fail', props.dataId); dataId: dataId.value,
bpmNodeId: beforeFlowNode.value.id
});
} }
} }
emit('success', props.dataId);
nextTick(() => { nextTick(() => {
message.success('任务发送成功'); //message.success('任务发送成功');
handleClose(); //handleClose();
}); });
}; };
...@@ -173,7 +174,7 @@ ...@@ -173,7 +174,7 @@
}; };
const handleClickPass = async () => { const handleClickPass = async () => {
updateField(props.userType); updateField(userType.value);
}; };
const updateField = (userTp) => { const updateField = (userTp) => {
...@@ -182,6 +183,7 @@ ...@@ -182,6 +183,7 @@
{ {
field: 'approvalUser', field: 'approvalUser',
required: true, required: true,
defaultValue: assignee.value,
ifShow: true, ifShow: true,
}, },
{ {
...@@ -190,11 +192,18 @@ ...@@ -190,11 +192,18 @@
ifShow: false, ifShow: false,
}, },
]); ]);
nextTick(async () => {
await setFieldsValue({
userType: userType.value,
approvalUser: assignee.value,
})
})
} else { } else {
updateSchema([ updateSchema([
{ {
field: 'approvalRole', field: 'approvalRole',
required: true, required: true,
defaultValue: assignee.value,
ifShow: true, ifShow: true,
}, },
{ {
...@@ -203,15 +212,30 @@ ...@@ -203,15 +212,30 @@
ifShow: false, ifShow: false,
}, },
]); ]);
nextTick(async () => {
await setFieldsValue({
userType: userType.value,
approvalRole: assignee.value,
})
})
} }
}; };
onMounted(async () => { const initFormData = async (data) => {
updateField(props.userType); beforeFlowNode.value = data.beforeFlowNode || {}
}); assignee.value = data.assignee || ''
userType.value = data.userType || ''
deployId.value = data.deployId || ''
dataId.value = data.dataId || ''
nextTick(async () => {
updateField(userType.value);
})
}
defineExpose({ defineExpose({
handleSaveApp, handleSaveApp,
initFormData,
}) })
</script> </script>
......
...@@ -2,245 +2,80 @@ ...@@ -2,245 +2,80 @@
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item label="用户类型" required> <a-form-item label="用户类型" required>
<a-radio-group v-model:value="localUserType" disabled> <a-radio-group v-model:value="localUserType" disabled>
<a-radio value="user"> <a-radio value="user"><UserOutlined /> 用户</a-radio>
<UserOutlined /> 用户 <a-radio value="role"><TeamOutlined /> 角色</a-radio>
</a-radio>
<a-radio value="role">
<TeamOutlined /> 角色
</a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<!-- 用户/角色选择区域(未选择时) --> <a-form-item v-if="!assigneeId" :label="localUserType === 'user' ? '选择用户' : '选择角色'">
<a-form-item
v-if="!assigneeId"
:label="localUserType === 'user' ? '选择用户' : '选择角色'"
>
<div class="assignee-selector"> <div class="assignee-selector">
<a-input <a-input :value="assigneeDisplayName" :placeholder="`点击'选择'按钮选择${localUserType === 'user' ? '用户' : '角色'}`" readonly class="assignee-input">
:value="assigneeDisplayName"
:placeholder="`点击'选择'按钮选择${localUserType === 'user' ? '用户' : '角色'}`"
readonly
class="assignee-input"
>
<template #suffix> <template #suffix>
<a-button type="link" size="small" @click="handleSelect">选择</a-button> <a-button type="link" size="small" @click="handleSelect">选择</a-button>
</template> </template>
</a-input> </a-input>
</div> </div>
</a-form-item> </a-form-item>
<!-- 已指定信息展示 -->
<div v-if="assigneeId" class="assignee-info-wrapper"> <div v-if="assigneeId" class="assignee-info-wrapper">
<div class="assignee-info-label">已指定{{ localUserType === 'user' ? '用户' : '角色' }}:</div> <div class="assignee-info-label">已指定{{ localUserType === 'user' ? '用户' : '角色' }}:</div>
<a-descriptions :column="2" size="small" bordered> <a-descriptions :column="2" size="small" bordered>
<a-descriptions-item :label="localUserType === 'user' ? '用户ID' : '角色ID'"> <a-descriptions-item :label="localUserType === 'user' ? '用户ID' : '角色ID'">{{ assigneeId }}</a-descriptions-item>
{{ assigneeId }} <a-descriptions-item :label="localUserType === 'user' ? '用户名' : '角色名'">{{ assigneeDisplayName || '--' }}</a-descriptions-item>
</a-descriptions-item> <a-descriptions-item><a-button type="link" size="small" @click="clearAssignee" class="change-btn">重新选择</a-button></a-descriptions-item>
<a-descriptions-item :label="localUserType === 'user' ? '用户名' : '角色名'">
{{ assigneeDisplayName || '--' }}
</a-descriptions-item>
<a-descriptions-item>
<a-button type="link" size="small" @click="clearAssignee" class="change-btn">
重新选择
</a-button>
</a-descriptions-item>
</a-descriptions> </a-descriptions>
</div> </div>
<a-form-item label="说明"> <a-form-item label="说明">
<a-textarea <a-textarea v-model:value="assigneeRemark" placeholder="请输入说明" :rows="4" allow-clear show-count :maxlength="200" />
v-model:value="assigneeRemark"
placeholder="请输入说明"
:rows="4"
allow-clear
show-count
:maxlength="200"
/>
</a-form-item> </a-form-item>
</a-form> </a-form>
<RoleSelectModal <RoleSelectModal rowKey="id" @register="registerSelRoleModal" @getSelectResult="onSelectRoleOk" isRadioSelection :showButton="false" labelKey="roleName" />
rowKey="id" <UserSelectModal rowKey="id" @register="registerSelUserModal" @getSelectResult="onSelectUserOk" isRadioSelection :showButton="false" labelKey="realname" />
@register="registerSelRoleModal"
@getSelectResult="onSelectRoleOk"
isRadioSelection
:showButton="false"
labelKey="roleName"
/>
<UserSelectModal
rowKey="id"
@register="registerSelUserModal"
@getSelectResult="onSelectUserOk"
isRadioSelection
:showButton="false"
labelKey="realname"
/>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, watch, nextTick } from 'vue' import { ref } from 'vue'
import { useModal } from '/@/components/Modal' import { useModal } from '/@/components/Modal'
import { UserOutlined, TeamOutlined } from '@ant-design/icons-vue' import { UserOutlined, TeamOutlined } from '@ant-design/icons-vue'
import UserSelectModal from '/@/components/Form/src/jeecg/components/modal/UserSelectModal.vue' import UserSelectModal from '/@/components/Form/src/jeecg/components/modal/UserSelectModal.vue'
import RoleSelectModal from '/@/components/Form/src/jeecg/components/modal/RoleSelectModal.vue' import RoleSelectModal from '/@/components/Form/src/jeecg/components/modal/RoleSelectModal.vue'
const emit = defineEmits(['success', 'error', 'close'])
const [registerSelUserModal, { openModal: userOpenModal }] = useModal() const [registerSelUserModal, { openModal: userOpenModal }] = useModal()
const [registerSelRoleModal, { openModal: roleOpenModal }] = useModal() const [registerSelRoleModal, { openModal: roleOpenModal }] = useModal()
// 状态
const localUserType = ref<'user' | 'role'>('user') const localUserType = ref<'user' | 'role'>('user')
const assigneeId = ref('') const assigneeId = ref('')
const assigneeDisplayName = ref('') const assigneeDisplayName = ref('')
const assigneeRemark = ref('') const assigneeRemark = ref('')
const setAssigneeData = ((data) => { const setAssigneeData = (data: any) => {
if (data) { if (data) {
if (data.assignee) {
localUserType.value = data.userType === 'role' ? 'role' : 'user' localUserType.value = data.userType === 'role' ? 'role' : 'user'
if (data.assignee) {
assigneeId.value = data.assignee assigneeId.value = data.assignee
if (data.assigneeName) { assigneeDisplayName.value = data.assigneeName || ''
assigneeDisplayName.value = data.assigneeName
}
} else {
localUserType.value = data.userType === 'role' ? 'role' : 'user'
}
} }
})
const clearAssignee = () => {
assigneeId.value = ''
assigneeDisplayName.value = ''
}
const handleSelect = () => {
if (localUserType.value === 'user') {
userOpenModal()
} else {
roleOpenModal()
} }
} }
const clearAssignee = () => { assigneeId.value = ''; assigneeDisplayName.value = '' }
const handleSelect = () => { localUserType.value === 'user' ? userOpenModal() : roleOpenModal() }
const onSelectUserOk = (options: any[], values: any[]) => { const onSelectUserOk = (options: any[], values: any[]) => {
if (!values?.length) return if (!values?.length) return
assigneeId.value = values[0] assigneeId.value = values[0]
assigneeDisplayName.value = options[0]?.label || '' assigneeDisplayName.value = options[0]?.label || ''
localUserType.value = 'user' localUserType.value = 'user'
} }
const onSelectRoleOk = (options: any[], values: any[]) => { const onSelectRoleOk = (options: any[], values: any[]) => {
if (!values?.length) return if (!values?.length) return
assigneeId.value = values[0] assigneeId.value = values[0]
assigneeDisplayName.value = options[0]?.label || '' assigneeDisplayName.value = options[0]?.label || ''
localUserType.value = 'role' localUserType.value = 'role'
} }
const getAssigneeData = () => ({ userType: localUserType.value, assignee: assigneeId.value, name: assigneeDisplayName.value, remark: assigneeRemark.value })
// 对外暴露的方法 defineExpose({ setAssigneeData, getAssigneeData })
const getAssigneeData = () => ({
userType: localUserType.value,
assignee: assigneeId.value,
name: assigneeDisplayName.value,
remark: assigneeRemark.value
})
defineExpose({
setAssigneeData,
getAssigneeData,
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.drawer-content { .assignee-selector { display: flex; align-items: center; gap: 8px; .assignee-input { flex: 1; :deep(.ant-input) { background-color: #fafafa; cursor: pointer; &:hover { background-color: #fff; } } } }
height: 100%; .assignee-info-wrapper { margin-top: 12px; padding: 12px; background-color: #fafbfc; border-radius: 8px; .assignee-info-label { margin-bottom: 8px; font-weight: 500; color: #1f2f3d; } .change-btn { margin-top: 8px; padding-left: 0; } :deep(.ant-descriptions) { .ant-descriptions-item-label { background-color: #f5f5f5; width: 80px; } } }
overflow-y: auto;
padding: 16px 20px;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 2px;
}
&::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 2px;
&:hover {
background: #a8a8a8;
}
}
}
.assignee-card {
height: 100%;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
:deep(.ant-card-head) {
background-color: #fafbfc;
border-bottom: 1px solid #e8eef2;
.ant-card-head-title {
font-size: 16px;
font-weight: 500;
}
}
:deep(.ant-card-body) {
padding: 24px;
height: calc(100% - 57px);
display: flex;
flex-direction: column;
}
}
.assignee-selector {
display: flex;
align-items: center;
gap: 8px;
.assignee-input {
flex: 1;
:deep(.ant-input) {
background-color: #fafafa;
cursor: pointer;
&:hover {
background-color: #fff;
}
}
}
}
.assignee-info-wrapper {
margin-top: 12px;
padding: 12px;
background-color: #fafbfc;
border-radius: 8px;
.assignee-info-label {
margin-bottom: 8px;
font-weight: 500;
color: #1f2f3d;
}
.change-btn {
margin-top: 8px;
padding-left: 0;
}
:deep(.ant-descriptions) {
.ant-descriptions-item-label {
background-color: #f5f5f5;
width: 80px;
}
}
}
.assignee-actions {
margin-top: auto;
padding-top: 24px;
text-align: center;
border-top: 1px solid #f0f0f0;
}
</style> </style>
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { BasicModal, useModalInner } from '/@/components/Modal'; import { BasicModal, useModalInner } from '/@/components/Modal';
import ApprovalPanel from './ApprovalPanel.vue'; import ApprovalPanel from './ApprovalPanel.vue';
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
}); });
......
...@@ -21,35 +21,29 @@ ...@@ -21,35 +21,29 @@
import { ref } from 'vue' import { ref } from 'vue'
import { BasicModal, useModalInner } from '/@/components/Modal'; import { BasicModal, useModalInner } from '/@/components/Modal';
import AssigneePanel from './AssigneePanel.vue'; import AssigneePanel from './AssigneePanel.vue';
import { complete, getMyTaskFlow,rejectTask, assignRead,assign } from '/@/components/Process/api/todo'; import { complete, getMyTaskFlow, rejectTask, assignRead, assign } from '/@/components/Process/api/todo';
import { message } from 'ant-design-vue';
const emit = defineEmits(['success','approval-fail','update-form-data']) const emit = defineEmits(['success', 'approval-fail', 'update-form-data'])
const taskTitle = ref('任务') const taskTitle = ref('任务')
const sending = ref(false); const sending = ref(false);
const taskType = ref<any>({}); const taskType = ref<any>(null);
const refAssigneePanel = ref<any>(null); const refAssigneePanel = ref<any>(null);
const myTaskFlow = ref<any>({}); const myTaskFlow = ref<any>({});
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); setModalProps({ confirmLoading: false, showCancelBtn: !!data?.showFooter, showOkBtn: !!data?.showFooter });
taskTitle.value = data?.taskTitle || '任务' taskTitle.value = data?.taskTitle || '任务'
taskType.value = data?.taskType || ""; taskType.value = data?.taskType || ''
refAssigneePanel.value?.setAssigneeData(data)
refAssigneePanel.value.setAssigneeData(data); myTaskFlow.value = await getMyTaskFlow({ deploymentId: data?.deployId || '', dataId: data?.dataId || '' })
myTaskFlow.value = await getMyTaskFlow({
deploymentId: data?.deployId || '',
dataId: data?.dataId || '',
})
}); });
const handleTaskOk = async () => { const handleTaskOk = async () => {
if (sending.value) return; if (sending.value) return
try { try {
sending.value = true; sending.value = true
const assigneeData = refAssigneePanel.value.getAssigneeData(); const assigneeData = refAssigneePanel.value?.getAssigneeData() || {}
const submitData: any = { const submitData: any = {
instanceId: myTaskFlow.value.procInsId, instanceId: myTaskFlow.value.procInsId,
deployId: myTaskFlow.value.deployId, deployId: myTaskFlow.value.deployId,
...@@ -57,55 +51,38 @@ ...@@ -57,55 +51,38 @@
comment: assigneeData.remark || '', comment: assigneeData.remark || '',
values: { values: {
approval: assigneeData.assignee, approval: assigneeData.assignee,
approvalType: assigneeData.userType, approvalType: assigneeData.userType
} }
};
if (taskType.value === 'send') {
await handleSendTask(submitData);
} else if (taskType.value === 'reject') {
await handleRejectTask(submitData);
} else if (taskType.value === 'transmit') {
await handleTransmitTask(submitData);
} else if (taskType.value === 'read') {
await handleReadTask(submitData);
} }
//message.success('操作成功'); if (taskType.value === 'send') await handleSendTask(submitData)
emit('success', submitData); else if (taskType.value === 'reject') await handleRejectTask(submitData)
closeThisModal(); else if (taskType.value === 'transmit') await handleTransmitTask(submitData)
} catch (error: any) { else if (taskType.value === 'read') await handleReadTask(submitData)
emit('success', submitData)
closeThisModal()
} catch (error) {
console.error('任务操作失败:', error)
} finally { } finally {
sending.value = false; sending.value = false
} }
} }
const handleSendTask = async (submitData: any) => {
const result = await complete(submitData);
return false;
};
const handleRejectTask = async (submitData) => {
const result = await rejectTask(submitData);
return false;
};
const handleReadTask = async (submitData) => {
const result = await assignRead(submitData);
return false;
};
const handleTransmitTask = async (submitData) => {
const result = await assign(submitData);
return false;
};
const closeThisModal = () => {
closeModal();
}
const handleSendTask = async (submitData: any) => {
await complete(submitData)
}
const handleRejectTask = async (submitData: any) => {
await rejectTask(submitData)
}
const handleReadTask = async (submitData: any) => {
alert(JSON.stringify(submitData))
await assignRead(submitData)
}
const handleTransmitTask = async (submitData: any) => {
await assign(submitData)
}
const closeThisModal = () => { closeModal() }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.assignee-panel-wrapper{ .assignee-panel-wrapper { padding: 0px; }
padding: 0px;
}
</style> </style>
...@@ -220,7 +220,7 @@ export const formSchema: FormSchema[] = [ ...@@ -220,7 +220,7 @@ export const formSchema: FormSchema[] = [
}, },
{ {
label: '流程节点顺序号', label: '流程节点顺序号',
field: 'bmpNodeId', field: 'bpmNodeId',
component: 'Input', component: 'Input',
}, },
{ {
...@@ -327,7 +327,7 @@ export const superQuerySchema = { ...@@ -327,7 +327,7 @@ export const superQuerySchema = {
execEndDate: {title: '整改结束时间',order: 22,view: 'date', type: 'string',}, execEndDate: {title: '整改结束时间',order: 22,view: 'date', type: 'string',},
execRemark: {title: '整改落实情况',order: 23,view: 'textarea', type: 'string',}, execRemark: {title: '整改落实情况',order: 23,view: 'textarea', type: 'string',},
reviewComment: {title: '审核意见',order: 24,view: 'textarea', type: 'string',}, reviewComment: {title: '审核意见',order: 24,view: 'textarea', type: 'string',},
bmpNodeId: {title: '流程节点顺序号',order: 25,view: 'text', type: 'string',}, bpmNodeId: {title: '流程节点顺序号',order: 25,view: 'text', type: 'string',},
bpmStatus: {title: '流程状态',order: 26,view: 'text', type: 'string',}, bpmStatus: {title: '流程状态',order: 26,view: 'text', type: 'string',},
deployId: {title: '部署ID',order: 27,view: 'text', type: 'string',}, deployId: {title: '部署ID',order: 27,view: 'text', type: 'string',},
createdUser: {title: '创建人',order: 28,view: 'text', type: 'string',}, createdUser: {title: '创建人',order: 28,view: 'text', type: 'string',},
......
<template> <template>
<div> <div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题--> <template #tableTitle></template>
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="getTableAction(record)"/> <TableAction :actions="getTableAction(record)" />
</template> </template>
</BasicTable> </BasicTable>
<!-- 整改执行 -->
<StProblemCheckExecuteModal @register="registerExecuteModal" @success="handleSuccess" />
</div> </div>
</template> </template>
<script lang="ts" name="problem-stProblemCheck" setup> <script lang="ts" name="problem-stProblemCheck" setup>
import { BasicTable, TableAction } from '/@/components/Table'; import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import { columns, searchFormSchema } from './StProblemCheck.data'; import { columns } from './StProblemCheck.data';
import { list,problemArchive} from './StProblemCheck.api'; import { list, problemArchive } from './StProblemCheck.api';
import StProblemCheckExecuteModal from './components/StProblemCheckExecuteModal.vue';
const emit = defineEmits(['callback','openMultiForm'])
const props = defineProps({ const props = defineProps({
currentFlowNode: { currentFlowNode: { type: Object, default: () => ({}) },
type: Object, });
default: () => ({})
},
})
const emit = defineEmits(['callback', 'openMultiForm']);
//注册model const { tableContext } = useListPage({
const [registerExecuteModal, { openModal: openExecuteModal }] = useModal();
//注册table数据
const { prefixCls, tableContext } = useListPage({
tableProps: { tableProps: {
title: '问题归档', title: '问题归档',
api: list, api: list,
columns, columns,
canResize: false, canResize: false,
beforeFetch(params) { beforeFetch(params) {
params['bmpNodeId'] = props.currentFlowNode.id params['bpmNodeId'] = props.currentFlowNode.id;
},
actionColumn: {
width: 200,
fixed: 'right',
}, },
actionColumn: { width: 200, fixed: 'right' },
}, },
}); });
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleArchive(record: Recordable) { function handleArchive(record: Recordable) {
problemArchive({id: record.id, }).then(handleSuccess); problemArchive({ id: record.id }).then(handleSuccess);
} }
function handleSuccess() { function handleSuccess() {
(selectedRowKeys.value = []) && reload(); selectedRowKeys.value = [];
reload();
} }
function getTableAction(record) { function getTableAction(record) {
return [ return [{ label: '问题归档', onClick: handleArchive.bind(null, record) }];
{
label: '问题归档',
onClick: handleArchive.bind(null, record),
},
];
} }
</script> </script>
<style scoped></style> <style scoped></style>
import {defHttp} from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage"; import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage(); const { createConfirm } = useMessage();
enum Api { const enum Api {
list = '/problem/stProblemCheck/list', list = '/problem/stProblemCheck/list',
save='/problem/stProblemCheck/add', save='/problem/stProblemCheck/add',
edit='/problem/stProblemCheck/edit', edit='/problem/stProblemCheck/edit',
...@@ -12,35 +12,22 @@ enum Api { ...@@ -12,35 +12,22 @@ enum Api {
importExcel = '/problem/stProblemCheck/importExcel', importExcel = '/problem/stProblemCheck/importExcel',
exportXls = '/problem/stProblemCheck/exportXls', exportXls = '/problem/stProblemCheck/exportXls',
problemArchive = '/problem/stProblemCheck/problemArchive', problemArchive = '/problem/stProblemCheck/problemArchive',
queryById = '/problem/stProblemCheck/queryById',
} }
/**
* 导出api
* @param params
*/
export const getExportUrl = Api.exportXls; export const getExportUrl = Api.exportXls;
/**
* 导入api
*/
export const getImportUrl = Api.importExcel; export const getImportUrl = Api.importExcel;
/**
* 列表接口
* @param params
*/
export const list = (params) =>
defHttp.get({url: Api.list, params});
/** export const list = (params) => defHttp.get({url: Api.list, params});
* 删除单个
*/ export const queryById = (params) => defHttp.get({url: Api.queryById, params});
export const deleteOne = (params,handleSuccess) => {
export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess(); handleSuccess?.();
}); });
} }
/**
* 批量删除
* @param params
*/
export const batchDelete = (params, handleSuccess) => { export const batchDelete = (params, handleSuccess) => {
createConfirm({ createConfirm({
iconType: 'warning', iconType: 'warning',
...@@ -50,26 +37,16 @@ export const batchDelete = (params, handleSuccess) => { ...@@ -50,26 +37,16 @@ export const batchDelete = (params, handleSuccess) => {
cancelText: '取消', cancelText: '取消',
onOk: () => { onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess(); handleSuccess?.();
}); });
} }
}); });
} }
/**
* 保存或者更新 export const saveOrUpdate = (params, isUpdate = false) => {
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save; let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({url: url, params}); return defHttp.post({url: url, params});
} }
/** export const problemArchive = (params) => defHttp.post({url: Api.problemArchive, params});
* 保存或者更新
* @param params
*/
export const problemArchive = (params) => {
let url = Api.problemArchive;
return defHttp.post({url: url, params});
}
import { BasicColumn } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table'; import { FormSchema } from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils'; import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
title: '问题编号', title: '问题编号',
...@@ -357,29 +357,14 @@ export const reviewFormSchema: FormSchema[] = [ ...@@ -357,29 +357,14 @@ export const reviewFormSchema: FormSchema[] = [
}, },
]; ];
/**
* 流程表单调用这个方法获取formSchema-默认弹窗(查看详情)
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] { export function getBpmFormSchema(_formData): FormSchema[] {
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema; return formSchema;
} }
/**
* 流程表单调用这个方法获取formSchema-整改计划
* @param param
*/
export function getPlanFormSchema(_planFormSchema): FormSchema[] { export function getPlanFormSchema(_planFormSchema): FormSchema[] {
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return planFormSchema; return planFormSchema;
} }
/**
* 流程表单调用这个方法获取formSchema-整改执行
* @param param
*/
export function getExecuteFormSchema(_executeFormSchema): FormSchema[] { export function getExecuteFormSchema(_executeFormSchema): FormSchema[] {
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return executeFormSchema; return executeFormSchema;
} }
...@@ -18,50 +18,35 @@ ...@@ -18,50 +18,35 @@
</a-button> </a-button>
</a-dropdown> </a-dropdown>
</template> </template>
<!--操作栏-->
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" /> <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template> </template>
</BasicTable> </BasicTable>
<!-- 表单区域 -->
<StProblemCheckModal @register="registerModal" @success="handleSuccess" :center="true" /> <StProblemCheckModal @register="registerModal" @success="handleSuccess" :center="true" />
</div> </div>
</template> </template>
<script lang="ts" name="problem-stProblemCheck" setup> <script lang="ts" name="problem-stProblemCheck" setup>
import { ref } from 'vue'; import { ref, unref } from 'vue';
import { BasicTable, TableAction } from '/@/components/Table'; import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import { Icon } from '/@/components/Icon';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import StProblemCheckModal from './components/StProblemCheckModal.vue'; import StProblemCheckModal from './components/StProblemCheckModal.vue';
import { columns, searchFormSchema } from './StProblemCheck.data'; import { columns, searchFormSchema } from './StProblemCheck.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl,saveOrUpdate } from './StProblemCheck.api'; import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, saveOrUpdate } from './StProblemCheck.api';
const props = defineProps({ const props = defineProps({
beforeFlowNode: { beforeFlowNode: { type: Object, default: () => ({}) },
type: Object, currentFlowNode: { type: Object, default: () => ({}) },
default: () => ({}) nextFlowNode: { type: Object, default: () => ({}) },
}, todoList: { type: Array, default: () => [] },
currentFlowNode: { });
type: Object,
default: () => ({})
},
nextFlowNode: {
type: Object,
default: () => ({})
},
todoList: {
type: Array,
default: () => []
}
})
const emit = defineEmits(['callback','startWorkFlow','sendWorkFlow','openMultiForm']) const emit = defineEmits(['callback', 'startWorkFlow', 'sendWorkFlow', 'openMultiForm']);
//注册model
const [registerModal, { openModal }] = useModal(); const [registerModal, { openModal }] = useModal();
const [registerPlanModal, { openModal: openPlanModal }] = useModal(); const [registerPlanModal, { openModal: openPlanModal }] = useModal();
//注册table数据
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: { tableProps: {
title: '问题整改', title: '问题整改',
...@@ -69,55 +54,31 @@ ...@@ -69,55 +54,31 @@
columns, columns,
canResize: false, canResize: false,
beforeFetch(params) { beforeFetch(params) {
params['bmpNodeId'] = props.currentFlowNode.id params['bpmNodeId'] = props.currentFlowNode.id;
params['todoList'] = props.todoList params['todoList'] = props.todoList;
},
actionColumn: {
width: 200,
fixed: 'right',
},
},
exportConfig: {
name: '问题整改',
url: getExportUrl,
}, },
importConfig: { actionColumn: { width: 200, fixed: 'right' },
url: getImportUrl,
success: handleSuccess,
}, },
exportConfig: { name: '问题整改', url: getExportUrl },
importConfig: { url: getImportUrl, success: handleSuccess },
}); });
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
/**
* 新增事件
*/
function handleAdd() { function handleAdd() {
openModal(true, { openModal(true, {
isUpdate: false, isUpdate: false,
showFooter: true, showFooter: true,
record: { record: { bpmNodeId: props.currentFlowNode.id, deployId: props.currentFlowNode.deployId, bpmStatus: 0 },
bmpNodeId: props.currentFlowNode.id,
deployId: props.currentFlowNode.deployId,
bpmStatus: 0,
}
}); });
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true, showFooter: true });
record,
isUpdate: true,
showFooter: true,
});
} }
function handleDetail(record: Recordable) { function handleDetail(record: Recordable) {
openModal(true, { openModal(true, { record, isUpdate: true, showFooter: false });
record,
isUpdate: true,
showFooter: false,
});
} }
async function handleDelete(record) { async function handleDelete(record) {
...@@ -125,77 +86,50 @@ ...@@ -125,77 +86,50 @@
} }
async function batchHandleDelete() { async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess); await batchDelete({ ids: unref(selectedRowKeys) }, handleSuccess);
} }
function handleSuccess(retData) { function handleSuccess(retData) {
(selectedRowKeys.value = []) && reload(); selectedRowKeys.value = [];
if(retData){ reload();
emit('startWorkFlow',retData) if (retData) emit('startWorkFlow', retData);
}
} }
function getTableAction(record) { function getTableAction(record) {
return [ return [
{ { label: '编辑', onClick: handleEdit.bind(null, record) },
label: '编辑', { label: '发送任务', onClick: handleFlow.bind(null, record) },
onClick: handleEdit.bind(null, record),
},
{
label: '发送任务',
onClick: handleFlow.bind(null, record),
},
]; ];
} }
function getDropDownAction(record) { function getDropDownAction(record) {
return [ return [
{ { label: '详情', onClick: handleDetail.bind(null, record) },
label: '详情',
onClick: handleDetail.bind(null, record),
},
{ {
label: '删除', label: '删除',
popConfirm: { popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
},
}, },
]; ];
} }
async function handleFlow(record: Recordable) { async function handleFlow(record: Recordable) {
emit("sendWorkFlow",record) emit('sendWorkFlow', record);
} }
async function handleUpdate(dataId,flowNode) { async function handleUpdate(dataId, flowNode) {
let record = { const record = { bpmNodeId: flowNode.id, deployId: flowNode.deployId, bpmStatus: 2, id: dataId };
bmpNodeId: flowNode.id, await saveOrUpdate(record, true);
deployId: flowNode.deployId, selectedRowKeys.value = [];
bpmStatus: 2, reload();
id:dataId
}
await saveOrUpdate(record,true).then(res => {
(selectedRowKeys.value = []) && reload();
})
} }
async function handleStartUpdate(flowData) { async function handleStartUpdate(flowData) {
let record = { const record = { procInsId: flowData.procInsId, id: flowData.dataId, bpmStatus: 0 };
procInsId: flowData.procInsId, await saveOrUpdate(record, true);
id:flowData.dataId,
bpmStatus: 0,
}
await saveOrUpdate(record,true).then(res => {
handleSuccess(null); handleSuccess(null);
})
} }
defineExpose({ defineExpose({ handleUpdate, handleStartUpdate });
handleUpdate,
handleStartUpdate
})
</script> </script>
<style scoped></style> <style scoped></style>
<template> <template>
<div> <div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题--> <template #tableTitle></template>
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="getTableAction(record)"/> <TableAction :actions="getTableAction(record)" />
</template> </template>
</BasicTable> </BasicTable>
<!-- 整改执行 -->
<StProblemCheckExecuteModal @register="registerExecuteModal" @success="handleSuccess" />
</div> </div>
</template> </template>
<script lang="ts" name="problem-stProblemCheck" setup> <script lang="ts" name="problem-stProblemCheck" setup>
import { BasicTable, TableAction } from '/@/components/Table'; import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import { columns, searchFormSchema } from './StProblemCheck.data'; import { columns } from './StProblemCheck.data';
import { list, saveOrUpdate } from './StProblemCheck.api'; import { list, saveOrUpdate } from './StProblemCheck.api';
import StProblemCheckExecuteModal from './components/StProblemCheckExecuteModal.vue';
const emit = defineEmits(['callback','sendWorkFlow','openMultiForm'])
const props = defineProps({ const props = defineProps({
beforeFlowNode: { beforeFlowNode: { type: Object, default: () => ({}) },
type: Object, currentFlowNode: { type: Object, default: () => ({}) },
default: () => ({}) nextFlowNode: { type: Object, default: () => ({}) },
}, });
currentFlowNode: {
type: Object, const emit = defineEmits(['callback', 'sendWorkFlow', 'openMultiForm']);
default: () => ({})
},
nextFlowNode: {
type: Object,
default: () => ({})
}
})
//注册model const { tableContext } = useListPage({
const [registerExecuteModal, { openModal: openExecuteModal }] = useModal();
//注册table数据
const { prefixCls, tableContext } = useListPage({
tableProps: { tableProps: {
title: '计划执行审批', title: '计划执行审批',
api: list, api: list,
columns, columns,
canResize: true, canResize: true,
beforeFetch(params) { beforeFetch(params) {
params['bmpNodeId'] = props.currentFlowNode.id params['bpmNodeId'] = props.currentFlowNode.id;
},
actionColumn: {
width: 200,
fixed: 'right',
}, },
actionColumn: { width: 200, fixed: 'right' },
}, },
}); });
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleExecuteApproval(record: Recordable) { function handleExecuteApproval(record: Recordable) {
emit("openMultiForm",record) emit('openMultiForm', record);
} }
function handleSuccess() { function handleSendNext(record: Recordable) {
(selectedRowKeys.value = []) && reload(); emit('sendWorkFlow', record);
} }
function handleSendNext(record: Recordable) { function handleSuccess() {
emit("sendWorkFlow",record) selectedRowKeys.value = [];
reload();
} }
function getTableAction(record) { function getTableAction(record) {
return [ return [
{ { label: '整改审核', onClick: handleExecuteApproval.bind(null, record) },
label: '整改审核', { label: '提交', onClick: handleSendNext.bind(null, record) },
onClick: handleExecuteApproval.bind(null, record),
},
{
label: '提交',
onClick: handleSendNext.bind(null, record),
},
]; ];
} }
async function handleUpdate(dataId) { async function handleUpdate(dataId) {
await saveOrUpdate({ await saveOrUpdate({ bpmNodeId: props.nextFlowNode?.id, id: dataId }, true);
bmpNodeId: props.nextFlowNode.id,
id:dataId,
},true).then(res => {
handleSuccess(); handleSuccess();
})
} }
defineExpose({ defineExpose({ handleUpdate });
handleUpdate,
})
</script> </script>
<style scoped></style> <style scoped></style>
<template> <template>
<div> <div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题--> <template #tableTitle></template>
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="getTableAction(record)"/> <TableAction :actions="getTableAction(record)" />
</template> </template>
</BasicTable> </BasicTable>
<!-- 整改执行 -->
<StProblemCheckExecuteModal @register="registerExecuteModal" @success="handleSuccess" />
</div> </div>
</template> </template>
<script lang="ts" name="problem-stProblemCheck" setup> <script lang="ts" name="problem-stProblemCheck" setup>
import { ref } from 'vue';
import { BasicTable, TableAction } from '/@/components/Table'; import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import { columns, searchFormSchema } from './StProblemCheck.data'; import { columns } from './StProblemCheck.data';
import { list, saveOrUpdate } from './StProblemCheck.api'; import { list, saveOrUpdate } from './StProblemCheck.api';
import StProblemCheckExecuteModal from './components/StProblemCheckExecuteModal.vue';
const emit = defineEmits(['callback','sendWorkFlow','openMultiForm'])
const props = defineProps({ const props = defineProps({
beforeFlowNode: { beforeFlowNode: { type: Object, default: () => ({}) },
type: Object, currentFlowNode: { type: Object, default: () => ({}) },
default: () => ({}) nextFlowNode: { type: Object, default: () => ({}) },
}, });
currentFlowNode: {
type: Object, const emit = defineEmits(['callback', 'sendWorkFlow', 'openMultiForm']);
default: () => ({})
},
nextFlowNode: {
type: Object,
default: () => ({})
}
})
//注册model const { tableContext } = useListPage({
const [registerExecuteModal, { openModal: openExecuteModal }] = useModal();
//注册table数据
const { prefixCls, tableContext } = useListPage({
tableProps: { tableProps: {
title: '问题整改', title: '问题整改',
api: list, api: list,
columns, columns,
canResize: true, canResize: true,
beforeFetch(params) { beforeFetch(params) {
params['bmpNodeId'] = props.currentFlowNode.id params['bpmNodeId'] = props.currentFlowNode.id;
},
actionColumn: {
width: 200,
fixed: 'right',
}, },
actionColumn: { width: 200, fixed: 'right' },
}, },
}); });
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleExecute(record: Recordable) { function handleExecute(record: Recordable) {
emit("openMultiForm",record) emit('openMultiForm', record);
} }
function handleSuccess() { function handleSendNext(record: Recordable) {
(selectedRowKeys.value = []) && reload(); emit('sendWorkFlow', record);
} }
function handleSendNext(record: Recordable) { function handleSuccess() {
emit("sendWorkFlow",record) selectedRowKeys.value = [];
reload();
} }
function getTableAction(record) { function getTableAction(record) {
return [ return [
{ { label: '整改执行', onClick: handleExecute.bind(null, record) },
label: '整改执行', { label: '提交', onClick: handleSendNext.bind(null, record) },
onClick: handleExecute.bind(null, record),
},
{
label: '提交',
onClick: handleSendNext.bind(null, record),
},
]; ];
} }
async function handleUpdate(dataId, flowNode) {
async function handleUpdate(dataId,flowNode) { const record = { bpmNodeId: flowNode.id, deployId: flowNode.deployId, bpmStatus: 2, id: dataId };
let record = { await saveOrUpdate(record, true);
bmpNodeId: flowNode.id,
deployId: flowNode.deployId,
bpmStatus: 2,
id:dataId
}
await saveOrUpdate(record,true).then(res => {
handleSuccess(); handleSuccess();
})
} }
defineExpose({ defineExpose({ handleUpdate });
handleUpdate,
})
</script> </script>
<style scoped></style> <style scoped></style>
<template> <template>
<div> <div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题--> <template #tableTitle></template>
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="getTableAction(record)"/> <TableAction :actions="getTableAction(record)" />
</template> </template>
</BasicTable> </BasicTable>
<!-- 整改执行 -->
<StProblemCheckExecuteModal @register="registerExecuteModal" @success="handleSuccess" />
</div> </div>
</template> </template>
<script lang="ts" name="problem-stProblemCheck" setup> <script lang="ts" name="problem-stProblemCheck" setup>
import { ref } from 'vue';
import { BasicTable, TableAction } from '/@/components/Table'; import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import { columns, searchFormSchema } from './StProblemCheck.data'; import { columns } from './StProblemCheck.data';
import { list, saveOrUpdate } from './StProblemCheck.api'; import { list, saveOrUpdate } from './StProblemCheck.api';
import StProblemCheckExecuteModal from './components/StProblemCheckExecuteModal.vue';
const props = defineProps({ const props = defineProps({
beforeFlowNode: { beforeFlowNode: { type: Object, default: () => ({}) },
type: Object, currentFlowNode: { type: Object, default: () => ({}) },
default: () => ({}) nextFlowNode: { type: Object, default: () => ({}) },
}, });
currentFlowNode: {
type: Object,
default: () => ({})
},
nextFlowNode: {
type: Object,
default: () => ({})
}
})
const emit = defineEmits(['callback','sendWorkFlow','openMultiForm']) const emit = defineEmits(['callback', 'sendWorkFlow', 'openMultiForm']);
//注册model const { tableContext } = useListPage({
const [registerExecuteModal, { openModal: openExecuteModal }] = useModal();
//注册table数据
const { prefixCls, tableContext } = useListPage({
tableProps: { tableProps: {
title: '问题整改', title: '问题整改',
api: list, api: list,
columns, columns,
canResize: false, canResize: false,
beforeFetch(params) { beforeFetch(params) {
params['bmpNodeId'] = props.currentFlowNode.id params['bpmNodeId'] = props.currentFlowNode.id;
},
actionColumn: {
width: 200,
fixed: 'right',
}, },
actionColumn: { width: 200, fixed: 'right' },
}, },
}); });
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handlePlanApproval(record: Recordable) { function handlePlanApproval(record: Recordable) {
emit("openMultiForm",record) emit('openMultiForm', record);
} }
function handleSuccess() { function handleSendNext(record: Recordable) {
(selectedRowKeys.value = []) && reload(); emit('sendWorkFlow', record);
} }
function handleSendNext(record: Recordable) { function handleSuccess() {
emit("sendWorkFlow",record) selectedRowKeys.value = [];
reload();
} }
function getTableAction(record) { function getTableAction(record) {
return [ return [
{ { label: '计划审核', onClick: handlePlanApproval.bind(null, record) },
label: '计划审核',
onClick: handlePlanApproval.bind(null, record),
},
// {
// label: '提交',
// onClick: handleSendNext.bind(null, record),
// },
]; ];
} }
async function handleUpdate(dataId,flowNode) { async function handleUpdate(dataId, flowNode) {
let record = { const record = { bpmNodeId: flowNode.id, deployId: flowNode.deployId, bpmStatus: 2, id: dataId };
bmpNodeId: flowNode.id, await saveOrUpdate(record, true);
deployId: flowNode.deployId,
bpmStatus: 2,
id:dataId
}
await saveOrUpdate(record,true).then(res => {
handleSuccess(); handleSuccess();
})
} }
defineExpose({ defineExpose({ handleUpdate });
handleUpdate,
})
</script> </script>
<style scoped></style> <style scoped></style>
<template> <template>
<div> <div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题--> <template #tableTitle></template>
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="getTableAction(record)"/> <TableAction :actions="getTableAction(record)" />
</template> </template>
</BasicTable> </BasicTable>
<!-- 整改执行 -->
<StProblemCheckExecuteModal @register="registerExecuteModal" @success="handleSuccess" />
</div> </div>
</template> </template>
<script lang="ts" name="problem-stProblemCheck" setup> <script lang="ts" name="problem-stProblemCheck" setup>
import { ref } from 'vue';
import { BasicTable, TableAction } from '/@/components/Table'; import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import { columns, searchFormSchema } from './StProblemCheck.data'; import { columns } from './StProblemCheck.data';
import { list,saveOrUpdate} from './StProblemCheck.api'; import { list, saveOrUpdate } from './StProblemCheck.api';
import StProblemCheckExecuteModal from './components/StProblemCheckExecuteModal.vue';
const emit = defineEmits(['callback','sendWorkFlow','openMultiForm'])
const props = defineProps({ const props = defineProps({
beforeFlowNode: { beforeFlowNode: { type: Object, default: () => ({}) },
type: Object, currentFlowNode: { type: Object, default: () => ({}) },
default: () => ({}) nextFlowNode: { type: Object, default: () => ({}) },
}, });
currentFlowNode: {
type: Object,
default: () => ({})
},
nextFlowNode: {
type: Object,
default: () => ({})
}
})
const [registerExecuteModal, { openModal: openExecuteModal }] = useModal(); const emit = defineEmits(['callback', 'sendWorkFlow', 'openMultiForm']);
const { prefixCls, tableContext } = useListPage({
const { tableContext } = useListPage({
tableProps: { tableProps: {
title: '问题整改计划', title: '问题整改计划',
api: list, api: list,
columns, columns,
canResize: false, canResize: false,
beforeFetch(params) { beforeFetch(params) {
params['bmpNodeId'] = props.currentFlowNode.id params['bpmNodeId'] = props.currentFlowNode.id;
},
actionColumn: {
width: 200,
fixed: 'right',
}, },
actionColumn: { width: 200, fixed: 'right' },
}, },
}); });
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handlePlan(record: Recordable) { function handlePlan(record: Recordable) {
emit("openMultiForm",record) emit('openMultiForm', record);
} }
async function handleSendNext(record: Recordable) { function handleSendNext(record: Recordable) {
emit("sendWorkFlow",record) emit('sendWorkFlow', record);
} }
function handleSuccess() { function handleSuccess() {
(selectedRowKeys.value = []) && reload(); selectedRowKeys.value = [];
reload();
} }
function getTableAction(record) { function getTableAction(record) {
return [ return [
{ { label: '制定计划', onClick: handlePlan.bind(null, record) },
label: '制定计划', { label: '提交', onClick: handleSendNext.bind(null, record) },
onClick: handlePlan.bind(null, record),
},
{
label: '提交',
onClick: handleSendNext.bind(null, record),
},
]; ];
} }
async function handleUpdate(dataId,flowNode) { async function handleUpdate(dataId, flowNode) {
let record = { const record = { bpmNodeId: flowNode.id, deployId: flowNode.deployId, bpmStatus: 2, id: dataId };
bmpNodeId: flowNode.id, await saveOrUpdate(record, true);
deployId: flowNode.deployId,
bpmStatus: 2,
id:dataId
}
await saveOrUpdate(record,true).then(res => {
handleSuccess(); handleSuccess();
})
} }
defineExpose({ defineExpose({ handleUpdate });
handleUpdate,
})
</script> </script>
<style scoped></style> <style scoped></style>
<template>
<div>
<vxe-drawer
show-confirm-button
show-cancel-button
v-model="showPopup"
:title="pageTilte"
width="100%"
height="100%"
:loading="loading"
>
<iframe
id="iframeId"
ref="iframeRef"
:src="frmUrl"
frameborder="0"
style="width: 100%; height: 100%;"
></iframe>
</vxe-drawer>
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted,nextTick } from "vue";
import { useUserStoreWithOut } from "/@/store/modules/user";
import { defHttp } from '/@/utils/http/axios';
import { getToken } from '/@/utils/auth';
const user = useUserStoreWithOut();
const showPopup = ref(false);
const frmUrl = ref("");
const loading = ref(false);
const pageTilte = ref("");
const iframeRef = ref<HTMLIFrameElement>();
const iniPage = async (data) => {
pageTilte.value = data.projectName;
showPopup.value = true;
frmUrl.value = `${import.meta.env.VITE_APP_JFLOW_CORE_ADDR}/#/WF/MyFlow?FlowNo=102&Token=${user.getJflowToken}&tid=${data.id}`;
const setSourctUrl = '/api/jflow/setCCWorkId';
await defHttp.get({
url: setSourctUrl,
params: {"targetId":data.id,"targetKey":"targetKey","token":getToken()},
});
}
// 暴露方法
defineExpose({ iniPage });
</script>
...@@ -38,32 +38,17 @@ ...@@ -38,32 +38,17 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue'; import { ref, reactive, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { getValueType } from '/@/utils';
import { Form } from 'ant-design-vue'; import { Form } from 'ant-design-vue';
import { useTabs } from '/@/hooks/web/useTabs';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import { useUserStoreWithOut } from '/@/store/modules/user';
import { useRouter } from 'vue-router';
import { getAuthCache, setAuthCache, removeAuthCache } from '/@/utils/auth';
import { TOKEN_KEY } from '/@/enums/cacheEnum';
import { useUserStore } from '/@/store/modules/user';
const router = useRouter();
const user = useUserStoreWithOut();
const { closeCurrent, refreshPage, setTitle } = useTabs();
const props = defineProps({ const props = defineProps({
formDisabled: { type: Boolean, default: false }, formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => {} }, formData: { type: Object, default: () => ({}) },
formBpm: { type: Boolean, default: true }, formBpm: { type: Boolean, default: true },
}); });
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']); const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({ const formData = reactive<Record<string, any>>({
id: '', id: '',
...@@ -72,65 +57,36 @@ ...@@ -72,65 +57,36 @@
problemSource: '', problemSource: '',
isReceive: '', isReceive: '',
programme: '', programme: '',
labels: '',
actIds: '',
}); });
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } }); const labelCol = ref({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } }); const wrapperCol = ref({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false); const confirmLoading = ref(false);
const loading = ref(false); const disabled = ref(true);
//表单验证
const validatorRules = {};
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
const disabled = ref<boolean>(true);
const listAll = '/problem/stProblemCheck/queryById'; const listAll = '/problem/stProblemCheck/queryById';
// 从URL获取参数
const getUrlParams = () => { const getUrlParams = () => {
const winurl = window.location.href; const winurl = window.location.href;
const params = new URLSearchParams(winurl.split('?')[1]); const params = new URLSearchParams(winurl.split('?')[1]);
return { return { cctoken: params.get('Token') || '', WorkID: params.get('WorkID') || '' };
cctoken: params.get('Token') || '',
WorkID: params.get('WorkID') || '',
};
}; };
const iniData = async () => { const iniData = async () => {
try { try {
loading.value = true; confirmLoading.value = true;
const { cctoken, WorkID } = getUrlParams(); const { cctoken, WorkID } = getUrlParams();
console.log('Token:', cctoken, 'WorkID:', WorkID);
const timestamp = new Date().getTime(); const timestamp = new Date().getTime();
const gettokeyUrl = '/api/jflow/getCCWorkTokenAndTid'; const gettokeyUrl = '/api/jflow/getCCWorkTokenAndTid';
const { tid, token } = await defHttp.get({ const { tid, token } = await defHttp.get({
url: gettokeyUrl, url: gettokeyUrl,
params: { params: { targetKey: 'targetKey', flowToken: cctoken, WorkID: WorkID, _t: timestamp },
targetKey: 'targetKey',
flowToken: cctoken,
WorkID: WorkID,
_t: timestamp,
},
}); });
console.log('问题整改tid ', tid);
// setAuthCache(TOKEN_KEY, token);
//params: { id: tid, token: token, "_t": timestamp },
defHttp.get({ url: listAll, params: { token: token, id: tid } }).then((res) => {
console.log('res ', res);
defHttp.get({ url: listAll, params: { token, id: tid } }).then((res) => {
formData.problemItem = res.problemItem; formData.problemItem = res.problemItem;
formData.problemDes = res.problemDes; formData.problemDes = res.problemDes;
formData.problemSource = res.problemSource; formData.problemSource = res.problemSource;
if (res.isReceive == '1') { formData.isReceive = res.isReceive == '1' ? '是' : '否';
formData.isReceive = '是';
} else {
formData.isReceive = '否';
}
formData.programme = res.programme; formData.programme = res.programme;
formData.strategy = res.strategy; formData.strategy = res.strategy;
}); });
...@@ -138,21 +94,18 @@ ...@@ -138,21 +94,18 @@
console.error('初始化表单数据失败:', error); console.error('初始化表单数据失败:', error);
createMessage.error('初始化表单数据失败'); createMessage.error('初始化表单数据失败');
} finally { } finally {
loading.value = false; confirmLoading.value = false;
} }
}; };
onMounted(async () => { onMounted(() => { iniData(); });
iniData();
});
defineExpose({}); defineExpose({});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.antd-modal-form { .antd-modal-form {
min-height: 500px !important; min-height: 500px !important;
overflow-y: auto; overflow-y: auto;
padding: 24px 24px 24px 24px; padding: 24px;
} }
</style> </style>
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
try { try {
let values = await validate(); let values = await validate();
values.bpmStatus = bpmFlowData.value?.bpmStatus || ''; values.bpmStatus = bpmFlowData.value?.bpmStatus || '';
values.bmpNodeId = bpmFlowData.value?.bmpNodeId || ''; values.bpmNodeId = bpmFlowData.value?.bpmNodeId || '';
values.deployId = bpmFlowData.value?.deployId || ''; values.deployId = bpmFlowData.value?.deployId || '';
setModalProps({ confirmLoading: true }); setModalProps({ confirmLoading: true });
//提交表单 //提交表单
......
...@@ -65,12 +65,11 @@ ...@@ -65,12 +65,11 @@
} }
// 保存按钮 // 保存按钮
async function saveForm() { async function saveForm(formData) {
try { try {
let data = getFieldsValue();
let params = Object.assign({}, currentFormData.value, data);
const result = await saveOrUpdate(params, true);
const result = await saveOrUpdate(formData, true);
alert(JSON.stringify(result))
// 保存成功后更新表单 // 保存成功后更新表单
if (result && result.id) { if (result && result.id) {
await initFormData(result.id); await initFormData(result.id);
......
import { ref, computed } from 'vue';
import { useListPage } from '/@/hooks/system/useListPage';
import { list, saveOrUpdate } from '../StProblemCheck.api';
import { columns } from '../StProblemCheck.data';
export function useProblemList(props) {
const { tableContext, reload } = useListPage({
tableProps: {
title: props?.title || '问题整改',
api: list,
columns,
canResize: props?.canResize ?? false,
beforeFetch(params) {
if (props?.currentFlowNode?.id) {
params['bpmNodeId'] = props.currentFlowNode.id;
}
if (props?.todoList) {
params['todoList'] = props.todoList;
}
},
actionColumn: {
width: 200,
fixed: 'right',
},
},
exportConfig: {
name: '问题整改',
url: '/problem/stProblemCheck/exportXls',
},
importConfig: {
url: '/problem/stProblemCheck/importExcel',
},
});
const [registerTable, , { rowSelection, selectedRowKeys }] = tableContext;
async function handleUpdate(dataId, flowNode) {
const record = {
bpmNodeId: flowNode.id,
deployId: flowNode.deployId,
bpmStatus: 2,
id: dataId,
};
await saveOrUpdate(record, true);
selectedRowKeys.value = [];
reload();
}
function handleSuccess() {
selectedRowKeys.value = [];
reload();
}
return {
registerTable,
reload,
rowSelection,
selectedRowKeys,
handleUpdate,
handleSuccess,
};
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论