地理分布,国外分布,国内分布,识别特征

This commit is contained in:
hxd 2025-08-08 16:44:18 +08:00
parent 0f7c42b949
commit a5a74a2ead
18 changed files with 2612 additions and 122 deletions

8
package-lock.json generated
View File

@ -48,6 +48,7 @@
"@types/js-cookie": "^3.0.6",
"@types/node": "^20.11.28",
"@types/nprogress": "^0.2.3",
"@types/qs": "^6.14.0",
"@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
@ -1716,6 +1717,13 @@
"integrity": "sha512-k7kRA033QNtC+gLc4VPlfnue58CM1iQLgn1IMAU8VPHGOj7oIHPp9UlhedEnD/Gl8evoCjwkZjlBORtZ3JByUA==",
"dev": true
},
"node_modules/@types/qs": {
"version": "6.14.0",
"resolved": "https://registry.npmmirror.com/@types/qs/-/qs-6.14.0.tgz",
"integrity": "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/sortablejs": {
"version": "1.15.8",
"integrity": "sha512-b79830lW+RZfwaztgs1aVPgbasJ8e7AXtZYHTELNXZPsERt4ymJdjV4OccDbHQAvHrCcFpbF78jkm0R6h/pZVg==",

View File

@ -50,6 +50,7 @@
"@types/js-cookie": "^3.0.6",
"@types/node": "^20.11.28",
"@types/nprogress": "^0.2.3",
"@types/qs": "^6.14.0",
"@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",

8
pnpm-lock.yaml generated
View File

@ -120,6 +120,9 @@ importers:
'@types/nprogress':
specifier: ^0.2.3
version: 0.2.3
'@types/qs':
specifier: ^6.14.0
version: 6.14.0
'@types/sortablejs':
specifier: ^1.15.8
version: 1.15.8
@ -771,6 +774,9 @@ packages:
'@types/nprogress@0.2.3':
resolution: {integrity: sha512-k7kRA033QNtC+gLc4VPlfnue58CM1iQLgn1IMAU8VPHGOj7oIHPp9UlhedEnD/Gl8evoCjwkZjlBORtZ3JByUA==}
'@types/qs@6.14.0':
resolution: {integrity: sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==}
'@types/sortablejs@1.15.8':
resolution: {integrity: sha512-b79830lW+RZfwaztgs1aVPgbasJ8e7AXtZYHTELNXZPsERt4ymJdjV4OccDbHQAvHrCcFpbF78jkm0R6h/pZVg==}
@ -2364,6 +2370,8 @@ snapshots:
'@types/nprogress@0.2.3': {}
'@types/qs@6.14.0': {}
'@types/sortablejs@1.15.8': {}
'@types/web-bluetooth@0.0.16': {}

View File

@ -1,55 +1,51 @@
export interface OptionItem {
label: string;
value: string | number;
label: string;
value: string | number;
}
export interface QueryFormField {
label: string; // 显示的 label
prop: string; // 绑定的字段
type: 'input' | 'select' | 'date' | 'daterange' | 'datetimerange' | 'monthrange';
placeholder?: string;
size?: 'small' | 'default' | 'large';
defaultValue?: any;
options?: OptionItem[];
fetchOptions?: () => Promise<OptionItem[]>; // 异步加载 options
valueFormat?:string;
rules?: any[]; // 校验规则
label: string; // 显示的 label
prop: string; // 绑定的字段
type: 'input' | 'select' | 'date' | 'daterange' | 'datetimerange' | 'monthrange';
placeholder?: string;
size?: 'small' | 'default' | 'large';
defaultValue?: any;
options?: OptionItem[];
fetchOptions?: () => Promise<OptionItem[]>; // 异步加载 options
valueFormat?: string;
rules?: any[]; // 校验规则
staerPlaceholder?: string;
endPlaceholder?: string;
}
export interface TableColumn {
label: string;
prop: string;
width?: string | number;
minWidth?: string | number;
align?: 'left' | 'center' | 'right';
sortable?: boolean;
fixed?: 'left' | 'right' | boolean;
render?: any;
showOverflowTooltip?: boolean;
formater?: (row: any, column: any, cellValue: any, index: number) => any;
isFormater?: boolean;
label: string;
prop: string;
width?: string | number;
minWidth?: string | number;
align?: 'left' | 'center' | 'right';
sortable?: boolean;
fixed?: 'left' | 'right' | boolean;
render?: any;
showOverflowTooltip?: boolean;
formater?: (row: any, column: any, cellValue: any, index: number) => any;
isFormater?: boolean;
}
export interface PopupFormField {
label: string;
prop: string;
type?: string;
rules?: any;
span?: number;
defaultValue?: any;
componentProps?: Record<string, any>;
options?: Array<{ label: string; value: any }>;
fetchOptions?: () => Promise<Array<{ label: string; value: any }>>;
label: string;
prop: string;
type?: string;
rules?: any;
span?: number;
defaultValue?: any;
componentProps?: Record<string, any>;
options?: Array<{ value: any; label: any }>;
fetchOptions?: () => Promise<Array<{ label: string; value: any }>>;
}
export interface AuditFormModel {
auditView: string
auditStatus: string
auditUser: string | number
auditDate: string
id: string | number
auditView: string;
auditStatus: string;
auditUser: string | number;
auditDate: string;
id: string | number;
}

View File

@ -0,0 +1,55 @@
import request from '/@/utils/request'
// 查询识别特征列表
export function listCharacteristic(query:object) {
return request({
url: '/api/v1/businesses/characteristic/list',
method: 'get',
params: query
})
}
// 查询识别特征详细
export function getCharacteristic(id:number) {
return request({
url: '/api/v1/businesses/characteristic/get',
method: 'get',
params: {
id: id.toString()
}
})
}
// 新增识别特征
export function addCharacteristic(data:object) {
return request({
url: '/api/v1/businesses/characteristic/add',
method: 'post',
data: data
})
}
// 修改识别特征
export function updateCharacteristic(data:object) {
return request({
url: '/api/v1/businesses/characteristic/edit',
method: 'put',
data: data
})
}
// 删除识别特征
export function delCharacteristic(ids:number[], version: number[]) {
return request({
url: '/api/v1/businesses/characteristic/delete',
method: 'delete',
data:{
ids:ids,
version: version,
}
})
}
export function auditCharacteristic(data: object) {
return request({
url: '/api/v1/businesses/characteristic/audit',
method: 'post',
data: data,
});
}

View File

@ -0,0 +1,512 @@
<template>
<div class="businesses-characteristic-container">
<el-card shadow="hover">
<QueryForm
v-model="searchForm"
:fields="searchFields"
@search="onSearch"
@reset="onReset"
:labelWidth="'120px'"
ref="queryFormRef"
/>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
@click="handleAdd"
v-auth="'api/v1/businesses/characteristic/add'"
><el-icon><ele-Plus /></el-icon>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
:disabled="multiple"
@click="handleDelete(null)"
v-auth="'api/v1/businesses/characteristic/delete'"
><el-icon><ele-Delete /></el-icon>删除</el-button
>
</el-col>
</el-row>
<ProTable
v-if="columns.length > 0"
ref="proTableRef"
:columns="columns"
:data="tableData.data"
:loading="loading"
:show-selection="true"
@selection-change="handleSelectionChange"
:heightOffset="400"
:action-width="280"
>
<template #actions="{ row }">
<el-button
type="primary"
@click="handleUpdate(row)"
size="small"
v-auth="'api/v1/businesses/characteristic/edit'"
v-if="row.auditStatus != 1"
><el-icon><ele-EditPen /></el-icon>修改</el-button
>
<el-button
type="danger"
size="small"
@click="handleDelete(row)"
v-auth="'api/v1/businesses/characteristic/delete'"
><el-icon><ele-DeleteFilled /></el-icon>删除</el-button
>
<el-button
type="warning"
size="small"
@click="handleAudit(row)"
v-if="row.auditStatus == 0"
v-auth="'api/v1/businesses/characteristic/audit'"
><el-icon><ele-Check /></el-icon>审核</el-button
>
</template>
</ProTable>
<pagination
v-show="tableData.total > 0"
:total="tableData.total"
v-model:page="tableData.param.pageNum"
v-model:limit="tableData.param.pageSize"
@pagination="getList"
/>
</el-card>
<ModalForm
v-model:visible="showDialog"
:title="formTitle"
:fields="formFields"
v-model:modelValue="formData"
:type="formType"
:show-footer="true"
:label-width="'120px'"
:width="'50%'"
@submit="handleFormSubmit"
@cancel="handleCancel"
ref="modalFormRef"
>
</ModalForm>
<AuditForm
ref="auditFormRef"
v-model="showAuditDialog"
title="审核数据"
@submit="onAuditSubmit"
/>
</div>
</template>
<script setup lang="ts">
import { toRefs, reactive, onMounted, ref, computed } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import {
listCharacteristic,
delCharacteristic,
addCharacteristic,
updateCharacteristic,
auditCharacteristic,
} from './api';
import {
CharacteristicTableColumns,
CharacteristicInfoData,
CharacteristicTableDataState,
} from './type';
import { getUserList } from '/@/api/system/user/index';
import { UserItem, VersionMap } from '/@/types';
import { parseTime } from '/@/utils/gfast';
import { cloneDeep } from 'lodash';
import { listSpeciesName } from '../speciesName/api';
import { QueryFormField, TableColumn, PopupFormField } from '/@/components/dynamicpage/type';
import QueryForm from '/@/components/dynamicpage/queryForm/index.vue';
import ProTable from '/@/components/dynamicpage/ProTable/index.vue';
import ModalForm from '/@/components/dynamicpage/modalForm/index.vue';
import AuditForm from '/@/components/dynamicpage/auditForm/index.vue';
import { SpeciesNameInfoData } from '../speciesName/type';
defineOptions({ name: 'BusinessesCharacteristicList' });
const loading = ref(false);
//
const single = ref(true);
//
const multiple = ref(true);
const userOptions = ref<UserItem[]>([]);
const state = reactive<CharacteristicTableDataState>({
ids: [],
tableData: {
data: [],
total: 0,
loading: false,
param: {
pageNum: 1,
pageSize: 10,
},
},
});
const versionMap = ref<VersionMap>({} as VersionMap);
const proTableRef = ref();
const { tableData } = toRefs(state);
const columns: TableColumn[] = [
{ label: '物种编码', prop: 'speciesCode' },
{ label: '形态学特征', prop: 'formCharacteristic', minWidth: 200 },
{ label: '分子生物学特征', prop: 'biologyCharacteristic', minWidth: 200 },
{ label: '数据来源', prop: 'sourcesData', minWidth: 150 },
{
label: '数据采集人',
prop: 'createUser',
isFormater: true,
minWidth: 120,
formater(row, column, cellValue, index) {
const user = userOptions.value.find((i) => i.id === cellValue);
return user ? user.userNickname : '';
},
},
{
label: '数据采集日期',
prop: 'createDate',
isFormater: true,
minWidth: 120,
formater(_, col: any, val: string) {
return parseTime(val, '{y}-{m}-{d}');
},
},
{
label: '数据核查人',
prop: 'auditUser',
isFormater: true,
minWidth: 120,
formater(row, column, cellValue, index) {
const user = userOptions.value.find((i) => i.id === cellValue);
return user ? user.userNickname : '';
},
},
{
label: '数据核查日期',
prop: 'auditDate',
minWidth: 120,
isFormater: true,
formater(_, col: any, val: string) {
return parseTime(val, '{y}-{m}-{d}');
},
},
{
label: '状态',
prop: 'auditStatus',
isFormater: true,
formater(row, column, cellValue, index) {
return cellValue == 0 ? '待审核' : cellValue == 1 ? '通过' : '不通过';
},
},
{ label: '核查意见', prop: 'auditView' },
{ label: '备注', prop: 'remark' },
];
const onSearch = async (val: Record<string, any>) => {
let newVal: Record<string, any> = {};
for (const v in val) {
if (val[v] || val[v] === 0) {
newVal[v] = val[v];
}
}
state.tableData.param = { ...state.tableData.param, ...newVal };
getList();
};
const onReset = () => {
state.tableData.param = {
pageNum: 1,
pageSize: 10,
};
getList();
};
const searchForm = ref<Partial<CharacteristicInfoData>>({
speciesCode: undefined,
formCharacteristic: undefined,
biologyCharacteristic: undefined,
sourcesData: undefined,
createUser: undefined,
auditUser: undefined,
auditStatus: undefined,
});
const searchFields = computed<QueryFormField[]>(() => [
{ label: '物种编码', prop: 'speciesCode', type: 'input', placeholder: '请输入物种编码' },
{ label: '形态学特征', prop: 'formCharacteristic', type: 'input', placeholder: '请输入形态学特征' },
{ label: '分子生物学特征', prop: 'biologyCharacteristic', type: 'input', placeholder: '请输入分子生物学特征' },
{ label: '数据来源', prop: 'sourcesData', type: 'input', placeholder: '请输入数据来源' },
{
label: '核查状态',
prop: 'auditStatus',
type: 'select',
options: [
{ label: '待审核', value: 0 },
{ label: '通过', value: 1 },
{ label: '不通过', value: 2 },
],
placeholder: '请输入物种编码',
},
{
label: '数据采集人',
prop: 'createUser',
type: 'select',
options: userOptions.value.map((i) => {
return {
label: i.userNickname,
value: i.id,
};
}),
placeholder: '请选择数据采集人',
},
{
label: '数据核查人',
prop: 'auditUser',
type: 'select',
options: userOptions.value.map((i) => {
return {
label: i.userNickname,
value: i.id,
};
}),
placeholder: '请选择数据核查人',
},
]);
//
onMounted(() => {
initTableData();
});
//
const initTableData = () => {
getList();
reqGetUserList();
reqListSpeciesName();
};
//
const getList = async () => {
loading.value = true;
const res = await listCharacteristic(state.tableData.param);
let list = res.data.list ?? [];
state.tableData.data = list;
versionMap.value = list.reduce((acc: any, cur: any) => {
acc[cur.id] = cur.version;
return acc;
}, {});
state.tableData.total = res.data.total;
loading.value = false;
};
const specieslist = ref<SpeciesNameInfoData[]>([]);
/**获取物种列表 */
const reqListSpeciesName = async () => {
if (userOptions.value.length > 0) return;
const res = await listSpeciesName({ pageSize: 9999, pageNum: 1 });
specieslist.value = res.data.list;
};
/**获取用户列表 */
const reqGetUserList = async () => {
if (userOptions.value.length > 0) return;
const res = await getUserList({ pageSize: 9999, pageNum: 1 });
userOptions.value = res.data.userList;
};
//
const handleSelectionChange = (selection: Array<CharacteristicInfoData>) => {
state.ids = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const showDialog = ref(false);
const formTitle = ref('');
const formFields = computed<PopupFormField[]>(() => [
{
label: '物种编码',
prop: 'speciesCode',
type: 'select',
options: specieslist.value.map((i) => {
return {
value: i.speciesCode,
label: i.speciesCode,
};
}),
span: 24,
rules: [{ required: true, message: '请输入物种编码', trigger: 'blur' }],
componentProps: {
placeholder: '请选择物种编码',
},
},
{
label: '形态学特征',
prop: 'formCharacteristic',
rules: [{ required: true, message: '请输入形态学特征', trigger: 'blur' }],
type: 'input',
span: 24,
componentProps: {
type: 'textarea',
placeholder: '请输入形态学特征',
},
},
{
label: '分子生物学特征',
prop: 'biologyCharacteristic',
type: 'input',
span: 24,
rules: [{ required: true, message: '请输入分子生物学特征', trigger: 'blur' }],
componentProps: {
type: 'textarea',
placeholder: '请输入分子生物学特征',
},
},
{
label: '数据来源',
prop: 'sourcesData',
type: 'input',
span: 24,
rules: [{ required: true, message: '请输入数据来源', trigger: 'blur' }],
componentProps: {
type: 'textarea',
placeholder: '请输入数据来源',
},
},
{
label: '数据采集人',
span: 12,
prop: 'createUser',
type: 'select',
rules: [{ required: true, message: '请选择数据采集人', trigger: 'change' }],
componentProps: {
placeholder: '请选择数据采集人',
},
options: userOptions.value.map((i) => {
return {
label: i.userNickname,
value: i.id,
};
}),
},
{
label: '数据采集日期',
span: 12,
prop: 'createDate',
type: 'date',
rules: [{ required: true, message: '请选择数据采集日期', trigger: 'change' }],
componentProps: {
placeholder: '请选择数据采集日期',
},
},
{
label: '备注',
prop: 'remark',
span: 24,
type: 'input',
componentProps: {
placeholder: '请输入备注',
type: 'textarea',
},
},
]);
const formData = ref<Partial<CharacteristicInfoData>>({
speciesCode: undefined,
formCharacteristic: undefined,
biologyCharacteristic: undefined,
sourcesData: undefined,
createUser: undefined,
createDate: undefined,
remark: undefined,
});
const formType = ref<'add' | 'edit'>('add');
const handleFormSubmit = (form: CharacteristicInfoData) => {
if (formType.value === 'add') {
addCharacteristic(form).then(() => {
ElMessage.success('新增成功');
handleCancel();
getList();
});
} else {
form.auditStatus = 0;
updateCharacteristic(form).then(() => {
ElMessage.success('编辑成功');
handleCancel();
getList();
});
}
};
const handleCancel = () => {
showDialog.value = false;
formTitle.value = '';
formType.value = 'add';
formData.value = {
speciesCode: undefined,
};
};
const handleAdd = () => {
showDialog.value = true;
formTitle.value = '新增分类地位';
formType.value = 'add';
};
const handleUpdate = (row: CharacteristicInfoData) => {
showDialog.value = true;
formTitle.value = '编辑分类地位';
formType.value = 'edit';
formData.value = cloneDeep(row);
};
const handleDelete = (row: CharacteristicTableColumns | null) => {
let msg = '你确定要删除所选数据?';
let id: number[] = [];
if (row) {
msg = `此操作将永久删除数据,是否继续?`;
id = [row.id];
} else {
id = state.ids;
}
if (id.length === 0) {
ElMessage.error('请选择要删除的数据。');
return;
}
ElMessageBox.confirm(msg, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
delCharacteristic(
id,
id.map((i) => versionMap.value[i])
).then(() => {
ElMessage.success('删除成功');
getList();
});
})
.catch(() => {});
};
const auditFormRef = ref();
const showAuditDialog = ref(false);
const handleAudit = (row: CharacteristicTableColumns) => {
auditFormRef.value.open(cloneDeep(row), userOptions.value);
};
const onAuditSubmit = (val: CharacteristicTableColumns) => {
auditCharacteristic(val).then(() => {
ElMessage.success('审核成功');
showAuditDialog.value = false;
getList();
});
};
</script>
<style lang="scss" scoped>
.colBlock {
display: block;
}
.colNone {
display: none;
}
.ml-2 {
margin: 3px;
}
</style>

View File

@ -0,0 +1,54 @@
export interface CharacteristicTableColumns {
id:number; //
speciesCode:string; // 物种编码
formCharacteristic:string; // 形态学特征
biologyCharacteristic:string; // 分子生物学特征
sourcesData:string; // 数据来源
createUser:number; // 数据采集人
createDate:string; // 数据采集日期
auditUser:number; // 数据核查人
auditDate:string; // 数据核查日期
auditStatus:number; //
auditView:string; //
remark:string; //
version:number; //
}
export interface CharacteristicInfoData {
id:number|undefined; //
speciesCode:string|undefined; // 物种编码
formCharacteristic:string|undefined; // 形态学特征
biologyCharacteristic:string|undefined; // 分子生物学特征
sourcesData:string|undefined; // 数据来源
createUser:number|undefined; // 数据采集人
createDate:string|undefined; // 数据采集日期
auditUser:number|undefined; // 数据核查人
auditDate:string|undefined; // 数据核查日期
auditStatus:number|undefined; //
auditView:string|undefined; //
remark:string|undefined; //
version:number|undefined; //
}
export interface CharacteristicTableDataState {
ids:any[];
tableData: {
data: Array<CharacteristicTableColumns>;
total: number;
loading: boolean;
param: {
pageNum: number;
pageSize: number;
};
};
}
export interface CharacteristicEditState{
loading:boolean;
isShowDialog: boolean;
formData:CharacteristicInfoData;
rules: object;
}

View File

@ -113,7 +113,8 @@ import {
ClassifyStatuseInfoData,
ClassifyStatuseTableDataState,
} from './type';
import { SpeciesNameInfoData } from '../speciesName/type';
import { listSpeciesName } from '../speciesName/api';
import { getUserList } from '/@/api/system/user/index';
import { UserItem, VersionMap } from '/@/types';
import { parseTime } from '/@/utils/gfast';
@ -151,7 +152,7 @@ const { tableData } = toRefs(state);
const columns: TableColumn[] = [
{ label: '物种编码', prop: 'speciesCode' },
{ label: '界', prop: 'jie' },
{ label: 'Kingdom', prop: 'kingdom' },
{ label: 'Kingdom', prop: 'kingdom', minWidth: 120 },
{ label: '门', prop: 'men' },
{ label: 'Phylum', prop: 'phylum' },
{ label: '纲', prop: 'gang' },
@ -212,6 +213,7 @@ const columns: TableColumn[] = [
return cellValue == 0 ? '待审核' : cellValue == 1 ? '通过' : '不通过';
},
},
{ label: '核查意见', prop: 'auditView' },
{ label: '备注', prop: 'remark' },
];
@ -277,6 +279,7 @@ onMounted(() => {
const initTableData = () => {
getList();
reqGetUserList();
reqListSpeciesName();
};
//
const getList = async () => {
@ -291,6 +294,17 @@ const getList = async () => {
state.tableData.total = res.data.total;
loading.value = false;
};
const specieslist = ref<SpeciesNameInfoData[]>([]);
/**获取物种列表 */
const reqListSpeciesName = async () => {
if (userOptions.value.length > 0) return;
const res = await listSpeciesName({ pageSize: 9999, pageNum: 1 });
specieslist.value = res.data.list;
};
/**获取用户列表 */
const reqGetUserList = async () => {
if (userOptions.value.length > 0) return;
const res = await getUserList({ pageSize: 9999, pageNum: 1 });
@ -309,11 +323,17 @@ const formFields = computed<PopupFormField[]>(() => [
{
label: '物种编码',
prop: 'speciesCode',
type: 'input',
type: 'select',
options: specieslist.value.map((i) => {
return {
value: i.speciesCode,
label: i.speciesCode,
};
}),
span: 12,
rules: [{ required: true, message: '请输入物种编码', trigger: 'blur' }],
componentProps: {
placeholder: '请输入物种编码',
placeholder: '请选择物种编码',
},
},
{
@ -334,8 +354,7 @@ const formFields = computed<PopupFormField[]>(() => [
rules: [{ required: true, message: '请输入kingdom', trigger: 'blur' }],
componentProps: {
placeholder: '请输入界',
}
},
},
{
label: '门',
@ -385,7 +404,7 @@ const formFields = computed<PopupFormField[]>(() => [
rules: [{ required: true, message: '请输入目', trigger: 'blur' }],
componentProps: {
placeholder: '请输入目',
}
},
},
{
label: 'Order',
@ -404,8 +423,8 @@ const formFields = computed<PopupFormField[]>(() => [
span: 12,
rules: [{ required: true, message: '请输入科', trigger: 'blur' }],
componentProps: {
placeholder: '请输入科',
}
placeholder: '请输入科',
},
},
{
label: 'Family',
@ -424,9 +443,9 @@ const formFields = computed<PopupFormField[]>(() => [
span: 12,
rules: [{ required: true, message: '请输入属', trigger: 'blur' }],
componentProps: {
placeholder: '请输入属',
}
},
placeholder: '请输入属',
},
},
{
label: 'Genus',
prop: 'genus',
@ -478,13 +497,13 @@ const formFields = computed<PopupFormField[]>(() => [
type: 'textarea',
},
},
{
label: '数据采集人',
span: 12,
prop: 'createUser',
type: 'select',
rules: [{ required: true, message: '请选择数据采集人', trigger: 'change' }],
// rules: [{ required: true, message: '', trigger: 'change' }],
componentProps: {
placeholder: '请选择数据采集人',
},
@ -548,30 +567,18 @@ const formType = ref<'add' | 'edit'>('add');
const handleFormSubmit = (form: ClassifyStatuseInfoData) => {
if (formType.value === 'add') {
addClassifyStatuse(form)
.then(() => {
ElMessage.success('新增成功');
handleCancel();
getList();
})
.catch(() => {
ElMessage.error('新增失败');
handleCancel();
getList();
});
addClassifyStatuse(form).then(() => {
ElMessage.success('新增成功');
handleCancel();
getList();
});
} else {
form.auditStatus = 0;
updateClassifyStatuse(form)
.then(() => {
ElMessage.success('编辑成功');
handleCancel();
getList();
})
.catch(() => {
ElMessage.error('编辑失败');
handleCancel();
getList();
});
updateClassifyStatuse(form).then(() => {
ElMessage.success('编辑成功');
handleCancel();
getList();
});
}
};
const handleCancel = () => {
@ -655,17 +662,11 @@ const handleAudit = (row: ClassifyStatuseTableColumns) => {
auditFormRef.value.open(cloneDeep(row), userOptions.value);
};
const onAuditSubmit = (val: ClassifyStatuseTableColumns) => {
auditSpeciesName(val)
.then(() => {
ElMessage.success('审核成功');
showAuditDialog.value = false;
getList();
})
.catch(() => {
ElMessage.error('审核失败');
showAuditDialog.value = false;
getList();
});
auditSpeciesName(val).then(() => {
ElMessage.success('审核成功');
showAuditDialog.value = false;
getList();
});
};
</script>
<style lang="scss" scoped>

View File

@ -0,0 +1,53 @@
import request from '/@/utils/request'
// 查询国内分布列表
export function listDomestiDistribuion(query:object) {
return request({
url: '/api/v1/businesses/domestiDistribuion/list',
method: 'get',
params: query
})
}
// 查询国内分布详细
export function getDomestiDistribuion(id:number) {
return request({
url: '/api/v1/businesses/domestiDistribuion/get',
method: 'get',
params: {
id: id.toString()
}
})
}
// 新增国内分布
export function addDomestiDistribuion(data:object) {
return request({
url: '/api/v1/businesses/domestiDistribuion/add',
method: 'post',
data: data
})
}
// 修改国内分布
export function updateDomestiDistribuion(data:object) {
return request({
url: '/api/v1/businesses/domestiDistribuion/edit',
method: 'put',
data: data
})
}
// 删除国内分布
export function delDomestiDistribuion(ids:number[],version: number[]) {
return request({
url: '/api/v1/businesses/domestiDistribuion/delete',
method: 'delete',
data:{
ids:ids,
version: version,
}
})
}
export function auditDomestiDistribuion(data: object) {
return request({
url: '/api/v1/businesses/domestiDistribuion/audit',
method: 'post',
data: data,
});
}

View File

@ -0,0 +1,519 @@
<template>
<div class="businesses-domestiDistribuion-container">
<el-card shadow="hover">
<QueryForm
v-model="searchForm"
:fields="searchFields"
@search="onSearch"
@reset="onReset"
ref="queryFormRef"
/>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
@click="handleAdd"
v-auth="'api/v1/businesses/domestiDistribuion/add'"
><el-icon><ele-Plus /></el-icon>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
:disabled="multiple"
@click="handleDelete(null)"
v-auth="'api/v1/businesses/domestiDistribuion/delete'"
><el-icon><ele-Delete /></el-icon>删除</el-button
>
</el-col>
</el-row>
<ProTable
v-if="columns.length > 0"
ref="proTableRef"
:columns="columns"
:data="tableData.data"
:loading="loading"
:show-selection="true"
@selection-change="handleSelectionChange"
:heightOffset="400"
:action-width="280"
>
<template #actions="{ row }">
<el-button
type="primary"
@click="handleUpdate(row)"
size="small"
v-auth="'api/v1/businesses/domestiDistribuion/edit'"
v-if="row.auditStatus != 1"
><el-icon><ele-EditPen /></el-icon>修改</el-button
>
<el-button
type="danger"
size="small"
@click="handleDelete(row)"
v-auth="'api/v1/businesses/domestiDistribuion/delete'"
><el-icon><ele-DeleteFilled /></el-icon>删除</el-button
>
<el-button
type="warning"
size="small"
@click="handleAudit(row)"
v-if="row.auditStatus == 0"
v-auth="'api/v1/businesses/domestiDistribuion/audit'"
><el-icon><ele-Check /></el-icon>审核</el-button
>
</template>
</ProTable>
<pagination
v-show="tableData.total > 0"
:total="tableData.total"
v-model:page="tableData.param.pageNum"
v-model:limit="tableData.param.pageSize"
@pagination="getList"
/>
</el-card>
<ModalForm
v-model:visible="showDialog"
:title="formTitle"
:fields="formFields"
v-model:modelValue="formData"
:type="formType"
:show-footer="true"
:label-width="'120px'"
:width="'50%'"
@submit="handleFormSubmit"
@cancel="handleCancel"
ref="modalFormRef"
>
</ModalForm>
<AuditForm
ref="auditFormRef"
v-model="showAuditDialog"
title="审核数据"
@submit="onAuditSubmit"
/>
</div>
</template>
<script setup lang="ts">
import { toRefs, reactive, onMounted, ref, computed } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import {
listDomestiDistribuion,
getDomestiDistribuion,
delDomestiDistribuion,
addDomestiDistribuion,
updateDomestiDistribuion,
auditDomestiDistribuion,
} from './api';
import {
DomestiDistribuionTableColumns,
DomestiDistribuionInfoData,
DomestiDistribuionTableDataState,
} from './type';
import { getUserList } from '/@/api/system/user/index';
import { UserItem, VersionMap } from '/@/types';
import { parseTime } from '/@/utils/gfast';
import { cloneDeep } from 'lodash';
import { listSpeciesName } from '../speciesName/api';
import { QueryFormField, TableColumn, PopupFormField } from '/@/components/dynamicpage/type';
import QueryForm from '/@/components/dynamicpage/queryForm/index.vue';
import ProTable from '/@/components/dynamicpage/ProTable/index.vue';
import ModalForm from '/@/components/dynamicpage/modalForm/index.vue';
import AuditForm from '/@/components/dynamicpage/auditForm/index.vue';
import { SpeciesNameInfoData } from '../speciesName/type';
defineOptions({ name: 'BusinessesDomestiDistribuionList' });
const loading = ref(false);
//
const single = ref(true);
//
const multiple = ref(true);
const userOptions = ref<UserItem[]>([]);
const state = reactive<DomestiDistribuionTableDataState>({
ids: [],
tableData: {
data: [],
total: 0,
loading: false,
param: {
pageNum: 1,
pageSize: 10,
},
},
});
const versionMap = ref<VersionMap>({} as VersionMap);
const proTableRef = ref();
const { tableData } = toRefs(state);
const columns: TableColumn[] = [
{ label: '物种编码', prop: 'speciesCode' },
{ label: '所属省区', prop: 'province', minWidth: 150 },
{ label: '所属地级州市', prop: 'city', minWidth: 150 },
{ label: '所属区县', prop: 'county', minWidth: 150 },
{ label: '发现年份', prop: 'year', minWidth: 150 },
{ label: '数据来源', prop: 'sourcesData', minWidth: 150 },
{
label: '数据采集人',
prop: 'createUser',
isFormater: true,
minWidth: 120,
formater(row, column, cellValue, index) {
const user = userOptions.value.find((i) => i.id === cellValue);
return user ? user.userNickname : '';
},
},
{
label: '数据采集日期',
prop: 'createDate',
isFormater: true,
minWidth: 120,
formater(_, col: any, val: string) {
return parseTime(val, '{y}-{m}-{d}');
},
},
{
label: '数据核查人',
prop: 'auditUser',
isFormater: true,
minWidth: 120,
formater(row, column, cellValue, index) {
const user = userOptions.value.find((i) => i.id === cellValue);
return user ? user.userNickname : '';
},
},
{
label: '数据核查日期',
prop: 'auditDate',
minWidth: 120,
isFormater: true,
formater(_, col: any, val: string) {
return parseTime(val, '{y}-{m}-{d}');
},
},
{
label: '状态',
prop: 'auditStatus',
isFormater: true,
formater(row, column, cellValue, index) {
return cellValue == 0 ? '待审核' : cellValue == 1 ? '通过' : '不通过';
},
},
{ label: '核查意见', prop: 'auditView' },
{ label: '备注', prop: 'remark' },
];
const onSearch = async (val: Record<string, any>) => {
let newVal: Record<string, any> = {};
for (const v in val) {
if (val[v] || val[v] === 0) {
newVal[v] = val[v];
}
}
state.tableData.param = { ...state.tableData.param, ...newVal };
getList();
};
const onReset = () => {
state.tableData.param = {
pageNum: 1,
pageSize: 10,
};
getList();
};
const searchForm = ref<Partial<DomestiDistribuionInfoData>>({
speciesCode: undefined,
province: undefined,
city: undefined,
county: undefined,
year: undefined,
sourcesData: undefined,
createUser: undefined,
auditStatus: undefined,
});
const searchFields = computed<QueryFormField[]>(() => [
{ label: '物种编码', prop: 'speciesCode', type: 'input', placeholder: '请输入物种编码' },
{ label: '所属省区', prop: 'province', type: 'input', placeholder: '请输入所属省区' },
{ label: '所属地级州市', prop: 'city', type: 'input', placeholder: '请输入所属地级州市' },
{ label: '所属区县', prop: 'county', type: 'input', placeholder: '请输入所属区县' },
{ label: '发现年份', prop: 'year', type: 'input', placeholder: '请输入发现年份' },
{ label: '数据来源', prop: 'sourcesData', type: 'input', placeholder: '请输入数据来源' },
{
label: '核查状态',
prop: 'auditStatus',
type: 'select',
options: [
{ label: '待审核', value: 0 },
{ label: '通过', value: 1 },
{ label: '不通过', value: 2 },
],
placeholder: '请输入物种编码',
},
{
label: '数据采集人',
prop: 'createUser',
type: 'select',
options: userOptions.value.map((i) => {
return {
label: i.userNickname,
value: i.id,
};
}),
placeholder: '请选择数据采集人',
},
]);
//
onMounted(() => {
initTableData();
});
//
const initTableData = () => {
getList();
reqGetUserList();
reqListSpeciesName();
};
//
const getList = async () => {
loading.value = true;
const res = await listDomestiDistribuion(state.tableData.param);
let list = res.data.list ?? [];
state.tableData.data = list;
versionMap.value = list.reduce((acc: any, cur: any) => {
acc[cur.id] = cur.version;
return acc;
}, {});
state.tableData.total = res.data.total;
loading.value = false;
};
const specieslist = ref<SpeciesNameInfoData[]>([]);
/**获取物种列表 */
const reqListSpeciesName = async () => {
if (userOptions.value.length > 0) return;
const res = await listSpeciesName({ pageSize: 9999, pageNum: 1 });
specieslist.value = res.data.list;
};
/**获取用户列表 */
const reqGetUserList = async () => {
if (userOptions.value.length > 0) return;
const res = await getUserList({ pageSize: 9999, pageNum: 1 });
userOptions.value = res.data.userList;
};
//
const handleSelectionChange = (selection: Array<DomestiDistribuionTableColumns>) => {
state.ids = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const showDialog = ref(false);
const formTitle = ref('');
const formFields = computed<PopupFormField[]>(() => [
{
label: '物种编码',
prop: 'speciesCode',
type: 'select',
options: specieslist.value.map((i) => {
return {
value: i.speciesCode,
label: i.speciesCode,
};
}),
span: 24,
rules: [{ required: true, message: '请输入物种编码', trigger: 'blur' }],
componentProps: {
placeholder: '请选择物种编码',
},
},
{
label: '所属省区',
prop: 'province',
rules: [{ required: true, message: '请输入所属省区', trigger: 'blur' }],
type: 'input',
span: 24,
componentProps: {
placeholder: '请输入所属省区',
},
},
{
label: '所属地级州市',
prop: 'city',
type: 'input',
span: 24,
rules: [{ required: true, message: '请输入所属地级州市', trigger: 'blur' }],
componentProps: {
placeholder: '请输入所属地级州市',
},
},
{
label: '所属区县',
prop: 'county',
type: 'input',
span: 24,
rules: [{ required: true, message: '请输入所属区县', trigger: 'blur' }],
componentProps: {
placeholder: '请输入所属区县',
},
},
{
label: '发现年份',
prop: 'year',
type: 'input',
span: 24,
rules: [{ required: true, message: '请输入发现年份', trigger: 'blur' }],
componentProps: {
placeholder: '请输入发现年份',
},
},
{
label: '数据来源',
prop: 'sourcesData',
type: 'input',
span: 24,
rules: [{ required: true, message: '请输入数据来源', trigger: 'blur' }],
componentProps: {
placeholder: '请输入数据来源',
},
},
{
label: '数据采集人',
span: 12,
prop: 'createUser',
type: 'select',
rules: [{ required: true, message: '请选择数据采集人', trigger: 'change' }],
componentProps: {
placeholder: '请选择数据采集人',
},
options: userOptions.value.map((i) => {
return {
label: i.userNickname,
value: i.id,
};
}),
},
{
label: '数据采集日期',
span: 12,
prop: 'createDate',
type: 'date',
rules: [{ required: true, message: '请选择数据采集日期', trigger: 'change' }],
componentProps: {
placeholder: '请选择数据采集日期',
},
},
{
label: '备注',
prop: 'remark',
span: 24,
type: 'input',
componentProps: {
placeholder: '请输入备注',
type: 'textarea',
},
},
]);
const formData = ref<Partial<DomestiDistribuionInfoData>>({
speciesCode: undefined,
province: undefined,
county: undefined,
city: undefined,
year: undefined,
sourcesData: undefined,
createUser: undefined,
createDate: undefined,
remark: undefined,
});
const formType = ref<'add' | 'edit'>('add');
const handleFormSubmit = (form: DomestiDistribuionInfoData) => {
if (formType.value === 'add') {
addDomestiDistribuion(form).then(() => {
ElMessage.success('新增成功');
handleCancel();
getList();
});
} else {
form.auditStatus = 0;
updateDomestiDistribuion(form).then(() => {
ElMessage.success('编辑成功');
handleCancel();
getList();
});
}
};
const handleCancel = () => {
showDialog.value = false;
formTitle.value = '';
formType.value = 'add';
formData.value = {
speciesCode: undefined,
};
};
const handleAdd = () => {
showDialog.value = true;
formTitle.value = '新增分类地位';
formType.value = 'add';
};
const handleUpdate = (row: DomestiDistribuionInfoData) => {
showDialog.value = true;
formTitle.value = '编辑分类地位';
formType.value = 'edit';
formData.value = cloneDeep(row);
};
const handleDelete = (row: DomestiDistribuionTableColumns | null) => {
let msg = '你确定要删除所选数据?';
let id: number[] = [];
if (row) {
msg = `此操作将永久删除数据,是否继续?`;
id = [row.id];
} else {
id = state.ids;
}
if (id.length === 0) {
ElMessage.error('请选择要删除的数据。');
return;
}
ElMessageBox.confirm(msg, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
delDomestiDistribuion(
id,
id.map((i) => versionMap.value[i])
).then(() => {
ElMessage.success('删除成功');
getList();
});
})
.catch(() => {});
};
const auditFormRef = ref();
const showAuditDialog = ref(false);
const handleAudit = (row: DomestiDistribuionTableColumns) => {
auditFormRef.value.open(cloneDeep(row), userOptions.value);
};
const onAuditSubmit = (val: DomestiDistribuionTableColumns) => {
auditDomestiDistribuion(val).then(() => {
ElMessage.success('审核成功');
showAuditDialog.value = false;
getList();
});
};
</script>
<style lang="scss" scoped>
.colBlock {
display: block;
}
.colNone {
display: none;
}
.ml-2 {
margin: 3px;
}
</style>

View File

@ -0,0 +1,55 @@
export interface DomestiDistribuionTableColumns {
id: number; //
speciesCode: string; // 物种编码
province: string; // 所属省区
city: string; // 所属地级州市
county: string; // 所属区县
year: string; // 发现年份
sourcesData: string; // 数据来源
createUser: number; // 数据采集人
createDate: string; // 数据采集日期
auditUser: number; // 数据核查人
auditDate: string; // 数据核查日期
auditStatus: number; //
auditView: string; //
remark: string; //
version: number; //
}
export interface DomestiDistribuionInfoData {
id: number | undefined; //
speciesCode: string | undefined; // 物种编码
province: string | undefined; // 所属省区
city: string | undefined; // 所属地级州市
county: string | undefined; // 所属区县
year: string | undefined; // 发现年份
sourcesData: string | undefined; // 数据来源
createUser: number | undefined; // 数据采集人
createDate: string | undefined; // 数据采集日期
auditUser: number | undefined; // 数据核查人
auditDate: string | undefined; // 数据核查日期
auditStatus: number | undefined; //
auditView: string | undefined; //
remark: string | undefined; //
version: number | undefined; //
}
export interface DomestiDistribuionTableDataState {
ids: any[];
tableData: {
data: Array<DomestiDistribuionTableColumns>;
total: number;
loading: boolean;
param: {
pageNum: number;
pageSize: number;
};
};
}
export interface DomestiDistribuionEditState {
loading: boolean;
isShowDialog: boolean;
formData: DomestiDistribuionInfoData;
rules: object;
}

View File

@ -0,0 +1,53 @@
import request from '/@/utils/request'
// 查询国外分布列表
export function listForeignDistribution(query:object) {
return request({
url: '/api/v1/businesses/foreignDistribution/list',
method: 'get',
params: query
})
}
// 查询国外分布详细
export function getForeignDistribution(id:number) {
return request({
url: '/api/v1/businesses/foreignDistribution/get',
method: 'get',
params: {
id: id.toString()
}
})
}
// 新增国外分布
export function addForeignDistribution(data:object) {
return request({
url: '/api/v1/businesses/foreignDistribution/add',
method: 'post',
data: data
})
}
// 修改国外分布
export function updateForeignDistribution(data:object) {
return request({
url: '/api/v1/businesses/foreignDistribution/edit',
method: 'put',
data: data
})
}
// 删除国外分布
export function delForeignDistribution(ids:number[],version: number[]) {
return request({
url: '/api/v1/businesses/foreignDistribution/delete',
method: 'delete',
data:{
ids:ids,
version: version,
}
})
}
export function auditForeignDistribution(data: object) {
return request({
url: '/api/v1/businesses/foreignDistribution/audit',
method: 'post',
data: data,
});
}

View File

@ -0,0 +1,520 @@
<template>
<div class="businesses-foreignDistribution-container">
<el-card shadow="hover">
<QueryForm
v-model="searchForm"
:fields="searchFields"
@search="onSearch"
@reset="onReset"
ref="queryFormRef"
/>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
@click="handleAdd"
v-auth="'api/v1/businesses/foreignDistribution/add'"
><el-icon><ele-Plus /></el-icon>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
:disabled="multiple"
@click="handleDelete(null)"
v-auth="'api/v1/businesses/foreignDistribution/delete'"
><el-icon><ele-Delete /></el-icon>删除</el-button
>
</el-col>
</el-row>
<ProTable
v-if="columns.length > 0"
ref="proTableRef"
:columns="columns"
:data="tableData.data"
:loading="loading"
:show-selection="true"
@selection-change="handleSelectionChange"
:heightOffset="400"
:action-width="280"
>
<template #actions="{ row }">
<el-button
type="primary"
@click="handleUpdate(row)"
size="small"
v-auth="'api/v1/businesses/foreignDistribution/edit'"
v-if="row.auditStatus != 1"
><el-icon><ele-EditPen /></el-icon>修改</el-button
>
<el-button
type="danger"
size="small"
@click="handleDelete(row)"
v-auth="'api/v1/businesses/foreignDistribution/delete'"
><el-icon><ele-DeleteFilled /></el-icon>删除</el-button
>
<el-button
type="warning"
size="small"
@click="handleAudit(row)"
v-if="row.auditStatus == 0"
v-auth="'api/v1/businesses/foreignDistribution/audit'"
><el-icon><ele-Check /></el-icon>审核</el-button
>
</template>
</ProTable>
<pagination
v-show="tableData.total > 0"
:total="tableData.total"
v-model:page="tableData.param.pageNum"
v-model:limit="tableData.param.pageSize"
@pagination="getList"
/>
</el-card>
<ModalForm
v-model:visible="showDialog"
:title="formTitle"
:fields="formFields"
v-model:modelValue="formData"
:type="formType"
:show-footer="true"
:label-width="'120px'"
:width="'50%'"
@submit="handleFormSubmit"
@cancel="handleCancel"
ref="modalFormRef"
>
</ModalForm>
<AuditForm
ref="auditFormRef"
v-model="showAuditDialog"
title="审核数据"
@submit="onAuditSubmit"
/>
</div>
</template>
<script setup lang="ts">
import { toRefs, reactive, onMounted, ref, computed } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import {
listForeignDistribution,
delForeignDistribution,
addForeignDistribution,
updateForeignDistribution,
auditForeignDistribution,
} from './api';
import {
ForeignDistributionTableColumns,
ForeignDistributionInfoData,
ForeignDistributionTableDataState,
} from './type';
import { getUserList } from '/@/api/system/user/index';
import { UserItem, VersionMap } from '/@/types';
import { parseTime } from '/@/utils/gfast';
import { cloneDeep } from 'lodash';
import { listSpeciesName } from '../speciesName/api';
import { QueryFormField, TableColumn, PopupFormField } from '/@/components/dynamicpage/type';
import QueryForm from '/@/components/dynamicpage/queryForm/index.vue';
import ProTable from '/@/components/dynamicpage/ProTable/index.vue';
import ModalForm from '/@/components/dynamicpage/modalForm/index.vue';
import AuditForm from '/@/components/dynamicpage/auditForm/index.vue';
import { SpeciesNameInfoData } from '../speciesName/type';
defineOptions({ name: 'BusinessesForeignDistributionList' });
const loading = ref(false);
//
const single = ref(true);
//
const multiple = ref(true);
const userOptions = ref<UserItem[]>([]);
const state = reactive<ForeignDistributionTableDataState>({
ids: [],
tableData: {
data: [],
total: 0,
loading: false,
param: {
pageNum: 1,
pageSize: 10,
},
},
});
const versionMap = ref<VersionMap>({} as VersionMap);
const proTableRef = ref();
const { tableData } = toRefs(state);
const columns: TableColumn[] = [
{ label: '物种编码', prop: 'speciesCode' },
{ label: '所属大洲', prop: 'continent', minWidth: 150 },
{ label: '所属国家/地区', prop: 'region', minWidth: 150 },
{ label: '所属州', prop: 'belongState', minWidth: 150 },
{ label: '发现/报道年份', prop: 'year', minWidth: 150 },
{ label: '参考文献', prop: 'references', minWidth: 150 },
{
label: '数据采集人',
prop: 'createUser',
isFormater: true,
minWidth: 120,
formater(row, column, cellValue, index) {
const user = userOptions.value.find((i) => i.id === cellValue);
return user ? user.userNickname : '';
},
},
{
label: '数据采集日期',
prop: 'createDate',
isFormater: true,
minWidth: 120,
formater(_, col: any, val: string) {
return parseTime(val, '{y}-{m}-{d}');
},
},
{
label: '数据核查人',
prop: 'auditUser',
isFormater: true,
minWidth: 120,
formater(row, column, cellValue, index) {
const user = userOptions.value.find((i) => i.id === cellValue);
return user ? user.userNickname : '';
},
},
{
label: '数据核查日期',
prop: 'auditDate',
minWidth: 120,
isFormater: true,
formater(_, col: any, val: string) {
return parseTime(val, '{y}-{m}-{d}');
},
},
{
label: '状态',
prop: 'auditStatus',
isFormater: true,
formater(row, column, cellValue, index) {
return cellValue == 0 ? '待审核' : cellValue == 1 ? '通过' : '不通过';
},
},
{ label: '核查意见', prop: 'auditView' },
{ label: '备注', prop: 'remark' },
];
const onSearch = async (val: Record<string, any>) => {
let newVal: Record<string, any> = {};
for (const v in val) {
if (val[v] || val[v] === 0) {
newVal[v] = val[v];
}
}
state.tableData.param = { ...state.tableData.param, ...newVal };
getList();
};
const onReset = () => {
state.tableData.param = {
pageNum: 1,
pageSize: 10,
};
getList();
};
const searchForm = ref<Partial<ForeignDistributionInfoData>>({
speciesCode: undefined,
continent: undefined,
region: undefined,
belongState: undefined,
year: undefined,
references: undefined,
createUser: undefined,
auditStatus: undefined,
});
const searchFields = computed<QueryFormField[]>(() => [
{ label: '物种编码', prop: 'speciesCode', type: 'input', placeholder: '请输入物种编码' },
{ label: '所属大洲', prop: 'continent', type: 'input', placeholder: '请输入所属大洲' },
{ label: '所属国家/地区', prop: 'region', type: 'input', placeholder: '请输入所属国家/地区' },
{ label: '所属州', prop: 'belongState', type: 'input', placeholder: '请输入所属州' },
{ label: '发现/报道年份', prop: 'year', type: 'input', placeholder: '请输入发现/报道年份' },
{ label: '参考文献', prop: 'references', type: 'input', placeholder: '请输入参考文献' },
{
label: '核查状态',
prop: 'auditStatus',
type: 'select',
options: [
{ label: '待审核', value: 0 },
{ label: '通过', value: 1 },
{ label: '不通过', value: 2 },
],
placeholder: '请输入物种编码',
},
{
label: '数据采集人',
prop: 'createUser',
type: 'select',
options: userOptions.value.map((i) => {
return {
label: i.userNickname,
value: i.id,
};
}),
placeholder: '请选择数据采集人',
},
]);
//
onMounted(() => {
initTableData();
});
//
const initTableData = () => {
getList();
reqGetUserList();
reqListSpeciesName();
};
//
const getList = async () => {
loading.value = true;
const res = await listForeignDistribution(state.tableData.param);
let list = res.data.list ?? [];
state.tableData.data = list;
versionMap.value = list.reduce((acc: any, cur: any) => {
acc[cur.id] = cur.version;
return acc;
}, {});
state.tableData.total = res.data.total;
loading.value = false;
};
const specieslist = ref<SpeciesNameInfoData[]>([]);
/**获取物种列表 */
const reqListSpeciesName = async () => {
if (userOptions.value.length > 0) return;
const res = await listSpeciesName({ pageSize: 9999, pageNum: 1 });
specieslist.value = res.data.list;
};
/**获取用户列表 */
const reqGetUserList = async () => {
if (userOptions.value.length > 0) return;
const res = await getUserList({ pageSize: 9999, pageNum: 1 });
userOptions.value = res.data.userList;
};
//
const handleSelectionChange = (selection: Array<ForeignDistributionInfoData>) => {
state.ids = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const showDialog = ref(false);
const formTitle = ref('');
const formFields = computed<PopupFormField[]>(() => [
{
label: '物种编码',
prop: 'speciesCode',
type: 'select',
options: specieslist.value.map((i) => {
return {
value: i.speciesCode,
label: i.speciesCode,
};
}),
span: 24,
rules: [{ required: true, message: '请输入物种编码', trigger: 'blur' }],
componentProps: {
placeholder: '请选择物种编码',
},
},
{
label: '所属大洲',
prop: 'continent',
rules: [{ required: true, message: '请输入所属大洲', trigger: 'blur' }],
type: 'input',
span: 24,
componentProps: {
placeholder: '请输入所属大洲',
},
},
{
label: '所属国家/地区',
prop: 'region',
type: 'input',
span: 24,
rules: [{ required: true, message: '请输入所属国家/地区', trigger: 'blur' }],
componentProps: {
placeholder: '请输入所属国家/地区',
},
},
{
label: '所属州',
prop: 'belongState',
type: 'input',
span: 24,
rules: [{ required: true, message: '请输入所属州', trigger: 'blur' }],
componentProps: {
placeholder: '请输入所属州',
},
},
{
label: '发现/报道年份',
prop: 'year',
type: 'input',
span: 24,
rules: [{ required: true, message: '请输入发现/报道年份', trigger: 'blur' }],
componentProps: {
placeholder: '请输入发现/报道年份',
},
},
{
label: '参考文献',
prop: 'references',
type: 'input',
span: 24,
rules: [{ required: true, message: '请输入参考文献', trigger: 'blur' }],
componentProps: {
placeholder: '请输入参考文献',
},
},
{
label: '数据采集人',
span: 12,
prop: 'createUser',
type: 'select',
rules: [{ required: true, message: '请选择数据采集人', trigger: 'change' }],
componentProps: {
placeholder: '请选择数据采集人',
},
options: userOptions.value.map((i) => {
return {
label: i.userNickname,
value: i.id,
};
}),
},
{
label: '数据采集日期',
span: 12,
prop: 'createDate',
type: 'date',
rules: [{ required: true, message: '请选择数据采集日期', trigger: 'change' }],
componentProps: {
placeholder: '请选择数据采集日期',
},
},
{
label: '备注',
prop: 'remark',
span: 24,
type: 'input',
componentProps: {
placeholder: '请输入备注',
type: 'textarea',
},
},
]);
const formData = ref<Partial<ForeignDistributionInfoData>>({
speciesCode: undefined,
continent: undefined,
region: undefined,
belongState: undefined,
year: undefined,
references: undefined,
createUser: undefined,
createDate: undefined,
remark: undefined,
});
const formType = ref<'add' | 'edit'>('add');
const handleFormSubmit = (form: ForeignDistributionInfoData) => {
if (formType.value === 'add') {
addForeignDistribution(form).then(() => {
ElMessage.success('新增成功');
handleCancel();
getList();
});
} else {
form.auditStatus = 0;
updateForeignDistribution(form).then(() => {
ElMessage.success('编辑成功');
handleCancel();
getList();
});
}
};
const handleCancel = () => {
showDialog.value = false;
formTitle.value = '';
formType.value = 'add';
formData.value = {
speciesCode: undefined,
};
};
const handleAdd = () => {
showDialog.value = true;
formTitle.value = '新增分类地位';
formType.value = 'add';
};
const handleUpdate = (row: ForeignDistributionInfoData) => {
showDialog.value = true;
formTitle.value = '编辑分类地位';
formType.value = 'edit';
formData.value = cloneDeep(row);
};
const handleDelete = (row: ForeignDistributionTableColumns | null) => {
let msg = '你确定要删除所选数据?';
let id: number[] = [];
if (row) {
msg = `此操作将永久删除数据,是否继续?`;
id = [row.id];
} else {
id = state.ids;
}
if (id.length === 0) {
ElMessage.error('请选择要删除的数据。');
return;
}
ElMessageBox.confirm(msg, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
delForeignDistribution(
id,
id.map((i) => versionMap.value[i])
).then(() => {
ElMessage.success('删除成功');
getList();
});
})
.catch(() => {});
};
const auditFormRef = ref();
const showAuditDialog = ref(false);
const handleAudit = (row: ForeignDistributionTableColumns) => {
auditFormRef.value.open(cloneDeep(row), userOptions.value);
};
const onAuditSubmit = (val: ForeignDistributionTableColumns) => {
auditForeignDistribution(val).then(() => {
ElMessage.success('审核成功');
showAuditDialog.value = false;
getList();
});
};
</script>
<style lang="scss" scoped>
.colBlock {
display: block;
}
.colNone {
display: none;
}
.ml-2 {
margin: 3px;
}
</style>

View File

@ -0,0 +1,55 @@
export interface ForeignDistributionTableColumns {
id: number; //
speciesCode: string; // 物种编码
continent: string; // 所属大洲
region: string; // 所属国家/地区
belongState: string; // 所属州
year: string; // 发现/报道年份
references: string; // 参考文献
createUser: number; // 数据采集人
createDate: string; // 数据采集日期
auditUser: number; // 数据核查人
auditDate: string; // 数据核查日期
auditStatus: number; //
auditView: string; //
remark: string; //
version: number; //
}
export interface ForeignDistributionInfoData {
id: number | undefined; //
speciesCode: string | undefined; // 物种编码
continent: string | undefined; // 所属大洲
region: string | undefined; // 所属国家/地区
belongState: string | undefined; // 所属州
year: string | undefined; // 发现/报道年份
references: string | undefined; // 参考文献
createUser: number | undefined; // 数据采集人
createDate: string | undefined; // 数据采集日期
auditUser: number | undefined; // 数据核查人
auditDate: string | undefined; // 数据核查日期
auditStatus: number | undefined; //
auditView: string | undefined; //
remark: string | undefined; //
version: number | undefined; //
}
export interface ForeignDistributionTableDataState {
ids: any[];
tableData: {
data: Array<ForeignDistributionTableColumns>;
total: number;
loading: boolean;
param: {
pageNum: number;
pageSize: number;
};
};
}
export interface ForeignDistributionEditState {
loading: boolean;
isShowDialog: boolean;
formData: ForeignDistributionInfoData;
rules: object;
}

View File

@ -0,0 +1,53 @@
import request from '/@/utils/request';
// 查询地理分布列表
export function listGeography(query: object) {
return request({
url: '/api/v1/businesses/geography/list',
method: 'get',
params: query,
});
}
// 查询地理分布详细
export function getGeography(id: number) {
return request({
url: '/api/v1/businesses/geography/get',
method: 'get',
params: {
id: id.toString(),
},
});
}
// 新增地理分布
export function addGeography(data: object) {
return request({
url: '/api/v1/businesses/geography/add',
method: 'post',
data: data,
});
}
// 修改地理分布
export function updateGeography(data: object) {
return request({
url: '/api/v1/businesses/geography/edit',
method: 'put',
data: data,
});
}
// 删除地理分布
export function delGeography(ids: number[], version: number[]) {
return request({
url: '/api/v1/businesses/geography/delete',
method: 'delete',
data: {
ids: ids,
version: version,
},
});
}
export function auditGeography(data: object) {
return request({
url: '/api/v1/businesses/geography/audit',
method: 'post',
data: data,
});
}

View File

@ -0,0 +1,512 @@
<template>
<div class="businesses-geography-container">
<el-card shadow="hover">
<QueryForm
v-model="searchForm"
:fields="searchFields"
@search="onSearch"
@reset="onReset"
ref="queryFormRef"
/>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" @click="handleAdd" v-auth="'api/v1/businesses/geography/add'"
><el-icon><ele-Plus /></el-icon>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
:disabled="multiple"
@click="handleDelete(null)"
v-auth="'api/v1/businesses/geography/delete'"
><el-icon><ele-Delete /></el-icon>删除</el-button
>
</el-col>
</el-row>
<ProTable
v-if="columns.length > 0"
ref="proTableRef"
:columns="columns"
:data="tableData.data"
:loading="loading"
:show-selection="true"
@selection-change="handleSelectionChange"
:heightOffset="400"
:action-width="280"
>
<template #actions="{ row }">
<el-button
type="primary"
@click="handleUpdate(row)"
size="small"
v-auth="'api/v1/businesses/geography/edit'"
v-if="row.auditStatus != 1"
><el-icon><ele-EditPen /></el-icon>修改</el-button
>
<el-button
type="danger"
size="small"
@click="handleDelete(row)"
v-auth="'api/v1/businesses/geography/delete'"
><el-icon><ele-DeleteFilled /></el-icon>删除</el-button
>
<el-button
type="warning"
size="small"
@click="handleAudit(row)"
v-if="row.auditStatus == 0"
v-auth="'api/v1/businesses/geography/audit'"
><el-icon><ele-Check /></el-icon>审核</el-button
>
</template>
</ProTable>
<pagination
v-show="tableData.total > 0"
:total="tableData.total"
v-model:page="tableData.param.pageNum"
v-model:limit="tableData.param.pageSize"
@pagination="getList"
/>
</el-card>
<ModalForm
v-model:visible="showDialog"
:title="formTitle"
:fields="formFields"
v-model:modelValue="formData"
:type="formType"
:show-footer="true"
:label-width="'120px'"
:width="'50%'"
@submit="handleFormSubmit"
@cancel="handleCancel"
ref="modalFormRef"
>
</ModalForm>
<AuditForm
ref="auditFormRef"
v-model="showAuditDialog"
title="审核数据"
@submit="onAuditSubmit"
/>
</div>
</template>
<script setup lang="ts">
import { toRefs, reactive, onMounted, ref, computed, toRaw } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { listGeography, delGeography, addGeography, updateGeography, auditGeography } from './api';
import { GeographyTableColumns, GeographyInfoData, GeographyTableDataState } from './type';
import { getUserList } from '/@/api/system/user/index';
import { UserItem, VersionMap } from '/@/types';
import { parseTime } from '/@/utils/gfast';
import { cloneDeep } from 'lodash';
import { listSpeciesName } from '../speciesName/api';
import { QueryFormField, TableColumn, PopupFormField } from '/@/components/dynamicpage/type';
import QueryForm from '/@/components/dynamicpage/queryForm/index.vue';
import ProTable from '/@/components/dynamicpage/ProTable/index.vue';
import ModalForm from '/@/components/dynamicpage/modalForm/index.vue';
import AuditForm from '/@/components/dynamicpage/auditForm/index.vue';
import {SpeciesNameInfoData} from '../speciesName/type'
defineOptions({ name: 'BusinessesGeographyList' });
const loading = ref(false);
//
const single = ref(true);
//
const multiple = ref(true);
const userOptions = ref<UserItem[]>([]);
const state = reactive<GeographyTableDataState>({
ids: [],
tableData: {
data: [],
total: 0,
loading: false,
param: {
pageNum: 1,
pageSize: 10,
},
},
});
const versionMap = ref<VersionMap>({} as VersionMap);
const proTableRef = ref();
const { tableData } = toRefs(state);
const columns: TableColumn[] = [
{ label: '物种编码', prop: 'speciesCode' },
{ label: '地理分布描述', prop: 'distributionInfo', minWidth: 150 },
{ label: '原产地描述', prop: 'originInfo', minWidth: 150 },
{ label: '国外分布描述', prop: 'abroadInfo', minWidth: 150 },
{ label: '国内分布描述', prop: 'domesticInfo', minWidth: 150 },
{
label: '数据采集人',
prop: 'createUser',
isFormater: true,
minWidth: 120,
formater(row, column, cellValue, index) {
const user = userOptions.value.find((i) => i.id === cellValue);
return user ? user.userNickname : '';
},
},
{
label: '数据采集日期',
prop: 'createDate',
isFormater: true,
minWidth: 120,
formater(_, col: any, val: string) {
return parseTime(val, '{y}-{m}-{d}');
},
},
{
label: '数据核查人',
prop: 'auditUser',
isFormater: true,
minWidth: 120,
formater(row, column, cellValue, index) {
const user = userOptions.value.find((i) => i.id === cellValue);
return user ? user.userNickname : '';
},
},
{
label: '数据核查日期',
prop: 'auditDate',
minWidth: 120,
isFormater: true,
formater(_, col: any, val: string) {
return parseTime(val, '{y}-{m}-{d}');
},
},
{
label: '状态',
prop: 'auditStatus',
isFormater: true,
formater(row, column, cellValue, index) {
return cellValue == 0 ? '待审核' : cellValue == 1 ? '通过' : '不通过';
},
},
{ label: '核查意见', prop: 'auditView' },
{ label: '备注', prop: 'remark' },
];
const onSearch = async (val: Record<string, any>) => {
console.log(val);
let newVal: Record<string, any> = {};
for (const v in val) {
if (val[v]||val[v]===0) {
newVal[v] = val[v];
}
}
state.tableData.param = { ...state.tableData.param, ...newVal };
getList();
};
const onReset = () => {
state.tableData.param = {
pageNum: 1,
pageSize: 10,
};
getList();
};
const searchForm = ref<Partial<GeographyInfoData>>({
speciesCode: undefined,
createUser: undefined,
createDate: undefined,
auditUser: undefined,
auditDate: undefined,
auditStatus: undefined,
});
const searchFields = computed<QueryFormField[]>(() => [
{ label: '物种编码', prop: 'speciesCode', type: 'input', placeholder: '请输入物种编码' },
{
label: '核查状态',
prop: 'auditStatus',
type: 'select',
options: [
{ label: '待审核', value: 0 },
{ label: '通过', value: 1 },
{ label: '不通过', value: 2 },
],
placeholder: '请输入物种编码',
},
{
label: '数据采集人',
prop: 'createUser',
type: 'select',
options: userOptions.value.map((i) => {
return {
label: i.userNickname,
value: i.id,
};
}),
placeholder: '请选择数据采集人',
},
{ label: '数据采集日期', prop: 'createDate', type: 'daterange', valueFormat: 'YYYY-MM-DD' },
{
label: '数据核查人',
prop: 'auditUser',
type: 'select',
options: userOptions.value.map((i) => {
return {
label: i.userNickname,
value: i.id,
};
}),
placeholder: '请选择数据核查人',
},
{ label: '数据核查日期', prop: 'auditDate', type: 'daterange', valueFormat: 'YYYY-MM-DD' },
]);
//
onMounted(() => {
initTableData();
});
//
const initTableData = () => {
getList();
reqGetUserList();
reqListSpeciesName();
};
//
const getList = async () => {
loading.value = true;
const res = await listGeography(state.tableData.param);
let list = res.data.list ?? [];
state.tableData.data = list;
versionMap.value = list.reduce((acc: any, cur: any) => {
acc[cur.id] = cur.version;
return acc;
}, {});
state.tableData.total = res.data.total;
loading.value = false;
};
const specieslist = ref<SpeciesNameInfoData[]>([]);
/**获取物种列表 */
const reqListSpeciesName = async () => {
if (userOptions.value.length > 0) return;
const res = await listSpeciesName({ pageSize: 9999, pageNum: 1 });
specieslist.value = res.data.list;
};
/**获取用户列表 */
const reqGetUserList = async () => {
if (userOptions.value.length > 0) return;
const res = await getUserList({ pageSize: 9999, pageNum: 1 });
userOptions.value = res.data.userList;
};
//
const handleSelectionChange = (selection: Array<GeographyInfoData>) => {
state.ids = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
const showDialog = ref(false);
const formTitle = ref('');
const formFields = computed<PopupFormField[]>(() => [
{
label: '物种编码',
prop: 'speciesCode',
type: 'select',
options: specieslist.value.map((i) => {
return {
value: i.speciesCode,
label: i.speciesCode,
};
}),
span: 24,
rules: [{ required: true, message: '请输入物种编码', trigger: 'blur' }],
componentProps: {
placeholder: '请选择物种编码',
},
},
{
label:"地理分布描述",
prop:'distributionInfo',
rules: [{ required: true, message: '请输入地理分布描述', trigger: 'blur' }],
type:'input',
span:24,
componentProps:{
type:'textarea',
placeholder:'请输入地理分布描述'
}
},
{
label:"原产地描述",
prop:'originInfo',
type:'input',
span:24,
rules: [{ required: true, message: '请输入原产地描述', trigger: 'blur' }],
componentProps:{
type:'textarea',
placeholder:'请输入原产地描述'
}
},
{
label:"国外分布描述",
prop:'abroadInfo',
type:'input',
span:24,
rules: [{ required: true, message: '请输入国外分布描述', trigger: 'blur' }],
componentProps:{
type:'textarea',
placeholder:'请输入国外分布描述'
}
},
{
label:"国内分布描述",
prop:'domesticInfo',
type:'input',
span:24,
rules: [{ required: true, message: '请输入国内分布描述', trigger: 'blur' }],
componentProps:{
type:'textarea',
placeholder:'请输入国内分布描述'
}
},
{
label: '数据采集人',
span: 12,
prop: 'createUser',
type: 'select',
rules: [{ required: true, message: '请选择数据采集人', trigger: 'change' }],
componentProps: {
placeholder: '请选择数据采集人',
},
options: userOptions.value.map((i) => {
return {
label: i.userNickname,
value: i.id,
};
}),
},
{
label: '数据采集日期',
span: 12,
prop: 'createDate',
type: 'date',
rules: [{ required: true, message: '请选择数据采集日期', trigger: 'change' }],
componentProps: {
placeholder: '请选择数据采集日期',
},
},
{
label: '备注',
prop: 'remark',
span: 24,
type: 'input',
componentProps: {
placeholder: '请输入备注',
type: 'textarea',
},
},
]);
const formData = ref<Partial<GeographyInfoData>>({
speciesCode: undefined,
distributionInfo: undefined,
originInfo: undefined,
abroadInfo: undefined,
domesticInfo: undefined,
createUser: undefined,
createDate: undefined,
auditStatus: undefined,
remark: undefined,
});
const formType = ref<'add' | 'edit'>('add');
const handleFormSubmit = (form: GeographyInfoData) => {
if (formType.value === 'add') {
addGeography(form).then(() => {
ElMessage.success('新增成功');
handleCancel();
getList();
});
} else {
form.auditStatus = 0;
updateGeography(form).then(() => {
ElMessage.success('编辑成功');
handleCancel();
getList();
});
}
};
const handleCancel = () => {
showDialog.value = false;
formTitle.value = '';
formType.value = 'add';
formData.value = {
speciesCode: undefined,
};
};
const handleAdd = () => {
showDialog.value = true;
formTitle.value = '新增分类地位';
formType.value = 'add';
};
const handleUpdate = (row: GeographyInfoData) => {
showDialog.value = true;
formTitle.value = '编辑分类地位';
formType.value = 'edit';
formData.value = cloneDeep(row);
};
const handleDelete = (row: GeographyTableColumns | null) => {
let msg = '你确定要删除所选数据?';
let id: number[] = [];
if (row) {
msg = `此操作将永久删除数据,是否继续?`;
id = [row.id];
} else {
id = state.ids;
}
if (id.length === 0) {
ElMessage.error('请选择要删除的数据。');
return;
}
ElMessageBox.confirm(msg, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
delGeography(
id,
id.map((i) => versionMap.value[i])
).then(() => {
ElMessage.success('删除成功');
getList();
});
})
.catch(() => {});
};
const auditFormRef = ref();
const showAuditDialog = ref(false);
const handleAudit = (row: GeographyTableColumns) => {
auditFormRef.value.open(cloneDeep(row), userOptions.value);
};
const onAuditSubmit = (val: GeographyTableColumns) => {
auditGeography(val).then(() => {
ElMessage.success('审核成功');
showAuditDialog.value = false;
getList();
});
};
</script>
<style lang="scss" scoped>
.colBlock {
display: block;
}
.colNone {
display: none;
}
.ml-2 {
margin: 3px;
}
</style>

View File

@ -0,0 +1,54 @@
export interface GeographyTableColumns {
id: number; //
speciesCode: string; // 物种编码
distributionInfo: string; // 地理分布描述
originInfo: string; // 原产地描述
abroadInfo: string; // 国外分布描述
domesticInfo: string; // 国内分布描述
createUser: number; // 数据采集人
createDate: string; // 数据采集日期
auditUser: number; // 数据核查人
auditDate: string; // 数据核查日期
auditStatus: number; // 核查状态
auditView: string; // 核查意见
remark: string; // 备注
version: number; //
createdAt: string; //
}
export interface GeographyInfoData {
id: number | undefined; //
speciesCode: string | undefined; // 物种编码
distributionInfo: string | undefined; // 地理分布描述
originInfo: string | undefined; // 原产地描述
abroadInfo: string | undefined; // 国外分布描述
domesticInfo: string | undefined; // 国内分布描述
createUser: number | undefined; // 数据采集人
createDate: string | undefined; // 数据采集日期
auditUser: number | undefined; // 数据核查人
auditDate: string | undefined; // 数据核查日期
auditStatus: number | undefined; // 核查状态
auditView: string | undefined; // 核查意见
remark: string | undefined; // 备注
version: number | undefined; //
}
export interface GeographyTableDataState {
ids: any[];
tableData: {
data: Array<GeographyTableColumns>;
total: number;
loading: boolean;
param: {
pageNum: number;
pageSize: number;
};
};
}
export interface GeographyEditState {
loading: boolean;
isShowDialog: boolean;
formData: GeographyInfoData;
rules: object;
}

View File

@ -209,7 +209,6 @@ const onSearch = async (val: Record<string, any>) => {
newVal[v] = val[v];
}
}
console.log(newVal);
state.tableData.param = { ...state.tableData.param, ...newVal };
speciesNameList();
};
@ -418,30 +417,18 @@ const formType = ref<'add' | 'edit'>('add');
const handleFormSubmit = (form: SpeciesNameInfoData) => {
if (formType.value === 'add') {
addSpeciesName(form)
.then(() => {
ElMessage.success('新增成功');
handleCancel();
speciesNameList();
})
.catch(() => {
ElMessage.error('新增失败');
handleCancel();
speciesNameList();
});
addSpeciesName(form).then(() => {
ElMessage.success('新增成功');
handleCancel();
speciesNameList();
});
} else {
form.auditStatus = 0;
updateSpeciesName(form)
.then(() => {
ElMessage.success('编辑成功');
handleCancel();
speciesNameList();
})
.catch(() => {
ElMessage.error('编辑失败');
handleCancel();
speciesNameList();
});
updateSpeciesName(form).then(() => {
ElMessage.success('编辑成功');
handleCancel();
speciesNameList();
});
}
};
const handleCancel = () => {
@ -509,16 +496,10 @@ const handleAudit = (row: SpeciesNameTableColumns) => {
auditFormRef.value.open(cloneDeep(row), userOptions.value);
};
const onAuditSubmit = (val: SpeciesNameTableColumns) => {
auditSpeciesName(val)
.then(() => {
ElMessage.success('审核成功');
showAuditDialog.value = false;
speciesNameList();
})
.catch(() => {
ElMessage.error('审核失败');
showAuditDialog.value = false;
speciesNameList();
});
auditSpeciesName(val).then(() => {
ElMessage.success('审核成功');
showAuditDialog.value = false;
speciesNameList();
});
};
</script>