zouyu
2023-08-31 b723865e2b3ad6032d10deda501644ebabef8368
src/views/inspectionManagement/reportForInspection/index.vue
@@ -64,12 +64,6 @@
         </el-dialog>
         <div class="library-table">
            <div class="table-header">
               <div class="search-bar">
                  <el-radio-group v-model="radioValue" @change="radioclick">
                     <el-radio-button v-for="option in radioOptions" :key="option.value"
                        :label="option.value">{{ option.label }}</el-radio-button>
                  </el-radio-group>
               </div>
               <div class="generateInsp">
                  <el-button @click="addReportBtn" type="primary" size="mini" icon="el-icon-document"
                     style="background-color: rgb(1, 102, 226);">生成报检单</el-button>
@@ -79,8 +73,7 @@
               <el-table ref="inspectionTable" :max-height="600" :cell-style="{textAlign: 'center'}"
                  :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}"
                  :data="inspectionTable" style="width: 100%" @selection-change="handleSelectionChange">
                  <el-table-column type="selection" :selectable="checkSelect" min-width="5%">
                  </el-table-column>
                  <el-table-column type="selection" :selectable="checkSelect" min-width="5%"></el-table-column>
                  <el-table-column type="index" label="序号" min-width="8%" />
                  <el-table-column prop="createTime" label="来料日期" min-width="8%" />
                  <el-table-column prop="supplierName" label="供应商名称" min-width="12%" />
@@ -116,7 +109,7 @@
         </div>
      </div>
      <el-dialog title="选择日期" :visible.sync="addReportDialog" width="60%">
         <el-form :model="addInspectionForm" :rules="addInspectionFormRules" rule="addInspectionForm">
         <el-form :model="addInspectionForm" :rules="addInspectionFormRules" ref="addInspectionForm">
            <el-form-item label="检验日期" label-width="100px" prop="inspectionDate">
               <el-date-picker v-model="addInspectionForm.inspectionDate" type="daterange" value-format="yyyy-MM-dd"
                  range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
@@ -446,8 +439,8 @@
            this.deviceoptions = res2.data;
         },
         resetForm(formName) {
            // this.addInspectionForm.inspectionDate = [],
            // this.$refs[formName].resetFields();
            this.addInspectionForm.inspectionDate = [],
            this.$refs[formName].resetFields();
            this.addReportDialog = false
         },
         removeFun(row, index) {
@@ -460,7 +453,7 @@
               this.deleteMaterialFun(row, index);
            }).catch(() => {});
         },
         checkSelect(row, index) {
         checkSelect(row) {
            if (row.type === 1) {
               return false;
            } else {
@@ -468,8 +461,11 @@
            }
         },
         handleSelectionChange(val) {
        if (val.length > 1) {
               this.$refs.inspectionTable.clearSelection();
               this.$refs.inspectionTable.toggleRowSelection(val.pop())
            }
            this.checkData = val;
        console.log(val);
         },
         //生成报检单按钮
         addReportBtn() {
@@ -530,28 +526,32 @@
      },
         //生成报检单确认按钮
         confirmBtn(formName) {
            let dateArr = this.addInspectionForm.inspectionDate;
            //添加报检单
            let val = this.checkData[0];
            let obj = {
               "endTime": dateArr[1],
               "experiment": "",
               "formTime": val.createTime,
               "id": val.id,
               "mcode": val.materialCoding,
               "name": val.materialName,
               "num": val.quantity,
               "specifications": val.specificationsModels,
               "startTime": dateArr[0],
               "supplier": val.supplierName,
               "type": val.type,
               "unit": val.unit,
               "version": this.addInspectionForm.version
            }
            // this.createReport(obj);
            this.addReportDialog = false;
            this.initNewSelection();
            this.showNewPage = true;
        this.$refs[formName].validate((valid=>{
          if(valid){
            let dateArr = this.addInspectionForm.inspectionDate;
            //添加报检单
            let val = this.checkData[0];
            let obj = {
              "endTime": dateArr[1],
              "experiment": "",
              "formTime": val.createTime,
              "id": val.id,
              "mcode": val.materialCoding,
              "name": val.materialName,
              "num": val.quantity,
              "specifications": val.specificationsModels,
              "startTime": dateArr[0],
              "supplier": val.supplierName,
              "type": val.type,
              "unit": val.unit,
              "version": this.addInspectionForm.version
            }
            // this.createReport(obj);
            this.addReportDialog = false;
            this.initNewSelection();
            this.showNewPage = true;
          }
        }));
         },
         //生成报检单
         async createReport(param) {
@@ -595,21 +595,6 @@
               date: ''
            }
            this.getRawMaterialList()
         },
         radioclick() {
            console.log(this.inspectionTable);
            if (this.radioValue === 0) {
            }
         },
         getAllTableData() {
            this.getRawMaterialList()
         },
         getCheckData() {
         },
         getUnCheckData() {
         },
         // 每页条数改变时触发 选择一页显示多少行
         handleSizeChange(val) {
@@ -707,10 +692,15 @@
         flex-direction: column;
         .table-header {
        width: 100%;
        height: 70px;
            padding: 20px;
            display: flex;
            justify-content: space-between;
        .generateInsp{
          position: relative;
          left: 92%;
        }
            .el-form-item {
               margin-bottom: 30px !important;
            }