ovictoraurelio

Untitled

Mar 30th, 2022
925
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <template lang="pug">
  2. div
  3.   qt-header(title="Gestão documentos")
  4.   v-container
  5.     v-btn.primary(
  6.       fixed
  7.       fab
  8.       bottom
  9.       right
  10.       @click="openCreateDialog()"
  11.     )
  12.       v-icon add
  13.     v-row(justify-center)
  14.       v-col(cols="12")
  15.         v-data-table.elevation-1(
  16.           :headers="tableHeaders"
  17.           :items="signedDocuments.list"
  18.           item-key="id"
  19.           :loading="loadings.data"
  20.         )
  21.           template(v-slot:item.edit="{ item }")
  22.             v-icon.mr-2(small @click="editItem(item)") edit
  23.           template(v-slot:item.delete="{ item }")
  24.             v-icon(small @click="deleteItem(item)") delete
  25.     qt-global-dialog(
  26.       v-model="editorDialog.visible"
  27.       showRButton
  28.       :disabledRButton="!formValid"
  29.       showLButton
  30.       scrollable
  31.       max-width="700px"
  32.       borderRadius="13px"
  33.       :headerTitle="this.form.id ? 'Editar documento' : 'Novo documento'"
  34.       :rButtonLoading="loadings.form"
  35.       :rButtonTitle="this.form.id ? 'Salvar documento' : 'Cadastrar documento'"
  36.       :persistent="loadings.form"
  37.       @clickRButton="save()"
  38.     )
  39.       template(v-slot:content)
  40.         v-form(ref="form" v-model="formValid")
  41.           v-container
  42.             qt-form-response(
  43.               ref="additionalForm"
  44.               mode="only-fields"
  45.               :loadingResponses="loadings.itemData"
  46.               :formId="colocarIdDoSIgnedDocumentsDatabaseAqui"
  47.               :formResponseId="form.formResponseId"
  48.               @formSent="formSent"
  49.             )
  50. </template>
  51.  
  52. <script>
  53. import { mapState } from 'vuex'
  54. import { formMethods } from '@/utils/forms'
  55.  
  56. export default {
  57.   components: {},
  58.   computed: {
  59.     ...mapState(['signedDocuments'])
  60.   },
  61.   data: function () {
  62.     return {
  63.       search: null,
  64.       FieldType: [],
  65.       rules: {
  66.         required: (v) => !!v || 'Campo obrigatório'
  67.       },
  68.       tableHeaders: [
  69.         {
  70.           text: 'Nome',
  71.           align: 'left',
  72.           value: 'name'
  73.         },
  74.         {
  75.           text: 'Slug',
  76.           align: 'left',
  77.           value: 'slug'
  78.         },
  79.         {
  80.           text: 'Editar',
  81.           width: '100',
  82.           align: 'center',
  83.           sortable: false,
  84.           value: 'edit'
  85.         },
  86.         {
  87.           text: 'Deletar',
  88.           width: '100',
  89.           align: 'center',
  90.           sortable: false,
  91.           value: 'delete'
  92.         }
  93.       ],
  94.       editorDialog: {
  95.         visible: false
  96.       },
  97.       loadings: {
  98.         data: false,
  99.         form: false
  100.       },
  101.       formValid: true,
  102.       form: {
  103.         id: null,
  104.         name: '',
  105.         slug: ''
  106.         // color: ''
  107.       }
  108.     }
  109.   },
  110.   methods: {
  111.     ...formMethods('signedDocuments')
  112.   },
  113.   async created() {
  114.     this.loadings.data = true
  115.     await Promise.all([this.$store.dispatch('signedDocuments/list')])
  116.     this.loadings.data = false
  117.   }
  118. }
  119. </script>
  120.  
  121. <style lang="sass" scoped>
  122. .toolbar-settings
  123.   box-shadow: none !important
  124.   border-radius: 100px 100px 0px 0px
  125. .text-settings
  126.   font-family: Roboto
  127.   font-style: normal
  128.   font-weight: 500
  129.   font-size: 18px
  130.   line-height: 20px
  131.   letter-spacing: 0.4px
  132. </style>
  133.  
Advertisement
Add Comment
Please, Sign In to add comment