From 331f438f99f6b699ba84544ee6da0950af83b90e Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Fri, 11 Apr 2025 15:50:15 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E5=90=8C=E6=AD=A5=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/inventory/classification/index.vue | 9 +++ .../inventory/consumables/config/content.ts | 7 +++ src/views/inventory/consumables/index.vue | 28 +++++++++- src/views/inventory/supplier/index.vue | 10 +++- src/views/product/index.vue | 5 +- .../indexconfig/SpecificationAttribute.vue | 18 +++--- src/views/product/indexconfig/addgoods.vue | 55 +++++++++++-------- src/views/product/indexconfig/content.ts | 2 +- 8 files changed, 95 insertions(+), 39 deletions(-) diff --git a/src/views/inventory/classification/index.vue b/src/views/inventory/classification/index.vue index 565a1ea..2a3cbcf 100644 --- a/src/views/inventory/classification/index.vue +++ b/src/views/inventory/classification/index.vue @@ -71,6 +71,7 @@ import contentConfig from "./config/content"; import editModalConfig from "./config/edit"; import searchConfig from "./config/search"; import { returnOptionsLabel } from "./config/config"; +import { isSyncStatus } from "@/utils/index"; const { searchRef, @@ -87,6 +88,14 @@ const { handleFilterChange, } = usePage(); +if (isSyncStatus()) { + if( JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1){ + contentConfig.toolbar?.splice(0, 1) + } + if( JSON.stringify(contentConfig.cols[contentConfig.cols.length-1].operat)?.indexOf("edit") != -1){ + contentConfig.cols[contentConfig.cols.length-1].operat?.splice(0, 1) + } +} // 新增 async function handleAddClick() { addModalRef.value?.setModalVisible(); diff --git a/src/views/inventory/consumables/config/content.ts b/src/views/inventory/consumables/config/content.ts index 0dc52a2..ab6e6a7 100644 --- a/src/views/inventory/consumables/config/content.ts +++ b/src/views/inventory/consumables/config/content.ts @@ -29,6 +29,13 @@ const contentConfig: IContentConfig = { pk: "id", toolbar: [ "add", + { + icon: "refresh", + text: "同步", + type: "danger", + name: "sync", + auth: "import", + }, { text: "入库", name: "ruku", diff --git a/src/views/inventory/consumables/index.vue b/src/views/inventory/consumables/index.vue index 114b26d..f546e37 100644 --- a/src/views/inventory/consumables/index.vue +++ b/src/views/inventory/consumables/index.vue @@ -64,7 +64,7 @@ justify-content: center; align-items: center; "> - 编辑 + 编辑 耗材盘点 @@ -89,12 +89,16 @@ import addHaocai from "./components/add-haocai.vue"; import dataTongji from "./components/DataStatistics.vue"; import addConsTakin from "./components/addConsTakin.vue"; import consApi from "@/api/product/cons"; +import UserAPI from "@/api/product/index"; + import type { IObject, IOperatData } from "@/components/CURD/types"; import usePage from "@/components/CURD/usePage"; import contentConfig from "./config/content"; import editModalConfig from "./config/edit"; import searchConfig from "./config/search"; import { returnOptionsLabel } from "./config/config"; +import { isSyncStatus } from "@/utils/index"; + const router = useRouter(); const { searchRef, @@ -121,7 +125,20 @@ if (conName) { searchConfig.formItems[1].initialValue = conName; } } - +console.log(isSyncStatus()) +console.log(contentConfig) +if (isSyncStatus()) { + if( JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1){ + contentConfig.toolbar?.splice(0, 1) + } + if( JSON.stringify(contentConfig.cols[contentConfig.cols.length-1].operat)?.indexOf("delete") != -1){ + contentConfig.cols[contentConfig.cols.length-1].operat?.splice(2, 1) + } +}else { + if( JSON.stringify(contentConfig.toolbar)?.indexOf("sync") != -1){ + contentConfig.toolbar?.splice(1, 1) + } +} //统计数据 const gongjiData = reactive({ totalRow: 0 }); function getTongji(params: IObject | undefined) { @@ -189,8 +206,13 @@ async function handleEditClick(row: IObject) { editModalRef.value?.setFormData({ ...row, url: [row.url] }); } // 其他工具栏 -function handleToolbarClick(name: string) { +async function handleToolbarClick(name: string) { console.log(name); + if( name === 'sync' ){ + let res = await UserAPI.sync() + ElMessage.success('操作成功,数据正在后台同步中...') + return; + } if (name === "category") { router.push({ path: "/inventory/classification" }); return; diff --git a/src/views/inventory/supplier/index.vue b/src/views/inventory/supplier/index.vue index 565a1ea..1b69dd9 100644 --- a/src/views/inventory/supplier/index.vue +++ b/src/views/inventory/supplier/index.vue @@ -71,6 +71,7 @@ import contentConfig from "./config/content"; import editModalConfig from "./config/edit"; import searchConfig from "./config/search"; import { returnOptionsLabel } from "./config/config"; +import { isSyncStatus } from "@/utils/index"; const { searchRef, @@ -86,7 +87,14 @@ const { handleSearchClick, handleFilterChange, } = usePage(); - +if (isSyncStatus()) { + if( JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1){ + contentConfig.toolbar?.splice(0, 1) + } + if( JSON.stringify(contentConfig.cols[contentConfig.cols.length-1].operat)?.indexOf("edit") != -1){ + contentConfig.cols[contentConfig.cols.length-1].operat?.splice(0, 1) + } +} // 新增 async function handleAddClick() { addModalRef.value?.setModalVisible(); diff --git a/src/views/product/index.vue b/src/views/product/index.vue index f700cab..7e7c056 100644 --- a/src/views/product/index.vue +++ b/src/views/product/index.vue @@ -208,7 +208,7 @@ if (isSyncStatus()) { contentConfig.cols[contentConfig.cols.length-1].operat?.splice(2, 1) } }else { - if( JSON.stringify(contentConfig.toolbar)?.indexOf("custom2") != -1){ + if( JSON.stringify(contentConfig.toolbar)?.indexOf("sync") != -1){ contentConfig.toolbar?.splice(1, 1) } } @@ -328,10 +328,9 @@ async function handleToolbarClick(name: string) { // ElMessage.success("点击了自定义1按钮"); myDialogRef.value.open(); } - if ( name === "custom2" ) { //商品同步 + if ( name === "sync" ) { //商品同步 let res = await UserAPI.sync() ElMessage.success('操作成功,数据正在后台同步中...') - console.log(res) } } async function confirm() { diff --git a/src/views/product/indexconfig/SpecificationAttribute.vue b/src/views/product/indexconfig/SpecificationAttribute.vue index 2b1b71f..a5ce69b 100644 --- a/src/views/product/indexconfig/SpecificationAttribute.vue +++ b/src/views/product/indexconfig/SpecificationAttribute.vue @@ -14,7 +14,7 @@ + @blur="priceFormat(scope.row, 'salePrice')" controls-position="right" :disabled="isSyncStatus()"> @@ -26,7 +26,7 @@ + @blur="priceFormat(scope.row, 'originPrice')" controls-position="right" :disabled="isSyncStatus()"> @@ -38,7 +38,7 @@ + @blur="priceFormat(scope.row, 'costPrice')" controls-position="right" :disabled="isSyncStatus()"> @@ -51,7 +51,7 @@ + @blur="priceFormat(scope.row, 'memberPrice')" controls-position="right" :disabled="isSyncStatus()"> @@ -64,9 +64,9 @@ + v-if="props.info.type == 'weigh'" :disabled="isSyncStatus()"> + @blur="priceFormat(scope.row, 'suitNum')" :min="1" controls-position="right" :disabled="isSyncStatus()" v-else> @@ -77,7 +77,7 @@ + controls-position="right" style="width: 100%" :disabled="isSyncStatus()"> @@ -93,6 +93,8 @@ \ No newline at end of file + diff --git a/src/views/product/indexconfig/addgoods.vue b/src/views/product/indexconfig/addgoods.vue index 8951c69..25139c0 100644 --- a/src/views/product/indexconfig/addgoods.vue +++ b/src/views/product/indexconfig/addgoods.vue @@ -4,21 +4,21 @@ - + - + - + @@ -27,7 +27,7 @@ - + @@ -54,7 +54,7 @@ - + 单规格商品 多规格商品 套餐商品 @@ -65,7 +65,7 @@ - + 固定套餐 可选套餐 @@ -82,13 +82,13 @@ - 添加商品 + 添加商品 - 设置规格 删除 + @click="ruleForm.proGroupVo[index].goods.splice(scope.$index, 1)" >删除 @@ -97,13 +97,13 @@ - + - + - 删除 + 删除 @@ -113,29 +113,29 @@ - + - 添加商品 + 添加商品 - 设置规格 删除 + @click="ruleForm.proGroupVo[index].goods.splice(scope.$index, 1)" :disabled="isSyncStatus()">删除 - 添加套餐组 + 添加套餐组 - + @@ -157,7 +157,7 @@ - + 千克 @@ -165,7 +165,7 @@ - + 允许 不允许 @@ -198,7 +198,7 @@ - + 注:关闭则不计算出入库数据 @@ -211,7 +211,7 @@ - + 单份商品打包费。注:店铺开启外卖模式下该数据才生效 @@ -251,6 +251,7 @@ import { reactive, ref } from 'vue' import type { FormInstance, FormRules } from 'element-plus' // 规格属性 import SpecificationAttribute from './SpecificationAttribute.vue' +import { isSyncStatus } from "@/utils/index"; import UserAPI from "@/api/product/productclassification"; import UserAPI2 from "@/api/product/commonUnits"; import UserAPI3 from "@/api/product/index"; @@ -492,6 +493,10 @@ function selectSkuHandle(item: any, index: number) { // } } function addimgEvent() { + if( isSyncStatus() ){ + ElMessage.error('当前同步启用状态下不可修改') + return + } (addImg.value as any)?.show() } // 确认套餐商品设置规格 @@ -521,6 +526,10 @@ function addgoods(index: number = -1) { (shopListRef.value as any)?.opens() } function deleteEvent(d: any) { + if( isSyncStatus() ){ + ElMessage.error('当前同步启用状态下不可修改') + return + } let index = ruleForm.images.findIndex((ele) => ele == d); ruleForm.images.splice(index, 1); } @@ -915,4 +924,4 @@ const resetForm = (formEl: FormInstance | undefined) => { top: -10px; z-index: 10; } - \ No newline at end of file + diff --git a/src/views/product/indexconfig/content.ts b/src/views/product/indexconfig/content.ts index 9598603..433bb17 100644 --- a/src/views/product/indexconfig/content.ts +++ b/src/views/product/indexconfig/content.ts @@ -63,7 +63,7 @@ const contentConfig: IContentConfig = { icon: "refresh", text: "同步", type: "danger", - name: "custom2", + name: "sync", auth: "import", }, { From 53fdd79a2e1c736b6207503133c2c3099f376e64 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Fri, 11 Apr 2025 16:48:06 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20crud=E7=BB=84=E4=BB=B6=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=93=8D=E4=BD=9C=E6=A0=8F=E5=92=8C=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B6=E9=83=A8=E6=93=8D=E4=BD=9C=E6=A0=8F=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?hidden=E9=9A=90=E8=97=8F=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CURD/PageContent.vue | 93 +++++++++++++++-------------- src/components/CURD/types.ts | 2 + 2 files changed, 51 insertions(+), 44 deletions(-) diff --git a/src/components/CURD/PageContent.vue b/src/components/CURD/PageContent.vue index 1c93275..2a81b02 100644 --- a/src/components/CURD/PageContent.vue +++ b/src/components/CURD/PageContent.vue @@ -55,6 +55,7 @@ - - {{ item.text }} - - - + {{ item.text }} - - - - {{ opt.label }} - - - - + + + + {{ item.text }} + + + + + {{ opt.label }} + + + + + diff --git a/src/components/CURD/types.ts b/src/components/CURD/types.ts index 6086710..d1f97b4 100644 --- a/src/components/CURD/types.ts +++ b/src/components/CURD/types.ts @@ -148,6 +148,7 @@ export interface IContentConfig { icon?: string; name: string; text: string; + hidden?: boolean; type?: "primary" | "success" | "warning" | "danger" | "info"; } >; @@ -215,6 +216,7 @@ export interface IContentConfig { name: string; text: string; isBtn?: boolean; + hidden?: boolean; type?: "primary" | "success" | "warning" | "danger" | "info"; render?: (row: IObject) => boolean; options?: { From c956972cb34fe3e5b2da673b7837ad844da5380b Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Fri, 11 Apr 2025 16:53:14 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat:=20=E5=90=8C=E6=AD=A5=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/user.ts | 1 + src/views/product/index.vue | 23 +++++++++++++---------- src/views/product/indexconfig/content.ts | 8 +++++++- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/api/system/user.ts b/src/api/system/user.ts index 223ad79..4cbd9df 100644 --- a/src/api/system/user.ts +++ b/src/api/system/user.ts @@ -246,6 +246,7 @@ export interface UserInfo { * 用户分页查询对象 */ export interface UserPageQuery extends PageQuery { + times: any; /** 搜索关键字 */ keywords?: string; diff --git a/src/views/product/index.vue b/src/views/product/index.vue index 7e7c056..d38bc3f 100644 --- a/src/views/product/index.vue +++ b/src/views/product/index.vue @@ -200,18 +200,21 @@ let datas = reactive({ remark: "", images: [] }); +console.log(isSyncStatus()) +console.log(contentConfig.toolbar) if (isSyncStatus()) { - if( JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1){ - contentConfig.toolbar?.splice(0, 1) + if (JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1) { + // contentConfig.toolbar?.splice(0, 1) } - if( JSON.stringify(contentConfig.cols[contentConfig.cols.length-1].operat)?.indexOf("delete") != -1){ - contentConfig.cols[contentConfig.cols.length-1].operat?.splice(2, 1) + if (JSON.stringify(contentConfig.cols[contentConfig.cols.length - 1].operat)?.indexOf("delete") != -1) { + contentConfig.cols[contentConfig.cols.length - 1].operat?.splice(2, 1) } -}else { - if( JSON.stringify(contentConfig.toolbar)?.indexOf("sync") != -1){ - contentConfig.toolbar?.splice(1, 1) +} else { + if (JSON.stringify(contentConfig.toolbar)?.indexOf("sync") != -1) { + // contentConfig.toolbar?.splice(1, 1) } } +console.log(contentConfig.toolbar) onMounted(() => { console.log(route.query); @@ -220,7 +223,7 @@ onMounted(() => { } // 获取耗材列表 gethaocaiList() - + }); function newHandleQueryClick(e: IObject | undefined) { const filterParams = contentRef.value?.getFilterParams(); @@ -324,11 +327,11 @@ async function handleEditClick(row: IObject) { // 其他工具栏 async function handleToolbarClick(name: string) { console.log(name); - if ( name === "custom1" ) { + if (name === "custom1") { // ElMessage.success("点击了自定义1按钮"); myDialogRef.value.open(); } - if ( name === "sync" ) { //商品同步 + if (name === "sync") { //商品同步 let res = await UserAPI.sync() ElMessage.success('操作成功,数据正在后台同步中...') } diff --git a/src/views/product/indexconfig/content.ts b/src/views/product/indexconfig/content.ts index 433bb17..fd7bc20 100644 --- a/src/views/product/indexconfig/content.ts +++ b/src/views/product/indexconfig/content.ts @@ -58,7 +58,13 @@ const contentConfig: IContentConfig = { }, pk: "id", toolbar: [ - "add", + { + icon: "plus", + text: "新增", + type: "primary", + name: "add", + auth: "import", + }, { icon: "refresh", text: "同步", From 688f30635b037ef82927eb4c668906c7924c0045 Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Fri, 11 Apr 2025 17:25:02 +0800 Subject: [PATCH 4/6] =?UTF-8?q?feat:=20=E5=90=8C=E6=AD=A5=E8=A7=84?= =?UTF-8?q?=E5=88=99=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classification/config/content.ts | 12 ++++++++-- src/views/inventory/classification/index.vue | 12 +++++----- .../inventory/consumables/config/content.ts | 8 ++++++- src/views/inventory/consumables/index.vue | 22 ++++++++----------- .../inventory/supplier/config/content.ts | 12 ++++++++-- src/views/inventory/supplier/index.vue | 15 ++++++++----- src/views/product/index.vue | 19 ++++++---------- src/views/product/indexconfig/content.ts | 2 +- 8 files changed, 59 insertions(+), 43 deletions(-) diff --git a/src/views/inventory/classification/config/content.ts b/src/views/inventory/classification/config/content.ts index f1a4aed..51e900a 100644 --- a/src/views/inventory/classification/config/content.ts +++ b/src/views/inventory/classification/config/content.ts @@ -20,7 +20,15 @@ const contentConfig: IContentConfig = { return Api.edit(data); }, pk: "id", - toolbar: ["add"], + toolbar: [ + { + icon: "plus", + text: "新增", + type: "primary", + name: "add", + auth: "import", + }, + ], defaultToolbar: ["refresh", "filter", "search"], cols: [ // { type: "selection", width: 50, align: "center" }, @@ -49,7 +57,7 @@ const contentConfig: IContentConfig = { fixed: "right", width: 280, templet: "tool", - operat: ["edit"], + operat: [{ text: "编辑", icon: 'edit', name: "edit"}], }, ], }; diff --git a/src/views/inventory/classification/index.vue b/src/views/inventory/classification/index.vue index 2a3cbcf..7550184 100644 --- a/src/views/inventory/classification/index.vue +++ b/src/views/inventory/classification/index.vue @@ -89,13 +89,13 @@ const { } = usePage(); if (isSyncStatus()) { - if( JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1){ - contentConfig.toolbar?.splice(0, 1) - } - if( JSON.stringify(contentConfig.cols[contentConfig.cols.length-1].operat)?.indexOf("edit") != -1){ - contentConfig.cols[contentConfig.cols.length-1].operat?.splice(0, 1) - } + contentConfig.toolbar[0].hidden = true + contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = true +} else { + contentConfig.toolbar[0].hidden = false + contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = false } + // 新增 async function handleAddClick() { addModalRef.value?.setModalVisible(); diff --git a/src/views/inventory/consumables/config/content.ts b/src/views/inventory/consumables/config/content.ts index ab6e6a7..6a42968 100644 --- a/src/views/inventory/consumables/config/content.ts +++ b/src/views/inventory/consumables/config/content.ts @@ -28,7 +28,13 @@ const contentConfig: IContentConfig = { indexActionData: {}, pk: "id", toolbar: [ - "add", + { + icon: "plus", + text: "新增", + type: "primary", + name: "add", + auth: "import", + }, { icon: "refresh", text: "同步", diff --git a/src/views/inventory/consumables/index.vue b/src/views/inventory/consumables/index.vue index f546e37..9e5954d 100644 --- a/src/views/inventory/consumables/index.vue +++ b/src/views/inventory/consumables/index.vue @@ -125,20 +125,16 @@ if (conName) { searchConfig.formItems[1].initialValue = conName; } } -console.log(isSyncStatus()) -console.log(contentConfig) + if (isSyncStatus()) { - if( JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1){ - contentConfig.toolbar?.splice(0, 1) - } - if( JSON.stringify(contentConfig.cols[contentConfig.cols.length-1].operat)?.indexOf("delete") != -1){ - contentConfig.cols[contentConfig.cols.length-1].operat?.splice(2, 1) - } -}else { - if( JSON.stringify(contentConfig.toolbar)?.indexOf("sync") != -1){ - contentConfig.toolbar?.splice(1, 1) - } + contentConfig.toolbar[0].hidden = true + contentConfig.toolbar[1].hidden = false +} else { + contentConfig.toolbar[0].hidden = false + contentConfig.toolbar[1].hidden = true } + + //统计数据 const gongjiData = reactive({ totalRow: 0 }); function getTongji(params: IObject | undefined) { @@ -208,7 +204,7 @@ async function handleEditClick(row: IObject) { // 其他工具栏 async function handleToolbarClick(name: string) { console.log(name); - if( name === 'sync' ){ + if (name === 'sync') { let res = await UserAPI.sync() ElMessage.success('操作成功,数据正在后台同步中...') return; diff --git a/src/views/inventory/supplier/config/content.ts b/src/views/inventory/supplier/config/content.ts index 81ac465..f2c3d1d 100644 --- a/src/views/inventory/supplier/config/content.ts +++ b/src/views/inventory/supplier/config/content.ts @@ -23,7 +23,15 @@ const contentConfig: IContentConfig = { return Api.edit(data); }, pk: "id", - toolbar: ["add"], + toolbar: [ + { + icon: "plus", + text: "新增", + type: "primary", + name: "add", + auth: "import", + }, + ], defaultToolbar: ["refresh", "filter", "search"], cols: [ // { type: "selection", width: 50, align: "center" }, @@ -71,7 +79,7 @@ const contentConfig: IContentConfig = { fixed: "right", width: 280, templet: "tool", - operat: ["edit", "delete"], + operat: [{ text: "编辑", icon: 'edit', name: "edit"}, { text: "删除", icon: 'delete', type: 'danger', name: "delete"}], }, ], }; diff --git a/src/views/inventory/supplier/index.vue b/src/views/inventory/supplier/index.vue index 1b69dd9..990c84a 100644 --- a/src/views/inventory/supplier/index.vue +++ b/src/views/inventory/supplier/index.vue @@ -87,14 +87,17 @@ const { handleSearchClick, handleFilterChange, } = usePage(); + if (isSyncStatus()) { - if( JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1){ - contentConfig.toolbar?.splice(0, 1) - } - if( JSON.stringify(contentConfig.cols[contentConfig.cols.length-1].operat)?.indexOf("edit") != -1){ - contentConfig.cols[contentConfig.cols.length-1].operat?.splice(0, 1) - } + contentConfig.toolbar[0].hidden = true + contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = true + contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = true +} else { + contentConfig.toolbar[0].hidden = false + contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = false + contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = false } + // 新增 async function handleAddClick() { addModalRef.value?.setModalVisible(); diff --git a/src/views/product/index.vue b/src/views/product/index.vue index d38bc3f..60b0a14 100644 --- a/src/views/product/index.vue +++ b/src/views/product/index.vue @@ -200,21 +200,16 @@ let datas = reactive({ remark: "", images: [] }); -console.log(isSyncStatus()) -console.log(contentConfig.toolbar) + if (isSyncStatus()) { - if (JSON.stringify(contentConfig.toolbar)?.indexOf("add") != -1) { - // contentConfig.toolbar?.splice(0, 1) - } - if (JSON.stringify(contentConfig.cols[contentConfig.cols.length - 1].operat)?.indexOf("delete") != -1) { - contentConfig.cols[contentConfig.cols.length - 1].operat?.splice(2, 1) - } + contentConfig.toolbar[0].hidden = true + contentConfig.toolbar[1].hidden = false + contentConfig.cols[contentConfig.cols.length - 1].operat[2].hidden = true } else { - if (JSON.stringify(contentConfig.toolbar)?.indexOf("sync") != -1) { - // contentConfig.toolbar?.splice(1, 1) - } + contentConfig.toolbar[0].hidden = false + contentConfig.toolbar[1].hidden = true + contentConfig.cols[contentConfig.cols.length - 1].operat[2].hidden = false } -console.log(contentConfig.toolbar) onMounted(() => { console.log(route.query); diff --git a/src/views/product/indexconfig/content.ts b/src/views/product/indexconfig/content.ts index fd7bc20..af20a78 100644 --- a/src/views/product/indexconfig/content.ts +++ b/src/views/product/indexconfig/content.ts @@ -120,7 +120,7 @@ const contentConfig: IContentConfig = { fixed: "right", width: 280, templet: "tool", - operat: [{ text: "报损" }, "edit", "delete"], + operat: [{ text: "报损", name: ''}, { text: "编辑", icon: 'edit', name: "edit"}, { text: "删除", icon: 'delete', type: 'danger', name: "delete"}], }, ], }; From cc13161f167011e3cba7db557774f3f4c2a1a512 Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Fri, 11 Apr 2025 17:57:35 +0800 Subject: [PATCH 5/6] =?UTF-8?q?feat:=20=20=20=E5=95=86=E5=93=81=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E8=A7=84=E5=88=99=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/login/index.vue | 2 +- src/views/online-shop/goods-group.vue | 14 ++++++++++++++ .../online-shop/goodsGroupconfig/content.ts | 2 +- src/views/product/category.vue | 12 ++++++++++++ src/views/product/categoryconfig/content.ts | 12 ++++++++++-- src/views/product/specifications.vue | 16 ++++++++++++---- .../product/specificationsconfig/content.ts | 8 +++++++- src/views/product/unit.vue | 11 +++++++++++ src/views/product/unitconfig/content.ts | 10 ++++++++-- 9 files changed, 76 insertions(+), 11 deletions(-) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 5b1a3f2..907a06a 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -172,7 +172,7 @@ function handleLogin() { setDouyinToken(checkInfo.userInfo.token); }); localStorage.removeItem("shopName") - + let resData = await $API_login.getPermission() const { path, queryParams } = parseRedirect(); console.log(path, queryParams); diff --git a/src/views/online-shop/goods-group.vue b/src/views/online-shop/goods-group.vue index 9e8e0b6..6ffa921 100644 --- a/src/views/online-shop/goods-group.vue +++ b/src/views/online-shop/goods-group.vue @@ -176,6 +176,8 @@ import searchConfig from "./goodsGroupconfig/search"; import searchConfig2 from "./goodsGroupconfig/search2"; import myDialog from '@/components/mycomponents/myDialog.vue' import selectGoodslist from "./goodsGroupconfig/selectGoodslist.vue" +import { isSyncStatus } from "@/utils/index"; + const { searchRef, searchRefs, @@ -194,6 +196,18 @@ const { handleFilterChange, } = usePage(); +if (isSyncStatus()) { + contentConfig.toolbar[0].hidden = true + contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = true + contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = true + contentConfig.cols[3].templet = "custom" +} else { + contentConfig.toolbar[0].hidden = false + contentConfig.cols[3].templet = "switch" + contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = false + contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = false +} + let switchref = ref(false) // 新增 diff --git a/src/views/online-shop/goodsGroupconfig/content.ts b/src/views/online-shop/goodsGroupconfig/content.ts index d17c42e..5d7d7c1 100644 --- a/src/views/online-shop/goodsGroupconfig/content.ts +++ b/src/views/online-shop/goodsGroupconfig/content.ts @@ -73,7 +73,7 @@ const contentConfig: IContentConfig = { fixed: "right", width: 280, templet: "tool", - operat: ["edit", "delete"], + operat: [{ text: "编辑", icon: 'edit', name: "edit"}, { text: "删除", icon: 'delete', type: 'danger', name: "delete"}], }, ], }; diff --git a/src/views/product/category.vue b/src/views/product/category.vue index 6546862..0666d76 100644 --- a/src/views/product/category.vue +++ b/src/views/product/category.vue @@ -95,6 +95,7 @@ import contentConfig from "./categoryconfig/content"; import contentConfig2 from "./categoryconfig/content2"; import editModalConfig from "./categoryconfig/edit"; import searchConfig from "./categoryconfig/search"; +import { isSyncStatus } from "@/utils/index"; const { searchRef, @@ -111,6 +112,17 @@ const { handleFilterChange, } = usePage(); +if (isSyncStatus()) { + contentConfig.toolbar[0].hidden = true + contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = true + contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = true + contentConfig.cols[2].templet = "custom" +} else { + contentConfig.toolbar[0].hidden = false + contentConfig.cols[2].templet = "switch" + contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = false + contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = false +} // 新增 async function handleAddClick() { addModalRef.value?.setModalVisible(); diff --git a/src/views/product/categoryconfig/content.ts b/src/views/product/categoryconfig/content.ts index 4740b7a..a563187 100644 --- a/src/views/product/categoryconfig/content.ts +++ b/src/views/product/categoryconfig/content.ts @@ -44,7 +44,15 @@ const contentConfig: IContentConfig = { // return res.list; // }, pk: "id", - toolbar: ["add"], + toolbar: [ + { + icon: "plus", + text: "新增", + type: "primary", + name: "add", + auth: "import", + }, + ], cols: [ // { type: "selection", width: 50, align: "center" }, { label: "分类名称", align: "center", prop: "name" }, @@ -68,7 +76,7 @@ const contentConfig: IContentConfig = { fixed: "right", width: 280, templet: "tool", - operat: ["edit", "delete"], + operat: [{ text: "编辑", icon: 'edit', name: "edit"}, { text: "删除", icon: 'delete', type: 'danger', name: "delete"}], }, ], }; diff --git a/src/views/product/specifications.vue b/src/views/product/specifications.vue index 6f9ae41..f907128 100644 --- a/src/views/product/specifications.vue +++ b/src/views/product/specifications.vue @@ -29,10 +29,10 @@ - 添加下一级 - 编辑 - 删除 + 编辑 + 删除 @@ -123,6 +123,8 @@ import contentConfig2 from "./specificationsconfig/content2"; import editModalConfig from "./specificationsconfig/edit"; import searchConfig from "./specificationsconfig/search"; import { pid } from "process"; +import { isSyncStatus } from "@/utils/index"; + const validateSku1 = (rule, value, callback) => { if (!datas.skuForm.label) { callback(new Error(' ')) @@ -190,6 +192,12 @@ let datas = reactive({ addchilderinfo: {} }) let myDialogRef = ref(null) +if (isSyncStatus()) { + contentConfig.toolbar[0].hidden = true +} else { + contentConfig.toolbar[0].hidden = false +} + function subitgood() { skuForm.value.validate(async valid => { if (valid) { @@ -381,4 +389,4 @@ const isA = ref(true); margin-left: 10px; vertical-align: bottom; } - \ No newline at end of file + diff --git a/src/views/product/specificationsconfig/content.ts b/src/views/product/specificationsconfig/content.ts index ebdba47..a3e646e 100644 --- a/src/views/product/specificationsconfig/content.ts +++ b/src/views/product/specificationsconfig/content.ts @@ -41,7 +41,13 @@ const contentConfig: IContentConfig = { // }, pk: "id", toolbar: [ - "add", + { + icon: "plus", + text: "新增", + type: "primary", + name: "add", + auth: "import", + }, ], cols: [ // { type: "selection", width: 50, align: "center" }, diff --git a/src/views/product/unit.vue b/src/views/product/unit.vue index e545093..0118650 100644 --- a/src/views/product/unit.vue +++ b/src/views/product/unit.vue @@ -61,6 +61,7 @@ import contentConfig from "./unitconfig/content"; import contentConfig2 from "./unitconfig/content2"; import editModalConfig from "./unitconfig/edit"; import searchConfig from "./unitconfig/search"; +import { isSyncStatus } from "@/utils/index"; const { searchRef, @@ -77,6 +78,16 @@ const { handleFilterChange, } = usePage(); +if (isSyncStatus()) { + contentConfig.toolbar[0].hidden = true + contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = true + contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = true +} else { + contentConfig.toolbar[0].hidden = false + contentConfig.cols[contentConfig.cols.length - 1].operat[0].hidden = false + contentConfig.cols[contentConfig.cols.length - 1].operat[1].hidden = false +} + // 新增 async function handleAddClick() { addModalRef.value?.setModalVisible(); diff --git a/src/views/product/unitconfig/content.ts b/src/views/product/unitconfig/content.ts index 035d12a..0a5c63c 100644 --- a/src/views/product/unitconfig/content.ts +++ b/src/views/product/unitconfig/content.ts @@ -38,7 +38,13 @@ const contentConfig: IContentConfig = { }, pk: "id", toolbar: [ - "add", + { + icon: "plus", + text: "新增", + type: "primary", + name: "add", + auth: "import", + }, ], cols: [ // { type: "selection", width: 50, align: "center" }, @@ -50,7 +56,7 @@ const contentConfig: IContentConfig = { fixed: "right", width: 280, templet: "tool", - operat: ["edit", "delete"], + operat: [{ text: "编辑", icon: 'edit', name: "edit"}, { text: "删除", icon: 'delete', type: 'danger', name: "delete"}], }, ], }; From b92f39fe8997f4319ce11bff0d7f95b9d234c6d1 Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Fri, 11 Apr 2025 18:26:10 +0800 Subject: [PATCH 6/6] =?UTF-8?q?feat:=20=20=E5=A2=9E=E5=8A=A0=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Sidebar/components/SidebarLogo.vue | 2 +- src/utils/index.ts | 13 +++++++++++++ src/views/application/marketing/coupon/list.vue | 4 ++++ src/views/login/index.vue | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/layout/components/Sidebar/components/SidebarLogo.vue b/src/layout/components/Sidebar/components/SidebarLogo.vue index 8a8bd70..9878d02 100644 --- a/src/layout/components/Sidebar/components/SidebarLogo.vue +++ b/src/layout/components/Sidebar/components/SidebarLogo.vue @@ -43,7 +43,7 @@ async function geiShopList() { state.branchList = res; if (!localStorage.getItem("shopName")) { state.shopName = state.branchList[0].shopName - localStorage.setItem("branch_shopId", data.shopInfo.id) + localStorage.setItem("branch_shopId", state.branchList[0].id) localStorage.setItem("shopName", state.branchList[0].shopName) } else { state.shopName = localStorage.getItem("shopName") diff --git a/src/utils/index.ts b/src/utils/index.ts index f17566b..3697fb7 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -129,3 +129,16 @@ export function isSyncStatus() { return false } } + +/** + * 判断是否有某权限 + */ +export function hasPermission(params: any) { + let $PermissionObj = JSON.parse(localStorage.getItem("permission") || '[]' ) + const obj = $PermissionObj.find((v: any) => v == params || v == params) + if (obj) { + return obj + } + return false +} + diff --git a/src/views/application/marketing/coupon/list.vue b/src/views/application/marketing/coupon/list.vue index 4ae2c6f..7990a2c 100644 --- a/src/views/application/marketing/coupon/list.vue +++ b/src/views/application/marketing/coupon/list.vue @@ -81,6 +81,7 @@ import couponEnum from "./couponEnum"; import couponDetails from "./components/coupon_details.vue"; import couponAdd from "./components/add.vue"; import couponApi from "@/api/account/coupon"; +import { hasPermission } from "@/utils/index"; export default { // eslint-disable-next-line vue/no-unused-components @@ -100,6 +101,9 @@ export default { }, mounted() { this.getTableData(); + console.log(hasPermission('coupon:add')) + console.log(hasPermission('coupon:edit')) + // coupon:add shopStaff:add }, methods: { toAdd(data) { diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 907a06a..43b9beb 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -173,6 +173,7 @@ function handleLogin() { }); localStorage.removeItem("shopName") let resData = await $API_login.getPermission() + localStorage.setItem("permission",JSON.stringify(resData)) const { path, queryParams } = parseRedirect(); console.log(path, queryParams);