fix bug load template
This commit is contained in:
parent
72906c4b72
commit
8f186eb183
1 changed files with 16 additions and 6 deletions
|
|
@ -31,7 +31,7 @@ const childTemplateDetailRef = ref<InstanceType<typeof TemplateDetail> | null>(
|
|||
null
|
||||
); //ref components ข้อความต้นแบบ
|
||||
const childPageOrderRef = ref<InstanceType<typeof PageOrder> | null>(null); //ref components คำสั่ง
|
||||
|
||||
|
||||
// Tabs
|
||||
const tabs = ref<Tabs[]>([
|
||||
{
|
||||
|
|
@ -94,6 +94,14 @@ async function fetchCommandType() {
|
|||
const data = res.data.result;
|
||||
listOrder.value = data.commandTypes;
|
||||
maxPage.value = Math.ceil(data.total / pageSize.value);
|
||||
|
||||
if (activeCommandId.value) {
|
||||
listOrder.value.find((e: ListOrder) => {
|
||||
if (e.id === activeCommandId.value) {
|
||||
selectInbox(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -147,7 +155,7 @@ function onDialogEdit(data: ListOrder) {
|
|||
name.value = data.name;
|
||||
status.value = data.isActive;
|
||||
category.value = data.commandSysId;
|
||||
subtitle.value = data.subtitle ? data.subtitle :'';
|
||||
subtitle.value = data.subtitle ? data.subtitle : "";
|
||||
isEdit.value = true;
|
||||
isAttachment.value = data.isAttachment;
|
||||
dialogFormCommand.value = true;
|
||||
|
|
@ -160,7 +168,7 @@ function closeDialog() {
|
|||
commandId.value = "";
|
||||
isEdit.value = false;
|
||||
dialogFormCommand.value = false;
|
||||
subtitle.value = ''
|
||||
subtitle.value = "";
|
||||
name.value = "";
|
||||
status.value = false;
|
||||
category.value = "";
|
||||
|
|
@ -198,6 +206,10 @@ function onSubmit() {
|
|||
* เก็บ id list คำสั่งที่เลือก เพื่อใช้ class
|
||||
*/
|
||||
function selectInbox(data: ListOrder) {
|
||||
store.currentTab =
|
||||
!data.isAttachment && store.currentTab == "attachment"
|
||||
? "cover"
|
||||
: store.currentTab;
|
||||
isAttachmentShow.value = data.isAttachment;
|
||||
activeCommandId.value = data.id;
|
||||
fetchDataCommandTypeId(data.id);
|
||||
|
|
@ -214,9 +226,7 @@ async function fetchDataCommandTypeId(id: string) {
|
|||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
dataTemplateDetail.value = data;
|
||||
await Promise.all([
|
||||
childTemplateDetailRef?.value?.fetchData(data),
|
||||
]);
|
||||
await Promise.all([childTemplateDetailRef?.value?.fetchData(data)]);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue