mirror of
https://github.com/frappe/books.git
synced 2025-01-23 07:08:36 +00:00
fix: List
- Remove unused formatFilters - Return field as column definition
This commit is contained in:
parent
b22e2045df
commit
e17b3059fa
@ -43,7 +43,7 @@
|
|||||||
<Row
|
<Row
|
||||||
gap="1rem"
|
gap="1rem"
|
||||||
class="cursor-pointer text-gray-900 flex-1"
|
class="cursor-pointer text-gray-900 flex-1"
|
||||||
@click.native="openForm(doc.name)"
|
@click.native="openForm(doc)"
|
||||||
:columnCount="columns.length"
|
:columnCount="columns.length"
|
||||||
>
|
>
|
||||||
<ListCell
|
<ListCell
|
||||||
@ -110,9 +110,9 @@ export default {
|
|||||||
this.doctype = this.listConfig.doctype;
|
this.doctype = this.listConfig.doctype;
|
||||||
await this.updateData();
|
await this.updateData();
|
||||||
},
|
},
|
||||||
openForm(name) {
|
openForm(doc) {
|
||||||
if (this.listConfig.formRoute) {
|
if (this.listConfig.formRoute) {
|
||||||
this.$router.push(this.listConfig.formRoute(name));
|
this.$router.push(this.listConfig.formRoute(doc.name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
@ -120,7 +120,7 @@ export default {
|
|||||||
query: {
|
query: {
|
||||||
edit: 1,
|
edit: 1,
|
||||||
doctype: this.doctype,
|
doctype: this.doctype,
|
||||||
name
|
name: doc.name
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -139,30 +139,13 @@ export default {
|
|||||||
Object.assign(filters, this.filters);
|
Object.assign(filters, this.filters);
|
||||||
return filters;
|
return filters;
|
||||||
},
|
},
|
||||||
formatFilters(filters) {
|
|
||||||
for (let key in filters) {
|
|
||||||
let value = filters[key];
|
|
||||||
this.meta.fields.forEach(field => {
|
|
||||||
if (field.fieldname === key) {
|
|
||||||
filters[key] = frappe.format(value, field.fieldtype);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return filters;
|
|
||||||
},
|
|
||||||
prepareColumns() {
|
prepareColumns() {
|
||||||
return this.listConfig.columns
|
return this.listConfig.columns
|
||||||
.map(col => {
|
.map(col => {
|
||||||
if (typeof col === 'string') {
|
if (typeof col === 'string') {
|
||||||
const field = this.meta.getField(col);
|
const field = this.meta.getField(col);
|
||||||
if (!field) return null;
|
if (!field) return null;
|
||||||
return {
|
return field;
|
||||||
label: field.label,
|
|
||||||
fieldtype: field.fieldtype,
|
|
||||||
getValue(doc) {
|
|
||||||
return doc[col];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
return col;
|
return col;
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user