diff --git a/.env b/.env index d202065..f6d7a7d 100644 --- a/.env +++ b/.env @@ -30,10 +30,10 @@ VITE_OAUTH2_MOBILE_CLIENT='app:app' VITE_OAUTH2_SOCIAL_CLIENT='social:social' # 是否开启前端滑块验证码 -VITE_VERIFY_ENABLE = true +VITE_VERIFY_ENABLE = false # 是否开启前端图形验证码 -VITE_VERIFY_IMAGE_ENABLE = false +VITE_VERIFY_IMAGE_ENABLE = true # 是否开启websocket 消息接受, VITE_WEBSOCKET_ENABLE = false diff --git a/src/api/supermarketerp/smErpTasteStock.ts b/src/api/supermarketerp/smErpTasteStock.ts new file mode 100644 index 0000000..bc697f4 --- /dev/null +++ b/src/api/supermarketerp/smErpTasteStock.ts @@ -0,0 +1,41 @@ +import request from "/@/utils/request" + +export function fetchList(query?: Object) { + return request({ + url: '/supermarket/smErpTasteStock/page', + method: 'get', + params: query + }) +} + +export function addObj(obj?: Object) { + return request({ + url: '/supermarket/smErpTasteStock', + method: 'post', + data: obj + }) +} + +export function getObj(id?: string) { + return request({ + url: '/supermarket/smErpTasteStock/' + id, + method: 'get' + }) +} + +export function delObjs(ids?: Object) { + return request({ + url: '/supermarket/smErpTasteStock', + method: 'delete', + data: ids + }) +} + +export function putObj(obj?: Object) { + return request({ + url: '/supermarket/smErpTasteStock', + method: 'put', + data: obj + }) +} + diff --git a/src/utils/other.ts b/src/utils/other.ts index ca381da..6d95f83 100644 --- a/src/utils/other.ts +++ b/src/utils/other.ts @@ -352,8 +352,9 @@ export function handleBlobFile(response: any, fileName: string) { "text/plain", "image/jpeg", "image/png", + // "application/zip" // 添加 ZIP 文件类型支持 + "application/octet-stream" ] - if (!allowedTypes.includes(blob.type) && blob.type !== "") { useMessage().error("不支持的文件类型") return diff --git a/src/views/canteenDailyDishes/index.vue b/src/views/canteenDailyDishes/index.vue index e623eca..2dc76aa 100644 --- a/src/views/canteenDailyDishes/index.vue +++ b/src/views/canteenDailyDishes/index.vue @@ -1,193 +1,81 @@ diff --git a/src/views/login/component/password.vue b/src/views/login/component/password.vue index 0651a3c..1cca88b 100644 --- a/src/views/login/component/password.vue +++ b/src/views/login/component/password.vue @@ -122,7 +122,7 @@ const state = reactive({ const loginRules = reactive({ username: [{ required: true, trigger: "blur", message: t("password.accountPlaceholder1") }], // 用户名校验规则 password: [{ required: true, trigger: "blur", message: t("password.accountPlaceholder2") }], // 密码校验规则 - code: [{ required: true, trigger: "blur", message: t("verify.imageCode") }], + code: [{ required: true, trigger: "blur", message: "请输入验证码" }], }) const verifyref = ref>(null) // 定义verify组件引用 diff --git a/src/views/supermarketerp/supermarketSpu/components/auxiliary-code.vue b/src/views/supermarketerp/supermarketSpu/components/auxiliary-code.vue index 90bd45e..753592d 100644 --- a/src/views/supermarketerp/supermarketSpu/components/auxiliary-code.vue +++ b/src/views/supermarketerp/supermarketSpu/components/auxiliary-code.vue @@ -35,7 +35,7 @@ @@ -45,9 +45,9 @@ 请选择 - + @@ -74,7 +74,7 @@ export interface rowVC { id: string unitId: string unit: string - taste: string + tasteName: string barCode: string } @@ -96,7 +96,7 @@ const pushEvent = () => { id: "tmp_" + nanoid(5), unitId: "", unit: "", - taste: "", + tasteName: "", barCode: "", } auxiliaryCodeList.value.push(newRow) @@ -132,7 +132,7 @@ watch( const handleUnitIdChange = (unitId: string, rowIndex: number) => { const unitItem = unitSelectOptions.value?.find((item: rowVU) => item.id == unitId) ;(auxiliaryCodeList.value[rowIndex] as any).unit = unitItem?.unit - ;(auxiliaryCodeList.value[rowIndex] as any).taste = unitItem?.taste + ;(auxiliaryCodeList.value[rowIndex] as any).tasteName = unitItem?.tasteName } // 校验可编辑表格 成功返回 true 失败返回 false diff --git a/src/views/supermarketerp/supermarketSpu/components/package-unit.vue b/src/views/supermarketerp/supermarketSpu/components/package-unit.vue index 3335357..098fd61 100644 --- a/src/views/supermarketerp/supermarketSpu/components/package-unit.vue +++ b/src/views/supermarketerp/supermarketSpu/components/package-unit.vue @@ -10,7 +10,16 @@

