|
|
@@ -3,7 +3,12 @@
|
|
|
<BasicForm ref="basicFormRef" :formData="ruleFormData" :formConfig="ruleFormConfig">
|
|
|
<template #taskType>
|
|
|
<div class="task-type-container">
|
|
|
- <el-select v-model="ruleFormData.taskType" placeholder="请选择检查类型" @change="handleTaskTypeChange">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleFormData.taskType"
|
|
|
+ placeholder="请选择检查类型"
|
|
|
+ @change="handleTaskTypeChange"
|
|
|
+ disabled
|
|
|
+ >
|
|
|
<el-option v-for="item in TASK_TYPE_OPTIONS" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
|
<el-select v-model="ruleFormData.taskTemplate" placeholder="请选择关联模板" disabled>
|
|
|
@@ -12,13 +17,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<template #checkUser>
|
|
|
- <el-select
|
|
|
- v-model="ruleFormData.checkUser"
|
|
|
- value-key="id"
|
|
|
- multiple
|
|
|
- placeholder="请选择人员"
|
|
|
- @click="userInfo = true"
|
|
|
- >
|
|
|
+ <el-select v-model="ruleFormData.checkUser" value-key="id" multiple placeholder="请选择人员" disabled>
|
|
|
<el-option
|
|
|
v-for="user in userOptions"
|
|
|
:key="user.id"
|
|
|
@@ -28,22 +27,12 @@
|
|
|
</el-select>
|
|
|
</template>
|
|
|
<template #isPush>
|
|
|
- <el-radio-group v-model="ruleFormData.isPush">
|
|
|
+ <el-radio-group v-model="ruleFormData.isPush" disabled>
|
|
|
<el-radio :value="true">是</el-radio>
|
|
|
<el-radio :value="false">否</el-radio>
|
|
|
</el-radio-group>
|
|
|
</template>
|
|
|
</BasicForm>
|
|
|
- <el-dialog
|
|
|
- v-model="userInfo"
|
|
|
- title="添加人员"
|
|
|
- align-center
|
|
|
- :close-on-click-modal="false"
|
|
|
- :destroy-on-close="true"
|
|
|
- class="customDialog--pushObject"
|
|
|
- >
|
|
|
- <User :customUserList="ruleFormData.checkUser" @cancel="userInfo = false" @submit="handleSubmit" />
|
|
|
- </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -55,11 +44,14 @@
|
|
|
import { TaskManagementRuleForm } from '../type';
|
|
|
import { TASK_TYPE_OPTIONS } from '../constants/task-execution';
|
|
|
import { TASK_TEMPLATE_LIST } from '../constants/template-detail';
|
|
|
- import User from '@/views/disaster/components/User.vue';
|
|
|
+ import { getTaskManagementItem } from '@/api/task-execution/tableData';
|
|
|
import type { UserInfo } from '@/types/push-object';
|
|
|
- import type { TreeNodeData } from '@/views/disaster/types';
|
|
|
+ import { cloneDeep } from 'lodash-es';
|
|
|
+
|
|
|
+ const props = defineProps<{
|
|
|
+ id: number;
|
|
|
+ }>();
|
|
|
|
|
|
- const userInfo = ref(false);
|
|
|
const userOptions = ref<UserInfo[]>([]);
|
|
|
const basicFormRef = ref<InstanceType<typeof BasicForm>>();
|
|
|
|
|
|
@@ -67,54 +59,36 @@
|
|
|
ruleFormData.taskTemplate = taskType;
|
|
|
};
|
|
|
|
|
|
- const { ruleFormConfig, ruleFormData, formRules, cloneRuleFormData, beforeRouteLeave } =
|
|
|
- useFormConfigHook<TaskManagementRuleForm>(
|
|
|
- TASK_MANAGEMENT_FROM_CONFIG,
|
|
|
- TASK_MANAGEMENT_FROM_DATA,
|
|
|
- TASK_MANAGEMENT_FROM_RULES,
|
|
|
- );
|
|
|
+ const TASK_MANAGEMENT_FROM_CONFIG_DISABLED = cloneDeep(TASK_MANAGEMENT_FROM_CONFIG).map((item) => {
|
|
|
+ if (item.componentProps) {
|
|
|
+ item.componentProps = { ...item.componentProps, disabled: true };
|
|
|
+ }
|
|
|
+ return item;
|
|
|
+ });
|
|
|
|
|
|
- const handleSubmit = (selectedPersonList: TreeNodeData[]) => {
|
|
|
- ruleFormData.checkUser = selectedPersonList.map((user) => {
|
|
|
- return {
|
|
|
- id: user.id,
|
|
|
- username: user.name.split('-')[0],
|
|
|
- realname: user.name.split('-')[1],
|
|
|
- };
|
|
|
- });
|
|
|
- userOptions.value = ruleFormData.checkUser;
|
|
|
- };
|
|
|
+ const { ruleFormConfig, ruleFormData, cloneRuleFormData } = useFormConfigHook<TaskManagementRuleForm>(
|
|
|
+ TASK_MANAGEMENT_FROM_CONFIG_DISABLED,
|
|
|
+ TASK_MANAGEMENT_FROM_DATA,
|
|
|
+ TASK_MANAGEMENT_FROM_RULES,
|
|
|
+ );
|
|
|
|
|
|
- const handleValidate = async () => {
|
|
|
- if (!basicFormRef.value) return;
|
|
|
- const parentValidateResult = await basicFormRef.value.validateForm();
|
|
|
- return parentValidateResult;
|
|
|
- };
|
|
|
- const getFormData = () => {
|
|
|
+ const getTaskManagementItemInfo = async () => {
|
|
|
+ const res = await getTaskManagementItem(props.id);
|
|
|
+ userOptions.value = res.checkUser;
|
|
|
+ for (const key in res) {
|
|
|
+ if (key in ruleFormData) {
|
|
|
+ ruleFormData[key] = res[key as keyof typeof res];
|
|
|
+ }
|
|
|
+ }
|
|
|
cloneRuleFormData();
|
|
|
- return ruleFormData;
|
|
|
};
|
|
|
- defineExpose({
|
|
|
- handleValidate,
|
|
|
- getFormData,
|
|
|
- });
|
|
|
|
|
|
onMounted(() => {
|
|
|
- ruleFormData.createUser = 'XXX';
|
|
|
- cloneRuleFormData();
|
|
|
- beforeRouteLeave();
|
|
|
+ getTaskManagementItemInfo();
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
@use '@/views/disaster/style/info-container.scss' as *;
|
|
|
- :deep(.el-date-editor) {
|
|
|
- --el-date-editor-width: 100%;
|
|
|
- }
|
|
|
- .task-type-container {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- gap: 10cpx;
|
|
|
- width: 100%;
|
|
|
- }
|
|
|
+ @use '../style/task-item.scss' as *;
|
|
|
</style>
|