loulijun2021
2023-12-15 1cc0d7fbe0a61617de913b30f557de205c1a6f88
1.设备点检、保养  导入
已修改5个文件
396 ■■■■■ 文件已修改
src/views/deviceManager/checkPosition.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/deviceManager/checkStandard.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/deviceManager/maintainPosition.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/deviceManager/maintainStandard.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/dataImport.vue 388 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/deviceManager/checkPosition.vue
@@ -3,7 +3,7 @@
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup" style="justify-content: space-between">
        <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
        <!--        <el-button v-waves icon="el-icon-download" @click="upload">导入</el-button>-->
        <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=10')">导入</el-button>
      </div>
      <div class="bodyTopFormGroup">
src/views/deviceManager/checkStandard.vue
@@ -3,7 +3,7 @@
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup" style="justify-content: space-between">
        <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
        <!--        <el-button v-waves icon="el-icon-download" @click="upload">导入</el-button>-->
        <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=10_1')">导入</el-button>
      </div>
      <div class="bodyTopFormGroup">
src/views/deviceManager/maintainPosition.vue
@@ -3,7 +3,7 @@
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup" style="justify-content: space-between">
        <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
        <!--        <el-button v-waves icon="el-icon-download" @click="upload">导入</el-button>-->
        <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=11')">导入</el-button>
      </div>
      <div class="bodyTopFormGroup">
src/views/deviceManager/maintainStandard.vue
@@ -3,7 +3,7 @@
    <div class="body" :style="{height:mainHeight+'px'}">
      <div class="bodyTopButtonGroup" style="justify-content: space-between">
        <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">新增</el-button>
        <!--        <el-button v-waves icon="el-icon-download" @click="upload">导入</el-button>-->
        <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=11_1')">导入</el-button>
      </div>
      <div class="bodyTopFormGroup">
src/views/systemSetting/dataImport.vue
@@ -139,7 +139,12 @@
                    item.indexOf('项序号')!==-1||
                    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="请输入" />
@@ -194,6 +199,9 @@
                </div>
                <div
                  v-else-if="
                    item.indexOf('点检管控')!==-1||
                      item.indexOf('选择扫码')!==-1||
                      item.indexOf('是否扫码')!==-1||
                    item.indexOf('库位管理')!==-1||
                      item.indexOf('是否外购')!==-1||
                      item.indexOf('是否销售')!==-1||
@@ -211,6 +219,24 @@
                  >
                    <el-option
                      v-for="item in isYesOrNo"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    />
                  </el-select>
                </div>
                <div
                  v-else-if="item.indexOf('点检周期')!==-1||
                    item.indexOf('保养周期')!==-1"
                >
                  <el-select
                    v-model="row[item]"
                    style="width: 100%;"
                    placeholder="请选择"
                  >
                    <el-option
                      v-for="item in cycleArr"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
@@ -346,13 +372,13 @@
            label="序号"
          />
          <el-table-column
            prop="errorField"
            prop="ErrorField"
            label="错误字段"
            width="160"
            show-overflow-tooltip
          />
          <el-table-column
            prop="errorCont"
            prop="ErrorCont"
            show-overflow-tooltip
            label="错误原因"
          />
@@ -426,6 +452,14 @@
      meterMethodArr: [
        { code: 'S', name: '单计量' },
        { code: 'M', name: '多计量' }
      ],
      cycleArr: [
        { code: '年', name: '年' },
        { code: '季', name: '季' },
        { code: '月', name: '月' },
        { code: '周', name: '周' },
        { code: '日', name: '日' }
      ],
      activeName: '0'// tab选中值
@@ -579,19 +613,61 @@
      }
      if (this.sheetName.indexOf('模具点检标准') !== -1) {
        // this.statusArr = [
        //   { code: 'Y', name: '正常' },
        //   { code: 'N', name: '故障' }
        // ]
        this.tableData[0].forEach(j => {
          j.uuid = nanoid()
          // j['*状态'] = j['*状态'] ? this.statusArr.find(e => e.name === j['*状态']).code : ''
        })
        this.tableData[1].forEach(j => {
          j.uuid = nanoid()
        })
      }
      if (this.sheetName.indexOf('设备点检项目') !== -1) {
        this.isYesOrNo = [
          { code: '是', name: '是' },
          { code: '否', name: '否' }
        ]
        this.tableData[0].forEach(j => {
          j.uuid = nanoid()
          j['*点检周期'] = j['*点检周期'] ? this.cycleArr.find(e => e.name === j['*点检周期']).code : ''
          j['*是否扫码'] = j['*是否扫码'] ? this.isYesOrNo.find(e => e.name === j['*是否扫码']).code : ''
        })
      }
      if (this.sheetName.indexOf('设备点检标准') !== -1) {
        this.isYesOrNo = [
          { code: 'Y', name: 'Y' },
          { code: 'N', name: 'N' }
        ]
        this.cycleArr = [
          { code: '日', name: '日' }
        ]
        this.tableData[0].forEach(j => {
          j.uuid = nanoid()
        })
        this.tableData[1].forEach(j => {
          j.uuid = nanoid()
        })
      }
      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()
          j['*是否扫码'] = j['*是否扫码'] ? this.isYesOrNo.find(e => e.name === j['*是否扫码']).code : ''
        })
      }
    //
    },
    // 提交
    submit() {
@@ -701,6 +777,34 @@
          if (this.sheetName.indexOf('模具保养标准') !== -1) {
            const res = this.handleMouldMaintainStandSubmitData()
            if (res.code !== '200') {
              return this.$message.info(res.message)
            }
          }
          if (this.sheetName.indexOf('设备点检项目') !== -1) {
            const res = this.handleCheckPositionSubmitData()
            if (res.code !== '200') {
              return this.$message.info(res.message)
            }
          }
          if (this.sheetName.indexOf('设备点检标准') !== -1) {
            const res = this.handleCheckStandardSubmitData()
            if (res.code !== '200') {
              return this.$message.info(res.message)
            }
          }
          if (this.sheetName.indexOf('设备保养项目') !== -1) {
            const res = this.handleMaintainPositionSubmitData()
            if (res.code !== '200') {
              return this.$message.info(res.message)
            }
          }
          if (this.sheetName.indexOf('设备保养标准') !== -1) {
            const res = this.handleMaintainStandardSubmitData()
            if (res.code !== '200') {
              return this.$message.info(res.message)
            }
@@ -1472,6 +1576,202 @@
      return { code: '200', message: '成功!' }
    },
    // 处理设备点检项目提交数据
    handleCheckPositionSubmitData() {
      let flag = true
      let msg = ''
      if ([...new Set(this.tableData[0].map(i => i['*点检项目编号(唯一)']))].length !== this.tableData[0].length) {
        return this.$message.info('编码不能重复!')
      }
      this.tableData[0].forEach(j => {
        if (!j['*点检项目编号(唯一)']) {
          flag = false
          msg = '*点检项目编号(唯一)'
        }
        if (!j['*点检项目名称']) {
          flag = false
          msg = '*点检项目名称'
        }
        if (!j['*点检周期']) {
          flag = false
          msg = '*点检周期'
        }
        if (!j['*是否扫码']) {
          flag = false
          msg = '*是否扫码'
        }
      })
      if (!flag) {
        return { code: '301', message: msg + '不能为空!' }
      }
      this.tableData[0].map(item => {
        delete (item.uuid)
      })
      return { code: '200', message: '成功!' }
    },
    // 处理设备点检标准提交数据
    handleCheckStandardSubmitData() {
      let flag = true
      let msg = ''
      if ([...new Set(this.tableData[0].map(i => i['*设备点检标准编号(唯一)']))].length !== this.tableData[0].length) {
        return this.$message.info('设备点检标准编号不能重复!')
      }
      // if ([...new Set(this.tableData[1].map(i => i['*模具保养标准编号']))].length !== this.tableData[1].length) {
      //   return this.$message.info('模具保养标准编号不能重复!')
      // }
      this.tableData[0].forEach(j => {
        if (!j['*设备点检标准编号(唯一)']) {
          flag = false
          msg = '*设备点检标准编号(唯一)不能为空!'
        }
        if (!j['*设备点检标准名称']) {
          flag = false
          msg = '*设备点检标准名称不能为空!'
        }
        if (!j['*点检管控']) {
          flag = false
          msg = '*点检管控不能为空!'
        }
      })
      this.tableData[1].forEach(j => {
        if (!j['*点检项序号']) {
          flag = false
          msg = '*点检项序号不能为空!'
        }
        if (!j['*设备点检标准编号(M)']) {
          flag = false
          msg = '*设备点检标准编号(M)不能为空!'
        }
        if (!j['*设备点检部位编号(唯一)']) {
          flag = false
          msg = '*设备点检部位编号(唯一)不能为空!'
        }
        if (!j['*设备点检部位名称']) {
          flag = false
          msg = '*设备点检部位名称不能为空!'
        }
        if (!j['*选择扫码']) {
          flag = false
          msg = '*选择扫码不能为空!'
        }
        if (!j['*点检周期']) {
          flag = false
          msg = '*点检周期不能为空!'
        }
      })
      if (!flag) {
        return { code: '301', message: msg }
      }
      this.tableData[0].map(item => {
        delete (item.uuid)
      })
      this.tableData[1].map(item => {
        delete (item.uuid)
      })
      return { code: '200', message: '成功!' }
    },
    // 处理设备保养项目提交数据
    handleMaintainPositionSubmitData() {
      let flag = true
      let msg = ''
      if ([...new Set(this.tableData[0].map(i => i['*保养项目编号(唯一)']))].length !== this.tableData[0].length) {
        return this.$message.info('编码不能重复!')
      }
      this.tableData[0].forEach(j => {
        if (!j['*保养项目编号(唯一)']) {
          flag = false
          msg = '*保养项目编号(唯一)'
        }
        if (!j['*保养项目名称']) {
          flag = false
          msg = '*保养项目名称'
        }
        if (!j['*是否扫码']) {
          flag = false
          msg = '*是否扫码'
        }
      })
      if (!flag) {
        return { code: '301', message: msg + '不能为空!' }
      }
      this.tableData[0].map(item => {
        delete (item.uuid)
      })
      return { code: '200', message: '成功!' }
    },
    // 处理设备保养标准提交数据
    handleMaintainStandardSubmitData() {
      let flag = true
      let msg = ''
      if ([...new Set(this.tableData[0].map(i => i['*设备保养标准编号(唯一)']))].length !== this.tableData[0].length) {
        return this.$message.info('设备保养标准编号不能重复!')
      }
      // if ([...new Set(this.tableData[1].map(i => i['*模具保养标准编号']))].length !== this.tableData[1].length) {
      //   return this.$message.info('模具保养标准编号不能重复!')
      // }
      this.tableData[0].forEach(j => {
        if (!j['*设备保养标准编号(唯一)']) {
          flag = false
          msg = '*设备保养标准编号(唯一)不能为空!'
        }
        if (!j['*设备保养标准名称']) {
          flag = false
          msg = '*设备保养标准名称不能为空!'
        }
        if (!j['*保养周期']) {
          flag = false
          msg = '*保养周期不能为空!'
        }
      })
      this.tableData[1].forEach(j => {
        if (!j['*保养项序号']) {
          flag = false
          msg = '*点检项序号不能为空!'
        }
        if (!j['*设备保养标准编号(M)']) {
          flag = false
          msg = '*设备保养标准编号(M)不能为空!'
        }
        if (!j['*设备保养部位编号(唯一)']) {
          flag = false
          msg = '*设备保养部位编号(唯一)不能为空!'
        }
        if (!j['*设备保养部位名称']) {
          flag = false
          msg = '*设备保养部位名称不能为空!'
        }
        if (!j['*选择扫码']) {
          flag = false
          msg = '*选择扫码不能为空!'
        }
      })
      if (!flag) {
        return { code: '301', message: msg }
      }
      this.tableData[0].map(item => {
        delete (item.uuid)
      })
      this.tableData[1].map(item => {
        delete (item.uuid)
      })
      return { code: '200', message: '成功!' }
    },
    // parents:用于返回的数组,childNode:要查询的节点,treeData:json树形数据
    findParent(parents, childNode, treeData) {
@@ -1730,6 +2030,76 @@
          '保养项要求': ''
        })
      }
      //  设备点检项目
      if (this.sheetName.indexOf('设备点检项目') !== -1) {
        this.tableData[0].unshift({
          uuid: nanoid(),
          '*点检项目编号(唯一)': '',
          '*点检项目名称': '',
          '*点检周期': '',
          '*是否扫码': '',
          '点检项目要求': ''
        })
      }
      // 设备点检标准
      if (this.sheetName.indexOf('设备点检标准') !== -1 && this.activeName === '0') {
        this.tableData[0].unshift({
          uuid: nanoid(),
          '*设备点检标准编号(唯一)': '',
          '*设备点检标准名称': '',
          '*点检管控': '',
          '标准描述': ''
        })
      }
      if (this.sheetName.indexOf('设备点检部位') !== -1 && this.activeName === '1') {
        this.tableData[1].unshift({
          uuid: nanoid(),
          '*设备点检标准编号(M)': '',
          '*点检项序号': '',
          '*设备点检部位编号(唯一)': '',
          '*设备点检部位名称': '',
          '点检部位要求': '',
          '*选择扫码': '',
          '*点检周期': ''
        })
      }
      //  设备点检项目
      if (this.sheetName.indexOf('设备保养项目') !== -1) {
        this.tableData[0].unshift({
          uuid: nanoid(),
          '*保养项目编号(唯一)': '',
          '*保养项目名称': '',
          '*是否扫码': '',
          '保养项目要求': ''
        })
      }
      // 设备保养标准
      if (this.sheetName.indexOf('设备保养标准') !== -1 && this.activeName === '0') {
        this.tableData[0].unshift({
          uuid: nanoid(),
          '*设备保养标准编号(唯一)': '',
          '*设备保养标准名称': '',
          '*保养周期': '',
          '标准描述': ''
        })
      }
      if (this.sheetName.indexOf('设备保养部位') !== -1 && this.activeName === '1') {
        this.tableData[1].unshift({
          uuid: nanoid(),
          '*保养项序号': '',
          '*设备保养标准编号(M)': '',
          '*设备保养部位编号(唯一)': '',
          '*设备保养部位名称': '',
          '保养部位要求': '',
          '*选择扫码': ''
        })
      }
    //
    },
    delRow(row) {
      // 针对单sheet