Commit 32749220 authored by Tình Trương's avatar Tình Trương

update

parent 37e665d2
......@@ -50,7 +50,7 @@ export enum ContactStatus {
inactive = 0,
}
export enum PolicyStatus {
export enum ConfigSystemStatus {
active = 1,
inactive = 0,
}
......
......@@ -474,6 +474,7 @@ export type ListConfigSystem = {
namePage: string;
title: string;
content: string;
url: string;
numIndex: number;
status: number;
createTime?: string;
......@@ -488,6 +489,7 @@ export type DetailConfigSystem = {
title: string;
content: string;
numIndex: number;
url: string;
status: number;
createTime?: string;
createBy?: string;
......@@ -501,6 +503,7 @@ export type UpdateConfigSystem = {
title: string;
content: string;
status: number;
url: string;
numIndex: number;
createTime?: string;
createBy?: string;
......@@ -512,6 +515,7 @@ export type AddConfigSystem = {
namePage: string;
title: string;
content: string;
url: string;
numIndex: number;
status: number;
};
......@@ -8,7 +8,7 @@
<q-form
greedy
@submit.prevent="
$emit('addUpdatePolicy', {});
$emit('addUpdateConfigSystem', {});
$emit('update:isOpened', false);
"
>
......@@ -17,8 +17,8 @@
<q-item-section>
<q-item-label class="text-h6 text-weight-regular">{{
isUpdate
? $t('listPolicy.dialogLabel.titleAdd')
: $t('listPolicy.dialogLabel.titleUpdate')
? $t('listConfigSystem.dialogLabel.titleAdd')
: $t('listConfigSystem.dialogLabel.titleUpdate')
}}</q-item-label>
</q-item-section>
</q-item>
......@@ -31,7 +31,7 @@
<q-input
:model-value="namePage"
@update:model-value="$emit('update:namePage', $event)"
:label="$t('listPolicy.dialogLabel.fieldLabels.namePage')"
:label="$t('listConfigSystem.dialogLabel.fieldLabels.namePage')"
class="q-my-sm"
type="text"
outlined
......@@ -47,29 +47,39 @@
outlined
clearable
></q-input>
<div class="q-pt-sm q-pl-sm">
<span class="text-body1">{{
$t('listConfigSystem.dialogLabel.fieldLabels.status')
}}</span
><q-toggle
:model-value="status"
:true-value="ConfigSystemStatus.active"
:false-value="ConfigSystemStatus.inactive"
@update:model-value="$emit('update:status', $event)"
/>
</div>
</div>
<div class="col-6">
<q-input
:model-value="title"
@update:model-value="$emit('update:title', $event)"
:label="$t('listPolicy.dialogLabel.fieldLabels.title')"
:label="$t('listConfigSystem.dialogLabel.fieldLabels.title')"
class="q-my-sm"
type="text"
outlined
:rules="titleRules"
clearable
></q-input>
<div class="q-pt-sm q-pl-sm">
<span class="text-body1">{{
$t('listPolicy.dialogLabel.fieldLabels.status')
}}</span
><q-toggle
:model-value="status"
:true-value="PolicyStatus.active"
:false-value="PolicyStatus.inactive"
@update:model-value="$emit('update:status', $event)"
/>
</div>
<q-input
:model-value="url"
@update:model-value="$emit('update:url', $event)"
:label="$t('listConfigSystem.dialogLabel.fieldLabels.url')"
class="q-my-sm"
type="text"
outlined
:rules="urlRules"
clearable
></q-input>
</div>
<div class="col-12">
<div>
......@@ -178,7 +188,7 @@
color="grey"
no-caps
style="width: 90px"
:label="$t('listPolicy.crudActions.cancel')"
:label="$t('listConfigSystem.crudActions.cancel')"
@click="$emit('update:isOpened', false)"
/>
<q-btn
......@@ -186,7 +196,7 @@
color="primary"
no-caps
style="width: 90px"
:label="$t('listPolicy.crudActions.save')"
:label="$t('listConfigSystem.crudActions.save')"
/>
</q-card-actions>
</q-form>
......@@ -195,7 +205,7 @@
</template>
<script lang="ts">
import { PolicyStatus } from 'src/assets/enums';
import { ConfigSystemStatus } from 'src/assets/enums';
import { defineComponent } from 'vue';
import { i18n } from 'src/boot/i18n';
......@@ -208,6 +218,7 @@ export default defineComponent({
isUpdate: { type: Boolean, default: false },
namePage: { type: String, required: true },
title: { type: String, required: true },
url: { type: String, required: true },
numIndex: { type: Number, required: true },
content: { type: String, required: true },
status: { type: Number, required: true },
......@@ -216,17 +227,23 @@ export default defineComponent({
const namePageRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('listPolicy.validateMessages.requireNamePage'),
i18n.global.t('listConfigSystem.validateMessages.requireNamePage'),
];
const titleRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('listPolicy.validateMessages.requireTitle'),
i18n.global.t('listConfigSystem.validateMessages.requireTitle'),
];
const urlRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('listConfigSystem.validateMessages.requireUrl'),
];
return {
namePageRules,
titleRules,
PolicyStatus,
urlRules,
ConfigSystemStatus,
};
},
emits: [
......@@ -234,10 +251,11 @@ export default defineComponent({
'update:namePage',
'update:title',
'update:content',
'update:url',
'update:numIndex',
'update:status',
'click:CloseBtn',
'addUpdatePolicy',
'addUpdateConfigSystem',
],
});
</script>
......@@ -959,33 +959,36 @@ export default {
},
//Cấu hình chính sách
listPolicy: {
listConfigSystem: {
add: 'Thêm',
toolTipMessageUpdate: 'Cập nhập',
toolTipMessageDelete: 'Xóa',
title: 'Cấu hình Chính sách',
title: 'Cấu hình hệ thống',
titleColumnsTable: {
stt: 'STT',
namePage: 'Tên chính sách',
namePage: 'Tên cấu hình',
title: 'Tiêu đề',
url: 'Url target',
content: 'Nội dung',
numIndex: 'Vị trí',
status: 'Trạng thái',
action: 'Chức năng',
},
dialogLabel: {
titleAdd: 'Thêm Chính sách',
titleUpdate: 'Cập nhập Chính sách',
titleAdd: 'Thêm Cấu hình',
titleUpdate: 'Cập nhập Cấu hình',
fieldLabels: {
namePage: 'Tên chính sách *',
namePage: 'Tên cấu hình *',
title: 'Tiêu đề *',
url: 'Url target *',
numIndex: 'Vị trí',
status: 'Trạng thái',
},
},
validateMessages: {
requireNamePage: 'Vui lòng nhập Tên chính sách',
requireNamePage: 'Vui lòng nhập Tên Cấu hình',
requireTitle: 'Vui lòng nhập Tiêu đề',
requireUrl: 'Vui lòng nhập Url target',
},
crudActions: {
save: 'Lưu',
......@@ -997,13 +1000,13 @@ export default {
},
confirmActionsTitle: {
confirmDelete: 'Xác nhận',
confirmDeleteContent: 'Bạn có chắc muốn xoá Menu này không?',
confirmDeleteContent: 'Bạn có chắc muốn xoá Cấu hình này không?',
confirmDeleteCancelBtnLabel: 'Huỷ',
},
actionMessages: {
addSuccess: 'Thêm Menu thành công',
updateSuccess: 'Cập nhập Menu thành công',
deleteSuccess: 'Xóa Menu thành công',
addSuccess: 'Thêm Cấu hình thành công',
updateSuccess: 'Cập nhập Cấu hình thành công',
deleteSuccess: 'Xóa Cấu hình thành công',
},
},
......
<template>
<div class="row q-col-gutter-sm flex-center q-mt-sm">
<div class="col-auto text-h6 text-weight-regular flex flex-center q-mr-md">
{{ $t('listPolicy.title') }}
{{ $t('listConfigSystem.title') }}
<q-separator vertical spaced />
</div>
<q-space></q-space>
......@@ -10,7 +10,7 @@
v-model="sreachNamePage"
dense
outlined
:label="$t('listPolicy.titleColumnsTable.namePage')"
:label="$t('listConfigSystem.titleColumnsTable.namePage')"
clearable
></q-input>
</div>
......@@ -38,8 +38,8 @@
<div class="col-12 q-mt-sm">
<q-table
:rows="listPolicy"
:columns="tableColumnsPolicy"
:rows="listConfigSystem"
:columns="tableColumnsConfigSystem"
:no-data-label="$t('emptyData')"
row-key="name"
separator="cell"
......@@ -61,7 +61,7 @@
@click="openUpdateDialog(rowData.row.id)"
>
<q-tooltip :offset="[10, 10]">{{
$t('listPolicy.toolTipMessageUpdate')
$t('listConfigSystem.toolTipMessageUpdate')
}}</q-tooltip>
</q-btn>
<q-btn
......@@ -72,7 +72,7 @@
@click="confirmDelete(rowData.row.id)"
>
<q-tooltip :offset="[10, 10]">{{
$t('listPolicy.toolTipMessageDelete')
$t('listConfigSystem.toolTipMessageDelete')
}}</q-tooltip>
</q-btn>
</q-td>
......@@ -94,20 +94,35 @@
</td>
</template>
<template v-slot:body-cell-url="rowData">
<q-td>
<div align="center">
<a
:href="rowData.row.url"
target="_blank"
style="max-width: 10rem"
>{{ rowData.row.url }}</a
>
</div>
</q-td>
</template>
<template v-slot:body-cell-status="rowData">
<q-td>
<div align="center">
<q-chip
:color="
rowData.value === PolicyStatus.active ? 'positive' : 'orange'
rowData.value === ConfigSystemStatus.active
? 'positive'
: 'orange'
"
text-color="white"
size="sm"
>
{{
rowData.value === PolicyStatus.active
? $t('listPolicy.statusLabel.active')
: $t('listPolicy.statusLabel.inactive')
rowData.value === ConfigSystemStatus.active
? $t('listConfigSystem.statusLabel.active')
: $t('listConfigSystem.statusLabel.inactive')
}}
</q-chip>
</div>
......@@ -131,6 +146,7 @@
v-model:namePage="namePage"
v-model:title="title"
v-model:content="content"
v-model:url="url"
v-model:num-index="numIndex"
v-model:status="status"
@addUpdateConfigSystem="addConfigSystem"
......@@ -142,6 +158,7 @@
v-model:namePage="namePage"
v-model:title="title"
v-model:content="content"
v-model:url="url"
v-model:num-index="numIndex"
v-model:status="status"
@addUpdateConfigSystem="updateConfigSystem"
......@@ -150,8 +167,8 @@
</template>
<script lang="ts">
import AddUpdatePolicyDialog from 'components/policy/index.vue';
import { PolicyStatus } from 'src/assets/enums';
import AddUpdatePolicyDialog from 'components/configSystem/index.vue';
import { ConfigSystemStatus } from 'src/assets/enums';
import { i18n } from 'src/boot/i18n';
import { defineComponent, onMounted, Ref, ref } from 'vue';
import Pagination from 'components/pagination/index.vue';
......@@ -173,12 +190,12 @@ export default defineComponent({
AddUpdatePolicyDialog,
},
setup() {
const tableColumnsPolicy = [
const tableColumnsConfigSystem = [
{
name: 'stt',
field: 'stt',
required: true,
label: i18n.global.t('listPolicy.titleColumnsTable.stt'),
label: i18n.global.t('listConfigSystem.titleColumnsTable.stt'),
headerStyle: 'text-align: center !important; width: 7%',
align: 'center',
sortable: false,
......@@ -187,26 +204,35 @@ export default defineComponent({
name: 'namePage',
field: 'namePage',
required: true,
label: i18n.global.t('listPolicy.titleColumnsTable.namePage'),
label: i18n.global.t('listConfigSystem.titleColumnsTable.namePage'),
align: 'left',
headerStyle: 'text-align: center !important; width: 17%',
headerStyle: 'text-align: center !important; width: 11%',
sortable: false,
},
{
name: 'title',
field: 'title',
required: true,
label: i18n.global.t('listPolicy.titleColumnsTable.title'),
label: i18n.global.t('listConfigSystem.titleColumnsTable.title'),
align: 'left',
headerStyle: 'text-align: center !important; width: 15%',
headerStyle: 'text-align: center !important; width: 11%',
sortable: false,
},
{
name: 'url',
field: 'url',
required: true,
label: i18n.global.t('listConfigSystem.titleColumnsTable.url'),
align: 'left',
headerStyle: 'text-align: center !important; width: 14%',
sortable: false,
},
{
name: 'content',
field: 'content',
required: true,
label: i18n.global.t('listPolicy.titleColumnsTable.content'),
headerStyle: 'text-align: center !important; width: 30%',
label: i18n.global.t('listConfigSystem.titleColumnsTable.content'),
headerStyle: 'text-align: center !important; width: 25%',
align: 'left',
sortable: false,
},
......@@ -214,7 +240,7 @@ export default defineComponent({
name: 'numIndex',
field: 'numIndex',
required: true,
label: i18n.global.t('listPolicy.titleColumnsTable.numIndex'),
label: i18n.global.t('listConfigSystem.titleColumnsTable.numIndex'),
headerStyle: 'text-align: center !important; width: 7%',
align: 'center',
sortable: false,
......@@ -223,7 +249,7 @@ export default defineComponent({
name: 'status',
field: 'status',
required: true,
label: i18n.global.t('listPolicy.titleColumnsTable.status'),
label: i18n.global.t('listConfigSystem.titleColumnsTable.status'),
headerStyle: 'text-align: center !important; width: 12%',
align: 'center',
sortable: false,
......@@ -232,14 +258,14 @@ export default defineComponent({
name: 'action',
field: 'action',
required: true,
label: i18n.global.t('listPolicy.titleColumnsTable.action'),
label: i18n.global.t('listConfigSystem.titleColumnsTable.action'),
headerStyle: 'text-align: center !important; width: 12%',
align: 'center',
sortable: false,
},
];
const listPolicy: Ref<unknown[]> = ref([]);
const listConfigSystem: Ref<unknown[]> = ref([]);
const sreachNamePage: Ref<string> = ref('');
const pageIndex = ref(1);
const pageSize = ref(20);
......@@ -252,9 +278,10 @@ export default defineComponent({
const showDialogUpdate = ref(false);
const namePage: Ref<string> = ref('');
const title: Ref<string> = ref('');
const url: Ref<string> = ref('');
const numIndex: Ref<number | undefined> = ref(undefined);
const content: Ref<string> = ref('');
const status: Ref<number> = ref(PolicyStatus.active);
const status: Ref<number> = ref(ConfigSystemStatus.active);
const ConfigSystemId: Ref<number | undefined> = ref(undefined);
const getConfigSystem = async () => {
......@@ -271,7 +298,7 @@ export default defineComponent({
BaseResponseBody<PaginationResponse<ListConfigSystem>>
>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
listPolicy.value = response.data.data.data;
listConfigSystem.value = response.data.data.data;
totalPage.value = response.data.data.totalPages;
}
} catch (error) {}
......@@ -281,8 +308,9 @@ export default defineComponent({
namePage.value = '';
title.value = '';
content.value = '';
url.value = '';
numIndex.value = undefined;
status.value = PolicyStatus.active;
status.value = ConfigSystemStatus.active;
showDialogAdd.value = true;
};
......@@ -290,6 +318,7 @@ export default defineComponent({
const data = {
namePage: namePage.value,
title: title.value,
url: url.value,
content: content.value,
numIndex: numIndex.value,
status: status.value,
......@@ -303,7 +332,7 @@ export default defineComponent({
showDialogAdd.value = false;
Notify.create({
type: 'positive',
message: i18n.global.t('listPolicy.actionMessages.addSuccess'),
message: i18n.global.t('listConfigSystem.actionMessages.addSuccess'),
actions: [{ icon: 'close', color: 'white' }],
});
void getConfigSystem();
......@@ -328,6 +357,7 @@ export default defineComponent({
ConfigSystemId.value = response.data.data.id;
namePage.value = response.data.data.namePage;
title.value = response.data.data.title;
url.value = response.data.data.url;
content.value = response.data.data.content;
numIndex.value = response.data.data.numIndex;
status.value = response.data.data.status;
......@@ -344,6 +374,7 @@ export default defineComponent({
id: ConfigSystemId.value,
name: namePage.value,
title: title.value,
url: url.value,
content: content.value,
numIndex: numIndex.value,
status: status.value,
......@@ -352,7 +383,9 @@ export default defineComponent({
if (response.data.error.code === config.API_RES_CODE.OK.code) {
Notify.create({
type: 'positive',
message: i18n.global.t('listPolicy.actionMessages.updateSuccess'),
message: i18n.global.t(
'listConfigSystem.actionMessages.updateSuccess'
),
});
void getConfigSystem();
showDialogUpdate.value = false;
......@@ -362,12 +395,14 @@ export default defineComponent({
const confirmDelete = (id: number) => {
Dialog.create({
title: i18n.global.t('listPolicy.confirmActionsTitle.confirmDelete'),
title: i18n.global.t(
'listConfigSystem.confirmActionsTitle.confirmDelete'
),
message: i18n.global.t(
'listPolicy.confirmActionsTitle.confirmDeleteContent'
'listConfigSystem.confirmActionsTitle.confirmDeleteContent'
),
cancel: i18n.global.t(
'listPolicy.confirmActionsTitle.confirmDeleteCancelBtnLabel'
'listConfigSystem.confirmActionsTitle.confirmDeleteCancelBtnLabel'
),
color: 'negative',
}).onOk(() => {
......@@ -388,7 +423,9 @@ export default defineComponent({
if (deleteResult.data.error.code === config.API_RES_CODE.OK.code) {
Notify.create({
type: 'positive',
message: i18n.global.t('listPolicy.actionMessages.deleteSuccess'),
message: i18n.global.t(
'listConfigSystem.actionMessages.deleteSuccess'
),
});
void getConfigSystem();
}
......@@ -401,17 +438,18 @@ export default defineComponent({
return {
getConfigSystem,
sreachNamePage,
listPolicy,
tableColumnsPolicy,
listConfigSystem,
tableColumnsConfigSystem,
pageIndex,
pageSize,
totalPage,
changePageSize,
PolicyStatus,
ConfigSystemStatus,
showDialogUpdate,
namePage,
content,
status,
url,
title,
numIndex,
ConfigSystemId,
......
......@@ -19,7 +19,7 @@ export enum Pages {
menu = 'menu',
listBooking = 'danh-sach-booking',
work = 'cong-viec',
policy = 'cau-hinh-chinh-sach',
configSystem = 'cau-hinh-he-thong',
news = 'cau-hinh-tin-tuc',
hotProduct = 'cau-hinh-san-pham-noi-bat',
}
......@@ -120,9 +120,9 @@ const routes: RouteRecordRaw[] = [
name: Pages.work,
},
{
path: 'cau-hinh-chinh-sach',
component: () => import('pages/cau-hinh-chinh-sach/index.vue'),
name: Pages.policy,
path: 'cau-hinh-he-thong',
component: () => import('pages/cau-hinh-he-thong/index.vue'),
name: Pages.configSystem,
},
{
path: 'cau-hinh-tin-tuc',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment