deviceSetting.vue 7.3 KB
<template>
  <d2-container>
    <el-card
      shadow="never"
      slot="header"
    >
      <el-form
        :inline="true"
        :model="formInline"
        class="demo-form-inline"
        size="small"
      >
        <el-form-item label="设备类型">
          <el-select
            v-model="formInline.deviceTypeId"
            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.attribName"
            placeholder="请输入物料编码"
            clearable
          />
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            :size="btn_size"
            icon="el-icon-search"
            :loading="tableLoading"
            @click="getList()"
          >搜索</el-button>
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            :size="btn_size"
            icon="el-icon-plus"
            :loading="tableLoading"
            @click="showModal = true"
          >新建设备配置</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="attribCode"
          label="物料编码"
          width="150"
        />
        <el-table-column
          prop="attribName"
          label="物料名称"
          width="250"
        />
        <el-table-column
          prop="devTypeName"
          label="设备类型"
          :width="tdWidth"
        />
        <el-table-column
          prop="devMnumName"
          label="设备型号"
          :width="tdWidth"
          :formatter="formatter"
        />
        <el-table-column
          prop="orNetName"
          label="是否联网"
          :width="tdWidth"
          :formatter="formatter"
        />
        <el-table-column
          prop="cardSelfName"
          label="卡类型"
          :width="tdWidth"
          :formatter="formatter"
        />
        <el-table-column
          prop="orOpenName"
          label="专用/通用"
          :width="tdWidth"
          :formatter="formatter"
        />
        <el-table-column
          prop="screenName"
          label="是否带屏"
          :width="tdWidth"
          :formatter="formatter"
        />
        <el-table-column
          prop="sourceName"
          label="有源/无源"
          :width="tdWidth"
          :formatter="formatter"
        />
        <el-table-column
          prop="msizeName"
          label="尺寸"
          :width="tdWidth"
          :formatter="formatter"
        />
        <el-table-column
          prop="modelName"
          label="机型"
          :width="tdWidth"
          :formatter="formatter"
        />
        <el-table-column
          prop="typeName"
          label="裸机/整机"
          :width="tdWidth"
          :formatter="formatter"
        />
        <el-table-column
          prop="configureName"
          label="配置"
          :width="tdWidth"
          :formatter="formatter"
        />
        <el-table-column
          prop="boardVersion"
          label="主板版本号"
          :width="tdWidth"
          :formatter="formatter"
        />
        <el-table-column
          prop="softVersion"
          label="软件版本号"
          :width="tdWidth"
          :formatter="formatter"
        />
      </el-table>
      <div class="pagination_list">
        <el-pagination
          background
          small
          layout="sizes, total,prev, pager, next, jumper"
          :total="pageTotal"
          :page-size="pageSize"
          :page-sizes="pageSizes"
          @current-change="getList"
          @size-change="changePageSize"
        />
      </div>
    </div>
    <!-- 表格区域 end -->

    <!-- 弹框 开始 -->
    <!-- <el-dialog title="新建配置" :visible.sync="showModal" v-if="showModal" width="600px">
        <add-setting ref="addSetting" v-if="showModal" />
      <div slot="footer">
        <el-button type="primary" @click="saveInfo()">提交</el-button>
        <el-button @click="showModal = false">取消</el-button>
      </div>
    </el-dialog> -->
    <add-setting
      :show="showModal"
      v-if="showModal"
      @closed="closeAddSettingDialog"
    />
    <!-- 弹框 end -->

  </d2-container>
</template>

<script>
import {
  PAGEATTRIBMANA,
  GETDEVICETYPE,
  // SAVEATTRIBMANA 
} from "@/http/interface";
import GlsxDialog from "@/components/dialog/index";
import AddSetting from "./addSetting";
export default {
  components: {
    "glsx-dialog": GlsxDialog,
    "add-setting": AddSetting
  },
  data() {
    return {
      formInline: {},
      tableData: [],
      dialogVisible: false,
      tableLoading: false,
      pageTotal: 0,
      userInfo: {},
      currentPage: 1,
      pageSizes: [10, 20, 30, 40],
      pageSize: 10,
      tdWidth: 100,
      DATEFORMATE: str => {
        return this.$Util.dateFormate(str);
      },
      CUTSTR: (str, num) => {
        return this.$Util.cutStr(str, num);
      },
      deviceTypeList: [],
      showModal: false,
      showChildModal: false
    };
  },
  created() { },

  mounted: function () {
    this.getList();
    this.getDeviceList();
  },
  methods: {
    formatter: function (row, column, cellValue) {
      if (cellValue) {
        if (cellValue == '未知' || cellValue == "'未知'") {
          return '//'
        } else {
          return cellValue
        }
      } else {
        return ''
      }
    },

    /**
     * 查询列表
     */
    getList: function (current) {
      const _this = this;
      const oParams = _this.getParams();
      oParams.pageNum = current || _this.currentPage;
      _this.tableLoading = true;
      PAGEATTRIBMANA(oParams).then(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;
      oParams.pageSize = this.pageSize;
      return oParams;
    },

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

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

    closeAddSettingDialog: function (sub) {
      this.showModal = false
      if (sub) {
        this.getList()
      }
    }

  }
};
</script>

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