台账管理页面修改

This commit is contained in:
lSun 2026-01-23 18:53:25 +08:00
parent 68443deca6
commit 173db85e47
2 changed files with 104 additions and 36 deletions

View File

@ -714,7 +714,7 @@
//
if (item.mustHave == '1') {
const trigger = ['SELECT', 'DATE', 'IMAGE', 'FILE'].includes(item.inputType) ? 'change' : 'blur'
const trigger = ['SELECT', 'DATE', 'IMAGE', 'FILE', 'INPUT'].includes(item.inputType) ? 'change' : 'blur'
this.$set(this.equipRules, item.propertyCode, [
{ required: true, message: `请输入${item.propertyName}`, trigger }
])
@ -725,7 +725,7 @@
this.isSystem.forEach(item => {
if (!item.propertyCode) return
if (item.mustHave == '1') {
const trigger = ['SELECT', 'DATE', 'IMAGE', 'FILE'].includes(item.inputType) ? 'change' : 'blur'
const trigger = ['SELECT', 'DATE', 'IMAGE', 'FILE', 'INPUT'].includes(item.inputType) ? 'change' : 'blur'
//
if (!this.equipRules[item.propertyCode]) {
this.$set(this.equipRules, item.propertyCode, [
@ -794,6 +794,10 @@
this.dialogVisible = true
this.firstLevel()
this.getManufacturerSelectList()
setTimeout(() => {
this.$refs.formRef.clearValidate()
}, 500)
},
//
async getInfo() {

View File

@ -115,6 +115,7 @@
stripe
class="my-table"
@row-dblclick="handleDblClick"
ref="tableRef"
>
<el-table-column
label="序号"
@ -350,57 +351,51 @@
<!-- 动态生成 fieldVoList -->
<el-table-column
v-for="(item, index) in fieldVoList"
:key="index"
:key="'field-col-' + index"
align="center"
show-overflow-tooltip
:label="item.propertyName"
:prop="item.propertyCode"
min-width="200px"
>
<!-- <template v-slot="{ row }">
<div
v-if="
(index + 1) % 2 === 0 &&
row.isNew &&
row.fieldVoList.length > 0 &&
row.fieldVoList[(index + 1) / 2 - 1]
"
>
<el-input
v-if="row.fieldVoList[(index + 1) / 2 - 1].inputType == 1"
<template v-slot="{ row }">
<div v-if="row.isNew && row.fieldVoList && row.fieldVoList.length > index">
<el-input v-if="row.fieldVoList[index].inputType == 'INPUT'"
autocomplete="off"
maxlength="30"
v-model="row.fieldVoList[(index + 1) / 2 - 1].propertyValue"
maxlength="30" v-model="row.fieldVoList[index].propertyValue"
clearable
/>
<!-- 日期选择器 -->
<el-date-picker
v-else-if="row.fieldVoList[index].inputType == 'DATE'"
v-model="row.fieldVoList[index].propertyValue"
type="date"
placeholder="选择日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
clearable
style="width: 100%"
/>
<el-select
v-if="row.fieldVoList[(index + 1) / 2 - 1].inputType == 2"
v-model="row.fieldVoList[(index + 1) / 2 - 1].propertyValue"
v-else-if="row.fieldVoList[index].inputType == 'SELECT' "
v-model="row.fieldVoList[index].propertyValue"
placeholder="请选择"
clearable
style="width: 100%"
>
<el-option
v-for="(item, index) in row.fieldVoList[(index + 1) / 2 - 1].valueList"
:key="index"
:label="item.value"
:value="item.value"
v-for="option in getSelectOptions(row.fieldVoList[index].value)"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</div>
<span
v-else-if="
row.isNew &&
row.fieldVoList.length > 0 &&
row.fieldVoList[Math.ceil(index / 2)] &&
row.fieldVoList[Math.ceil(index / 2)].mustHave != 0
"
style="color: red"
>{{ getFeatureValue(row, item.prop) }}</span
>
<span v-else>{{ getFeatureValue(row, item.prop) }}</span>
</template>-->
<span v-else>{{ getLedgerValue(row, item.propertyCode) }}</span>
</template>
</el-table-column>
@ -1075,9 +1070,17 @@ export default {
delete params.productionDate
const res = await getDeviceByOrderIdApi(params)
this.tableData = res.data.rows
// console.log("",res.data.rows.fieldVoList)
// this.fieldVoList = res.data.rows.fieldVoList || []
// console.log("",this.fieldVoList)
this.total = res.data.total
setTimeout(() => {
this.$refs.tableRef.doLayout()
}, 200)
} catch (error) {
console.error('获取列表失败:', error)
}
@ -1428,6 +1431,8 @@ export default {
purchaseInvoices: [], //
propertyVoList: [], //
fieldVoList: this.fieldVoList, //
majorList: [], //
processList: [], //
categoryList: [], //
@ -1440,6 +1445,7 @@ export default {
await this.getFirstLevel(newRow)
this.tableData.unshift(newRow)
console.log('🚀 ~ this.tableData:', this.tableData)
console.log('----》》》', this.fieldVoList)
} catch (error) {
console.log('🚀 ~ error:', error)
}
@ -1608,6 +1614,30 @@ export default {
return
}
}
// fieldVoList
if (row.isNew && row.fieldVoList && row.fieldVoList.length > 0) {
//
const missingRequiredFields = []
row.fieldVoList.forEach((field, index) => {
//
if (field.mustHave != 0) {
//
const value = field.propertyValue
if (value === undefined || value === null || value === '') {
missingRequiredFields.push(field.propertyName || `字段${index + 1}`)
}
}
})
//
if (missingRequiredFields.length > 0) {
this.$message.error(`请填写以下必填项:${missingRequiredFields.join('、')}`)
return
}
}
console.log('🚀 ~ row.propertyVoList:', row.propertyVoList)
//
@ -1662,6 +1692,40 @@ export default {
isApprovalVisible: routerParams.isApprovalVisible
}
})
},
//
getSelectOptions(value) {
if (!value) return []
return value.split(/[,]/).map(v => ({
value: v.trim(),
label: v.trim()
}))
},
//
getLedgerValue(row, propertyCode) {
// row.fieldVoList fieldVoList 使
const configIndex = this.fieldVoList.findIndex(item => item.propertyCode === propertyCode)
if (configIndex !== -1 && row.fieldVoList && row.fieldVoList[configIndex]) {
const value = row.fieldVoList[configIndex].propertyValue
if (value !== null && value !== undefined) {
return value
}
}
// 使 find
if (row.fieldVoList && Array.isArray(row.fieldVoList)) {
const field = row.fieldVoList.find(item => item.propertyCode === propertyCode)
if (field && field.propertyValue !== null && field.propertyValue !== undefined) {
return field.propertyValue
}
}
// row
return row[propertyCode] || ''
}
}
}