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

update

parent 00f5dcf5
...@@ -23,3 +23,8 @@ export enum FieldStatus { ...@@ -23,3 +23,8 @@ export enum FieldStatus {
active = 1, active = 1,
inactive = 0, inactive = 0,
} }
export enum PostStatus {
active = 1,
inactive = 0,
}
<template>
<q-dialog
persistent
:model-value="isOpened"
@update:model-value="$emit('update:isOpened', $event)"
>
<q-card class="full-width" style="max-width: 50rem" bordered>
<q-form
greedy
@submit.prevent="
$emit('savePostInfo', {});
$emit('update:isOpened', false);
"
>
<q-card-section class="q-pa-none">
<q-item>
<q-item-section>
<q-item-label class="text-h6 text-weight-regular">{{
isUpdate
? $t('post.dialogLabel.title.addPost')
: $t('post.dialogLabel.title.updatePost')
}}</q-item-label>
</q-item-section>
</q-item>
</q-card-section>
<q-separator />
<q-card-section
class="overflow-auto"
style="max-height: calc(100vh - 10rem)"
>
<div class="row q-col-gutter-sm">
<div class="col-6">
<q-input
:model-value="avatar"
@update:model-value="$emit('update:avatar', $event)"
:label="$t('post.dialogLabel.postLabels.avatar')"
type="text"
class="q-my-sm"
outlined
:rules="avatarRules"
clearable
></q-input>
</div>
<div class="col-6">
<q-input
:model-value="name"
@update:model-value="$emit('update:name', $event)"
:label="$t('post.dialogLabel.postLabels.name')"
type="text"
class="q-my-sm"
outlined
:rules="nameRules"
clearable
></q-input>
<q-input
:model-value="description"
@update:model-value="$emit('update:description', $event)"
:label="$t('post.dialogLabel.postLabels.description')"
type="text"
class="q-my-sm"
outlined
></q-input>
<q-input
:model-value="content"
@update:model-value="$emit('update:content', $event)"
:label="$t('post.dialogLabel.postLabels.content')"
:rules="contentRules"
type="textarea"
class="q-my-sm"
outlined
></q-input>
<div class="q-pt-sm">
<span class="text-body1">{{
$t('post.dialogLabel.postLabels.status')
}}</span
><q-toggle
:model-value="status"
:true-value="1"
:false-value="2"
@update:model-value="$emit('update:status', $event)"
/>
</div>
</div>
</div>
</q-card-section>
<q-card-actions align="right">
<div>
<q-btn
color="grey"
no-caps
style="width: 90px"
class="q-mr-sm"
:label="$t('post.crudActions.cancel')"
@click="$emit('update:isOpened', false)"
/>
<q-btn
type="submit"
color="primary"
no-caps
style="width: 90px"
:label="$t('post.crudActions.save')"
/>
</div>
</q-card-actions>
</q-form>
</q-card>
</q-dialog>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { i18n } from 'src/boot/i18n';
export default defineComponent({
props: {
isOpened: {
type: Boolean,
required: true,
},
isUpdate: { type: Boolean, default: false },
avatar: { type: String, required: true },
name: { type: String, required: true },
description: { type: String, required: true },
content: { type: String, required: true },
status: { type: Number, required: true },
},
setup() {
const avatarRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('post.validateMessages.requireAvatar'),
];
const contentRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('post.validateMessages.requireContent'),
];
const nameRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('post.validateMessages.requireName'),
];
return {
contentRules,
nameRules,
avatarRules,
};
},
emits: [
'update:isOpened',
'update:avatar',
'update:name',
'update:description',
'update:content',
'update:status',
'savePostInfo',
],
});
</script>
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
:label=" :label="
$t('managingUnitAdd.dialogLabel.fieldLabels.numberCard') $t('managingUnitAdd.dialogLabel.fieldLabels.numberCard')
" "
type="text" type="number"
class="q-my-sm" class="q-my-sm"
outlined outlined
:rules="numberCardRules" :rules="numberCardRules"
......
...@@ -592,7 +592,7 @@ export default { ...@@ -592,7 +592,7 @@ export default {
updateField: 'Cập nhật lĩnh vực hoạt động', updateField: 'Cập nhật lĩnh vực hoạt động',
}, },
fieldLabels: { fieldLabels: {
name: 'Tên lĩnh vực', name: 'Tên lĩnh vực *',
description: 'Mô tả *', description: 'Mô tả *',
status: 'Trạng thái', status: 'Trạng thái',
}, },
...@@ -621,4 +621,61 @@ export default { ...@@ -621,4 +621,61 @@ export default {
updateFieldAccess: 'Cập nhật lĩnh vực hoạt động thành công', updateFieldAccess: 'Cập nhật lĩnh vực hoạt động thành công',
}, },
}, },
//bài viết
post: {
title: 'Danh sách bài viết',
tableColumnsPost: {
stt: 'STT',
name: 'Tên bài viết',
avatar: 'Avatar',
category: 'Danh mục bài viết',
addUser: 'Người thêm',
addTime: 'Thời gian thêm',
updateUser: 'Người cập nhập',
updateTime: 'Thời gian cập nhật',
status: 'Trạng thái',
action: 'Chức năng',
},
statusLabel: {
active: 'Đang hoạt động',
inactive: 'Ngừng hoạt động',
},
dialogLabel: {
title: {
addPost: 'Thêm bài viết',
updatePost: 'Cập nhật Bài viết',
},
postLabels: {
name: 'Tên bài viết *',
avatar: 'Avatar *',
description: 'Mô tả',
content: 'Nội dung *',
status: 'Trạng thái',
},
},
toolTipMessage: {
updatePost: 'Cập nhật',
deletePost: 'Xoá',
},
crudActions: {
save: 'Lưu',
cancel: 'Đóng',
},
validateMessages: {
requireName: 'Vui lòng nhập Tên bài viết',
requireAvatar: 'Vui lòng chọn Avatar',
requireContent: 'Vui lòng nhập Nội dung',
},
confirmActionsPost: {
confirmDeletePostTitle: 'Xác nhận',
confirmDeletePostCancelBtnLabel: 'Huỷ',
confirmDeletePostContent: 'Bạn có chắc chắn muốn xoá bài viết này không?',
},
actionMessages: {
addNewPostAccess: 'Thêm bài viết thành công',
deletePostAccess: 'Xoá bài viết thành công',
updatePostAccess: 'Cập nhật bài viết thành công',
},
},
}; };
This diff is collapsed.
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<q-table <q-table
:rows="fieldTableRows" :rows="fieldTableRows"
:columns="fieldTableColumns" :columns="fieldTableColumns"
row-key="unitCode" row-key="fieldName"
separator="cell" separator="cell"
:no-data-label="$t('emptyData')" :no-data-label="$t('emptyData')"
hide-pagination hide-pagination
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<q-table <q-table
:rows="customerRankTableRows" :rows="customerRankTableRows"
:columns="customerRankTableColumns" :columns="customerRankTableColumns"
row-key="unitCode" row-key="customerRankCode"
separator="cell" separator="cell"
:no-data-label="$t('emptyData')" :no-data-label="$t('emptyData')"
hide-pagination hide-pagination
......
...@@ -12,6 +12,7 @@ export enum Pages { ...@@ -12,6 +12,7 @@ export enum Pages {
addArtist = 'them-nghe-sy', addArtist = 'them-nghe-sy',
customerRank = 'xep-hang-khach-hang', customerRank = 'xep-hang-khach-hang',
field = 'linh-vuc-hoat-dong', field = 'linh-vuc-hoat-dong',
post = 'bai-viet',
} }
const routes: RouteRecordRaw[] = [ const routes: RouteRecordRaw[] = [
...@@ -74,6 +75,11 @@ const routes: RouteRecordRaw[] = [ ...@@ -74,6 +75,11 @@ const routes: RouteRecordRaw[] = [
component: () => import('pages/linh-vuc-hoat-dong/index.vue'), component: () => import('pages/linh-vuc-hoat-dong/index.vue'),
name: Pages.field, name: Pages.field,
}, },
{
path: 'bai-viet',
component: () => import('pages/bai-viet/index.vue'),
name: Pages.post,
},
], ],
}, },
......
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