/admin/content/list 페이징 처리와 검색 조건 기능 추가
This commit is contained in:
parent
40a1c2740d
commit
f786df1d9b
|
|
@ -1,12 +1,16 @@
|
||||||
package com.leejk0523.javavue.admin.contents.dao;
|
package com.leejk0523.javavue.admin.contents.dao;
|
||||||
|
|
||||||
|
import ch.qos.logback.core.util.StringUtil;
|
||||||
import com.leejk0523.javavue.admin.contents.vo.ContentsListResult;
|
import com.leejk0523.javavue.admin.contents.vo.ContentsListResult;
|
||||||
import com.leejk0523.javavue.admin.contents.vo.ContentsPagingQuery;
|
import com.leejk0523.javavue.admin.contents.vo.ContentsPagingQuery;
|
||||||
|
import com.leejk0523.javavue.common.QueryDSLUtils;
|
||||||
import com.leejk0523.javavue.model.AsaContent;
|
import com.leejk0523.javavue.model.AsaContent;
|
||||||
import com.leejk0523.javavue.model.QAsaContent;
|
import com.leejk0523.javavue.model.QAsaContent;
|
||||||
import com.querydsl.core.types.Projections;
|
import com.querydsl.core.types.Projections;
|
||||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||||
|
|
||||||
|
import com.querydsl.core.types.dsl.Expressions;
|
||||||
|
import io.micrometer.common.util.StringUtils;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageImpl;
|
import org.springframework.data.domain.PageImpl;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
|
@ -18,6 +22,7 @@ import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class AdminContentsDao extends QuerydslRepositorySupport {
|
public class AdminContentsDao extends QuerydslRepositorySupport {
|
||||||
|
|
||||||
public AdminContentsDao() {
|
public AdminContentsDao() {
|
||||||
super(AsaContent.class);
|
super(AsaContent.class);
|
||||||
}
|
}
|
||||||
|
|
@ -25,12 +30,33 @@ public class AdminContentsDao extends QuerydslRepositorySupport {
|
||||||
public Page<ContentsListResult> findContentsList(ContentsPagingQuery query) {
|
public Page<ContentsListResult> findContentsList(ContentsPagingQuery query) {
|
||||||
QAsaContent asaContent = QAsaContent.asaContent;
|
QAsaContent asaContent = QAsaContent.asaContent;
|
||||||
|
|
||||||
final var offset = getOffset(query);
|
final var offset = QueryDSLUtils.getOffset(query);
|
||||||
final var limit = getLimit(query);
|
final var limit = QueryDSLUtils.getLimit(query);
|
||||||
final var pageable = getPageable(query);
|
final var pageable = QueryDSLUtils.getPageable(query);
|
||||||
|
|
||||||
BooleanExpression expression = asaContent.delYn.eq("N");
|
BooleanExpression expression = asaContent.delYn.eq("N");
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(query.getKeyword())) {
|
||||||
|
switch (query.getType()) {
|
||||||
|
case CONTENT: {
|
||||||
|
expression = expression.and(asaContent.contents.contains(query.getKeyword()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TITLE : {
|
||||||
|
expression = expression.and(asaContent.contentTitle.contains(query.getKeyword()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TOTAL: {
|
||||||
|
expression = expression.and(asaContent.contents.contains(query.getKeyword())
|
||||||
|
.or(asaContent.contentTitle.contains(query.getKeyword())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(query.getOrgId())) {
|
||||||
|
expression = expression.and(asaContent.orgId.eq(query.getOrgId()));
|
||||||
|
}
|
||||||
|
|
||||||
final var list = from(asaContent)
|
final var list = from(asaContent)
|
||||||
.select(
|
.select(
|
||||||
Projections.bean(
|
Projections.bean(
|
||||||
|
|
@ -55,17 +81,4 @@ public class AdminContentsDao extends QuerydslRepositorySupport {
|
||||||
|
|
||||||
return new PageImpl<>(list, pageable, total);
|
return new PageImpl<>(list, pageable, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Pageable getPageable(ContentsPagingQuery query) {
|
|
||||||
return PageRequest.of(query.getPage() - 1, query.getSize());
|
|
||||||
}
|
|
||||||
|
|
||||||
private long getOffset(ContentsPagingQuery query) {
|
|
||||||
return (long) (query.getPage() - 1) * query.getSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
private long getLimit(ContentsPagingQuery query) {
|
|
||||||
return query.getSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
package com.leejk0523.javavue.admin.contents.vo;
|
package com.leejk0523.javavue.admin.contents.vo;
|
||||||
|
|
||||||
|
import com.leejk0523.javavue.common.PagingQuery;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ContentsPagingQuery {
|
public class ContentsPagingQuery implements PagingQuery {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private int page;
|
private int page;
|
||||||
|
|
@ -19,6 +20,7 @@ public class ContentsPagingQuery {
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
TITLE,
|
TITLE,
|
||||||
CONTENT
|
CONTENT,
|
||||||
|
TOTAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.leejk0523.javavue.code.dao;
|
||||||
|
|
||||||
|
import com.leejk0523.javavue.common.GridCode;
|
||||||
|
import com.leejk0523.javavue.model.ComCd;
|
||||||
|
import com.leejk0523.javavue.model.QAsaSite;
|
||||||
|
import com.leejk0523.javavue.model.QIstInst;
|
||||||
|
import com.querydsl.core.types.Projections;
|
||||||
|
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class CodeDAO extends QuerydslRepositorySupport {
|
||||||
|
public CodeDAO() {
|
||||||
|
super(ComCd.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GridCode> findSiteCodeList() {
|
||||||
|
final var site = QAsaSite.asaSite;
|
||||||
|
|
||||||
|
return from(site)
|
||||||
|
.select(
|
||||||
|
Projections.bean(
|
||||||
|
GridCode.class,
|
||||||
|
site.siteId.as("value"),
|
||||||
|
site.siteName.as("text"),
|
||||||
|
site.siteName.as("label")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GridCode> findInstCodeList() {
|
||||||
|
final var inst = QIstInst.istInst;
|
||||||
|
|
||||||
|
return from(inst)
|
||||||
|
.select(
|
||||||
|
Projections.bean(
|
||||||
|
GridCode.class,
|
||||||
|
inst.instNo.as("value"),
|
||||||
|
inst.instNm.as("label"),
|
||||||
|
inst.instNm.as("text")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.leejk0523.javavue.code.service;
|
||||||
|
|
||||||
|
import com.leejk0523.javavue.common.GridCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface CodeService {
|
||||||
|
List<GridCode> findSiteCodeList();
|
||||||
|
List<GridCode> findInstCodeList();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.leejk0523.javavue.code.service.impl;
|
||||||
|
|
||||||
|
import com.leejk0523.javavue.code.dao.CodeDAO;
|
||||||
|
import com.leejk0523.javavue.code.service.CodeService;
|
||||||
|
import com.leejk0523.javavue.common.GridCode;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service("lasp.codeServiceImpl")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CodeServiceImpl implements CodeService {
|
||||||
|
private final CodeDAO codeDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GridCode> findSiteCodeList() {
|
||||||
|
return codeDAO.findSiteCodeList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GridCode> findInstCodeList() {
|
||||||
|
return codeDAO.findInstCodeList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.leejk0523.javavue.code.web;
|
||||||
|
|
||||||
|
import com.leejk0523.javavue.code.service.CodeService;
|
||||||
|
import com.leejk0523.javavue.common.GridCode;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CodeController {
|
||||||
|
|
||||||
|
private final CodeService codeService;
|
||||||
|
|
||||||
|
@GetMapping("/api/admin/code/siteList")
|
||||||
|
public ResponseEntity<List<GridCode>> siteCodeList() {
|
||||||
|
final var results = codeService.findSiteCodeList();
|
||||||
|
return ResponseEntity.ok(results);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/api/admin/code/instList")
|
||||||
|
public ResponseEntity<List<GridCode>> instCodeList() {
|
||||||
|
final var results = codeService.findInstCodeList();
|
||||||
|
return ResponseEntity.ok(results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.leejk0523.javavue.common;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GridCode {
|
||||||
|
private String label;
|
||||||
|
private String text;
|
||||||
|
private String value;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
package com.leejk0523.javavue.common;
|
||||||
|
|
||||||
|
public interface PagingQuery {
|
||||||
|
int getPage();
|
||||||
|
int getSize();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.leejk0523.javavue.common;
|
||||||
|
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
public class QueryDSLUtils {
|
||||||
|
public static Pageable getPageable(PagingQuery query) {
|
||||||
|
return PageRequest.of(query.getPage() - 1, query.getSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getOffset(PagingQuery query) {
|
||||||
|
return (long) (query.getPage() - 1) * query.getSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getLimit(PagingQuery query) {
|
||||||
|
return query.getSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
package com.leejk0523.javavue.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Entity
|
||||||
|
@Table(name = "com_cd")
|
||||||
|
@IdClass(ComCd.Key.class)
|
||||||
|
public class ComCd {
|
||||||
|
@Id
|
||||||
|
@NotNull
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "CD_GROUP_ID", nullable = false, length = 20)
|
||||||
|
private String cdGroupId;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Size(max = 6)
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "COM_CD", nullable = false, length = 6)
|
||||||
|
private String comCd;
|
||||||
|
|
||||||
|
@Size(max = 100)
|
||||||
|
@Column(name = "COM_CD_NM", length = 100)
|
||||||
|
private String comCdNm;
|
||||||
|
|
||||||
|
@Size(max = 2000)
|
||||||
|
@Column(name = "COM_CD_EXPLN", length = 2000)
|
||||||
|
private String comCdExpln;
|
||||||
|
|
||||||
|
@Column(name = "SORT_SEQ", nullable = false)
|
||||||
|
private Integer sortSeq;
|
||||||
|
|
||||||
|
@Column(name = "USE_YN", length = 1, nullable = false)
|
||||||
|
private Boolean useYn;
|
||||||
|
|
||||||
|
@Column(name = "DEL_YN", length = 1, nullable = false)
|
||||||
|
private Boolean delYn;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "ARTCL_NM1", length = 20)
|
||||||
|
private String artclNm1;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "ARTCL_NM2", length = 20)
|
||||||
|
private String artclNm2;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "ARTCL_NM3", length = 20)
|
||||||
|
private String artclNm3;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "ARTCL_NM4", length = 20)
|
||||||
|
private String artclNm4;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "ARTCL_NM5", length = 20)
|
||||||
|
private String artclNm5;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "ARTCL_NM6", length = 20)
|
||||||
|
private String artclNm6;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "ARTCL_NM7", length = 20)
|
||||||
|
private String artclNm7;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "ARTCL_NM8", length = 20)
|
||||||
|
private String artclNm8;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "ARTCL_NM9", length = 20)
|
||||||
|
private String artclNm9;
|
||||||
|
|
||||||
|
@Size(max = 20)
|
||||||
|
@Column(name = "ARTCL_NM10", length = 20)
|
||||||
|
private String artclNm10;
|
||||||
|
|
||||||
|
@Column(name = "FRST_RGTR_ID", length = 50, nullable = false)
|
||||||
|
private String frstRgtrId;
|
||||||
|
|
||||||
|
@Column(name = "FRST_REG_DT", nullable = false)
|
||||||
|
private LocalDateTime frstRegDt;
|
||||||
|
|
||||||
|
@Column(name = "LAST_MDFR_ID", length = 50)
|
||||||
|
private String lastMdfrId;
|
||||||
|
|
||||||
|
@Column(name = "LAST_MDFCN_DT")
|
||||||
|
private LocalDateTime lastMdfcnDt;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Key implements Serializable {
|
||||||
|
private static final long serialVersionUID = -3281903370957728656L;
|
||||||
|
private String cdGroupId;
|
||||||
|
private String comCd;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.leejk0523.javavue.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Entity
|
||||||
|
@Table(name = "IST_INST")
|
||||||
|
public class IstInst {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "INST_NO", length = 10, nullable = false)
|
||||||
|
private String instNo;
|
||||||
|
|
||||||
|
@Column(name = "INST_CLSF_CD", length = 6, nullable = false)
|
||||||
|
private String instClsfCd;
|
||||||
|
|
||||||
|
@Column(name = "INST_NM", length = 200, nullable = false)
|
||||||
|
private String instNm;
|
||||||
|
|
||||||
|
@Column(name = "INST_SRVC_EXPLN", length = 50)
|
||||||
|
private String instSrvcExpln;
|
||||||
|
|
||||||
|
@Column(name = "INST_CN")
|
||||||
|
private String instCn;
|
||||||
|
|
||||||
|
@Column(name = "ATCH_FILE_ID", length = 20)
|
||||||
|
private String atchFileId;
|
||||||
|
|
||||||
|
@Column(name = "USE_YN", length = 1, nullable = false)
|
||||||
|
private String useYn;
|
||||||
|
|
||||||
|
@Column(name = "FRST_RGTR_ID", length = 50, nullable = false)
|
||||||
|
private String frstRgtrId;
|
||||||
|
|
||||||
|
@Column(name = "FRST_REG_DT", nullable = false)
|
||||||
|
private LocalDateTime frstRegDt;
|
||||||
|
|
||||||
|
@Column(name = "LAST_MDFR_ID", length = 50)
|
||||||
|
private String lastMdfrId;
|
||||||
|
|
||||||
|
@Column(name = "LAST_MDFCN_DT")
|
||||||
|
private LocalDateTime lastMdfcnDt;
|
||||||
|
}
|
||||||
|
|
@ -7,4 +7,16 @@ spring.datasource.password=Ghtkssk0325
|
||||||
|
|
||||||
spring.jpa.hibernate.ddl-auto=update
|
spring.jpa.hibernate.ddl-auto=update
|
||||||
spring.jpa.properties.hibernate.show-sql=true
|
spring.jpa.properties.hibernate.show-sql=true
|
||||||
|
# SQL 출력
|
||||||
|
#spring.jpa.show-sql=true
|
||||||
|
|
||||||
|
# SQL 포맷팅
|
||||||
spring.jpa.properties.hibernate.format_sql=true
|
spring.jpa.properties.hibernate.format_sql=true
|
||||||
|
spring.jpa.properties.hibernate.type=trace
|
||||||
|
|
||||||
|
# 바인딩 파라미터 값 로깅
|
||||||
|
logging.level.org.hibernate.type.descriptor.sql=TRACE
|
||||||
|
|
||||||
|
# SQL에 바인딩된 파라미터 값도 출력
|
||||||
|
logging.level.org.hibernate.SQL=DEBUG
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { GridCodeType } from '~/types';
|
||||||
|
|
||||||
|
const value = defineModel<string>({ default: '' });
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
options: GridCodeType[];
|
||||||
|
className?: string;
|
||||||
|
selectType?: 'SELECT' | 'ALL';
|
||||||
|
isLoading?: boolean;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const selectOptions = computed(() => {
|
||||||
|
if (props.selectType === 'REQUIRED') {
|
||||||
|
return [{ label: '선택', value: '' }, ...props.options];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.selectType === 'ALL') {
|
||||||
|
return [{ label: '전체', value: '' }, ...props.options];
|
||||||
|
}
|
||||||
|
|
||||||
|
return props.options;
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['change']);
|
||||||
|
|
||||||
|
const change = () => {
|
||||||
|
emit('change');
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<a-select
|
||||||
|
:class="className"
|
||||||
|
:options="selectOptions"
|
||||||
|
:loading="isLoading"
|
||||||
|
v-model:value="value"
|
||||||
|
@change="change"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const props = defineProps<{
|
||||||
|
className?: string;
|
||||||
|
selectType?: 'SELECT' | 'ALL';
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const commonCodeStore = useCommonCodeStore();
|
||||||
|
const value = defineModel<string>('');
|
||||||
|
|
||||||
|
const { data, isLoading } = useQuery({
|
||||||
|
queryKey: ['INST_CODE_LIST'],
|
||||||
|
queryFn: async () => {
|
||||||
|
return await commonCodeStore.searchInstCodeList();
|
||||||
|
},
|
||||||
|
staleTime: 60 * 1000,
|
||||||
|
refetchOnWindowFocus: false,
|
||||||
|
refetchOnMount: false
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<common-default-select-code
|
||||||
|
v-if="!isLoading"
|
||||||
|
:class-name="className"
|
||||||
|
:select-type="selectType"
|
||||||
|
:options="data"
|
||||||
|
v-model="value"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
@ -69,7 +69,7 @@ const nonValid = computed(() => {
|
||||||
:colon="false"
|
:colon="false"
|
||||||
:label-col="{ span: 2 }"
|
:label-col="{ span: 2 }"
|
||||||
>
|
>
|
||||||
<!-- <common-inst-code-select v-model:value="contents.orgId" />-->
|
<common-inst-code-select v-model:value="contents.orgId" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,11 @@
|
||||||
import type { OptColumn, OptRowHeader } from 'tui-grid/types/options';
|
import type { OptColumn, OptRowHeader } from 'tui-grid/types/options';
|
||||||
import { useContentStore } from '~/stores/contents';
|
import { useContentStore } from '~/stores/contents';
|
||||||
import type { ContentType } from '~/types/contents';
|
import type { ContentType } from '~/types/contents';
|
||||||
import { BOOLEANS } from '~/constants/grid';
|
import { useCommonCodeStore } from '~/stores';
|
||||||
// import { useCommonCodeStore } from '~/stores';
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
// const siteCodeList = await useCommonCodeStore().searchSiteCodeList();
|
const instCodeList = await useCommonCodeStore().searchInstCodeList();
|
||||||
// const instCodeList = await useCommonCodeStore().searchInstCodeList();
|
|
||||||
const contentStore = useContentStore();
|
const contentStore = useContentStore();
|
||||||
const { contentsList, contentsQuery } = storeToRefs(contentStore);
|
const { contentsList, contentsQuery } = storeToRefs(contentStore);
|
||||||
const gridRef = ref();
|
const gridRef = ref();
|
||||||
|
|
@ -28,6 +26,15 @@ const columns: OptColumn[] = [
|
||||||
name: 'orgId',
|
name: 'orgId',
|
||||||
header: '관리기관',
|
header: '관리기관',
|
||||||
width: 100,
|
width: 100,
|
||||||
|
disabled: true,
|
||||||
|
formatter: 'listItemText',
|
||||||
|
resizable: true,
|
||||||
|
editor: {
|
||||||
|
type: 'select',
|
||||||
|
options: {
|
||||||
|
listItems: instCodeList
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'useYn',
|
name: 'useYn',
|
||||||
|
|
@ -58,7 +65,7 @@ const columns: OptColumn[] = [
|
||||||
];
|
];
|
||||||
|
|
||||||
const contentType = [
|
const contentType = [
|
||||||
{ label: '전체', value: '' },
|
{ label: '전체', value: 'TOTAL' },
|
||||||
{ label: '제목', value: 'TITLE' },
|
{ label: '제목', value: 'TITLE' },
|
||||||
{ label: '내용', value: 'CONTENT' }
|
{ label: '내용', value: 'CONTENT' }
|
||||||
];
|
];
|
||||||
|
|
@ -72,7 +79,7 @@ onBeforeUnmount(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const search = () => {
|
const search = () => {
|
||||||
// contentStore.searchContentList();
|
contentStore.searchContentList();
|
||||||
};
|
};
|
||||||
|
|
||||||
const list = computed(() => {
|
const list = computed(() => {
|
||||||
|
|
@ -133,12 +140,12 @@ const editPage = (contentId: any) => {
|
||||||
<a-col>
|
<a-col>
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-typography-text>관리기관</a-typography-text>
|
<a-typography-text>관리기관</a-typography-text>
|
||||||
<!-- <lazy-common-inst-code-select-->
|
<lazy-common-inst-code-select
|
||||||
<!-- key="inst-code-select"-->
|
key="inst-code-select"
|
||||||
<!-- v-model="contentsQuery.orgId"-->
|
v-model="contentsQuery.orgId"
|
||||||
<!-- class-name="w-40"-->
|
class-name="w-40"
|
||||||
<!-- select-type="ALL"-->
|
select-type="ALL"
|
||||||
<!-- />-->
|
/>
|
||||||
</a-space>
|
</a-space>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
||||||
|
|
@ -151,7 +158,8 @@ const editPage = (contentId: any) => {
|
||||||
v-model:value="contentsQuery.type"
|
v-model:value="contentsQuery.type"
|
||||||
:options="contentType"
|
:options="contentType"
|
||||||
/>
|
/>
|
||||||
<a-input title="검색어" placeholder="Search" class="w-60" />
|
<a-input title="검색어" placeholder="Search" class="w-60"
|
||||||
|
v-model:value="contentsQuery.keyword" allow-clear/>
|
||||||
</a-space>
|
</a-space>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col>
|
<a-col>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ const DEFAULT_CONTENT_QUERY: ContentListQueryType = {
|
||||||
page: 1,
|
page: 1,
|
||||||
siteId: '',
|
siteId: '',
|
||||||
size: 10,
|
size: 10,
|
||||||
type: ''
|
type: 'TOTAL'
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_CONTENTS_LIST: Page<ContentListType> = {
|
const DEFAULT_CONTENTS_LIST: Page<ContentListType> = {
|
||||||
|
|
|
||||||
|
|
@ -60,16 +60,6 @@ export const useDefaultStore = defineStore('useDefaultStore', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
export const useCommonCodeStore = defineStore('useCommonCodeStore', () => {
|
export const useCommonCodeStore = defineStore('useCommonCodeStore', () => {
|
||||||
const searchCommonCodeList = async (
|
|
||||||
codeGroupId: string
|
|
||||||
): Promise<GridCodeType[]> => {
|
|
||||||
const { data } = await useAxios().get('/api/admin/code/codeList', {
|
|
||||||
params: {
|
|
||||||
codeGroupId
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
const searchSiteCodeList = async (): Promise<GridCodeType[]> => {
|
const searchSiteCodeList = async (): Promise<GridCodeType[]> => {
|
||||||
const { data } = await useAxios().get('/api/admin/code/siteList');
|
const { data } = await useAxios().get('/api/admin/code/siteList');
|
||||||
|
|
@ -83,17 +73,8 @@ export const useCommonCodeStore = defineStore('useCommonCodeStore', () => {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchRoleCodeList = async (): Promise<GridCodeType[]> => {
|
|
||||||
const { data } = await useAxios().get<GridCodeType[]>(
|
|
||||||
'/api/admin/code/roleList'
|
|
||||||
);
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
searchInstCodeList,
|
searchInstCodeList,
|
||||||
searchSiteCodeList,
|
searchSiteCodeList
|
||||||
searchCommonCodeList,
|
|
||||||
searchRoleCodeList
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ export type ContentListQueryType = {
|
||||||
siteId: string;
|
siteId: string;
|
||||||
orgId: string;
|
orgId: string;
|
||||||
keyword: string;
|
keyword: string;
|
||||||
type: '' | 'TITLE' | 'CONTENT';
|
type: 'TOTAL' | 'TITLE' | 'CONTENT';
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ContentListType = {
|
export type ContentListType = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue