value
2023-08-31 5a15331883386cb2206acd081ee54b873a08858b
src/views/inspectionManagement/reportForInspection/index.vue
@@ -30,7 +30,7 @@
         </div>
         <el-dialog title="新增原材料报检" :visible.sync="addReportVisible" width="40%">
            <el-form ref="addMaterialForm" :rules="insertRule" :model="insertData" :inline="true" label-position="right"
               label-width="80px">
               label-width="100px">
               <el-form-item label="来料日期:" prop="fromDate">
                  <el-date-picker v-model="insertData.fromDate" type="date" value-format="yyyy-MM-dd"></el-date-picker>
               </el-form-item>
@@ -54,7 +54,7 @@
                  <el-input type="text" v-model="insertData.unit" />
               </el-form-item>
               <el-form-item label="数量:" prop="num">
                  <el-input type="number" v-model="insertData.num" />
                  <el-input type="number" v-model="insertData.num"/>
               </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
@@ -82,7 +82,7 @@
                  <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="dateSurvey" label="来料日期" min-width="8%" />
                  <el-table-column prop="supplierName" label="供应商名称" min-width="12%" />
                  <el-table-column prop="materialCoding" label="材料编码" min-width="8%" />
                  <el-table-column prop="materialName" label="材料名称" min-width="8%" />
@@ -91,7 +91,7 @@
                  <el-table-column prop="quantity" label="数量" min-width="5%" />
                  <el-table-column prop="inspectionDate" label="报检日期" min-width="8%" />
                  <el-table-column prop="surveyor" label="检验人" min-width="8%" />
                  <el-table-column prop="dateSurvey" label="检验日期" min-width="8%" />
                  <el-table-column prop="insTime" label="检验日期" min-width="8%" />
                  <el-table-column prop="type" label="状态" min-width="8%">
                     <template slot-scope="scope">
                        <span :style="{ color: scope.row.type === 1 ? 'green' : 'red' }">
@@ -115,19 +115,30 @@
            </div>
         </div>
      </div>
      <el-dialog title="选择日期" :visible.sync="addReportDialog" width="30%">
      <el-dialog title="选择日期" :visible.sync="addReportDialog" width="60%">
         <el-form :model="addInspectionForm" :rules="addInspectionFormRules" rule="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="结束日期">
               </el-date-picker>
            </el-form-item>
            <el-form-item label="版本" label-width="100px" prop="version">
               <el-select v-model="addInspectionForm.version" placeholder="请选择版本">
                  <el-option v-for="(item,index) in 5" :key="index" :value="item" :label="item"></el-option>
            <el-form-item label="当前版本" label-width="100px" prop="version">
               <el-select @change="changeVersionFun" v-model="addInspectionForm.version" placeholder="请选择版本">
                  <el-option v-for="item in chooseVersion" :key="item.value" :label="item.label" :value="item.value" ></el-option>
               </el-select>
            </el-form-item>
         </el-form>
      <el-table
        style="width:90%;margin-left:5%"
        :data="standardLibraryData" row-key="id" border
        default-expand-all ref="multipleTable"
        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
        <el-table-column type="index" width="50px" label="序号"></el-table-column>
        <el-table-column label="项目名称" prop="name" sortable></el-table-column>
        <el-table-column prop="unit" label="单位" sortable></el-table-column>
        <el-table-column label="标准值" prop="required" sortable></el-table-column>
        <el-table-column prop="internal" label="内控值" sortable></el-table-column>
      </el-table>
         <div slot="footer" class="dialog-footer">
            <el-button @click="resetForm('addInspectionForm')">取 消</el-button>
            <el-button type="primary" @click="confirmBtn('addInspectionForm')">确 定</el-button>
