yuyu
2023-08-08 314d6fc39ede1b94cdab512adb9dc806471ef8a4
委托检验查询功能
已修改4个文件
138 ■■■■ 文件已修改
src/api/inspection/commisioninspection.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inspectionManagement/commissionInspection/index.vue 119 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/standardLibrary/index.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/inspection/commisioninspection.js
@@ -8,3 +8,11 @@
    params
  })
}
export function getlink(params){
  return request({
    url:'/link-basic-table/link',
    method:'get',
    params
  })
}
src/utils/request.js
@@ -21,6 +21,7 @@
      // please modify it according to the actual situation
      config.headers['X-Token'] = getToken()
    }
    console.log('config' ,config)
    return config
  },
  error => {
src/views/inspectionManagement/commissionInspection/index.vue
@@ -31,8 +31,8 @@
                </el-select>
              </el-form-item>
              <el-form-item>
                <el-button type="primary">查询</el-button>
                <el-button type="primary" plain>重置</el-button>
                <el-button type="primary" @click="search">查询</el-button>
                <el-button type="primary" plain @click="reset">重置</el-button>
              </el-form-item>
              </el-form>
              <el-form>
@@ -42,10 +42,10 @@
          <div class="library-table">
            <div class="table-header">
              <div class="search-bar">
                <el-radio-group v-model="radioValue">
                  <el-radio-button label="全部" />
                  <el-radio-button label="待检验" />
                  <el-radio-button label="已检验" />
                <el-radio-group v-model="radioValue" @change="radioclick">
                <el-radio-button v-for="item in conditionsOptions" :key="item.value" :label="item.value">
                {{ item.label }}
              </el-radio-button>
                </el-radio-group>
              </div>
              <div class="generateInsp">
@@ -73,7 +73,7 @@
                <el-table-column
                  prop="entrust_coding"
                  label="委托编号"
                  min-width="8%"
                  min-width="10%"
                />
                <el-table-column
                  prop="entrusted"
@@ -160,7 +160,7 @@
</template>
<script>
import { getCommisionList } from '@/api/inspection/commisioninspection'
import { getCommisionList, getlink } from '@/api/inspection/commisioninspection'
export default {
  data() {
    return {
@@ -173,14 +173,8 @@
      options: [{
        value: '1',
        label: '部门1'
      }, {
        value: '2',
        label: '部门2'
      }, {
        value: '3',
        label: '部门3'
      }],
      radioValue: '',
      radioValue: 0,
      commisionTable: [{
        specifications_models: "GGXH-AAAAA",
        inspectionTime: "2023-08-03",
@@ -194,6 +188,20 @@
        sample_name: "发动机",
        inspection_status: 1
      }],
      conditionsOptions: [
        {
          label: '全部',
          value: 0
        },
        {
          label: '已检验',
          value: 1
        },
        {
          label: '待检验',
          value: 2
        }
      ],
      currentPage: 1,
      pageSize: 5,
      total: 100,
@@ -213,20 +221,87 @@
    async getCommisionList(){
      const res = await getCommisionList({pageNo:this.currentPage , pageSize:this.pageSize})
      this.commisionTable = res.data.row
      // this.total = res.data.row.length
      console.log(this.commisionTable)
      this.total = res.data.total
      // console.log(res)
       // 获取所有的委托单位名称
      const allDepartmentNames = [...new Set(this.commisionTable.map(item => item.entrusted))]
      // 将allDepartmentNames转换为options需要的格式
      this.options = allDepartmentNames.map(name => ({ value: name, label: name }))
    },
    // 查询方法
    async search() {
    // 将搜索条件作为参数传递给getCommisionList方法
    if(this.radioValue === 0){
      const res = await getCommisionList({
        pageNo: this.currentPage,
        pageSize: this.pageSize,
        entrustCoding: this.searchData.code,
        sampleName: this.searchData.name,
        entrusted: this.searchData.department,
      })
    }else{
      const res = await getCommisionList({
        pageNo: this.currentPage,
        pageSize: this.pageSize,
        entrustCoding: this.searchData.code,
        sampleName: this.searchData.name,
        entrusted: this.searchData.department,
        inspectionStatus: this.radioValue
      })
    }
      // console.log(res)
      this.commisionTable = res.data.row
      this.total = res.data.total
    },
    // 重置方法
    reset() {
      // 重置搜索条件
      this.searchData.code = ''
      this.searchData.name = ''
      this.searchData.department = ''
      this.radioValue = '0'
      // 重新获取数据
      this.getCommisionList()
    },
    async radioclick(){
      // 处理点击radio的时间
      // console.log('radioValue',this.radioValue)
      if(this.radioValue === 0){
        this.getCommisionList()
      }else{
        const res = await getCommisionList({pageNo:this.currentPage, pageSize:this.pageSize, inspectionStatus: this.radioValue})
        // console.log(res)
        this.commisionTable = res.data.row
        this.total = res.data.total
      }
    },
    // 每页条数改变时触发 选择一页显示多少行
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
    async handleSizeChange(val) {
      // console.log(`每页 ${val} 条`)
      this.currentPage = 1
      this.pageSize = val
      if(this.radioValue === 0){
        this.getCommisionList()
      }else{
        const res = await getCommisionList({pageNo:this.currentPage, pageSize:this.pageSize, inspectionStatus: this.radioValue})
        this.commisionTable = res.data.row
        this.total = res.data.total
      }
    },
    // 当前页改变时触发 跳转其他页
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
    async handleCurrentChange(val) {
      // console.log(`当前页: ${val}`)
      this.currentPage = val
      this.commisionTable = getCommisionList({pageNo:this.currentPage , pageSize:this.pageSize})
      if(this.radioValue === 0){
        this.getCommisionList()
      }else{
        const res = await getCommisionList({pageNo:this.currentPage, pageSize:this.pageSize, inspectionStatus: this.radioValue})
        this.commisionTable = res.data.row
        this.total = res.data.total
      }
    },
    goToaddCommision() {
      this.$router.push('/inspectionManagement/commissionInspection/addCommision')
src/views/standardLibrary/index.vue
@@ -384,7 +384,7 @@
//   height: 800px;
// }
.standard-library-main{
  width: 100%;
  width: 100vh;
  height: 100%;
// 页面中心内容区域
  .content-main{
@@ -398,12 +398,12 @@
      background: #fff;
    }
    .library-bom{
      flex: 2;
      // width: 20%;
      padding-right: 10px;
      width: 40vh;
      // height: 100%;
      max-height: 100%;
      margin-right: 12px;
      overflow-y: scroll;
      // overflow-y: scroll;
      .el-tree {
        // margin-top: 12px;
        ::v-deep .el-tree-node__content{
@@ -453,7 +453,7 @@
    }
    .library-table{
      // height: 100%;
      flex: 8;
      width: 170vh;
      max-height: 100%;
      // flex: 8;
      margin-left: 12px;