czh-20260501-增加密级相关功能
This commit is contained in:
@@ -1,19 +1,36 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" destroy-on-close title="创建任务" :width="600" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
<div class="attachment-row">
|
||||
<span class="attachment-label">附件</span>
|
||||
<span class="attachment-trigger" @click="openFileUploadModal">添加附件</span>
|
||||
<TaskAttachmentUpload
|
||||
ref="fileUploadRef"
|
||||
:bussiness-id="''"
|
||||
:bussiness-secret-level="currentSecretLevel"
|
||||
:disabled="false"
|
||||
style="display: none"
|
||||
/>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import TaskAttachmentUpload from './TaskAttachmentUpload.vue';
|
||||
import { createTaskFormSchema } from '../TaskList.data';
|
||||
import { addTask } from '../TaskList.api';
|
||||
import { checkUserSecLevel } from '../utils/taskUtils';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const groupId = ref('');
|
||||
const mainId = ref('');
|
||||
const currentSecretLevel = ref(1);
|
||||
const currentSecretText = ref('非密');
|
||||
const fileUploadRef = ref<InstanceType<typeof TaskAttachmentUpload> | null>(null);
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
@@ -26,6 +43,8 @@
|
||||
await resetFields();
|
||||
groupId.value = data?.groupId || '';
|
||||
mainId.value = data?.mainId || '';
|
||||
currentSecretLevel.value = data?.secretLevel || 1;
|
||||
currentSecretText.value = data?.secretText || '非密';
|
||||
if (groupId.value) {
|
||||
await setFieldsValue({ groupId: groupId.value });
|
||||
}
|
||||
@@ -35,7 +54,16 @@
|
||||
try {
|
||||
setModalProps({ confirmLoading: true });
|
||||
const values = await validate();
|
||||
await addTask({
|
||||
|
||||
if (values.assigneeId) {
|
||||
const { ok, invalidNames } = await checkUserSecLevel(values.assigneeId, currentSecretLevel.value);
|
||||
if (!ok) {
|
||||
message.warning(`以下人员的密级不满足当前清单(${currentSecretText.value})要求:${invalidNames.join('、')}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const result = await addTask({
|
||||
mainId: mainId.value,
|
||||
taskName: values.taskName,
|
||||
taskDesc: values.taskDesc || '',
|
||||
@@ -46,10 +74,42 @@
|
||||
startTime: values.startTime || null,
|
||||
endTime: values.endTime || null,
|
||||
});
|
||||
if (fileUploadRef.value?.hasPendingFiles()) {
|
||||
await fileUploadRef.value.bindBussinessId(result);
|
||||
}
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
function openFileUploadModal() {
|
||||
fileUploadRef.value?.handleOpenUploadModal();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.attachment-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 0 16px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.attachment-label {
|
||||
width: 100px;
|
||||
flex-shrink: 0;
|
||||
text-align: right;
|
||||
font-size: 14px;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.attachment-trigger {
|
||||
color: #8c8c8c;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
&:hover {
|
||||
color: #3370ff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user