zouyu
2023-12-25 63204f933e349118cee4636a2fd1da038e10d99c
	modified:   src/views/technology/document/index.vue
modified: src/views/technology/routing/index.vue
已修改2个文件
200 ■■■■ 文件已修改
src/views/technology/document/index.vue 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/technology/routing/index.vue 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/technology/document/index.vue
@@ -11,29 +11,6 @@
        ref="documentTable"
      >
        <template #toolbar>
          <!-- <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"
            v-if="permissions.technology_document_del"
            >批量删除</el-button
          >
          <!-- <el-button
            type="primary"
            @click="bindTestStandard"
@@ -337,40 +314,7 @@
            searchInfoType: 'datetimerange'
          }
        ],
        toolbar: [
          // {
          //   text: '复制',
          //   fun: this.copyDocument,
          //   disabled: false,
          //   permitArr: []
          // },
          /*,
          {
            text: '海缆OA',
            fun: () => {
              this.approveHandle(0)
            },
            disabled: false,
            permitArr: ['01draft', '04reject'],
            loading: false
          },
          {
            text: '陆缆OA',
            fun: () => {
              this.approveHandle(1)
            },
            disabled: false,
            permitArr: ['01draft', '04reject'],
            loading: false
          },
          {
            text: '导出word',
            type: 'primary',
            fun: this.exportWord,
            disabled: false,
            permitArr: []
          } */
        ],
        toolbar: [],
        operator: null,
        operatorConfig: {
          fixed: 'right',
@@ -441,7 +385,49 @@
  activated() {
    this.getData()
  },
  created() {
  created() {
    if(this.permissions.technology_document_add){
      this.table.toolbar.push({
        text: '新增',
        type: 'primary',
        disabled: true,
        fun: ()=>{this.addOrUpdateHandle()},
        permitArr: [],
      })
    }
    if(this.permissions.technology_document_accept){
      this.table.toolbar.push({
        text: '批准',
        disabled: true,
        fun: ()=>{this.changeState('accept')},
        permitArr: ['01draft', '03accepted', '04reject'],
      })
    }
    if(this.permissions.technology_document_reject){
      this.table.toolbar.push({
        text: '拒绝',
        disabled: true,
        fun: () => {this.changeState('reject')},
        permitArr: ['01draft', '03accepted', '04reject'],
      })
    }
    if(this.permissions.technology_document_cancel){
      this.table.toolbar.push({
        text: '撤销',
        disabled: true,
        fun: ()=>{this.changeState('cancel')},
        permitArr: ['01draft', '03accepted', '04reject'],
      })
    }
    if (this.permissions.technology_document_del) {
      this.table.toolbar.push({
        text: '批量删除',
        type: 'primary',
        disabled: false,
        fun: ()=>{this.deleteBatch()},
        permitArr: [],
      })
    }
    if (this.permissions.technology_document_del) {
      this.table.operator = [{
        text: '删除',
src/views/technology/routing/index.vue
@@ -12,23 +12,7 @@
        :ajaxFun="ajaxFun"
        ref="routingTable"
      >
        <template #toolbar>
          <el-button v-if="permissions.technology_routing_add"
          type="primary" @click="addOrUpdateHandle">新增</el-button>
          <el-button @click="() => {this.approveHandle('ACCEPT')}"
          :disabled="!uniqueStateArr.includes('01draft')"
          v-if="permissions.technology_routing_accept">批准</el-button>
          <el-button @click="() => {this.approveHandle('REVOKE')}"
          :disabled="!uniqueStateArr.includes('02accepted')"
          v-if="permissions.technology_routing_revoke">撤回</el-button>
          <el-button @click="() => {this.approveHandle('CANCEL')}"
          :disabled="!uniqueStateArr.includes('02accepted')"
          v-if="permissions.technology_routing_cancel">拒绝</el-button>
          <el-button @click="copyRouting"
          v-if="permissions.technology_routing_cancel">复制</el-button>
          <el-button @click="() => {this.deleteAll()}" type="primary"
          v-if="permissions.technology_routing_batch_del">批量删除</el-button>
        </template>
        <template #toolbar></template>
      </ttable>
      <el-dialog title="导入" :visible.sync="importRoutingVisible" width="50%">
        <span>
@@ -132,7 +116,6 @@
  data() {
    return {
      ids: [],
      uniqueStateArr: [],
      ajaxFun: fetchList,
      multipleSelection: [],
      isShowQuery: false,
@@ -435,6 +418,55 @@
    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,
        fun: ()=>{this.copyRouting()},
      })
    }
    if(this.permissions.technology_routing_del){
      this.table.operator = [
          {
@@ -575,22 +607,22 @@
          uniqueStateArr.push(stateArr[i])
        }
      }
      this.uniqueStateArr = uniqueStateArr
      // 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
    },