王震
2023-12-27 b1dbfd44f6bafaa4d24e0c1c3a0f7ae548e77f60
src/views/technology/structure/index.vue
@@ -6,92 +6,18 @@
        @handleSelectionChange="handleSelectionChange"
        @customUploadPage="structureImport"
        :uploadInfo="uploadInfo"
        :customUpload="customUpload"
        :prelang="prelang"
        :options="options"
        :ajaxFun="ajaxFun"
        ref="structureTable"
      >
        <template #toolbar>
          <el-button type="primary" :loading="ifsSynsLoading" @click="syncIfs"
            >ERP同步</el-button
          >
          <el-button type="primary" @click="addOrUpdateHandle"
          v-if="permissions.technology_structure_add">新增</el-button>
          <el-button type="primary" @click="copyStructure"
          v-if="permissions.technology_structure_copy">复制</el-button>
        </template>
      </ttable>
      <!-- 弹窗, 新增 / 修改 -->
      <!--<table-form v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getData"></table-form>-->
      <el-dialog
        title="导入"
        :visible.sync="importStructureVisible"
        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"
                accept=".xlsx,.xls,.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
                :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
                  >
                </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"
                accept=".xlsx,.xls,.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
                :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
                  >
                </div>
              </el-upload>
            </div>
          </div>
        </span>
      </el-dialog>
    </basic-container>
  </div>
</template>
@@ -130,7 +56,9 @@
      uploadInfo: {
        // 是否展示上传EXCEL以及对应的url
        isShow: true,
        url: '/mes/structure/uploadExt'
        fileName: '产品结构模板',
        download: true,
        url: '/mes/structure/uploadExcelPlus'
      },
      prelang: 'structure',
      options: {
@@ -185,39 +113,39 @@
            searchInfoType: 'text'
          },
          // 结构类型
          {
            minWidth: '120',
            prop: 'bomTypeDb',
            label: '结构类型',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'select',
            formatter: this.formatBomTypeDbType,
            optList: () => {
              return this.bomTypeDbOptions
            }
          },
          // {
          //   minWidth: '120',
          //   prop: 'bomTypeDb',
          //   label: '结构类型',
          //   sort: true,
          //   isTrue: true,
          //   isSearch: true,
          //   searchInfoType: 'select',
          //   formatter: this.formatBomTypeDbType,
          //   optList: () => {
          //     return this.bomTypeDbOptions
          //   }
          // },
          // 替代
          {
            minWidth: '120',
            prop: 'alternativeNo',
            label: '替代',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          // {
          //   minWidth: '120',
          //   prop: 'alternativeNo',
          //   label: '替代',
          //   sort: true,
          //   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'
          // },
          // 是否已同步至ERP
          {
            minWidth: '120',
@@ -235,7 +163,7 @@
            }
          },
          // 是否为默认结构
          {
          /* {
            minWidth: '120',
            prop: 'master',
            label: '默认结构',
@@ -249,7 +177,7 @@
            formatter: (row, column, cellValue) => {
              return cellValue == true ? '是' : '否'
            }
          },
          }, */
          // 描述
          {
            minWidth: '120',
@@ -262,30 +190,8 @@
            noShowTip: false
          }
        ],
        toolbar: [
          {
            text: '新增',
            // icon: 'el-icon-plus',
            type: 'primary',
            fun: this.addOrUpdateHandle,
            disabled: false,
            permitArr: []
          },
          {
            text: '复制',
            fun: this.copyStructure,
            disabled: false,
            permitArr: []
          }
        ],
        operator: [
          {
            text: '删除',
            type: 'text',
            size: 'small',
            fun: this.deleteHandle
          }
        ],
        toolbar: [],
        operator: null,
        operatorConfig: {
          fixed: 'right',
          label: '操作',
@@ -323,11 +229,6 @@
        isShow: true,
        url: '/mes/structure/upload'
      },
      zhuangbeiUploadInfo: {
        // 是否展示上传EXCEL以及对应的url
        isShow: true,
        url: '/mes/structure/uploadExt'
      },
      zhuangbeifileList: [],
      shepinfileList: [],
      ifsSynsLoading: false
@@ -345,6 +246,17 @@
    this.getData()
  },
  created() {
    if(this.permissions.technology_structure_del){
      this.table.operator = [
          {
            text: '删除',
            type: 'text',
            size: 'small',
            fun: this.deleteHandle
          }
        ]
    }
    this.uploadInfo.isShow = this.permissions.technology_structure_upload
    this.table.column.find((e) => e.label === '已同步至ERP').isTrue = false
    this.getBomTypeDbOptions()
  },
@@ -364,11 +276,14 @@
    },
    // 新增 / 修改
    addOrUpdateHandle(row) {
      if(!this.permissions.technology_structure_edit && row.id!=null){
        this.$message.error("该角色没有操作权限")
        return
      }
      this.$router.push({
        name: 'singleStructureForm',
        params: { id: row == null ? null : row.id }
      })
      // this.$router.push({name:"structureForm",query:{id:row==null?null:row.id}})
    },
    // 删除
    deleteHandle(row) {
@@ -487,8 +402,9 @@
        this.$message.warning(response.msg)
      } else {
        this.$message({
          message: '上传成功',
          type: 'success'
          message: response.data,
          type: 'success',
          dangerouslyUseHTMLString: true
        })
        this.getData()
      }