yuyu
2023-08-08 0d452c10ee16e40a3ca3d176e5ebebcb4bd16a87
src/views/rawMaterials/reportForInspection/forInspectionDetail.vue
@@ -26,14 +26,18 @@
            </div> -->
        </div>
        <div class="message">
          <div class="message-item"><span><i class="el-icon-edit" />试验方法:</span></div>
          <!-- <div class="message-item"><span><i class="el-icon-edit" />试验方法:</span></div> -->
          <div class="message-item">
            <span><i class="el-icon-edit" />项目分类:</span>
            <span><i class="el-icon-edit" />检验类型:
              <span v-if="inspectionDetail.type===0">原材料检验</span>
              <span v-else-if="inspectionDetail.type===1">半成品检验</span>
              <span v-else-if="inspectionDetail.type===2">成品检验</span>
            </span>
          </div>
          <div class="message-item">
            <span><i class="el-icon-edit" />更新人:</span></div>
            <span><i class="el-icon-edit" />登记人:<el-tag>{{ inspectionDetail.userName }}</el-tag></span></div>
          <div class="message-item">
            <span><i class="el-icon-edit" />更新时间:</span></div>
            <span><i class="el-icon-edit" />登记日期:{{ inspectionDetail.createTime }}</span></div>
        </div>
      </div>
      <div class="card-main sample-list">
@@ -57,53 +61,58 @@
            style="width: 100%"
          >
            <el-table-column
              prop="applicationOrdernumber"
              label="申请单号"
              prop="materialNum"
              label="物料编号"
              min-width="200"
            />
            <el-table-column
              prop="typeofInspection"
              label="检验类型"
              prop="materialName"
              label="物料名称"
              min-width="200"
            />
            <el-table-column
              prop="objectofInspection"
              label="检验对象"
              label="物料属性"
              min-width="200"
            />
            <el-table-column
              prop="palceofObject"
              label="对象位置"
              prop="materialBatch"
              label="批次"
              min-width="200"
            />
            <el-table-column
              prop="name"
              label="对象名称"
              prop="materialReelNumber"
              label="盘号"
              min-width="200"
            />
            <el-table-column
              prop="date"
              label="登记日期"
              prop="specificationsSerialNumber"
              label="型号"
              min-width="200"
            />
            <el-table-column
              prop="registrant"
              label="登记人"
              label="规格"
              min-width="200"
            />
            <el-table-column
              prop="applicationTime"
              label="申请时间"
              label="入库数量"
              min-width="200"
            />
            <el-table-column
              prop="materialNum"
              label="送样数量"
              min-width="200"
            />
            <el-table-column
              label="操作"
              min-width="200"
              :fixed="true"
              fixed="right"
            >
              <template slot-scope="scope">
                <el-button type="text" size="small" @click="handleClick(scope.row)">查看</el-button>
                <el-button type="text" size="small">作废</el-button>
                <el-button type="text" size="small" @click="openChangeMaterial(scope.row)">编辑</el-button>
                <el-button type="text" size="small">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
@@ -129,7 +138,7 @@
      <div class="demo-drawer__content">
        <el-form label-position="top" label-width="120px" :model="addSampleFrom">
          <el-form-item>
            <el-button type="primary">选择物料</el-button>
            <el-button type="primary" @click="chooseMaterialVisible = true">选择物料</el-button>
          </el-form-item>
          <div class="materialParams-card">
            <el-row class="materialParams-top">
@@ -165,7 +174,7 @@
              </el-col>
            </el-row>
          </div>
          <el-row gutter="100" :style="{marginTop:'24px'}">
          <el-row :gutter="100" :style="{marginTop:'24px'}">
            <el-col :span="12">
              <el-form-item label="批次">
                <el-input placeholder="" />
@@ -177,7 +186,7 @@
              </el-form-item>
            </el-col>
          </el-row>
          <el-row gutter="100">
          <el-row :gutter="100">
            <el-col :span="12">
              <el-form-item label="盘号">
                <el-input placeholder="" />
@@ -189,7 +198,7 @@
              </el-form-item>
            </el-col>
          </el-row>
          <el-row gutter="100">
          <el-row :gutter="100">
            <el-col :span="12">
              <el-form-item label="规格/型号名称">
                <el-input placeholder="" />
@@ -201,7 +210,7 @@
              </el-form-item>
            </el-col>
          </el-row>
          <el-row gutter="100">
          <el-row :gutter="100">
            <el-col :span="12">
              <el-form-item label="生产指令号">
                <el-input placeholder="" />
