台账管理页面修改

This commit is contained in:
lSun 2026-01-22 20:33:39 +08:00
parent 41d92dd90f
commit 1d070e8054
4 changed files with 1350 additions and 1025 deletions

View File

@ -360,3 +360,11 @@ export const getDevDetailsApi = (data) => {
params: data
})
}
// 获取特征值
export const getConfigApi = (data) => {
return request({
url: `/material-mall/equipment/field/getConfig`,
method: 'GET',
})
}

View File

@ -118,6 +118,14 @@
<el-input v-model="form.propertyUnit" placeholder="产权单位" readonly/>
</el-form-item>
</el-col>
<el-col :span="6" v-for="(item, index) in form.fieldVoList" :key="index">
<el-form-item :label="item.propertyName" >
<el-input v-model="item.propertyValue" readonly/>
</el-form-item>
</el-col>
</el-row>
<div style="display: flex; padding-bottom: 10px">
@ -303,7 +311,7 @@
/>
</el-form-item>
<el-form-item label="装备二维码" prop="">
<el-form-item label="装备二维码111" prop="">
<div class="qrcode-box" style="width: 150px;height: 150px">
<QrcodeGenerator
ref="qr3"

View File

@ -1,4 +1,4 @@
<template>
<template>
<!-- 弹窗内容区域 -->
<el-dialog
:title="pageTitle"
@ -244,6 +244,63 @@
/>
</el-form-item>
</el-col>
<!-- 🔥 手动新增字段插在产权单位后面 -->
<el-col
v-for="item in config"
:key="item.id"
:span="6"
>
<el-form-item
:label="item.propertyName"
:prop="item.propertyCode"
:required="item.mustHave == '1'"
>
<!-- 输入框 -->
<el-input
v-if="item.inputType == 'INPUT'"
v-model="form[item.propertyCode]"
clearable
maxlength="100"
/>
<!-- 数字框 -->
<el-input-number
v-else-if="item.inputType == 'NUMBER'"
v-model="form[item.propertyCode]"
style="width: 100%"
maxlength="100"
/>
<!-- 日期 -->
<el-date-picker
v-else-if="item.inputType == 'DATE'"
v-model="form[item.propertyCode]"
type="date"
:editable="false"
value-format="yyyy-MM-dd"
style="width: 100%"
/>
<!-- 下拉选择 -->
<el-select
v-else-if="item.inputType == 'SELECT'"
v-model="form[item.propertyCode]"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="opt in parseSelectOptions(item.value)"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<div style="display: flex; padding-bottom: 10px">
@ -460,10 +517,10 @@
</div>
</el-dialog>
</el-dialog>
</template>
</template>
<script>
import {
<script>
import {
addInterDevice,
getEquipmentAddIdApi,
firstLevel,
@ -471,16 +528,17 @@ import {
fourthToSixthLevel,
getDeviceApi,
equipmentEditApiNew,
getEquipmentPropertyTypeApi
} from '@/api/EquipmentEntryApply'
import { getManufacturerSelectApi } from '@/api/EquipmentLedger/index.js'
import ImageUpload from '@/components/ImageUpload'
import FileUpload from '@/components/FileImageUpload'
import { handlePositiveNumberInput } from '@/utils/bonus.js'
import { addFacturer } from '@/api/ma/supplier'
import { deptTreeSelect } from '@/api/system/user'
getEquipmentPropertyTypeApi,
getConfigApi
} from '@/api/EquipmentEntryApply'
import { getManufacturerSelectApi } from '@/api/EquipmentLedger/index.js'
import ImageUpload from '@/components/ImageUpload'
import FileUpload from '@/components/FileImageUpload'
import { handlePositiveNumberInput } from '@/utils/bonus.js'
import { addFacturer } from '@/api/ma/supplier'
import { deptTreeSelect } from '@/api/system/user'
export default {
export default {
name: 'EquipmentEntryEditDialog', //
emits: ['update:isVisible', 'submit', 'getOrderId'], //
dicts: ['dev_unit_type'],
@ -540,26 +598,29 @@ export default {
propertyUnitList: [], //
//
equipRules: {
major: [{ required: true, message: '请选择专业', trigger: 'change' }],
/* major: [{ required: true, message: '', trigger: 'change' }],
process: [{ required: true, message: '请选择工序', trigger: 'change' }],
category: [{ required: true, message: '请选择装备类目', trigger: 'change' }],
name: [{ required: true, message: '请输入装备名称', trigger: 'blur' }],
specificationModel: [{ required: true, message: '请输入规格型号', trigger: 'blur' }],
originalValue: [{ required: true, message: '请输入资产原值', trigger: 'blur' }],
originalValue: [{ required: true, message: '请输入资产原值', trigger: 'blur' }], */
// productionDate: [{ required: true, message: '', trigger: 'change' }],
manufacturerId: [{ required: true, message: '请输入生产厂家', trigger: 'blur' }],
/* manufacturerId: [{ required: true, message: '请输入生产厂家', trigger: 'blur' }], */
// originalCode: [{ required: true, message: '', trigger: 'blur' }],
nextMaintenanceDate: [{ required: true, message: '请选择下次维保日期', trigger: 'change' }],
maxServiceLifeYears: [{ required: true, message: '请输入装备寿命', trigger: 'blur' }],
/* nextMaintenanceDate: [{ required: true, message: '', trigger: 'change' }],
maxServiceLifeYears: [{ required: true, message: '请输入装备寿命', trigger: 'blur' }], */
// manageType: [{ required: true, message: '', trigger: 'change' }],
count: [{ required: true, message: '请输入装备数量', trigger: 'blur' }],
unit: [{ required: true, message: '请输入计数单位', trigger: 'blur' }]
/* count: [{ required: true, message: '', trigger: 'blur' }],
unit: [{ required: true, message: '请输入计数单位', trigger: 'blur' }] */
// purchaseDate: [{ required: true, message: '', trigger: 'change' }],
// certificateList: [{ required: true, message: '', trigger: 'change' }],
// inspectionList: [{ required: true, message: '', trigger: 'change' }],
// mainFileList: [{ required: true, message: '', trigger: 'change' }],
},
propertyVoList: [] //
propertyVoList: [], //
isSystem:[], //
config:[], //
systemFieldMap: {}
}
},
created() {
@ -574,7 +635,151 @@ export default {
// }
},
methods: {
/* getConfig(){
getConfigApi().then(res => {
this.config = res.data.config;
this.isSystem = res.data.isSystem;
this.systemFieldMap = this.isSystem.reduce((map, item) => {
map[item.propertyCode] = item
return map
}, {})
this.config.forEach(item => {
if (this.form[item.propertyCode] == undefined) {
if (item.inputType == 'SELECT') {
this.$set(this.form, item.propertyCode, item.propertyValue || '')
} else {
this.$set(this.form, item.propertyCode, item.value || '')
}
}
if (item.mustHave == '1') {
this.rules[item.propertyCode] = [
{ required: true, message: `请输入${item.propertyName}`, trigger: 'blur' }
]
}
})
// isSystem
this.buildDynamicRules()
})
}, */
resetDynamicFields() {
if (!this.config || this.config.length === 0) return
this.config.forEach(item => {
if (!item.propertyCode) return
//
switch (item.inputType) {
case 'INPUT':
case 'SELECT':
case 'DATE':
this.$set(this.form, item.propertyCode, '')
break
case 'NUMBER':
this.$set(this.form, item.propertyCode, null)
break
default:
this.$set(this.form, item.propertyCode, '')
}
})
},
//
getConfig() {
getConfigApi().then(res => {
this.config = res.data.config || []
this.isSystem = res.data.isSystem || []
//
this.systemFieldMap = this.isSystem.reduce((map, item) => {
map[item.propertyCode] = item
return map
}, {})
// form & rules
this.config.forEach(item => {
if (!item.propertyCode) return //
// form
if (this.form[item.propertyCode] === undefined) {
if (item.inputType === 'SELECT') {
this.$set(this.form, item.propertyCode, item.propertyValue || '')
} else {
this.$set(this.form, item.propertyCode, item.value || '')
}
}
//
if (item.mustHave == '1') {
const trigger = ['SELECT', 'DATE', 'IMAGE', 'FILE'].includes(item.inputType) ? 'change' : 'blur'
this.$set(this.equipRules, item.propertyCode, [
{ required: true, message: `请输入${item.propertyName}`, trigger }
])
}
})
// isSystem
this.isSystem.forEach(item => {
if (!item.propertyCode) return
if (item.mustHave == '1') {
const trigger = ['SELECT', 'DATE', 'IMAGE', 'FILE'].includes(item.inputType) ? 'change' : 'blur'
//
if (!this.equipRules[item.propertyCode]) {
this.$set(this.equipRules, item.propertyCode, [
{ required: true, message: `请填写${item.propertyName}`, trigger }
])
}
}
})
})
},
parseSelectOptions(value) {
if (!value) return []
// 1
const normalized = value.replace(//g, ',')
// 2
return normalized
.split(',')
.map(v => v.trim())
.filter(v => v)
.map(v => ({
label: v,
value: v
}))
},
buildDynamicRules() {
const rules = {}
this.isSystem.forEach(item => {
if (item.mustHave == '1') {
let trigger = 'blur'
// 使
if (['SELECT', 'DATE', 'IMAGE', 'FILE'].includes(item.inputType)) {
trigger = 'change'
}
rules[item.propertyCode] = [
{
required: true,
message: `请填写${item.propertyName}`,
trigger
}
]
}
})
this.equipRules = rules
},
async openDialog(id, type) {
this.resetDynamicFields()
this.getConfig()
await this.getDeptTreeSelect()
if (type === 'edit') {
this.pageTitle = '编辑装备'
@ -594,10 +799,24 @@ export default {
async getInfo() {
try {
const res = await getDeviceApi(this.maId)
console.log('🚀 ~ getInfo ~ res:', res)
Object.assign(this.form, res.data)
if (res.data) {
let row = res.data
if(row.fieldVoList){
this.config = row.fieldVoList
// fieldVoList form
this.config.forEach(item => {
if (!item.propertyCode) return; //
if (item.inputType == 'SELECT' && item.value) {
//
this.$set(this.form, item.propertyCode, item.propertyValue ? item.propertyValue.split(',') : []);
} else {
this.$set(this.form, item.propertyCode, item.propertyValue ?? '');
}
});
}
const propertyList = row.propertyVoList || []
const property = propertyList
// item propertyValue
@ -813,6 +1032,20 @@ export default {
this.isSubmit = true
const loading = this.$loading()
try {
var fieldVoList = [];
//
if (this.config && this.config.length > 0) {
this.config.forEach(item => {
fieldVoList.push({
...item,
propertyValue: this.form[item.propertyCode] ?? null //
})
})
}
if (!this.form.orderId && !this.isEdit) {
const result = await getEquipmentAddIdApi()
this.orderId = result.data.id
@ -904,7 +1137,8 @@ export default {
certificates,
inspectionReports,
purchaseInvoices,
propertyVoList: this.propertyVoList
propertyVoList: this.propertyVoList,
fieldVoList:fieldVoList
}
if (this.maId) {
params.maId = this.maId
@ -994,15 +1228,15 @@ export default {
})
}
}
}
</script>
}
</script>
<style lang="scss" scoped>
.dialog-content {
<style lang="scss" scoped>
.dialog-content {
padding: 20px;
}
}
.page-header {
.page-header {
display: flex;
align-items: center;
margin-bottom: 20px;
@ -1017,29 +1251,29 @@ export default {
margin-left: 15px;
color: #303133;
}
}
}
.dialog-content {
.dialog-content {
padding: 10px 0;
min-height: 200px; //
}
}
.goBack-btn:hover {
.goBack-btn:hover {
cursor: pointer;
color: #33b5a0;
}
}
.dialog-footer {
.dialog-footer {
display: flex;
justify-content: flex-end;
gap: 10px; //
}
}
::v-deep .el-input-number.is-without-controls .el-input__inner {
::v-deep .el-input-number.is-without-controls .el-input__inner {
text-align: left;
}
}
.select-box {
.select-box {
width: 100%;
height: 260px;
border: 1px solid #dcdcdc;
@ -1062,28 +1296,28 @@ export default {
text-align: center;
color: #c0c4cc;
}
}
}
/* 紧凑表单行距 */
::v-deep .el-form-item {
/* 紧凑表单行距 */
::v-deep .el-form-item {
margin-bottom: 16px;
}
}
::v-deep.el-tag.el-tag--info {
::v-deep.el-tag.el-tag--info {
background-color: #F5F5F5;
border-color: #B3B3B3;
color: #B3B3B3;
}
}
::v-deep.el-tag.el-tag--warn {
::v-deep.el-tag.el-tag--warn {
background-color: rgba(255, 171, 41, 0.1);;
border: #FFAB29;
color: #FFAB29;
}
}
::v-deep.el-tag.el-tag--success {
::v-deep.el-tag.el-tag--success {
background-color: rgba(52, 226, 199, 0.1);
border-color: #34E2C7;
color: #34E2C7;
}
</style>
}
</style>

View File

@ -346,6 +346,64 @@
</template>
</el-table-column>
<!-- 动态生成 fieldVoList -->
<el-table-column
v-for="(item, index) in fieldVoList"
:key="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"
autocomplete="off"
maxlength="30"
v-model="row.fieldVoList[(index + 1) / 2 - 1].propertyValue"
clearable
/>
<el-select
v-if="row.fieldVoList[(index + 1) / 2 - 1].inputType == 2"
v-model="row.fieldVoList[(index + 1) / 2 - 1].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"
/>
</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>-->
</el-table-column>
<el-table-column
v-for="(item, index) in columns"
v-if="item.visible"
@ -627,6 +685,9 @@
<script>
import EquipmentEntryEditDialog from '@/views/EquipmentEntryApply/equipmentInput/edit.vue'
import AddEquip from './AddEquip'
import {
getConfigApi
} from '@/api/EquipmentEntryApply'
// 使defineComponent
import {
@ -760,6 +821,8 @@ export default {
{ key: 42, label: `特征项9`, prop: 'featureItem9', visible: true },
{ key: 43, label: `特征值9`, prop: 'featureValue9', visible: true }
],
fieldVoList:[],
dialogVisible: false,
dialogTitle: '',
dialogList: [],
@ -776,6 +839,7 @@ export default {
watch: {
isVisible(val) {
if (val) {
this.getConfig()
this.getList()
}
}
@ -783,6 +847,7 @@ export default {
mounted() {
this.getManufacturerSelectList()
this.getConfig()
},
methods: {
handleNumberInput(key) {
@ -985,6 +1050,14 @@ export default {
}
})
},
getConfig() {
getConfigApi().then(res => {
this.fieldVoList = res.data.config || []
})
},
//
async getList() {
try {
@ -1003,6 +1076,8 @@ export default {
const res = await getDeviceByOrderIdApi(params)
this.tableData = res.data.rows
this.total = res.data.total
} catch (error) {
console.error('获取列表失败:', error)
}