loulijun2021
2024-03-22 e232ce8f6b8d3a5784c4eb6b880c8bb04c9981c8
src/views/systemSetting/dataImport.vue
@@ -144,7 +144,10 @@
                    item.indexOf('保养部位要求')!==-1||
                    item.indexOf('保养项目要求')!==-1||
                    item.indexOf('点检部位要求')!==-1||
                    item.indexOf('点检项目要求')!==-1
                    item.indexOf('点检项目要求')!==-1||
                    item.indexOf('仓库编码')!==-1||
                    item.indexOf('库位编码')!==-1
                  "
                >
                  <el-input v-model="row[item]" placeholder="请输入" />
@@ -346,7 +349,7 @@
      v-el-drag-dialog
      title="失败原因"
      :visible.sync="dialogVisible"
      width="1000px"
      width="1300px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleClose"
@@ -374,7 +377,7 @@
          <el-table-column
            prop="ErrorField"
            label="错误字段"
            width="160"
            width="200"
            show-overflow-tooltip
          />
          <el-table-column
@@ -549,6 +552,17 @@
        })
      }
      if (this.sheetName.indexOf('库位设置') !== -1) {
        this.statusArr = [
          { code: '0', name: '正常' },
          { code: '1', name: '停用' }
        ]
        this.tableData[0].forEach(j => {
          j['*状态'] = j['*状态'] ? this.statusArr.find(e => e.name === j['*状态']).code : ''
          j.uuid = nanoid()
        })
      }
      if (this.sheetName.indexOf('存货分类') !== -1) {
        this.statusArr = [
          { code: '0', name: '正常' },
@@ -667,7 +681,26 @@
        })
      }
    //
      if (this.sheetName.indexOf('设备保养标准') !== -1) {
        this.isYesOrNo = [
          { code: 'Y', name: 'Y' },
          { code: 'N', name: 'N' }
        ]
        this.cycleArr = [
          { code: '年', name: '年' },
          { code: '季', name: '季' },
          { code: '月', name: '月' },
          { code: '周', name: '周' }
        ]
        this.tableData[0].forEach(j => {
          j.uuid = nanoid()
        })
        this.tableData[1].forEach(j => {
          j.uuid = nanoid()
        })
      }
      //
    },
    // 提交
    submit() {
@@ -809,6 +842,9 @@
              return this.$message.info(res.message)
            }
          }
          // 数据提交前去除空格方法
          // this.tableDataTrim()
          const data = {
            fileCode: this.excelCode,
@@ -1391,6 +1427,14 @@
          flag = false
          msg = '*状态不能为空!'
        }
        if (!j['*仓库编码']) {
          flag = false
          msg = '*仓库编码不能为空!'
        }
        if (!j['*库位编码']) {
          flag = false
          msg = '*库位编码不能为空!'
        }
      })
      this.tableData[1].forEach(j => {
        if (!j['模具编码'] && j['产品编码']) {
@@ -1959,8 +2003,11 @@
          '*模具名称': '',
          '规格型号': '',
          '*状态': 'Y',
          '*仓库编码': '',
          '*库位编码': '',
          '预计寿命(次)': '',
          '剩余寿命(次)': ''
        })
      }
      if (this.sheetName.indexOf('模具关联产品') !== -1 && this.activeName === '1') {
@@ -2099,7 +2146,7 @@
        })
      }
    //
      //
    },
    delRow(row) {
      // 针对单sheet
@@ -2149,7 +2196,9 @@
    // 模板下载
    async getExcel() {
      const res = await DownLoadExcel({ FileCode: this.excelCode })
      window.location.href = res.data
      if (res.code === '200') {
        window.location.href = res.data
      }
    },
    async getSelectArr() {
      await this.getPrentOrganization()
@@ -2222,6 +2271,29 @@
          h('span', { style: 'color:#FFF' }, column.label)
        ]
      }
    },
    // 数据提交前去除空格方法
    tableDataTrim() {
      if (this.tableData.length === 1) { // 一个sheet
        this.tableData[0].forEach(i => {
          for (const j in i) {
            i[j] = i[j].trim()
          }
        })
      }
      if (this.tableData.length === 2) { // 两个sheet
        this.tableData[0].forEach(i => {
          for (const j in i) {
            i[j] = i[j].trim()
          }
        })
        this.tableData[1].forEach(i => {
          for (const j in i) {
            i[j] = i[j].trim()
          }
        })
      }
    }
  }
@@ -2230,7 +2302,7 @@
<style lang="scss">
::v-deep .el-dialog__body {
  padding: 20px 20px !important;
  padding: 10px 10px !important;
}
</style>