1286 lines
41 KiB
Vue

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="羊只id" prop="id">
<el-input
v-model="queryParams.id"
placeholder="请输入羊只id"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="管理耳号" prop="bsManageTags">
<el-input
v-model="queryParams.bsManageTags"
placeholder="请输入管理耳号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="电子耳号" prop="electronicTags">
<el-input
v-model="queryParams.electronicTags"
placeholder="请输入电子耳号"
clearable
@keyup.enter="handleQuery"
/>
</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-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['sheep_file:sheep_file:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['sheep_file:sheep_file:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<div style="margin-bottom: 10px;">
<el-button type="info" plain icon="Setting" @click="openColumnDialog">显示列</el-button>
</div>
<el-table
v-loading="loading"
:data="sheep_fileList"
@selection-change="handleSelectionChange"
style="width: 100%"
border
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
v-if="columns['id'].visible"
label="羊只id"
align="center"
prop="id"
width="120"
fixed="left"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">羊只id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['bsManageTags'].visible"
label="管理耳号"
align="center"
prop="bsManageTags"
width="120"
fixed="left"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">管理耳号</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['ranchId'].visible"
label="牧场id"
align="center"
prop="ranchId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">牧场id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['drRanch'].visible"
label="牧场名称"
align="center"
prop="drRanch"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">牧场名称</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['sheepfoldId'].visible"
label="羊舍id"
align="center"
prop="sheepfoldId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">羊舍id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['sheepfoldName'].visible"
label="羊舍名称"
align="center"
prop="sheepfoldName"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">羊舍名称</span>
</template>
<template #default="scope">
<el-tooltip :content="scope.row.sheepfoldName" placement="top">
<span style="display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
{{ scope.row.sheepfoldName }}
</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column
v-if="columns['electronicTags'].visible"
label="电子耳号"
align="center"
prop="electronicTags"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">电子耳号</span>
</template>
<template #default="scope">
<el-tooltip :content="scope.row.electronicTags" placement="top">
<span style="display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
{{ scope.row.electronicTags }}
</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column
v-if="columns['varietyId'].visible"
label="品种id"
align="center"
prop="varietyId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">品种id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['variety'].visible"
label="品种"
align="center"
prop="variety"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">品种</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['family'].visible"
label="家系"
align="center"
prop="family"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">家系</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['name'].visible"
label="羊只类型"
align="center"
prop="name"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">羊只类型</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['gender'].visible"
label="性别"
align="center"
prop="gender"
width="120"
sortable
>
<!-- <template #header>
<span style="font-weight: bold; color: #333;">性别</span>
</template> -->
<template #default="scope">
<dict-tag :options="sheep_gender" :value="scope.row.gender"/>
</template>
</el-table-column>
<el-table-column
v-if="columns['birthday'].visible"
label="出生日期"
align="center"
prop="birthday"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">出生日期</span>
</template>
<template #default="scope">
<span>{{ parseTime(scope.row.birthday, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['dayAge'].visible"
label="日龄"
align="center"
prop="dayAge"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">日龄</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['monthAge'].visible"
label="月龄"
align="center"
prop="monthAge"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">月龄</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['parity'].visible"
label="胎次"
align="center"
prop="parity"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">胎次</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['birthWeight'].visible"
label="出生体重"
align="center"
prop="birthWeight"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">出生体重</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['weaningDate'].visible"
label="断奶日期"
align="center"
prop="weaningDate"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">断奶日期</span>
</template>
<template #default="scope">
<span>{{ parseTime(scope.row.weaningDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['statusId'].visible"
label="羊只状态"
align="center"
prop="statusId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">羊只状态</span>
</template>
<template #default="scope">
<dict-tag :options="sheep_status" :value="scope.row.statusId"/>
</template>
</el-table-column>
<el-table-column
v-if="columns['weaningWeight'].visible"
label="断奶体重"
align="center"
prop="weaningWeight"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">断奶体重</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['currentWeight'].visible"
label="当前体重"
align="center"
prop="currentWeight"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">当前体重</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['breedStatusId'].visible"
label="繁育状态id"
align="center"
prop="breedStatusId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">繁育状态id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['breed'].visible"
label="繁殖状态"
align="center"
prop="breed"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">繁殖状态</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['bsFatherId'].visible"
label="父号id"
align="center"
prop="bsFatherId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">父号id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['fatherManageTags'].visible"
label="父亲管理耳号"
align="center"
prop="fatherManageTags"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">父亲管理耳号</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['bsMotherId'].visible"
label="母号id"
align="center"
prop="bsMotherId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">母号id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['motherManageTags'].visible"
label="母亲管理耳号"
align="center"
prop="motherManageTags"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">母亲管理耳号</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['receptorId'].visible"
label="受体id"
align="center"
prop="receptorId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">受体id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['receptorManageTags'].visible"
label="受体管理耳号"
align="center"
prop="receptorManageTags"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">受体管理耳号</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['fatherFatherId'].visible"
label="祖父号id"
align="center"
prop="fatherFatherId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">祖父号id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['grandfatherManageTags'].visible"
label="祖父管理耳号"
align="center"
prop="grandfatherManageTags"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">祖父管理耳号</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['fatherMotherId'].visible"
label="祖母号id"
align="center"
prop="fatherMotherId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">祖母号id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['grandmotherManageTags'].visible"
label="祖母管理耳号"
align="center"
prop="grandmotherManageTags"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">祖母管理耳号</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['fatherId'].visible"
label="外祖父号id"
align="center"
prop="fatherId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">外祖父号id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['maternalGrandfatherManageTags'].visible"
label="外祖父管理耳号"
align="center"
prop="maternalGrandfatherManageTags"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">外祖父管理耳号</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['motherId'].visible"
label="外祖母号id"
align="center"
prop="motherId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">外祖母号id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['maternalGrandmotherManageTags'].visible"
label="外祖母管理耳号"
align="center"
prop="maternalGrandmotherManageTags"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">外祖母管理耳号</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['matingDate'].visible"
label="配种日期"
align="center"
prop="matingDate"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">配种日期</span>
</template>
<template #default="scope">
<span>{{ parseTime(scope.row.matingDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['matingTypeId'].visible"
label="配种类型"
align="center"
prop="matingTypeId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">配种类型</span>
</template>
<template #default="scope">
<dict-tag :options="breed_type" :value="scope.row.matingTypeId"/>
</template>
</el-table-column>
<el-table-column
v-if="columns['pregDate'].visible"
label="孕检日期"
align="center"
prop="pregDate"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">孕检日期</span>
</template>
<template #default="scope">
<span>{{ parseTime(scope.row.pregDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['lambingDate'].visible"
label="产羔日期"
align="center"
prop="lambingDate"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">产羔日期</span>
</template>
<template #default="scope">
<span>{{ parseTime(scope.row.lambingDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['lambingDay'].visible"
label="产羔时怀孕天数"
align="center"
prop="lambingDay"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">产羔时怀孕天数</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['matingDay'].visible"
label="配后天数"
align="center"
prop="matingDay"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">配后天数</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['gestationDay'].visible"
label="怀孕天数"
align="center"
prop="gestationDay"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">怀孕天数</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['expectedDate'].visible"
label="预产日期"
align="center"
prop="expectedDate"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">预产日期</span>
</template>
<template #default="scope">
<span>{{ parseTime(scope.row.expectedDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['postLambingDay'].visible"
label="产后天数"
align="center"
prop="postLambingDay"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">产后天数</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['lactationDay'].visible"
label="泌乳天数"
align="center"
prop="lactationDay"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">泌乳天数</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['anestrousDay'].visible"
label="空怀天数"
align="center"
prop="anestrousDay"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">空怀天数</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['matingCounts'].visible"
label="配种次数"
align="center"
prop="matingCounts"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">配种次数</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['matingTotal'].visible"
label="累计配种次数"
align="center"
prop="matingTotal"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">累计配种次数</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['miscarriageCounts'].visible"
label="累计流产次数"
align="center"
prop="miscarriageCounts"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">累计流产次数</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['comment'].visible"
label="备注"
align="center"
prop="comment"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">备注</span>
</template>
<template #default="scope">
<el-tooltip :content="scope.row.comment" placement="top">
<span style="display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
{{ scope.row.comment }}
</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column
v-if="columns['controlled'].visible"
label="是否性控"
align="center"
prop="controlled"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">是否性控</span>
</template>
<template #default="scope">
<dict-tag :options="controlled" :value="scope.row.controlled"/>
</template>
</el-table-column>
<el-table-column
v-if="columns['body'].visible"
label="体况评分"
align="center"
prop="body"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">体况评分</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['breast'].visible"
label="乳房评分"
align="center"
prop="breast"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">乳房评分</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['source'].visible"
label="入群来源"
align="center"
prop="source"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">入群来源</span>
</template>
<template #default="scope">
<dict-tag :options="source" :value="scope.row.source"/>
</template>
</el-table-column>
<el-table-column
v-if="columns['sourceDate'].visible"
label="入群日期"
align="center"
prop="sourceDate"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">入群日期</span>
</template>
<template #default="scope">
<span>{{ parseTime(scope.row.sourceDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['sourceRanchId'].visible"
label="来源牧场id"
align="center"
prop="sourceRanchId"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">来源牧场id</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['sourceRanch'].visible"
label="来源牧场"
align="center"
prop="sourceRanch"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">来源牧场</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['updateBy'].visible"
label="修改人"
align="center"
prop="updateBy"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">修改人</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['updateTime'].visible"
label="修改日期"
align="center"
prop="updateTime"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">修改日期</span>
</template>
<template #default="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['createBy'].visible"
label="创建人"
align="center"
prop="createBy"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">创建人</span>
</template>
</el-table-column>
<el-table-column
v-if="columns['createTime'].visible"
label="创建日期"
align="center"
prop="createTime"
width="120"
sortable
>
<template #header>
<span style="font-weight: bold; color: #333;">创建日期</span>
</template>
<template #default="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
fixed="right"
width="120"
>
<template #header>
<span style="font-weight: bold; color: #333;">操作</span>
</template>
<template #default="scope">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['sheep_file:sheep_file:remove']">删除</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-dialog v-model="columnDialogVisible" title="显示列设置" width="800px">
<div style="max-height: 400px; overflow-y: auto; ">
<el-checkbox-group v-model="selectedColumns" style="grid; grid-template-columns: repeat(3, 1fr); gap: 10px;" >
<el-checkbox label="id">羊只id</el-checkbox>
<el-checkbox label="bsManageTags">管理耳号</el-checkbox>
<el-checkbox label="ranchId">牧场id</el-checkbox>
<el-checkbox label="drRanch">牧场名称</el-checkbox>
<el-checkbox label="sheepfoldId">羊舍id</el-checkbox>
<el-checkbox label="sheepfoldName">羊舍名称</el-checkbox>
<el-checkbox label="electronicTags">电子耳号</el-checkbox>
<el-checkbox label="varietyId">品种id</el-checkbox>
<el-checkbox label="variety">品种</el-checkbox>
<el-checkbox label="family">家系</el-checkbox>
<el-checkbox label="name">羊只类型</el-checkbox>
<el-checkbox label="gender">性别</el-checkbox>
<el-checkbox label="birthday">出生日期</el-checkbox>
<el-checkbox label="dayAge">日龄</el-checkbox>
<el-checkbox label="monthAge">月龄</el-checkbox>
<el-checkbox label="parity">胎次</el-checkbox>
<el-checkbox label="birthWeight">出生体重</el-checkbox>
<el-checkbox label="weaningDate">断奶日期</el-checkbox>
<el-checkbox label="statusId">羊只状态</el-checkbox>
<el-checkbox label="weaningWeight">断奶体重</el-checkbox>
<el-checkbox label="currentWeight">当前体重</el-checkbox>
<el-checkbox label="breedStatusId">繁育状态id</el-checkbox>
<el-checkbox label="breed">繁殖状态</el-checkbox>
<el-checkbox label="bsFatherId">父号id</el-checkbox>
<el-checkbox label="fatherManageTags">父亲管理耳号</el-checkbox>
<el-checkbox label="bsMotherId">母号id</el-checkbox>
<el-checkbox label="motherManageTags">母亲管理耳号</el-checkbox>
<el-checkbox label="receptorId">受体id</el-checkbox>
<el-checkbox label="receptorManageTags">受体管理耳号</el-checkbox>
<el-checkbox label="fatherFatherId">祖父号id</el-checkbox>
<el-checkbox label="grandfatherManageTags">祖父管理耳号</el-checkbox>
<el-checkbox label="fatherMotherId">祖母号id</el-checkbox>
<el-checkbox label="grandmotherManageTags">祖母管理耳号</el-checkbox>
<el-checkbox label="fatherId">外祖父号id</el-checkbox>
<el-checkbox label="maternalGrandfatherManageTags">外祖父管理耳号</el-checkbox>
<el-checkbox label="motherId">外祖母号id</el-checkbox>
<el-checkbox label="maternalGrandmotherManageTags">外祖母管理耳号</el-checkbox>
<el-checkbox label="matingDate">配种日期</el-checkbox>
<el-checkbox label="matingTypeId">配种类型</el-checkbox>
<el-checkbox label="pregDate">孕检日期</el-checkbox>
<el-checkbox label="lambingDate">产羔日期</el-checkbox>
<el-checkbox label="lambingDay">产羔时怀孕天数</el-checkbox>
<el-checkbox label="matingDay">配后天数</el-checkbox>
<el-checkbox label="gestationDay">怀孕天数</el-checkbox>
<el-checkbox label="expectedDate">预产日期</el-checkbox>
<el-checkbox label="postLambingDay">产后天数</el-checkbox>
<el-checkbox label="lactationDay">泌乳天数</el-checkbox>
<el-checkbox label="anestrousDay">空怀天数</el-checkbox>
<el-checkbox label="matingCounts">配种次数</el-checkbox>
<el-checkbox label="matingTotal">累计配种次数</el-checkbox>
<el-checkbox label="miscarriageCounts">累计流产次数</el-checkbox>
<el-checkbox label="comment">备注</el-checkbox>
<el-checkbox label="controlled">是否性控</el-checkbox>
<el-checkbox label="body">体况评分</el-checkbox>
<el-checkbox label="breast">乳房评分</el-checkbox>
<el-checkbox label="source">入群来源</el-checkbox>
<el-checkbox label="sourceDate">入群日期</el-checkbox>
<el-checkbox label="sourceRanchId">来源牧场id</el-checkbox>
<el-checkbox label="sourceRanch">来源牧场</el-checkbox>
<el-checkbox label="updateBy">修改人</el-checkbox>
<el-checkbox label="updateTime">修改日期</el-checkbox>
<el-checkbox label="createBy">创建人</el-checkbox>
<el-checkbox label="createTime">创建日期</el-checkbox>
</el-checkbox-group>
</div>
<div style="margin-top: 20px; display: flex; justify-content: space-between; align-items: center;">
<el-checkbox v-model="isAllSelected" @change="toggleAllSelection" >全选</el-checkbox>
<div>
<el-button type="primary" @click="confirmColumnSettings">提交</el-button>
<el-button @click="resetColumnSettings">重置</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
<script setup name="Sheep_file">
import { listSheep_file, getSheep_file } from "@/api/fileManagement/sheep_file"
const { proxy } = getCurrentInstance()
const { sheep_gender } = proxy.useDict('sheep_gender')
const { breed_type } = proxy.useDict('breed_type')
const { controlled } = proxy.useDict('controlled')
const { source } = proxy.useDict('source')
const { sheep_status } = proxy.useDict('sheep_status')
const sheep_fileList = 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 columnDialogVisible = ref(false)
const selectedColumns = ref([
'id', 'bsManageTags', 'ranchId', 'drRanch', 'sheepfoldId', 'sheepfoldName', 'electronicTags', 'varietyId', 'variety', 'family', 'name', 'gender', 'birthday', 'dayAge', 'monthAge', 'parity', 'birthWeight', 'weaningDate', 'statusId', 'weaningWeight', 'currentWeight', 'breedStatusId', 'breed', 'bsFatherId', 'fatherManageTags', 'bsMotherId', 'motherManageTags', 'receptorId', 'receptorManageTags', 'fatherFatherId', 'grandfatherManageTags', 'fatherMotherId', 'grandmotherManageTags', 'fatherId', 'maternalGrandfatherManageTags', 'motherId', 'maternalGrandmotherManageTags', 'matingDate', 'matingTypeId', 'pregDate', 'lambingDate', 'lambingDay', 'matingDay', 'gestationDay', 'expectedDate', 'postLambingDay', 'lactationDay', 'anestrousDay', 'matingCounts', 'matingTotal', 'miscarriageCounts', 'comment', 'controlled', 'body', 'breast', 'source', 'sourceDate', 'sourceRanchId', 'sourceRanch', 'updateBy', 'updateTime', 'createBy', 'createTime'
])
const isAllSelected = ref(false)
const columns = reactive({
id: { visible: true },
bsManageTags: { visible: true },
ranchId: { visible: true },
drRanch: { visible: true },
sheepfoldId: { visible: true },
sheepfoldName: { visible: true },
electronicTags: { visible: true },
varietyId: { visible: true },
variety: { visible: true },
family: { visible: true },
name: { visible: true },
gender: { visible: true },
birthday: { visible: true },
dayAge: { visible: true },
monthAge: { visible: true },
parity: { visible: true },
birthWeight: { visible: true },
weaningDate: { visible: true },
statusId: { visible: true },
weaningWeight: { visible: true },
currentWeight: { visible: true },
breedStatusId: { visible: true },
breed: { visible: true },
bsFatherId: { visible: true },
fatherManageTags: { visible: true },
bsMotherId: { visible: true },
motherManageTags: { visible: true },
receptorId: { visible: true },
receptorManageTags: { visible: true },
fatherFatherId: { visible: true },
grandfatherManageTags: { visible: true },
fatherMotherId: { visible: true },
grandmotherManageTags: { visible: true },
fatherId: { visible: true },
maternalGrandfatherManageTags: { visible: true },
motherId: { visible: true },
maternalGrandmotherManageTags: { visible: true },
matingDate: { visible: true },
matingTypeId: { visible: true },
pregDate: { visible: true },
lambingDate: { visible: true },
lambingDay: { visible: true },
matingDay: { visible: true },
gestationDay: { visible: true },
expectedDate: { visible: true },
postLambingDay: { visible: true },
lactationDay: { visible: true },
anestrousDay: { visible: true },
matingCounts: { visible: true },
matingTotal: { visible: true },
miscarriageCounts: { visible: true },
comment: { visible: true },
controlled: { visible: true },
body: { visible: true },
breast: { visible: true },
source: { visible: true },
sourceDate: { visible: true },
sourceRanchId: { visible: true },
sourceRanch: { visible: true },
updateBy: { visible: true },
updateTime: { visible: true },
createBy: { visible: true },
createTime: { visible: true }
})
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
id: null,
bsManageTags: null,
drRanch: null,
electronicTags: null,
variety: null,
name: null,
gender: null,
statusId: null,
breed: null,
},
rules: {
id: [
{ required: true, message: "羊只id不能为空", trigger: "blur" }
],
}
})
const { queryParams, form, rules } = toRefs(data)
/** 查询羊只档案列表 */
function getList() {
loading.value = true
listSheep_file(queryParams.value).then(response => {
sheep_fileList.value = response.rows
total.value = response.total
loading.value = false
})
}
// 表单重置
function reset() {
form.value = {
id: null,
bsManageTags: null,
ranchId: null,
drRanch: null,
sheepfoldId: null,
sheepfoldName: null,
electronicTags: null,
varietyId: null,
variety: null,
family: null,
name: null,
gender: null,
birthday: null,
dayAge: null,
monthAge: null,
parity: null,
birthWeight: null,
weaningDate: null,
statusId: null,
weaningWeight: null,
currentWeight: null,
breedStatusId: null,
breed: null,
bsFatherId: null,
fatherManageTags: null,
bsMotherId: null,
motherManageTags: null,
receptorId: null,
receptorManageTags: null,
fatherFatherId: null,
grandfatherManageTags: null,
fatherMotherId: null,
grandmotherManageTags: null,
fatherId: null,
maternalGrandfatherManageTags: null,
motherId: null,
maternalGrandmotherManageTags: null,
matingDate: null,
matingTypeId: null,
pregDate: null,
lambingDate: null,
lambingDay: null,
matingDay: null,
gestationDay: null,
expectedDate: null,
postLambingDay: null,
lactationDay: null,
anestrousDay: null,
matingCounts: null,
matingTotal: null,
miscarriageCounts: null,
comment: null,
controlled: null,
body: null,
breast: null,
source: null,
sourceDate: null,
sourceRanchId: null,
sourceRanch: null,
updateBy: null,
updateTime: null,
createBy: null,
createTime: null,
isDelete: null
}
proxy.resetForm("sheep_fileRef")
}
/** 搜索建议功能 */
function handleQuery() {
queryParams.value.pageNum = 1
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 handleDelete(row) {
const _ids = row.id || ids.value
proxy.$modal.confirm('是否确认删除羊只档案编号为"' + _ids + '"的数据项?').then(function() {
return delSheep_file(_ids)
}).then(() => {
getList()
proxy.$modal.msgSuccess("删除成功")
}).catch(() => {})
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('sheep_file/sheep_file/export', {
...queryParams.value
}, `sheep_file_${new Date().getTime()}.xlsx`)
}
// 打开列设置对话框
function openColumnDialog() {
// 加载上次选择的状态
const savedColumns = localStorage.getItem('selectedColumns')
if (savedColumns) {
selectedColumns.value = JSON.parse(savedColumns)
Object.keys(columns).forEach(column => {
columns[column].visible = selectedColumns.value.includes(column)
})
}
columnDialogVisible.value = true
}
// 全选功能
function toggleAllSelection() {
if (isAllSelected.value) {
selectedColumns.value = Object.keys(columns)
} else {
selectedColumns.value = []
}
updateColumnVisibility()
}
// 更新列的显示状态
function updateColumnVisibility() {
Object.keys(columns).forEach(column => {
columns[column].visible = selectedColumns.value.includes(column)
})
}
// 确认列设置
function confirmColumnSettings() {
updateColumnVisibility()
// 保存当前选择到本地存储
localStorage.setItem('selectedColumns', JSON.stringify(selectedColumns.value))
columnDialogVisible.value = false
}
// 重置列设置
function resetColumnSettings() {
selectedColumns.value = [
'id', 'bsManageTags', 'ranchId', 'drRanch', 'sheepfoldId', 'sheepfoldName', 'electronicTags', 'varietyId', 'variety', 'family', 'name', 'gender', 'birthday', 'dayAge', 'monthAge', 'parity', 'birthWeight', 'weaningDate', 'statusId', 'weaningWeight', 'currentWeight', 'breedStatusId', 'breed', 'bsFatherId', 'fatherManageTags', 'bsMotherId', 'motherManageTags', 'receptorId', 'receptorManageTags', 'fatherFatherId', 'grandfatherManageTags', 'fatherMotherId', 'grandmotherManageTags', 'fatherId', 'maternalGrandfatherManageTags', 'motherId', 'maternalGrandmotherManageTags', 'matingDate', 'matingTypeId', 'pregDate', 'lambingDate', 'lambingDay', 'matingDay', 'gestationDay', 'expectedDate', 'postLambingDay', 'lactationDay', 'anestrousDay', 'matingCounts', 'matingTotal', 'miscarriageCounts', 'comment', 'controlled', 'body', 'breast', 'source', 'sourceDate', 'sourceRanchId', 'sourceRanch', 'updateBy', 'updateTime', 'createBy', 'createTime'
]
updateColumnVisibility()
localStorage.setItem('selectedColumns', JSON.stringify(selectedColumns.value))
}
getList()
</script>
<style scoped>
:deep(.el-checkbox) {
border: 1px solid #dcdfe6;
border-radius: 4px;
padding: 10px;
margin: 5px;
width: calc(30% - 20px);
}
</style>