conflict-nuxt-4/app/components/lazy-load/data-entry/RelationEdit.vue
2026-02-14 13:56:22 +03:30

132 lines
3.3 KiB
Vue

<template>
<div>
<HeaderTools></HeaderTools>
<TiptapEditor :accordionData="accordionItems"></TiptapEditor>
</div>
</template>
<script setup>
import { ref, watch, onMounted } from "vue";
import { useElpService } from "~/composables/useElpService";
const { uepGetConflictDoc } = useElpService();
const props = defineProps({
listConflicts: {
type: Array,
default: () => [],
},
conflict_id: {
type: String,
default: () => "",
},
});
let accordionItems = ref([
{
id: 1,
tag: "",
title: "عنوان",
link_label: "منبع",
link_url: "",
content: "متن",
isOpen: true,
children: [],
},
]);
const setDataEditor = async () => {
let response = await uepGetConflictDoc(props.conflict_id);
console.log("setDataEditor ", response);
let _source = response._source;
let base_url = window.location.origin;
base_url = base_url.replace("localhost:3007", "localhost:8082");
base_url = base_url.replace("majles.tavasi.ir", "jedit.tavasi.ir");
base_url += "/entity/show/view/qasection/{{qanon_id}}?jump_id={{section_id}}";
accordionItems.value = [];
if (_source.previous_info) {
let item = _source.previous_info;
let node = {
isOpen: false,
id: item.section_mom_id,
title: "قانون مقدم : " + item.qanon_title + " > " + item.full_path,
tag: item.state_etebar,
content: _source.content1,
link_label: "«منبع»",
link_url: base_url
.replace("{{qanon_id}}", item.qanon_id)
.replace("{{section_id}}", item.section_mom_id),
children: [],
};
node["children"].push({
isOpen: false,
id: item.context_id,
title: "متن کامل با اجزاء دیگر مورد توجه : ",
content: _source.context1,
});
accordionItems.value.push(node);
item.rule_ids.forEach((rule_id) => {
let content = _source.rules_content[rule_id] ?? "";
accordionItems.value.push({
isOpen: false,
id: rule_id,
title: "حکم مورد استناد طرف مقدم با شناسه : " + rule_id,
content: content,
});
});
}
if (_source.next_info) {
let item = _source.next_info;
let node = {
isOpen: false,
id: item.section_mom_id,
title: "قانون موخر : " + item.qanon_title + " > " + item.full_path,
tag: item.state_etebar,
content: _source.content2,
link_label: "«منبع»",
link_url: base_url
.replace("{{qanon_id}}", item.qanon_id)
.replace("{{section_id}}", item.section_mom_id),
children: [],
};
node["children"].push({
isOpen: false,
id: item.context_id,
title: "متن کامل با اجزاء دیگر مورد توجه : ",
content: _source.context1,
});
accordionItems.value.push(node);
item.rule_ids.forEach((rule_id) => {
let content = _source.rules_content[rule_id] ?? "";
accordionItems.value.push({
isOpen: false,
id: rule_id,
title: "حکم مورد استناد طرف موخر با شناسه : " + rule_id,
content: content,
});
});
}
console.log("accordionItems", accordionItems.value);
};
// #region Lifecycle
onMounted(() => {
setDataEditor();
});
// #endregion
</script>
<style></style>