企业库导入功能
This commit is contained in:
parent
0d96842248
commit
609dcc7663
@ -101,15 +101,22 @@
|
|||||||
<u-form-item label="应急处置" prop="HIDDEN_PLACE" border-bottom>
|
<u-form-item label="应急处置" prop="HIDDEN_PLACE" border-bottom>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<u--textarea v-model="item.EMERGENCY" placeholder="请填写应急处置" autoHeight maxlength="-1"></u--textarea>
|
<u--textarea v-model="item.EMERGENCY" placeholder="请填写应急处置" autoHeight maxlength="-1"></u--textarea>
|
||||||
<u-form-item label="是否有效" prop="HIDDEN_PLACE" @click="handleChangeUnit(index,'ENABLE_STATUS')">
|
<u-form-item label="新增标识" prop="HIDDEN_PLACE" border-bottom>
|
||||||
<u--input v-model="item.ENABLE_STATUS" placeholder="请选择是否有效" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
|
<u--input v-model="item.MARK_NAME" disabled disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
|
||||||
|
</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>
|
</u--input>
|
||||||
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
|
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
|
||||||
</u-icon>
|
</u-icon>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-button text="新增检查区域" type="primary" @click="handleNewCheckContent"></u-button>
|
<view style="padding: 10px 16px;display: flex;flex-direction: row;">
|
||||||
|
<u-button type="primary" @click="handleNewCheckContent" color="#3d4b70">新增检查区域</u-button>
|
||||||
|
<u-button type="primary" @click="handleNewCheckList" color="#3d4b70" style="margin-left: 5px;">导入企业库内容</u-button>
|
||||||
|
</view>
|
||||||
</u--form>
|
</u--form>
|
||||||
</view>
|
</view>
|
||||||
<view style="padding: 10px 16px;display: flex;flex-direction: row;" v-if="stepsPageList === 1" class="bottom-button">
|
<view style="padding: 10px 16px;display: flex;flex-direction: row;" v-if="stepsPageList === 1" class="bottom-button">
|
||||||
@ -118,8 +125,49 @@
|
|||||||
</view>
|
</view>
|
||||||
<u-picker :show="showPopupUnit" :columns="UnitLists" @confirm="confirmUnit" @cancel="cancelUnit" :defaultIndex="UnitDefaultIndex" keyName="NAME"></u-picker>
|
<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="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>
|
<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" />
|
<query-selector :show="showPopupStep" :total="curTotalStep" :lists="stepLists" :defaultValue="currentOperateStep.NAME" @close="handleClosePopupStep" @search="handleSearchStep" @select="handleSelectedStep" />
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -135,7 +183,8 @@
|
|||||||
guid,
|
guid,
|
||||||
initFilter,
|
initFilter,
|
||||||
initFilterGroup,
|
initFilterGroup,
|
||||||
handleOriginalArray
|
handleOriginalArray,
|
||||||
|
transformData
|
||||||
} from '../../../../utils/common'
|
} from '../../../../utils/common'
|
||||||
import {
|
import {
|
||||||
FMProductionUnit,
|
FMProductionUnit,
|
||||||
@ -154,6 +203,10 @@
|
|||||||
GetRiskTypeInfo,
|
GetRiskTypeInfo,
|
||||||
GetRiskNameInfo,
|
GetRiskNameInfo,
|
||||||
} from '../../../../services/apply/subPages/SK/SKServices.js'
|
} from '../../../../services/apply/subPages/SK/SKServices.js'
|
||||||
|
import {
|
||||||
|
getEnum,
|
||||||
|
GetEnumAnyOrder
|
||||||
|
} from '../../../../services/common';
|
||||||
import {
|
import {
|
||||||
getRequest,
|
getRequest,
|
||||||
} from '../../../../services/apply/FOServices/FOServices';
|
} from '../../../../services/apply/FOServices/FOServices';
|
||||||
@ -179,6 +232,15 @@
|
|||||||
stepLoad: true,
|
stepLoad: true,
|
||||||
UnitLists: [],
|
UnitLists: [],
|
||||||
UnitDefaultIndex: [0],
|
UnitDefaultIndex: [0],
|
||||||
|
// 新增企业库相关数据
|
||||||
|
showEnterpriseLibrary: false,
|
||||||
|
enterpriseLibraryList: [],
|
||||||
|
selectedEnterpriseIndices: [],
|
||||||
|
// 新增分页相关变量
|
||||||
|
enterpriseLibraryPageIndex: 1,
|
||||||
|
enterpriseLibraryHasMore: true,
|
||||||
|
enterpriseLibraryLoading: false,
|
||||||
|
enterpriseLibraryTotal: 0,
|
||||||
dataModel: {
|
dataModel: {
|
||||||
YEAR: '',
|
YEAR: '',
|
||||||
START_DATE: '',
|
START_DATE: '',
|
||||||
@ -247,15 +309,29 @@
|
|||||||
TaskID: '',
|
TaskID: '',
|
||||||
nowName: '',
|
nowName: '',
|
||||||
nowIndex: 0,
|
nowIndex: 0,
|
||||||
|
enumsData: {}, // 存储所有枚举数据(键:枚举名称,值:处理后的枚举列表)
|
||||||
|
enumsText: {} // 存储枚举文本列表(用于下拉选择等场景)
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
this.TaskID = option.taskID ? option.taskID : '';
|
this.TaskID = option.taskID ? option.taskID : '';
|
||||||
this.ID = option.ID ? option.ID : '';
|
this.ID = option.ID ? option.ID : '';
|
||||||
this.loadData()
|
this.fetchEnums(['SKMarkEnum', 'SKEnableStatusEnum']);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
fetchEnums(enumNames) {
|
||||||
|
var dataParm = {
|
||||||
|
'name': enumNames.join('|')
|
||||||
|
}
|
||||||
|
GetEnumAnyOrder(dataParm).then(res => {
|
||||||
|
let newd = transformData(res, enumNames)
|
||||||
|
this.enumsData = newd[0];
|
||||||
|
// 生成文本列表(如需要)
|
||||||
|
this.enumsText = newd[1]
|
||||||
|
this.loadData();
|
||||||
|
})
|
||||||
|
},
|
||||||
loadData() {
|
loadData() {
|
||||||
// const json = {}
|
// const json = {}
|
||||||
const orgId = uni.getStorageSync('orgId')
|
const orgId = uni.getStorageSync('orgId')
|
||||||
@ -283,7 +359,8 @@
|
|||||||
},
|
},
|
||||||
this.dataModel.Nav_Details.map(item => {
|
this.dataModel.Nav_Details.map(item => {
|
||||||
item['showPack'] = false
|
item['showPack'] = false
|
||||||
item.ENABLE_STATUS = item.ENABLE_STATUS == 0 ? '有效' : '无效'
|
item.ENABLE_STATUS_NAME = item.ENABLE_STATUS !== undefined ? this.enumsData['SKEnableStatusEnum'].find(item1 => item1.code === item.ENABLE_STATUS).name : '';
|
||||||
|
item.MARK_NAME = item.MARK !== undefined ? this.enumsData['SKMarkEnum'].find(item1 => item1.code === item.MARK).name : '';
|
||||||
})
|
})
|
||||||
this.stepLoad = false
|
this.stepLoad = false
|
||||||
|
|
||||||
@ -306,17 +383,17 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.UnitLists = [SKEffective]
|
this.UnitLists = [this.enumsData[name]]
|
||||||
}
|
}
|
||||||
this.showPopupUnit = true
|
this.showPopupUnit = true
|
||||||
},
|
},
|
||||||
confirmUnit(e) {
|
confirmUnit(e) {
|
||||||
console.log(e,'11')
|
|
||||||
if (this.nowIndex[1] == 'MinType') {
|
if (this.nowIndex[1] == 'MinType') {
|
||||||
this.dataModel.Nav_Details[this.nowIndex[0]].Nav_ProductionUnit = e.value[0]
|
this.dataModel.Nav_Details[this.nowIndex[0]].Nav_ProductionUnit = e.value[0]
|
||||||
this.dataModel.Nav_Details[this.nowIndex[0]].PRODUCTION_UNIT_ID = e.value[0].ID
|
this.dataModel.Nav_Details[this.nowIndex[0]].PRODUCTION_UNIT_ID = e.value[0].ID
|
||||||
} else {
|
} else {
|
||||||
this.dataModel.Nav_Details[this.nowIndex[0]].ENABLE_STATUS = e.value[0]
|
this.dataModel.Nav_Details[this.nowIndex[0]].ENABLE_STATUS = e.value[0].code
|
||||||
|
this.dataModel.Nav_Details[this.nowIndex[0]].ENABLE_STATUS_NAME = e.value[0].name
|
||||||
}
|
}
|
||||||
this.showPopupUnit = false
|
this.showPopupUnit = false
|
||||||
},
|
},
|
||||||
@ -347,11 +424,257 @@
|
|||||||
},
|
},
|
||||||
MEASURE: '',
|
MEASURE: '',
|
||||||
EMERGENCY: '',
|
EMERGENCY: '',
|
||||||
ENABLE_STATUS: '有效',
|
ENABLE_STATUS: this.enumsData['SKEnableStatusEnum'][0].code,
|
||||||
|
ENABLE_STATUS_NAME: this.enumsData['SKEnableStatusEnum'][0].name,
|
||||||
|
MARK: this.enumsData['SKMarkEnum'].find(item1 => item1.name === '新增').code,
|
||||||
|
MARK_NAME: this.enumsData['SKMarkEnum'].find(item1 => item1.name === '新增').name,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
this.dataModel.Nav_Details = [...this.dataModel.Nav_Details]
|
this.dataModel.Nav_Details = [...this.dataModel.Nav_Details]
|
||||||
},
|
},
|
||||||
|
handleNewCheckList() {
|
||||||
|
// 重置分页状态
|
||||||
|
this.enterpriseLibraryPageIndex = 1
|
||||||
|
this.enterpriseLibraryHasMore = true
|
||||||
|
this.enterpriseLibraryList = []
|
||||||
|
this.selectedEnterpriseIndices = []
|
||||||
|
this.loadEnterpriseLibraryData()
|
||||||
|
|
||||||
|
},
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
// 原有逻辑保持不变
|
||||||
|
const newDetails = []
|
||||||
|
const duplicateItems = []
|
||||||
|
this.selectedEnterpriseIndices.forEach(idx => {
|
||||||
|
const enterpriseItem = this.enterpriseLibraryList[idx]
|
||||||
|
// 检查是否与现有数据重复
|
||||||
|
const isDuplicate = this.dataModel.Nav_Details.some(existingItem =>
|
||||||
|
existingItem.AREA_ID === (enterpriseItem.AREA_ID || '') &&
|
||||||
|
existingItem.PRODUCTION_UNIT_ID === (enterpriseItem.PRODUCTION_UNIT_ID || '') &&
|
||||||
|
existingItem.RISK_NAME === (enterpriseItem.RISK_NAME || '')
|
||||||
|
)
|
||||||
|
|
||||||
|
if (isDuplicate) {
|
||||||
|
duplicateItems.push({
|
||||||
|
生产单元: enterpriseItem.Nav_ProductionUnit?.NAME || '',
|
||||||
|
辨识区域: enterpriseItem.Nav_Area?.NAME || '',
|
||||||
|
风险名称: enterpriseItem.RISK_NAME || ''
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const convertedItem = {
|
||||||
|
showPack: false,
|
||||||
|
PRODUCTION_UNIT_ID: enterpriseItem.PRODUCTION_UNIT_ID || '',
|
||||||
|
Nav_ProductionUnit: enterpriseItem.Nav_ProductionUnit || {
|
||||||
|
NAME: ''
|
||||||
|
},
|
||||||
|
AREA_ID: enterpriseItem.AREA_ID || '',
|
||||||
|
Nav_Area: enterpriseItem.Nav_Area || {
|
||||||
|
NAME: ''
|
||||||
|
},
|
||||||
|
RISK_NAME: enterpriseItem.RISK_NAME || '',
|
||||||
|
RISK_NAME_ID: enterpriseItem.RISK_NAME_ID || '',
|
||||||
|
Nav_RiskName: enterpriseItem.Nav_RiskName || {
|
||||||
|
NAME: ''
|
||||||
|
},
|
||||||
|
RISK_DESCRIPTION: enterpriseItem.RISK_DESCRIPTION || '',
|
||||||
|
TYPE_ID: enterpriseItem.TYPE_ID || '',
|
||||||
|
Nav_Type: enterpriseItem.Nav_Type || {
|
||||||
|
NAME: ''
|
||||||
|
},
|
||||||
|
MEASURE: enterpriseItem.MEASURE || '',
|
||||||
|
EMERGENCY: enterpriseItem.EMERGENCY || '',
|
||||||
|
ENABLE_STATUS: this.enumsData['SKEnableStatusEnum'][0].code,
|
||||||
|
ENABLE_STATUS_NAME: this.enumsData['SKEnableStatusEnum'][0].name,
|
||||||
|
MARK: this.enumsData['SKMarkEnum'].find(item1 => item1.name === '新增').code,
|
||||||
|
MARK_NAME: this.enumsData['SKMarkEnum'].find(item1 => item1.name === '新增').name,
|
||||||
|
ORG_ID: this.ORG_ID
|
||||||
|
}
|
||||||
|
newDetails.push(convertedItem)
|
||||||
|
})
|
||||||
|
|
||||||
|
// 处理重复项提示(保持原有逻辑)
|
||||||
|
if (duplicateItems.length > 0) {
|
||||||
|
const duplicateCount = duplicateItems.length
|
||||||
|
let message = ''
|
||||||
|
if (duplicateCount === 1) {
|
||||||
|
const dup = duplicateItems[0]
|
||||||
|
message = `以下数据已存在,无法重复导入:\n生产单元:${dup.生产单元}\n辨识区域:${dup.辨识区域}\n风险名称:${dup.风险名称}`
|
||||||
|
} else {
|
||||||
|
message = `有 ${duplicateCount} 条数据已存在,无法重复导入:\n`
|
||||||
|
duplicateItems.slice(0, 3).forEach((dup, i) => {
|
||||||
|
message += `${i+1}. ${dup.生产单元} / ${dup.辨识区域} / ${dup.风险名称}\n`
|
||||||
|
})
|
||||||
|
if (duplicateCount > 3) {
|
||||||
|
message += `...等共 ${duplicateCount} 条`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.showModal({
|
||||||
|
title: '重复数据提示',
|
||||||
|
content: message,
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: '知道了'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showEnterpriseLibrary = false
|
||||||
|
this.selectedEnterpriseIndices = []
|
||||||
|
},
|
||||||
|
// 取消选择
|
||||||
|
cancelEnterpriseSelection() {
|
||||||
|
this.showEnterpriseLibrary = false
|
||||||
|
this.selectedEnterpriseIndices = []
|
||||||
|
this.enterpriseLibraryList = []
|
||||||
|
this.enterpriseLibraryPageIndex = 1
|
||||||
|
this.enterpriseLibraryHasMore = true
|
||||||
|
this.enterpriseLibraryLoading = false
|
||||||
|
},
|
||||||
handleDelRowBefore(index) {
|
handleDelRowBefore(index) {
|
||||||
this.showDelModalIndex = index
|
this.showDelModalIndex = index
|
||||||
this.nowIndex = index
|
this.nowIndex = index
|
||||||
@ -437,8 +760,7 @@
|
|||||||
} else if (this.nowIndex[1] == 'RiskName') {
|
} else if (this.nowIndex[1] == 'RiskName') {
|
||||||
this.dataModel.Nav_Details[this.nowIndex[0]].Nav_RiskName.NAME = val.NAME
|
this.dataModel.Nav_Details[this.nowIndex[0]].Nav_RiskName.NAME = val.NAME
|
||||||
this.dataModel.Nav_Details[this.nowIndex[0]].RISK_NAME_ID = val.ID
|
this.dataModel.Nav_Details[this.nowIndex[0]].RISK_NAME_ID = val.ID
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.dataModel.Nav_Details[this.nowIndex[0]].Nav_Type.NAME = val.NAME
|
this.dataModel.Nav_Details[this.nowIndex[0]].Nav_Type.NAME = val.NAME
|
||||||
this.dataModel.Nav_Details[this.nowIndex[0]].TYPE_ID = val.ID
|
this.dataModel.Nav_Details[this.nowIndex[0]].TYPE_ID = val.ID
|
||||||
}
|
}
|
||||||
@ -509,7 +831,8 @@
|
|||||||
TYPE_ID: item.TYPE_ID,
|
TYPE_ID: item.TYPE_ID,
|
||||||
MEASURE: item.MEASURE,
|
MEASURE: item.MEASURE,
|
||||||
EMERGENCY: item.EMERGENCY,
|
EMERGENCY: item.EMERGENCY,
|
||||||
ENABLE_STATUS: !item.ENABLE_STATUS ? 0 : item.ENABLE_STATUS == '有效' ? 0 : 10,
|
ENABLE_STATUS: item.ENABLE_STATUS,
|
||||||
|
MARK: item.MARK,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.model = {
|
this.model = {
|
||||||
@ -547,4 +870,75 @@
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@import url("../../../../style/css/newTemplate.css");
|
@import url("../../../../style/css/newTemplate.css");
|
||||||
|
|
||||||
|
/* 新增企业库弹窗样式 */
|
||||||
|
.enterprise-list {
|
||||||
|
max-height: 500px;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.enterprise-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
padding: 12px 8px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.enterprise-info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.enterprise-name {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.enterprise-detail {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-tip {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40px 0;
|
||||||
|
color: #999;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.enterprise-list-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.load-more-footer {
|
||||||
|
padding: 15px 0 10px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.load-more-btn {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-more-tip {
|
||||||
|
text-align: center;
|
||||||
|
padding: 10px 0;
|
||||||
|
color: #999;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-tip {
|
||||||
|
text-align: center;
|
||||||
|
padding: 20px 0;
|
||||||
|
color: #999;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user