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] =?UTF-8?q?feat:=20=E5=90=8C=E6=AD=A5=E8=A7=84=E6=A0=BC?= =?UTF-8?q?=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", }, {