gaoluyang
2025-02-15 b1187d1141a17fea3a7c184db73f232ca9877a85
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) {