loulijun2021
2023-09-26 089a8067eae3980cc9f247d2e65bb5c10aa1bd99
1.缺陷定义100%
已重命名1个文件
已添加1个文件
已修改3个文件
437 ■■■■■ 文件已修改
src/api/QualityManagement.js 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicSettings/processList.vue 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManager/defectDefine.vue 356 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/dataImport.vue 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/QualityManagement.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
import request from '@/utils/request'
// è´¨é‡ç®¡ç†,缺陷定义查询列表
export function DedectSearch(data) {
  return request({
    url: 'QualityManagement/DedectSearch',
    method: 'get',
    params: data
  })
}
// è´¨é‡ç®¡ç†ï¼Œç¼ºé™·å®šä¹‰æ–°å¢žã€ç¼–辑提交
export function AddUpdateDedect(data) {
  return request({
    url: 'QualityManagement/AddUpdateDedect',
    method: 'post',
    data
  })
}
// è´¨é‡ç®¡ç†ï¼Œç¼ºé™·å®šä¹‰åˆ é™¤
export function DeleteDedect(data) {
  return request({
    url: 'QualityManagement/DeleteDedect',
    method: 'post',
    params: data
  })
}
src/router/index.js
@@ -167,10 +167,10 @@
        component: () => import('@/views/basicSettings/installLampList'),
        meta: { code: '0109', title: '安灯设置', icon: '', keepAlive: true }
      }, {
        path: 'processSList',
        name: 'processSListCancel',
        path: 'processList',
        name: 'processListCancel',
        code: '0112',
        component: () => import('@/views/basicSettings/processSList'),
        component: () => import('@/views/basicSettings/processList'),
        meta: { code: '0112', title: '工序设置', icon: '', keepAlive: true }
      }
src/views/basicSettings/processList.vue
src/views/qualityManager/defectDefine.vue
@@ -0,0 +1,356 @@
<template>
  <div>
    <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
          type="success"
          icon="el-icon-download"
          @click="$router.push('./../systemSetting/dataImport?fileCode=18')"
        >导入
        </el-button>
      </div>
      <div class="bodyTopFormGroup">
        <el-form
          ref="form"
          :model="form"
          label-width="100px"
          inline
          style="display: flex;"
        >
          <div class="elForm">
            <el-form-item label="缺陷编码" style=" display: flex;">
              <el-input v-model="form.defectcode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="缺陷名称" style=" display: flex;">
              <el-input v-model="form.defectname" placeholder="请输入" style="width: 200px" />
            </el-form-item>
          </div>
          <div
            class="bodySearchReset"
            :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
          >
            <el-button v-waves type="primary" icon="el-icon-search" @click="getDedectSearch">查询</el-button>
            <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
          </div>
        </el-form>
        <div
          class="bodyTopFormExpand"
          style="height:5px"
        >
          <!--          <svg-icon-->
          <!--            v-show="mouseHoverType==='mouseout'"-->
          <!--            style="cursor: pointer"-->
          <!--            :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"-->
          <!--            @mouseenter="mouseHoverType=$event.type"-->
          <!--          />-->
          <!--          <svg-icon-->
          <!--            v-show="mouseHoverType==='mouseenter'"-->
          <!--            style="cursor: pointer"-->
          <!--            :icon-class="!isExpandForm?'doubleDown':'doubleUp'"-->
          <!--            @click="isExpandForm=!isExpandForm"-->
          <!--            @mouseout="mouseHoverType=$event.type"-->
          <!--          />-->
        </div>
      </div>
      <div class="elTableDiv">
        <el-table
          ref="tableDataRef"
          class="tableFixed"
          :data="tableData"
          :height="tableHeight+'px'"
          border
          row-class-name="custom-row"
          :style="{width: 100+'%',height:tableHeight+'px',}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
          @sort-change="sortChange"
        >
          <el-table-column
            prop="rowNum"
            width="50"
            fixed
            label="序号"
          />
          <el-table-column
            prop="code"
            label="缺陷编码"
            sortable="custom"
          />
          <el-table-column
            prop="name"
            label="缺陷名称"
            sortable="custom"
          />
          <el-table-column
            prop="description"
            label="描述"
            sortable="custom"
          >
            <template slot-scope="{row}">
              {{ row.description ? row.description : '/' }}
            </template>
          </el-table-column>
          <el-table-column
            prop="lm_user"
            label="创建人员"
            sortable="custom"
          />
          <el-table-column
            prop="lm_date"
            label="创建时间"
            width="160"
            sortable="custom"
          />
          <el-table-column
            label="操作"
            width="120"
            fixed="right"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-tooltip class="item" effect="dark" content="编辑" placement="top">
                  <i
                    v-if="row.leve!==0"
                    class="el-icon-edit-outline"
                    :style="{color:$store.state.settings.theme}"
                    @click="edit('edit',row)"
                  />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                  <i
                    v-if="row.leve!==0"
                    class="el-icon-delete"
                    :style="{color:$store.state.settings.theme}"
                    @click="del(row)"
                  />
                </el-tooltip>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!--分页-->
      <pagination
        :total="total"
        :page.sync="form.page"
        :limit.sync="form.rows"
        align="right"
        layout="total,prev, pager, next,sizes,jumper"
        popper-class="select_bottom"
        @pagination="getDedectSearch"
      />
    </div>
    <el-dialog
      v-el-drag-dialog
      :title="operation==='add'?'新增':'编辑'"
      :visible.sync="dialogVisible"
      width="800px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleClose"
      @close="handleClose"
    >
      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
        <el-form-item label="缺陷编码" prop="defectcode">
          <el-input v-model="dialogForm.defectcode" :disabled="operation!=='add'" style="width: 200px" />
        </el-form-item>
        <el-form-item label="缺陷名称" prop="defectname">
          <el-input v-model="dialogForm.defectname" style="width: 200px" />
        </el-form-item>
        <el-form-item label="描述">
          <el-input
            v-model="dialogForm.defectdescr"
            type="textarea"
            style="width: 200px"
          />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="dialogVisibleCancel">取 æ¶ˆ</el-button>
          <el-button
            v-waves
            type="primary"
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            @click="dialogVisibleConfirm"
          >ç¡® å®š</el-button>
        </div>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import Pagination from '@/components/Pagination'
