spring
2025-04-27 2a2d753357f4d3c26b3622513ffb6e647f64704a
src/views/technology/routing/index.vue
@@ -1,106 +1,48 @@
<template>
  <div class="mod-config">
    <basic-container>
      <ttable
        :table="table"
        @handleSelectionChange="handleSelectionChange"
        @customUploadPage="routingImport"
        :uploadInfo="uploadInfo"
        :customUpload="customUpload"
        :prelang="prelang"
        :options="options"
        :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>
      <ttable :table="table" @handleSelectionChange="handleSelectionChange" @customUploadPage="routingImport"
        :uploadInfo="uploadInfo" :customUpload="customUpload" :prelang="prelang" :options="options" :ajaxFun="ajaxFun"
        ref="routingTable">
        <template #toolbar></template>
      </ttable>
      <el-dialog title="导入" :visible.sync="importRoutingVisible" width="50%">
        <span>
          <div style="display:flex;justify-content:space-around;">
            <div>
              <el-upload
                style="margin-left:8px;display: inline;"
                class="upload-demo"
                drag
                :headers="headers"
                :action="zhuangbeiUploadInfo.url"
                :beforeUpload="beforeAvatarUpload"
                :limit="1"
                :show-file-list="false"
                :file-list="zhuangbeifileList"
                :data="zhuangbeiUploadInfo.uploadData"
                :on-success="zhuangbeiFileSuccessUploadScan"
                :on-error="handleError"
              <el-upload style="margin-left:8px;display: inline;" class="upload-demo" drag :headers="headers"
                :action="zhuangbeiUploadInfo.url" :beforeUpload="beforeAvatarUpload" :limit="1" :show-file-list="false"
                :file-list="zhuangbeifileList" :data="zhuangbeiUploadInfo.uploadData"
                :on-success="zhuangbeiFileSuccessUploadScan" :on-error="handleError"
                accept=".xlsx,.xls,.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
                :auto-upload="true"
                ref="zhuangbeiUploadScan"
                multiple
              >
                :auto-upload="true" ref="zhuangbeiUploadScan" 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="downZhuangbeiDataTemplate"
                    >下载模板</el-button
                  >
                  只能上传xlsx/xls文件,且不超过10M<el-button type="text" style="font-size:12px;"
                    @click="downZhuangbeiDataTemplate">下载模板</el-button>
                </div>
              </el-upload>
            </div>
            <div>
              <el-upload
                style="margin-left:8px;display: inline;"
                class="upload-demo"
                drag
                :headers="headers"
                :action="shepinUploadInfo.url"
                :beforeUpload="beforeAvatarUpload"
                :limit="1"
                :show-file-list="false"
                :file-list="shepinfileList"
                :data="shepinUploadInfo.uploadData"
                :on-success="shepinFileSuccessUploadScan"
                :on-error="handleError"
              <el-upload style="margin-left:8px;display: inline;" class="upload-demo" drag :headers="headers"
                :action="shepinUploadInfo.url" :beforeUpload="beforeAvatarUpload" :limit="1" :show-file-list="false"
                :file-list="shepinfileList" :data="shepinUploadInfo.uploadData"
                :on-success="shepinFileSuccessUploadScan" :on-error="handleError"
                accept=".xlsx,.xls,.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
                :auto-upload="true"
                ref="shepinUploadScan"
                multiple
              >
                :auto-upload="true" ref="shepinUploadScan" 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="downShepinDataTemplate"
                    >下载模板</el-button
                  >
                  只能上传xlsx/xls文件,且不超过10M<el-button type="text" style="font-size:12px;"
                    @click="downShepinDataTemplate">下载模板</el-button>
                </div>
              </el-upload>
            </div>
          </div>
        </span>
      </el-dialog>
      <partDialog
        :currshowlist.sync="showPart"
        @listenToPartEvent="selectPart"
      />
      <partDialog :currshowlist.sync="showPart" @listenToPartEvent="selectPart" />
    </basic-container>
  </div>
</template>
@@ -114,7 +56,6 @@
import {
  fetchList,
  delObj,
  changeState,
  changeStateBatch,
  exportRoutingTemplate,
  routingIfsSync,
@@ -138,7 +79,7 @@
      customUpload: true,
      uploadInfo: {
        // 是否展示上传EXCEL以及对应的url
        isShow: true,
        isShow: false,
        url: '/mes/routing/uploadExcel'
      },
      prelang: 'routing',
@@ -196,7 +137,7 @@
            noShowTip: false
          },
          // 是否为主工艺
          {
          /* {
            minWidth: '120',
            prop: 'master',
            label: '主工艺',
@@ -210,7 +151,7 @@
            formatter: (row, column, cellValue) => {
              return cellValue == true ? '是' : '否'
            }
          },
          }, */
          // 状态
          {
            minWidth: '120',
@@ -300,7 +241,7 @@
            searchInfoType: 'datetimerange'
          },
          // 替代
          {
          /* {
            minWidth: '120',
            prop: 'alternativeNo',
            label: '替代',
@@ -308,17 +249,17 @@
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          }, */
          // 替代描述
          {
            minWidth: '120',
            prop: 'alternativeDesc',
            label: '替代描述',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          /*  {
             minWidth: '120',
             prop: 'alternativeDesc',
             label: '替代描述',
             sort: true,
             isTrue: true,
             isSearch: true,
             searchInfoType: 'text'
           }, */
          // 是否已同步至IFS
          // {
          //   minWidth: '120',
@@ -356,65 +297,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 +375,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.deleteAll() },
      })
    }
    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,8 +467,12 @@
    },
    // 新增 / 修改
    addOrUpdateHandle(row) {
      if (!this.permissions.technology_routing_edit && row.id != null) {
        this.$message.error("该角色没有操作权限")
        return
      }
      this.$router.push({
        name: 'routingForm',
        path: '/technology/routing/routing-form',
        query: { id: row == null ? null : row.id }
      })
    },
@@ -521,7 +484,7 @@
        closeOnClickModal: false,
        type: 'warning'
      })
        .then(function() {
        .then(function () {
          const ids = []
          ids.push(row.id)
          return delObj(ids)
@@ -546,7 +509,7 @@
          type: 'warning',
          closeOnClickModal: false
        })
          .then(function() {
          .then(function () {
            const ids = that.multipleSelection.map((item) => {
              return item.id
            })
@@ -603,7 +566,7 @@
    handleSelectionChange(val) {
      // 根据状态,禁用表头按钮
      // 筛选出选中记录的状态
      var stateArr = val.map(function(value, index) {
      var stateArr = val.map(function (value, index) {
        return value.state
      })
      // 选中状态数组元素去重
@@ -613,6 +576,7 @@
          uniqueStateArr.push(stateArr[i])
        }
      }
      // this.uniqueStateArr = uniqueStateArr
      // 循环表头按钮,判断每个按钮的permitArr是否完全包含选中状态,若完全包含,则按钮亮,否则按钮灰
      var toolbar = this.table.toolbar
      for (var j = 0; j < toolbar.length; j++) {