<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">刷新</el-button>
        <el-button
          type="warning"
          plain
          icon="Download"
          @click="handleExport"
          v-hasPermi="['calc:sjl:export']"
        >导出</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="loading" height="750px" :data="dataList">
      <el-table-column label="设备ID" align="center" prop="device" />
      <el-table-column label="L1梳栉送经量" align="center" prop="l1" />
      <el-table-column label="L2梳栉送经量" align="center" prop="l2" />
      <el-table-column label="L3梳栉送经量" align="center" prop="l3" />
      <el-table-column label="L4梳栉送经量" align="center" prop="l4" />
      <el-table-column label="L5梳栉送经量" align="center" prop="l5" />
      <el-table-column label="设定落布米长" align="center" prop="length" />
      <el-table-column label="牵拉密度" align="center" prop="density" />
      <el-table-column label="卷曲张力系数" align="center" prop="coefficient" />
    </el-table>
  </div>
</template>

<script setup name="SJL">
import { Get09Data } from "@/api/calc/sjl";

const { proxy } = getCurrentInstance();

const dataList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");

const data = reactive({
  form: {},
  queryParams: {
    deviceId: null,
    orderByColumn: 'id',
    isAsc: 'descending'
  },
  rules: {
  }
});

const { queryParams, form, rules } = toRefs(data);

/** 查询日统计数据列表 */
function getList() {
  loading.value = true;
  dataList.value = [];
  Get09Data(queryParams.value).then(response => {
    loading.value = false;
    if(response.code!=0){
      return;
    }
    dataList.value = response.data;
    total.value = response.total;

  });
}

// 取消按钮
function cancel() {
  open.value = false;
  reset();
}

// 表单重置
function reset() {
  form.value = {
    id: null,
    deviceId: null,
  };
  proxy.resetForm("calcDayRef");
}

/** 搜索按钮操作 */
function handleQuery() {
  getList();
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm("queryRef");
  handleQuery();
}

// 多选框选中数据
function handleSelectionChange(selection) {
  ids.value = selection.map(item => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}

/** 导出按钮操作 */
function handleExport() {
  proxy.download('api/export/warp-run-in', {
    ...queryParams.value
  }, `送经量统计_${new Date().getTime()}.xlsx`)
}

getList();
</script>
