Skip to content

Commit

Permalink
fix: 自定义字段代码优化 #107
Browse files Browse the repository at this point in the history
  • Loading branch information
v_yutyi authored and EmilyMei committed Jan 14, 2022
1 parent 2d44c51 commit 79e0c03
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/pages/src/components/catalog/operation/addCustomField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
},
watch: {
addFieldList(val) {
this.$emit('upSetFieldList', val);
this.$emit('upAddFieldList', val);
},
},
methods: {
Expand All @@ -47,7 +47,7 @@ export default {
},
handleClickDel(item, index) {
if (index === 0) {
this.setFieldList.push({ key: '', value: '' });
this.addFieldList.push({ key: '', value: '' });
}
this.addFieldList.splice(index, 1);
this.customField.forEach((element) => {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/src/components/catalog/operation/setCustomField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ export default {
this.setFieldList.push({ key: '', value: '' });
},
handleClickDel(item, index) {
if (index === 0) {
this.setFieldList.push({ key: '', value: '' });
if (index === 0 && this.setFieldList.length === 1) {
this.handleClickAdd();
}
this.setFieldList.splice(index, 1);
this.customField.forEach((element) => {
Expand Down
6 changes: 1 addition & 5 deletions src/pages/src/views/catalog/operation/RemoteAdd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,7 @@ export default {
async handlePush(data) {
try {
this.isLoading = true;
const list = [];
data.forEach((element) => {
list.push(element);
this.fieldsInfo.extend.dynamic_fields_mapping = list;
});
this.fieldsInfo.extend.dynamic_fields_mapping = data;
await this.$store.dispatch('catalog/ajaxPostFields', {
id: this.catalogId,
data: this.$convertObjectToArray(this.fieldsInfo),
Expand Down
3 changes: 1 addition & 2 deletions src/pages/src/views/catalog/operation/RemoteSet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ export default {
try {
this.isLoading = true;
this.handleSaveSuccess();
const list = [...data];
this.fieldsInfo.extend.dynamic_fields_mapping = list;
this.fieldsInfo.extend.dynamic_fields_mapping = data;
const action = this.fieldsHasCreated ? 'catalog/ajaxPutFields' : 'catalog/ajaxPostFields';
await this.$store.dispatch(action, {
id: this.catalogInfo.id,
Expand Down
4 changes: 1 addition & 3 deletions src/pages/src/views/organization/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1290,9 +1290,7 @@ export default {
next.style.left = `${calculateDistance.getOffsetLeft + 20}px`;
next.style.top = `${calculateDistance.getOffsetTop + 30}px`;
const bottomHeight = window.innerHeight - (next.offsetTop - window.pageYOffset) - next.offsetHeight;
if ((bottomHeight < 0) && (next.offsetHeight === 146)) {
next.style.top = `${calculateDistance.getOffsetTop - next.offsetHeight - 8}px`;
} else if ((bottomHeight < 0) && (next.offsetHeight === 254)) {
if ((bottomHeight < 0) && (next.offsetHeight === next.offsetHeight)) {
next.style.top = `${calculateDistance.getOffsetTop - next.offsetHeight - 8}px`;
}
});
Expand Down

0 comments on commit 79e0c03

Please sign in to comment.