diff --git a/src/components/base-dialog/AttrForm/index.vue b/src/components/base-dialog/AttrForm/index.vue
index ab4ef86..9d0bdce 100644
--- a/src/components/base-dialog/AttrForm/index.vue
+++ b/src/components/base-dialog/AttrForm/index.vue
@@ -66,8 +66,14 @@ export default {
default: () => []
},
/** 表单提交需要的属性 */
- pId: {
+ relatedId: {
type: String,
+ required: true,
+ default: null
+ },
+ relatedField: {
+ type: String,
+ required: true,
default: null
}
},
@@ -96,12 +102,12 @@ export default {
},
mounted() {
this.getDataList()
- /** 设置 AttrForm 的 rules */
- for(const config of this.tableConfigs) {
- if (config.rules) {
- this.$set(this.AttrFormRules, [config.prop], config.rules)
- }
- }
+ /** 设置 AttrForm 的 rules */
+ for (const config of this.tableConfigs) {
+ if (config.rules) {
+ this.$set(this.AttrFormRules, [config.prop], config.rules)
+ }
+ }
},
methods: {
/** init dataform */
@@ -127,7 +133,7 @@ export default {
params: this.$http.adornParams({
page: this.pageIndex,
limit: this.pageSize,
- productId: this.pId
+ [this.relatedField]: this.relatedId
// order: 'asc/desc',
// orderField: 'name'
})
@@ -210,7 +216,7 @@ export default {
headers: {
'Content-Type': 'application/json'
},
- data: JSON.stringify({ ...this.AttrForm, productId: this.pId })
+ data: JSON.stringify({ ...this.AttrForm, [this.relatedField]: this.relatedId })
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue
index 2411e11..36dcd98 100644
--- a/src/components/base-dialog/addOrUpdate/index.vue
+++ b/src/components/base-dialog/addOrUpdate/index.vue
@@ -66,7 +66,7 @@
-
+