mirror of https://github.com/doccano/doccano.git
pythondatasetnatural-language-processingdata-labelingmachine-learningannotation-tooldatasetsactive-learningtext-annotation
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
2.1 KiB
93 lines
2.1 KiB
<template>
|
|
<v-data-table
|
|
:value="selected"
|
|
:headers="headers"
|
|
:items="items"
|
|
item-key="id"
|
|
:options.sync="options"
|
|
:server-items-length="total"
|
|
:search="search"
|
|
:loading="loading"
|
|
:footer-props="{
|
|
'items-per-page-options': [10, 50, 100]
|
|
}"
|
|
loading-text="Loading... Please wait"
|
|
show-select
|
|
@input="updateSelected"
|
|
>
|
|
<template v-slot:top>
|
|
<v-text-field
|
|
v-model="search"
|
|
prepend-inner-icon="search"
|
|
label="Search"
|
|
single-line
|
|
hide-details
|
|
filled
|
|
/>
|
|
</template>
|
|
<template v-slot:item.text="{ item }">
|
|
<v-edit-dialog>
|
|
<span class="d-flex d-sm-none">{{ item.text | truncate(50) }}</span>
|
|
<span class="d-none d-sm-flex">{{ item.text | truncate(200) }}</span>
|
|
<template v-slot:input>
|
|
<v-textarea
|
|
:value="item.text"
|
|
label="Edit"
|
|
autofocus
|
|
@change="handleUpdateDocument({ id: item.id, text: $event })"
|
|
/>
|
|
</template>
|
|
</v-edit-dialog>
|
|
</template>
|
|
</v-data-table>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapState, mapActions, mapMutations, mapGetters } from 'vuex'
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
search: '',
|
|
options: {}
|
|
}
|
|
},
|
|
|
|
computed: {
|
|
...mapState('documents', ['items', 'selected', 'loading', 'total']),
|
|
...mapGetters('documents', ['headers'])
|
|
},
|
|
|
|
watch: {
|
|
options: {
|
|
handler() {
|
|
this.getDocumentList({
|
|
projectId: this.$route.params.id,
|
|
limit: this.options.itemsPerPage,
|
|
offset: (this.options.page - 1) * this.options.itemsPerPage
|
|
})
|
|
},
|
|
deep: true
|
|
}
|
|
},
|
|
|
|
created() {
|
|
this.getDocumentList({
|
|
projectId: this.$route.params.id
|
|
})
|
|
},
|
|
|
|
methods: {
|
|
...mapActions('documents', ['getDocumentList', 'updateDocument']),
|
|
...mapMutations('documents', ['updateSelected']),
|
|
|
|
handleUpdateDocument(payload) {
|
|
const data = {
|
|
projectId: this.$route.params.id,
|
|
...payload
|
|
}
|
|
this.updateDocument(data)
|
|
}
|
|
}
|
|
}
|
|
</script>
|