diff --git a/pages/apply/subPages/SK/enterprise/enterpriseLibarary.vue b/pages/apply/subPages/SK/enterprise/enterpriseLibarary.vue new file mode 100644 index 0000000..6814653 --- /dev/null +++ b/pages/apply/subPages/SK/enterprise/enterpriseLibarary.vue @@ -0,0 +1,514 @@ + + + + + \ No newline at end of file diff --git a/pages/apply/subPages/SK/riskSafeIdenEdit.vue b/pages/apply/subPages/SK/riskSafeIdenEdit.vue index 65a13d0..dd53bf2 100644 --- a/pages/apply/subPages/SK/riskSafeIdenEdit.vue +++ b/pages/apply/subPages/SK/riskSafeIdenEdit.vue @@ -90,7 +90,7 @@ - @@ -106,7 +106,7 @@ - + @@ -125,46 +125,7 @@ - - - - - - - {{idx+1}}.生产单元 : - {{ item.Nav_ProductionUnit.NAME || '' }} - 辨识区域 : - {{ item.Nav_Area.NAME || '' }} - - 风险名称 : - {{ item.RISK_NAME || '' }} - - 风险描述 : - {{ item.RISK_DESCRIPTION || '' }} - - 风险类别 : - {{ item.Nav_Type.NAME || '' }} - - 管控措施 : - {{ item.MEASURE || '' }} - - 应急处置 : - {{ item.EMERGENCY || '' }} - - - 暂无企业库数据 - - - - - - {{ enterpriseLibraryLoading ? '加载中...' : '加载更多' }} - - —— 没有更多数据了 —— - - - @@ -199,7 +160,7 @@ SKRiskIdentifyFullUpdate, getUserLists, GetSKRequestInfo, - GetRiskAreaInfo, + GetNewRiskAreaInfo, GetRiskTypeInfo, GetRiskNameInfo, } from '../../../../services/apply/subPages/SK/SKServices.js' @@ -232,15 +193,6 @@ stepLoad: true, UnitLists: [], UnitDefaultIndex: [0], - // 新增企业库相关数据 - showEnterpriseLibrary: false, - enterpriseLibraryList: [], - selectedEnterpriseIndices: [], - // 新增分页相关变量 - enterpriseLibraryPageIndex: 1, - enterpriseLibraryHasMore: true, - enterpriseLibraryLoading: false, - enterpriseLibraryTotal: 0, dataModel: { YEAR: '', START_DATE: '', @@ -434,148 +386,32 @@ this.dataModel.Nav_Details = [...this.dataModel.Nav_Details] }, handleNewCheckList() { - // 重置分页状态 - this.enterpriseLibraryPageIndex = 1 - this.enterpriseLibraryHasMore = true - this.enterpriseLibraryList = [] - this.selectedEnterpriseIndices = [] - this.loadEnterpriseLibraryData() + // 将现有数据传递给选择页面用于去重判断 + const existingData = this.dataModel.Nav_Details.map(item => ({ + PRODUCTION_UNIT_ID: item.PRODUCTION_UNIT_ID, + AREA_ID: item.AREA_ID, + RISK_NAME: item.RISK_NAME + })) + + uni.navigateTo({ + url: `/pages/apply/subPages/SK/enterprise/enterpriseLibarary?existingData=${encodeURIComponent(JSON.stringify(existingData))}`, + events: { + // 监听页面返回的数据 + confirm: (data) => { + this.handleEnterpriseSelection(data.selectedItems) + } + } + }) }, - loadEnterpriseLibraryData(isLoadMore = false) { - if (this.enterpriseLibraryLoading) return - - if (!isLoadMore) { - this.enterpriseLibraryPageIndex = 1 - this.enterpriseLibraryHasMore = true - this.enterpriseLibraryList = [] - this.selectedEnterpriseIndices = [] - } - - if (!this.enterpriseLibraryHasMore && isLoadMore) { - uni.showToast({ - title: '没有更多数据了', - icon: 'none' - }) - return - } - - this.enterpriseLibraryLoading = true - - const json = initFilter(this.ORG_ID) - extendInclude(json, 'Nav_ProductionUnit'); - extendInclude(json, 'Nav_Area'); - extendInclude(json, 'Nav_Type'); - json.SelectField = [ - "CODE", - "Nav_ProductionUnit.NAME", - "Nav_Area.NAME", - "RISK_NAME", - "RISK_DESCRIPTION", - "Nav_Type.NAME", - "CHECKLEVEL", - "CHECKDEPT", - "CHECKPOST", - "EVALUATE_LEVEL", - "MEASURE", - "EMERGENCY", - "ID", - "ORG_ID", - "PRODUCTION_UNIT_ID", - "AREA_ID", - "TYPE_ID", - "RISK_NAME_ID" - ] - json.Limit = 2 - json.PageIndex = this.enterpriseLibraryPageIndex - json.Start = (this.enterpriseLibraryPageIndex - 1) * json.Limit - - getRequest(json, "/SK/SKEnterpriseLibrary/SKOrderPaged").then(res => { - this.enterpriseLibraryLoading = false - - if (res && res.length > 0) { - if (isLoadMore) { - this.enterpriseLibraryList = [...this.enterpriseLibraryList, ...res] - } else { - this.enterpriseLibraryList = res - } - - // 判断是否还有更多数据 - this.enterpriseLibraryHasMore = res.length >= json.Limit - this.enterpriseLibraryPageIndex++ - - this.showEnterpriseLibrary = true - } else { - if (isLoadMore) { - this.enterpriseLibraryHasMore = false - uni.showToast({ - title: '没有更多数据了', - icon: 'none' - }) - } else { - if (this.enterpriseLibraryList.length === 0) { - this.showEnterpriseLibrary = false - uni.showToast({ - title: '暂无企业库数据', - icon: 'none' - }) - } - } - } - }).catch(err => { - this.enterpriseLibraryLoading = false - uni.showToast({ - title: '加载失败', - icon: 'none' - }) - }) - }, - - // 加载更多方法 - loadMoreEnterpriseData() { - if (this.enterpriseLibraryHasMore && !this.enterpriseLibraryLoading) { - this.loadEnterpriseLibraryData(true) - } else if (!this.enterpriseLibraryHasMore && this.enterpriseLibraryList.length > 0) { - uni.showToast({ - title: '没有更多数据了', - icon: 'none' - }) - } - }, - handleEnterpriseListScroll(e) { - if (this.enterpriseLibraryHasMore && !this.enterpriseLibraryLoading) { - this.loadEnterpriseLibraryData(true) - } else if (!this.enterpriseLibraryHasMore && this.enterpriseLibraryList.length > 0) { - uni.showToast({ - title: '没有更多数据了', - icon: 'none' - }) - } - }, - // 切换企业库条目选择状态 - toggleEnterpriseSelection(index) { - const idx = this.selectedEnterpriseIndices.indexOf(index) - if (idx === -1) { - this.selectedEnterpriseIndices.push(index) - } else { - this.selectedEnterpriseIndices.splice(idx, 1) - } - }, - // 确认选择企业库条目 - confirmEnterpriseSelection() { - if (this.selectedEnterpriseIndices.length === 0) { - uni.showToast({ - title: '请至少选择一项', - icon: 'none' - }) - return - } + // 新增处理企业库选择结果的方法 + handleEnterpriseSelection(selectedItems) { + if (!selectedItems || selectedItems.length === 0) return - // 原有逻辑保持不变 const newDetails = [] const duplicateItems = [] - this.selectedEnterpriseIndices.forEach(idx => { - const enterpriseItem = this.enterpriseLibraryList[idx] + + selectedItems.forEach(enterpriseItem => { // 检查是否与现有数据重复 const isDuplicate = this.dataModel.Nav_Details.some(existingItem => existingItem.AREA_ID === (enterpriseItem.AREA_ID || '') && @@ -622,8 +458,7 @@ } newDetails.push(convertedItem) }) - - // 处理重复项提示(保持原有逻辑) + // 处理重复项提示 if (duplicateItems.length > 0) { const duplicateCount = duplicateItems.length let message = '' @@ -639,42 +474,39 @@ message += `...等共 ${duplicateCount} 条` } } - - uni.showModal({ - title: '重复数据提示', - content: message, - showCancel: false, - confirmText: '知道了' - }) + setTimeout(() => { + uni.showModal({ + title: '重复数据提示', + content: message, + showCancel: false, + confirmText: '知道了' + }) + }, 100) // 延迟100毫秒 } if (newDetails.length > 0) { this.dataModel.Nav_Details.push(...newDetails) - uni.showToast({ - title: `成功导入 ${newDetails.length} 条数据${duplicateItems.length > 0 ? `,跳过 ${duplicateItems.length} 条重复数据` : ''}`, - icon: 'success', - duration: 2000 - }) - } else if (duplicateItems.length > 0) { - uni.showToast({ - title: `所选数据均重复,未导入任何内容`, - icon: 'none', - duration: 2000 - }) - } + setTimeout(() => { + uni.showToast({ + title: `成功导入 ${newDetails.length} 条数据${duplicateItems.length > 0 ? `,跳过 ${duplicateItems.length} 条重复数据` : ''}`, + icon: 'success', + duration: 2000 + }) + }, 100) - this.showEnterpriseLibrary = false - this.selectedEnterpriseIndices = [] - }, - // 取消选择 - cancelEnterpriseSelection() { - this.showEnterpriseLibrary = false - this.selectedEnterpriseIndices = [] - this.enterpriseLibraryList = [] - this.enterpriseLibraryPageIndex = 1 - this.enterpriseLibraryHasMore = true - this.enterpriseLibraryLoading = false + } else if (duplicateItems.length > 0) { + setTimeout(() => { + uni.showToast({ + title: `所选数据均重复,未导入任何内容`, + icon: 'none', + duration: 2000 + }) + }, 100) + } }, + + + handleDelRowBefore(index) { this.showDelModalIndex = index this.nowIndex = index @@ -721,7 +553,7 @@ // this.showPopupCertificate = false }, handleSearchStep(val, pageIndex) { - let requestInfo = this.nowIndex[1] == 'demand' ? GetSKRequestInfo : this.nowIndex[1] == 'Area' ? GetRiskAreaInfo : this.nowIndex[1] == 'RiskName' ? GetRiskNameInfo : GetRiskTypeInfo + let requestInfo = this.nowIndex[1] == 'demand' ? GetSKRequestInfo : this.nowIndex[1] == 'Area' ? GetNewRiskAreaInfo : this.nowIndex[1] == 'RiskName' ? GetRiskNameInfo : GetRiskTypeInfo const orgId = uni.getStorageSync('orgId') const json = initFilter(orgId, "", "", 0, pageIndex ?? 1) @@ -941,4 +773,83 @@ color: #999; font-size: 12px; } + + /* 新增筛选区域样式 */ + .filter-section { + padding: 12px 0; + border-bottom: 1px solid #f0f0f0; + margin-bottom: 8px; + background-color: #fff; + } + + .filter-row { + display: flex; + flex-direction: row; + margin-bottom: 10px; + gap: 12px; + } + + .filter-row:last-child { + margin-bottom: 0; + } + + .filter-item { + flex: 1; + display: flex; + flex-direction: row; + align-items: center; + gap: 8px; + } + + .filter-label { + font-size: 13px; + color: #666; + white-space: nowrap; + width: 70px; + } + + .filter-item :deep(.u-input) { + flex: 1; + } + + .filter-reset { + flex: 0.5; + } + + .reset-btn { + width: 100%; + } + + .filter-result-tip { + font-size: 12px; + color: #999; + text-align: center; + width: 100%; + } + + /* 调整企业库列表高度 */ + .enterprise-list { + max-height: 350px; + overflow-y: auto; + padding: 10px 0; + } + + /* 筛选区域样式 */ + .filter-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 8px 8px 8px; + cursor: pointer; + } + + .filter-title { + font-size: 14px; + font-weight: 500; + color: #333; + } + + .filter-content { + padding-top: 8px; + } \ No newline at end of file