完善政府端

This commit is contained in:
2025-10-09 18:01:06 +08:00
parent f88383425f
commit 1a1abf4c26
39 changed files with 4309 additions and 673 deletions

View File

@@ -0,0 +1,93 @@
const { DataTypes } = require('sequelize');
const sequelize = require('../config/database');
const ApprovalProcess = sequelize.define('ApprovalProcess', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
title: {
type: DataTypes.STRING(255),
allowNull: false,
comment: '审批标题'
},
type: {
type: DataTypes.ENUM('enterprise', 'license', 'project', 'other'),
allowNull: false,
comment: '审批类型'
},
applicant: {
type: DataTypes.STRING(100),
allowNull: false,
comment: '申请人'
},
phone: {
type: DataTypes.STRING(20),
allowNull: true,
comment: '联系电话'
},
farmName: {
type: DataTypes.STRING(255),
allowNull: true,
comment: '养殖场名称'
},
quantity: {
type: DataTypes.INTEGER,
allowNull: true,
comment: '认证数量'
},
description: {
type: DataTypes.TEXT,
allowNull: true,
comment: '审批说明'
},
status: {
type: DataTypes.ENUM('pending', 'approved', 'rejected', 'processing'),
defaultValue: 'pending',
comment: '审批状态'
},
approvalComment: {
type: DataTypes.TEXT,
allowNull: true,
comment: '审批意见'
},
approver: {
type: DataTypes.STRING(100),
allowNull: true,
comment: '审批人'
},
approvalTime: {
type: DataTypes.DATE,
allowNull: true,
comment: '审批时间'
},
files: {
type: DataTypes.JSON,
allowNull: true,
comment: '附件文件列表'
},
remarks: {
type: DataTypes.TEXT,
allowNull: true,
comment: '备注'
},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
comment: '创建时间'
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
comment: '更新时间'
}
}, {
tableName: 'approval_processes',
timestamps: true,
createdAt: 'createdAt',
updatedAt: 'updatedAt',
paranoid: false
});
module.exports = ApprovalProcess;

View File

@@ -0,0 +1,98 @@
const { DataTypes } = require('sequelize');
const sequelize = require('../config/database');
const CattleAcademy = sequelize.define('CattleAcademy', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
title: {
type: DataTypes.STRING(255),
allowNull: false,
comment: '标题'
},
coverImage: {
type: DataTypes.STRING(500),
allowNull: true,
comment: '封面图URL'
},
content: {
type: DataTypes.TEXT,
allowNull: true,
comment: '内容'
},
summary: {
type: DataTypes.TEXT,
allowNull: true,
comment: '摘要'
},
category: {
type: DataTypes.STRING(100),
allowNull: true,
comment: '分类'
},
tags: {
type: DataTypes.JSON,
allowNull: true,
comment: '标签'
},
sort: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: '排序'
},
status: {
type: DataTypes.BOOLEAN,
defaultValue: true,
comment: '状态'
},
viewCount: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: '浏览次数'
},
author: {
type: DataTypes.STRING(100),
allowNull: true,
comment: '作者'
},
publishTime: {
type: DataTypes.DATE,
allowNull: true,
comment: '发布时间'
},
isTop: {
type: DataTypes.BOOLEAN,
defaultValue: false,
comment: '是否置顶'
},
isRecommend: {
type: DataTypes.BOOLEAN,
defaultValue: false,
comment: '是否推荐'
},
remarks: {
type: DataTypes.TEXT,
allowNull: true,
comment: '备注'
},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
comment: '创建时间'
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
comment: '更新时间'
}
}, {
tableName: 'cattle_academy',
timestamps: true,
createdAt: 'createdAt',
updatedAt: 'updatedAt',
paranoid: false
});
module.exports = CattleAcademy;

View File

