<template>
  <div class="p-2">
    <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
      <div v-show="showSearch" class="mb-[10px]">
        <el-card shadow="hover">
          <el-form ref="queryFormRef" :model="queryParams" :inline="true">
            <el-form-item label="订单编号" prop="">
              <el-input placeholder="请输入订单编号" clearable @keyup.enter="handleQuery" />
            </el-form-item>
            <el-form-item label="状态">
              <el-select placeholder="请选择状态" clearable>
                <!-- <el-option v-for="dict in order_status" :key="dict.value" :label="dict.label" :value="dict.value" /> -->
              </el-select>
            </el-form-item>
            <el-form-item label="提报部门" prop="">
              <el-select placeholder="请选择提报部门" clearable>
                <!-- <el-option v-for="dict in order_status" :key="dict.value" :label="dict.label" :value="dict.value" /> -->
              </el-select>
            </el-form-item>
            <el-form-item label="提交时间" prop="orderTime">
              <el-date-picker
                type="daterange"
                range-separator="至"
                start-placeholder="开始时间"
                end-placeholder="结束时间"
                value-format="YYYY-MM-DD"
              />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
              <el-button icon="Refresh" @click="resetQuery">重置</el-button>
            </el-form-item>
          </el-form>
        </el-card>
      </div>
    </transition>

    <el-card shadow="never">
      <template #header>
        <el-row :gutter="10" class="mb8">
          <el-col :span="22"> 询价单管理信息列表 </el-col>
        </el-row>
      </template>

      <el-table v-loading="loading" border :data="orderInquiryList" @selection-change="handleSelectionChange">
        <el-table-column label="订单编号" align="center" prop="" />
        <el-table-column label="类型" align="center" prop="" />
        <el-table-column label="公司名称" align="center" prop="" />
        <el-table-column label="公司名称" align="center" prop="" />
        <el-table-column label="提交时间" align="center" prop="createTime">
          <template #default="scope">
            <span>{{ parseTime(scope.row.createTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column label="需求报价时间" align="center">
          <!-- <template #default="scope">
             <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
          </template> -->
        </el-table-column>
        <el-table-column label="报价时间" align="center">
          <!-- <template #default="scope">
             <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
          </template> -->
        </el-table-column>
        <el-table-column label="报价负责人" align="center" prop="supplierName" />
        <el-table-column label="订单状态" align="center" prop="" />

        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <!-- <template #default="scope">
            <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['order:orderInquiry:edit']">编辑</el-button>
          </template> -->
        </el-table-column>
      </el-table>

      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
    </el-card>
  </div>
</template>

<script setup name="OrderInquiry" lang="ts">
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_platform_yes_no, check_status, revenue_type } = toRefs<any>(proxy?.useDict('sys_platform_yes_no', 'check_status', 'revenue_type'));

const orderInquiryList = ref<[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const router = useRouter();
const queryFormRef = ref<ElFormInstance>();
const queryParams = reactive<any>({
  pageNum: 1,
  pageSize: 10
});
const dialog = reactive<DialogOption>({
  visible: false,
  title: ''
});

/** 表单重置 */
const reset = () => {};

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.value.pageNum = 1;
  getList();
};

/** 重置按钮操作 */
const resetQuery = () => {
  queryFormRef.value?.resetFields();
  handleQuery();
};

/** 多选框选中数据 */
const handleSelectionChange = (selection: any[]) => {
  ids.value = selection.map((item) => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
};
const getList = () => {
  loading.value = true;
  setTimeout(() => {
    loading.value = false;
  }, 1000);
};

onMounted(() => {
  getList();
});

onActivated(() => {});
</script>
