导入企业库功能
This commit is contained in:
parent
609dcc7663
commit
3195b69d7c
514
pages/apply/subPages/SK/enterprise/enterpriseLibarary.vue
Normal file
514
pages/apply/subPages/SK/enterprise/enterpriseLibarary.vue
Normal file
@ -0,0 +1,514 @@
|
||||
<template>
|
||||
<view class="enterprise-library-page">
|
||||
<!-- 筛选区域 -->
|
||||
<view class="filter-section">
|
||||
<view class="filter-header" @click="showFilter = !showFilter">
|
||||
<text class="filter-title">筛选条件</text>
|
||||
<u-icon :name="showFilter ? 'arrow-up' : 'arrow-down'" size="14" color="#666"></u-icon>
|
||||
</view>
|
||||
|
||||
<view class="filter-content" v-if="showFilter">
|
||||
<view class="filter-row">
|
||||
<view class="filter-item" @click="handleChangeStep('Area')">
|
||||
<text class="filter-label">辨识区域:</text>
|
||||
<u--input @click="handleChangeStep('Area')" v-model="filters.areaName" disabled disabledColor="#ffffff" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" fontSize="13px" placeholder="请选择辨识区域" size="small"></u--input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="filter-row">
|
||||
<view class="filter-item" @click="handleChangeStep('typeName')">
|
||||
<text class="filter-label">风险类别:</text>
|
||||
<u--input @click="handleChangeStep('typeName')" v-model="filters.typeName" disabled disabledColor="#ffffff" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" fontSize="13px" placeholder="请选择风险类别" size="small"></u--input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="filter-row">
|
||||
<view class="filter-item">
|
||||
<text class="filter-label">生产单元:</text>
|
||||
<u--input v-model="filters.productionUnitName" fontSize="13px" placeholder="请输入生产单元" clearable size="small"></u--input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="filter-row">
|
||||
|
||||
<view class="filter-item filter-reset">
|
||||
<u-button type="primary" size="small" :plain="true" @click="resetFilters" class="reset-btn">重置</u-button>
|
||||
</view>
|
||||
<view class="filter-item filter-reset">
|
||||
<u-button type="primary" size="small" @click="searchWithFilters" class="reset-btn">搜索</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 列表区域 -->
|
||||
<view class="list-container">
|
||||
<view v-for="(item, idx) in enterpriseLibraryList" :key="item.ID" class="enterprise-item">
|
||||
<u-checkbox-group><u-checkbox :checked="selectedIndices.includes(idx)" shape="circle" @change="(e) => toggleSelection(idx, e)"></u-checkbox></u-checkbox-group>
|
||||
<text class="info-index">{{idx+1}}</text>
|
||||
<view class="enterprise-info">
|
||||
<view class="info-row">
|
||||
<text class="info-label">生产单元:</text>
|
||||
<text class="info-value">{{ item.Nav_ProductionUnit.NAME || '' }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">辨识区域:</text>
|
||||
<text class="info-value">{{ item.Nav_Area.NAME || '' }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">风险名称:</text>
|
||||
<text class="info-value">{{ item.RISK_NAME || '' }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">风险描述:</text>
|
||||
<text class="info-value">{{ item.RISK_DESCRIPTION || '' }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">风险类别:</text>
|
||||
<text class="info-value">{{ item.Nav_Type.NAME || '' }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">管控措施:</text>
|
||||
<text class="info-value">{{ item.MEASURE || '' }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">应急处置:</text>
|
||||
<text class="info-value">{{ item.EMERGENCY || '' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="enterpriseLibraryList.length === 0 && !loading" class="empty-tip">暂无企业库数据</view>
|
||||
|
||||
<view class="load-more-footer" v-if="enterpriseLibraryList.length > 0">
|
||||
<u-button v-if="hasMore" type="primary" :plain="true" :loading="loading" @click="loadMore" class="load-more-btn" size="small">
|
||||
{{ loading ? '加载中...' : '加载更多' }}
|
||||
</u-button>
|
||||
<view v-else class="no-more-tip">—— 没有更多数据了 ——</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="bottom-buttons">
|
||||
<u-button type="primary" :plain="true" @click="handleCancel">取消</u-button>
|
||||
<u-button type="primary" @click="handleConfirm" :disabled="selectedIndices.length === 0">确定导入({{ selectedIndices.length }})</u-button>
|
||||
</view>
|
||||
<query-selector :show="showPopupStep" :total="curTotalStep" :lists="stepLists" :defaultValue="currentOperateStep.NAME" @close="handleClosePopupStep" @search="handleSearchStep" @select="handleSelectedStep" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
initFilter,
|
||||
extendFilterGroup,
|
||||
extendGroupRule,
|
||||
extendInclude,
|
||||
extendRule,
|
||||
initFilterGroup
|
||||
} from '@/utils/common'
|
||||
import {
|
||||
getRequest
|
||||
} from '@/services/apply/FOServices/FOServices'
|
||||
import {
|
||||
GetNewRiskAreaInfo,
|
||||
GetRiskTypeInfo
|
||||
} from '../../../../../services/apply/subPages/SK/SKServices.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
ORG_ID: uni.getStorageSync('orgId'),
|
||||
enterpriseLibraryList: [],
|
||||
selectedIndices: [],
|
||||
loading: false,
|
||||
hasMore: true,
|
||||
pageIndex: 1,
|
||||
pageSize: 2,
|
||||
showFilter: false,
|
||||
searchKeyword: '',
|
||||
filters: {
|
||||
areaName: '',
|
||||
productionUnitName: '',
|
||||
typeName: ''
|
||||
},
|
||||
filterTimer: null,
|
||||
currentOperateStep: {},
|
||||
showPopupStep: false,
|
||||
stepLists: [],
|
||||
curTotalStep: 0,
|
||||
nowName:''
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
// 可以接收外部传入的已存在数据用于去重提示
|
||||
if (options.existingData) {
|
||||
try {
|
||||
this.existingData = JSON.parse(decodeURIComponent(options.existingData))
|
||||
} catch (e) {}
|
||||
}
|
||||
this.loadData()
|
||||
},
|
||||
methods: {
|
||||
loadData(isLoadMore = false) {
|
||||
if (this.loading) return
|
||||
|
||||
if (!isLoadMore) {
|
||||
this.pageIndex = 1
|
||||
this.hasMore = true
|
||||
this.enterpriseLibraryList = []
|
||||
this.selectedIndices = []
|
||||
}
|
||||
|
||||
if (!this.hasMore && isLoadMore) {
|
||||
uni.showToast({
|
||||
title: '没有更多数据了',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
this.loading = true
|
||||
|
||||
const json = initFilter(this.ORG_ID)
|
||||
extendInclude(json, 'Nav_ProductionUnit')
|
||||
extendInclude(json, 'Nav_Area')
|
||||
extendInclude(json, 'Nav_Type')
|
||||
|
||||
// 添加筛选条件
|
||||
const conditions = []
|
||||
|
||||
if (this.filters.areaName) {
|
||||
const tempGroup = initFilterGroup(false);
|
||||
extendGroupRule(tempGroup, 'AREA_ID', 1, this.filters.AREA_ID)
|
||||
extendFilterGroup(json, tempGroup);
|
||||
}
|
||||
if (this.filters.productionUnitName) {
|
||||
const tempGroup = initFilterGroup(false);
|
||||
extendGroupRule(tempGroup, 'Nav_ProductionUnit.NAME', 9, this.filters.productionUnitName)
|
||||
extendFilterGroup(json, tempGroup);
|
||||
}
|
||||
if (this.filters.typeName) {
|
||||
const tempGroup = initFilterGroup(false);
|
||||
extendGroupRule(tempGroup, 'TYPE_ID', 1, this.filters.TYPE_ID)
|
||||
extendFilterGroup(json, tempGroup);
|
||||
}
|
||||
|
||||
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 = this.pageSize
|
||||
json.PageIndex = this.pageIndex
|
||||
json.Start = (this.pageIndex - 1) * this.pageSize
|
||||
|
||||
getRequest(json, "/SK/SKEnterpriseLibrary/SKOrderPaged").then(res => {
|
||||
this.loading = false
|
||||
|
||||
if (res && res.length > 0) {
|
||||
if (isLoadMore) {
|
||||
this.enterpriseLibraryList = [...this.enterpriseLibraryList, ...res]
|
||||
} else {
|
||||
this.enterpriseLibraryList = res
|
||||
}
|
||||
this.hasMore = res.length >= this.pageSize
|
||||
this.pageIndex++
|
||||
} else {
|
||||
this.hasMore = false
|
||||
if (!isLoadMore && this.enterpriseLibraryList.length === 0) {
|
||||
uni.showToast({
|
||||
title: '暂无数据',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
uni.showToast({
|
||||
title: '加载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
loadMore() {
|
||||
if (this.hasMore && !this.loading) {
|
||||
this.loadData(true)
|
||||
}
|
||||
},
|
||||
|
||||
toggleSelection(index) {
|
||||
const idx = this.selectedIndices.indexOf(index)
|
||||
if (idx === -1) {
|
||||
this.selectedIndices.push(index)
|
||||
} else {
|
||||
this.selectedIndices.splice(idx, 1)
|
||||
}
|
||||
},
|
||||
|
||||
handleSearch() {
|
||||
this.loadData()
|
||||
},
|
||||
|
||||
handleClear() {
|
||||
this.searchKeyword = ''
|
||||
this.loadData()
|
||||
},
|
||||
|
||||
handleFilterChange() {
|
||||
if (this.filterTimer) clearTimeout(this.filterTimer)
|
||||
this.filterTimer = setTimeout(() => {
|
||||
this.loadData()
|
||||
}, 500)
|
||||
},
|
||||
|
||||
searchWithFilters() {
|
||||
this.loadData()
|
||||
},
|
||||
|
||||
resetFilters() {
|
||||
this.filters = {
|
||||
areaName: '',
|
||||
productionUnitName: '',
|
||||
typeName: '',
|
||||
AREA_ID:'',
|
||||
TYPE_ID:''
|
||||
|
||||
|
||||
}
|
||||
this.loadData()
|
||||
},
|
||||
|
||||
handleConfirm() {
|
||||
const selectedItems = this.selectedIndices.map(idx => this.enterpriseLibraryList[idx])
|
||||
// 使用 uni.$emit 或 getOpenerEventChannel 返回数据
|
||||
const eventChannel = this.getOpenerEventChannel()
|
||||
if (eventChannel) {
|
||||
eventChannel.emit('confirm', {
|
||||
selectedItems
|
||||
})
|
||||
}
|
||||
uni.navigateBack()
|
||||
},
|
||||
|
||||
handleCancel() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
handleChangeStep(name) {
|
||||
this.currentOperateStep = {}
|
||||
this.showPopupStep = true
|
||||
this.nowName = name
|
||||
this.handleSearchStep('init')
|
||||
},
|
||||
handleClosePopupStep() {
|
||||
this.showPopupStep = false
|
||||
// this.showPopupCertificate = false
|
||||
},
|
||||
handleSearchStep(val, pageIndex) {
|
||||
let requestInfo = this.nowName == 'Area' ? GetNewRiskAreaInfo :GetRiskTypeInfo
|
||||
const orgId = uni.getStorageSync('orgId')
|
||||
const json = initFilter(orgId, "", "", 0, pageIndex ?? 1)
|
||||
|
||||
json.Limit = 20
|
||||
if (pageIndex) {
|
||||
json.Start = (pageIndex - 1) * json.Limit;
|
||||
}
|
||||
if (val !== 'init') {
|
||||
const tempGroup = initFilterGroup(false);
|
||||
extendGroupRule(tempGroup, 'NAME', 9, val)
|
||||
extendFilterGroup(json, tempGroup);
|
||||
}
|
||||
requestInfo(json).then(res => {
|
||||
// if (res.IsSuccessful) {
|
||||
this.stepLists = (res.Data || res).map(i => {
|
||||
return {
|
||||
...i,
|
||||
id: i.ID,
|
||||
name: i.NAME,
|
||||
}
|
||||
})
|
||||
this.curTotalStep = res.TotalCount
|
||||
// }
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
handleSelectedStep(val) {
|
||||
if (this.nowName == 'Area') {
|
||||
this.filters.areaName = val.NAME
|
||||
this.filters.AREA_ID = val.ID
|
||||
} else {
|
||||
this.filters.typeName = val.NAME
|
||||
this.filters.TYPE_ID = val.ID
|
||||
}
|
||||
this.showPopupStep = false
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.enterprise-library-page {
|
||||
min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.search-header {
|
||||
padding: 12px 16px;
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.filter-section {
|
||||
background-color: #fff;
|
||||
padding: 0 16px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.filter-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.filter-title {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.filter-content {
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.filter-row {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.filter-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.filter-label {
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
white-space: nowrap;
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
.filter-reset {
|
||||
flex: 0.5;
|
||||
}
|
||||
|
||||
.reset-btn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.list-container {
|
||||
flex: 1;
|
||||
padding: 12px 16px;
|
||||
padding-bottom: 80px;
|
||||
}
|
||||
|
||||
.enterprise-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
padding: 12px;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 12px;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.enterprise-info {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
margin-bottom: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 13px;
|
||||
color: #999;
|
||||
width: 70px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.info-index {
|
||||
font-size: 13px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
padding: 40px 0;
|
||||
color: #999;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.load-more-footer {
|
||||
padding: 15px 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.load-more-btn {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.no-more-tip {
|
||||
text-align: center;
|
||||
padding: 10px 0;
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.bottom-buttons {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
padding: 12px 16px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.bottom-buttons button {
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
@ -90,7 +90,7 @@
|
||||
</u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="风险类别" prop="HIDDEN_LEVEL" @click="handleChangeStep(index,'Category')" border-bottom>
|
||||
<u--input v-model="(item.Nav_Type||{}).NAME" placeholder="请选择风险类别" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" disabledColor="#ffffff" inputAlign="right" fontSize="14px"
|
||||
<u--input v-model="(item.Nav_Type||{}).NAME" disabled placeholder="请选择风险类别" suffixIcon="arrow-down" suffixIconStyle="font-size: 12px" disabledColor="#ffffff" inputAlign="right" fontSize="14px"
|
||||
border="none">
|
||||
</u--input>
|
||||
</u-form-item>
|
||||
@ -106,7 +106,7 @@
|
||||
</u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="是否有效" prop="HIDDEN_PLACE" @click="handleChangeUnit(index,'SKEnableStatusEnum')">
|
||||
<u--input v-model="item.ENABLE_STATUS_NAME" placeholder="请选择是否有效" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
|
||||
<u--input v-model="item.ENABLE_STATUS_NAME" disabled placeholder="请选择是否有效" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
|
||||
</u--input>
|
||||
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
|
||||
</u-icon>
|
||||
@ -125,46 +125,7 @@
|
||||
</view>
|
||||
<u-picker :show="showPopupUnit" :columns="UnitLists" @confirm="confirmUnit" @cancel="cancelUnit" :defaultIndex="UnitDefaultIndex" keyName="NAME"></u-picker>
|
||||
<u-modal :show="showDelModalIndex >= 0" @confirm="confirmDel" @cancel="cacelDel" :showCancelButton="true" title="确认删除?"></u-modal>
|
||||
<u-modal :show="showEnterpriseLibrary" :closeOnClickOverlay="false" :showCancelButton="true" @confirm="confirmEnterpriseSelection" @cancel="cancelEnterpriseSelection" title="选择企业库内容">
|
||||
<view class="enterprise-list-container">
|
||||
<view class="enterprise-list" :style="{ maxHeight: '400px', overflowY: 'auto' }">
|
||||
<view v-for="(item, idx) in enterpriseLibraryList" :key="item.ID" class="enterprise-item" >
|
||||
<u-checkbox-group><u-checkbox :checked="selectedEnterpriseIndices.includes(idx)" shape="circle" @change="(e) => toggleEnterpriseSelection(idx, e)"></u-checkbox></u-checkbox-group>
|
||||
<view class="enterprise-info" >
|
||||
<text class="enterprise-detail">{{idx+1}}.生产单元 : </text>
|
||||
<text class="enterprise-name">{{ item.Nav_ProductionUnit.NAME || '' }}</text>
|
||||
|
||||
<text class="enterprise-detail">辨识区域 : </text>
|
||||
<text class="enterprise-name">{{ item.Nav_Area.NAME || '' }}</text>
|
||||
|
||||
<text class="enterprise-detail">风险名称 : </text>
|
||||
<text class="enterprise-name">{{ item.RISK_NAME || '' }}</text>
|
||||
|
||||
<text class="enterprise-detail">风险描述 : </text>
|
||||
<text class="enterprise-name">{{ item.RISK_DESCRIPTION || '' }}</text>
|
||||
|
||||
<text class="enterprise-detail">风险类别 : </text>
|
||||
<text class="enterprise-name">{{ item.Nav_Type.NAME || '' }}</text>
|
||||
|
||||
<text class="enterprise-detail">管控措施 : </text>
|
||||
<text class="enterprise-name">{{ item.MEASURE || '' }}</text>
|
||||
|
||||
<text class="enterprise-detail">应急处置 : </text>
|
||||
<text class="enterprise-name">{{ item.EMERGENCY || '' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="enterpriseLibraryList.length === 0 && !enterpriseLibraryLoading" class="empty-tip">暂无企业库数据</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部加载更多按钮 -->
|
||||
<view class="load-more-footer" v-if="enterpriseLibraryList.length > 0">
|
||||
<u-button v-if="enterpriseLibraryHasMore" type="primary" :plain="true" :loading="enterpriseLibraryLoading" @click="loadMoreEnterpriseData" class="load-more-btn" size="small">
|
||||
{{ enterpriseLibraryLoading ? '加载中...' : '加载更多' }}
|
||||
</u-button>
|
||||
<view v-else class="no-more-tip">—— 没有更多数据了 ——</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-modal>
|
||||
<u-datetime-picker :show="showPopupRecitifyDate" v-model="dateRecitifyTime" mode="date" @confirm="confirmRecitifyDate" @cancel="cancelRecitifyDate"></u-datetime-picker>
|
||||
<query-selector :show="showPopupStep" :total="curTotalStep" :lists="stepLists" :defaultValue="currentOperateStep.NAME" @close="handleClosePopupStep" @search="handleSearchStep" @select="handleSelectedStep" />
|
||||
|
||||
@ -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
|
||||
// 新增处理企业库选择结果的方法
|
||||
handleEnterpriseSelection(selectedItems) {
|
||||
if (!selectedItems || selectedItems.length === 0) 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
|
||||
}
|
||||
|
||||
// 原有逻辑保持不变
|
||||
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;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user