@@ -0,0 +1,107 @@
const { DataTypes } = require('sequelize');
const sequelize = require('../config/database');
const DeviceWarning = sequelize.define('DeviceWarning', {
id: {
type: DataTypes.INTEGER,
autoIncrement: true,
primaryKey: true,
},
farmName: {
type: DataTypes.STRING,
allowNull: false,
comment: '养殖场名称',
field: 'farmName'
},
farmerName: {
type: DataTypes.STRING,
allowNull: false,
comment: '养殖户名称',
field: 'farmerName'
},
phone: {
type: DataTypes.STRING,
allowNull: false,
comment: '联系电话',
field: 'phone'
},
deviceType: {
type: DataTypes.ENUM('智能耳标', '智能项圈', '智能主机'),
allowNull: false,
comment: '设备类型',
field: 'deviceType'
},
deviceNumber: {
type: DataTypes.STRING,
allowNull: false,
comment: '设备编号',
field: 'deviceNumber'
},
alertType: {
type: DataTypes.ENUM('设备离线', '电量不足', '信号异常', '温度异常', '其他'),
allowNull: false,
comment: '预警类型',
field: 'alertType'
},
alertLevel: {
type: DataTypes.ENUM('high', 'medium', 'low'),
allowNull: false,
defaultValue: 'medium',
comment: '预警级别 (高, 中, 低)',
field: 'alertLevel'
},
alertTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
comment: '预警时间',
field: 'alertTime'
},
status: {
type: DataTypes.ENUM('active', 'resolved', 'ignored'),
allowNull: false,
defaultValue: 'active',
comment: '预警状态 (活跃, 已解决, 已忽略)',
field: 'status'
},
description: {
type: DataTypes.TEXT,
comment: '预警描述',
},
location: {
type: DataTypes.STRING,
comment: '设备位置',
},
batteryLevel: {
type: DataTypes.INTEGER,
comment: '电池电量百分比',
},
signalStrength: {
type: DataTypes.INTEGER,
comment: '信号强度',
},
temperature: {
type: DataTypes.FLOAT,
comment: '温度值',
},
resolvedBy: {
type: DataTypes.STRING,
comment: '解决人',
},
resolvedAt: {
type: DataTypes.DATE,
comment: '解决时间',
},
remarks: {
type: DataTypes.TEXT,
comment: '备注',
},
}, {
tableName: 'device_warnings',
timestamps: true,
createdAt: 'createdAt',
updatedAt: 'updatedAt',
paranoid: false,
});
module.exports = DeviceWarning;

View File

@@ -0,0 +1,63 @@
const { DataTypes } = require('sequelize');
const sequelize = require('../config/database');
const EpidemicActivity = sequelize.define('EpidemicActivity', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
activityName: {
type: DataTypes.STRING(255),
allowNull: false,
comment: '活动名称'
},
livestockCategory: {
type: DataTypes.STRING(100),
allowNull: true,
comment: '防疫畜别'
},
diseaseCategory: {
type: DataTypes.STRING(100),
allowNull: true,
comment: '疫病类别'
},
vaccineUsed: {
type: DataTypes.STRING(255),
allowNull: true,
comment: '使用疫苗'
},
vaccineBatch: {
type: DataTypes.STRING(100),
allowNull: true,
comment: '疫苗批次'
},
preventionDate: {
type: DataTypes.STRING(100),
allowNull: true,
comment: '防疫日期'
},
activityStatus: {
type: DataTypes.ENUM('active', 'inactive'),
defaultValue: 'active',
comment: '活动状态'
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
comment: '更新时间'
},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
comment: '创建时间'
}
}, {
tableName: 'epidemic_activities',
timestamps: true,
createdAt: 'createdAt',
updatedAt: 'updatedAt',
paranoid: false
});
module.exports = EpidemicActivity;

View File

@@ -0,0 +1,103 @@
const { DataTypes } = require('sequelize');
const sequelize = require('../config/database');
const ProductionMaterialCertification = sequelize.define('ProductionMaterialCertification', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
materialName: {
type: DataTypes.STRING(255),
allowNull: false,
comment: '生产资料名称'
},
materialType: {
type: DataTypes.STRING(100),
allowNull: false,
comment: '生产资料类型'
},
manufacturer: {
type: DataTypes.STRING(255),
allowNull: false,
comment: '生产厂商'
},
certificationNumber: {
type: DataTypes.STRING(100),
allowNull: false,
comment: '认证编号'
},
certificationType: {
type: DataTypes.STRING(100),
allowNull: false,
comment: '认证类型'
},
certificationAuthority: {
type: DataTypes.STRING(255),
allowNull: false,
comment: '认证机构'
},
issueDate: {
type: DataTypes.DATE,
allowNull: false,
comment: '发证日期'
},
expiryDate: {
type: DataTypes.DATE,
allowNull: false,
comment: '有效期至'
},
certificationStatus: {
type: DataTypes.ENUM('valid', 'expired', 'suspended', 'revoked'),
defaultValue: 'valid',
comment: '认证状态'
},
description: {
type: DataTypes.TEXT,
allowNull: true,
comment: '产品描述'
},
specifications: {
type: DataTypes.TEXT,
allowNull: true,
comment: '技术规格'
},
applicableScope: {
type: DataTypes.TEXT,
allowNull: true,
comment: '适用范围'
},
contactPerson: {
type: DataTypes.STRING(100),
allowNull: true,
comment: '联系人'
},
contactPhone: {
type: DataTypes.STRING(20),
allowNull: true,
comment: '联系电话'
},
remarks: {
type: DataTypes.TEXT,
allowNull: true,
comment: '备注'
},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
comment: '创建时间'
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
comment: '更新时间'
}
}, {
tableName: 'production_material_certifications',
timestamps: true,
createdAt: 'createdAt',
updatedAt: 'updatedAt',
paranoid: false
});
module.exports = ProductionMaterialCertification;