台账管理页面修改

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') { 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, [ this.$set(this.equipRules, item.propertyCode, [
{ required: true, message: `请输入${item.propertyName}`, trigger } { required: true, message: `请输入${item.propertyName}`, trigger }
]) ])
@ -725,7 +725,7 @@
this.isSystem.forEach(item => { this.isSystem.forEach(item => {
if (!item.propertyCode) return if (!item.propertyCode) return
if (item.mustHave == '1') { 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]) { if (!this.equipRules[item.propertyCode]) {
this.$set(this.equipRules, item.propertyCode, [ this.$set(this.equipRules, item.propertyCode, [
@ -794,6 +794,10 @@
this.dialogVisible = true this.dialogVisible = true
this.firstLevel() this.firstLevel()
this.getManufacturerSelectList() this.getManufacturerSelectList()
setTimeout(() => {
this.$refs.formRef.clearValidate()
}, 500)
}, },
// //
async getInfo() { async getInfo() {

View File

@ -115,6 +115,7 @@
stripe stripe
class="my-table" class="my-table"
@row-dblclick="handleDblClick" @row-dblclick="handleDblClick"
ref="tableRef"
> >
<el-table-column <el-table-column
label="序号" label="序号"
@ -350,57 +351,51 @@
<!-- 动态生成 fieldVoList --> <!-- 动态生成 fieldVoList -->
<el-table-column <el-table-column
v-for="(item, index) in fieldVoList" v-for="(item, index) in fieldVoList"
:key="index" :key="'field-col-' + index"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
:label="item.propertyName" :label="item.propertyName"
:prop="item.propertyCode" :prop="item.propertyCode"
min-width="200px" min-width="200px"
> >
<!-- <template v-slot="{ row }"> <template v-slot="{ row }">
<div <div v-if="row.isNew && row.fieldVoList && row.fieldVoList.length > index">
v-if=" <el-input v-if="row.fieldVoList[index].inputType == 'INPUT'"
(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"
autocomplete="off" autocomplete="off"
maxlength="30" maxlength="30" v-model="row.fieldVoList[index].propertyValue"
v-model="row.fieldVoList[(index + 1) / 2 - 1].propertyValue"
clearable 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 <el-select
v-if="row.fieldVoList[(index + 1) / 2 - 1].inputType == 2" v-else-if="row.fieldVoList[index].inputType == 'SELECT' "
v-model="row.fieldVoList[(index + 1) / 2 - 1].propertyValue" v-model="row.fieldVoList[index].propertyValue"
placeholder="请选择" placeholder="请选择"
clearable clearable
style="width: 100%" style="width: 100%"
> >
<el-option <el-option
v-for="(item, index) in row.fieldVoList[(index + 1) / 2 - 1].valueList" v-for="option in getSelectOptions(row.fieldVoList[index].value)"
:key="index" :key="option.value"
:label="item.value" :label="option.label"
:value="item.value" :value="option.value"
/> />
</el-select> </el-select>
</div> </div>
<span
v-else-if=" <span v-else>{{ getLedgerValue(row, item.propertyCode) }}</span>
row.isNew && </template>
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>-->
</el-table-column> </el-table-column>
@ -1075,9 +1070,17 @@ export default {
delete params.productionDate delete params.productionDate
const res = await getDeviceByOrderIdApi(params) const res = await getDeviceByOrderIdApi(params)
this.tableData = res.data.rows 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 this.total = res.data.total
setTimeout(() => {
this.$refs.tableRef.doLayout()
}, 200)
} catch (error) { } catch (error) {
console.error('获取列表失败:', error) console.error('获取列表失败:', error)
} }
@ -1428,6 +1431,8 @@ export default {
purchaseInvoices: [], // purchaseInvoices: [], //
propertyVoList: [], // propertyVoList: [], //
fieldVoList: this.fieldVoList, //
majorList: [], // majorList: [], //
processList: [], // processList: [], //
categoryList: [], // categoryList: [], //
@ -1440,6 +1445,7 @@ export default {
await this.getFirstLevel(newRow) await this.getFirstLevel(newRow)
this.tableData.unshift(newRow) this.tableData.unshift(newRow)
console.log('🚀 ~ this.tableData:', this.tableData) console.log('🚀 ~ this.tableData:', this.tableData)
console.log('----》》》', this.fieldVoList)
} catch (error) { } catch (error) {
console.log('🚀 ~ error:', error) console.log('🚀 ~ error:', error)
} }
@ -1608,6 +1614,30 @@ export default {
return 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) console.log('🚀 ~ row.propertyVoList:', row.propertyVoList)
// //
@ -1662,6 +1692,40 @@ export default {
isApprovalVisible: routerParams.isApprovalVisible 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] || ''
} }
} }
} }