diff --git a/src/views/collectReorganizi/collectionLibrary/mixins/index.js b/src/views/collectReorganizi/collectionLibrary/mixins/index.js index 045bc79..7a4e808 100644 --- a/src/views/collectReorganizi/collectionLibrary/mixins/index.js +++ b/src/views/collectReorganizi/collectionLibrary/mixins/index.js @@ -122,7 +122,7 @@ export const collectionLibraryCrud = { }) }, getViewTableList(categoryLevel, parentsId, type) { - console.log(' this.query.condition', this.query.condition) + // console.log(' this.query.condition', this.query.condition) const currentPageSize = localStorage.getItem('currentPageSize') if (currentPageSize) { this.page.size = parseInt(currentPageSize) diff --git a/src/views/collectReorganizi/collectionLibrary/module/advancedSearchModal.vue b/src/views/collectReorganizi/collectionLibrary/module/advancedSearchModal.vue index b952385..2c2b4d4 100644 --- a/src/views/collectReorganizi/collectionLibrary/module/advancedSearchModal.vue +++ b/src/views/collectReorganizi/collectionLibrary/module/advancedSearchModal.vue @@ -259,12 +259,11 @@ export default { }) }, getFieldCommon() { - console.log('selectedCategory', this.selectedCategory) const params = { 'categoryId': this.selectedCategory.id, 'categoryLevel': this.collectLevel } - console.log('params', params) + // console.log('params', params) FetchInitCategoryInputFieldByPid(params).then((data) => { if (data && data.length > 0) { this.fieldOptions = data @@ -349,7 +348,7 @@ export default { }, handleSearch() { const wheresql = this.checkConditions(this.conditionData) - console.log('wheresql', wheresql) + // console.log('wheresql', wheresql) if (wheresql) { const conditions = JSON.parse(JSON.stringify(this.conditionData)) // 保存到 localStorage diff --git a/src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue b/src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue index cbf24ee..01858f4 100644 --- a/src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue +++ b/src/views/collectReorganizi/collectionLibrary/module/collectHeader.vue @@ -725,7 +725,6 @@ export default { if (this.parentsData.parentsProjectId && this.isTitleType === 3) { console.log('项目下的案卷') } else { - console.log('111') if (this.parentsData.parentsAnjuanRow && this.parentsData.parentsAnjuanRow.collect_formal === 2) { this.$message({ message: '当前档案处于归档流程中,不可操作新增,请先确认!', offset: 8 }) return false @@ -736,7 +735,6 @@ export default { this.quickPaper = true this.formTitle = '新增案卷' } else { - console.log('222') this.quickPaperArcId = [] this.formTitle = '新增' + this.collectTitle this.quickPaper = false @@ -860,10 +858,10 @@ export default { this.$nextTick(() => { this.$refs.previewForm.archivesType = 'add' this.$refs.previewForm.activeIndex = this.activeIndex - console.log('this.parentsData.parentsAnjuanRow ', this.parentsData.parentsAnjuanRow) - console.log('this.collectTitle', this.collectTitle) + // console.log('this.parentsData.parentsAnjuanRow ', this.parentsData.parentsAnjuanRow) + // console.log('this.collectTitle', this.collectTitle) const savePrevFromData = JSON.parse(localStorage.getItem('savePrevFromData')) - console.log('savePrevFromData', savePrevFromData) + // console.log('savePrevFromData', savePrevFromData) if (savePrevFromData) { if ('record_no' in savePrevFromData && 'item_no' in savePrevFromData) { @@ -898,7 +896,7 @@ export default { // 全宗fonds_no、门类archival_category_code、档案分类archive_ctg_no、年度archive_year、保管期限retention、案卷号record_no、责任者signer const rowAjData = this.parentsData.parentsAnjuanRow const fields = ['archive_ctg_no', 'archive_year', 'retention', 'record_no', 'signer'] - console.log('this.selectedCategory', this.selectedCategory) + // console.log('this.selectedCategory', this.selectedCategory) const result = { is_entity: 1, 'fonds_no': this.selectedCategory.fondsNo, 'archival_category_code': this.selectedCategory.code } fields.forEach(field => { diff --git a/src/views/components/category/PreviewForm.vue b/src/views/components/category/PreviewForm.vue index 92b8477..ee0f0a5 100644 --- a/src/views/components/category/PreviewForm.vue +++ b/src/views/components/category/PreviewForm.vue @@ -39,7 +39,7 @@ :class="{ 'treeselect-error': fieldErrors[item.fieldName] }" @select="selectTree" @open="openTree(item)" - @blur="() => { this.$refs.addOrUpdateForm.validateField(item.fieldName) }" + @close="() => { handleSelectClose(item.fieldName) }" >
{{ getAutoNameUnknown(node.label) }}
@@ -661,7 +661,6 @@ export default { return row.level ? row.level === 3 : true }, normalizer(node) { - console.log('normalizer', node.dictionaryName) if ((node.childDictionarys && !node.childDictionarys.length) || node.childDictionarys === null) { delete node.childDictionarys } @@ -991,7 +990,7 @@ export default { this.$set(this.rules, 'item_no', [{ validator: async(rule, value, callback) => { // 通过档号是否重复来判断,而不是通过件号大小判断(因为可能有断档) - console.log('this.archiveNoDuplicate', this.archiveNoDuplicate) + // console.log('this.archiveNoDuplicate', this.archiveNoDuplicate) if (this.archiveNoDuplicate && this.maxItemNo !== null) { callback(new Error(`可用起始件号建议: ${this.maxItemNo}`)) } else { @@ -1055,7 +1054,7 @@ export default { } } else { if (item.dictionaryId) { - console.log('item.dictionaryId', item.dictionaryId) + // console.log('item.dictionaryId', item.dictionaryId) // const params = { // 'pid': item.dictionaryId.id // } @@ -1081,11 +1080,14 @@ export default { .filter(parent => filterCodes.includes(parent.dictionaryCode)) // 匹配顶级项 .map(topItem => topItem.childDictionarys) // 只取顶级项的子级(保留多级结构) .flat() // 扁平化一维数组(多个顶级项的子树合并) - console.log('保留多级结构的子项:', filteredItems) + + console.log('filteredItems', filteredItems) + // 去重处理:移除重复的节点ID + const uniqueItems = this.removeDuplicateNodes(filteredItems) if (item.isInputClass === 'select') { - this.$set(item, 'options', filteredItems) + this.$set(item, 'options', uniqueItems) } else if (item.isInputClass === 'popover') { - this.popoverTableData = filteredItems + this.popoverTableData = uniqueItems this.popoverVisible = true } }).catch(err => { @@ -1253,6 +1255,67 @@ export default { } } } + console.log('isRepeatHandle', item) + }, + // treeselect close事件处理 - 验证必填字段 + handleSelectClose(fieldName) { + console.log('handleSelectClose', fieldName) + if (this.$refs.addOrUpdateForm) { + // 先验证字段 + this.$refs.addOrUpdateForm.validateField(fieldName) + + // 检查该字段是否为必填且值为空 + const fieldItem = this.formPreviewData.find(item => item.fieldName === fieldName) + if (fieldItem && fieldItem.isRequired) { + const fieldValue = this.addOrUpdateForm[fieldName] + if (!fieldValue && fieldValue !== 0 && fieldValue !== false) { + // 设置错误信息 + this.$set(this.fieldErrors, fieldName, '请选择' + fieldItem.fieldCnName) + } else { + // 清除错误信息 + this.$set(this.fieldErrors, fieldName, '') + } + } + } + }, + // 递归移除树形数据中重复的节点ID + removeDuplicateNodes(nodes) { + const seenIds = new Set() + const result = [] + + const processNode = (node) => { + // 检查当前节点ID是否已存在 + const nodeId = node.dictionaryName || node.id || node.code + if (nodeId && seenIds.has(nodeId)) { + return null // 跳过重复节点 + } + if (nodeId) { + seenIds.add(nodeId) + } + + // 递归处理子节点 + if (node.childDictionarys && Array.isArray(node.childDictionarys)) { + const uniqueChildren = [] + for (const child of node.childDictionarys) { + const processedChild = processNode(child) + if (processedChild) { + uniqueChildren.push(processedChild) + } + } + node.childDictionarys = uniqueChildren + } + + return node + } + + for (const node of nodes) { + const processedNode = processNode(node) + if (processedNode) { + result.push(processedNode) + } + } + + return result }, // tree - open openTree(item) { @@ -1443,8 +1506,6 @@ export default { if (item.fieldName === 'fonds_name' && this.isDesFormType !== 'category') { this.$set(this.addOrUpdateForm, item.fieldName, this.selectedCategory.fondName) } - console.log('item', item) - console.log('item.isRequired', item.isRequired) const rule = { required: !!item.isRequired, message: ((item.isInputClass === 'text' || item.isInputClass === 'textarea') ? '请输入' : '请选择') + item.fieldCnName, @@ -1634,7 +1695,7 @@ export default { } const originalArchiveNo = this.addOrUpdateForm.archive_no - console.log('this.addOrUpdateForm', this.addOrUpdateForm) + // console.log('this.addOrUpdateForm', this.addOrUpdateForm) // 先验证重复字段 const isRepeatValid = await this.validateRepeatFieldsBeforeSubmit(formName)