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

update

parent ee6ef607
...@@ -472,11 +472,8 @@ export type AddMenu = { ...@@ -472,11 +472,8 @@ export type AddMenu = {
export type ListConfigSystem = { export type ListConfigSystem = {
id: number; id: number;
namePage: string; namePage: string;
title: string;
content: string; content: string;
url: string; url: string;
numIndex: number;
status: number;
createTime?: string; createTime?: string;
createBy?: string; createBy?: string;
updateTime?: string; updateTime?: string;
...@@ -486,11 +483,8 @@ export type ListConfigSystem = { ...@@ -486,11 +483,8 @@ export type ListConfigSystem = {
export type DetailConfigSystem = { export type DetailConfigSystem = {
id: number; id: number;
namePage: string; namePage: string;
title: string;
content: string; content: string;
numIndex: number;
url: string; url: string;
status: number;
createTime?: string; createTime?: string;
createBy?: string; createBy?: string;
updateTime?: string; updateTime?: string;
...@@ -500,11 +494,8 @@ export type DetailConfigSystem = { ...@@ -500,11 +494,8 @@ export type DetailConfigSystem = {
export type UpdateConfigSystem = { export type UpdateConfigSystem = {
id: number; id: number;
namePage: string; namePage: string;
title: string;
content: string; content: string;
status: number;
url: string; url: string;
numIndex: number;
createTime?: string; createTime?: string;
createBy?: string; createBy?: string;
updateTime?: string; updateTime?: string;
...@@ -513,9 +504,6 @@ export type UpdateConfigSystem = { ...@@ -513,9 +504,6 @@ export type UpdateConfigSystem = {
export type AddConfigSystem = { export type AddConfigSystem = {
namePage: string; namePage: string;
title: string;
content: string; content: string;
url: string; url: string;
numIndex: number;
status: number;
}; };
...@@ -38,38 +38,8 @@ ...@@ -38,38 +38,8 @@
:rules="namePageRules" :rules="namePageRules"
clearable clearable
></q-input> ></q-input>
<q-input
:model-value="numIndex"
@update:model-value="$emit('update:numIndex', $event)"
:label="$t('listMenu.dialogLabel.fieldLabels.numIndex')"
class="q-my-sm"
mask="##"
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>
<div class="col-6"> <div class="col-6">
<q-input
:model-value="title"
@update:model-value="$emit('update:title', $event)"
:label="$t('listConfigSystem.dialogLabel.fieldLabels.title')"
class="q-my-sm"
type="text"
outlined
:rules="titleRules"
clearable
></q-input>
<q-input <q-input
:model-value="url" :model-value="url"
@update:model-value="$emit('update:url', $event)" @update:model-value="$emit('update:url', $event)"
...@@ -217,11 +187,8 @@ export default defineComponent({ ...@@ -217,11 +187,8 @@ export default defineComponent({
}, },
isUpdate: { type: Boolean, default: false }, isUpdate: { type: Boolean, default: false },
namePage: { type: String, required: true }, namePage: { type: String, required: true },
title: { type: String, required: true },
url: { type: String, required: true }, url: { type: String, required: true },
numIndex: { type: Number, required: true },
content: { type: String, required: true }, content: { type: String, required: true },
status: { type: Number, required: true },
}, },
setup() { setup() {
const namePageRules = [ const namePageRules = [
...@@ -229,11 +196,6 @@ export default defineComponent({ ...@@ -229,11 +196,6 @@ export default defineComponent({
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('listConfigSystem.validateMessages.requireNamePage'), i18n.global.t('listConfigSystem.validateMessages.requireNamePage'),
]; ];
const titleRules = [
(val?: string) =>
(val && val.trim().length) ||
i18n.global.t('listConfigSystem.validateMessages.requireTitle'),
];
const urlRules = [ const urlRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
...@@ -241,7 +203,6 @@ export default defineComponent({ ...@@ -241,7 +203,6 @@ export default defineComponent({
]; ];
return { return {
namePageRules, namePageRules,
titleRules,
urlRules, urlRules,
ConfigSystemStatus, ConfigSystemStatus,
}; };
...@@ -249,11 +210,8 @@ export default defineComponent({ ...@@ -249,11 +210,8 @@ export default defineComponent({
emits: [ emits: [
'update:isOpened', 'update:isOpened',
'update:namePage', 'update:namePage',
'update:title',
'update:content', 'update:content',
'update:url', 'update:url',
'update:numIndex',
'update:status',
'click:CloseBtn', 'click:CloseBtn',
'addUpdateConfigSystem', 'addUpdateConfigSystem',
], ],
......
...@@ -106,28 +106,6 @@ ...@@ -106,28 +106,6 @@
</div> </div>
</q-td> </q-td>
</template> </template>
<template v-slot:body-cell-status="rowData">
<q-td>
<div align="center">
<q-chip
:color="
rowData.value === ConfigSystemStatus.active
? 'positive'
: 'orange'
"
text-color="white"
size="sm"
>
{{
rowData.value === ConfigSystemStatus.active
? $t('listConfigSystem.statusLabel.active')
: $t('listConfigSystem.statusLabel.inactive')
}}
</q-chip>
</div>
</q-td>
</template>
</q-table> </q-table>
</div> </div>
<div class="col-12 q-mt-sm"> <div class="col-12 q-mt-sm">
...@@ -144,11 +122,8 @@ ...@@ -144,11 +122,8 @@
isUpdate isUpdate
v-model:isOpened="showDialogAdd" v-model:isOpened="showDialogAdd"
v-model:namePage="namePage" v-model:namePage="namePage"
v-model:title="title"
v-model:content="content" v-model:content="content"
v-model:url="url" v-model:url="url"
v-model:num-index="numIndex"
v-model:status="status"
@addUpdateConfigSystem="addConfigSystem" @addUpdateConfigSystem="addConfigSystem"
/> />
...@@ -156,11 +131,8 @@ ...@@ -156,11 +131,8 @@
isUpdate isUpdate
v-model:isOpened="showDialogUpdate" v-model:isOpened="showDialogUpdate"
v-model:namePage="namePage" v-model:namePage="namePage"
v-model:title="title"
v-model:content="content" v-model:content="content"
v-model:url="url" v-model:url="url"
v-model:num-index="numIndex"
v-model:status="status"
@addUpdateConfigSystem="updateConfigSystem" @addUpdateConfigSystem="updateConfigSystem"
/> />
</div> </div>
...@@ -168,7 +140,6 @@ ...@@ -168,7 +140,6 @@
<script lang="ts"> <script lang="ts">
import AddUpdatePolicyDialog from 'components/configSystem/index.vue'; import AddUpdatePolicyDialog from 'components/configSystem/index.vue';
import { ConfigSystemStatus } from 'src/assets/enums';
import { i18n } from 'src/boot/i18n'; import { i18n } from 'src/boot/i18n';
import { defineComponent, onMounted, Ref, ref } from 'vue'; import { defineComponent, onMounted, Ref, ref } from 'vue';
import Pagination from 'components/pagination/index.vue'; import Pagination from 'components/pagination/index.vue';
...@@ -218,15 +189,6 @@ export default defineComponent({ ...@@ -218,15 +189,6 @@ export default defineComponent({
headerStyle: 'text-align: center !important; width: 14%', headerStyle: 'text-align: center !important; width: 14%',
sortable: false, sortable: false,
}, },
{
name: 'title',
field: 'title',
required: true,
label: i18n.global.t('listConfigSystem.titleColumnsTable.title'),
align: 'left',
headerStyle: 'text-align: center !important; width: 11%',
sortable: false,
},
{ {
name: 'content', name: 'content',
field: 'content', field: 'content',
...@@ -236,24 +198,6 @@ export default defineComponent({ ...@@ -236,24 +198,6 @@ export default defineComponent({
align: 'left', align: 'left',
sortable: false, sortable: false,
}, },
{
name: 'numIndex',
field: 'numIndex',
required: true,
label: i18n.global.t('listConfigSystem.titleColumnsTable.numIndex'),
headerStyle: 'text-align: center !important; width: 7%',
align: 'center',
sortable: false,
},
{
name: 'status',
field: 'status',
required: true,
label: i18n.global.t('listConfigSystem.titleColumnsTable.status'),
headerStyle: 'text-align: center !important; width: 12%',
align: 'center',
sortable: false,
},
{ {
name: 'action', name: 'action',
field: 'action', field: 'action',
...@@ -277,11 +221,8 @@ export default defineComponent({ ...@@ -277,11 +221,8 @@ export default defineComponent({
const showDialogAdd = ref(false); const showDialogAdd = ref(false);
const showDialogUpdate = ref(false); const showDialogUpdate = ref(false);
const namePage: Ref<string> = ref(''); const namePage: Ref<string> = ref('');
const title: Ref<string> = ref('');
const url: Ref<string> = ref(''); const url: Ref<string> = ref('');
const numIndex: Ref<number | undefined> = ref(undefined);
const content: Ref<string> = ref(''); const content: Ref<string> = ref('');
const status: Ref<number> = ref(ConfigSystemStatus.active);
const ConfigSystemId: Ref<number | undefined> = ref(undefined); const ConfigSystemId: Ref<number | undefined> = ref(undefined);
const getConfigSystem = async () => { const getConfigSystem = async () => {
...@@ -306,22 +247,16 @@ export default defineComponent({ ...@@ -306,22 +247,16 @@ export default defineComponent({
const openAddDialog = () => { const openAddDialog = () => {
namePage.value = ''; namePage.value = '';
title.value = '';
content.value = ''; content.value = '';
url.value = ''; url.value = '';
numIndex.value = undefined;
status.value = ConfigSystemStatus.active;
showDialogAdd.value = true; showDialogAdd.value = true;
}; };
const addConfigSystem = async () => { const addConfigSystem = async () => {
const data = { const data = {
namePage: namePage.value, namePage: namePage.value,
title: title.value,
url: url.value, url: url.value,
content: content.value, content: content.value,
numIndex: numIndex.value,
status: status.value,
}; };
const response = (await api({ const response = (await api({
url: API_PATHS.addConfigSystem, url: API_PATHS.addConfigSystem,
...@@ -356,11 +291,8 @@ export default defineComponent({ ...@@ -356,11 +291,8 @@ export default defineComponent({
if (response.data.error.code === config.API_RES_CODE.OK.code) { if (response.data.error.code === config.API_RES_CODE.OK.code) {
ConfigSystemId.value = response.data.data.id; ConfigSystemId.value = response.data.data.id;
namePage.value = response.data.data.namePage; namePage.value = response.data.data.namePage;
title.value = response.data.data.title;
url.value = response.data.data.url; url.value = response.data.data.url;
content.value = response.data.data.content; content.value = response.data.data.content;
numIndex.value = response.data.data.numIndex;
status.value = response.data.data.status;
} }
} catch (error) {} } catch (error) {}
}; };
...@@ -373,11 +305,8 @@ export default defineComponent({ ...@@ -373,11 +305,8 @@ export default defineComponent({
data: { data: {
id: ConfigSystemId.value, id: ConfigSystemId.value,
namePage: namePage.value, namePage: namePage.value,
title: title.value,
url: url.value, url: url.value,
content: content.value, content: content.value,
numIndex: numIndex.value,
status: status.value,
}, },
})) as AxiosResponse<BaseResponseBody<UpdateConfigSystem>>; })) as AxiosResponse<BaseResponseBody<UpdateConfigSystem>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) { if (response.data.error.code === config.API_RES_CODE.OK.code) {
...@@ -444,14 +373,10 @@ export default defineComponent({ ...@@ -444,14 +373,10 @@ export default defineComponent({
pageSize, pageSize,
totalPage, totalPage,
changePageSize, changePageSize,
ConfigSystemStatus,
showDialogUpdate, showDialogUpdate,
namePage, namePage,
content, content,
status,
url, url,
title,
numIndex,
ConfigSystemId, ConfigSystemId,
showDialogAdd, showDialogAdd,
openAddDialog, openAddDialog,
......
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