修复打印机切换分类打印后,部分分类时无法选择商品分类问题

This commit is contained in:
2026-04-11 18:12:19 +08:00
parent c87c999d42
commit 209be704e1
4 changed files with 48 additions and 17 deletions

View File

@@ -7,8 +7,8 @@ VITE_APP_BASE_API=/dev-api
# 接口地址 # 接口地址
# VITE_APP_API_URL=https://tapi.cashier.sxczgkj.cn/ # 测试 # VITE_APP_API_URL=https://tapi.cashier.sxczgkj.cn/ # 测试
# VITE_APP_API_URL=https://cashier.sxczgkj.com/ # 正式 VITE_APP_API_URL=https://cashier.sxczgkj.com/ # 正式
VITE_APP_API_URL=http://192.168.1.42/ # 本地 # 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_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=http://192.168.1.42:8789 #本地php批量导入
# VITE_APP_API_PHP_IMPORT_URL=https://diftcs.sxczgkj.com #本地线上php批量导入 # VITE_APP_API_PHP_IMPORT_URL=https://diftcs.sxczgkj.com #本地线上php批量导入

View File

@@ -2,6 +2,7 @@ import printerApi, { type addRequest } from "@/api/account/printer";
import { options } from './config' import { options } from './config'
import type { IModalConfig } from "@/components/CURD/types"; import type { IModalConfig } from "@/components/CURD/types";
import { c } from "vite/dist/node/moduleRunnerTransport.d-CXw_Ws6P";
const modalConfig: IModalConfig<addRequest> = { const modalConfig: IModalConfig<addRequest> = {
pageName: "sys:user", pageName: "sys:user",
@@ -15,9 +16,13 @@ const modalConfig: IModalConfig<addRequest> = {
}, },
formAction: function (data) { formAction: function (data) {
let obj = { ...data } let obj = { ...data }
console.log("打印类型", data);
obj.printType = data.printType.join(',') obj.printType = data.printType.join(',')
obj.categoryIds = JSON.stringify(data.categoryIdsArr) obj.categoryIds = JSON.stringify(data.categoryIdsArr)
obj.categoryList = JSON.stringify(data.categoryIdsArr) obj.categoryList = JSON.stringify(data.categoryIdsArr)
if (data.classifyPrint == 0) {
obj.categoryIds = ''
}
// obj.categoryIds = '[' + data.categoryIdsArr.join(',') + ']' // obj.categoryIds = '[' + data.categoryIdsArr.join(',') + ']'
return printerApi.add(obj); return printerApi.add(obj);
}, },

View File

@@ -20,6 +20,9 @@ const modalConfig: IModalConfig<editRequest> = {
obj.categoryIds = JSON.stringify(data.categoryIdsArr) obj.categoryIds = JSON.stringify(data.categoryIdsArr)
obj.categoryList = JSON.stringify(data.categoryIdsArr) obj.categoryList = JSON.stringify(data.categoryIdsArr)
} }
if (data.classifyPrint == 0) {
obj.categoryIds = ''
}
return printerApi.edit(obj); return printerApi.edit(obj);
}, },
beforeSubmit(data) { beforeSubmit(data) {

View File

@@ -2,23 +2,35 @@
<div class="app-container"> <div class="app-container">
<!-- 列表 --> <!-- 列表 -->
<!-- 搜索 --> <!-- 搜索 -->
<page-search ref="searchRef" :search-config="searchConfig" @query-click="handleQueryClick" <page-search
@reset-click="handleResetClick" /> ref="searchRef"
:search-config="searchConfig"
@query-click="handleQueryClick"
@reset-click="handleResetClick"
/>
<!-- 列表 --> <!-- 列表 -->
<page-content ref="contentRef" :content-config="contentConfig" @add-click="handleAddClick" <page-content
@edit-click="handleEditClick" @export-click="handleExportClick" @search-click="handleSearchClick" ref="contentRef"
@toolbar-click="handleToolbarClick" @operat-click="handleOperatClick" @filter-change="handleFilterChange"> :content-config="contentConfig"
@add-click="handleAddClick"
@edit-click="handleEditClick"
@export-click="handleExportClick"
@search-click="handleSearchClick"
@toolbar-click="handleToolbarClick"
@operat-click="handleOperatClick"
@filter-change="handleFilterChange"
>
<template #status="scope"> <template #status="scope">
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'"> <el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }} {{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
</el-tag> </el-tag>
</template> </template>
<template #contentType="scope"> <template #contentType="scope">
{{ scope.row.contentType == 'yxyPrinter' ? "云想印" : "飞鹅" }} {{ scope.row.contentType == "yxyPrinter" ? "云想印" : "飞鹅" }}
</template> </template>
<template #subType="scope"> <template #subType="scope">
{{ scope.row.subType == 'label' ? "标签" : "小票" }} {{ scope.row.subType == "label" ? "标签" : "小票" }}
</template> </template>
<template #caozuo="scope"> <template #caozuo="scope">
{{ scope }} {{ scope }}
@@ -28,8 +40,12 @@
</template> </template>
<template #operate="scope"> <template #operate="scope">
<div v-if="scope.row.connectionType != 'USB'"> <div v-if="scope.row.connectionType != 'USB'">
<el-button @click="handleEditClick(scope.row)" icon="Edit" type="primary" link>编辑</el-button> <el-button @click="handleEditClick(scope.row)" icon="Edit" type="primary" link>
<el-button @click="handdeleteevent(scope.row)" icon="Delete" type="danger" link>删除</el-button> 编辑
</el-button>
<el-button @click="handdeleteevent(scope.row)" icon="Delete" type="danger" link>
删除
</el-button>
</div> </div>
</template> </template>
<!-- <template #mobile="scope"> <!-- <template #mobile="scope">
@@ -55,7 +71,11 @@
</page-modal> </page-modal>
<!-- 编辑 --> <!-- 编辑 -->
<page-modal ref="editModalRef" :modal-config="editModalConfig" @submit-click="handleSubmitClick"> <page-modal
ref="editModalRef"
:modal-config="editModalConfig"
@submit-click="handleSubmitClick"
>
<template #gender="scope"> <template #gender="scope">
<Dict v-model="scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" /> <Dict v-model="scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" />
</template> </template>
@@ -98,11 +118,11 @@ const {
onMounted(() => { onMounted(() => {
getPrinterType(); getPrinterType();
}); });
let PrinterTypeList = ref([]) let PrinterTypeList = ref([]);
// 获取商品分类 // 获取商品分类
async function getPrinterType() { async function getPrinterType() {
let res = await UserAPI.getPrinterType(); let res = await UserAPI.getPrinterType();
PrinterTypeList.value = res.records PrinterTypeList.value = res.records;
} }
function handdeleteevent(item) { function handdeleteevent(item) {
ElMessageBox.confirm("确认删除?", "警告", { ElMessageBox.confirm("确认删除?", "警告", {
@@ -114,7 +134,6 @@ function handdeleteevent(item) {
ElMessage.success("删除成功"); ElMessage.success("删除成功");
handleQueryClick(); handleQueryClick();
}); });
}); });
} }
// 新增 // 新增
@@ -127,11 +146,15 @@ async function handleEditClick(row: IObject) {
editModalRef.value?.setModalVisible(); editModalRef.value?.setModalVisible();
// 根据id获取数据进行填充 // 根据id获取数据进行填充
let data = await UserAPI.get(row.id); let data = await UserAPI.get(row.id);
data.printType = data.printType.split(','); data.printType = data.printType.split(",");
if (data.categoryIds) { 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; data.classifyPrint = data.classifyPrint * 1;