|
|
|
@ -63,9 +63,9 @@
|
|
|
|
<Option
|
|
|
|
<Option
|
|
|
|
v-for="item in getColumnParams(select.filter[0].key)"
|
|
|
|
v-for="item in getColumnParams(select.filter[0].key)"
|
|
|
|
:key="item.id"
|
|
|
|
:key="item.id"
|
|
|
|
:value="item.id"
|
|
|
|
:value="getColumnField(select.filter[0].key)._relations ? item[getColumnField(select.filter[0].key)._relations.foreign_key] : item.value"
|
|
|
|
>{{
|
|
|
|
>{{
|
|
|
|
item.value || item.name || item.no || item.id
|
|
|
|
item.key || item.value || item.name || item.no || item.id
|
|
|
|
}}</Option
|
|
|
|
}}</Option
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</Select>
|
|
|
|
</Select>
|
|
|
|
@ -160,9 +160,9 @@
|
|
|
|
<Option
|
|
|
|
<Option
|
|
|
|
v-for="item in getColumnParams(item.key)"
|
|
|
|
v-for="item in getColumnParams(item.key)"
|
|
|
|
:key="item.id"
|
|
|
|
:key="item.id"
|
|
|
|
:value="item.id"
|
|
|
|
:value="getColumnField(item.key)._relations ? item[getColumnField(item.key)._relations.foreign_key] : item.value"
|
|
|
|
>{{
|
|
|
|
>{{
|
|
|
|
item.value || item.name || item.no || item.id
|
|
|
|
item.key || item.value || item.name || item.no || item.id
|
|
|
|
}}</Option
|
|
|
|
}}</Option
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</Select>
|
|
|
|
</Select>
|
|
|
|
@ -414,26 +414,28 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fields.forEach((i, index) => {
|
|
|
|
fields.forEach((i, index) => {
|
|
|
|
i._relations = relation.find((j) => j.local_key === i.field);
|
|
|
|
i._relations = relation.find((j) => j.local_key === i.field);
|
|
|
|
i._params = {
|
|
|
|
if (i.select_item && typeof i.select_item === 'object') {
|
|
|
|
value: [],
|
|
|
|
let keys = Object.keys(i.select_item)
|
|
|
|
load: false,
|
|
|
|
i._params = keys.map(key => {
|
|
|
|
get: () => i._params.value,
|
|
|
|
return {
|
|
|
|
set: () => {
|
|
|
|
key,
|
|
|
|
if(i._params.load) return
|
|
|
|
value: i.select_item[key]
|
|
|
|
i._relations.parameter_id
|
|
|
|
}
|
|
|
|
? getparameter({ id: i._relations.parameter_id },false).then((res) => {
|
|
|
|
})
|
|
|
|
i._params.value = res.detail;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if (i._relations) {
|
|
|
|
: this.index({
|
|
|
|
i._params = i._relations.parameter_id
|
|
|
|
table_name: i._relations.link_table_name,
|
|
|
|
? getparameter({ id: i._relations.parameter_id },false).then((res) => {
|
|
|
|
page: 1,
|
|
|
|
i._params = res.detail;
|
|
|
|
page_size: 9999,
|
|
|
|
})
|
|
|
|
}).then((res) => {
|
|
|
|
: this.index({
|
|
|
|
i._params.value = res.data;
|
|
|
|
table_name: i._relations.link_table_name,
|
|
|
|
});
|
|
|
|
page: 1,
|
|
|
|
i._params.load = true
|
|
|
|
page_size: 9999,
|
|
|
|
},
|
|
|
|
}).then((res) => {
|
|
|
|
};
|
|
|
|
i._params = res.data;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.form = fields;
|
|
|
|
this.form = fields;
|
|
|
|
console.log(111, this.form);
|
|
|
|
console.log(111, this.form);
|
|
|
|
@ -469,6 +471,21 @@ export default {
|
|
|
|
.map((i) => {
|
|
|
|
.map((i) => {
|
|
|
|
let linkOb = {};
|
|
|
|
let linkOb = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (i.select_item && typeof i.select_item === 'object') {
|
|
|
|
|
|
|
|
let keys = Object.keys(i.select_item)
|
|
|
|
|
|
|
|
linkOb.customFn = row => {
|
|
|
|
|
|
|
|
let paramMap = new Map()
|
|
|
|
|
|
|
|
keys.forEach(key => {
|
|
|
|
|
|
|
|
paramMap.set(i.select_item[key],key)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<span>
|
|
|
|
|
|
|
|
{ paramMap.get(row[i.field].toString()) }
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (i._relations) {
|
|
|
|
if (i._relations) {
|
|
|
|
let { link_relation, foreign_key, link_with_name } = i._relations
|
|
|
|
let { link_relation, foreign_key, link_with_name } = i._relations
|
|
|
|
if (link_relation === 'newHasOne' || link_relation === 'hasOne') {
|
|
|
|
if (link_relation === 'newHasOne' || link_relation === 'hasOne') {
|
|
|
|
@ -485,9 +502,9 @@ export default {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<span>
|
|
|
|
<span>
|
|
|
|
{row[link_with_name]?.name ||
|
|
|
|
{ row[link_with_name]?.name ||
|
|
|
|
row[link_with_name]?.no ||
|
|
|
|
row[link_with_name]?.no ||
|
|
|
|
row[link_with_name]?.value}
|
|
|
|
row[link_with_name]?.value }
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -528,17 +545,24 @@ export default {
|
|
|
|
columnArrTest() {
|
|
|
|
columnArrTest() {
|
|
|
|
return function (field) {
|
|
|
|
return function (field) {
|
|
|
|
return this.form.find((i) => i.field === field)
|
|
|
|
return this.form.find((i) => i.field === field)
|
|
|
|
? this.form.find((i) => i.field === field).search_input === "checkbox"
|
|
|
|
? this.form.find((i) => i.field === field).search_input === "checkbox" || this.form.find((i) => i.field === field).search_input === "radio"
|
|
|
|
: false;
|
|
|
|
: false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
getColumnField() {
|
|
|
|
|
|
|
|
return function (field) {
|
|
|
|
|
|
|
|
return this.form.find((i) => i.field === field)
|
|
|
|
|
|
|
|
? this.form.find((i) => i.field === field)
|
|
|
|
|
|
|
|
: {};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
},
|
|
|
|
getColumnParams() {
|
|
|
|
getColumnParams() {
|
|
|
|
return function (field) {
|
|
|
|
return function (field) {
|
|
|
|
return this.form.find((i) => i.field === field)
|
|
|
|
return this.form.find((i) => i.field === field)
|
|
|
|
? this.form.find((i) => i.field === field)._paramters
|
|
|
|
? this.form.find((i) => i.field === field)._params
|
|
|
|
: [];
|
|
|
|
: [];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
|
this.getFormDetail();
|
|
|
|
this.getFormDetail();
|
|
|
|
|