zouyu
2024-01-19 4e2b8719ff4296831a9ef05faa6e91ce6a7b0bc7
模具管理模块
已修改4个文件
已添加1个文件
325 ■■■■■ 文件已修改
src/api/equipment/moulde.js 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/common/ztt-table.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipment/mould/index.vue 219 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/quality/Packaging_ledger/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/quality/rawMaterial/rawMaterial-form.vue 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/equipment/moulde.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
import request from '@/router/axios'
export function fetchList(query) {
  return request({
    url: '/mes/mould/page',
    method: 'get',
    params: query
  })
}
export function addMould(data) {
  return request({
    url: '/mes/mould/addMould',
    method: 'post',
    data: data
  })
}
export function updateMould(data) {
  return request({
    url: '/mes/mould/updateMould',
    method: 'post',
    data: data
  })
}
export function delById(id) {
  return request({
    url: '/mes/mould/'+id,
    method: 'delete',
  })
}
src/views/common/ztt-table.vue
@@ -509,7 +509,7 @@
                åªèƒ½ä¸Šä¼ xlsx/xls文件,且不超过10M<el-button
                  type="text"
                  style="font-size:14px;text-decoration: underline;"
                  @click="downDataTemplate(uploadInfo.fileName)"
                  @click="downDataTemplate(uploadInfo.fileName)"
                  v-if="uploadInfo.download"
                  >下载模板</el-button
                >
src/views/equipment/mould/index.vue
@@ -1,44 +1,56 @@
<template>
  <div class="mod-config">
      <basic-container>
      <ttable
      :table="table"
      :isShowHide="true"
      :ajaxFun="ajaxFun"
      :prelang="prelang"
      :options="options"
      ref="processconfiguration"
      >
      <template #toolbar>
        <el-button  type="primary"
                @click="">新增</el-button>
                <!-- <el-dropdown style="margin-left: 20px;" @command="handleCommand">
                    <el-button >
                      çŠ¶æ€å˜æ›´<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                      <el-dropdown-item :key="index"
                        :command="item.label"
                        v-for="(item,index) in taskTypeArr"
                        >{{ item.label }}</el-dropdown-item
                      >
                    </el-dropdown-menu>
                </el-dropdown> -->
      </template>
      </ttable>
        <ttable
        :table="table"
        :ajaxFun="ajaxFun"
        :prelang="prelang"
        :options="options"
        ref="mouldTable"
        class="mouldTable"
        >
        <template #toolbar></template>
        </ttable>
      </basic-container>
      <el-dialog
        :title="editRow==null ? '新增':'修改'"
        :visible.sync="dialogVisible"
        width="40%">
            <el-form :model="editRow" label-position="right" label-width="100px" ref="editForm" :rules="editRules">
                <el-form-item prop="code" label="模具编码">
                    <el-input v-model="editRow.code" placeholder="请输入模具编码称"></el-input>
                </el-form-item>
                <el-form-item prop="name" label="模具名称">
                    <el-input v-model="editRow.name" placeholder="请输入模具名称"></el-input>
                </el-form-item>
            </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button @click="dialogVisible = false">取 æ¶ˆ</el-button>
            <el-button type="primary" @click="confirmSaveOrUpdateMould">ç¡® å®š</el-button>
        </span>
        </el-dialog>
  </div>
