|
@@ -55,19 +55,6 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
- <!--
|
|
|
|
|
- <el-row>
|
|
|
|
|
- <el-col :span="12">
|
|
|
|
|
- <el-form-item label="总数" prop="workloadTotal">
|
|
|
|
|
- <el-input v-model="formData.workloadTotal" placeholder="请输入工作量总数" disabled/>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
- <el-col :span="12">
|
|
|
|
|
- <el-form-item label="已完成" prop="workloadFinish">
|
|
|
|
|
- <el-input v-model="formData.workloadFinish" placeholder="已完成工作量" disabled/>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
- </el-row> -->
|
|
|
|
|
|
|
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
@@ -198,7 +185,7 @@
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item label="井号" prop="wellName">
|
|
<el-form-item label="井号" prop="wellName">
|
|
|
- <el-input v-model="currentTask.wellName" placeholder="请输入井号" />
|
|
|
|
|
|
|
+ <el-input v-model="currentTask.wellName" placeholder="请输入井号" :disabled="currentTask.platformWell === '1'"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
@@ -244,37 +231,12 @@
|
|
|
</div>
|
|
</div>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
- <!--
|
|
|
|
|
- <el-col :span="8">
|
|
|
|
|
- <el-form-item label="井型" prop="wellType">
|
|
|
|
|
- <el-select v-model="currentTask.wellType" placeholder="请选择井型" clearable>
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="dict in getStrDictOptions(DICT_TYPE.PMS_PROJECT_WELL_TYPE)"
|
|
|
|
|
- :key="dict.value"
|
|
|
|
|
- :label="dict.label"
|
|
|
|
|
- :value="dict.value"
|
|
|
|
|
- />
|
|
|
|
|
- </el-select>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
- <el-col :span="8">
|
|
|
|
|
- <el-form-item label="井别" prop="wellCategory">
|
|
|
|
|
- <el-select v-model="currentTask.wellCategory" placeholder="请选择井别" clearable>
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="dict in getStrDictOptions(DICT_TYPE.PMS_PROJECT_WELL_CATEGORY)"
|
|
|
|
|
- :key="dict.value"
|
|
|
|
|
- :label="dict.label"
|
|
|
|
|
- :value="dict.value"
|
|
|
|
|
- />
|
|
|
|
|
- </el-select>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col> -->
|
|
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item label="设计工作量" prop="workloadDesign">
|
|
<el-form-item label="设计工作量" prop="workloadDesign">
|
|
|
- <el-input v-model="currentTask.workloadDesign" placeholder="请输入设计工作量" />
|
|
|
|
|
|
|
+ <el-input v-model="currentTask.workloadDesign" placeholder="请输入设计工作量" :disabled="currentTask.platformWell === '1'"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
@@ -379,6 +341,19 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col :span="8" v-if="isSpecialDept">
|
|
|
|
|
+ <el-form-item label="平台井" prop="platformWell">
|
|
|
|
|
+ <el-switch
|
|
|
|
|
+ v-model="currentTask.platformWell"
|
|
|
|
|
+ active-value="1"
|
|
|
|
|
+ inactive-value="0"
|
|
|
|
|
+ @change="handlePlatformWellChange"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+
|
|
|
<!-- 动态属性部分 -->
|
|
<!-- 动态属性部分 -->
|
|
|
<el-row v-if="dynamicAttrs.length > 0">
|
|
<el-row v-if="dynamicAttrs.length > 0">
|
|
|
<el-col v-for="attr in dynamicAttrs" :key="attr.id" :span="attr.dataType === 'textarea' ? 24 : 8">
|
|
<el-col v-for="attr in dynamicAttrs" :key="attr.id" :span="attr.dataType === 'textarea' ? 24 : 8">
|
|
@@ -442,15 +417,53 @@
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
- <!-- <el-button type="primary" @click="saveTask" :disabled="!currentTask.id && !isNewTask">保存任务</el-button> -->
|
|
|
|
|
<el-button @click="resetTaskForm" v-if="isNewTask">重置</el-button>
|
|
<el-button @click="resetTaskForm" v-if="isNewTask">重置</el-button>
|
|
|
- <!--
|
|
|
|
|
- <el-button type="danger" @click="deleteCurrentTask" v-if="currentTask.id">删除任务</el-button>
|
|
|
|
|
- <el-button @click="addNewTask" v-if="!isNewTask">新增任务</el-button> -->
|
|
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</ContentWrap>
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
+ <ContentWrap v-if="currentTask.platformWell === '1'">
|
|
|
|
|
+ <h3 style="margin-bottom: 20px;">平台井</h3>
|
|
|
|
|
+ <el-table :data="currentTask.platformWellDetails" style="width: 100%">
|
|
|
|
|
+ <el-table-column prop="wellName" label="井号">
|
|
|
|
|
+ <template #default="{ $index }">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="currentTask.platformWellDetails[$index].wellName"
|
|
|
|
|
+ placeholder="请输入井号"
|
|
|
|
|
+ />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="workloadDesign" label="设计工作量">
|
|
|
|
|
+ <template #default="{ $index }">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="currentTask.platformWellDetails[$index].workloadDesign"
|
|
|
|
|
+ placeholder="请输入设计工作量"
|
|
|
|
|
+ />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="操作" width="100">
|
|
|
|
|
+ <template #default="{ $index }">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="danger"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ @click="removePlatformWellDetail($index)"
|
|
|
|
|
+ :disabled="currentTask.platformWellDetails[$index].taskId === currentTask.id"
|
|
|
|
|
+ >
|
|
|
|
|
+ 删除
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ @click="addPlatformWellDetail"
|
|
|
|
|
+ style="margin-top: 10px;"
|
|
|
|
|
+ >
|
|
|
|
|
+ 添加一行
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </ContentWrap>
|
|
|
|
|
+
|
|
|
<ContentWrap>
|
|
<ContentWrap>
|
|
|
<el-form style="float: right">
|
|
<el-form style="float: right">
|
|
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
|
@@ -657,6 +670,9 @@ const technologyOptions = ref<any[]>([])
|
|
|
const loadingTechnologyOptions = ref(false)
|
|
const loadingTechnologyOptions = ref(false)
|
|
|
const currentTechnologyDictLabel = ref(''); // 存储当前项目对应的施工工艺字典类型
|
|
const currentTechnologyDictLabel = ref(''); // 存储当前项目对应的施工工艺字典类型
|
|
|
|
|
|
|
|
|
|
+// 添加一个变量来保存平台井详情数据
|
|
|
|
|
+const platformWellDetailsBackup = ref([]);
|
|
|
|
|
+
|
|
|
/** 项目信息 表单 */
|
|
/** 项目信息 表单 */
|
|
|
defineOptions({ name: 'IotProjectTaskInfo' })
|
|
defineOptions({ name: 'IotProjectTaskInfo' })
|
|
|
|
|
|
|
@@ -844,7 +860,9 @@ const currentTask = ref({
|
|
|
responsiblePerson: [],
|
|
responsiblePerson: [],
|
|
|
submitter: [],
|
|
submitter: [],
|
|
|
remark: '',
|
|
remark: '',
|
|
|
- projectId: ''
|
|
|
|
|
|
|
+ projectId: '',
|
|
|
|
|
+ platformWell: '0', // 新增平台井字段,默认非平台井
|
|
|
|
|
+ platformWellDetails: [] // 新增平台井详情列表
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const isNewTask = ref(false); // 是否是新任务
|
|
const isNewTask = ref(false); // 是否是新任务
|
|
@@ -852,20 +870,25 @@ const taskFormRef = ref(); // 任务表单ref
|
|
|
const currentEditingIndex = ref(-1); // 当前编辑的行索引
|
|
const currentEditingIndex = ref(-1); // 当前编辑的行索引
|
|
|
|
|
|
|
|
// 任务表单验证规则
|
|
// 任务表单验证规则
|
|
|
-const taskFormRules = reactive({
|
|
|
|
|
- wellName: [{ required: true, message: '井号不能为空', trigger: 'blur' }],
|
|
|
|
|
- wellType: [{ required: true, message: '井型不能为空', trigger: 'change' }],
|
|
|
|
|
- location: [{ required: true, message: '施工地点不能为空', trigger: 'blur' }],
|
|
|
|
|
- technique: [{ required: true, message: '施工工艺不能为空', trigger: 'change' }],
|
|
|
|
|
- workloadDesign: [{ required: true, message: '设计工作量不能为空', trigger: 'blur' }],
|
|
|
|
|
- workloadUnit: [{ required: true, message: '工作量单位不能为空', trigger: 'change' }],
|
|
|
|
|
- deptIds: [{ required: true, message: '施工队伍不能为空', trigger: 'change' }],
|
|
|
|
|
- deviceIds: [{ required: true, message: '施工设备不能为空', trigger: 'change' }],
|
|
|
|
|
- responsiblePerson: [{ required: true, message: '责任人不能为空', trigger: 'change' }],
|
|
|
|
|
- // 动态添加填报人验证规则
|
|
|
|
|
- ...(isSpecialDept.value ? {
|
|
|
|
|
- submitter: [{ required: true, message: '填报人不能为空', trigger: 'change' }]
|
|
|
|
|
- } : {})
|
|
|
|
|
|
|
+const taskFormRules = computed(() => {
|
|
|
|
|
+ const rules = {
|
|
|
|
|
+ wellName: [{ required: currentTask.value.platformWell !== '1', message: '井号不能为空', trigger: 'blur' }],
|
|
|
|
|
+ wellType: [{ required: true, message: '井型不能为空', trigger: 'change' }],
|
|
|
|
|
+ location: [{ required: true, message: '施工地点不能为空', trigger: 'blur' }],
|
|
|
|
|
+ technique: [{ required: true, message: '施工工艺不能为空', trigger: 'change' }],
|
|
|
|
|
+ workloadDesign: [{ required: currentTask.value.platformWell !== '1', message: '设计工作量不能为空', trigger: 'blur' }],
|
|
|
|
|
+ workloadUnit: [{ required: true, message: '工作量单位不能为空', trigger: 'change' }],
|
|
|
|
|
+ deptIds: [{ required: true, message: '施工队伍不能为空', trigger: 'change' }],
|
|
|
|
|
+ deviceIds: [{ required: true, message: '施工设备不能为空', trigger: 'change' }],
|
|
|
|
|
+ responsiblePerson: [{ required: true, message: '责任人不能为空', trigger: 'change' }]
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 如果是特殊部门,添加填报人必填规则
|
|
|
|
|
+ if (isSpecialDept.value) {
|
|
|
|
|
+ rules.submitter = [{ required: true, message: '填报人不能为空', trigger: 'change' }];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return rules;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 动态属性验证规则
|
|
// 动态属性验证规则
|
|
@@ -1077,39 +1100,129 @@ const getWorkloadUnitLabel = (value) => {
|
|
|
|
|
|
|
|
/** 同步当前任务表单数据到表格数据 */
|
|
/** 同步当前任务表单数据到表格数据 */
|
|
|
const syncCurrentTaskToTable = () => {
|
|
const syncCurrentTaskToTable = () => {
|
|
|
- if (!currentTask.value.wellName) {
|
|
|
|
|
- ElMessage.warning('请先填写任务详情');
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 平台井模式特殊处理
|
|
|
|
|
+ if (currentTask.value.platformWell === '1') {
|
|
|
|
|
+ if (currentTask.value.platformWellDetails.length === 0) {
|
|
|
|
|
+ ElMessage.warning('请先添加平台井详情');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // 设置项目ID
|
|
|
|
|
- currentTask.value.projectId = formData.value.id;
|
|
|
|
|
|
|
+ // 验证平台井详情数据
|
|
|
|
|
+ const invalidDetails = currentTask.value.platformWellDetails.some(
|
|
|
|
|
+ detail => !detail.wellName || !detail.wellName.trim() || !detail.workloadDesign
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
- if (isNewTask.value) {
|
|
|
|
|
- // 新增任务 - 生成唯一ID并添加到表格
|
|
|
|
|
- const newId = tableData.value.length > 0
|
|
|
|
|
- ? Math.max(...tableData.value.map(item => item.id)) + 1
|
|
|
|
|
- : 1;
|
|
|
|
|
- currentTask.value.id = newId;
|
|
|
|
|
- tableData.value.unshift({...currentTask.value});
|
|
|
|
|
- isNewTask.value = false;
|
|
|
|
|
- // ElMessage.success('任务已添加到列表');
|
|
|
|
|
- } else {
|
|
|
|
|
- // 更新现有任务
|
|
|
|
|
- const index = tableData.value.findIndex(item => item.id === currentTask.value.id);
|
|
|
|
|
- if (index !== -1) {
|
|
|
|
|
- tableData.value.splice(index, 1, {...currentTask.value});
|
|
|
|
|
- // ElMessage.success('任务已更新');
|
|
|
|
|
|
|
+ if (invalidDetails) {
|
|
|
|
|
+ ElMessage.error('请完善平台井的井号和设计工作量信息');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 平台井模式:为每个平台井详情生成任务对象
|
|
|
|
|
+ const platformTasks = [];
|
|
|
|
|
+
|
|
|
|
|
+ // 查找当前编辑的主任务对应的平台井详情
|
|
|
|
|
+ let mainTaskDetailIndex = -1;
|
|
|
|
|
+
|
|
|
|
|
+ // 如果有当前任务ID,查找对应的平台井详情
|
|
|
|
|
+ if (currentTask.value.id) {
|
|
|
|
|
+ mainTaskDetailIndex = currentTask.value.platformWellDetails.findIndex(
|
|
|
|
|
+ detail => detail.taskId === currentTask.value.id
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 如果没有找到对应的详情,使用第一个详情作为主任务
|
|
|
|
|
+ if (mainTaskDetailIndex === -1 && currentTask.value.platformWellDetails.length > 0) {
|
|
|
|
|
+ mainTaskDetailIndex = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 处理每个平台井详情
|
|
|
|
|
+ currentTask.value.platformWellDetails.forEach((detail, index) => {
|
|
|
|
|
+ if (index === mainTaskDetailIndex) {
|
|
|
|
|
+ // 主任务:使用当前任务对象
|
|
|
|
|
+ currentTask.value.wellName = detail.wellName;
|
|
|
|
|
+ currentTask.value.workloadDesign = detail.workloadDesign;
|
|
|
|
|
+ // platformWell 保持为 '1' - 主平台井任务
|
|
|
|
|
+ currentTask.value.platformWell = '1';
|
|
|
|
|
+
|
|
|
|
|
+ platformTasks.push({...currentTask.value});
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 子任务:创建新的任务对象
|
|
|
|
|
+ const newTask = {
|
|
|
|
|
+ ...currentTask.value, // 拷贝所有属性
|
|
|
|
|
+ id: detail.taskId || undefined, // 已有任务使用taskId,新增任务为undefined
|
|
|
|
|
+ wellName: detail.wellName,
|
|
|
|
|
+ workloadDesign: detail.workloadDesign,
|
|
|
|
|
+ platformWell: detail.taskId ? '2' : '2' // 子任务platformWell设为2
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 移除不需要的属性
|
|
|
|
|
+ delete newTask.platformWellDetails;
|
|
|
|
|
+
|
|
|
|
|
+ platformTasks.push(newTask);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 设置项目ID
|
|
|
|
|
+ platformTasks.forEach(task => {
|
|
|
|
|
+ task.projectId = formData.value.id;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if (isNewTask.value) {
|
|
|
|
|
+ // 新增任务 - 为所有任务生成ID
|
|
|
|
|
+ let maxId = tableData.value.length > 0
|
|
|
|
|
+ ? Math.max(...tableData.value.map(item => item.id))
|
|
|
|
|
+ : 0;
|
|
|
|
|
+
|
|
|
|
|
+ platformTasks.forEach(task => {
|
|
|
|
|
+ maxId += 1;
|
|
|
|
|
+ task.id = maxId;
|
|
|
|
|
+ tableData.value.unshift({...task});
|
|
|
|
|
+ });
|
|
|
|
|
+ isNewTask.value = false;
|
|
|
} else {
|
|
} else {
|
|
|
- // 如果没有找到,添加到表格(可能是意外情况)
|
|
|
|
|
- tableData.value.unshift({...currentTask.value});
|
|
|
|
|
|
|
+ // 更新现有任务 - 比较复杂,需要先删除原有任务再添加新任务
|
|
|
|
|
+ // 这里简化处理:删除当前任务相关的所有平台井任务,然后重新添加
|
|
|
|
|
+ const currentTaskId = currentTask.value.id;
|
|
|
|
|
+ tableData.value = tableData.value.filter(item => item.id !== currentTaskId);
|
|
|
|
|
+
|
|
|
|
|
+ platformTasks.forEach(task => {
|
|
|
|
|
+ tableData.value.unshift({...task});
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- return true;
|
|
|
|
|
-};
|
|
|
|
|
|
|
+ return true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 非平台井模式,验证原有字段
|
|
|
|
|
+ if (!currentTask.value.wellName) {
|
|
|
|
|
+ ElMessage.warning('请先填写任务详情');
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 设置项目ID
|
|
|
|
|
+ currentTask.value.projectId = formData.value.id;
|
|
|
|
|
|
|
|
|
|
+ if (isNewTask.value) {
|
|
|
|
|
+ // 新增任务 - 生成唯一ID并添加到表格
|
|
|
|
|
+ const newId = tableData.value.length > 0
|
|
|
|
|
+ ? Math.max(...tableData.value.map(item => item.id)) + 1
|
|
|
|
|
+ : 1;
|
|
|
|
|
+ currentTask.value.id = newId;
|
|
|
|
|
+ tableData.value.unshift({...currentTask.value});
|
|
|
|
|
+ isNewTask.value = false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 更新现有任务
|
|
|
|
|
+ const index = tableData.value.findIndex(item => item.id === currentTask.value.id);
|
|
|
|
|
+ if (index !== -1) {
|
|
|
|
|
+ tableData.value.splice(index, 1, {...currentTask.value});
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果没有找到,添加到表格(可能是意外情况)
|
|
|
|
|
+ tableData.value.unshift({...currentTask.value});
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
// 重置任务表单
|
|
// 重置任务表单
|
|
|
const resetTaskForm = () => {
|
|
const resetTaskForm = () => {
|
|
@@ -1127,6 +1240,8 @@ const resetTaskForm = () => {
|
|
|
responsiblePerson: [],
|
|
responsiblePerson: [],
|
|
|
remark: '',
|
|
remark: '',
|
|
|
projectId: formData.value.id,
|
|
projectId: formData.value.id,
|
|
|
|
|
+ platformWell: '0', // 重置平台井状态
|
|
|
|
|
+ platformWellDetails: [], // 清空平台井详情
|
|
|
// 如果是特殊部门,初始化填报人字段
|
|
// 如果是特殊部门,初始化填报人字段
|
|
|
...(isSpecialDept.value ? { submitter: [] } : {})
|
|
...(isSpecialDept.value ? { submitter: [] } : {})
|
|
|
};
|
|
};
|
|
@@ -1332,7 +1447,27 @@ const open = async () => {
|
|
|
currentTask.value = JSON.parse(JSON.stringify(tableData.value[0]));
|
|
currentTask.value = JSON.parse(JSON.stringify(tableData.value[0]));
|
|
|
isNewTask.value = false;
|
|
isNewTask.value = false;
|
|
|
|
|
|
|
|
- // 新增代码:检查任务数据中是否有extProperty
|
|
|
|
|
|
|
+ // 处理平台井数据
|
|
|
|
|
+ // 将数字类型的 platformWell 转换为字符串类型
|
|
|
|
|
+ currentTask.value.platformWell = currentTask.value.platformWell?.toString() || '0';
|
|
|
|
|
+
|
|
|
|
|
+ // 如果 platformWell 为 1,处理 platformWells 数据
|
|
|
|
|
+ if (currentTask.value.platformWell === '1' && currentTask.value.platformWells) {
|
|
|
|
|
+ // 将 platformWells 映射到 platformWellDetails
|
|
|
|
|
+ currentTask.value.platformWellDetails = currentTask.value.platformWells.map((item: any) => ({
|
|
|
|
|
+ taskId: item.id,
|
|
|
|
|
+ wellName: item.wellName,
|
|
|
|
|
+ workloadDesign: item.workloadDesign
|
|
|
|
|
+ }));
|
|
|
|
|
+ // 初始化备份数据
|
|
|
|
|
+ platformWellDetailsBackup.value = [...currentTask.value.platformWellDetails];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 非平台井模式,确保 platformWellDetails 是数组
|
|
|
|
|
+ currentTask.value.platformWellDetails = currentTask.value.platformWellDetails || [];
|
|
|
|
|
+ platformWellDetailsBackup.value = [];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 检查任务数据中是否有extProperty
|
|
|
if (tableData.value[0].extProperty && tableData.value[0].extProperty.length > 0) {
|
|
if (tableData.value[0].extProperty && tableData.value[0].extProperty.length > 0) {
|
|
|
// 使用任务数据中的extProperty作为动态属性
|
|
// 使用任务数据中的extProperty作为动态属性
|
|
|
dynamicAttrs.value = tableData.value[0].extProperty;
|
|
dynamicAttrs.value = tableData.value[0].extProperty;
|
|
@@ -1355,6 +1490,8 @@ const open = async () => {
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
formType.value = 'create';
|
|
formType.value = 'create';
|
|
|
|
|
+ // 初始化备份数据
|
|
|
|
|
+ platformWellDetailsBackup.value = [];
|
|
|
}
|
|
}
|
|
|
// 如果有projectId参数,自动选中对应的合同
|
|
// 如果有projectId参数,自动选中对应的合同
|
|
|
if (projectId.value) {
|
|
if (projectId.value) {
|
|
@@ -1394,9 +1531,10 @@ const validateAllRows = (): boolean => {
|
|
|
allValid = false;
|
|
allValid = false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /* if (!row.wellType || row.wellType.trim() === '') {
|
|
|
|
|
|
|
+ // 对于平台井模式下的后续任务,platformWell为0,但wellName和workloadDesign仍需验证
|
|
|
|
|
+ if (!row.workloadDesign) {
|
|
|
allValid = false;
|
|
allValid = false;
|
|
|
- } */
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (!row.location || row.location.trim() === '') {
|
|
if (!row.location || row.location.trim() === '') {
|
|
|
allValid = false;
|
|
allValid = false;
|
|
@@ -1600,6 +1738,38 @@ const submitForm = async () => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 处理平台井开关变化
|
|
|
|
|
+const handlePlatformWellChange = (value) => {
|
|
|
|
|
+ if (value === '1') {
|
|
|
|
|
+ // 切换到平台井模式,恢复之前保存的数据
|
|
|
|
|
+ if (platformWellDetailsBackup.value.length > 0) {
|
|
|
|
|
+ currentTask.value.platformWellDetails = [...platformWellDetailsBackup.value];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 如果没有备份数据,初始化一行
|
|
|
|
|
+ addPlatformWellDetail();
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 切换到非平台井模式,保存当前数据到备份
|
|
|
|
|
+ platformWellDetailsBackup.value = [...currentTask.value.platformWellDetails];
|
|
|
|
|
+ // 切换到非平台井模式,清空详情列表
|
|
|
|
|
+ currentTask.value.platformWellDetails = [];
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 添加平台井详情行
|
|
|
|
|
+const addPlatformWellDetail = () => {
|
|
|
|
|
+ currentTask.value.platformWellDetails.push({
|
|
|
|
|
+ taskId: '',
|
|
|
|
|
+ wellName: '',
|
|
|
|
|
+ workloadDesign: ''
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 删除平台井详情行
|
|
|
|
|
+const removePlatformWellDetail = (index: number) => {
|
|
|
|
|
+ currentTask.value.platformWellDetails.splice(index, 1);
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
/** 重置表单 */
|
|
/** 重置表单 */
|
|
|
const resetForm = () => {
|
|
const resetForm = () => {
|
|
|
formData.value = {
|
|
formData.value = {
|