-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -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,
+ }
+ })
+ },
},
}
diff --git a/src/views/EquipmentRoamRecord/index.vue b/src/views/EquipmentRoamRecord/index.vue
index b645fb34..74f1da35 100644
--- a/src/views/EquipmentRoamRecord/index.vue
+++ b/src/views/EquipmentRoamRecord/index.vue
@@ -62,21 +62,21 @@
-
- 在库
-
- 在用
-
- 维修
+
+ 在库
+ 自用
+ 共享
+ 退役
+ 维修
-
-
- 在库
-
- 在用
-
- 维修
+
+
+ 在库
+ 自用
+ 共享
+ 退役
+ 维修