Merge branch 'main' of https://git2.tavasi.ir/Baghi/conflict-nuxt-4 into shadi/conflict
This commit is contained in:
commit
d69b74561c
|
|
@ -23,5 +23,8 @@ export default {
|
|||
},
|
||||
data_entry:{
|
||||
getSchema:"elp/schema/get"
|
||||
},
|
||||
conflict:{
|
||||
get:"elp/conflict/{{type_name}}/get/text/{{doc_id}}"
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, nextTick, onMounted, onBeforeUnmount } from "vue";
|
||||
import { ref, nextTick, onMounted, onBeforeUnmount, watch } from "vue";
|
||||
import {
|
||||
Details,
|
||||
DetailsContent,
|
||||
|
|
@ -52,7 +52,7 @@ function isList(text) {
|
|||
(line) =>
|
||||
line.trim().startsWith("*") ||
|
||||
line.trim().startsWith("-") ||
|
||||
/^\d+\./.test(line.trim()),
|
||||
/^\d+\./.test(line.trim())
|
||||
);
|
||||
}
|
||||
const toolbarGroups = [
|
||||
|
|
@ -247,7 +247,16 @@ function formatContent(content) {
|
|||
|
||||
function generateDetailsHtml(item) {
|
||||
let html = `<details class="custom-details" ${item.isOpen ? "open" : ""}>`;
|
||||
html += `<summary>${escapeHtml(item.title) || "بدون عنوان"}</summary>`;
|
||||
html += `<summary>`;
|
||||
if (item.tag) {
|
||||
html += `<span href="${item.tag}"/>`;
|
||||
}
|
||||
|
||||
html += `${escapeHtml(item.title) || "بدون عنوان"}`;
|
||||
if (item.link_url) {
|
||||
html += `<a href="${item.link_url}">${item.link_label}</a>`;
|
||||
}
|
||||
html += "</summary>";
|
||||
|
||||
const formattedContent = formatContent(item.content || "");
|
||||
html += `<div class="details-content">${formattedContent}</div>`;
|
||||
|
|
@ -268,7 +277,7 @@ function loadFromJson() {
|
|||
if (!editor.value) return;
|
||||
|
||||
let html =
|
||||
'<p style="margin-bottom: 1.5rem; color: var(--color-dark-primary-700);">✨ اطلاعات محصول</p>';
|
||||
'<p style="margin-bottom: 1.5rem; color: var(--color-dark-primary-700);"></p>';
|
||||
|
||||
props.accordionData.forEach((item) => {
|
||||
html += generateDetailsHtml(item);
|
||||
|
|
@ -276,7 +285,20 @@ function loadFromJson() {
|
|||
|
||||
editor.value.commands.setContent(html);
|
||||
}
|
||||
watch(
|
||||
() => props.accordionData,
|
||||
(newVal) => {
|
||||
if (!editor.value) return;
|
||||
if (!newVal || newVal.length === 0) return;
|
||||
|
||||
console.log("accordionData updated:", newVal);
|
||||
|
||||
nextTick(() => {
|
||||
loadFromJson();
|
||||
});
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
onMounted(() => {
|
||||
editor.value = new Editor({
|
||||
extensions: [
|
||||
|
|
@ -320,8 +342,8 @@ onBeforeUnmount(() => {
|
|||
/* فقط متغیرهای غیررنگ (سایه، انحنا، RGB اصلی) – رنگها در main.css تعریف شدهاند */
|
||||
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
||||
--shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
||||
--shadow-md:
|
||||
0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
||||
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
||||
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
||||
--radius: 0.75rem;
|
||||
--radius-sm: 0.5rem;
|
||||
--radius-lg: 1rem;
|
||||
|
|
@ -411,14 +433,8 @@ onBeforeUnmount(() => {
|
|||
}
|
||||
|
||||
.tiptap {
|
||||
font-family:
|
||||
"Vazir",
|
||||
"Inter",
|
||||
-apple-system,
|
||||
BlinkMacSystemFont,
|
||||
"Segoe UI",
|
||||
Roboto,
|
||||
sans-serif;
|
||||
font-family: "Vazir", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
|
||||
Roboto, sans-serif;
|
||||
color: var(--color-dark-primary-700);
|
||||
line-height: 1.7;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,25 +6,84 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, onMounted } from "vue";
|
||||
import { useElpService } from "~/composables/useElpService";
|
||||
|
||||
const { uepGetConflictDoc } = useElpService();
|
||||
|
||||
const props = defineProps({
|
||||
listConflicts: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
conflictSelected: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
conflict_id: {
|
||||
type: String,
|
||||
default: () => "",
|
||||
},
|
||||
});
|
||||
const accordionItems = [
|
||||
|
||||
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 +
|
||||
"/entity/show/view/qasection/{{qanon_id}}?jump_id={{section_id}}";
|
||||
|
||||
accordionItems.value = [];
|
||||
|
||||
if (_source.previous_info) {
|
||||
let item = _source.previous_info;
|
||||
accordionItems.value.push({
|
||||
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),
|
||||
});
|
||||
}
|
||||
|
||||
if (_source.next_info) {
|
||||
let item = _source.next_info;
|
||||
accordionItems.value.push({
|
||||
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),
|
||||
});
|
||||
}
|
||||
|
||||
console.log("accordionItems", accordionItems.value);
|
||||
};
|
||||
|
||||
// #region Lifecycle
|
||||
onMounted(() => {
|
||||
setDataEditor();
|
||||
});
|
||||
// #endregion
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
|
|
|
|||
|
|
@ -69,10 +69,37 @@ export function useElpService(props, emit) {
|
|||
});
|
||||
}
|
||||
|
||||
///-----------------------------------------------------
|
||||
///--- با توجه به یک فیلد، مقدار محاسبه شده ای بر میگردند مثلا : بیشترین مقدار یا مجموع یا ...
|
||||
///-----------------------------------------------------
|
||||
async function uepGetConflictDoc(
|
||||
doc_id,
|
||||
key = "qaconflict"
|
||||
) {
|
||||
let url = elpApi.conflict.get;
|
||||
url = url.replace("{{type_name}}", key);
|
||||
url = url.replace("{{doc_id}}", doc_id);
|
||||
|
||||
return await httpService
|
||||
.getRequest(url)
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch(() => {
|
||||
toast.add({
|
||||
title: "خطا",
|
||||
description: "خطا در انجام عملیات، دوباره تلاش کنید",
|
||||
color: "red",
|
||||
});
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
|
||||
///-----------------------------------------------------
|
||||
///-----------------------------------------------------
|
||||
return {
|
||||
uepUpdateField,
|
||||
uepGetComputeField,
|
||||
uepGetConflictDoc,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,16 +6,16 @@ export const isLoginRemoved = () => process.env.VUE_APP_LOGIN_REMOVE == 1;
|
|||
|
||||
// util to export to excel file using plugin
|
||||
// https://github.com/zheeeng/export-from-json
|
||||
export const convertJsonToExcelUsingPlugin = async (
|
||||
data,
|
||||
fileName = "download"
|
||||
) => {
|
||||
// 'txt'(default), 'css', 'html', 'json', 'csv', 'xls', 'xml'
|
||||
const exportType = exportFromJSON.types.xls;
|
||||
const withBOM = true;
|
||||
// export const convertJsonToExcelUsingPlugin = async (
|
||||
// data,
|
||||
// fileName = "download"
|
||||
// ) => {
|
||||
// // 'txt'(default), 'css', 'html', 'json', 'csv', 'xls', 'xml'
|
||||
// const exportType = exportFromJSON.types.xls;
|
||||
// const withBOM = true;
|
||||
|
||||
return await exportFromJSON({ data, fileName, exportType, withBOM });
|
||||
};
|
||||
// return await exportFromJSON({ data, fileName, exportType, withBOM });
|
||||
// };
|
||||
|
||||
// util to export to excel file manually
|
||||
export const exportJsonToExcelManually = (JSONData, FileTitle, ShowLabel) => {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
:listConflicts="listConflicts"
|
||||
:conflictSelected="conflictSelected"
|
||||
:pagination="pagination"
|
||||
:conflict_id="conflictSelected?._id"
|
||||
@conflict-details="conflictDetails"
|
||||
@my-content-action="myContentAction"
|
||||
@my-header-tools-search="myHeaderToolsSearch"
|
||||
|
|
@ -145,7 +146,7 @@ const getListConflict = async (textSearch = "", filterExtended = "") => {
|
|||
}
|
||||
};
|
||||
function conflictDetails(event) {
|
||||
conflictSelected.value = event;
|
||||
conflictSelected.value = event.item;
|
||||
activeTabKey.value = "RelationEdit";
|
||||
console.log("event", event);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user