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