- + + + 口味管理 + + + @@ -57,9 +66,20 @@
- - + + diff --git a/src/views/supermarketerp/supermarketSpu/form.vue b/src/views/supermarketerp/supermarketSpu/form.vue index 2dd4b55..87354fb 100644 --- a/src/views/supermarketerp/supermarketSpu/form.vue +++ b/src/views/supermarketerp/supermarketSpu/form.vue @@ -6,7 +6,7 @@ - + ({ grossMargin: 0, smErpUnitEntityList: [], smErpAuxiliaryCodeEntityList: [], + smErpTasteStockEntityList: [], barCode: "", spec: "", @@ -142,23 +143,8 @@ const nextStep = () => { // 默认设置一行基础包装单位 const setDefaultPackageUnit = () => { - if (!form.id && tabPaneActiveIndex.value == 1) { - const isFlagRowExist = form.smErpUnitEntityList.some((item: rowVU) => item.flag === "defaultPackageUnitRow") - if (isFlagRowExist) return - const row = { - id: "tmp_" + nanoid(5), - barCode: form.barCode, - spec: form.spec, - unit: form.unit, - status: form.unitStatus, - packageNum: form.packageNum, - purchasePrice: form.purchasePrice, - retailPrice: form.retailPrice, - promotionPrice: form.promotionPrice, - costPrice: form.costPrice, - flag: "defaultPackageUnitRow", - } - packageUnitRef.value.pushEvent(row) + if (!form.id && tabPaneActiveIndex.value == 1 && form.smErpUnitEntityList.length === 0) { + packageUnitRef.value.pushEvent() packageUnitRef.value.setRadioRow(0) // 自动设置基础包装单位的radio单选行 } } @@ -180,6 +166,8 @@ const openDialog = async (id: string) => { // 设置基础包装单位的单选行 packageUnitRef.value.setRadioRow(form.smErpUnitEntityList.findIndex((item: any) => item.isBase)) + + await getAllTasteList(id) } } @@ -214,11 +202,22 @@ const getsupermarketSpuData = async (id: string) => { } } +// 获取全部口味 +const getAllTasteList = async (spuId: string) => { + const { code, data, msg } = await fetchList({ spuId, current: 1, size: 1000 }) + if (code !== 0) { + form.smErpTasteStockEntityList = [] + return useMessage().error(msg) + } + form.smErpTasteStockEntityList = data.records ?? [] +} + // 重置表单数据 const resetForm = () => { formRef.value?.resetFields() form.smErpUnitEntityList = [] form.smErpAuxiliaryCodeEntityList = [] + form.smErpTasteStockEntityList = [] } // 整理包装单位列表 @@ -233,6 +232,10 @@ const settlePackageUnitList = () => { item.isBase = false } if (item.id.startsWith("tmp_")) item.id = "" + if (item.tasteId?.startsWith("tmp_")) { + item.tasteName = form.smErpTasteStockEntityList.find((tasteItem: any) => tasteItem.id === item.tasteId)?.tasteName || "" + item.tasteId = "" + } // 转换金额单位 item.costPrice = storePrice(item.costPrice) item.promotionPrice = storePrice(item.promotionPrice) @@ -254,16 +257,27 @@ const settleAuxiliaryCode = () => { }) } +// 整理口味 +const settleSmErpTasteStockEntityList = () => { + const smErpTasteStockEntityList = [...form.smErpTasteStockEntityList] + return smErpTasteStockEntityList.map((item: rowVC) => { + if (item.id && item.id.startsWith("tmp_")) item.id = "" + return item + }) +} + // 提交 const onSubmit = async () => { const valid = await formRef.value.validate().catch(() => {}) if (!valid) return useMessage().warning("基础信息或库存必填项未填写完整") if (!form.smErpUnitEntityList || form.smErpUnitEntityList.length <= 0) return useMessage().warning("请添加包装单位") - if (!(await packageUnitRef.value.tableValidate())) return useMessage().warning("包装单位必填项未填写完整 且 相同包装单位的口味不能相同") + if (!(await packageUnitRef.value.tableValidate("tasteId"))) return useMessage().warning("相同包装单位的口味不能相同") + if (!(await packageUnitRef.value.tableValidate())) return useMessage().warning("包装单位必填项未填写完整") if (!packageUnitRef.value.getRadioRow()) return useMessage().warning("请选择基础包装单位") const smErpAuxiliaryCodeEntityList = settleAuxiliaryCode() const smErpUnitEntityList = settlePackageUnitList() + const smErpTasteStockEntityList = settleSmErpTasteStockEntityList() try { loading.value = true const _pa = { @@ -271,6 +285,7 @@ const onSubmit = async () => { ...formatedStorePrice.value, smErpAuxiliaryCodeEntityList, smErpUnitEntityList, + smErpTasteStockEntityList, } // console.log("提交的数据", _pa) diff --git a/src/views/supermarketerp/supermarketSpu/index.vue b/src/views/supermarketerp/supermarketSpu/index.vue index 708494d..b85bb0a 100644 --- a/src/views/supermarketerp/supermarketSpu/index.vue +++ b/src/views/supermarketerp/supermarketSpu/index.vue @@ -149,13 +149,13 @@ - -