Merge branch 'anhui-mall-ui-test' of http://192.168.30.2:3000/bonus/bonus-ui into anhui-mall-ui-test

This commit is contained in:
zzyuan 2026-01-23 10:40:13 +08:00
commit fae5b91b46
5 changed files with 1353 additions and 1025 deletions

View File

@ -360,3 +360,11 @@ export const getDevDetailsApi = (data) => {
params: 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-input v-model="form.propertyUnit" placeholder="产权单位" readonly/>
</el-form-item> </el-form-item>
</el-col> </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> </el-row>
<div style="display: flex; padding-bottom: 10px"> <div style="display: flex; padding-bottom: 10px">
@ -303,7 +311,7 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="装备二维码" prop=""> <el-form-item label="装备二维码111" prop="">
<div class="qrcode-box" style="width: 150px;height: 150px"> <div class="qrcode-box" style="width: 150px;height: 150px">
<QrcodeGenerator <QrcodeGenerator
ref="qr3" ref="qr3"

View File

@ -428,6 +428,9 @@ export default {
.map-box { .map-box {
width: 100%; width: 100%;
height: 440px; height: 440px;
display: flex;
align-items: center;
justify-content: center;
} }
.echarts { .echarts {
width: 100%; width: 100%;

View File

@ -1,4 +1,4 @@
<template> <template>
<!-- 弹窗内容区域 --> <!-- 弹窗内容区域 -->
<el-dialog <el-dialog
:title="pageTitle" :title="pageTitle"
@ -244,6 +244,63 @@
/> />
</el-form-item> </el-form-item>
</el-col> </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> </el-row>
<div style="display: flex; padding-bottom: 10px"> <div style="display: flex; padding-bottom: 10px">
@ -460,10 +517,10 @@
</div> </div>
</el-dialog> </el-dialog>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { import {
addInterDevice, addInterDevice,
getEquipmentAddIdApi, getEquipmentAddIdApi,
firstLevel, firstLevel,
@ -471,16 +528,17 @@ import {
fourthToSixthLevel, fourthToSixthLevel,
getDeviceApi, getDeviceApi,
equipmentEditApiNew, equipmentEditApiNew,
getEquipmentPropertyTypeApi getEquipmentPropertyTypeApi,
} from '@/api/EquipmentEntryApply' getConfigApi
import { getManufacturerSelectApi } from '@/api/EquipmentLedger/index.js' } from '@/api/EquipmentEntryApply'
import ImageUpload from '@/components/ImageUpload' import { getManufacturerSelectApi } from '@/api/EquipmentLedger/index.js'
import FileUpload from '@/components/FileImageUpload' import ImageUpload from '@/components/ImageUpload'
import { handlePositiveNumberInput } from '@/utils/bonus.js' import FileUpload from '@/components/FileImageUpload'
import { addFacturer } from '@/api/ma/supplier' import { handlePositiveNumberInput } from '@/utils/bonus.js'
import { deptTreeSelect } from '@/api/system/user' import { addFacturer } from '@/api/ma/supplier'
import { deptTreeSelect } from '@/api/system/user'
export default { export default {
name: 'EquipmentEntryEditDialog', // name: 'EquipmentEntryEditDialog', //
emits: ['update:isVisible', 'submit', 'getOrderId'], // emits: ['update:isVisible', 'submit', 'getOrderId'], //
dicts: ['dev_unit_type'], dicts: ['dev_unit_type'],
@ -540,26 +598,29 @@ export default {
propertyUnitList: [], // propertyUnitList: [], //
// //
equipRules: { equipRules: {
major: [{ required: true, message: '请选择专业', trigger: 'change' }], /* major: [{ required: true, message: '', trigger: 'change' }],
process: [{ required: true, message: '请选择工序', trigger: 'change' }], process: [{ required: true, message: '请选择工序', trigger: 'change' }],
category: [{ required: true, message: '请选择装备类目', trigger: 'change' }], category: [{ required: true, message: '请选择装备类目', trigger: 'change' }],
name: [{ required: true, message: '请输入装备名称', trigger: 'blur' }], name: [{ required: true, message: '请输入装备名称', trigger: 'blur' }],
specificationModel: [{ 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' }], // productionDate: [{ required: true, message: '', trigger: 'change' }],
manufacturerId: [{ required: true, message: '请输入生产厂家', trigger: 'blur' }], /* manufacturerId: [{ required: true, message: '请输入生产厂家', trigger: 'blur' }], */
// originalCode: [{ required: true, message: '', trigger: 'blur' }], // originalCode: [{ required: true, message: '', trigger: 'blur' }],
nextMaintenanceDate: [{ required: true, message: '请选择下次维保日期', trigger: 'change' }], /* nextMaintenanceDate: [{ required: true, message: '', trigger: 'change' }],
maxServiceLifeYears: [{ required: true, message: '请输入装备寿命', trigger: 'blur' }], maxServiceLifeYears: [{ required: true, message: '请输入装备寿命', trigger: 'blur' }], */
// manageType: [{ required: true, message: '', trigger: 'change' }], // manageType: [{ required: true, message: '', trigger: 'change' }],
count: [{ required: true, message: '请输入装备数量', trigger: 'blur' }], /* count: [{ required: true, message: '', trigger: 'blur' }],
unit: [{ required: true, message: '请输入计数单位', trigger: 'blur' }] unit: [{ required: true, message: '请输入计数单位', trigger: 'blur' }] */
// purchaseDate: [{ required: true, message: '', trigger: 'change' }], // purchaseDate: [{ required: true, message: '', trigger: 'change' }],
// certificateList: [{ required: true, message: '', trigger: 'change' }], // certificateList: [{ required: true, message: '', trigger: 'change' }],
// inspectionList: [{ required: true, message: '', trigger: 'change' }], // inspectionList: [{ required: true, message: '', trigger: 'change' }],
// mainFileList: [{ required: true, message: '', trigger: 'change' }], // mainFileList: [{ required: true, message: '', trigger: 'change' }],
}, },
propertyVoList: [] // propertyVoList: [], //
isSystem:[], //
config:[], //
systemFieldMap: {}
} }
}, },
created() { created() {
@ -574,7 +635,151 @@ export default {
// } // }
}, },
methods: { 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) { async openDialog(id, type) {
this.resetDynamicFields()
this.getConfig()
await this.getDeptTreeSelect() await this.getDeptTreeSelect()
if (type === 'edit') { if (type === 'edit') {
this.pageTitle = '编辑装备' this.pageTitle = '编辑装备'
@ -594,10 +799,24 @@ export default {
async getInfo() { async getInfo() {
try { try {
const res = await getDeviceApi(this.maId) const res = await getDeviceApi(this.maId)
console.log('🚀 ~ getInfo ~ res:', res)
Object.assign(this.form, res.data) Object.assign(this.form, res.data)
if (res.data) { if (res.data) {
let row = 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 propertyList = row.propertyVoList || []
const property = propertyList const property = propertyList
// item propertyValue // item propertyValue
@ -813,6 +1032,20 @@ export default {
this.isSubmit = true this.isSubmit = true
const loading = this.$loading() const loading = this.$loading()
try { 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) { if (!this.form.orderId && !this.isEdit) {
const result = await getEquipmentAddIdApi() const result = await getEquipmentAddIdApi()
this.orderId = result.data.id this.orderId = result.data.id
@ -904,7 +1137,8 @@ export default {
certificates, certificates,
inspectionReports, inspectionReports,
purchaseInvoices, purchaseInvoices,
propertyVoList: this.propertyVoList propertyVoList: this.propertyVoList,
fieldVoList:fieldVoList
} }
if (this.maId) { if (this.maId) {
params.maId = this.maId params.maId = this.maId
@ -994,15 +1228,15 @@ export default {
}) })
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dialog-content { .dialog-content {
padding: 20px; padding: 20px;
} }
.page-header { .page-header {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 20px; margin-bottom: 20px;
@ -1017,29 +1251,29 @@ export default {
margin-left: 15px; margin-left: 15px;
color: #303133; color: #303133;
} }
} }
.dialog-content { .dialog-content {
padding: 10px 0; padding: 10px 0;
min-height: 200px; // min-height: 200px; //
} }
.goBack-btn:hover { .goBack-btn:hover {
cursor: pointer; cursor: pointer;
color: #33b5a0; color: #33b5a0;
} }
.dialog-footer { .dialog-footer {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
gap: 10px; // 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; text-align: left;
} }
.select-box { .select-box {
width: 100%; width: 100%;
height: 260px; height: 260px;
border: 1px solid #dcdcdc; border: 1px solid #dcdcdc;
@ -1062,28 +1296,28 @@ export default {
text-align: center; text-align: center;
color: #c0c4cc; color: #c0c4cc;
} }
} }
/* 紧凑表单行距 */ /* 紧凑表单行距 */
::v-deep .el-form-item { ::v-deep .el-form-item {
margin-bottom: 16px; margin-bottom: 16px;
} }
::v-deep.el-tag.el-tag--info { ::v-deep.el-tag.el-tag--info {
background-color: #F5F5F5; background-color: #F5F5F5;
border-color: #B3B3B3; border-color: #B3B3B3;
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);; background-color: rgba(255, 171, 41, 0.1);;
border: #FFAB29; border: #FFAB29;
color: #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); background-color: rgba(52, 226, 199, 0.1);
border-color: #34E2C7; border-color: #34E2C7;
color: #34E2C7; color: #34E2C7;
} }
</style> </style>

View File

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