|
|
@@ -927,29 +927,30 @@ export default {
|
|
|
},
|
|
|
// 选择属性值
|
|
|
selectValue(propertyId, recordId) {
|
|
|
- // 如果当前选中值和之前选中的相同,直接切换选中状态
|
|
|
if (this.selectedValues[propertyId] === recordId) {
|
|
|
this.selectedValues[propertyId] = null;
|
|
|
} else {
|
|
|
this.$set(this.selectedValues, propertyId, recordId);
|
|
|
}
|
|
|
- // 生成 JSON 格式的数据
|
|
|
- const selectionJson = Object.entries(this.selectedValues).map(
|
|
|
- ([propertyId, recordId]) => {
|
|
|
- const property = this.PropertyList.find(
|
|
|
- (p) => p.propertyId === propertyId
|
|
|
- );
|
|
|
- const value = this.PropertyValueList.find(
|
|
|
- (v) => v.recordId === recordId
|
|
|
- );
|
|
|
- return {
|
|
|
- propertyId,
|
|
|
- recordId,
|
|
|
- valueName: value ? value.valueName : "",
|
|
|
- propertyName: property ? property.propertyName : "",
|
|
|
- };
|
|
|
- }
|
|
|
- );
|
|
|
+
|
|
|
+ const selectionJson = Object.entries(this.selectedValues)
|
|
|
+ .map(([propertyId, recordId]) => {
|
|
|
+ if (!recordId) return null;
|
|
|
+ const property = this.PropertyList.find(p => p.propertyId === propertyId);
|
|
|
+ const value = this.PropertyValueList.find(v => v.recordId === recordId);
|
|
|
+
|
|
|
+ if (property && value) {
|
|
|
+ return {
|
|
|
+ propertyId,
|
|
|
+ recordId,
|
|
|
+ valueName: value.valueName,
|
|
|
+ propertyName: property.propertyName,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ })
|
|
|
+ .filter(Boolean);
|
|
|
+
|
|
|
this.form.properties = JSON.stringify(selectionJson);
|
|
|
console.log(selectionJson, "生成的属性值json");
|
|
|
},
|
|
|
@@ -1097,6 +1098,7 @@ export default {
|
|
|
this.form.expirationDate = this.formatDateExpirationDate(
|
|
|
this.form.expirationDate
|
|
|
);
|
|
|
+ console.log(this.form,'修改传递的参数');
|
|
|
updateMaterials(this.form).then((response) => {
|
|
|
console.log(response, "修改返回");
|
|
|
this.$modal.msgSuccess("修改成功");
|