Commit 5668b432 authored by chenqikuai's avatar chenqikuai

1

parent c21c7380
...@@ -832,9 +832,9 @@ ...@@ -832,9 +832,9 @@
} }
}, },
"cqk-sy-ui": { "cqk-sy-ui": {
"version": "1.2.73", "version": "1.2.78",
"resolved": "https://registry.npmjs.org/cqk-sy-ui/-/cqk-sy-ui-1.2.73.tgz", "resolved": "https://registry.npmjs.org/cqk-sy-ui/-/cqk-sy-ui-1.2.78.tgz",
"integrity": "sha512-Mb/lU3DkPSGUl0ARFqfBqV1UsSAhQtekiD8r5QBsrFK1CKf/Wwi36V4YnjvWfM94++P4Y72A8o6mQj9DeJEPow==", "integrity": "sha512-VKCh4gBoZP8BmUqB1707Etr8v5JsNiyHPgDYBlJeKRp1nCRZYeoGt3w5xeglzSX0/H8euORwZ8ScJ3xJbS/pxQ==",
"requires": { "requires": {
"axios": "^0.26.1", "axios": "^0.26.1",
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"@chenfengyuan/vue-countdown": "^2.0.0", "@chenfengyuan/vue-countdown": "^2.0.0",
"axios": "^0.26.1", "axios": "^0.26.1",
"comlink": "^4.3.1", "comlink": "^4.3.1",
"cqk-sy-ui": "^1.2.73", "cqk-sy-ui": "^1.2.78",
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"dom-to-image": "^2.6.0", "dom-to-image": "^2.6.0",
"element-plus": "^2.1.9", "element-plus": "^2.1.9",
......
...@@ -25,10 +25,9 @@ ...@@ -25,10 +25,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, unref } from "vue"; import { ref, unref } from "vue";
import { iFolder } from "./types";
defineProps<{ defineProps<{
list: iFolder[]; list: { id: number; name: string }[];
focusedId: number; focusedId: number;
}>(); }>();
......
...@@ -8,12 +8,14 @@ ...@@ -8,12 +8,14 @@
name: 'editTemplate', name: 'editTemplate',
query: { query: {
id: data.id, id: data.id,
type: (hideOperate && 'sys') || undefined,
}, },
}) })
" "
> >
<template #icon="slotProps"> <template #icon="slotProps">
<syMoreOperate <syMoreOperate
v-if="!hideOperate"
:list="operateList" :list="operateList"
teleport teleport
@click-item="(e) => clickItem(e, data)" @click-item="(e) => clickItem(e, data)"
...@@ -86,6 +88,7 @@ import CopyTemplate from "./components/CopyTemplate.vue"; ...@@ -86,6 +88,7 @@ import CopyTemplate from "./components/CopyTemplate.vue";
const props = defineProps<{ const props = defineProps<{
list: iTemplate[]; list: iTemplate[];
categoryId: number; categoryId: number;
hideOperate: boolean;
}>(); }>();
const emit = defineEmits(["update"]); const emit = defineEmits(["update"]);
......
...@@ -40,8 +40,28 @@ ...@@ -40,8 +40,28 @@
</syMoreOperate> </syMoreOperate>
</div> </div>
</div> </div>
<syMenu
v-model="focusedMenu"
:menu-list="[
{ label: '系统模板', value: 'sys' },
{ label: '我的模板', value: 'private' },
]"
></syMenu>
<HorizontalListWrapper <HorizontalListWrapper
class="flex-shrink-0 mt-[49px]" v-if="focusedMenu === 'sys'"
class="flex-shrink-0 mt-[10px]"
ref="HorizontalListWrapperRef"
>
<CategoryList
v-model:focusedId="focusedSysFolderId"
:list="
sysFolderList.map((i) => ({ name: i.folder_name, id: i.folder_id }))
"
></CategoryList>
</HorizontalListWrapper>
<HorizontalListWrapper
v-else-if="focusedMenu === 'private'"
class="flex-shrink-0 mt-[10px]"
ref="HorizontalListWrapperRef" ref="HorizontalListWrapperRef"
@to-almost-end="fetchNextPageOfCategory" @to-almost-end="fetchNextPageOfCategory"
> >
...@@ -53,11 +73,22 @@ ...@@ -53,11 +73,22 @@
</HorizontalListWrapper> </HorizontalListWrapper>
<syScrollBar class="flex-grow" style="margin-top: 28px"> <syScrollBar class="flex-grow" style="margin-top: 28px">
<TemplateList <TemplateList
v-if="focusedMenu === 'private'"
:list="templateList" :list="templateList"
:categoryId="focusedCategoryId" :categoryId="focusedCategoryId"
v-loading="loadingOfTemplateList" v-loading="loadingOfTemplateList"
:hideOperate="false"
@update="refetchOfTemplateList" @update="refetchOfTemplateList"
></TemplateList> ></TemplateList>
<TemplateList
v-else-if="focusedMenu === 'sys'"
:list="
sysFolderList.find((i) => i.folder_id === focusedSysFolderId)
?.detail || []
"
:hideOperate="true"
:categoryId="focusedSysFolderId"
></TemplateList>
</syScrollBar> </syScrollBar>
</div> </div>
<syCommonDialog <syCommonDialog
...@@ -138,7 +169,7 @@ ...@@ -138,7 +169,7 @@
</Layout> </Layout>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, ref, watch } from "vue"; import { nextTick, ref, watch, onBeforeMount, onMounted } from "vue";
import { import {
syButton, syButton,
...@@ -147,6 +178,7 @@ import { ...@@ -147,6 +178,7 @@ import {
syMoreOperate, syMoreOperate,
syMessage, syMessage,
syCommonDialog, syCommonDialog,
syMenu,
} from "cqk-sy-ui"; } from "cqk-sy-ui";
import Search from "@/components/Search/index.vue"; import Search from "@/components/Search/index.vue";
import Layout from "@/components/Layout.vue"; import Layout from "@/components/Layout.vue";
...@@ -171,23 +203,85 @@ import { router } from "@/router"; ...@@ -171,23 +203,85 @@ import { router } from "@/router";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
const route = useRoute(); const route = useRoute();
const searchStr = ref(""); const searchStr = ref("");
const focusedCategoryId = ref(Number(route.query.categoryId) || NaN);
const showAddCategory = ref(false); const showAddCategory = ref(false);
const showAddTemplate = ref(false); const showAddTemplate = ref(false);
const editCategoryShow = ref(false);
const focusedMenu = ref(route.query.menu);
const focusedCategoryId = ref(Number(route.query.categoryId) || NaN);
const categoryListRef = ref<InstanceType<typeof CategoryList>>();
const templateList = ref<iTemplate[]>([]); const templateList = ref<iTemplate[]>([]);
const loadingOfTemplateList = ref(false); const loadingOfTemplateList = ref(false);
const categoryListRef = ref<InstanceType<typeof CategoryList>>();
const editCategoryShow = ref(false); const focusedSysFolderId = ref(NaN);
const sysFolderList = ref<
{ folder_id: number; detail: any; folder_name: string; update_time: number }[]
>([]);
onBeforeMount(() => {
if (focusedMenu.value === "" || focusedMenu.value === undefined) {
focusedMenu.value = "sys";
}
});
onMounted(async () => {
fetchSysTemplateList().then(() => {
if (focusedMenu.value === "sys") {
focusedSysFolderId.value =
Number(route.query.categoryId) || sysFolderList.value[0].folder_id;
}
});
});
watch(focusedMenu, (newV) => {
router.replace({
name: "templateManagement",
query: {
menu: newV,
},
});
if (newV === "sys") {
focusedSysFolderId.value = sysFolderList.value[0]?.folder_id;
} else if (newV === "private") {
focusedCategoryId.value = categoryList.value[0].id;
}
});
watch(focusedCategoryId, (newV) => { watch(focusedCategoryId, (newV) => {
router.replace({ router.replace({
name: "templateManagement",
query: {
menu: "private",
categoryId: newV,
},
});
});
watch(focusedSysFolderId, (newV) => {
router.replace({
name: "templateManagement",
query: { query: {
menu: "sys",
categoryId: newV, categoryId: newV,
}, },
}); });
}); });
async function fetchSysTemplateList() {
const res = await $ajax({
url: GO_URLS.systemList,
type: "post",
});
if (res) {
sysFolderList.value = res.data.results || [];
}
}
const operateListOfCreate = [ const operateListOfCreate = [
{ {
value: "createCategory", value: "createCategory",
...@@ -205,15 +299,6 @@ const operateListOfCreate = [ ...@@ -205,15 +299,6 @@ const operateListOfCreate = [
}, },
]; ];
const afterGetFolderList = (list: iFolder[]) => {
if (!focusedCategoryId.value) {
if (list[0]) {
focusedCategoryId.value = list[0].id;
}
}
refetchOfTemplateList();
};
const resetCateogryId = () => { const resetCateogryId = () => {
focusedCategoryId.value = categoryList.value[0].id; focusedCategoryId.value = categoryList.value[0].id;
}; };
...@@ -239,7 +324,7 @@ const { ...@@ -239,7 +324,7 @@ const {
total = res?.data.total; total = res?.data.total;
if (page === 1) { if (page === 1) {
afterGetFolderList(list); refetchOfTemplateList();
} }
return { return {
total: total, total: total,
...@@ -249,6 +334,7 @@ const { ...@@ -249,6 +334,7 @@ const {
}); });
let focusInTheTagAfterLoad = false; let focusInTheTagAfterLoad = false;
watch(categoryList, (nv, ov) => { watch(categoryList, (nv, ov) => {
async function findFocus(id: number) { async function findFocus(id: number) {
const the = categoryList.value.find((i) => i.id === id); const the = categoryList.value.find((i) => i.id === id);
...@@ -256,6 +342,7 @@ watch(categoryList, (nv, ov) => { ...@@ -256,6 +342,7 @@ watch(categoryList, (nv, ov) => {
fetchNextPageOfCategory(); fetchNextPageOfCategory();
} }
} }
if (focusedMenu.value !== "private") return;
findFocus(focusedCategoryId.value); findFocus(focusedCategoryId.value);
if (!focusInTheTagAfterLoad) { if (!focusInTheTagAfterLoad) {
nextTick(() => { nextTick(() => {
......
...@@ -72,7 +72,11 @@ onMounted(async () => { ...@@ -72,7 +72,11 @@ onMounted(async () => {
}); });
const saveTemplate = async () => { const saveTemplate = async () => {
if (route.query.type === "sys") {
syTraceProofEditRef.value.CreateTemplate();
} else {
syTraceProofEditRef.value.updateCustomize(); syTraceProofEditRef.value.updateCustomize();
}
}; };
const addTemplate = async () => { const addTemplate = async () => {
......
...@@ -22,7 +22,7 @@ export default defineConfig({ ...@@ -22,7 +22,7 @@ export default defineConfig({
"^/api": { "^/api": {
target: "http://183.134.99.140:46790/", target: "http://183.134.99.140:46790/",
// target: "http://121.37.141.165:46790/", // target: "http://121.37.141.165:46790/",
// target: "https://sy.8n.cn/api", // target: "https://sy.8n.cn",
changeOrigin: true, changeOrigin: true,
}, },
"^/proxyPdf": { "^/proxyPdf": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment