123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <div>
- <m-filter :option="filter" @search="handleSearch" />
- <m-table
- class="mt-3"
- :loading="loading"
- :headers="headers"
- :items="items"
- :total="total"
- :show-select="false"
- :is-tools="false"
- :page-info="pageInfo"
- @pageHandleChange="pageHandleChange"
- @sort="handleSort"
- >
- <template #navBtn>
- <v-btn class="buttons" rounded elevation="5" color="primary" @click="handleImport">
- <v-icon left>mdi-plus</v-icon>
- 新增
- </v-btn>
- </template>
- </m-table>
- <m-dialog :title="title" :visible.sync="show" @submit="handleSubmit">
- <ManualImportEdit></ManualImportEdit>
- </m-dialog>
- </div>
- </template>
- <script>
- import MFilter from '@/components/Filter'
- import MTable from '@/components/List/table.vue'
- import MDialog from '@/components/Dialog'
- import ManualImportEdit from '../components/ManualImportEdit'
- export default {
- name: 'manual-import',
- components: { MFilter, MTable, MDialog, ManualImportEdit },
- data () {
- return {
- loading: false,
- show: false,
- filter: {
- list: [
- { type: 'textField', value: '', label: '名称', key: 'name' },
- { type: 'autocomplete', value: null, label: '选择', key: 'type', items: [] }
- ]
- },
- queryData: {
- name: null
- },
- headers: [
- { text: '标题', align: 'start', value: 'title' },
- { text: '姓名', align: 'start', value: 'name' },
- { text: '来源', align: 'start', value: 'source' },
- { text: '创建日期', align: 'start', value: 'createDate' },
- { text: '操作', align: 'start', value: 'actions' }
- ],
- itemData: {},
- items: [],
- orders: [],
- pageInfo: {
- size: 10,
- current: 1
- },
- total: 0
- }
- },
- computed: {
- title () {
- return Object.keys(this.itemData).length ? '编辑' : '新增'
- }
- },
- created () {
- this.init()
- },
- methods: {
- async init () {},
- handleSearch (val) {
- Object.assign(this.queryData, val)
- this.pageInfo.current = 1
- this.init()
- },
- handleImport () {
- this.itemData = {}
- this.show = true
- },
- async handleEdit (item) {
- this.itemData = item
- this.show = true
- },
- handleDelete (ids) {
- if (Array.isArray(ids) && !ids.length) return this.$snackbar.warning('请选择要删除的选项')
- this.$confirm('提示', '是否删除该选项')
- .then(async () => {
- try {
- this.$snackbar.success('删除成功')
- this.init()
- } catch (error) {
- this.$snackbar.error('删除失败')
- }
- })
- },
- handleSubmit () {},
- pageHandleChange (page) {
- this.pageInfo.current = page
- this.init()
- },
- handleSort (val) {
- this.orders = val
- this.init()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|