@@ -245,16 +256,20 @@
      deleteMaterial,
      addMaterial,
      getMaterielName,
      getSpecification
      getSpecification,
    getChooseVersion,
    lookProByVer
   } from '@/api/inspection/rawmaterial'
   export default {
      data() {
         return {
        standardLibraryData:[],
        chooseVersion: [],
            userName: "",
            devices: "",
            addInspectionForm: {
               inspectionDate: ['2023-08-01', '2023-08-31'],
               version: 5
               inspectionDate: [],
               version: null
            },
            addInspectionFormRules: {
               inspectionDate: [{
@@ -332,19 +347,7 @@
               label: '未报检'
            }],
            radioValue: null,
            inspectionTable: [{
               createTime: '2023-07-28',
               supplier_name: '国网山东省电力有限公司',
               materialCoding: 'BP214274',
               materialName: '铝包钢绞线',
               specificationsModels: 'JLHA/G1A-185/30-26/7',
               unit: '吨',
               quantity: 21,
               dateSurvey: '2023-08-02',
               surveyor: '黄小明',
               inspectionDate: '2023-12-09',
               condition: 1
            }],
            inspectionTable: [],
            currentPage: 1,
            pageSize: 10,
            total: 20,
@@ -364,37 +367,37 @@
            insertRule: {
               fromDate: [{
                  required: true,
                  message: '请输入活动名称',
                  message: '请选择来料日期',
                  trigger: 'blur'
               }],
               supplierName: [{
                  required: true,
                  message: '请输入活动名称',
                  message: '请输入供应商名称',
                  trigger: 'blur'
               }],
               mName: [{
                  required: true,
                  message: '请输入活动名称',
                  message: '请选择物料名称',
                  trigger: 'blur'
               }],
               mCode: [{
                  required: true,
                  message: '请输入活动名称',
                  message: '请选择物料',
                  trigger: 'blur'
               }],
               specificationsNumber: [{
                  required: true,
                  message: '请输入活动名称',
                  message: '请选择规格型号',
                  trigger: 'blur'
               }],
               unit: [{
                  required: true,
                  message: '请输入活动名称',
                  message: '请输入单位',
                  trigger: 'blur'
               }],
               num: [{
                  required: true,
                  message: '请输入活动名称',
                  message: '请输入报检数量',
                  trigger: 'blur'
               }]
            },
@@ -405,7 +408,7 @@
         this.getRawMaterialList()
      },
      mounted() {
         this.getMaterielName()
         this.getMaterielName();
      },
      methods: {
         handleChange() {
@@ -422,7 +425,6 @@
            });
         },
         blurOptions(row) {
            console.log("更新", row);
         },
         async initNewSelection() {
            const res = await selectUser();
@@ -433,7 +435,7 @@
         resetForm(formName) {
            // this.addInspectionForm.inspectionDate = [],
            // this.$refs[formName].resetFields();
            // this.addReportDialog = false
            this.addReportDialog = false
         },
         removeFun(row, index) {
            this.$confirm('确认删除该数据吗?', '提示', {
@@ -441,7 +443,6 @@
               cancelButtonText: '取消',
               type: 'warning'
            }).then(() => {
               console.log(row.id);
               this.deleteMaterialFun(row, index);
            }).catch(() => {});
         },
@@ -463,10 +464,53 @@
               if (this.checkData.length > 1) {
                  this.$message.error("最多选择一条数据!");
               } else {
            let mcode = this.checkData[0].materialCoding;
            let name = this.checkData[0].materialName;
            let specifications = this.checkData[0].specificationsModels;
            this.getChooseVersionFun(mcode,name,specifications);
                  this.addReportDialog = true;
               }
            }
         },
      changeVersionFun(){
        let mCode = this.checkData[0].materialCoding;
        let name = this.checkData[0].materialName;
        let specifications = this.checkData[0].specificationsModels;
        let version = this.addInspectionForm.version;
        this.getProByVersion(mCode,name,specifications,version);
      },
      //获取版本下的标准库数据
      async getProByVersion(mCode,name,specifications,version){
          var vm = this;
          await lookProByVer({
              mcode : mCode,
              name : name,
              specifications : specifications,
              version: version
          }).then((res)=>{
            vm.standardLibraryData = res.data;
          })
      },
      //获取版本列表
      async getChooseVersionFun(mCode,name,specifications){
        var vm = this;
        this.chooseVersion = [];
        await getChooseVersion({
          mcode : mCode,
          name : name,
          specifications : specifications
        }).then((res)=>{
              vm.getProByVersion(mCode,name,specifications,res.data[0])
              for(let i=0;i<res.data.length;i++){
                vm.chooseVersion.push({
                  value: res.data[i],
                  label: "V"+res.data[i]
                });
              }
              vm.addInspectionForm.version = res.data[0];
        });
      },
         //生成报检单确认按钮
         confirmBtn(formName) {
            let dateArr = this.addInspectionForm.inspectionDate;
@@ -485,23 +529,19 @@
               "supplier": val.supplierName,
               "type": val.type,
               "unit": val.unit,
               "version": val.version
               "version": this.addInspectionForm.version
            }
            // this.createReport(obj);
            this.addReportDialog = false;
            this.initNewSelection();
            this.showNewPage = true;
            this.createReport(obj);
            // this.addReportDialog = false;
            // this.initNewSelection();
            // this.showNewPage = true;
         },
         //生成报价单
         //生成报检单
         async createReport(param) {
            let res = await addInspect(param);
            const res2 = await selectInspectsListById({
               id: res.data
            });
            this.resultData = res2.data;
            this.inspectionForm = res2.data;
            this.inspectionItems = res2.data.insProducts;
            if(res.data==null)return
            this.$message.success('报检成功')
            this.$router.push(`/experiment/Viewdetails/${res.data}`)
         },
         // 获取分页列表数据
         async getRawMaterialList() {
@@ -537,7 +577,6 @@
            this.getRawMaterialList()
         },
         radioclick() {
            console.log(this.inspectionTable);
            if (this.radioValue === 0) {
            }