spring
2025-04-27 c85ea17d45adac17b780992e049685d72168fdda
src/views/technology/document/index.vue
@@ -1,25 +1,9 @@
<template>
  <div class="mod-config">
    <basic-container>
      <ttable
        :table="table"
        @handleSelectionChange="handleSelectionChange"
        @tableRowClassName="tableRowClassName"
        :prelang="prelang"
        :options="options"
        :ajaxFun="ajaxFun"
        ref="documentTable"
      >
      <ttable :table="table" @handleSelectionChange="handleSelectionChange" @tableRowClassName="tableRowClassName"
        :prelang="prelang" :options="options" :ajaxFun="ajaxFun" ref="documentTable">
        <template #toolbar>
          <!-- <el-button type="primary" :loading="ifsSynsLoading" @click="syncIfs"
            >ERP同步</el-button
          > -->
          <el-button
            type="primary"
            @click="deleteBatch"
            v-if="permissions.technology_document_del"
            >批量删除</el-button
          >
          <!-- <el-button
            type="primary"
            @click="bindTestStandard"
@@ -28,38 +12,18 @@
          > -->
        </template>
      </ttable>
      <el-dialog
        title="导入"
        :visible.sync="importTestStandardVisible"
        width="50%"
      >
      <el-dialog title="导入" :visible.sync="importTestStandardVisible" width="50%">
        <div>
          <el-upload
            style="margin-left:8px;display: inline;"
            class="upload-demo"
            drag
            :headers="headers"
            :action="testStandardUploadInfo.url"
            :beforeUpload="beforeAvatarUpload"
            :limit="1"
            :show-file-list="false"
            :file-list="testStandardFileList"
            :on-success="testStandardFileSuccessUploadScan"
            :on-error="handleError"
          <el-upload style="margin-left:8px;display: inline;" class="upload-demo" drag :headers="headers"
            :action="testStandardUploadInfo.url" :beforeUpload="beforeAvatarUpload" :limit="1" :show-file-list="false"
            :file-list="testStandardFileList" :on-success="testStandardFileSuccessUploadScan" :on-error="handleError"
            accept=".xlsx,.xls,.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
            :auto-upload="true"
            ref="testStandardUploadScan"
            multiple
          >
            :auto-upload="true" ref="testStandardUploadScan" multiple>
            <i class="el-icon-upload"></i>
            <div class="el-upload__text"><em>导入数据</em></div>
            <div class="el-upload__tip" slot="tip">
              只能上传xlsx/xls文件,且不超过10M<el-button
                type="text"
                style="font-size:12px;"
                @click="downTestStandardDataTemplate"
                >下载模板</el-button
              >
              只能上传xlsx/xls文件,且不超过10M<el-button type="text" style="font-size:12px;"
                @click="downTestStandardDataTemplate">下载模板</el-button>
            </div>
          </el-upload>
        </div>
@@ -239,7 +203,7 @@
            isSearch: true,
            searchInfoType: 'text'
          },
          {
          /* {
            minWidth: '120',
            prop: 'projectType',
            label: '项目类别',
@@ -271,7 +235,7 @@
            isSearch: true,
            searchInfoType: 'text'
          },
 */
          // 描述
          {
            minWidth: '120',
@@ -322,72 +286,8 @@
            searchInfoType: 'datetimerange'
          }
        ],
        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',
            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: []
          } */
        ],
        operator: [],
        toolbar: [],
        operator: null,
        operatorConfig: {
          fixed: 'right',
          label: '操作',
@@ -458,9 +358,50 @@
    this.getData()
  },
  created() {
    this.getBomTypeDbOptions()
    if (this.permissions.technology_document_add) {
      this.table.toolbar.push({
        text: '新增',
        type: 'primary',
        disabled: false,
        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.operator.push({
      this.table.toolbar.push({
        text: '批量删除',
        type: 'primary',
        disabled: false,
        fun: () => { this.deleteBatch() },
        permitArr: [],
      })
    }
    if (this.permissions.technology_document_del) {
      this.table.operator = [{
        text: '删除',
        type: 'text',
        size: 'small',
@@ -469,18 +410,19 @@
          val: ['01draft'],
          key: 'state'
        }
      })
    } else {
      this.table.operator.push({
        text: '删除',
        type: 'text',
        size: 'small',
        fun: this.deleteHandle,
        show: {
          val: [],
          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: {
@@ -509,7 +451,7 @@
        that.multipleSelection.forEach((item) => {
          ids.push(item.id)
        })
        changeState(ids, event).then(function() {
        changeState(ids, event).then(function () {
          that.getData()
        })
      } else {
@@ -523,8 +465,12 @@
    },
    // 新增 / 修改
    addOrUpdateHandle(row) {
      if (!this.permissions.technology_document_edit && row.id != null) {
        this.$message.error("该角色没有操作权限")
        return
      }
      this.$router.push({
        name: 'documentForm',
        path: '/technology/document/document-form',
        query: { id: row == null ? null : row.id }
      })
    },
@@ -536,7 +482,7 @@
        closeOnClickModal: false,
        type: 'warning'
      })
        .then(function() {
        .then(function () {
          return delObj(row.id)
        })
        .then((response) => {
@@ -575,7 +521,7 @@
    handleSelectionChange(val) {
      // 根据状态,禁用表头按钮
      // 筛选出选中记录的状态
      var stateArr = val.map(function(value, index) {
      var stateArr = val.map(function (value, index) {
        return value.state
      })
      // 选中状态数组元素去重
@@ -609,7 +555,7 @@
      var selectVals = []
      if (val != null) {
        selectVals.push(val)
        var stateArr = selectVals.map(function(value, index) {
        var stateArr = selectVals.map(function (value, index) {
          return value.state
        })
        // 选中状态数组元素去重