新增特征值优化
This commit is contained in:
parent
f3c05aa89d
commit
fc9202ea14
|
|
@ -258,4 +258,10 @@ export const getDeviceApi = (id) => {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
// 获取特征值
|
||||
export const getEquipmentPropertyTypeApi = (typeId) => {
|
||||
return request({
|
||||
url: `/material-mall/equipment/property/type/${typeId}`,
|
||||
method: 'GET',
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
placeholder="请选择专业"
|
||||
@change="majorChange"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
>
|
||||
<el-option v-for="item in majorList" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
|
|
@ -48,7 +47,6 @@
|
|||
<el-form-item label="工序" prop="process">
|
||||
<el-cascader
|
||||
style="width: 100%"
|
||||
clearable
|
||||
v-model="form.process"
|
||||
placeholder="请选择工序"
|
||||
:options="processList"
|
||||
|
|
@ -60,7 +58,6 @@
|
|||
<el-form-item label="装备类目" prop="category">
|
||||
<el-cascader
|
||||
style="width: 100%"
|
||||
clearable
|
||||
v-model="form.category"
|
||||
:options="categoryList"
|
||||
placeholder="请选择装备类目"
|
||||
|
|
@ -215,7 +212,35 @@
|
|||
特征属性
|
||||
</div>
|
||||
<el-row :gutter="24" style="padding-top: 10px">
|
||||
<el-col :span="6">
|
||||
<!-- propertyVoList -->
|
||||
<el-col :span="6" v-for="(item, index) in propertyVoList" :key="index">
|
||||
<el-form-item v-if="item.inputType == 1" :label="item.propertyName">
|
||||
<el-input autocomplete="off" maxlength="30" v-model="item.propertyValue" clearable />
|
||||
</el-form-item>
|
||||
<!-- 单选 -->
|
||||
<el-form-item v-if="item.inputType == 2" :label="item.propertyName">
|
||||
<el-select v-model="item.propertyValue" placeholder="请选择" clearable style="width: 100%">
|
||||
<el-option
|
||||
v-for="(item, index) in handleData(item.value)"
|
||||
:key="index"
|
||||
:label="item.value"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- 多选 -->
|
||||
<el-form-item v-if="item.inputType == 3" :label="item.propertyName">
|
||||
<el-select v-model="item.propertyValue" multiple placeholder="请选择" clearable style="width: 100%">
|
||||
<el-option
|
||||
v-for="(item, index) in handleData(item.value)"
|
||||
:key="index"
|
||||
:label="item.value"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="6">
|
||||
<el-form-item label="专业特征" prop="specialtyFeature">
|
||||
<el-input autocomplete="off" maxlength="30" v-model="form.specialtyFeature" clearable />
|
||||
</el-form-item>
|
||||
|
|
@ -229,7 +254,7 @@
|
|||
<el-form-item label="类目特征" prop="categoryFeature">
|
||||
<el-input autocomplete="off" maxlength="30" v-model="form.categoryFeature" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
|
||||
<div style="display: flex; padding-bottom: 10px">
|
||||
|
|
@ -302,6 +327,7 @@ import {
|
|||
fourthToSixthLevel,
|
||||
getDeviceApi,
|
||||
equipmentEditApiNew,
|
||||
getEquipmentPropertyTypeApi,
|
||||
} from '@/api/EquipmentEntryApply'
|
||||
import { getManufacturerSelectApi } from '@/api/EquipmentLedger/index.js'
|
||||
import ImageUpload from '@/components/ImageUpload'
|
||||
|
|
@ -362,6 +388,7 @@ export default {
|
|||
unit: [{ required: true, message: '请输入计数单位', trigger: 'blur' }],
|
||||
purchaseDate: [{ required: true, message: '请选择采购日期', trigger: 'change' }],
|
||||
},
|
||||
propertyVoList: [], // 特征属性集合
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
|
@ -400,6 +427,16 @@ export default {
|
|||
String(res.data.subCategoryId),
|
||||
String(res.data.branchId),
|
||||
].filter(Boolean)
|
||||
|
||||
this.propertyVoList = res.data.propertyVoList || []
|
||||
console.log('🚀 ~ getInfo ~ this.propertyVoList:', this.propertyVoList)
|
||||
if (this.propertyVoList.length > 0) {
|
||||
this.propertyVoList.forEach((item) => {
|
||||
if (item.inputType == 3) {
|
||||
item.propertyValue = item.propertyValue.split(',')
|
||||
}
|
||||
})
|
||||
}
|
||||
const res2 = await secondAndThirdLevel({ firstLevelId: this.form.majorId })
|
||||
this.processList = this.convertToSubTree(res2.data)
|
||||
const res3 = await fourthToSixthLevel({ thirdLevelId: this.form.subProcessId })
|
||||
|
|
@ -452,7 +489,11 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
categoryChange(item) {},
|
||||
categoryChange(item) {
|
||||
console.log('🚀 ~ processChange ~ item:', item)
|
||||
this.propertyVoList = []
|
||||
this.getPropertyVoList(item[item.length - 1])
|
||||
},
|
||||
// 返回上一页
|
||||
goBack() {
|
||||
this.$router.go(-1)
|
||||
|
|
@ -491,7 +532,7 @@ export default {
|
|||
* 处理表单提交
|
||||
*/
|
||||
async handleSubmit() {
|
||||
console.log('🚀 ~ handleSubmit ~ this.form:', this.form)
|
||||
console.log('🚀 ~ handleSubmit ~ this.form:', this.form, this.propertyVoList)
|
||||
this.$refs['formRef'].validate(async (valid) => {
|
||||
if (valid) {
|
||||
if (this.isSubmit) return
|
||||
|
|
@ -564,9 +605,32 @@ export default {
|
|||
})
|
||||
console.log('🚀 ~ handleSubmit ~ purchaseInvoices:', purchaseInvoices)
|
||||
}
|
||||
// 判断特征项是否填写 propertyVoList 每个propertyValue 都要有值
|
||||
if (this.propertyVoList && this.propertyVoList.length > 0) {
|
||||
const unfilledIndex = this.propertyVoList.findIndex(
|
||||
(item) => !item.propertyValue || item.propertyValue === '',
|
||||
)
|
||||
if (unfilledIndex !== -1) {
|
||||
this.$message.warning(`请填写第 ${unfilledIndex + 1} 个特征项`)
|
||||
return
|
||||
}
|
||||
}
|
||||
this.propertyVoList.forEach((item) => {
|
||||
console.log('item.item.propertyValue', item.propertyValue)
|
||||
if (item.inputType == 3 && Array.isArray(item.propertyValue)) {
|
||||
item.propertyValue = item.propertyValue.join(',')
|
||||
}
|
||||
})
|
||||
|
||||
let res = null
|
||||
const params = { ...this.form, appearanceImages, certificates, inspectionReports, purchaseInvoices }
|
||||
const params = {
|
||||
...this.form,
|
||||
appearanceImages,
|
||||
certificates,
|
||||
inspectionReports,
|
||||
purchaseInvoices,
|
||||
propertyVoList: this.propertyVoList,
|
||||
}
|
||||
if (this.query && this.query.maId) {
|
||||
params.maId = this.query.maId
|
||||
res = await equipmentEditApiNew(params)
|
||||
|
|
@ -625,6 +689,27 @@ export default {
|
|||
|
||||
return tree
|
||||
},
|
||||
// 获取特征值
|
||||
async getPropertyVoList(typeId) {
|
||||
try {
|
||||
const res = await getEquipmentPropertyTypeApi(typeId)
|
||||
console.log('特征值-->:', res)
|
||||
this.propertyVoList = res.data || []
|
||||
} catch (error) {
|
||||
console.log('获取特征值失败:', error)
|
||||
}
|
||||
},
|
||||
// 处理数据
|
||||
handleData(data) {
|
||||
console.log('处理数据:', data)
|
||||
if (!data) return []
|
||||
return data.split(',').map((item) => {
|
||||
return {
|
||||
label: item,
|
||||
value: item,
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -62,21 +62,21 @@
|
|||
</el-table-column>
|
||||
<el-table-column align="center" show-overflow-tooltip prop="createTime" label="操作时间"/>
|
||||
<el-table-column align="center" show-overflow-tooltip prop="changeStatus" label="流转前状态">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.changeStatus == 1" size="mini">在库</el-tag>
|
||||
<el-tag v-if="scope.row.changeStatus == 2 || scope.row.changeStatus == 3" size="mini">
|
||||
在用
|
||||
</el-tag>
|
||||
<el-tag v-if="scope.row.changeStatus == 5" size="mini"> 维修</el-tag>
|
||||
<template slot-scope="{ row }">
|
||||
<el-tag v-if="row.changeStatus == 1" size="mini">在库</el-tag>
|
||||
<el-tag v-if="row.changeStatus == 2" size="mini">自用</el-tag>
|
||||
<el-tag v-if="row.changeStatus == 3" size="mini">共享</el-tag>
|
||||
<el-tag v-if="row.changeStatus == 4" size="mini" type="info">退役</el-tag>
|
||||
<el-tag v-if="row.changeStatus == 5" size="mini" type="danger">维修</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" show-overflow-tooltip prop="changeStatus" label="流转后状态">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.status == 1" size="mini">在库</el-tag>
|
||||
<el-tag v-if="scope.row.status == 2 || scope.row.status == 3" size="mini">
|
||||
在用
|
||||
</el-tag>
|
||||
<el-tag v-if="scope.row.status == 5" size="mini"> 维修</el-tag>
|
||||
<el-table-column align="center" show-overflow-tooltip prop="status" label="流转后状态">
|
||||
<template slot-scope="{ row }">
|
||||
<el-tag v-if="row.status == 1" size="mini">在库</el-tag>
|
||||
<el-tag v-if="row.status == 2" size="mini">自用</el-tag>
|
||||
<el-tag v-if="row.status == 3" size="mini">共享</el-tag>
|
||||
<el-tag v-if="row.status == 4" size="mini" type="info">退役</el-tag>
|
||||
<el-tag v-if="row.status == 5" size="mini" type="danger">维修</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" show-overflow-tooltip prop="useUint" label="使用单位"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue