refactor(04): tree and path behavior
This commit is contained in:
parent
233babd89b
commit
37ebd3d880
1 changed files with 36 additions and 13 deletions
|
|
@ -177,10 +177,15 @@ const treeProductTypeAndGroup = computed(
|
||||||
type: 'group',
|
type: 'group',
|
||||||
actionDisabled: item.status === 'INACTIVE',
|
actionDisabled: item.status === 'INACTIVE',
|
||||||
children: [
|
children: [
|
||||||
{ id: 'type', name: 'ประเภท', type: 'type', actionDisabled: true },
|
{
|
||||||
|
id: 'type',
|
||||||
|
name: t('general.type'),
|
||||||
|
type: 'type',
|
||||||
|
actionDisabled: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'productService',
|
id: 'productService',
|
||||||
name: 'สินค้าและบริการ',
|
name: t('productService.title'),
|
||||||
type: 'productService',
|
type: 'productService',
|
||||||
actionDisabled: true,
|
actionDisabled: true,
|
||||||
},
|
},
|
||||||
|
|
@ -1318,6 +1323,7 @@ async function enterGroup(
|
||||||
expandedTree.value = [];
|
expandedTree.value = [];
|
||||||
expandedTree.value.push(id);
|
expandedTree.value.push(id);
|
||||||
pathGroupName.value = name;
|
pathGroupName.value = name;
|
||||||
|
currentIdType.value = '';
|
||||||
currentIdGrop.value = id;
|
currentIdGrop.value = id;
|
||||||
currentStatusList.value.push(status);
|
currentStatusList.value.push(status);
|
||||||
pathTypeName.value = name;
|
pathTypeName.value = name;
|
||||||
|
|
@ -1447,7 +1453,7 @@ onMounted(async () => {
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => expandedTree.value,
|
() => expandedTree.value,
|
||||||
() => {
|
(v) => {
|
||||||
inputSearch.value = '';
|
inputSearch.value = '';
|
||||||
currentStatus.value = 'All';
|
currentStatus.value = 'All';
|
||||||
|
|
||||||
|
|
@ -1466,19 +1472,23 @@ watch(
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (productMode.value === 'group' || productMode.value === 'service') {
|
if (
|
||||||
|
productMode.value === 'group' ||
|
||||||
|
productMode.value === 'service' ||
|
||||||
|
productMode.value === 'product'
|
||||||
|
) {
|
||||||
tmp.push({
|
tmp.push({
|
||||||
text: 'productService.group.withName',
|
text: 'productService.group.withName',
|
||||||
i18n: true,
|
i18n: true,
|
||||||
argsi18n: { name: pathGroupName.value },
|
argsi18n: { name: pathGroupName.value },
|
||||||
handler: () => {
|
handler: () => {
|
||||||
if (productMode.value === 'service') {
|
if (
|
||||||
|
productMode.value === 'service' ||
|
||||||
|
productMode.value === 'product'
|
||||||
|
) {
|
||||||
currentIdType.value = '';
|
currentIdType.value = '';
|
||||||
// productMode.value = 'type';
|
filterStat.value = [];
|
||||||
|
productMode.value = 'group';
|
||||||
filterStat.value = filterStat.value.filter((item) => {
|
|
||||||
return item !== 'type';
|
|
||||||
});
|
|
||||||
|
|
||||||
currentStatusList.value.splice(1);
|
currentStatusList.value.splice(1);
|
||||||
expandedTree.value.pop();
|
expandedTree.value.pop();
|
||||||
|
|
@ -1493,11 +1503,17 @@ watch(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (productMode.value === 'service') {
|
if (productMode.value === 'service' && v.length !== 1) {
|
||||||
tmp.push({
|
tmp.push({
|
||||||
text: 'productService.type.withName',
|
text: 'general.type',
|
||||||
|
i18n: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (productMode.value === 'product' && v.length !== 1) {
|
||||||
|
tmp.push({
|
||||||
|
text: 'productService.title',
|
||||||
i18n: true,
|
i18n: true,
|
||||||
argsi18n: { name: pathTypeName.value },
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1711,6 +1727,8 @@ watch([currentStatusList, productMode], () => {
|
||||||
}
|
}
|
||||||
if (currentIdType === v.id) {
|
if (currentIdType === v.id) {
|
||||||
expandedTree.pop();
|
expandedTree.pop();
|
||||||
|
currentIdType = '';
|
||||||
|
filterStat = [];
|
||||||
productMode = 'group';
|
productMode = 'group';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1719,11 +1737,16 @@ watch([currentStatusList, productMode], () => {
|
||||||
if (v.type === 'productService') {
|
if (v.type === 'productService') {
|
||||||
if (currentIdType !== v.id) {
|
if (currentIdType !== v.id) {
|
||||||
await enterNext('product');
|
await enterNext('product');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (currentIdType === v.id) {
|
if (currentIdType === v.id) {
|
||||||
expandedTree.pop();
|
expandedTree.pop();
|
||||||
|
currentIdType = '';
|
||||||
|
|
||||||
|
filterStat = [];
|
||||||
productMode = 'group';
|
productMode = 'group';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue