index.vue 10.4 KB
<template>
  <div class="app-container">
    <!--    <el-row>-->
    <!--      <el-col :gutter="20">-->
    <!--        <el-select-->
    <!--          v-model=""-->
    <!--          placeholder="校验数据库"-->
    <!--          clearable-->
    <!--          size="small"-->
    <!--          style="width: 240px"-->
    <!--        >-->
    <!--          <el-option-->
    <!--            v-for="item in databaseOptions"-->
    <!--            :key="item.id"-->
    <!--            :label="item.name"-->
    <!--            :value="item.code"-->
    <!--          />-->
    <!--        </el-select>-->
    <!--      </el-col>-->
    <!--    </el-row>-->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          v-if="activeName=='first'"
          type="primary"
          size="mini"
          @click="checkList"
          v-hasPermi="['']"
        >校验库位状态
        </el-button>
        <el-button
          v-if="activeName=='second'"
          type="primary"
          size="mini"
          @click="checkList"
          v-hasPermi="['']"
        >查询
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          v-if="activeName=='first'"
          type="primary"
          size="mini"
          @click="checkListForContainer"
          v-hasPermi="['']"
        >校验库位上的容器
        </el-button>
      </el-col>
    </el-row>
    <el-tabs v-model="activeName" type="card">
      <el-tab-pane label="库位校验" name="first">
        <el-table
          v-loading="locationLoading"
          :data="locationList"
          ref="table"
        >
          <el-table-column
            label="本地库位编号"
            align="center"
            prop="localLocation"
            v-if="findCol('本地库位编号',1)"
          />
          <el-table-column
            label="本地容器编号"
            align="center"
            prop="localContain"
            sortable
            v-if="findCol('本地容器编号',1)"
          />
          <el-table-column
            label="本地库位状态"
            align="center"
            prop="localLocationStatus"
            sortable
            v-if="findCol('本地库位状态',1)"
          >
          </el-table-column>
          <el-table-column
            label="对照库位编号"
            align="center"
            prop="contrastLocation"
            :show-overflow-tooltip="true"
            v-if="findCol('对照库位编号',1)"
          >
          </el-table-column>
          <el-table-column
            label="对照容器编号"
            align="center"
            prop="contrastContain"
            v-if="findCol('对照容器编号',1)"
          >
          </el-table-column>
          <el-table-column
            label="对照库位状态"
            align="center"
            prop="contrastLocationStatus"
            v-if="findCol('对照库位状态',1)"
          >
          </el-table-column>
        </el-table>

<!--        <pagination-->
<!--          v-show="locationTotal > 0"-->
<!--          :total="locationTotal"-->
<!--          :page.sync="queryHeaderParams.pageNum"-->
<!--          :limit.sync="queryHeaderParams.pageSize"-->
<!--          @pagination="checkList"-->
<!--        />-->
      </el-tab-pane>
      <el-tab-pane
        label="任务检验"
        name="second"
      >

        <el-table
          v-loading="taskLoading"
          :data="taskList"
          ref="table"
        >
          <el-table-column
            label="本地任务id"
            align="center"
            prop="localId"
            v-if="findCol('本地任务id',2)"
          />
          <el-table-column
            label="对照任务id"
            align="center"
            prop="contrastId"
            v-if="findCol('对照任务id',2)"
          />
          <el-table-column
            label="容器编号"
            align="center"
            prop="localContainerCode"
            v-if="findCol('容器编号',2)"
          />
          <el-table-column
            label="本地任务状态"
            align="center"
            prop="localTaskStatus"
            v-if="findCol('本地任务状态',2)"
          />
          <el-table-column
            label="对照任务状态"
            align="center"
            prop="contrastTaskStatus"
            v-if="findCol('对照任务状态',2)"
            :show-overflow-tooltip="true"
          >
          </el-table-column>
        </el-table>

<!--        <pagination-->
<!--          v-show="taskTotal > 0"-->
<!--          :total="taskTotal"-->
<!--          :page.sync="queryDetailParams.pageNum"-->
<!--          :limit.sync="queryDetailParams.pageSize"-->
<!--          @pagination="getDetailList"-->
<!--        />-->
      </el-tab-pane>
    </el-tabs>

    <!-- 添加或修改入库单库位校验对话框 -->
<!--    <el-dialog-->
<!--      :title="configTitle"-->
<!--      :visible.sync="headerOpen"-->
<!--      width="500px"-->
<!--      append-to-body-->
<!--    >-->
<!--      <el-form-->
<!--        ref="locationForm"-->
<!--        :model="locationForm"-->
<!--        :rules="headerRules"-->
<!--        label-width="100px"-->
<!--      >-->
<!--        <el-form-item label="入库类型" prop="receiptType">-->

<!--        </el-form-item>-->
<!--      </el-form>-->
<!--      <div slot="footer" class="dialog-footer">-->
<!--        <el-button type="primary" @click="submitConfigForm">确 定</el-button>-->
<!--        <el-button @click="headerCancel">取 消</el-button>-->
<!--      </div>-->
<!--    </el-dialog>-->

  </div>
</template>

<script>
  import {
    locationStatusList,
    locationWithContainerList,
    taskStatuslist
  } from "@/api/tool/verify";

  export default {
    name: "verify",
    data() {
      return {
        // 库位校验遮罩层
        locationLoading: false,
        // 库位校验总条数
        locationTotal: 0,
        // 库位校验表格数据
        locationList: [],
        // 库位校验是否显示弹出层
        headerOpen: false,
        // 数据库下拉数据
        databaseOptions: [],
        // 库位校验查询参数
        queryHeaderParams: {
          pageNum: 1,
          pageSize: 10
        },
        // 数据库表单
        databaseForm: {},
        // 数据源配置表单校验
        databaseRules: {},
        // 任务校验遮罩层
        taskLoading: false,
        // 任务校验总条数
        taskTotal: 0,
        // 任务校验表格数据
        taskList: [],
        // 任务校验是否显示弹出层
        detailOpen: false,
        // 任务校验查询参数
        queryDetailParams: {
          pageNum: 1,
          pageSize: 10,
        },
        colData: [
          {title: "本地库位编号", istrue: true},
          {title: "本地容器编号", istrue: true},
          {title: "本地库位状态", istrue: true},
          {title: "对照库位编号", istrue: true},
          {title: "对照容器编号", istrue: true},
          {title: "对照库位状态", istrue: true}
        ],
        colData2: [
          {title: "本地任务id", istrue: true},
          {title: "对照任务id", istrue: true},
          {title: "本地任务状态", istrue: true},
          {title: "容器编号", istrue: true},
          {title: "对照任务状态", istrue: true}
        ],
        statusCloseData:[
          "对照库位编号",
          "本地容器编号",
          "对照容器编号"
        ],
        containerCloseData:[
          "本地库位状态",
          "对照库位状态"
        ],
        activeName: "first"
      };
    },
    created() {

    },
    beforeUpdate() {
      this.$nextTick(() => {
        this.$refs["table"].doLayout();
      });
    },
    methods: {
      //库存状态字典翻译
      // inventoryStsFormat(row, column) {
      //   return this.selectDictLabel(this.inventoryStsOptions, row.inventorySts);
      // },

      /** 查询按钮操作 */
      checkList() {
        if (this.activeName == "first") {
          locationStatusList().then(res =>{
            if (res.code==200){
              if (res.data==null){
                this.msgSuccess(res.msg)
                this.locationLoading = false
              }else {
                this.reset()
                this.msgSuccess(res.msg)
                this.statusCloseData.forEach(item=>{
                  this.colData.forEach(ob => {
                    if (ob.title == item){
                      ob.istrue = false
                    }
                  })
                })
                this.locationList = res.data
                this.locationLoading = false
              }
            }
          })
        }
        if (this.activeName == "second") {
          taskStatuslist().then(res =>{
            if (res.code==200){
              if (res.data==null){
                this.msgSuccess(res.msg)
                this.taskLoading = false
              }else {
                this.msgSuccess(res.msg)
                this.locationList = res.data
                this.taskLoading = false
              }
            }
          })
        }
      },

      checkListForContainer(){
        locationWithContainerList().then(res =>{
          if (res.code==200){
            if (res.data==null){
              this.msgSuccess(res.msg)
              this.locationLoading = false
            }else {
              this.reset()
              this.containerCloseData.forEach(item=>{
                this.colData.forEach(ob => {
                  if (ob.title == item){
                    ob.istrue = false
                  }
                })
              })
              this.msgSuccess(res.msg)
              this.locationList = res.data
              this.locationLoading = false
            }
          }
        })
      },
      reset(){
        this.colData.forEach(item =>{
          item.istrue = true
        })
      },
      /** 提交审核按钮操作 */
      submitReview() {

      },
      /** 表格切换字段显示操作 */
      findCol(title, index) {
        let result = false
        if (index == 1) {
          this.colData.forEach(item => {
            if (item.title === title) {
              return result = item.istrue
            }
          })
          return result
        } else if (index == 2) {
          this.colData2.forEach(item => {
            if (item.title === title) {
              return result = item.istrue
            }
          })
          return result
        }
      },
      },
  };
</script>