</template>
<script>
import ttable from '@/views/common/ztt-table.vue'
import { fetchList, } from '@/api/quality/finishedDelivery'
import * as fecha from 'element-ui/lib/utils/date'
import { fetchList,addMould,updateMould,delById } from '@/api/equipment/moulde'
import { mapGetters } from 'vuex'
export default {
  data(){
      return {
          editRules: {
            code: [{required:true,message:'请输入模具编号',trigger:'blur'}],
            name: [{required:true,message:'请输入模具名称',trigger:'blur'}]
          },
          editRow: {
            code: null,
            name: null,
          },
          dialogVisible: false,
          ajaxFun: fetchList,
          prelang: 'operation',
          prelang: 'moudle',
          dataListLoading: false,
          options: {
              height: 300, // é»˜è®¤é«˜åº¦-为了表头固定
@@ -62,79 +74,162 @@
              // æ ‡é¢˜
              column: [
                {
                  minWidth: '140',
                  prop: 'packageNo',
                  label: '设备',
                  isTrue: true,
                  isSearch: true,
                  searchInfoType: 'text',
                },{
                  minWidth: '140',
                  prop: 'outBatchNo',
                  minWidth: '140px',
                  prop: 'code',
                  label: '模具编号',
                  isTrue: true,
                  isSearch: true,
                  searchInfoType: 'text',
                  render: { fun: this.addOrUpdateHandle }
                },
                {
                  minWidth: '140',
                  prop: 'partNo',
                  minWidth: '140px',
                  prop: 'name',
                  label: '模具名称',
                  isTrue: true,
                  isSearch: true,
                  searchInfoType: 'text',
                },
                {
                  minWidth: '140',
                  prop: 'partName',
                  label: '工序',
                  minWidth: '140px',
                  prop: 'createUser',
                  label: '责任人',
                  isTrue: true,
                  isSearch: true,
                  searchInfoType: 'text',
                },
                {
                  minWidth: '140',
                  prop: 'specs',
                  label: '工步',
                  minWidth: '140px',
                  prop: 'status',
                  label: '模具状态',
                  isTrue: true,
                  isSearch: true,
                  searchInfoType: 'text',
                },
                {
                  minWidth: '140',
                  prop: 'unit',
                  label: '寿命转换系数',
                  minWidth: '140px',
                  prop: 'createTime',
                  label: '创建时间',
                  isTrue: true,
                  isSearch: true,
                  searchInfoType: 'text',
                  searchInfoType: 'date',
                  formatter: this.formatDateTime
                },
              ],
              toolbar: [],
              operator: [{
                text: '删除',
                type: 'text',
                size: 'small',
                fun: this.deleteHandle
              }],
              operator: null,
              operatorConfig: {
                fixed: 'right',
                label: '操作',
                width: 100,
                minWidth: 100
                },
              },
          },
     }
  },
  // computed: {
  //   ...mapGetters(['permissions'])
  // },
  computed: {
    ...mapGetters(['permissions'])
  },
  components: {
    ttable
  },
  medthods: {
  watch: {
    dialogVisible(newVal){
        if(!newVal){
            this.editRow = {
                code: null,
                name: null,
            }
        }
    }
  },
  created(){
    if(this.permissions.equipment_mould_add){
        this.table.toolbar.push({
            text: '新增',
            type: 'primary',
            fun: this.addOrUpdateHandle
        })
    }
    if(this.permissions.equipment_mould_lableprint){
        this.table.toolbar.push({
            text: '标签打印',
            type: 'primary',
            fun: this.lableprint
        })
    }
    if(this.permissions.equipment_mould_del){
        this.table.operator = [{
            text: '删除',
            type: 'text',
            fun: this.deleteHandle
        }]
    }
  },
  mounted(){
  },
  methods: {
    deleteHandle(row){
        this.$confirm('是否确认删除模具名称为' + row.name, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          closeOnClickModal: false,
          type: 'warning'
        })
          .then(function() {
            return delById(row.id)
          }).then((data) => {
            this.$message.success('删除成功')
            this.getData()
          })
    },
    lableprint(){
    },
    confirmSaveOrUpdateMould(){
        this.$refs.editForm.validate(valid=>{
            if(valid){
                if(this.editRow.id){
                    updateMould(this.editRow).then(res=>{
                        if(res.status===200){
                            this.$message.success("修改成功")
                            this.getData()
                        }
                    }).catch(error=>{
                        console.error(error)
                    })
                }else{
                    addMould(this.editRow).then(res=>{
                        if(res.status===200){
                            this.$message.success("新增成功")
                            this.getData()
                        }
                    }).catch(error=>{
                        console.error(error)
                    })
                }
                this.dialogVisible = false
            }
        })
    },
    addOrUpdateHandle(row){
        if(row){
            this.editRow = row
        }
        this.dialogVisible = true
    },
    formatDateTime(row, column, cellValue) {
        return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd') : ''
        return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd HH:mm:ss') : ''
    },
    getData() {
      this.$refs.mouldTable.getDataList()
    },
  },
}
</script>
</script>
<style scoped>
.mouldTable >>>.el-table__fixed-right .el-table__fixed-body-wrapper {
  top: 74px !important;
}
</style>
src/views/quality/Packaging_ledger/index.vue
@@ -345,7 +345,7 @@
    },
    methods: {
      //包装详情
      //打印按钮
      printFun() {
          this.diaPrintTab = false;
src/views/quality/rawMaterial/rawMaterial-form.vue
@@ -173,9 +173,9 @@
                        <template slot-scope="scope">
                          <div v-if="!scope.row.children">
                          <el-tooltip :disabled="scope.row.deviceId != null" class="item" effect="dark" content="请先选择设备!" placement="top-start">
                            <!-- <el-autocomplete clearable
                            <el-autocomplete clearable
                            :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&resultVal!=null)"
                            @blur="changeState(scope.row,scope.$index)"
                            @input="changeState(scope.row,scope.$index)"
                            v-model="scope.row.testValueList[index]"
                            :fetch-suggestions="querySearch"
                            placeholder="请输入或选择检测值" >
@@ -183,9 +183,9 @@
                            <template slot-scope="{ item }">
                                <div>{{ item.value }}</div>
                            </template>
                            </el-autocomplete> -->
                            </el-autocomplete>
                              <el-select style="width:100%" filterable
                              <!-- <el-select style="width:100%" filterable
                              :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&resultVal!=null)"
                              v-model="scope.row.testValueList[index]"
                              placeholder="请输入或选择检测值"
