fix: Not resend request when hidden document status. (#339)
* fix: Not resend request when hidden document status. * Validate store data to get documents actions.pull/3759/head
							parent
							
								
									4c507aa82a
								
							
						
					
					
						commit
						6ce282c65d
					
				| 
						 | 
				
			
			@ -345,12 +345,12 @@ export const contextMixin = {
 | 
			
		|||
      }
 | 
			
		||||
      this.actions = this.metadataMenu.actions
 | 
			
		||||
      if (this.panelType === 'window') {
 | 
			
		||||
        var processAction = this.actions.find(item => {
 | 
			
		||||
        const processAction = this.actions.find(item => {
 | 
			
		||||
          if (item.name === 'Procesar Orden' || (item.name === 'Process Order')) {
 | 
			
		||||
            return item
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
        this.$store.dispatch('setOrden', processAction)
 | 
			
		||||
        this.$store.dispatch('setOrder', processAction)
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if (this.actions && this.actions.length) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,6 @@
 | 
			
		|||
<template>
 | 
			
		||||
  <span>
 | 
			
		||||
  <span v-if="isContextInfo">
 | 
			
		||||
    <el-popover
 | 
			
		||||
      v-if="(fieldAttributes.contextInfo && fieldAttributes.contextInfo.isActive) || fieldAttributes.reference.zoomWindowList.length"
 | 
			
		||||
      ref="contextInfoField"
 | 
			
		||||
      placement="top"
 | 
			
		||||
      width="300"
 | 
			
		||||
| 
						 | 
				
			
			@ -15,9 +14,7 @@
 | 
			
		|||
        <span class="custom-tittle-popover">
 | 
			
		||||
          {{ fieldAttributes.name }}
 | 
			
		||||
        </span>
 | 
			
		||||
        <template v-if="!isEmptyValue(fieldAttributes.help)">
 | 
			
		||||
          : {{ fieldAttributes.help }}
 | 
			
		||||
        </template>
 | 
			
		||||
        {{ fieldAttributes.help }}
 | 
			
		||||
      </div>
 | 
			
		||||
      <template v-for="(zoomItem, index) in fieldAttributes.reference.zoomWindowList">
 | 
			
		||||
        <el-button
 | 
			
		||||
| 
						 | 
				
			
			@ -58,6 +55,9 @@ export default {
 | 
			
		|||
    }
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    isContextInfo() {
 | 
			
		||||
      return (this.fieldAttributes.contextInfo && this.fieldAttributes.contextInfo.isActive) || this.fieldAttributes.reference.zoomWindowList.length
 | 
			
		||||
    },
 | 
			
		||||
    permissionRoutes() {
 | 
			
		||||
      return this.$store.getters.permission_routes
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,141 @@
 | 
			
		|||
<template>
 | 
			
		||||
  <el-popover
 | 
			
		||||
    v-if="(field.columnName === 'DocStatus') && (!isEmptyValue(processOrderUuid))"
 | 
			
		||||
    placement="right"
 | 
			
		||||
    width="400"
 | 
			
		||||
    trigger="click"
 | 
			
		||||
    :disabled="withoutRecord"
 | 
			
		||||
  >
 | 
			
		||||
    <el-select
 | 
			
		||||
      v-model="valueActionDocument"
 | 
			
		||||
      @change="documentActionChange"
 | 
			
		||||
      @visible-change="listActionDocument"
 | 
			
		||||
    >
 | 
			
		||||
      <el-option
 | 
			
		||||
        v-for="(item, key) in listDocumentActions"
 | 
			
		||||
        :key="key"
 | 
			
		||||
        :label="item.name"
 | 
			
		||||
        :value="item.value"
 | 
			
		||||
      />
 | 
			
		||||
    </el-select>
 | 
			
		||||
    <el-tag
 | 
			
		||||
      v-if="isEmptyValue(valueActionDocument)"
 | 
			
		||||
      :type="tagStatus(field.value)"
 | 
			
		||||
    >
 | 
			
		||||
      {{ field.displayColumn }}
 | 
			
		||||
    </el-tag>
 | 
			
		||||
    <el-tag
 | 
			
		||||
      v-else
 | 
			
		||||
      :type="tagStatus(valueActionDocument)"
 | 
			
		||||
    >
 | 
			
		||||
      {{ labelDocumentActions }}
 | 
			
		||||
    </el-tag>
 | 
			
		||||
    <p v-if="isEmptyValue(valueActionDocument)"> {{ field.description }} </p>
 | 
			
		||||
    <p v-else> {{ descriptionDocumentActions }} </p>
 | 
			
		||||
    <el-button
 | 
			
		||||
      slot="reference"
 | 
			
		||||
      type="text"
 | 
			
		||||
      icon="el-icon-set-up"
 | 
			
		||||
    />
 | 
			
		||||
  </el-popover>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'FieldDocumentStatus',
 | 
			
		||||
  props: {
 | 
			
		||||
    field: {
 | 
			
		||||
      type: Object,
 | 
			
		||||
      required: true
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      valueActionDocument: ''
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    withoutRecord() {
 | 
			
		||||
      // TODO: Validate with record attribute
 | 
			
		||||
      if (this.isEmptyValue(this.$route.query.action) ||
 | 
			
		||||
      ['create-new', 'reference', 'advancedQuery', 'criteria'].includes(this.$route.query.action)) {
 | 
			
		||||
        return true
 | 
			
		||||
      }
 | 
			
		||||
      return false
 | 
			
		||||
    },
 | 
			
		||||
    documentActions() {
 | 
			
		||||
      return this.$store.getters.getListDocumentActions
 | 
			
		||||
    },
 | 
			
		||||
    listDocumentActions() {
 | 
			
		||||
      return this.documentActions.documentActionsList
 | 
			
		||||
    },
 | 
			
		||||
    labelDocumentActions() {
 | 
			
		||||
      const found = this.listDocumentActions.find(element => {
 | 
			
		||||
        if (element.value === this.valueActionDocument) {
 | 
			
		||||
          return element
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      if (this.isEmptyValue(found)) {
 | 
			
		||||
        return this.valueActionDocument
 | 
			
		||||
      }
 | 
			
		||||
      return found.name
 | 
			
		||||
    },
 | 
			
		||||
    descriptionDocumentActions() {
 | 
			
		||||
      const found = this.listDocumentActions.find(element => {
 | 
			
		||||
        if (element.value === this.valueActionDocument) {
 | 
			
		||||
          return element
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      if (this.isEmptyValue(found)) {
 | 
			
		||||
        return this.valueActionDocument
 | 
			
		||||
      }
 | 
			
		||||
      return found.description
 | 
			
		||||
    },
 | 
			
		||||
    processOrderUuid() {
 | 
			
		||||
      return this.$store.getters.getOrders
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    listActionDocument(isShowList) {
 | 
			
		||||
      if (isShowList) {
 | 
			
		||||
        if (!this.withoutRecord && this.$route.query.action !== this.documentActions.recordUuid) {
 | 
			
		||||
          this.$store.dispatch('listDocumentActionStatus', {
 | 
			
		||||
            recordUuid: this.$route.query.action,
 | 
			
		||||
            recordId: this.$route.params.recordId
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    documentActionChange(value) {
 | 
			
		||||
      this.$store.dispatch('notifyFieldChange', {
 | 
			
		||||
        parentUuid: this.parentUuid,
 | 
			
		||||
        containerUuid: this.containerUuid,
 | 
			
		||||
        columnName: 'DocAction',
 | 
			
		||||
        isSendToServer: true,
 | 
			
		||||
        newValue: value
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      const actionProcess = this.$store.getters.getOrders
 | 
			
		||||
      this.$store.dispatch('startProcess', {
 | 
			
		||||
        action: {
 | 
			
		||||
          uuid: actionProcess.uuid,
 | 
			
		||||
          id: actionProcess.id,
 | 
			
		||||
          name: actionProcess.name
 | 
			
		||||
        }, // process metadata
 | 
			
		||||
        tableName: this.$route.params.tableName,
 | 
			
		||||
        recordId: this.$route.params.recordId,
 | 
			
		||||
        recordUuid: this.$route.query.action,
 | 
			
		||||
        parametersList: [{
 | 
			
		||||
          columnName: 'DocStatus',
 | 
			
		||||
          value: this.valueActionDocument
 | 
			
		||||
        }],
 | 
			
		||||
        isActionDocument: true,
 | 
			
		||||
        parentUuid: this.parentUuid,
 | 
			
		||||
        panelType: this.panelType,
 | 
			
		||||
        containerUuid: this.containerUuid// determinate if get table name and record id (window) or selection (browser)
 | 
			
		||||
      })
 | 
			
		||||
      this.valueActionDocument = ''
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
| 
						 | 
				
			
			@ -25,7 +25,7 @@
 | 
			
		|||
          :field-value="field.value"
 | 
			
		||||
        />
 | 
			
		||||
        <field-context-info
 | 
			
		||||
          v-else-if="(field.contextInfo && field.contextInfo.isActive) || field.reference.zoomWindowList.length"
 | 
			
		||||
          v-else-if="isContextInfo"
 | 
			
		||||
          key="is-field-context-info"
 | 
			
		||||
          :field-attributes="fieldAttributes"
 | 
			
		||||
          :field-value="field.value"
 | 
			
		||||
| 
						 | 
				
			
			@ -33,39 +33,12 @@
 | 
			
		|||
        <span v-else key="is-field-name">
 | 
			
		||||
          {{ isFieldOnly() }}
 | 
			
		||||
        </span>
 | 
			
		||||
        <el-popover
 | 
			
		||||
          v-if="(field.columnName === 'DocStatus') && (!isEmptyValue(processOrdenUuid))"
 | 
			
		||||
          placement="right"
 | 
			
		||||
          width="400"
 | 
			
		||||
          trigger="click"
 | 
			
		||||
        >
 | 
			
		||||
          <el-select
 | 
			
		||||
            v-model="valueActionDocument"
 | 
			
		||||
            @change="documentActionChange"
 | 
			
		||||
          >
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="(item, key) in listDocumentActions"
 | 
			
		||||
              :key="key"
 | 
			
		||||
              :label="item.name"
 | 
			
		||||
              :value="item.value"
 | 
			
		||||
 | 
			
		||||
        <field-document-status
 | 
			
		||||
          v-if="isDocuemntStatus"
 | 
			
		||||
          :field="fieldAttributes"
 | 
			
		||||
        />
 | 
			
		||||
          </el-select>
 | 
			
		||||
          <el-tag
 | 
			
		||||
            v-if="isEmptyValue(valueActionDocument)"
 | 
			
		||||
            :type="tagStatus(field.value)"
 | 
			
		||||
          >
 | 
			
		||||
            {{ field.displayColumn }}
 | 
			
		||||
          </el-tag>
 | 
			
		||||
          <el-tag
 | 
			
		||||
            v-else
 | 
			
		||||
            :type="tagStatus(valueActionDocument)"
 | 
			
		||||
          >
 | 
			
		||||
            {{ labelDocumentActions }}
 | 
			
		||||
          </el-tag>
 | 
			
		||||
          <p v-if="isEmptyValue(valueActionDocument)"> {{ field.description }} </p>
 | 
			
		||||
          <p v-else> {{ descriptionDocumentActions }} </p>
 | 
			
		||||
          <el-button slot="reference" type="text" icon="el-icon-set-up" @click="listActionDocument" />
 | 
			
		||||
        </el-popover>
 | 
			
		||||
 | 
			
		||||
        <field-translated
 | 
			
		||||
          v-if="field.isTranslated && !isAdvancedQuery"
 | 
			
		||||
          :field-attributes="fieldAttributes"
 | 
			
		||||
| 
						 | 
				
			
			@ -92,13 +65,12 @@
 | 
			
		|||
 | 
			
		||||
<script>
 | 
			
		||||
import FieldContextInfo from '@/components/ADempiere/Field/fieldPopovers/fieldContextInfo'
 | 
			
		||||
import FieldDocumentStatus from '@/components/ADempiere/Field/fieldPopovers/fieldDocumentStatus'
 | 
			
		||||
import FieldOperatorComparison from '@/components/ADempiere/Field/fieldPopovers/fieldOperatorComparison'
 | 
			
		||||
import FieldTranslated from '@/components/ADempiere/Field/fieldPopovers/fieldTranslated'
 | 
			
		||||
import { FIELD_ONLY } from '@/components/ADempiere/Field/references'
 | 
			
		||||
import { DEFAULT_SIZE } from '@/components/ADempiere/Field/fieldSize'
 | 
			
		||||
import { fieldIsDisplayed } from '@/utils/ADempiere'
 | 
			
		||||
import { showMessage } from '@/utils/ADempiere/notification'
 | 
			
		||||
import { recursiveTreeSearch } from '@/utils/ADempiere/valueUtils'
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This is the base component for linking the components according to the
 | 
			
		||||
| 
						 | 
				
			
			@ -108,6 +80,7 @@ export default {
 | 
			
		|||
  name: 'FieldDefinition',
 | 
			
		||||
  components: {
 | 
			
		||||
    FieldContextInfo,
 | 
			
		||||
    FieldDocumentStatus,
 | 
			
		||||
    FieldOperatorComparison,
 | 
			
		||||
    FieldTranslated
 | 
			
		||||
  },
 | 
			
		||||
| 
						 | 
				
			
			@ -148,8 +121,7 @@ export default {
 | 
			
		|||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      field: {},
 | 
			
		||||
      valueActionDocument: ''
 | 
			
		||||
      field: {}
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
| 
						 | 
				
			
			@ -267,36 +239,22 @@ export default {
 | 
			
		|||
      }
 | 
			
		||||
      return false
 | 
			
		||||
    },
 | 
			
		||||
    listDocumentActions() {
 | 
			
		||||
      return this.$store.getters.getListDocumentActions.documentActionsList
 | 
			
		||||
    processOrderUuid() {
 | 
			
		||||
      return this.$store.getters.getOrders
 | 
			
		||||
    },
 | 
			
		||||
    defaultDocumentActions() {
 | 
			
		||||
      return this.$store.getters.getListDocumentActions.defaultDocumentAction
 | 
			
		||||
    isDocuemntStatus() {
 | 
			
		||||
      if (this.panelType === 'window') {
 | 
			
		||||
        if (this.field.columnName === 'DocStatus' && !this.isEmptyValue(this.processOrderUuid)) {
 | 
			
		||||
          return true
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      return false
 | 
			
		||||
    },
 | 
			
		||||
    labelDocumentActions() {
 | 
			
		||||
      const found = this.listDocumentActions.find(element => {
 | 
			
		||||
        if (element.value === this.valueActionDocument) {
 | 
			
		||||
          return element
 | 
			
		||||
    isContextInfo() {
 | 
			
		||||
      if (!this.isAdvancedQuery) {
 | 
			
		||||
        return (this.field.contextInfo && this.field.contextInfo.isActive) || this.field.reference.zoomWindowList.length
 | 
			
		||||
      }
 | 
			
		||||
      })
 | 
			
		||||
      if (this.isEmptyValue(found)) {
 | 
			
		||||
        return this.valueActionDocument
 | 
			
		||||
      }
 | 
			
		||||
      return found.name
 | 
			
		||||
    },
 | 
			
		||||
    descriptionDocumentActions() {
 | 
			
		||||
      const found = this.listDocumentActions.find(element => {
 | 
			
		||||
        if (element.value === this.valueActionDocument) {
 | 
			
		||||
          return element
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
      if (this.isEmptyValue(found)) {
 | 
			
		||||
        return this.valueActionDocument
 | 
			
		||||
      }
 | 
			
		||||
      return found.description
 | 
			
		||||
    },
 | 
			
		||||
    processOrdenUuid() {
 | 
			
		||||
      return this.$store.getters.getOrden
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
| 
						 | 
				
			
			@ -309,42 +267,6 @@ export default {
 | 
			
		|||
    this.field = this.metadataField
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    showMessage,
 | 
			
		||||
    listActionDocument() {
 | 
			
		||||
      this.$store.dispatch('listDocumentActionStatus', {
 | 
			
		||||
        tableName: 'C_Order',
 | 
			
		||||
        recordUuid: this.$route.query.action
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    documentActionChange(value) {
 | 
			
		||||
      var actionProcess = this.$store.getters.getOrden
 | 
			
		||||
      this.$store.dispatch('notifyFieldChange', {
 | 
			
		||||
        parentUuid: this.parentUuid,
 | 
			
		||||
        containerUuid: this.containerUuid,
 | 
			
		||||
        columnName: 'DocAction',
 | 
			
		||||
        isSendToServer: true,
 | 
			
		||||
        newValue: value
 | 
			
		||||
      })
 | 
			
		||||
      this.$store.dispatch('startProcess', {
 | 
			
		||||
        action: {
 | 
			
		||||
          uuid: actionProcess.uuid,
 | 
			
		||||
          id: actionProcess.id,
 | 
			
		||||
          name: actionProcess.name
 | 
			
		||||
        }, // process metadata
 | 
			
		||||
        tableName: this.$route.params.tableName,
 | 
			
		||||
        recordId: this.$route.params.recordId,
 | 
			
		||||
        recordUuid: this.$route.query.action,
 | 
			
		||||
        parametersList: [{
 | 
			
		||||
          columnName: 'DocStatus',
 | 
			
		||||
          value: this.valueActionDocument
 | 
			
		||||
        }],
 | 
			
		||||
        isActionDocument: true,
 | 
			
		||||
        parentUuid: this.parentUuid,
 | 
			
		||||
        panelType: this.panelType,
 | 
			
		||||
        containerUuid: this.containerUuid// determinate if get table name and record id (window) or selection (browser)
 | 
			
		||||
      })
 | 
			
		||||
      this.valueActionDocument = ''
 | 
			
		||||
    },
 | 
			
		||||
    isDisplayed() {
 | 
			
		||||
      if (this.isAdvancedQuery) {
 | 
			
		||||
        return this.field.isShowedFromUser
 | 
			
		||||
| 
						 | 
				
			
			@ -424,30 +346,6 @@ export default {
 | 
			
		|||
      if (this.isDisplayed() && this.isMandatory() && !this.isReadOnly()) {
 | 
			
		||||
        this.$refs[this.field.columnName].activeFocus()
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    redirect({ window, columnName, value }) {
 | 
			
		||||
      const viewSearch = recursiveTreeSearch({
 | 
			
		||||
        treeData: this.permissionRoutes,
 | 
			
		||||
        attributeValue: window.uuid,
 | 
			
		||||
        attributeName: 'meta',
 | 
			
		||||
        secondAttribute: 'uuid',
 | 
			
		||||
        attributeChilds: 'children'
 | 
			
		||||
      })
 | 
			
		||||
      if (viewSearch) {
 | 
			
		||||
        this.$router.push({
 | 
			
		||||
          name: viewSearch.name,
 | 
			
		||||
          query: {
 | 
			
		||||
            action: 'advancedQuery',
 | 
			
		||||
            tabParent: 0,
 | 
			
		||||
            [columnName]: value
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
      } else {
 | 
			
		||||
        this.showMessage({
 | 
			
		||||
          type: 'error',
 | 
			
		||||
          message: this.$t('notifications.noRoleAccess')
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,12 @@ import { requestListDocumentActions } from '@/api/ADempiere/data'
 | 
			
		|||
const contextMenu = {
 | 
			
		||||
  state: {
 | 
			
		||||
    contextMenu: [],
 | 
			
		||||
    listDocumentAction: []
 | 
			
		||||
    listDocumentAction: {
 | 
			
		||||
      defaultDocumentAction: undefined,
 | 
			
		||||
      documentActionsList: [],
 | 
			
		||||
      recordId: undefined,
 | 
			
		||||
      recordUuid: undefined
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  mutations: {
 | 
			
		||||
    setContextMenu(state, payload) {
 | 
			
		||||
| 
						 | 
				
			
			@ -34,21 +39,37 @@ const contextMenu = {
 | 
			
		|||
    setContextMenu({ commit }, payload) {
 | 
			
		||||
      commit('setContextMenu', payload)
 | 
			
		||||
    },
 | 
			
		||||
    listDocumentActionStatus({ commit }, params) {
 | 
			
		||||
      const tableName = params.tableName
 | 
			
		||||
      const recordId = params.recordId
 | 
			
		||||
      const recordUuid = params.recordUuid
 | 
			
		||||
      const documentStatus = params.DocStatus
 | 
			
		||||
      const documentAction = params.DocAction
 | 
			
		||||
      const pageSize = 0
 | 
			
		||||
      const pageToken = ''
 | 
			
		||||
      requestListDocumentActions({ tableName, recordId, recordUuid, documentStatus, documentAction, pageSize, pageToken })
 | 
			
		||||
        .then(response => {
 | 
			
		||||
          var documentAction = {
 | 
			
		||||
            defaultDocumentAction: response.defaultDocumentAction,
 | 
			
		||||
            documentActionsList: response.documentActionsList
 | 
			
		||||
    /**
 | 
			
		||||
     * TODO: Verify tableName params to change in constant
 | 
			
		||||
     * @param {number} recordId
 | 
			
		||||
     * @param {string} recordUuid
 | 
			
		||||
     */
 | 
			
		||||
    listDocumentActionStatus({ commit }, {
 | 
			
		||||
      tableName = 'C_Order',
 | 
			
		||||
      recordId,
 | 
			
		||||
      recordUuid,
 | 
			
		||||
      documentAction,
 | 
			
		||||
      documentStatus
 | 
			
		||||
    }) {
 | 
			
		||||
      requestListDocumentActions({
 | 
			
		||||
        tableName,
 | 
			
		||||
        recordId,
 | 
			
		||||
        recordUuid,
 | 
			
		||||
        documentAction,
 | 
			
		||||
        documentStatus,
 | 
			
		||||
        pageSize: 0,
 | 
			
		||||
        pageToken: ''
 | 
			
		||||
      })
 | 
			
		||||
        .then(responseDocumentActios => {
 | 
			
		||||
          const documentAction = {
 | 
			
		||||
            defaultDocumentAction: responseDocumentActios.defaultDocumentAction,
 | 
			
		||||
            documentActionsList: responseDocumentActios.documentActionsList,
 | 
			
		||||
            recordId,
 | 
			
		||||
            recordUuid
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          commit('listDocumentAction', documentAction)
 | 
			
		||||
          return documentAction
 | 
			
		||||
        })
 | 
			
		||||
        .catch(error => {
 | 
			
		||||
          console.warn(error)
 | 
			
		||||
| 
						 | 
				
			
			@ -79,6 +100,9 @@ const contextMenu = {
 | 
			
		|||
    },
 | 
			
		||||
    getListDocumentActions: (state) => {
 | 
			
		||||
      return state.listDocumentAction
 | 
			
		||||
    },
 | 
			
		||||
    getListDocumentActionByUuid: (state) => (recordUuid) => {
 | 
			
		||||
      return state.listDocumentAction.find(itemDocumentAction => itemDocumentAction.recordUuid === recordUuid)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@ const utils = {
 | 
			
		|||
    setProcessTable(state, recordTable) {
 | 
			
		||||
      state.recordTable = recordTable
 | 
			
		||||
    },
 | 
			
		||||
    setOrden(state, payload) {
 | 
			
		||||
    setOrder(state, payload) {
 | 
			
		||||
      state.documentAction = payload
 | 
			
		||||
    },
 | 
			
		||||
    setChatText(state, payload) {
 | 
			
		||||
| 
						 | 
				
			
			@ -146,8 +146,8 @@ const utils = {
 | 
			
		|||
    setReportTypeToShareLink({ commit }, value) {
 | 
			
		||||
      commit('setReportTypeToShareLink', value)
 | 
			
		||||
    },
 | 
			
		||||
    setOrden({ commit }, params) {
 | 
			
		||||
      commit('setOrden', params)
 | 
			
		||||
    setOrder({ commit }, params) {
 | 
			
		||||
      commit('setOrder', params)
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  getters: {
 | 
			
		||||
| 
						 | 
				
			
			@ -209,7 +209,7 @@ const utils = {
 | 
			
		|||
    getIsReadedOpenRoute: (state) => {
 | 
			
		||||
      return state.openRoute.isReaded
 | 
			
		||||
    },
 | 
			
		||||
    getOrden: (state) => {
 | 
			
		||||
    getOrders: (state) => {
 | 
			
		||||
      return state.documentAction
 | 
			
		||||
    },
 | 
			
		||||
    getChatTextLong: (state) => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@
 | 
			
		|||
                            circle
 | 
			
		||||
                            style="margin-left: 10px;"
 | 
			
		||||
                            class="el-button-window"
 | 
			
		||||
                            @click="handleChangeShowedRecordNavigation(isShowedRecordNavigation)"
 | 
			
		||||
                            @click="handleChangeShowedRecordNavigation(false)"
 | 
			
		||||
                          />
 | 
			
		||||
                          <el-button
 | 
			
		||||
                            v-show="!isPanel"
 | 
			
		||||
| 
						 | 
				
			
			@ -50,18 +50,12 @@
 | 
			
		|||
                        </div>
 | 
			
		||||
                      </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <i
 | 
			
		||||
                      v-if="isMobile"
 | 
			
		||||
                      class="el-icon-close"
 | 
			
		||||
                      style="position: fixed; padding-top: 15px; color: #000000; font-size: 121%; font-weight: 615 !important; padding-left: 9px;"
 | 
			
		||||
                      @click="handleChangeShowedRecordNavigation(isShowedRecordNavigation)"
 | 
			
		||||
                    />
 | 
			
		||||
                  </el-aside>
 | 
			
		||||
                </div>
 | 
			
		||||
              </template>
 | 
			
		||||
              <template slot="paneR">
 | 
			
		||||
                <el-container style="height: 86vh;">
 | 
			
		||||
                  <Split v-shortkey="['f8']" direction="vertical" @onDrag="onDrag" @shortkey.native="handleChangeShowedRecordNavigation(isShowedRecordNavigation)">
 | 
			
		||||
                  <Split v-shortkey="['f8']" direction="vertical" @onDrag="onDrag" @shortkey.native="handleChangeShowedRecordNavigation(!isShowedRecordNavigation)">
 | 
			
		||||
                    <SplitArea :size="sizeAreaStyle" :style="splitAreaStyle">
 | 
			
		||||
                      <el-header style="height: 39px;">
 | 
			
		||||
                        <context-menu
 | 
			
		||||
| 
						 | 
				
			
			@ -113,7 +107,7 @@
 | 
			
		|||
                              class="open-navegation"
 | 
			
		||||
                              circle
 | 
			
		||||
                              type="primary"
 | 
			
		||||
                              @click="handleChangeShowedRecordNavigation(isShowedRecordNavigation)"
 | 
			
		||||
                              @click="handleChangeShowedRecordNavigation(true)"
 | 
			
		||||
                            />
 | 
			
		||||
                          </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -255,10 +249,6 @@ export default {
 | 
			
		|||
      isPanel: false,
 | 
			
		||||
      activeInfo: 'listChatEntries',
 | 
			
		||||
      show: false,
 | 
			
		||||
      chatNote: '',
 | 
			
		||||
      typeAction: 0,
 | 
			
		||||
      isLoadingFromServer: false,
 | 
			
		||||
      currentKey: 100,
 | 
			
		||||
      // TODO: Manage attribute with store
 | 
			
		||||
      isShowedRecordPanel: false
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -386,45 +376,26 @@ export default {
 | 
			
		|||
      return true
 | 
			
		||||
    },
 | 
			
		||||
    getIsWorkflowLog() {
 | 
			
		||||
      if (this.isEmptyValue(this.gettersListWorkflow)) {
 | 
			
		||||
      if (this.isEmptyValue(this.$store.getters.getWorkflow)) {
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
      return true
 | 
			
		||||
    },
 | 
			
		||||
    getIsChat() {
 | 
			
		||||
      return this.$store.getters.getIsNote
 | 
			
		||||
    },
 | 
			
		||||
    isNote() {
 | 
			
		||||
      return this.$store.getters.getIsNote
 | 
			
		||||
    },
 | 
			
		||||
    gettersListWorkflow() {
 | 
			
		||||
      return this.$store.getters.getWorkflow
 | 
			
		||||
    },
 | 
			
		||||
    getterShowContainerInfo() {
 | 
			
		||||
      return this.$store.getters.getShowContainerInfo
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    $route(value) {
 | 
			
		||||
      this.$store.dispatch(this.activeInfo, {
 | 
			
		||||
        tableName: this.$route.params.tableName,
 | 
			
		||||
        recordId: this.$route.params.recordId
 | 
			
		||||
      })
 | 
			
		||||
        .then(response => {
 | 
			
		||||
          if (value.query.action === 'create-new') {
 | 
			
		||||
        this.$store.dispatch(this.activeInfo, {
 | 
			
		||||
          tableName: this.$route.params.tableName,
 | 
			
		||||
          recordId: this.$route.params.recordId
 | 
			
		||||
        })
 | 
			
		||||
          .then((response) => {
 | 
			
		||||
            this.$store.dispatch('isNote', false)
 | 
			
		||||
          })
 | 
			
		||||
      } else {
 | 
			
		||||
        this.$store.dispatch(this.activeInfo, {
 | 
			
		||||
          tableName: this.$route.params.tableName,
 | 
			
		||||
          recordId: this.$route.params.recordId
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    'this.$route.params'(newValue, oldValue) {
 | 
			
		||||
      if (!this.isEmptyValue(newValue)) {
 | 
			
		||||
        this.getIsRecordLocked()
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
| 
						 | 
				
			
			@ -449,12 +420,6 @@ export default {
 | 
			
		|||
        recordId: this.$route.params.recordId
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    refres(tabInfo) {
 | 
			
		||||
      this.$store.dispatch(tabInfo, {
 | 
			
		||||
        tableName: this.$route.params.tableName,
 | 
			
		||||
        recordId: this.$route.params.recordId
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    // callback new size
 | 
			
		||||
    onDrag(size) {
 | 
			
		||||
      this.$store.dispatch('setSplitHeightTop', {
 | 
			
		||||
| 
						 | 
				
			
			@ -468,7 +433,6 @@ export default {
 | 
			
		|||
    getWindow() {
 | 
			
		||||
      if (this.getterWindow) {
 | 
			
		||||
        this.generateWindow()
 | 
			
		||||
        this.isLoadingFromServer = true
 | 
			
		||||
        return
 | 
			
		||||
      }
 | 
			
		||||
      this.$store.dispatch('getWindowFromServer', {
 | 
			
		||||
| 
						 | 
				
			
			@ -477,7 +441,6 @@ export default {
 | 
			
		|||
      })
 | 
			
		||||
        .then(response => {
 | 
			
		||||
          this.generateWindow()
 | 
			
		||||
          this.isLoadingFromServer = true
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
    generateWindow() {
 | 
			
		||||
| 
						 | 
				
			
			@ -485,23 +448,22 @@ export default {
 | 
			
		|||
 | 
			
		||||
      let isShowRecords = this.isShowedRecordNavigation
 | 
			
		||||
      if (isShowRecords === undefined) {
 | 
			
		||||
        if (['M', 'Q'].includes(this.windowMetadata.windowType) && this.getterRecordList >= 10) {
 | 
			
		||||
        if ((['M', 'Q'].includes(this.windowMetadata.windowType) && this.getterRecordList >= 10) ||
 | 
			
		||||
          this.$route.query.action === 'advancedQuery') {
 | 
			
		||||
          isShowRecords = true
 | 
			
		||||
        } else if (this.windowMetadata.windowType === 'T') {
 | 
			
		||||
          isShowRecords = false
 | 
			
		||||
        } else if (this.$route.query.action === 'advancedQuery') {
 | 
			
		||||
          isShowRecords = true
 | 
			
		||||
        }
 | 
			
		||||
        }
 | 
			
		||||
        this.handleChangeShowedRecordNavigation(!isShowRecords)
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      this.isLoaded = true
 | 
			
		||||
    },
 | 
			
		||||
    handleChangeShowedRecordNavigation(value) {
 | 
			
		||||
    handleChangeShowedRecordNavigation(valueToChange) {
 | 
			
		||||
      this.$store.dispatch('changeWindowAttribute', {
 | 
			
		||||
        parentUuid: this.windowUuid, // act as parentUuid
 | 
			
		||||
        attributeName: 'isShowedRecordNavigation',
 | 
			
		||||
        attributeValue: !value
 | 
			
		||||
        attributeValue: valueToChange
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    handleChangeShowedPanel(value) {
 | 
			
		||||
| 
						 | 
				
			
			@ -514,12 +476,6 @@ export default {
 | 
			
		|||
        attributeName: 'isShowedTabsChildren',
 | 
			
		||||
        attributeValue: !this.isShowedTabsChildren
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    getIsRecordLocked() {
 | 
			
		||||
      if (this.$store.getters.getRecordPrivateAccess(this.$route.params.tableName, this.$route.params.recordId)) {
 | 
			
		||||
        return true
 | 
			
		||||
      }
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue