|
|
|
@ -76,6 +76,7 @@ |
|
|
|
> |
|
|
|
<i v-if="item.isInputClass === 'popover'" slot="suffix" class="el-input__icon iconfont icon-gengduo1" @click="handleCurrentFieldName(item)" /> |
|
|
|
</el-input> |
|
|
|
<i v-if="item.fieldName === 'item_no'" class="el-icon-refresh" style="cursor: pointer;" @click="handleRefreshItemNo" /> |
|
|
|
<!-- <div v-if="shouldShowIcon(item)" :class="loadingStatus[item.fieldName] ?'auto-box loading-style':'auto-box'" :disabled="loadingStatus[item.fieldName]"> |
|
|
|
<i ref="iconRef" class="iconfont icon-zidonggengxin" @click="handleIconClick(item)" /> |
|
|
|
</div> --> |
|
|
|
@ -863,10 +864,10 @@ export default { |
|
|
|
this.itemNoAutoGenerated = true |
|
|
|
console.log('件号自动赋值完成:', this.addOrUpdateForm.item_no) |
|
|
|
|
|
|
|
// 检查件号是否是档号的组成项,如果是则重新生成档号(只在首次生成时执行) |
|
|
|
const isItemNoInAutoMatic = this.autoMatic.some(item => item.fieldName === 'item_no') |
|
|
|
if (isItemNoInAutoMatic && !this.itemNoAutoGenerated) { |
|
|
|
// 如果件号是档号组成项,重新生成档号(只在首次时执行,避免循环调用) |
|
|
|
// 检查件号是否是档号的组成项,如果是则重新生成档号 |
|
|
|
const isItemNoInAutoMatic = this.autoMatic && this.autoMatic.some(item => item.fieldName === 'item_no') |
|
|
|
if (isItemNoInAutoMatic) { |
|
|
|
// 如果件号是档号组成项,重新生成档号 |
|
|
|
await this.handleAuto() |
|
|
|
} |
|
|
|
} |
|
|
|
@ -875,6 +876,63 @@ export default { |
|
|
|
console.error('查询最大件号失败:', error) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 点击刷新图标获取最大件号 |
|
|
|
async handleRefreshItemNo() { |
|
|
|
try { |
|
|
|
// 1. 检查是否已有档号 |
|
|
|
if (this.addOrUpdateForm.archive_no) { |
|
|
|
await this.fetchAndSetMaxItemNo(this.addOrUpdateForm.archive_no) |
|
|
|
return |
|
|
|
} |
|
|
|
console.log('this.autoMatic', this.autoMatic) |
|
|
|
// 2. 检查 autoMatic 是否已初始化,如果未初始化则先获取 |
|
|
|
if (!this.autoMatic || !this.autoMatic.length) { |
|
|
|
// 获取当前分类ID |
|
|
|
let categoryId = null |
|
|
|
if (this.isDesFormType !== 'mergeFile' && this.isDesFormType !== 'arcives' && this.isDesFormType !== 'manageArcives') { |
|
|
|
categoryId = this.selectedCategory?.pid || this.selectedCategory?.id |
|
|
|
} else { |
|
|
|
categoryId = this.selectedCategory?.id |
|
|
|
} |
|
|
|
|
|
|
|
if (!categoryId) { |
|
|
|
this.$message({ message: '当前无组成的档号,无法获取最大件号值', type: 'warning', offset: 8 }) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 调用 FetchNoFormatField 获取档号格式配置 |
|
|
|
await this.FetchNoFormatField(categoryId) |
|
|
|
|
|
|
|
// 再次检查是否获取到配置 |
|
|
|
if (!this.autoMatic || !this.autoMatic.length) { |
|
|
|
this.$message({ message: '当前无组成的档号,无法获取最大件号值', type: 'warning', offset: 8 }) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 3. 检查组成项是否有值 |
|
|
|
const hasComponentValue = this.autoMatic.some(val => { |
|
|
|
if (val.fieldName === 'item_no') return false |
|
|
|
return this.addOrUpdateForm[val.fieldName] |
|
|
|
}) |
|
|
|
|
|
|
|
if (hasComponentValue) { |
|
|
|
// 组成项有值,先生成档号 |
|
|
|
const archivesNo = await this.handleAuto() |
|
|
|
if (archivesNo) { |
|
|
|
await this.fetchAndSetMaxItemNo(archivesNo) |
|
|
|
} else { |
|
|
|
this.$message({ message: '当前无组成的档号,无法获取最大件号值', type: 'warning', offset: 8 }) |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 没有组成项的值 |
|
|
|
this.$message({ message: '当前无组成的档号,无法获取最大件号值', type: 'warning', offset: 8 }) |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('刷新最大件号失败:', error) |
|
|
|
this.$message({ message: '刷新最大件号失败', type: 'error', offset: 8 }) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 2. 抽离档号验证逻辑,确保异步验证稳定 |
|
|
|
updateArchiveNoValidator(item) { |
|
|
|
const validateArchiveNo = async(value) => { |
|
|
|
|