<!--
  功能：功能描述 巷道信息
  作者：Libra
  邮箱：mingxichen@163.com
  时间：2024年04月08日 15:46:01
  版本：v1.0
  修改记录：
  修改内容：
  修改人员：liwenhu
  修改时间：2024/04/15
-->
<template>
  <div class="vue-element-page-wrap" ref="tableContainer">
    <el-row class="page-search" justify="space-between" align="middle">
      <el-form ref="queryFormRef" :model="queryParamsData" :inline="true">
        <el-row :gutter="20">
          <el-col :span="3">
            <el-form-item label="货位" prop="SITENAME">
              <el-select v-model="formDataRefData.SITENAME" placeholder="Select" style="width: 160px">
                <el-option v-for="item in formDataRefData.SITENAMElIST" :key="item.value" :label="item.label"
                  :value="item.value" />
              </el-select>
            </el-form-item>
          </el-col>
          </el-row>
      </el-form>
      <div class="page-search-btns">
        <el-button type="primary" @click="handleQuery">搜索</el-button>
        <el-button @click="resetQuery">重置</el-button>
      </div>
    </el-row>

    <div class="vue-element-page-table">
      <div class="page-table-operate">
        <div class="page-table-title">
          <div class="page-table-title-left">
            <span>物料信息列表</span>
          </div>
        </div>
        <div class="page-table-operateBtns">
          <el-popover :persistent="false" placement="right" popper-class="config-table-wrap" trigger="click">
            <template #reference>
              <el-button class="operateBtns-setting">
                <svg-icon icon-class="table_title" width="16px" height="16px" />
              </el-button>
            </template>
            <ConfigTable :list="materialTableConfig.column" @updateList="updateList" />
          </el-popover>
        </div>
      </div>
      <el-table border v-loading="materialTableConfig.loading" :data="materialTableConfig.data" highlight-current-row
        row-key="id" style="width: 100%">
        <template v-for="(col, index) in materialTableConfig.column" :key="index">
          <el-table-column v-if="!col.hide" :label="col.header" show-overflow-tooltip>
            <template #default="scope">
              <span>{{ scope.row[col.field] }}</span>
            </template>
          </el-table-column>
        </template>
      </el-table>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { reactive, ref, onMounted, toRefs, getCurrentInstance, nextTick } from "vue";
import { ElForm, ElMessageBox, ElTable } from "element-plus";
const queryFormRef = ref(ElForm);
const formDataRef = ref(ElForm);
const queryParamsData = ref({
  MATERIALSPECNAME: ''
})
const formDataRefData = ref({
  SITENAME: '',//工厂
  SITENAMElIST:[{label:'A',value:'a'}],//工厂列表
  MATERIALSPECNAME: '',//物料编号
  MATERIALSPECDESCRIPTION: '',//物料描述
  CHECKSTATE: '',//check state
  CHECKSTATELIST:[{label:'A',value:'a'}],//check state列表
  ERPLOCATION: '',//ERP库位
  MATERIALTYPE: '',//物料类型
  MATERIALLIFEMARK: '',//寿命管理标记
  MATERIALGROUP: '',//物料组
  DESC_CN: '',//中文描述
  DESC_EN: '',//英文描述
  EXPIRINGDATE: '',//过期时间
  STOCKDATE: '',//入库有效期
  MATERIALGROUPDESCRIPTION: '',//物料组描述
  MATERIALUNIT: '',//单位
  MATERIALWEIGHT: '',//物料重量
  ERPFACTORY: '',//ERP工厂
  MATERIALSPECTYPE: '',//物料类别
})


const materialTableConfig = ref({
  loading: false,
  column: [] as any,
  data: [],
})
onMounted(() => {
  materialTableConfig.value.column = [
    { header: "工厂", field: "SITENAME", hide: false },
    { header: "物料编号", field: "MATERIALSPECNAME", hide: false },
    { header: "物料描述", field: "MATERIALSPECDESCRIPTION", hide: false },
    { header: "Check State", field: "CHECKSTATE", hide: false },
    { header: "物料类别", field: "MATERIALSPECTYPE", hide: false },
    { header: "生成时间", field: "MAKEDATE", hide: false },
    { header: "生成操作员", field: "MAKEUSER", hide: false },
    { header: "中文描述", field: "DESC_CN", hide: false },
    { header: "英文描述", field: "DESC_EN", hide: false },
    { header: "物料类型", field: "MATERIALTYPE", hide: false },
    { header: "物料组", field: "MATERIALGROUP", hide: false },
    { header: "物料组描述", field: "MATERIALGROUPDESCRIPTION", hide: false },
    { header: "单位", field: "MATERIALUNIT", hide: false },
    { header: "物料重量", field: "MATERIALWEIGHT", hide: false },
    { header: "ERP工厂", field: "ERPFACTORY", hide: false },
  ]
});
const handleQuery = () => {
  console.log(queryParamsData.value);
}
const resetQuery = () => {
  queryFormRef.value.resetFields();
}
const updateList = (col: any) => {
  materialTableConfig.value.column = col
}
const buildInfo = () => { }
const editInfo = () => { }
const saveInfo = () => { }
const exiteInfo = () => {
  formDataRef.value.resetFields()
}
</script>

<style scoped></style>

