From 2aa2da6ff94c0e88e7ba0638606881a3c04cf579 Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期二, 29 七月 2025 16:25:06 +0800 Subject: [PATCH] '-' --- src/views/system/dept/index.vue | 20 ++- src/store/modules/user.ts | 7 - src/layout/components/lay-tag/index.vue | 2 src/layout/components/lay-navbar/index.vue | 16 +- src/views/home/component/myHeader.vue | 63 ++++++++++++ src/views/home/component/myFooter.vue | 2 src/views/home/index.vue | 54 ---------- src/views/system/dept/utils/hook.tsx | 56 +++++++++-- src/layout/hooks/useTag.ts | 2 src/layout/hooks/useNav.ts | 2 src/store/modules/multiTags.ts | 2 src/views/system/dept/form.vue | 22 ++- src/router/utils.ts | 3 13 files changed, 157 insertions(+), 94 deletions(-) diff --git a/src/layout/components/lay-navbar/index.vue b/src/layout/components/lay-navbar/index.vue index 8a966e4..a7527f9 100644 --- a/src/layout/components/lay-navbar/index.vue +++ b/src/layout/components/lay-navbar/index.vue @@ -62,13 +62,15 @@ </span> <template #dropdown> <el-dropdown-menu class="logout"> - <el-dropdown-item - v-for="item in userRolesList" - :key="item.code" - @click="changRole(item)" - > - {{ item.name }} - </el-dropdown-item> + <template v-if="userRolesList && userRolesList.length > 1"> + <el-dropdown-item + v-for="item in userRolesList" + :key="item.code" + @click="changRole(item)" + > + {{ item.name }} + </el-dropdown-item> + </template> <el-dropdown-item @click="logout"> <!-- <IconifyIconOffline :icon="LogoutCircleRLine" diff --git a/src/layout/components/lay-tag/index.vue b/src/layout/components/lay-tag/index.vue index af563cf..ccbabaf 100644 --- a/src/layout/components/lay-tag/index.vue +++ b/src/layout/components/lay-tag/index.vue @@ -46,6 +46,7 @@ currentSelect, scheduleIsActive, getContextMenuStyle, + userRoles, closeMenu, onMounted, onMouseenter, @@ -186,6 +187,7 @@ if (!hasValue) { arr.forEach((arrItem: any) => { if (arrItem.path === value) { + console.log(arrItem.path, value, "arrItem.path === value"); useMultiTagsStoreHook().handleTags("push", { path: value, meta: arrItem.meta, diff --git a/src/layout/hooks/useNav.ts b/src/layout/hooks/useNav.ts index b1b0567..17745d4 100644 --- a/src/layout/hooks/useNav.ts +++ b/src/layout/hooks/useNav.ts @@ -52,7 +52,7 @@ : useUserStoreHook()?.nickname; }); - /** 瑙掕壊 */ + /** 褰撳墠瑙掕壊 */ const userRoles = computed(() => { return useUserStoreHook()?.nowRole; }); diff --git a/src/layout/hooks/useTag.ts b/src/layout/hooks/useTag.ts index 2c40c44..1c2d254 100644 --- a/src/layout/hooks/useTag.ts +++ b/src/layout/hooks/useTag.ts @@ -8,7 +8,6 @@ getCurrentInstance } from "vue"; import type { tagsViewsType } from "../types"; -import { useUserStoreHook } from "@/store/modules/user"; import { useRoute, useRouter } from "vue-router"; import { responsiveStorageNameSpace } from "@/config"; import { useSettingStoreHook } from "@/store/modules/settings"; @@ -43,7 +42,6 @@ // 褰撳墠鍙抽敭閫変腑鐨勮矾鐢变俊鎭� const currentSelect = ref({}); const isScrolling = ref(false); - const hasFlash = useUserStoreHook()?.nowRole.hasFlsh; /** 鏄剧ず妯″紡锛岄粯璁ょ伒鍔ㄦā寮� */ const showModel = ref( diff --git a/src/router/utils.ts b/src/router/utils.ts index d8ef0f7..9137806 100644 --- a/src/router/utils.ts +++ b/src/router/utils.ts @@ -21,6 +21,7 @@ import { userKey, type DataInfo } from "@/utils/auth"; import { type menuType, routerArrays } from "@/layout/types"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; +import { useUserStoreHook } from "@/store/modules/user"; import { usePermissionStoreHook } from "@/store/modules/permission"; const IFrame = () => import("@/layout/frame.vue"); // https://cn.vitejs.dev/guide/features.html#glob-import @@ -387,7 +388,7 @@ usePermissionStoreHook().wholeMenus[0]?.children[0] ); tag && useMultiTagsStoreHook().handleTags("push", topMenu); - console.log(topMenu, "topMenu"); + // console.log(topMenu, "topMenu"); return topMenu; } diff --git a/src/store/modules/multiTags.ts b/src/store/modules/multiTags.ts index 839b8f7..41346b8 100644 --- a/src/store/modules/multiTags.ts +++ b/src/store/modules/multiTags.ts @@ -62,6 +62,8 @@ value?: T | multiType, position?: positionType ): T { + console.log(mode, "--------------",value); + switch (mode) { case "equal": this.multiTags = value; diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 145823a..152e9ec 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -48,8 +48,7 @@ enterpriseInfo: storageLocal().getItem<DataInfo<number>>("enterpriseInfo") ?? {}, nowRole: storageLocal().getItem<DataInfo<number>>("nowRole") ?? {}, - rolesList: storageLocal().getItem<DataInfo<number>>("rolesList") ?? [], - isFlsh: storageLocal().getItem<DataInfo<number>>("isFlsh") ?? false + rolesList: storageLocal().getItem<DataInfo<number>>("rolesList") ?? [] }), actions: { /** 瀛樺偍澶村儚 */ @@ -75,10 +74,6 @@ /** 瀛樺偍瑙掕壊鍒楄〃 */ SET_ROLES_LIST(rolesList: Array<string>) { this.rolesList = rolesList; - }, - /** 褰撳墠瑙掕壊鏄惁瀹℃牳 */ - SET_IS_FLSH(isFlsh: boolean | string) { - this.isFlsh = isFlsh; }, /** 瀛樺偍鎸夐挳绾у埆鏉冮檺 */ SET_PERMS(permissions: Array<string>) { diff --git a/src/views/home/component/myFooter.vue b/src/views/home/component/myFooter.vue index 984ecba..d140ba4 100644 --- a/src/views/home/component/myFooter.vue +++ b/src/views/home/component/myFooter.vue @@ -1,7 +1,7 @@ <template> <div class="myfooter"> <div - class="w-[58%] mx-auto flex justify-between items-center flex-wrap pt-8" + class="w-[68%] mx-auto flex justify-between items-center flex-wrap pt-8" > <div class="flex-1/2"> <span>鍏充簬鎴戜滑锛�</span> diff --git a/src/views/home/component/myHeader.vue b/src/views/home/component/myHeader.vue new file mode 100644 index 0000000..7a63ed1 --- /dev/null +++ b/src/views/home/component/myHeader.vue @@ -0,0 +1,63 @@ +<script setup lang="ts"> +defineOptions({ + name: "MyHeader" +}); +</script> + +<template> + <div class="header"> + <img width="227px" height="74px" src="@/assets/home/logo.png" alt="" /> + <img width="427px" height="74px" src="@/assets/home/Header.png" alt="" /> + <div class="other"> + <div class="item"> + <img width="21px" height="21px" src="@/assets/home/share.png" alt="" /> + <span>鍒嗕韩缃戠珯</span> + </div> + <div class="item"> + <img + width="21px" + height="21px" + src="@/assets/home/BellFilled.png" + alt="" + /> + <span>鎴戠殑娑堟伅</span> + </div> + </div> + </div> +</template> + +<style lang="scss" scoped> +.header { + display: flex; + align-items: center; + justify-content: space-evenly; + height: 80px; + width: 100%; + .middle { + width: 50%; + display: flex; + justify-content: space-around; + color: rgb(51, 51, 51); + font-family: 鎬濇簮榛戜綋; + } + .other { + display: flex; + .item { + display: flex; + justify-content: center; + width: 63px; + height: 48px; + color: rgb(51, 51, 51); + font-family: 鎬濇簮榛戜綋; + font-size: 12px; + font-weight: 400; + line-height: 20px; + letter-spacing: 0%; + text-align: left; + text-transform: capitalize; + flex-wrap: wrap; + margin-right: 10px; + } + } +} +</style> diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 4dd21ac..54ca78d 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,24 +1,6 @@ el <template> - <div class="header"> - <img width="227px" height="74px" src="@/assets/home/logo.png" alt="" /> - <img width="427px" height="74px" src="@/assets/home/Header.png" alt="" /> - <div class="other"> - <div class="item"> - <img width="21px" height="21px" src="@/assets/home/share.png" alt="" /> - <span>鍒嗕韩缃戠珯</span> - </div> - <div class="item"> - <img - width="21px" - height="21px" - src="@/assets/home/BellFilled.png" - alt="" - /> - <span>鎴戠殑娑堟伅</span> - </div> - </div> - </div> + <my-header /> <div class="banner"> <!-- <img width="100%" height="306px" src="@/assets/home/banner.png" alt="" /> --> </div> @@ -395,6 +377,7 @@ <script lang="ts" setup> import { onMounted, ref, computed, reactive } from "vue"; import MyFooter from "./component/myFooter.vue"; +import MyHeader from "./component/myHeader.vue"; import { useUserStoreHook } from "@/store/modules/user"; import { exRole } from "@/api/register/index"; import { storageLocal, isString, isIncludeAllChildren } from "@pureadmin/utils"; @@ -461,39 +444,6 @@ </script> <style lang="scss" scoped> -.header { - display: flex; - align-items: center; - justify-content: space-evenly; - height: 80px; - width: 100%; - .middle { - width: 50%; - display: flex; - justify-content: space-around; - color: rgb(51, 51, 51); - font-family: 鎬濇簮榛戜綋; - } - .other { - display: flex; - .item { - display: flex; - justify-content: center; - width: 63px; - height: 48px; - color: rgb(51, 51, 51); - font-family: 鎬濇簮榛戜綋; - font-size: 12px; - font-weight: 400; - line-height: 20px; - letter-spacing: 0%; - text-align: left; - text-transform: capitalize; - flex-wrap: wrap; - margin-right: 10px; - } - } -} .banner { // left: -3.76px; // top: 80px; diff --git a/src/views/system/dept/form.vue b/src/views/system/dept/form.vue index 98fd3eb..d652539 100644 --- a/src/views/system/dept/form.vue +++ b/src/views/system/dept/form.vue @@ -24,7 +24,7 @@ shifoufenbao: "false", // 鏄惁鍒嗗寘锛堝彲閫夛級 shifoutuisongxuanchuan: "true", // 鏄惁鎺ㄩ�佸浼狅紙鍙�夛級 caigourenmingcheng: null, // 閲囪喘浜哄悕绉帮紙鍙�夛級 - xingzhengquyu: null, // 琛屾斂鍖哄煙锛堝彲閫夛級 + xingzhengquyu: [], // 琛屾斂鍖哄煙锛堝彲閫夛級 xingzhengquyuName: null, // 琛屾斂鍖哄煙鍚嶇О锛堝彲閫夛級 jigoudaima: null, // 鏈烘瀯浠g爜锛堝彲閫夛級 daimaleixing: null, // 浠g爜绫诲瀷锛堝彲閫夛級 @@ -52,7 +52,9 @@ function getRef() { return ruleFormRef.value; } - +const handleChange = value => { + console.log(value); +}; defineExpose({ getRef }); onMounted(async () => {}); </script> @@ -138,15 +140,19 @@ </re-col> <re-col :value="6" :xs="24" :sm="24"> <el-form-item label="瀹氬埗瑙勫垝" prop="dingbiaoguize"> - <el-checkbox-group + <!-- <el-checkbox-group v-model="newFormInline.dingbiaoguize" placeholder="璇烽�夋嫨鐘舵��" clearable class="w-[100%]!" > - <el-checkbox label="鏈�浣庝环" :value="1" /> - <el-checkbox label="缁煎悎璇勫垎" :value="0" /> - </el-checkbox-group> + <el-checkbox label="鏈�浣庝环" value="鏈�浣庝环" /> + <el-checkbox label="缁煎悎璇勫垎" value="缁煎悎璇勫垎" /> + </el-checkbox-group> --> + <el-radio-group v-model="newFormInline.dingbiaoguize"> + <el-radio value="鏈�浣庝环">鏈�浣庝环</el-radio> + <el-radio value="缁煎悎璇勫垎">缁煎悎璇勫垎</el-radio> + </el-radio-group> </el-form-item> </re-col> <re-col :value="6" :xs="24" :sm="24"> @@ -226,14 +232,14 @@ class="w-full" :options="state.regionList" :props="{ - value: 'id', + value: 'code', label: 'name', - emitPath: false, children: 'regions' }" clearable filterable placeholder="璇烽�夋嫨鍖哄煙" + @change="handleChange" /> </el-form-item> </re-col> diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 04b15f4..3470945 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -25,7 +25,11 @@ resetForm, openDialog, handleDelete, - handleSelectionChange + handleSelectionChange, + handleSizeChange, + handleCurrentChange, + pagination, + checkboxAsRadio } = useDept(); function onFullscreen() { @@ -114,9 +118,10 @@ v-model="form.zhiyi" clearable class="w-[100%]!" + @change="checkboxAsRadio(form.zhiyi)" > - <el-checkbox label="鏈�" :value="1" /> - <el-checkbox label="鏃�" :value="0" /> + <el-checkbox label="鏈�" value="true" /> + <el-checkbox label="鏃�" value="false" /> </el-checkbox-group> </el-form-item> </el-col> @@ -126,9 +131,10 @@ v-model="form.tousu" clearable class="w-[100%]!" + @change="checkboxAsRadio(form.tousu)" > - <el-checkbox label="鏈�" :value="1" /> - <el-checkbox label="鏃�" :value="0" /> + <el-checkbox label="鏈�" value="true" /> + <el-checkbox label="鏃�" value="false" /> </el-checkbox-group> </el-form-item> </el-col> @@ -225,15 +231,17 @@ row-key="id" showOverflowTooltip table-layout="auto" - default-expand-all :loading="loading" :data="dataList" :columns="dynamicColumns" + :pagination="{ ...pagination, size }" :header-cell-style="{ background: 'var(--el-fill-color-light)', color: 'var(--el-text-color-primary)' }" @selection-change="handleSelectionChange" + @page-size-change="handleSizeChange" + @page-current-change="handleCurrentChange" > <template #operation="{ row }"> <el-button diff --git a/src/views/system/dept/utils/hook.tsx b/src/views/system/dept/utils/hook.tsx index d11ee6f..70bc46e 100644 --- a/src/views/system/dept/utils/hook.tsx +++ b/src/views/system/dept/utils/hook.tsx @@ -11,6 +11,7 @@ getRegionList, getDaimaleixingList, caigourenAdd, + caigourenUpdate, caigourenDelete } from "@/api/item/index"; import { usePublicHooks } from "../../hooks"; @@ -24,15 +25,15 @@ // 鏂板鏃ユ湡鑼冨洿锛屽彲涓� null锛岀被鍨嬩负鏁扮粍 createDateRange: null, // 琛屾斂鍖哄煙锛屽彲涓� null锛岀被鍨嬩负瀛楃涓� - xingzhengquyu: "", + xingzhengquyu: [], // 琛屼笟鍝佺洰锛屽彲涓� null锛岀被鍨嬩负瀛楃涓� hangyepinmu: "", // 璁㈠崟鐘舵�侊紝鍙负 null锛岀被鍨嬩负 32 浣嶆暣鏁� orderStatus: "", // 璐ㄧ枒鏈夋棤锛屽彲涓� null锛岀被鍨嬩负甯冨皵鍊� - zhiyi: null, + zhiyi: [], // 鎶曡瘔鏈夋棤锛屽彲涓� null锛岀被鍨嬩负甯冨皵鍊� - tousu: null, + tousu: [], // 椤圭洰鍚嶇О锛屽彲涓� null锛岀被鍨嬩负瀛楃涓� projectName: null, // 浠g悊鏈烘瀯鍚嶇О锛屽彲涓� null锛岀被鍨嬩负瀛楃涓� @@ -48,6 +49,12 @@ orderStatusList: [], regionList: [], daimaleixingList: [] + }); + const pagination = reactive<PaginationProps>({ + total: 0, + pageSize: 10, + currentPage: 1, + background: true }); //鑾峰彇閲囪喘鏂瑰紡 const getCaigoufangshiListFun = async () => { @@ -86,7 +93,7 @@ const res = state.orderStatusList.find(item => { return row.orderStatus == item.status; }); - return res.label; + return res?.label; }; const columns: TableColumnList = [ { @@ -155,18 +162,36 @@ function handleSelectionChange(val) { console.log("handleSelectionChange", val); } + function handleSizeChange(val: number) { + console.log(`${val} items per page`); + } + + function handleCurrentChange(val: number) { + console.log(`current page: ${val}`); + } function resetForm(formEl) { if (!formEl) return; formEl.resetFields(); onSearch(); } - + const checkboxAsRadio = data => { + if (data.length > 1) { + data.shift(); + } + }; async function onSearch() { loading.value = true; - const { result } = await zhaobiaoPageOrder(form); // 杩欓噷鏄繑鍥炰竴缁存暟缁勭粨鏋勶紝鍓嶇鑷澶勭悊鎴愭爲缁撴瀯锛岃繑鍥炴牸寮忚姹傦細鍞竴id鍔犵埗鑺傜偣parentId锛宲arentId鍙栫埗鑺傜偣id + const obj = cloneDeep(form); + obj.tousu = obj.tousu.join(""); + obj.zhiyi = obj.zhiyi.join(""); + obj.xingzhengquyu = obj.xingzhengquyu.join(""); + const { result } = await zhaobiaoPageOrder(obj); // 杩欓噷鏄繑鍥炰竴缁存暟缁勭粨鏋勶紝鍓嶇鑷澶勭悊鎴愭爲缁撴瀯锛岃繑鍥炴牸寮忚姹傦細鍞竴id鍔犵埗鑺傜偣parentId锛宲arentId鍙栫埗鑺傜偣id const newData = result.items; loading.value = false; + pagination.total = result.total; + pagination.pageSize = result.pageSize; + pagination.currentPage = result.page; // if (!isAllEmpty(form.name)) { // // 鍓嶇鎼滅储閮ㄩ棬鍚嶇О // newData = newData.filter(item => item.name.includes(form.name)); @@ -209,7 +234,7 @@ shifoufenbao: row?.shifoufenbao ?? false, // 鏄惁鍒嗗寘锛堝彲閫夛級 shifoutuisongxuanchuan: row?.shifoutuisongxuanchuan ?? true, // 鏄惁鎺ㄩ�佸浼狅紙鍙�夛級 caigourenmingcheng: row?.caigourenmingcheng ?? null, // 閲囪喘浜哄悕绉帮紙鍙�夛級 - xingzhengquyu: row?.xingzhengquyu ?? null, // 琛屾斂鍖哄煙锛堝彲閫夛級 + xingzhengquyu: row?.xingzhengquyu.split(",") ?? [], // 琛屾斂鍖哄煙锛堝彲閫夛級 xingzhengquyuName: row?.xingzhengquyuName ?? null, // 琛屾斂鍖哄煙鍚嶇О锛堝彲閫夛級 jigoudaima: row?.jigoudaima ?? null, // 鏈烘瀯浠g爜锛堝彲閫夛級 daimaleixing: row?.daimaleixing ?? null, // 浠g爜绫诲瀷锛堝彲閫夛級 @@ -237,12 +262,19 @@ contentRenderer: () => h(editForm, { ref: formRef, formInline: null }), beforeSure: (done, { options }) => { const FormRef = formRef.value.getRef(); - const curData = options.props.formInline as FormItemProps; + const curData = cloneDeep(options.props.formInline as FormItemProps); async function chores() { message(`鎮�${title}浜嗛」鐩悕绉颁负${curData.projectName}鐨勮繖鏉℃暟鎹甡, { type: "success" }); - const res = await caigourenAdd(curData); + // curData.dingbiaoguize = curData.dingbiaoguize.join(""); + curData.xingzhengquyu = curData.xingzhengquyu.join(","); + let res; + if (title == "鏂板") { + res = await caigourenAdd(curData); + } else { + res = await caigourenUpdate(curData); + } if (res.code == "200") { done(); // 鍏抽棴寮规 onSearch(); // 鍒锋柊琛ㄦ牸鏁版嵁 @@ -306,6 +338,10 @@ openDialog, /** 鍒犻櫎閮ㄩ棬 */ handleDelete, - handleSelectionChange + handleSelectionChange, + handleSizeChange, + handleCurrentChange, + pagination, + checkboxAsRadio }; } -- Gitblit v1.9.1