gaoluyang
2025-02-15 b1187d1141a17fea3a7c184db73f232ca9877a85
能力范围-零件绑定联调
已修改6个文件
334 ■■■■ 文件已修改
src/api/structural/structureTestObjectPart.js 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Table/lims-table.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/capability/EditForm.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/capability/bindPartDialog.vue 136 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/capability/testObjectEditForm.vue 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/structural/capabilityAndLaboratory/capability/index.vue 125 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/structural/structureTestObjectPart.js
@@ -13,7 +13,7 @@
  return request({
    url: '/structureTestObjectPart/addTestObjectPart',
    method: 'post',
    params: query
    data: query
  })
}
// 检验对象修改产品零件
@@ -21,7 +21,7 @@
  return request({
    url: '/structureTestObjectPart/updateTestObjectPart',
    method: 'post',
    params: query
    data: query
  })
}
// 检验对象删除产品零件
@@ -35,8 +35,32 @@
// 根据产品id查询零件
export function selectByProductId(query) {
  return request({
    url: 'ctPart/selectByProductId',
    url: '/productPart/selectByProductId',
    method: 'post',
    params: query
  })
}
// 新增产品零件
export function addProductPart(query) {
  return request({
    url: '/productPart/addProductPart',
    method: 'post',
    data: query
  })
}
// 修改产品零件
export function updateProductPart(query) {
  return request({
    url: '/productPart/updateProductPart',
    method: 'post',
    data: query
  })
}
// 删除产品零件
export function deleteProductPart(query) {
  return request({
    url: '/productPart/deleteProductPart',
    method: 'post',
    data: query
  })
}
src/components/Table/lims-table.vue
@@ -68,17 +68,19 @@
                <template v-for="(o, key) in item.operation">
                  <el-button
                      v-if="o.type!='upload'"
                      size="mini"
                      v-show="o.showHide ? o.showHide(scope.row) : true"
                      :disabled="o.disabled ? o.disabled(scope.row) : false"
                      :icon="o.icon | iconFn(scope.row)"
                      :plain="o.plain" :size="o.size"
                      :style="{ 'color': o.color }"
                      :icon="o.icon | iconFn(scope.row, o)"
                      :plain="o.plain"
                      :style="{ 'color': o.name === '删除' ? '#f56c6c' : o.color }"
                      :type="o.type | typeFn(scope.row)"
                      @click="o.clickFun(scope.row)">
                    {{ o.name }}
                  </el-button>
                  <el-upload
                    action="#"
                    size="mini"
                    :on-change="(file, fileList)=>o.clickFun(scope.row,file, fileList)"
                    :multiple="o.multiple?o.multiple:false"
                    :limit="o.limit?o.limit:1"
src/components/capability/EditForm.vue
@@ -317,9 +317,7 @@
          let obj = this.HaveJson(this.editForm)
          obj.method = JSON.stringify(obj.method)
          obj.sample = JSON.stringify(obj.sample)
          if (obj.radiusList !== null && obj.radiusList.length > 0) {
            obj.radiusList = JSON.stringify(obj.radiusList)
          }
          obj.radiusList = JSON.stringify(obj.radiusList)
          if(obj.id){
            // 修改
            upItemParameter(obj).then(res => {
@@ -329,7 +327,7 @@
              }
              this.$message.success('修改成功')
              this.editFormDia = false
              this.$emit('refreshTable')
              this.$emit('refreshList')
            }).catch(e => {
              this.editLoad = false
            })
@@ -342,7 +340,7 @@
              }
              this.$message.success('添加成功')
              this.editFormDia = false
              this.$emit('refreshTable')
              this.$emit('refreshList')
            }).catch(e => {
              this.editLoad = false
            })
@@ -353,7 +351,7 @@
    // 关闭弹框
    closeDia () {
      this.editFormDia = false
      this.$refs.editForm.resetFields()
      this.resetForm("editForm");
    },
    selectTestObjectByName() {
      getItemTree().then(res => {
src/components/capability/bindPartDialog.vue
@@ -7,7 +7,7 @@
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="$emit('closeBindPartDialog')">取 消</el-button>
        <el-button type="primary" @click="addBindPart" :loading="addBindLoad">新 增</el-button>
        <el-button type="primary" @click="addBindPart('add')" :loading="addBindLoad">新 增</el-button>
      </span>
    </el-dialog>
    <el-dialog :title="dialogTitle" :visible.sync="addBindPartDialog" width="400px" @close="closeBindPartDialog"
@@ -20,10 +20,10 @@
          <el-form-item label="零件号:" prop="partNo">
            <el-input v-model="bindPartData.partNo" size="small"></el-input>
          </el-form-item>
          <el-form-item label="颜色:">
          <el-form-item label="颜色:" prop="color">
            <el-input v-model="bindPartData.color" size="small"></el-input>
          </el-form-item>
          <el-form-item label="色标:">
          <el-form-item label="色标:" prop="colorCode">
            <el-input v-model="bindPartData.colorCode" size="small"></el-input>
          </el-form-item>
        </el-form>
@@ -38,7 +38,13 @@
<script>
import limsTable from "@/components/Table/lims-table.vue";
import {selectByProductId, selectByTestObjectId} from "@/api/structural/structureTestObjectPart";
import {
  addProductPart,
  addTestObjectPart, deleteProductPart, deleteTestObjectPart,
  selectByProductId,
  selectByTestObjectId, updateProductPart, updateTestObjectPart
} from "@/api/structural/structureTestObjectPart";
import {delProduct} from "@/api/structural/capability";
export default {
  name: "bindPartDialog",
@@ -63,6 +69,7 @@
    return {
      isShow: this.bindPartDialog,
      dialogTitle: '新增零件绑定',
      operationType: '',
      tableData: [],
      tableLoading: false,
      column: [
@@ -78,7 +85,7 @@
              name: '编辑',
              type: 'text',
              clickFun: (row) => {
                this.editForm(row);
                this.addBindPart('edit', row);
              },
            },
            {
@@ -149,29 +156,34 @@
      this.tableLoading = true
      // 根据类型判断是检验对象零件绑定还是产品维护零件绑定
      if (this.type === 0) {
        selectByTestObjectId(this.currentRow.id).then(res => {
        selectByTestObjectId({id: this.currentRow.id}).then(res => {
          this.tableLoading = false
          if (res.code === 200) {
            this.tableData = res.data
            this.page.total = res.total
            this.tableData = res.data.records
            this.page.total = res.data.total
          }
        }).catch(err => {
          this.tableLoading = false
        })
      } else {
        selectByProductId(this.currentRow.id).then(res => {
        selectByProductId({id: this.currentRow.id}).then(res => {
          this.tableLoading = false
          if (res.code === 200) {
            this.tableData = res.data
            this.page.total = res.total
            this.tableData = res.data.records
            this.page.total = res.data.total
          }
        }).catch(err => {
          this.tableLoading = false
        })
      }
    },
    addBindPart () {
    addBindPart (type, row) {
      this.addBindPartDialog = true
      this.dialogTitle = type === 'add' ? '新增零件绑定' : '修改零件绑定'
      this.operationType = type
      if (type === 'edit') {
        this.bindPartData = row
      }
    },
    // 提交零件绑定
    submitBind () {
@@ -190,33 +202,95 @@
            partNo: this.bindPartData.partNo,
          }
          this.bindLoad = true
          if (this.type === 0) {
          if (this.operationType === 'add') {
            if (this.type === 0) {
              addTestObjectPart(params).then(res => {
                if (res.code === 200) {
                  this.resetForm('bindPartData')
                  this.addBindPartDialog = false
                  this.$message.success('新增成功')
                  this.getList()
                }
              }).catch(err => {
                this.bindLoad = false
                console.log(err)
              })
            } else {
              addProductPart(params).then(res => {
                if (res.code === 200) {
                  this.resetForm('bindPartData')
                  this.addBindPartDialog = false
                  this.$message.success('新增成功')
                  this.getList()
                }
              }).catch(err => {
                this.bindLoad = false
                console.log(err)
              })
            }
          } else {
            if (this.type === 0) {
              updateTestObjectPart(params).then(res => {
                if (res.code === 200) {
                  this.resetForm('bindPartData')
                  this.addBindPartDialog = false
                  this.$message.success('修改成功')
                  this.getList()
                }
              }).catch(err => {
                this.bindLoad = false
                console.log(err)
              })
            } else {
              updateProductPart(params).then(res => {
                if (res.code === 200) {
                  this.resetForm('bindPartData')
                  this.addBindPartDialog = false
                  this.$message.success('修改成功')
                  this.getList()
                }
              }).catch(err => {
                this.bindLoad = false
                console.log(err)
              })
            }
          }
          this.$axios.post(url, params, {
            headers: {
              'Content-Type': 'application/json'
            }
          }).then(res => {
            this.bindLoad = false
            if (res.code === 200) {
              this.$refs['bindPartData'].resetFields();
              this.addBindPartDialog = false
              this.$message.success('操作成功')
              this.getList()
            }
          }).catch(err => {
            this.bindLoad = false
            console.log(err)
          })
        } else {
          console.log('error submit!!');
          return false;
        }
      })
    },
    delete (row) {
      this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        if (this.type === 0) {
          deleteTestObjectPart({id:row.id}).then(res => {
            if (res.code === 200) {
              this.$message.success('删除成功')
              this.getList();
            }
          })
        } else {
          deleteProductPart({id:row.id}).then(res => {
            if (res.code === 200) {
              this.$message.success('删除成功')
              this.getList();
            }
          })
        }
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      })
    },
    closeBindPartDialog () {
      this.$refs['bindPartData'].resetFields();
      this.resetForm('bindPartData')
      this.addBindPartDialog = false
    },
  },
src/components/capability/testObjectEditForm.vue
@@ -4,7 +4,7 @@
      <el-form ref="editForm" :model="editForm" :rules="editFormRules" label-width="120px" label-position="right">
        <el-form-item label="场所:" prop="laboratoryId">
          <el-select v-model="editForm.laboratoryId" clearable placeholder="请选择" size="small" style="width: 100%">
            <el-option v-for="item in laboratoryList" :key="item.label" :label="item.label" :value="item.label"></el-option>
            <el-option v-for="item in laboratoryList" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="检验对象:" prop="specimenName">
@@ -46,6 +46,7 @@
      editFormDia: false,
      editLoad: false,
      editForm: {
        id: '',
        laboratoryId: '', // 场所
        specimenName: '', // 检验对象
        specimenNameEn: '', // 检验对象EN
@@ -74,9 +75,9 @@
      this.obtainItemParameterList()
      this.editFormDia = true
      if (type === 'add') {
        this.$refs.editForm.resetFields()
        this.resetForm("editForm");
      } else {
        this.editForm = this.HaveJson(row)
        this.editForm = {...row}
      }
    },
    // 提交编辑
@@ -84,32 +85,31 @@
      this.$refs.editForm.validate(valid => {
        if (valid) {
          this.editLoad = true
          let obj = this.HaveJson(this.editForm)
          if(obj.id){
          if(this.editForm.id){
            // 修改
            upTestObject(obj).then(res => {
            upTestObject(this.editForm).then(res => {
              this.editLoad = false
              if (res.code === 201) {
              if (res.code === 500) {
                return
              }
              this.$message.success('修改成功')
              this.closeDia()
              this.$emit('refreshList')
            }).catch(e => {
              this.editLoad = false
              this.editFormDia = false
            })
          }else{
            // 新增
            addTestObject(obj).then(res => {
            addTestObject(this.editForm).then(res => {
              this.editLoad = false
              if (res.code === 201) {
              if (res.code === 500) {
                return
              }
              this.$message.success('添加成功')
              this.closeDia()
              this.$emit('refreshList')
            }).catch(e => {
              this.editLoad = false
              this.editFormDia = false
            })
          }
        }
@@ -118,8 +118,7 @@
    // 关闭弹框
    closeDia () {
      this.editFormDia = false
      this.$refs.editForm.resetFields()
      this.$parent.refreshTable('page')
      this.resetForm("editForm");
    },
    // 获取场所下拉框的值
    obtainItemParameterList() {
src/views/structural/capabilityAndLaboratory/capability/index.vue
@@ -3,7 +3,7 @@
    <div>
      <el-row class="title">
        <el-col :span="12" style="text-align: left">
          <el-radio-group v-model="radio" size="medium" fill="#409EFF">
          <el-radio-group v-model="radio" size="medium" fill="#409EFF" @change="refreshTable">
            <el-radio-button :label="0">检验项目参数</el-radio-button>
            <el-radio-button :label="1">检验对象</el-radio-button>
          </el-radio-group>
@@ -43,10 +43,12 @@
          <el-button icon="el-icon-refresh" size="mini" @click="refresh">重 置</el-button>
        </el-form-item>
      </el-form>
<!--      检验项目参数表格-->
      <div class="table" v-if="radio===0">
        <lims-table :tableData="tableData" :column="column"
                    :page="page" :tableLoading="tableLoading"></lims-table>
      </div>
<!--      检验对象表格-->
      <div class="table" v-if="radio===1">
        <lims-table :tableData="testObjectTableData" :column="testObjectColumn"
                    :page="testObjectPage" :tableLoading="tableLoading"></lims-table>
@@ -64,8 +66,8 @@
      </span>
    </el-dialog>
    <!--产品维护编辑-->
    <el-dialog title="编辑产品维护" :visible.sync="productEditDia" width="400px">
      <el-form :model="productEditForm" ref="productEditForm" :rules="productRules">
    <el-dialog title="操作产品维护" :visible.sync="productEditDia" width="400px">
      <el-form :model="productEditForm" ref="productEditForm" :rules="productRules" label-position="right" label-width="100px">
        <el-form-item label="产品名称" prop="name">
          <el-input size="small" placeholder="请输入" clearable v-model="productEditForm.name"></el-input>
        </el-form-item>
@@ -96,8 +98,8 @@
      </span>
    </el-dialog>
    <!--检验项目参数-编辑弹框-->
    <EditForm ref="editForm" @refreshTable="refreshTable"></EditForm>
    <testObjectEditForm ref="testObjectEditForm"></testObjectEditForm>
    <EditForm ref="editForm" @refreshList="refreshList1"></EditForm>
    <testObjectEditForm ref="testObjectEditForm" @refreshList="refreshList"></testObjectEditForm>
    <BindPartDialog v-if="bindPartDialog" :bindPartDialog="bindPartDialog"
                    :currentRow="currentRow"
                    :type="type"
@@ -113,8 +115,9 @@
import BindPartDialog from "@/components/capability/bindPartDialog.vue"
import BindSupplierDensityDialog from "@/components/capability/bindSupplierDensityDialog.vue"
import {
  addProduct,
  delItemParameter, delProduct, delTestObject, selectItemParameterList, selectProductListByObjectId,
  selectTestObjectList,
  selectTestObjectList, upProduct,
} from "@/api/structural/capability";
import limsTable from "@/components/Table/lims-table.vue";
import EditForm from "@/components/capability/EditForm.vue";
@@ -151,10 +154,12 @@
          dataType: 'action',
          fixed: 'right',
          label: '操作',
          width: '140px',
          operation: [
            {
              name: '编辑',
              type: 'text',
              icon: 'el-icon-edit',
              clickFun: (row) => {
                this.editForm(row);
              },
@@ -162,6 +167,7 @@
            {
              name: '删除',
              type: 'text',
              icon: 'el-icon-delete',
              clickFun: (row) => {
                this.delete(row);
              },
@@ -240,10 +246,12 @@
          dataType: 'action',
          fixed: 'right',
          label: '操作',
          width: '240px',
          operation: [
            {
              name: '编辑',
              type: 'text',
              icon: 'el-icon-edit',
              clickFun: (row) => {
                this.editTestObjectForm(row);
              },
@@ -251,6 +259,7 @@
            {
              name: '删除',
              type: 'text',
              icon: 'el-icon-delete',
              clickFun: (row) => {
                this.deleteTest(row);
              },
@@ -300,6 +309,7 @@
            {
              name: '编辑',
              type: 'text',
              icon: 'el-icon-edit',
              clickFun: (row) => {
                this.editProduct('edit', row);
              },
@@ -307,6 +317,7 @@
            {
              name: '删除',
              type: 'text',
              icon: 'el-icon-delete',
              clickFun: (row) => {
                this.deleteProduct(row);
              },
@@ -336,10 +347,14 @@
      },
      productableLoading: false,
      productEditDia: false,
      operationType: '',
      productEditForm: {
        objectId: '',
        id: '',
        name: '',
        nameEn: ''
      },
      objectId: '',
      productRules: {
        name: [{ required: true, message: '请填写产品名称', trigger: 'blur' }],
        nameEn: [{ required: true, message: '请填写产品名称EN', trigger: 'blur' }]
@@ -355,7 +370,7 @@
      type: null,  // 零件绑定的类型--0:检验对象,1:产品维护
    }
  },
  mounted() {
  created() {
    this.refreshTable()
  },
  computed: {
@@ -365,7 +380,7 @@
  },
  methods: {
    submitUpload() {
      if (this.$refs.upload.uploadFiles.length == 0) {
      if (this.$refs.upload.uploadFiles.length === 0) {
        this.$message.error('未选择文件')
        return
      }
@@ -376,7 +391,7 @@
      this.$refs.upload.clearFiles()
      this.uploadDia = false
      this.uploading = false
      if (response.code == 201) {
      if (response.code === 201) {
        this.$message.error(response.message)
        return
      }
@@ -414,11 +429,17 @@
    },
    handleSuccessUp (response, file, fileList) {
      this.$refs.upload.clearFiles()
      if (response.code == 201) {
      if (response.code === 201) {
        this.$message.error(response.message)
        return
      }
      this.$message.success('上传成功')
      this.refreshTable()
    },
    refreshList () {
      this.refreshTable()
    },
    refreshList1 () {
      this.refreshTable()
    },
    refreshTable() {
@@ -463,12 +484,23 @@
    },
    // 检验项目参数-删除
    delete (row) {
      this.$modal.confirm('是否确认删除此数据项?').then(function() {
        return delItemParameter(row.id);
      this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
        delItemParameter({id:row.id}).then(res => {
          if (res.code === 200) {
            this.$message.success('删除成功')
            this.refreshTable();
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      })
    },
    // 检验对象-打开修改弹框
    editTestObjectForm (row) {
@@ -476,16 +508,28 @@
    },
    // 检验项目参数-删除
    deleteTest (row) {
      this.$modal.confirm('是否确认删除此数据项?').then(function() {
        return delTestObject(row.id);
      this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
        delTestObject({id:row.id}).then(res => {
          if (res.code === 200) {
            this.$message.success('删除成功')
            this.refreshTable();
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      })
    },
    // 产品维护
    upProduct(row) {
      this.diaProduct = true
      this.objectId = row.id
      this.getProductList(row)
    },
    getProductList (row) {
@@ -506,6 +550,7 @@
    // 产品维护-新增-编辑
    editProduct (type, row) {
      this.productEditDia = true
      this.operationType = type
      if (type === 'edit') {
        this.productEditForm = row
      }
@@ -514,7 +559,24 @@
    submitProduct () {
      this.$refs['productEditForm'].validate((valid) => {
        if (valid) {
          this.productEditForm.objectId = this.objectId
          if (this.operationType === 'add') {
            addProduct(this.productEditForm).then(res => {
              if (res.code === 200) {
                this.$message.success('新增成功')
                this.productEditDia = false
                this.refreshTable();
              }
            })
          } else {
            upProduct(this.productEditForm).then(res => {
              if (res.code === 200) {
                this.$message.success('新增成功')
                this.productEditDia = false
                this.refreshTable();
              }
            })
          }
        }
      })
    },
@@ -524,12 +586,23 @@
    },
    // 产品维护-删除
    deleteProduct (row) {
      this.$modal.confirm('是否确认删除此数据项?').then(function() {
        return delProduct(row.id);
      this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
        delProduct({id:row.id}).then(res => {
          if (res.code === 200) {
            this.$message.success('删除成功')
            this.refreshTable();
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      })
    },
    // 零件绑定
    bindPartFirst (row) {