王震
2023-12-26 09d9c957b47c488c4b25c3a14c82ea71623be670
src/views/technology/routing/index.vue
@@ -12,22 +12,7 @@
        :ajaxFun="ajaxFun"
        ref="routingTable"
      >
        <template #toolbar>
          <el-button
            v-if="permissions.technology_routing_ifssync"
            type="primary"
            :loading="ifsSynsLoading"
            @click="syncIfs"
            >IFS同步</el-button
          >
          <el-button
            v-if="permissions.technology_routing_advancecalc"
            type="primary"
            :loading="preCalcLoading"
            @click="calcTech"
            >提前计算</el-button
          >
        </template>
        <template #toolbar></template>
      </ttable>
      <el-dialog title="导入" :visible.sync="importRoutingVisible" width="50%">
        <span>
@@ -114,7 +99,6 @@
import {
  fetchList,
  delObj,
  changeState,
  changeStateBatch,
  exportRoutingTemplate,
  routingIfsSync,
@@ -138,7 +122,7 @@
      customUpload: true,
      uploadInfo: {
        // 是否展示上传EXCEL以及对应的url
        isShow: true,
        isShow: false,
        url: '/mes/routing/uploadExcel'
      },
      prelang: 'routing',
@@ -356,65 +340,8 @@
            searchInfoType: 'datetimerange'
          }
        ],
        toolbar: [
          {
            text: '新增',
            type: 'primary',
            fun: this.addOrUpdateHandle,
            disabled: false,
            permitArr: []
          },
          {
            text: '批准',
            fun: () => {
              this.approveHandle('ACCEPT')
            },
            disabled: false,
            permitArr: ['01draft']
          },
          {
            text: '撤回',
            fun: () => {
              this.approveHandle('REVOKE')
            },
            disabled: false,
            permitArr: ['02accepted']
          },
          {
            text: '拒绝',
            fun: () => {
              this.approveHandle('CANCEL')
            },
            disabled: false,
            permitArr: ['02accepted']
          },
          {
            text: '复制',
            fun: this.copyRouting,
            disabled: false,
            permitArr: []
          },
          {
            text: '删除',
            fun: () => {
              this.deleteAll()
            },
            disabled: false,
            permitArr: []
          }
        ],
        operator: [
          {
            text: '删除',
            type: 'text',
            size: 'small',
            fun: this.deleteHandle
            // show: {
            //   val: ['01draft'],
            //   key: 'state'
            // }
          }
        ],
        toolbar: [],
        operator: null,
        operatorConfig: {
          fixed: 'right',
          label: '操作',
@@ -491,7 +418,82 @@
    this.getData()
  },
  created() {
    if(this.permissions.technology_routing_add){
      this.table.toolbar.push({
        text: '新增',
        disabled: false,
        type: 'primary',
        fun: ()=>{this.addOrUpdateHandle()},
        permitArr: []
      })
    }
    if(this.permissions.technology_routing_accept){
      this.table.toolbar.push({
        text: '批准',
        disabled: true,
        fun: ()=>{this.approveHandle('ACCEPT')},
        permitArr: ['01draft'],
      })
    }
    if(this.permissions.technology_routing_revoke){
      this.table.toolbar.push({
        text: '撤回',
        disabled: true,
        fun: () => {this.approveHandle('REVOKE')},
        permitArr: ['02accepted'],
      })
    }
    if(this.permissions.technology_routing_cancel){
      this.table.toolbar.push({
        text: '拒绝',
        disabled: true,
        fun: ()=>{this.approveHandle('CANCEL')},
        permitArr: ['02accepted'],
      })
    }
    if(this.permissions.technology_routing_copy){
      this.table.toolbar.push({
        text: '复制',
        disabled: false,
        fun: ()=>{this.copyRouting()},
        permitArr: []
      })
    }
    if(this.permissions.technology_routing_batch_del){
      this.table.toolbar.push({
        text: '批量删除',
        type:'primary',
        disabled: false,
        permitArr: [],
        fun: ()=>{this.copyRouting()},
      })
    }
    if(this.permissions.technology_routing_del){
      this.table.operator = [
          {
            text: '删除',
            type: 'text',
            size: 'small',
            fun: this.deleteHandle
            // show: {
            //   val: ['01draft'],
            //   key: 'state'
            // }
          }
        ]
    }
    this.getBomTypeDbOptions()
  },
  watch:{
    multipleSelection(newVal){
      if(newVal.length==0){
        this.table.toolbar.forEach(ele=>{
          if(ele.text=='拒绝' || ele.text=='批准' || ele.text=='撤回'){
            ele.disabled = true
          }
        })
      }
    }
  },
  methods: {
    getData() {
@@ -508,6 +510,10 @@
    },
    // 新增 / 修改
    addOrUpdateHandle(row) {
      if(!this.permissions.technology_routing_edit && row.id!=null){
        this.$message.error("该角色没有操作权限")
        return
      }
      this.$router.push({
        name: 'routingForm',
        query: { id: row == null ? null : row.id }
@@ -613,6 +619,7 @@
          uniqueStateArr.push(stateArr[i])
        }
      }
      // this.uniqueStateArr = uniqueStateArr
      // 循环表头按钮,判断每个按钮的permitArr是否完全包含选中状态,若完全包含,则按钮亮,否则按钮灰
      var toolbar = this.table.toolbar
      for (var j = 0; j < toolbar.length; j++) {