|
|
@@ -48,6 +48,12 @@
|
|
|
show-word-limit
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="状态:" prop="status">
|
|
|
+ <el-radio-group v-model="ruleFormData.status" :disabled="isViewMode">
|
|
|
+ <el-radio :label="1">启用</el-radio>
|
|
|
+ <el-radio :label="0">禁用</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
<div class="check-items-section">
|
|
|
@@ -62,7 +68,7 @@
|
|
|
</el-upload>
|
|
|
</div>
|
|
|
<div class="check-items-table">
|
|
|
- <el-table :data="checkItems" border>
|
|
|
+ <el-table :data="checkItems" border :span-method="handleSpanMethod">
|
|
|
<el-table-column label="编号" type="index" width="80" align="center" />
|
|
|
<el-table-column label="检查内容" min-width="180">
|
|
|
<template #header>
|
|
|
@@ -80,7 +86,7 @@
|
|
|
<template #default="scope">
|
|
|
<el-input
|
|
|
v-model="scope.row.checkStandard"
|
|
|
- placeholder="请输入检查标准"
|
|
|
+ placeholder="请输入检查标准"
|
|
|
:disabled="isViewMode"
|
|
|
/>
|
|
|
</template>
|
|
|
@@ -90,7 +96,7 @@
|
|
|
<el-radio-group v-model="scope.row.checkResult" :disabled="isViewMode">
|
|
|
<el-radio value="合格">合格</el-radio>
|
|
|
<el-radio value="不合格">不合格</el-radio>
|
|
|
- <el-radio value="待检">待检</el-radio>
|
|
|
+ <!-- <el-radio value="待检">待检</el-radio> -->
|
|
|
</el-radio-group>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -99,7 +105,7 @@
|
|
|
<el-input
|
|
|
v-model="scope.row.checkProblem"
|
|
|
placeholder="请输入检查发现问题"
|
|
|
- :disabled="isViewMode"
|
|
|
+ :disabled="true"
|
|
|
/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -124,7 +130,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
- import { computed, onMounted, ref } from 'vue';
|
|
|
+ import { computed, onMounted, ref ,nextTick } from 'vue';
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
import type { FormInstance } from 'element-plus';
|
|
|
@@ -201,7 +207,11 @@
|
|
|
};
|
|
|
|
|
|
const handleAddItem = (index: number) => {
|
|
|
- checkItems.value.splice(index + 1, 0, createEmptyCheckItem());
|
|
|
+ const currentItem = checkItems.value[index];
|
|
|
+ checkItems.value.splice(index + 1, 0, {
|
|
|
+ ...createEmptyCheckItem(),
|
|
|
+ checkContent: currentItem.checkContent || '',
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
/** 向上插入分类:在当前行之前插入一条空白数据 */
|
|
|
@@ -245,6 +255,7 @@
|
|
|
ruleFormData.value.categoryCode = detail.categoryCode || '';
|
|
|
ruleFormData.value.businessWork = detail.businessWork || '';
|
|
|
ruleFormData.value.fillInstruction = detail.fillInstruction || '';
|
|
|
+ ruleFormData.value.status = detail.status || 1;
|
|
|
|
|
|
const items = detail.ChecklistTemplateItem;
|
|
|
if (items && items.length > 0) {
|
|
|
@@ -260,12 +271,23 @@
|
|
|
}));
|
|
|
}
|
|
|
if (checkItems.value.length === 0) checkItems.value = [createEmptyCheckItem()];
|
|
|
+
|
|
|
+ await nextTick();
|
|
|
+ recalculateMerges();
|
|
|
+
|
|
|
} catch (e: any) {
|
|
|
console.error('获取检查单模版详情失败:', e);
|
|
|
ElMessage.error(e?.message || e?.data || '获取详情失败,请重试');
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const recalculateMerges = () => {
|
|
|
+ // 强制表格重新计算合并
|
|
|
+ const temp = [...checkItems.value];
|
|
|
+ checkItems.value = [];
|
|
|
+ checkItems.value = temp;
|
|
|
+ };
|
|
|
+
|
|
|
const createEmptyCheckItem = (): CheckItemRow => ({
|
|
|
checkContent: '',
|
|
|
checkStandard: '',
|
|
|
@@ -308,6 +330,7 @@
|
|
|
businessWork: ruleFormData.value.businessWork || '',
|
|
|
fillInstruction: ruleFormData.value.fillInstruction || '',
|
|
|
ChecklistTemplateItem: items,
|
|
|
+ status: ruleFormData.value.status || 1,
|
|
|
};
|
|
|
|
|
|
if (isEditMode.value && props.id) {
|
|
|
@@ -325,6 +348,28 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const handleSpanMethod = ({ row, column, rowIndex, columnIndex }: any) => {
|
|
|
+ if (columnIndex === 1) {
|
|
|
+ const currentContent = row.checkContent;
|
|
|
+ if (!currentContent) {
|
|
|
+ return { rowspan: 1, colspan: 1 };
|
|
|
+ }
|
|
|
+ let rowspan = 1;
|
|
|
+ for (let i = rowIndex + 1; i < checkItems.value.length; i++) {
|
|
|
+ if (checkItems.value[i].checkContent === currentContent) {
|
|
|
+ rowspan++;
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (rowIndex > 0 && checkItems.value[rowIndex - 1].checkContent === currentContent) {
|
|
|
+ return { rowspan: 0, colspan: 0 };
|
|
|
+ }
|
|
|
+ return { rowspan, colspan: 1 };
|
|
|
+ }
|
|
|
+ return { rowspan: 1, colspan: 1 };
|
|
|
+ };
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
await loadCategoryOptions();
|
|
|
if (isEditMode.value || isViewMode.value) {
|