add Officer view

This commit is contained in:
kittapath 2025-01-22 15:15:29 +07:00
parent 99c1ead9a1
commit debf24e5bc
3 changed files with 25 additions and 2 deletions

View file

@ -815,6 +815,13 @@ export class WorkflowController extends Controller {
let condition: any = { let condition: any = {
isDirector: true, isDirector: true,
orgRootId: posMasterUser.orgRootId, orgRootId: posMasterUser.orgRootId,
orgRevisionId: posMasterUser.orgRevisionId,
};
let conditionOfficer: any = {
isDirector: true,
isOfficer: true,
orgRevisionId: posMasterUser.orgRevisionId,
}; };
if (type.trim().toUpperCase() == "OPERATE") { if (type.trim().toUpperCase() == "OPERATE") {
@ -832,6 +839,7 @@ export class WorkflowController extends Controller {
condition = { condition = {
isDirector: true, isDirector: true,
orgRootId: posMasterUser.orgRootId, orgRootId: posMasterUser.orgRootId,
orgRevisionId: posMasterUser.orgRevisionId,
orgChild1Id: IsNull(), orgChild1Id: IsNull(),
orgChild2Id: IsNull(), orgChild2Id: IsNull(),
orgChild3Id: IsNull(), orgChild3Id: IsNull(),
@ -848,6 +856,7 @@ export class WorkflowController extends Controller {
condition = { condition = {
isDirector: true, isDirector: true,
isDeputy: true, isDeputy: true,
orgRevisionId: posMasterUser.orgRevisionId,
orgChild1Id: IsNull(), orgChild1Id: IsNull(),
orgChild2Id: IsNull(), orgChild2Id: IsNull(),
orgChild3Id: IsNull(), orgChild3Id: IsNull(),
@ -860,7 +869,11 @@ export class WorkflowController extends Controller {
if (body.isAct == true) { if (body.isAct == true) {
const [lists, total] = await AppDataSource.getRepository(viewDirectorActing) const [lists, total] = await AppDataSource.getRepository(viewDirectorActing)
.createQueryBuilder("viewDirectorActing") .createQueryBuilder("viewDirectorActing")
.andWhere(condition) .andWhere(
new Brackets((qb) => {
qb.orWhere(condition).orWhere(conditionOfficer);
}),
)
.andWhere( .andWhere(
new Brackets((qb) => { new Brackets((qb) => {
qb.orWhere( qb.orWhere(
@ -936,7 +949,11 @@ export class WorkflowController extends Controller {
} else { } else {
const [lists, total] = await AppDataSource.getRepository(viewDirector) const [lists, total] = await AppDataSource.getRepository(viewDirector)
.createQueryBuilder("viewDirector") .createQueryBuilder("viewDirector")
.andWhere(condition) .andWhere(
new Brackets((qb) => {
qb.orWhere(condition).orWhere(conditionOfficer);
}),
)
.andWhere( .andWhere(
new Brackets((qb) => { new Brackets((qb) => {
qb.orWhere( qb.orWhere(

View file

@ -21,6 +21,7 @@ import { ViewColumn, ViewEntity } from "typeorm";
\`posType\`.\`posTypeName\` AS \`posType\`, \`posType\`.\`posTypeName\` AS \`posType\`,
\`posExecutive\`.\`posExecutiveName\` AS \`posExecutiveName\`, \`posExecutive\`.\`posExecutiveName\` AS \`posExecutiveName\`,
\`orgRoot\`.\`isDeputy\` AS \`isDeputy\`, \`orgRoot\`.\`isDeputy\` AS \`isDeputy\`,
\`orgChild1\`.\`isOfficer\` AS \`isOfficer\`,
\`posMaster\`.\`orgRootId\` AS \`orgRootId\`, \`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
\`posMaster\`.\`orgChild1Id\` AS \`orgChild1Id\`, \`posMaster\`.\`orgChild1Id\` AS \`orgChild1Id\`,
\`posMaster\`.\`orgChild2Id\` AS \`orgChild2Id\`, \`posMaster\`.\`orgChild2Id\` AS \`orgChild2Id\`,
@ -113,6 +114,8 @@ export class viewDirector {
@ViewColumn() @ViewColumn()
isDeputy: boolean; isDeputy: boolean;
@ViewColumn() @ViewColumn()
isOfficer: boolean;
@ViewColumn()
orgRootId: string; orgRootId: string;
@ViewColumn() @ViewColumn()
orgChild1Id: string; orgChild1Id: string;

View file

@ -22,6 +22,7 @@ import { ViewColumn, ViewEntity } from "typeorm";
\`posType\`.\`posTypeName\` AS \`posType\`, \`posType\`.\`posTypeName\` AS \`posType\`,
\`posExecutive\`.\`posExecutiveName\` AS \`posExecutiveName\`, \`posExecutive\`.\`posExecutiveName\` AS \`posExecutiveName\`,
\`orgRoot\`.\`isDeputy\` AS \`isDeputy\`, \`orgRoot\`.\`isDeputy\` AS \`isDeputy\`,
\`orgChild1\`.\`isOfficer\` AS \`isOfficer\`,
\`posMaster\`.\`orgRootId\` AS \`orgRootId\`, \`posMaster\`.\`orgRootId\` AS \`orgRootId\`,
\`posMaster\`.\`orgChild1Id\` AS \`orgChild1Id\`, \`posMaster\`.\`orgChild1Id\` AS \`orgChild1Id\`,
\`posMaster\`.\`orgChild2Id\` AS \`orgChild2Id\`, \`posMaster\`.\`orgChild2Id\` AS \`orgChild2Id\`,
@ -78,6 +79,8 @@ export class viewDirectorActing {
@ViewColumn() @ViewColumn()
isDeputy: boolean; isDeputy: boolean;
@ViewColumn() @ViewColumn()
isOfficer: boolean;
@ViewColumn()
isDirectorChild: boolean; isDirectorChild: boolean;
@ViewColumn() @ViewColumn()
orgRootId: string; orgRootId: string;