zouyu
2023-12-21 a48ded866d223f581944ea9043df1b296b3425e3
src/views/technology/document/index.vue
@@ -14,6 +14,20 @@
          <!-- <el-button type="primary" :loading="ifsSynsLoading" @click="syncIfs"
            >ERP同步</el-button
          > -->
          <el-button v-if="permissions.technology_document_add"
          type="primary" @click="addOrUpdateHandle">新增</el-button>
          <el-button @click="() => {this.changeState('accept')}"
          :disabled="uniqueStateArr.includes(['01draft', '03accepted', '04reject'])"
          v-if="permissions.technology_document_accept">批准</el-button>
          <el-button @click="() => {this.changeState('reject')}"
          :disabled="uniqueStateArr.includes(['01draft', '03accepted', '04reject'])"
          v-if="permissions.technology_document_reject">拒绝</el-button>
          <el-button @click="() => {this.changeState('cancel')}"
          :disabled="uniqueStateArr.includes(['01draft', '03accepted', '04reject'])"
          v-if="permissions.technology_document_cancel">撤销</el-button>
          <el-button
            type="primary"
            @click="deleteBatch"
@@ -88,6 +102,7 @@
  data() {
    return {
      ids: [],
      uniqueStateArr: [],
      ajaxFun: fetchList,
      multipleSelection: [],
      isShowQuery: false,
@@ -239,7 +254,7 @@
            isSearch: true,
            searchInfoType: 'text'
          },
          {
          /* {
            minWidth: '120',
            prop: 'projectType',
            label: '项目类别',
@@ -271,7 +286,7 @@
            isSearch: true,
            searchInfoType: 'text'
          },
 */
          // 描述
          {
            minWidth: '120',
@@ -323,43 +338,12 @@
          }
        ],
        toolbar: [
          {
            text: '新增',
            type: 'primary',
            fun: this.addOrUpdateHandle,
            disabled: false,
            permitArr: []
          },
          // {
          //   text: '复制',
          //   fun: this.copyDocument,
          //   disabled: false,
          //   permitArr: []
          // },
          {
            text: '批准',
            fun: () => {
              this.changeState('accept')
            },
            disabled: false,
            permitArr: ['01draft', '03accepted', '04reject']
          },
          {
            text: '拒绝',
            fun: () => {
              this.changeState('reject')
            },
            disabled: false,
            permitArr: ['01draft', '03accepted', '04reject']
          },
          {
            text: '撤销',
            fun: () => {
              this.changeState('cancel')
            },
            disabled: false,
            permitArr: ['01draft', '03accepted', '04reject']
          }
          /*,
          {
            text: '海缆OA',
@@ -387,7 +371,7 @@
            permitArr: []
          } */
        ],
        operator: [],
        operator: null,
        operatorConfig: {
          fixed: 'right',
          label: '操作',
@@ -458,9 +442,8 @@
    this.getData()
  },
  created() {
    this.getBomTypeDbOptions()
    if (this.permissions.technology_document_del) {
      this.table.operator.push({
      this.table.operator = [{
        text: '删除',
        type: 'text',
        size: 'small',
@@ -469,19 +452,9 @@
          val: ['01draft'],
          key: 'state'
        }
      })
    } else {
      this.table.operator.push({
        text: '删除',
        type: 'text',
        size: 'small',
        fun: this.deleteHandle,
        show: {
          val: [],
          key: 'state'
        }
      })
    }
      }]
    }
    this.getBomTypeDbOptions()
  },
  methods: {
    getBomTypeDbOptions() {
@@ -523,6 +496,10 @@
    },
    // 新增 / 修改
    addOrUpdateHandle(row) {
      if(!this.permissions.technology_document_edit && row.id!=null){
        this.$message.error("该角色没有操作权限")
        return
      }
      this.$router.push({
        name: 'documentForm',
        query: { id: row == null ? null : row.id }
@@ -585,21 +562,22 @@
          uniqueStateArr.push(stateArr[i])
        }
      }
      this.uniqueStateArr = uniqueStateArr
      // 循环表头按钮,判断每个按钮的permitArr是否完全包含选中状态,若完全包含,则按钮亮,否则按钮灰
      var toolbar = this.table.toolbar
      for (var j = 0; j < toolbar.length; j++) {
        if (
          uniqueStateArr.every((val) =>
            toolbar[j].permitArr.length <= 0
              ? true
              : toolbar[j].permitArr.includes(val)
          )
        ) {
          toolbar[j].disabled = false
        } else {
          toolbar[j].disabled = true
        }
      }
      // var toolbar = this.table.toolbar
      // for (var j = 0; j < toolbar.length; j++) {
      //   if (
      //     uniqueStateArr.every((val) =>
      //       toolbar[j].permitArr.length <= 0
      //         ? true
      //         : toolbar[j].permitArr.includes(val)
      //     )
      //   ) {
      //     toolbar[j].disabled = false
      //   } else {
      //     toolbar[j].disabled = true
      //   }
      // }
      // 将选中记录赋值给multipleSelection
      this.multipleSelection = val
    },