deviceInventory.vue 8.48 KB
<template>
  <d2-container>
    <el-card shadow="never">
      <el-form :inline="true" :model="formInline" class="demo-form-inline" size="small">
        <el-form-item label="设备类型">
          <el-select v-model="formInline.devTypeId" placeholder="请选择">
            <el-option value="" label="全部">全部</el-option>
            <el-option v-for="item in deviceTypeList" :key="item.id" :value="item.id" :label="item.name">{{item.name}}</el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="设备编号">
          <el-input v-model="formInline.sn" placeholder="请输入发货单号" />
        </el-form-item>
        <el-form-item label="状态">
          <el-select v-model="formInline.typeId" placeholder="请选择">
            <el-option value="" label="全部">全部</el-option>
            <el-option value="IN" label="入库">入库</el-option>
            <el-option value="OUT" label="出库">出库</el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" :loading="tableLoading" @click="getList()">搜索</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-download" :loading="exportLoading" @click="getList()">导出</el-button>
        </el-form-item>
      </el-form>
    </el-card>

    <!-- 表格区域 开始 -->
    <div class="table_box">
        <el-table v-loading="tableLoading" :data="tableData" stripe style="width: 100%" size="small" border>
          <el-table-column type="index" :index="index => {return index+1}" label="序号" width="80" />
          <el-table-column prop="iccid" label="ICCID" :width="tdWidth" />
          <el-table-column prop="imei" label="IMEI" :width="tdWidth" />
          <el-table-column prop="sn" label="SN" :width="tdWidth" />
          <el-table-column prop="attribCode" label="设备类型编号" :width="tdWidth" />
          <el-table-column prop="model" label="设备型号" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.attribMana.devMnumName }}</template>
          </el-table-column>
          <el-table-column prop="batch" label="是否联网" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.attribMana.orNetName }}</template>
          </el-table-column>
          <el-table-column prop="vcode" label="卡类型" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.attribMana.cardSelfName }}</template>
          </el-table-column>
          <el-table-column prop="logisticsNo" label="是否带屏" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.attribMana.screenName }}</template>
          </el-table-column>
          <el-table-column prop="attribMana" label="有源/无源" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.attribMana.sourceName }}</template>
          </el-table-column>
          <el-table-column prop="typeName" label="机型" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.attribMana.typeName }}</template>
          </el-table-column>
          <el-table-column prop="factoryName" label="裸机/整机" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.attribMana.modelName }}</template>
          </el-table-column>
          <el-table-column prop="factoryName" label="配置" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.attribMana.configureName }}</template>
          </el-table-column>
          <el-table-column prop="factoryName" label="尺寸" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.attribMana.msizeName }}</template>
          </el-table-column>
          <el-table-column prop="factoryName" label="主板版本号" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.attribMana.boardVersion }}</template>
          </el-table-column>
          <el-table-column prop="factoryName" label="软件版本号" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.attribMana.softVersion }}</template>
          </el-table-column>
          <el-table-column prop="batch" label="设备批次号" :width="tdWidth" />
          <el-table-column prop="status" label="状态" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.status == 'OUT'?'出库':'入库' }}</template>
          </el-table-column>
          <el-table-column prop="imei" label="入库工厂" :width="tdWidth">
            <template slot-scope="scoped">{{ scoped.row.wareHouseInfo.wareHouseName }}</template>
          </el-table-column>
          <el-table-column prop="imei" label="当前所在工厂/仓库" :width="tdWidth">
          <template slot-scope="scoped">{{ scoped.row.wareHouseInfo.wareHouseUpName }}</template>
          </el-table-column>
          <el-table-column prop="createdDate" label="入库时间" :width="tdWidth">
            <template slot-scope="scoped">{{ DATEFORMATE(scoped.row.createdDate,'YYYY-MM-DD HH:mm:ss') }}</template>
          </el-table-column>
          <el-table-column prop="updatedDate" label="出库时间" :width="tdWidth">
            <template slot-scope="scoped">{{ DATEFORMATE(scoped.row.updatedDate,'YYYY-MM-DD HH:mm:ss') }}</template>
          </el-table-column>
          <el-table-column prop="orderCode" label="出库发货单号" :width="tdWidth" />
          <el-table-column label="操作" fixed="right" align="center">
            <template slot-scope="scope">
              <el-link type="primary" :underline="false" v-if="scope.row.status == 'IN'" @click="editEvent(scope.row)">修改</el-link>
            </template>
          </el-table-column>
        </el-table>
        <div class="pagination_list">
          <el-pagination
            background
            layout="sizes, total,prev, pager, next, jumper"
            :total="pageTotal"
            :page-size="pageSize"
            :page-sizes="pageSizes"
            @current-change="getList"
            @size-change="changePageSize"
          />
        </div>
    </div>
    <!-- 表格区域 end -->

    <edit-inventory :deviceInfo="current" v-if="editShow" :show="editShow" @closed="closeDialog"/>


  </d2-container>
</template>

<script>
import {
  GETLISTDEVICEINFO,
  GETDEVICETYPE
} from '@/http/interface'
import EditInventory from './editInventory'
export default {
  components: {
    'edit-inventory': EditInventory
  },
  data() {
    return {
      formInline: {},
      tableData: [],
      dialogVisible: false,
      tableLoading: false,
      pageTotal: 0,
      userInfo: {},
      currentPage: 1,
      pageSizes: [10, 20, 30, 40],
      pageSize: 10,
      registerDate: [],
      tdWidth: 170,
      DATEFORMATE: (str, type) => { return this.$Util.dateFormate(str, type) },
      deviceTypeList: [],
      exportLoading: false,
      editShow:false,
      current:{}
    }
  },
  created() {

  },

  mounted: function() {
    this.getList()
    this.getDeviceList()
  },
  methods: {

    /**
       * 查询列表
       */
    getList: function(current) {
      const _this = this
      const oParams = _this.getParams()
      console.log(current)
      oParams.pageNum = current || _this.currentPage
      _this.tableLoading = true
      GETLISTDEVICEINFO(oParams).then(res => {
        console.log(res)
        _this.tableLoading = false
        if (res.returnCode == 0) {
          const { data } = res
          const { total, list } = data
          _this.tableData = list || []
          _this.pageTotal = total
        }
      })
    },

    /**
       * 获取查询参数
       */
    getParams: function() {
      const oParams = this.formInline

      if (oParams.sn) {
        oParams.iccid = oParams.sn
        oParams.imei = oParams.sn
      } else {
        delete oParams.iccid
        delete oParams.imei
      }

      oParams.pageSize = this.pageSize
      return oParams
    },


    /**
     * 每页展示
     */
    changePageSize: function(e) {
      this.pageSize = e
      this.getList()
    },

    /**
     * 获取设备类型列表
     */
    getDeviceList: function() {
      let _this = this
      GETDEVICETYPE().then(res => {
        const { data } = res
        _this.deviceTypeList = data || []

      })
    },

    /**
     * 关闭弹框
     */
    closeDialog:function(){
      this.editShow = false;
    },

    /**
     * 修改
     */
    editEvent:function(row){
      this.editShow = true;
      this.current = row;
    }


  }

}
</script>

<style lang="scss">
  .table_box {
    margin: 20px 0;
  }
</style>