@@ -213,14 +222,14 @@
              </el-form-item>
            </el-col>
          </el-row>
          <el-row gutter="100">
          <el-row :gutter="100">
            <el-col :span="12">
              <el-form-item label="电压等级">
                <el-input placeholder="" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row gutter="100" :style="{flex:'1'}">
          <el-row :gutter="100" :style="{flex:'1'}">
            <el-col :span="24">
              <el-form-item label="备注">
                <el-input
@@ -232,16 +241,60 @@
            </el-col>
          </el-row>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">立即创建</el-button>
            <el-button type="primary">立即创建</el-button>
            <el-button>取消</el-button>
          </el-form-item>
        </el-form>
      </div>
    </el-drawer>
    <el-dialog title="选择物料" :visible.sync="chooseMaterialVisible">
      <div class="dialog-content">
        <!-- Left side tree structure -->
        <div class="tree-container">
          <span class="all"> 全部</span>
          <el-tree :data="treeData" />
        </div>
        <!-- Right side material list -->
        <div class="table-container">
          <el-table
            ref="todoListRef"
            :data="selectedNodeMaterials"
            style="width: 100%"
            highlight-current-row
            :header-row-class-name="headerBg"
            @row-click="handleSelectionChange"
          >
            <el-table-column
              label="物料编号"
              prop="number"
            >
              <template slot-scope="scope">
                <el-radio v-model="radioSelected" :label="scope.row.number" @change.native="handleSelectionChange(scope.row)">&nbsp;  </el-radio>
              </template>
            </el-table-column>
            <el-table-column prop="name" label="物料名称" />
          </el-table>
          <el-pagination
            :current-page="pageParams.pageNo"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="pageParams.pageSize"
            :total="pageParams.total"
            layout="total, sizes, prev, pager, next, jumper"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
          />
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="chooseMaterialVisible = false">取 消</el-button>
        <el-button type="primary">确定选择</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { getInspectionMaterialListById } from '@/api/rawMaterials/reportForInspection'
export default {
  data() {
    return {
@@ -252,14 +305,120 @@
        total: 3
      },
      addSampleVisible: false,
      chooseMaterialVisible: false,
      direction: 'rtl',
      addSampleFrom: {}
      addSampleFrom: {},
      treeData: [{
        id: 1,
        label: '一级 1',
        children: [{
          id: 4,
          label: '二级 1-1',
          children: [{
            id: 9,
            label: '三级 1-1-1'
          }, {
            id: 10,
            label: '三级 1-1-2'
          }]
        }]
      }, {
        id: 2,
        label: '一级 2',
        children: [{
          id: 4,
          label: '二级 2-1',
          children: [{
            id: 9,
            label: '三级 2-1-1'
          }, {
            id: 10,
            label: '三级 2-1-2'
          }]
        }]
      }],
      selectedNodeMaterials: [
        {
          number: '12345',
          name: '测试数据1'
        },
        {
          number: 'Y111111',
          name: '测试数据2'
        }],
      radioSelected: null,
      multipleSelection: '',
      inspectionDetail: {}
    }
  },
  created() {
    // console.log(this.$route.query) 传递的申请单对象详情
    this.inspectionDetail = JSON.parse(this.$route.query.inspectionDetail)
    this.getMaterialList()
  },
  methods: {
    openChangeMaterial(row) {
      console.log(row)
    },
    async getMaterialList() {
      const res = await getInspectionMaterialListById({ inspectionId: this.inspectionDetail.id })
      // console.log(res)
      this.sampleTable = res.data
    },
    handleSelectionChange(val) {
      console.log(val)
      this.radioSelected = val.number // 选中行的number
      this.multipleSelection = val // 选中的一行数据
    },
    handleSizeChange(pageSize) {
      this.pageParams.pageSize = pageSize
    },
    handleCurrentChange(pageNo) {
      this.pageParams.pageNo = pageNo
    },
    headerBg({ row, rowIndex }) {
      console.log('rowIndex', rowIndex)
      if (rowIndex === 0) {
        return 'headerBgClass'
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.dialog-content{
  display: flex;
  .tree-container{
    flex: 30%;
    // background-color: #bfa;
    margin-right: 12px;
    margin-left: 12px;
    .all{
      display: block;
      color: #0077DB;
      padding: 5px;
    }
  }
  .table-container{
    flex: 70%;
    // background-color: #0077DB;
    margin-left: 12px;
    .el-table{
      .el-table__header_wrapper{
        .has-gutter{
          .headerBgClass{
            background-color: #606266;
          }
        }
      }
    }
    .el-pagination{
      margin-top: 12px;
    }
  }
}
.forInspectionDetail-main{
    min-height: calc(100vh - 88px);
    display: flex;