去除index,采用item

This commit is contained in:
yunkexin 2026-06-22 14:34:27 +08:00
parent 9cbdd7ca30
commit ef2baad230

View File

@ -59,18 +59,18 @@
<u-form-item prop="Nav_Contents">
<view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;flex: 1;">
<view @click="handleChangeStep(index,'Area')" style="flex: 1;">
<view @click="handleChangeStep(item,'Area')" style="flex: 1;">
{{index+1+'.辨识区域:'+item.Nav_Area?item.Nav_Area.NAME:''}}
</view>
<view class="action" style="display: flex;flex-direction: row;align-items: center;justify-content: space-around;">
<u-icon @click="handleDelRowBefore(item)" name="trash" color="#ff4d4f" size="21" style="margin-right: 20px;"></u-icon>
<u-icon name="arrow-up" size="12" v-if="item.showPack" @click="handlePack(index)"></u-icon>
<u-icon name="arrow-down" size="12" v-if="!item.showPack" @click="handlePack(index)"></u-icon>
<u-icon name="arrow-up" size="12" v-if="item.showPack" @click="handlePack(item)"></u-icon>
<u-icon name="arrow-down" size="12" v-if="!item.showPack" @click="handlePack(item)"></u-icon>
</view>
</view>
</u-form-item>
<view v-if="item.showPack==true">
<u-form-item label="生产单元:" @click="handleChangeUnit(index,'MinType')" border-bottom>
<u-form-item label="生产单元:" @click="handleChangeUnit(item,'MinType')" border-bottom>
<u--input v-model="(item.Nav_ProductionUnit||{}).NAME" disabled disabledColor="#ffffff" placeholder="请选择生产单元" border="none" inputAlign="right" fontSize="14px">
</u--input>
<u-icon style="margin-left: 4px;" slot="right" name="arrow-down" size="12">
@ -89,7 +89,7 @@
<u--input v-model="item.RISK_DESCRIPTION" placeholder="请填写风险描述" disabledColor="#ffffff" inputAlign="right" fontSize="14px" border="none">
</u--input>
</u-form-item>
<u-form-item label="风险类别" prop="HIDDEN_LEVEL" @click="handleChangeStep(index,'Category')" border-bottom>
<u-form-item label="风险类别" prop="HIDDEN_LEVEL" @click="handleChangeStep(item,'Category')" border-bottom>
<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>
@ -122,7 +122,7 @@
<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-form-item label="是否有效" prop="HIDDEN_PLACE" @click="handleChangeUnit(item,'SKEnableStatusEnum')">
<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">
@ -346,16 +346,17 @@
})
},
handlePack(index) {
this.dataModel.Nav_Details[index].showPack = this.dataModel.Nav_Details[index].showPack == false ? true : false
this.dataModel.Nav_Details = [...this.dataModel.Nav_Details]
handlePack(item) {
item.showPack = item.showPack == false ? true : false
this.$forceUpdate()
},
cancelUnit() {
this.showPopupUnit = false
},
handleChangeUnit(index, name) {
this.nowIndex = [index, name]
handleChangeUnit(item, name) {
this.nowItem = item
this.nowName = name
if (name == 'MinType') {
const json = initFilter(this.ORG_ID)
getRequest(json, "/FM/UserProductionUnitSet/OrderPaged").then(res => {
@ -368,12 +369,12 @@
this.showPopupUnit = true
},
confirmUnit(e) {
if (this.nowIndex[1] == 'MinType') {
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
if (this.nowName == 'MinType') {
this.nowItem.Nav_ProductionUnit = e.value[0]
this.nowItem.PRODUCTION_UNIT_ID = e.value[0].ID
} else {
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.nowItem.ENABLE_STATUS = e.value[0].code
this.nowItem.ENABLE_STATUS_NAME = e.value[0].name
}
this.showPopupUnit = false
},
@ -449,6 +450,7 @@
},
//
handleEnterpriseSelection(selectedItems) {
console.log(selectedItems, '999')
if (!selectedItems || selectedItems.length === 0) return
const newDetails = []
@ -470,6 +472,11 @@
})
return
}
const convertedMeasures = (enterpriseItem.Nav_Details || [])
.map((item, index) => ({
...item,
MEASURE: item.MEASURES_NAME, //
}))
const convertedItem = {
showPack: false,
@ -486,12 +493,14 @@
Nav_RiskName: enterpriseItem.Nav_RiskName || {
NAME: ''
},
Nav_DetailMeasures: convertedMeasures,
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,
@ -589,10 +598,11 @@
this.showPopupRecitifyDate = false
},
handleChangeStep(index, name) {
handleChangeStep(item, name) {
this.currentOperateStep = {}
this.showPopupStep = true
this.nowIndex = [index, name]
this.nowItem = item
this.nowName = name
this.handleSearchStep('init')
},
handleClosePopupStep() {
@ -600,7 +610,7 @@
// this.showPopupCertificate = false
},
handleSearchStep(val, pageIndex) {
let requestInfo = this.nowIndex[1] == 'demand' ? GetSKRequestInfo : this.nowIndex[1] == 'Area' ? GetNewRiskAreaInfo : this.nowIndex[1] == 'RiskName' ? GetRiskNameInfo : GetRiskTypeInfo
let requestInfo = this.nowName == 'demand' ? GetSKRequestInfo : this.nowName == 'Area' ? GetRiskAreaInfo : this.nowName == 'RiskName' ? GetRiskNameInfo : GetRiskTypeInfo
const orgId = uni.getStorageSync('orgId')
const json = initFilter(orgId, "", "", 0, pageIndex ?? 1)
@ -629,19 +639,19 @@
},
handleSelectedStep(val) {
if (this.nowIndex[1] == 'demand') {
if (this.nowName == 'demand') {
this.dataModel.Nav_Require.NAME = val.NAME
this.dataModel.REQUIRE_ID = val.ID
this.dataModel.RequireName = val.NAME
} else if (this.nowIndex[1] == 'Area') {
this.dataModel.Nav_Details[this.nowIndex[0]].Nav_Area.NAME = val.NAME
this.dataModel.Nav_Details[this.nowIndex[0]].AREA_ID = val.ID
} 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]].RISK_NAME_ID = val.ID
} else if (this.nowName == 'Area') {
this.nowItem.Nav_Area.NAME = val.NAME
this.nowItem.AREA_ID = val.ID
} else if (this.nowName == 'RiskName') {
this.nowItem.Nav_RiskName.NAME = val.NAME
this.nowItem.RISK_NAME_ID = val.ID
} else {
this.dataModel.Nav_Details[this.nowIndex[0]].Nav_Type.NAME = val.NAME
this.dataModel.Nav_Details[this.nowIndex[0]].TYPE_ID = val.ID
this.nowItem.Nav_Type.NAME = val.NAME
this.nowItem.TYPE_ID = val.ID
}
this.showPopupStep = false
@ -657,7 +667,7 @@
})
return
}
if (!item.Nav_Area ||!item.Nav_Area.NAME) {
if (!item.Nav_Area || !item.Nav_Area.NAME) {
uni.showToast({
title: '顺序' + i + '辨识区域不能为空',
icon: 'none'
@ -685,7 +695,7 @@
})
return
}
if (!item.Nav_Type ||!item.Nav_Type.NAME) {
if (!item.Nav_Type || !item.Nav_Type.NAME) {
uni.showToast({
title: '顺序' + i + '风险类别不能为空',
icon: 'none'
@ -704,7 +714,7 @@
this.model.PUBLISH = "SaveAndNotify";
delete this.model.Nav_ApplyDepartment
delete this.model.Nav_ApplyUser
this.model.Nav_Details.map(item=>{
this.model.Nav_Details.map(item => {
delete item.Nav_ProductionUnit
delete item.Nav_Type
})