loulijun2021
2023-12-19 f05ec4caf6d61a0eb96447bae7de4ef5fad25beb
1.模板导入新增去空格方法
已修改1个文件
53 ■■■■■ 文件已修改
src/views/systemSetting/dataImport.vue 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/dataImport.vue
@@ -346,7 +346,7 @@
      v-el-drag-dialog
      title="失败原因"
      :visible.sync="dialogVisible"
      width="1000px"
      width="1300px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleClose"
@@ -374,7 +374,7 @@
          <el-table-column
            prop="ErrorField"
            label="错误字段"
            width="160"
            width="200"
            show-overflow-tooltip
          />
          <el-table-column
@@ -667,6 +667,25 @@
        })
      }
      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()
        })
      }
    //
    },
    // 提交
@@ -809,6 +828,9 @@
              return this.$message.info(res.message)
            }
          }
          // 数据提交前去除空格方法
          this.tableDataTrim()
          const data = {
            fileCode: this.excelCode,
@@ -2222,6 +2244,31 @@
          h('span', { style: 'color:#FFF' }, column.label)
        ]
      }
    },
    // 数据提交前去除空格方法
    tableDataTrim() {
      if (this.tableData.length === 1) { // 一个sheet
        this.tableData[0].forEach(i => {
          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 +2277,7 @@
<style lang="scss">
::v-deep .el-dialog__body {
  padding: 20px 20px !important;
  padding: 10px 10px !important;
}
</style>