更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -14,14 +14,6 @@ import (
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
// 本文件承载组织架构模块的设置读写、CSV 导入导出,以及 DTO 组装与通用工具函数。
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 组织架构设置(按租户存放在 yz_backend_normal_setting 中)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// GetOrgSettings 获取当前租户的组织架构设置。
|
||||
// GET /backend/{erp|oa}/getOrgSettings
|
||||
func (c *BackendOrganizationController) GetOrgSettings() {
|
||||
tid, ok := c.tenantID()
|
||||
if !ok {
|
||||
@@ -30,8 +22,6 @@ func (c *BackendOrganizationController) GetOrgSettings() {
|
||||
c.jsonOK(c.loadOrgSettings(tid))
|
||||
}
|
||||
|
||||
// SaveOrgSettings 保存当前租户的组织架构设置。
|
||||
// POST /backend/{erp|oa}/saveOrgSettings
|
||||
func (c *BackendOrganizationController) SaveOrgSettings() {
|
||||
tid, ok := c.tenantID()
|
||||
if !ok {
|
||||
@@ -95,7 +85,6 @@ func (c *BackendOrganizationController) orgSettingsCode(tid uint64) string {
|
||||
return fmt.Sprintf("%s_%d", orgSettingsCodePrefix, tid)
|
||||
}
|
||||
|
||||
// loadOrgSettings 读取租户设置;无记录或解析失败时回退到默认值,保证接口始终可用。
|
||||
func (c *BackendOrganizationController) loadOrgSettings(tid uint64) orgSettings {
|
||||
settings := defaultOrgSettings()
|
||||
|
||||
@@ -146,16 +135,10 @@ func (c *BackendOrganizationController) persistOrgSettings(tid uint64, settings
|
||||
return err
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 导入 / 导出(CSV,带 UTF-8 BOM,Excel 可直接打开)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
var organizationExportHeader = []string{
|
||||
"组织编码", "组织名称", "上级组织编码", "是否公司(1是0否)", "排序", "状态(1启用0禁用)", "备注",
|
||||
}
|
||||
|
||||
// ExportOrganization 导出当前租户组织架构为 CSV。
|
||||
// GET /backend/{erp|oa}/exportOrganization
|
||||
func (c *BackendOrganizationController) ExportOrganization() {
|
||||
tid, ok := c.tenantID()
|
||||
if !ok {
|
||||
@@ -181,7 +164,6 @@ func (c *BackendOrganizationController) ExportOrganization() {
|
||||
c.Ctx.Output.Header("Content-Disposition",
|
||||
fmt.Sprintf("attachment; filename=organization_%s.csv", time.Now().Format("20060102150405")))
|
||||
|
||||
// UTF-8 BOM,避免 Excel 打开中文乱码
|
||||
_, _ = c.Ctx.ResponseWriter.Write([]byte{0xEF, 0xBB, 0xBF})
|
||||
writer := csv.NewWriter(c.Ctx.ResponseWriter)
|
||||
_ = writer.Write(organizationExportHeader)
|
||||
@@ -199,10 +181,6 @@ func (c *BackendOrganizationController) ExportOrganization() {
|
||||
writer.Flush()
|
||||
}
|
||||
|
||||
// ImportOrganization 从 CSV 导入组织架构。
|
||||
// 已存在的组织编码执行更新,不存在的新增;上级组织通过编码关联,
|
||||
// 上级关系在所有行入库后统一回填,因此 CSV 行序不影响结果。
|
||||
// POST /backend/{erp|oa}/importOrganization (multipart/form-data, field=file)
|
||||
func (c *BackendOrganizationController) ImportOrganization() {
|
||||
tid, ok := c.tenantID()
|
||||
if !ok {
|
||||
@@ -334,8 +312,6 @@ func (c *BackendOrganizationController) ImportOrganization() {
|
||||
})
|
||||
}
|
||||
|
||||
// GetImportTemplate 下载导入模板(仅表头 + 一行示例)。
|
||||
// GET /backend/{erp|oa}/organizationImportTemplate
|
||||
func (c *BackendOrganizationController) GetImportTemplate() {
|
||||
if _, ok := c.tenantID(); !ok {
|
||||
return
|
||||
@@ -352,7 +328,6 @@ func (c *BackendOrganizationController) GetImportTemplate() {
|
||||
writer.Flush()
|
||||
}
|
||||
|
||||
// bomTrimReader 去掉 CSV 文件开头可能存在的 UTF-8 BOM。
|
||||
type bomTrimReader struct {
|
||||
reader io.Reader
|
||||
checked bool
|
||||
|
||||
Reference in new issue
Block a user