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:{
|
data_entry:{
|
||||||
getSchema:"elp/schema/get"
|
getSchema:"elp/schema/get"
|
||||||
|
},
|
||||||
|
conflict:{
|
||||||
|
get:"elp/conflict/{{type_name}}/get/text/{{doc_id}}"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, nextTick, onMounted, onBeforeUnmount } from "vue";
|
import { ref, nextTick, onMounted, onBeforeUnmount, watch } from "vue";
|
||||||
import {
|
import {
|
||||||
Details,
|
Details,
|
||||||
DetailsContent,
|
DetailsContent,
|
||||||
|
|
@ -52,7 +52,7 @@ function isList(text) {
|
||||||
(line) =>
|
(line) =>
|
||||||
line.trim().startsWith("*") ||
|
line.trim().startsWith("*") ||
|
||||||
line.trim().startsWith("-") ||
|
line.trim().startsWith("-") ||
|
||||||
/^\d+\./.test(line.trim()),
|
/^\d+\./.test(line.trim())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const toolbarGroups = [
|
const toolbarGroups = [
|
||||||
|
|
@ -247,7 +247,16 @@ function formatContent(content) {
|
||||||
|
|
||||||
function generateDetailsHtml(item) {
|
function generateDetailsHtml(item) {
|
||||||
let html = `<details class="custom-details" ${item.isOpen ? "open" : ""}>`;
|
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 || "");
|
const formattedContent = formatContent(item.content || "");
|
||||||
html += `<div class="details-content">${formattedContent}</div>`;
|
html += `<div class="details-content">${formattedContent}</div>`;
|
||||||
|
|
@ -268,7 +277,7 @@ function loadFromJson() {
|
||||||
if (!editor.value) return;
|
if (!editor.value) return;
|
||||||
|
|
||||||
let html =
|
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) => {
|
props.accordionData.forEach((item) => {
|
||||||
html += generateDetailsHtml(item);
|
html += generateDetailsHtml(item);
|
||||||
|
|
@ -276,7 +285,20 @@ function loadFromJson() {
|
||||||
|
|
||||||
editor.value.commands.setContent(html);
|
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(() => {
|
onMounted(() => {
|
||||||
editor.value = new Editor({
|
editor.value = new Editor({
|
||||||
extensions: [
|
extensions: [
|
||||||
|
|
@ -320,8 +342,8 @@ onBeforeUnmount(() => {
|
||||||
/* فقط متغیرهای غیررنگ (سایه، انحنا، RGB اصلی) – رنگها در main.css تعریف شدهاند */
|
/* فقط متغیرهای غیررنگ (سایه، انحنا، RGB اصلی) – رنگها در main.css تعریف شدهاند */
|
||||||
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
--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: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
||||||
--shadow-md:
|
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
||||||
0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
||||||
--radius: 0.75rem;
|
--radius: 0.75rem;
|
||||||
--radius-sm: 0.5rem;
|
--radius-sm: 0.5rem;
|
||||||
--radius-lg: 1rem;
|
--radius-lg: 1rem;
|
||||||
|
|
@ -411,14 +433,8 @@ onBeforeUnmount(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.tiptap {
|
.tiptap {
|
||||||
font-family:
|
font-family: "Vazir", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
|
||||||
"Vazir",
|
Roboto, sans-serif;
|
||||||
"Inter",
|
|
||||||
-apple-system,
|
|
||||||
BlinkMacSystemFont,
|
|
||||||
"Segoe UI",
|
|
||||||
Roboto,
|
|
||||||
sans-serif;
|
|
||||||
color: var(--color-dark-primary-700);
|
color: var(--color-dark-primary-700);
|
||||||
line-height: 1.7;
|
line-height: 1.7;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,25 +6,84 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { ref, watch, onMounted } from "vue";
|
||||||
|
import { useElpService } from "~/composables/useElpService";
|
||||||
|
|
||||||
|
const { uepGetConflictDoc } = useElpService();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
listConflicts: {
|
listConflicts: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
conflictSelected: {
|
conflict_id: {
|
||||||
type: Object,
|
type: String,
|
||||||
default: () => {},
|
default: () => "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const accordionItems = [
|
|
||||||
|
let accordionItems = ref([
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
|
tag: "",
|
||||||
title: "عنوان",
|
title: "عنوان",
|
||||||
|
link_label: "منبع",
|
||||||
|
link_url: "",
|
||||||
content: "متن",
|
content: "متن",
|
||||||
isOpen: true,
|
isOpen: true,
|
||||||
children: [],
|
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>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<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 {
|
return {
|
||||||
uepUpdateField,
|
uepUpdateField,
|
||||||
uepGetComputeField,
|
uepGetComputeField,
|
||||||
|
uepGetConflictDoc,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,16 @@ export const isLoginRemoved = () => process.env.VUE_APP_LOGIN_REMOVE == 1;
|
||||||
|
|
||||||
// util to export to excel file using plugin
|
// util to export to excel file using plugin
|
||||||
// https://github.com/zheeeng/export-from-json
|
// https://github.com/zheeeng/export-from-json
|
||||||
export const convertJsonToExcelUsingPlugin = async (
|
// export const convertJsonToExcelUsingPlugin = async (
|
||||||
data,
|
// data,
|
||||||
fileName = "download"
|
// fileName = "download"
|
||||||
) => {
|
// ) => {
|
||||||
// 'txt'(default), 'css', 'html', 'json', 'csv', 'xls', 'xml'
|
// // 'txt'(default), 'css', 'html', 'json', 'csv', 'xls', 'xml'
|
||||||
const exportType = exportFromJSON.types.xls;
|
// const exportType = exportFromJSON.types.xls;
|
||||||
const withBOM = true;
|
// const withBOM = true;
|
||||||
|
|
||||||
return await exportFromJSON({ data, fileName, exportType, withBOM });
|
// return await exportFromJSON({ data, fileName, exportType, withBOM });
|
||||||
};
|
// };
|
||||||
|
|
||||||
// util to export to excel file manually
|
// util to export to excel file manually
|
||||||
export const exportJsonToExcelManually = (JSONData, FileTitle, ShowLabel) => {
|
export const exportJsonToExcelManually = (JSONData, FileTitle, ShowLabel) => {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
:listConflicts="listConflicts"
|
:listConflicts="listConflicts"
|
||||||
:conflictSelected="conflictSelected"
|
:conflictSelected="conflictSelected"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
|
:conflict_id="conflictSelected?._id"
|
||||||
@conflict-details="conflictDetails"
|
@conflict-details="conflictDetails"
|
||||||
@my-content-action="myContentAction"
|
@my-content-action="myContentAction"
|
||||||
@my-header-tools-search="myHeaderToolsSearch"
|
@my-header-tools-search="myHeaderToolsSearch"
|
||||||
|
|
@ -145,7 +146,7 @@ const getListConflict = async (textSearch = "", filterExtended = "") => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function conflictDetails(event) {
|
function conflictDetails(event) {
|
||||||
conflictSelected.value = event;
|
conflictSelected.value = event.item;
|
||||||
activeTabKey.value = "RelationEdit";
|
activeTabKey.value = "RelationEdit";
|
||||||
console.log("event", event);
|
console.log("event", event);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user