|
@@ -1,7 +1,25 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div>
|
|
<div>
|
|
|
<BasicForm ref="basicFormRef" :formData="ruleFormData" :formRules="formRules" :formConfig="ruleFormConfig">
|
|
<BasicForm ref="basicFormRef" :formData="ruleFormData" :formRules="formRules" :formConfig="ruleFormConfig">
|
|
|
- <template #personInChargeId> </template>
|
|
|
|
|
|
|
+ <template #personInChargeName>
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="ruleFormData.personInChargeName"
|
|
|
|
|
+ placeholder="请输入负责人姓名"
|
|
|
|
|
+ value-key="id"
|
|
|
|
|
+ filterable
|
|
|
|
|
+ remote
|
|
|
|
|
+ :remote-method="remoteMethod"
|
|
|
|
|
+ :loading="loading"
|
|
|
|
|
+ @change="selectKeeper"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in userOptions"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="`${item.realname}(${item.username})${item.deptName}`"
|
|
|
|
|
+ :value="item"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </template>
|
|
|
<template #drillDeptIdList>
|
|
<template #drillDeptIdList>
|
|
|
<el-cascader
|
|
<el-cascader
|
|
|
v-model="ruleFormData.drillDeptIdList"
|
|
v-model="ruleFormData.drillDeptIdList"
|
|
@@ -15,7 +33,19 @@
|
|
|
>
|
|
>
|
|
|
</el-cascader>
|
|
</el-cascader>
|
|
|
</template>
|
|
</template>
|
|
|
- <template #drillScript> </template>
|
|
|
|
|
|
|
+ <template #drillScript>
|
|
|
|
|
+ <UploadFiles
|
|
|
|
|
+ ref="uploadFilesRef"
|
|
|
|
|
+ label="上传材料"
|
|
|
|
|
+ :fileList="unformatAttachment(props.drillData.drillScript)"
|
|
|
|
|
+ @uploadSuccess="
|
|
|
|
|
+ (files) => {
|
|
|
|
|
+ fileList = files;
|
|
|
|
|
+ ruleFormData.drillScript = files;
|
|
|
|
|
+ }
|
|
|
|
|
+ "
|
|
|
|
|
+ />
|
|
|
|
|
+ </template>
|
|
|
</BasicForm>
|
|
</BasicForm>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -33,6 +63,9 @@
|
|
|
} from '../configs/plan/form';
|
|
} from '../configs/plan/form';
|
|
|
import { DeptTree } from '@/types/dept/type';
|
|
import { DeptTree } from '@/types/dept/type';
|
|
|
import { getAllDepartments } from '@/api/auth/dept';
|
|
import { getAllDepartments } from '@/api/auth/dept';
|
|
|
|
|
+ import type { QueryUserInfoByUserNameRes } from '@/types/person-group/type';
|
|
|
|
|
+ import { queryUserInfoByUserName } from '@/api/system/person-group';
|
|
|
|
|
+ import UploadFiles from '@/views/disaster/components/UploadFiles.vue';
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
|
drillData: DrillPlanItemDetail;
|
|
drillData: DrillPlanItemDetail;
|
|
@@ -45,11 +78,12 @@
|
|
|
DRILL_EXECUTE_FORM_CONFIG,
|
|
DRILL_EXECUTE_FORM_CONFIG,
|
|
|
props.drillData
|
|
props.drillData
|
|
|
? {
|
|
? {
|
|
|
- id: props.drillData.id,
|
|
|
|
|
|
|
+ drillPlanId: props.drillData.id,
|
|
|
drillTime: props.drillData.drillTime,
|
|
drillTime: props.drillData.drillTime,
|
|
|
drillLocation: props.drillData.drillLocation,
|
|
drillLocation: props.drillData.drillLocation,
|
|
|
personInChargeId: props.drillData.personInChargeId,
|
|
personInChargeId: props.drillData.personInChargeId,
|
|
|
- drillDeptIdList: undefined,
|
|
|
|
|
|
|
+ personInChargeName: props.drillData.personInChargeName,
|
|
|
|
|
+ drillDeptIdList: stringToArray(props.drillData.drillDeptIdList),
|
|
|
drillScript: props.drillData.drillScript,
|
|
drillScript: props.drillData.drillScript,
|
|
|
}
|
|
}
|
|
|
: DRILL_EXECUTE_FORM_DATA,
|
|
: DRILL_EXECUTE_FORM_DATA,
|
|
@@ -64,9 +98,67 @@
|
|
|
deptTree.value = result;
|
|
deptTree.value = result;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ const userOptions = ref<QueryUserInfoByUserNameRes[]>([]);
|
|
|
|
|
+ const loading = ref<boolean>(false);
|
|
|
|
|
+
|
|
|
|
|
+ const fileList = ref();
|
|
|
|
|
+ fileList.value = unformatAttachment(props.drillData.drillScript);
|
|
|
|
|
+
|
|
|
|
|
+ const remoteMethod = async (query: string) => {
|
|
|
|
|
+ if (!query) {
|
|
|
|
|
+ userOptions.value = [];
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ loading.value = true;
|
|
|
|
|
+ userOptions.value = await queryUserInfoByUserName(query);
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
loadDeptTreeData();
|
|
loadDeptTreeData();
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ const handleValidate = async () => {
|
|
|
|
|
+ if (!basicFormRef.value) return;
|
|
|
|
|
+ const validateResult = await basicFormRef.value.validateForm();
|
|
|
|
|
+ return validateResult;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const handleClearValidate = () => {
|
|
|
|
|
+ if (!basicFormRef.value) return;
|
|
|
|
|
+ basicFormRef.value.clearValidate();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ function getFormData() {
|
|
|
|
|
+ return ruleFormData;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ defineExpose({
|
|
|
|
|
+ handleValidate,
|
|
|
|
|
+ handleClearValidate,
|
|
|
|
|
+ getFormData,
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ function selectKeeper(value) {
|
|
|
|
|
+ if (!value) return;
|
|
|
|
|
+ ruleFormData.personInChargeId = value.id;
|
|
|
|
|
+ ruleFormData.personInChargeName = value.realname;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function stringToArray(str?: string): number[] | undefined {
|
|
|
|
|
+ if (!str) return undefined;
|
|
|
|
|
+ // 去除字符串中的方括号
|
|
|
|
|
+ const trimmed = str.replace(/\[|\]/g, '');
|
|
|
|
|
+ // 将剩余部分转换为数字并放入数组
|
|
|
|
|
+ return [Number(trimmed)];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function unformatAttachment(file?: string) {
|
|
|
|
|
+ if (!file) return undefined;
|
|
|
|
|
+ const fileData = JSON.parse(file);
|
|
|
|
|
+ console.log(fileData);
|
|
|
|
|
+ return [fileData];
|
|
|
|
|
+ }
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped></style>
|
|
<style scoped></style>
|