import {
  AddUpdateOrganization, AddUpdatePost,
  DeleteOrganization, DeletePost, PostData,
  PrentOrganization,
  STorgData
} from '@/api/basicSettings'
import { validateCode } from '@/utils/global'
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
import { AddUpdateDedect, DedectSearch, DeleteDedect } from '@/api/QualityManagement'
export default {
  name: 'Zzjg',
  components: {
    Pagination
  },
  directives: { elDragDialog, waves },
  data() {
    return {
      mainHeight: 0,
      tableHeight: 0,
      form: {
        defectcode: '', // ç»„织架构编码
        defectname: '', // ç»„织架构名称
        defectdescr: '',
        prop: 'lm_date', // æŽ’序字段
        order: 'desc', // æŽ’序字段
        page: 1, // ç¬¬å‡ é¡µ
        rows: 20 // æ¯é¡µå¤šå°‘条
      },
      total: 10,
      tableData: [],
      dialogVisible: false,
      dialogForm: {
        defectcode: '', // ç»„织编码
        defectname: '', // ç»„织名称
        defectdescr: '', // æè¿°
        OperType: ''
      },
      operation: '',
      dialogFormRules: {
        defectcode: [
          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
        ],
        defectname: [
          { required: true, message: '请输入缺陷名称', trigger: ['blur', 'change'] }
        ]
      }
    }
  },
  created() {
    this.getDedectSearch()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  methods: {
    // ç»„织架构大列表查询
    async getDedectSearch() {
      const res = await DedectSearch(this.form)
      this.tableData = res.data
      this.total = res.count
    },
    // æŽ’序改变时
    sortChange({ column, prop, order }) {
      if (order === 'descending') {
        order = 'desc'
      } else if (order === 'ascending') {
        order = 'asc'
      } else {
        order = 'desc'
      }
      this.form.order = order
      this.form.prop = prop
      this.getDedectSearch()
    },
    // é‡ç½®
    reset() {
      this.form.defectcode = ''
      this.form.defectname = ''
      this.getDedectSearch()
    },
    // æ–°å¢žæŒ‰é’®
    add(operation) {
      this.operation = operation
      this.dialogVisible = true
      this.dialogForm.OperType = 'Add'
    },
    // ä¿®æ”¹æŒ‰é’®
    async edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      this.dialogForm.OperType = 'Update'
      this.$nextTick(() => {
        this.dialogForm.defectcode = row.code
        this.dialogForm.defectname = row.name
        this.dialogForm.defectdescr = row.description
      })
    },
    // åˆ é™¤æŒ‰é’®
    async del(row) {
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        DeleteDedect({ defectcode: row.code }).then(res => {
          if (res.code === '200') {
            this.$notify.success('删除成功!')
            if (this.form.page > 1 && this.tableData.length === 1) {
              this.form.page--
            }
            this.getDedectSearch()
          }
        })
      }).catch(() => {
        this.$notify.info('已取消删除')
      })
    },
    // å¯¹è¯æ¡†å…³é—­äº‹ä»¶
    handleClose() {
      this.dialogForm.defectcode = ''
      this.dialogForm.defectname = ''
      this.dialogForm.defectdescr = ''
      this.$refs.dialogForm.clearValidate()
    },
    // å¯¹è¯æ¡†å–消
    dialogVisibleCancel() {
      this.dialogVisible = false
    },
    // å¯¹è¯æ¡†ç¡®è®¤
    dialogVisibleConfirm() {
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          this.$store.state.app.buttonIsDisabled = true
          AddUpdateDedect(this.dialogForm).then(res => {
            if (res.code === '200') {
              this.$notify.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
              this.dialogVisible = false
              this.$store.state.app.buttonIsDisabled = false
              this.getDedectSearch()
            } else {
              this.$store.state.app.buttonIsDisabled = false
              this.$notify.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
            }
          })
        }
      })
    },
    // èŽ·å–é¡µé¢é«˜åº¦
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 200
        this.$refs.tableDataRef.doLayout()
      })
    }
  }
}
</script>
src/views/systemSetting/dataImport.vue
@@ -620,7 +620,13 @@
            }
          }
          if (this.sheetName.indexOf('工序设置') !== -1) {
            const res = this.handleProcessSListSubmitData()
            const res = this.handleProcessListSubmitData()
            if (res.code !== '200') {
              return this.$message.info(res.message)
            }
          }
          if (this.sheetName.indexOf('缺陷定义') !== -1) {
            const res = this.handleDefectDefineSubmitData()
            if (res.code !== '200') {
              return this.$message.info(res.message)
            }
@@ -1121,7 +1127,7 @@
      return { code: '200', message: '成功!' }
    },
    // å¤„理工序设置提交数据
    handleProcessSListSubmitData() {
    handleProcessListSubmitData() {
      let flag = true
      let msg = ''
      if ([...new Set(this.tableData[0].map(i => i['*工序编号(唯一)']))].length !== this.tableData[0].length) {
@@ -1143,6 +1149,34 @@
        if (!j['*状态']) {
          flag = false
          msg = '*状态'
        }
      })
      if (!flag) {
        return { code: '301', message: msg + '不能为空!' }
      }
      this.tableData[0].map(item => {
        delete (item.uuid)
      })
      return { code: '200', message: '成功!' }
    },
    // å¤„理缺陷定义提交数据
    handleDefectDefineSubmitData() {
      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 = '*缺陷名称'
        }
      })
@@ -1326,6 +1360,15 @@
          '描述': ''
        })
      }
      //  ç¼ºé™·å®šä¹‰
      if (this.sheetName.indexOf('缺陷定义') !== -1) {
        this.tableData[0].unshift({
          uuid: nanoid(),
          '*缺陷编号(唯一)': '',
          '*缺陷名称': '',
          '缺陷描述': ''
        })
      }
    },
    delRow(row) {
      // é’ˆå¯¹å•sheet