@@ -196,7 +196,7 @@
                              >
                                <el-option label="是" value="是"/>
                                <el-option label="否" value="否"/>
                              </el-select>
                              </el-select> -->
                            </el-tooltip>
                          </div>
                        </template>
@@ -887,43 +887,41 @@
        console.log(e.target.value);
      },
      changeState(row, index) {
        this.$nextTick(()=>{
            if(row){
                let isTrue = true
                for(var i=0;i<row.testValueList.length;i++){
                let val = row.testValueList[i]
                let reg = /(^-?[0-9]{1,6}$)|(^-?[0-9]{1,6}[\.]{1}[0-9]{1,3}$)/
                if(!reg.test(val) && !['是','否'].includes(val)){
                    row.testValueList[i] = null
                    this.$message.error("请输入数字或选择是否")
                    isTrue = false
                }
                }
                if(!isTrue){
                return
                }
          }
          if (row.rpId != null && row.rpId != '') {
            let val = row.testValueList.join(",")
            if (val === undefined || val === '' || val === null) {
                return
        if(row){
            let isTrue = true
            for(var i=0;i<row.testValueList.length;i++){
              let val = row.testValueList[i]
              let reg = /(^-?[0-9]{1,6}$)|(^-?[0-9]{1,6}[\.]{1}[0-9]{1,3}$)/
              if(!reg.test(val) && !['是','否'].includes(val)){
                  row.testValueList[i] = null
                  this.$message.error("请输入6位数字或选择是否")
                  isTrue = false
              }
            }
            let obj = {
            if(!isTrue){
              return
            }
        }
        if (row.rpId != null && row.rpId != '') {
          let val = row.testValueList.join(",")
          if (val === undefined || val === '' || val === null) {
              return
          }
          let obj = {
              deviceId: row.deviceId,
              rpId: row.rpId,
              testValue: val,
              note: row.note
            }
            updateRawInsProduct(obj).then(res => {
                if (res.data.code == 0) {
                    this.$message.success("更新成功")
                } else {
                    this.$message.error("更新失败")
                }
                this.init(this.dataForm.id)
            })
          }
        })
          updateRawInsProduct(obj).then(res => {
              if (res.data.code == 0) {
                  this.$message.success("更新成功")
              } else {
                  this.$message.error("更新失败")
              }
              this.init(this.dataForm.id)
          })
        }
      },
      // åˆ é™¤å­é¡¹ç›®
      delChildren(row,index,isParent) {