diff --git a/.env.development b/.env.development index 949bf9b..b20487c 100644 --- a/.env.development +++ b/.env.development @@ -7,8 +7,8 @@ VITE_APP_BASE_API=/dev-api # 接口地址 # VITE_APP_API_URL=https://tapi.cashier.sxczgkj.cn/ # 测试 -# VITE_APP_API_URL=https://cashier.sxczgkj.com/ # 正式 - VITE_APP_API_URL=http://192.168.1.42/ # 本地 +VITE_APP_API_URL=https://cashier.sxczgkj.com/ # 正式 +# VITE_APP_API_URL=http://192.168.1.42/ # 本地 VITE_APP_API_PHP_URL=http://192.168.1.42:8000 #php抖音美团测试环境 VITE_APP_API_PHP_IMPORT_URL=http://192.168.1.42:8789 #本地php批量导入 # VITE_APP_API_PHP_IMPORT_URL=https://diftcs.sxczgkj.com #本地线上php批量导入 diff --git a/src/views/devices/config/add.ts b/src/views/devices/config/add.ts index 5968746..d1e20cf 100644 --- a/src/views/devices/config/add.ts +++ b/src/views/devices/config/add.ts @@ -2,6 +2,7 @@ import printerApi, { type addRequest } from "@/api/account/printer"; import { options } from './config' import type { IModalConfig } from "@/components/CURD/types"; +import { c } from "vite/dist/node/moduleRunnerTransport.d-CXw_Ws6P"; const modalConfig: IModalConfig = { pageName: "sys:user", @@ -15,9 +16,13 @@ const modalConfig: IModalConfig = { }, formAction: function (data) { let obj = { ...data } + console.log("打印类型", data); obj.printType = data.printType.join(',') obj.categoryIds = JSON.stringify(data.categoryIdsArr) obj.categoryList = JSON.stringify(data.categoryIdsArr) + if (data.classifyPrint == 0) { + obj.categoryIds = '' + } // obj.categoryIds = '[' + data.categoryIdsArr.join(',') + ']' return printerApi.add(obj); }, diff --git a/src/views/devices/config/edit.ts b/src/views/devices/config/edit.ts index 1034e58..a63ff89 100644 --- a/src/views/devices/config/edit.ts +++ b/src/views/devices/config/edit.ts @@ -20,6 +20,9 @@ const modalConfig: IModalConfig = { obj.categoryIds = JSON.stringify(data.categoryIdsArr) obj.categoryList = JSON.stringify(data.categoryIdsArr) } + if (data.classifyPrint == 0) { + obj.categoryIds = '' + } return printerApi.edit(obj); }, beforeSubmit(data) { diff --git a/src/views/devices/printer.vue b/src/views/devices/printer.vue index e7b4b1b..d062c65 100644 --- a/src/views/devices/printer.vue +++ b/src/views/devices/printer.vue @@ -2,23 +2,35 @@
- + - + - + @@ -98,11 +118,11 @@ const { onMounted(() => { getPrinterType(); }); -let PrinterTypeList = ref([]) +let PrinterTypeList = ref([]); // 获取商品分类 async function getPrinterType() { let res = await UserAPI.getPrinterType(); - PrinterTypeList.value = res.records + PrinterTypeList.value = res.records; } function handdeleteevent(item) { ElMessageBox.confirm("确认删除?", "警告", { @@ -114,7 +134,6 @@ function handdeleteevent(item) { ElMessage.success("删除成功"); handleQueryClick(); }); - }); } // 新增 @@ -127,11 +146,15 @@ async function handleEditClick(row: IObject) { editModalRef.value?.setModalVisible(); // 根据id获取数据进行填充 let data = await UserAPI.get(row.id); - data.printType = data.printType.split(','); + data.printType = data.printType.split(","); if (data.categoryIds) { - data.categoryIdsArr = JSON.parse(data.categoryIds) + data.categoryIdsArr = JSON.parse(data.categoryIds); + } else { + data.categoryIdsArr = []; } + console.log(data.categoryIdsArr); + console.log(data); data.classifyPrint = data.classifyPrint * 1;