优化打印机配置
This commit is contained in:
@@ -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批量导入
|
||||||
|
|||||||
@@ -89,6 +89,22 @@ const OrderApi = {
|
|||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 打印经营日报
|
||||||
|
printDayReport(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${Order_BaseUrl}/admin/finance/printDayReport`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 打印日结单
|
||||||
|
printDaySettle(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${Order_BaseUrl}/admin/finance/printDaySettle`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default OrderApi;
|
export default OrderApi;
|
||||||
|
|||||||
@@ -28,6 +28,14 @@ const Api = {
|
|||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 商品报表打印
|
||||||
|
print(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/print`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Api;
|
export default Api;
|
||||||
|
|||||||
120
src/components/printBusinessDialog.vue
Normal file
120
src/components/printBusinessDialog.vue
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog title="打印确认" width="400px" v-model="showDayBusiness">
|
||||||
|
<div class="business_wrap">
|
||||||
|
<div class="title">
|
||||||
|
<el-text>请选择要打印的日期:</el-text> <el-text type="danger">周期最长为7天</el-text>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<el-date-picker v-model="printDayBusinessParams.date" type="daterange" start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期" format="YYYY-MM-DD" value-format="YYYY-MM-DD" :disabled-date="disabledDate"
|
||||||
|
@change="handleDateChange" clearable />
|
||||||
|
</div>
|
||||||
|
<div class="business_tips">
|
||||||
|
<el-text type="info">若数据过多,打印时间会比较长,请耐心等待</el-text>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="showDayBusiness = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="confirmHandle" :loading="printDayBusinessLoading">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '经营日报'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const showDayBusiness = ref(false)
|
||||||
|
const emits = defineEmits(['success'])
|
||||||
|
|
||||||
|
// 打印参数
|
||||||
|
const printDayBusinessParams = ref({
|
||||||
|
date: [],
|
||||||
|
})
|
||||||
|
const printDayBusinessLoading = ref(false)
|
||||||
|
|
||||||
|
// 取消
|
||||||
|
const confirmHandle = () => {
|
||||||
|
// 校验日期
|
||||||
|
if (!printDayBusinessParams.value.date || printDayBusinessParams.value.date.length !== 2) {
|
||||||
|
ElMessage.warning('请选择日期范围')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
showDayBusiness.value = false
|
||||||
|
emits('success', { date: printDayBusinessParams.value.date })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 日期禁用规则:只能选昨天及更早,不能选未来
|
||||||
|
const disabledDate = (time) => {
|
||||||
|
const yesterday = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
|
||||||
|
return dayjs(time).isAfter(yesterday)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 日期选择后校验:区间长度不能超过7天
|
||||||
|
const handleDateChange = (val) => {
|
||||||
|
if (!val || val.length !== 2) return
|
||||||
|
const [start, end] = val
|
||||||
|
const days = dayjs(end).diff(start, 'day') + 1 // 包含起止日
|
||||||
|
if (days > 7) {
|
||||||
|
ElMessage.warning('日期范围最多只能选择7天')
|
||||||
|
printDayBusinessParams.value.date = [] // 清空选择
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断当前时间 是否在 00:00 ~ 05:20 之间
|
||||||
|
const time = ref(['00:00', '05:20'])
|
||||||
|
const isInTimeRange = () => {
|
||||||
|
const now = dayjs()
|
||||||
|
const startTime = dayjs(time.value[0], 'HH:mm')
|
||||||
|
const endTime = dayjs(time.value[1], 'HH:mm')
|
||||||
|
return now.isAfter(startTime) && now.isBefore(endTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开弹窗
|
||||||
|
const show = () => {
|
||||||
|
if (isInTimeRange()) {
|
||||||
|
ElMessage.warning(`当前时间不能打印${props.title},打印时间:${time.value[0]}点至${time.value[1]}点`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
showDayBusiness.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 暴露方法
|
||||||
|
defineExpose({ show })
|
||||||
|
|
||||||
|
// 初始化默认选中昨天
|
||||||
|
onMounted(() => {
|
||||||
|
const yesterday = dayjs().subtract(1, 'day').format('YYYY-MM-DD')
|
||||||
|
printDayBusinessParams.value.date = [yesterday, yesterday]
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.business_wrap {
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
gap: 6px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
padding-top: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.business_tips {
|
||||||
|
padding-top: 6px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -39,7 +39,7 @@ export const useUserStore = defineStore("user", () => {
|
|||||||
setRefreshToken(token);
|
setRefreshToken(token);
|
||||||
localStorage.setItem("shopId", "" + data.shopInfo.id);
|
localStorage.setItem("shopId", "" + data.shopInfo.id);
|
||||||
localStorage.setItem("branch_shopId", data.shopInfo.id)
|
localStorage.setItem("branch_shopId", data.shopInfo.id)
|
||||||
resolve();
|
resolve(data);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
reject(error);
|
reject(error);
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" :loading="loading" @click="handleQuery">查询</el-button>
|
<el-button type="primary" icon="Search" :loading="loading" @click="handleQuery">查询</el-button>
|
||||||
<el-button @click="handleReset" icon="Refresh" :loading="loading">重置</el-button>
|
<el-button @click="handleReset" icon="Refresh" :loading="loading">重置</el-button>
|
||||||
|
<el-button icon="Printer" @click="printBusinessDialogRef.show()">经营日报</el-button>
|
||||||
|
<el-button icon="Printer" @click="printBusinessDialogRef2.show()">日结单</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-form inline>
|
<el-form inline>
|
||||||
@@ -359,6 +361,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<printBusinessDialog ref="printBusinessDialogRef" @success="printHandle" />
|
||||||
|
<printBusinessDialog ref="printBusinessDialogRef2" @success="printHandle2" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -366,6 +370,46 @@ import dayjs from "dayjs";
|
|||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import OrderApi from "@/api/order/order";
|
import OrderApi from "@/api/order/order";
|
||||||
import { downloadFile, multiplyAndFormat } from '@/utils'
|
import { downloadFile, multiplyAndFormat } from '@/utils'
|
||||||
|
import printBusinessDialog from "@/components/printBusinessDialog.vue";
|
||||||
|
|
||||||
|
const printBusinessDialogRef = ref(null)
|
||||||
|
|
||||||
|
// 打印经营日报回调
|
||||||
|
async function printHandle(res) {
|
||||||
|
try {
|
||||||
|
const shopStaff = JSON.parse(localStorage.getItem('shopStaff')) || { name: '' }
|
||||||
|
const shopName = localStorage.getItem('shopName')
|
||||||
|
await OrderApi.printDayReport({
|
||||||
|
beginDate: res.date[0],
|
||||||
|
endDate: res.date[1],
|
||||||
|
rangeType: 'CUSTOM',
|
||||||
|
shopId: localStorage.getItem('shopId') || '',
|
||||||
|
operator: shopStaff.name || shopName
|
||||||
|
})
|
||||||
|
ElMessage.success('打印成功')
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const printBusinessDialogRef2 = ref(null)
|
||||||
|
// 打印日结单回调
|
||||||
|
async function printHandle2(res) {
|
||||||
|
try {
|
||||||
|
const shopStaff = JSON.parse(localStorage.getItem('shopStaff')) || { name: '' }
|
||||||
|
const shopName = localStorage.getItem('shopName')
|
||||||
|
await OrderApi.printDaySettle({
|
||||||
|
beginDate: res.date[0],
|
||||||
|
endDate: res.date[1],
|
||||||
|
rangeType: 'CUSTOM',
|
||||||
|
shopId: localStorage.getItem('shopId') || '',
|
||||||
|
operator: shopStaff.name || shopName
|
||||||
|
})
|
||||||
|
ElMessage.success('打印成功')
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const queryForm = ref({
|
const queryForm = ref({
|
||||||
queryDate: dayjs().format('YYYY-MM-DD'), // 查询日期 yyyy-MM-dd
|
queryDate: dayjs().format('YYYY-MM-DD'), // 查询日期 yyyy-MM-dd
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
<span v-if="!downloadLoading">导出Excel</span>
|
<span v-if="!downloadLoading">导出Excel</span>
|
||||||
<span v-else>下载中...</span>
|
<span v-else>下载中...</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button icon="Printer" :loading="printLoading" @click="$refs.printBusinessDialogRef.show()">打印</el-button>
|
||||||
<importData :type="7" @close="getTableData" />
|
<importData :type="7" @close="getTableData" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -185,6 +186,7 @@
|
|||||||
@current-change="paginationChange" @size-change="sizeChange"
|
@current-change="paginationChange" @size-change="sizeChange"
|
||||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||||
</div>
|
</div>
|
||||||
|
<printBusinessDialog ref="printBusinessDialogRef" title="商品报表" @success="printBusinessConfirm" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -197,9 +199,10 @@ import ShopApi from "@/api/account/shop";
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { downloadFile, multiplyAndFormat } from "@/utils/index";
|
import { downloadFile, multiplyAndFormat } from "@/utils/index";
|
||||||
import { formatDateRange } from './utils/index.js'
|
import { formatDateRange } from './utils/index.js'
|
||||||
|
import printBusinessDialog from '@/components/printBusinessDialog.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { importData },
|
components: { importData, printBusinessDialog },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
multiplyAndFormat,
|
multiplyAndFormat,
|
||||||
@@ -233,7 +236,8 @@ export default {
|
|||||||
// dayjs(time):将原生 Date 转为 dayjs 对象
|
// dayjs(time):将原生 Date 转为 dayjs 对象
|
||||||
// isAfter:判断目标日期是否在今天之后
|
// isAfter:判断目标日期是否在今天之后
|
||||||
return dayjs(time).isAfter(dayjs().startOf('day'));
|
return dayjs(time).isAfter(dayjs().startOf('day'));
|
||||||
}
|
},
|
||||||
|
printLoading: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
@@ -255,6 +259,34 @@ export default {
|
|||||||
this.geiShopList();
|
this.geiShopList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 确认打印
|
||||||
|
printBusinessConfirm(res) {
|
||||||
|
this.printHandle(res.date)
|
||||||
|
},
|
||||||
|
// 打印
|
||||||
|
async printHandle(date) {
|
||||||
|
try {
|
||||||
|
const shopStaff = JSON.parse(localStorage.getItem('shopStaff')) || { name: '' }
|
||||||
|
const shopName = localStorage.getItem('shopName')
|
||||||
|
|
||||||
|
this.printLoading = true
|
||||||
|
|
||||||
|
await saleSummaryApi.print({
|
||||||
|
beginDate: date[0],
|
||||||
|
endDate: date[1],
|
||||||
|
categoryId: this.query.prodCategoryId,
|
||||||
|
productName: this.query.productName,
|
||||||
|
shopId: this.shopId,
|
||||||
|
rangeType: this.timeValue,
|
||||||
|
operator: shopStaff.name || shopName
|
||||||
|
})
|
||||||
|
ElMessage.success('操作成功')
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.printLoading = false
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 获取分店列表
|
* 获取分店列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ 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",
|
||||||
@@ -17,7 +16,7 @@ const modalConfig: IModalConfig<addRequest> = {
|
|||||||
formAction: function (data) {
|
formAction: function (data) {
|
||||||
let obj = { ...data }
|
let obj = { ...data }
|
||||||
console.log("打印类型", 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) {
|
if (data.classifyPrint == 0) {
|
||||||
@@ -90,7 +89,7 @@ const modalConfig: IModalConfig<addRequest> = {
|
|||||||
{
|
{
|
||||||
type: "select",
|
type: "select",
|
||||||
label: "打印类型",
|
label: "打印类型",
|
||||||
prop: "subType",
|
prop: "printType",
|
||||||
rules: [{ required: false, message: "请选择打印类型", trigger: "blur" }],
|
rules: [{ required: false, message: "请选择打印类型", trigger: "blur" }],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: "请选择打印类型",
|
placeholder: "请选择打印类型",
|
||||||
@@ -108,7 +107,7 @@ const modalConfig: IModalConfig<addRequest> = {
|
|||||||
{
|
{
|
||||||
type: "select",
|
type: "select",
|
||||||
label: "打印机品牌",
|
label: "打印机品牌",
|
||||||
prop: "contentType",
|
prop: "brand",
|
||||||
rules: [{ required: true, message: "请选择打印机品牌", trigger: "blur" }],
|
rules: [{ required: true, message: "请选择打印机品牌", trigger: "blur" }],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: "请选择打印机品牌",
|
placeholder: "请选择打印机品牌",
|
||||||
@@ -144,27 +143,27 @@ const modalConfig: IModalConfig<addRequest> = {
|
|||||||
label: "",
|
label: "",
|
||||||
initialValue: []
|
initialValue: []
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
type: "radio",
|
type: "radio",
|
||||||
label: "打印数量",
|
label: "打印数量",
|
||||||
prop: "printQty",
|
prop: "printNum",
|
||||||
options: options.printQty,
|
options: options.printQty,
|
||||||
initialValue: options.printQty[0].value
|
initialValue: options.printQty[0].value
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "radio",
|
type: "radio",
|
||||||
label: "打印方式",
|
label: "打印方式",
|
||||||
prop: "printMethod",
|
prop: "kitchenPrintMode",
|
||||||
options: options.printMethod,
|
options: options.printMethod,
|
||||||
initialValue: options.printMethod[0].value
|
initialValue: options.printMethod[0].value
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "checkbox",
|
type: "custom",
|
||||||
label: "打印类型",
|
label: "打印类型",
|
||||||
prop: "printType",
|
prop: "printContentType",
|
||||||
options: options.printType,
|
options: options.printType,
|
||||||
initialValue: options.printType.map(v => v.value)
|
initialValue: options.printType.map(v => v.value),
|
||||||
|
slotName: 'printTypeSlot'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "打印机状态",
|
label: "打印机状态",
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ const contentConfig: IContentConfig<getListRequest> = {
|
|||||||
label: "状态",
|
label: "状态",
|
||||||
align: "center",
|
align: "center",
|
||||||
prop: "status",
|
prop: "status",
|
||||||
templet: "switch",
|
templet: "custom",
|
||||||
slotName: "status",
|
slotName: "status"
|
||||||
},
|
},
|
||||||
{ label: "创建时间", align: "center", prop: "createTime" },
|
{ label: "创建时间", align: "center", prop: "createTime" },
|
||||||
// {
|
// {
|
||||||
|
|||||||
@@ -160,11 +160,11 @@ const modalConfig: IModalConfig<editRequest> = {
|
|||||||
initialValue: options.printMethod[0].value
|
initialValue: options.printMethod[0].value
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "checkbox",
|
type: "custom",
|
||||||
label: "打印类型",
|
label: "打印类型",
|
||||||
prop: "printType",
|
prop: "printContentType",
|
||||||
options: options.printType,
|
options: '',
|
||||||
initialValue: options.printType.map(v => v.value)
|
initialValue: ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "打印机状态",
|
label: "打印机状态",
|
||||||
|
|||||||
@@ -2,30 +2,18 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<page-search
|
<page-search ref="searchRef" :search-config="searchConfig" @query-click="handleQueryClick"
|
||||||
ref="searchRef"
|
@reset-click="handleResetClick" />
|
||||||
:search-config="searchConfig"
|
|
||||||
@query-click="handleQueryClick"
|
|
||||||
@reset-click="handleResetClick"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<page-content
|
<page-content ref="contentRef" :content-config="contentConfig" @add-click="handleAddClick"
|
||||||
ref="contentRef"
|
@edit-click="handleEditClick" @export-click="handleExportClick" @search-click="handleSearchClick"
|
||||||
:content-config="contentConfig"
|
@toolbar-click="handleToolbarClick" @operat-click="handleOperatClick" @filter-change="handleFilterChange">
|
||||||
@add-click="handleAddClick"
|
<!-- <template #status="scope">
|
||||||
@edit-click="handleEditClick"
|
|
||||||
@export-click="handleExportClick"
|
|
||||||
@search-click="handleSearchClick"
|
|
||||||
@toolbar-click="handleToolbarClick"
|
|
||||||
@operat-click="handleOperatClick"
|
|
||||||
@filter-change="handleFilterChange"
|
|
||||||
>
|
|
||||||
<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>
|
||||||
@@ -38,6 +26,10 @@
|
|||||||
<template #gender="scope">
|
<template #gender="scope">
|
||||||
<DictLabel v-model="scope.row[scope.prop]" code="gender" />
|
<DictLabel v-model="scope.row[scope.prop]" code="gender" />
|
||||||
</template>
|
</template>
|
||||||
|
<template #status="scope">
|
||||||
|
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0"
|
||||||
|
@click="statusChange($event, scope.row)"></el-switch>
|
||||||
|
</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 @click="handleEditClick(scope.row)" icon="Edit" type="primary" link>
|
||||||
@@ -55,10 +47,21 @@
|
|||||||
</page-content>
|
</page-content>
|
||||||
|
|
||||||
<!-- 新增 -->
|
<!-- 新增 -->
|
||||||
<page-modal ref="addModalRef" :modal-config="addModalConfig" @submit-click="handleSubmitClick">
|
<!-- <page-modal ref="addModalRef" :modal-config="addModalConfig" @submit-click="handleSubmitClick">
|
||||||
<template #gender="scope">
|
<template #gender="scope">
|
||||||
<Dict v-model="scope.formData[scope.prop]" code="gender" />
|
<Dict v-model="scope.formData[scope.prop]" code="gender" />
|
||||||
</template>
|
</template>
|
||||||
|
<template #printTypeSlot="scope">
|
||||||
|
<div class="row" v-for="(item, index) in printTypeList" :key="index">
|
||||||
|
<div class="title">{{ item.label }}</div>
|
||||||
|
<div class="cont">
|
||||||
|
<el-checkbox-group v-model="item.values" @change="printTypeChange($event, index, scope)">
|
||||||
|
<el-checkbox :label="item.label" :value="item.value" v-for="item in item.list"
|
||||||
|
:key="item.value"></el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<template #classifyPrintData="scope">
|
<template #classifyPrintData="scope">
|
||||||
<template v-if="scope.formData.classifyPrint == 1">
|
<template v-if="scope.formData.classifyPrint == 1">
|
||||||
<el-checkbox-group v-model="scope.formData.categoryIdsArr">
|
<el-checkbox-group v-model="scope.formData.categoryIdsArr">
|
||||||
@@ -68,17 +71,24 @@
|
|||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</page-modal>
|
</page-modal> -->
|
||||||
|
|
||||||
<!-- 编辑 -->
|
<!-- 编辑 -->
|
||||||
<page-modal
|
<!-- <page-modal ref="editModalRef" :modal-config="editModalConfig" @submit-click="handleSubmitClick">
|
||||||
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>
|
||||||
|
<template #printTypeSlot="scope">
|
||||||
|
<div class="row" v-for="(item, index) in printTypeList" :key="index">
|
||||||
|
<div class="title">{{ item.label }}</div>
|
||||||
|
<div class="cont">
|
||||||
|
<el-checkbox-group v-model="item.values" @change="printTypeChange($event, index, scope)">
|
||||||
|
<el-checkbox :label="item.label" :value="item.value" v-for="item in item.list"
|
||||||
|
:key="item.value"></el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<template #classifyPrintData="scope">
|
<template #classifyPrintData="scope">
|
||||||
<template v-if="scope.formData.classifyPrint == 1">
|
<template v-if="scope.formData.classifyPrint == 1">
|
||||||
<el-checkbox-group v-model="scope.formData.categoryIdsArr">
|
<el-checkbox-group v-model="scope.formData.categoryIdsArr">
|
||||||
@@ -88,11 +98,103 @@
|
|||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</page-modal>
|
</page-modal> -->
|
||||||
|
|
||||||
|
<el-dialog :title="form.id ? '编辑打印机' : '添加打印机'" width="800px" v-model="visible" @closed="dialogClosed"
|
||||||
|
@open="dialogOpen">
|
||||||
|
<div style="height: 60vh;overflow-y: auto;" ref="formDivRef">
|
||||||
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
|
||||||
|
<el-form-item label="设备名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入设备名称"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备类型">
|
||||||
|
<el-radio-group v-model="form.connectionType">
|
||||||
|
<el-radio-button label="USB" value="USB"></el-radio-button>
|
||||||
|
<el-radio-button label="云打印" value="云打印"></el-radio-button>
|
||||||
|
<el-radio-button label="局域网" value="局域网"></el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="小票类型">
|
||||||
|
<el-radio-group v-model="form.printType">
|
||||||
|
<el-radio-button label="标签" value="label"></el-radio-button>
|
||||||
|
<el-radio-button label="小票" value="cash"></el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="打印机品牌" prop="brand">
|
||||||
|
<el-radio-group v-model="form.brand">
|
||||||
|
<el-radio-button label="飞鹅"></el-radio-button>
|
||||||
|
<el-radio-button label="云想印"></el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="ip地址/MAC地址" prop="address">
|
||||||
|
<el-input v-model="form.address" placeholder="请输入ip地址/MAC地址"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="端口" prop="port">
|
||||||
|
<el-input v-model="form.port" placeholder="请输入端口"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="小票尺寸" prop="receiptSize">
|
||||||
|
<el-radio-group v-model="form.receiptSize">
|
||||||
|
<el-radio-button label="58mm"></el-radio-button>
|
||||||
|
<el-radio-button label="80mm"></el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="打印数量" prop="printNum">
|
||||||
|
<el-input-number v-model="form.printNum" :step="1" :min="1"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="打印内容" prop="printContentType">
|
||||||
|
<div class="row" v-for="(item, index) in printTypeList" :key="index">
|
||||||
|
<div class="title">{{ item.label }}</div>
|
||||||
|
<div class="cont">
|
||||||
|
<el-checkbox-group v-model="item.values" @change="printTypeChange($event, index)">
|
||||||
|
<el-checkbox :label="item.label" :value="item.value" v-for="item in item.list"
|
||||||
|
:key="item.value"></el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="打印模式" prop="kitchenPrintMode">
|
||||||
|
<el-radio-group v-model="form.kitchenPrintMode">
|
||||||
|
<el-radio-button label="整单" value="all"></el-radio-button>
|
||||||
|
<el-radio-button label="单个" value="only"></el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
<el-text type="info" style="margin-left: 14px;">仅针对厨房制作单的打印</el-text>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="分类打印">
|
||||||
|
<div class="column">
|
||||||
|
<div style="display: flex;align-items: center;">
|
||||||
|
<el-radio-group v-model="form.classifyPrint">
|
||||||
|
<el-radio-button label="所有" value="0"></el-radio-button>
|
||||||
|
<el-radio-button label="部分分类" value="1" v-if="printTypeList[1].values.length > 0"></el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
<el-text type="info" style="margin-left: 14px;">仅针对厨房制作单的打印</el-text>
|
||||||
|
</div>
|
||||||
|
<template v-if="form.classifyPrint == 1">
|
||||||
|
<el-checkbox-group v-model="form.categoryIds">
|
||||||
|
<el-checkbox v-for="item in PrinterTypeList" :value="item.id" :label="item.name"></el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="媒体音量">
|
||||||
|
<el-switch v-model="form.volumeSwitch" :active-value="1" :inactive-value="0"></el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="启用状态">
|
||||||
|
<el-switch v-model="form.status" :active-value="1" :inactive-value="0"></el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="visible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" :loading="loading" @click="submitHandle">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import _ from 'lodash'
|
||||||
import UserAPI from "@/api/account/printer";
|
import UserAPI from "@/api/account/printer";
|
||||||
import type { IObject, IOperatData } from "@/components/CURD/types";
|
import type { IObject, IOperatData } from "@/components/CURD/types";
|
||||||
import usePage from "@/components/CURD/usePage";
|
import usePage from "@/components/CURD/usePage";
|
||||||
@@ -100,6 +202,166 @@ import addModalConfig from "./config/add";
|
|||||||
import contentConfig from "./config/content";
|
import contentConfig from "./config/content";
|
||||||
import editModalConfig from "./config/edit";
|
import editModalConfig from "./config/edit";
|
||||||
import searchConfig from "./config/search";
|
import searchConfig from "./config/search";
|
||||||
|
import { options } from './config/config'
|
||||||
|
import printerApi, { type addRequest } from "@/api/account/printer";
|
||||||
|
|
||||||
|
const printTypeList = ref([
|
||||||
|
{
|
||||||
|
label: '前台',
|
||||||
|
values: [],
|
||||||
|
list: [
|
||||||
|
{ label: '客看单', value: 'GUEST_ORDER' },
|
||||||
|
{ label: '预结算单', value: 'PRE_ORDER' },
|
||||||
|
{ label: '结算单', value: 'ORDER' },
|
||||||
|
{ label: '退菜单', value: 'RETURN_ORDER' },
|
||||||
|
{ label: '退款单', value: 'REFUND_ORDER' },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '后厨',
|
||||||
|
values: [],
|
||||||
|
list: [
|
||||||
|
{ label: '后厨-整单', value: 'ALL_KITCHEN' },
|
||||||
|
{ label: '后厨-分单', value: 'ONLY_KITCHEN' },
|
||||||
|
{ label: '后厨-退菜单', value: 'REFUND_KITCHEN' },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '其它',
|
||||||
|
values: [],
|
||||||
|
list: [
|
||||||
|
{ label: '交班单', value: 'HANDOVER' },
|
||||||
|
{ label: '排队取号', value: 'CALL' },
|
||||||
|
{ label: '储值单', value: 'RECHARGE' },
|
||||||
|
{ label: '入库单', value: 'STOCK' },
|
||||||
|
{ label: '盘点单', value: 'STOCK_CHECK' },
|
||||||
|
{ label: '商品报表', value: 'PRODUCT_REPORT' },
|
||||||
|
{ label: '经营日报', value: 'DAY_REPORT' },
|
||||||
|
{ label: '日结单', value: 'DAY_ORDER' },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const visible = ref(false)
|
||||||
|
const formRef = ref(null)
|
||||||
|
const obj = {
|
||||||
|
id: '',
|
||||||
|
name: '', // 设备名称
|
||||||
|
connectionType: '云打印', // 连接方式 USB、云打印、局域网
|
||||||
|
printType: 'cash', // 打印类型 label标签 cash小票
|
||||||
|
brand: '', // 打印机品牌 飞鹅/云想印
|
||||||
|
address: '', // ip地址/MAC地址
|
||||||
|
port: '', // 端口
|
||||||
|
receiptSize: '58mm', // 小票尺寸 58mm 80mm
|
||||||
|
printNum: 1, // 打印数量
|
||||||
|
printContentType: '', // 打印内容
|
||||||
|
kitchenPrintMode: 'all', // 打印模式(厨房打印菜品) all整单 /only单个
|
||||||
|
classifyPrint: '0', // 分类打印 0-所有 1-部分分类
|
||||||
|
categoryIds: [], // 分类Id
|
||||||
|
status: 1, // 0 禁用 1启用
|
||||||
|
volumeSwitch: 1, // 媒体声音开关 0关1开
|
||||||
|
}
|
||||||
|
const form = ref({ ...obj })
|
||||||
|
|
||||||
|
const rules = {
|
||||||
|
name: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入设备名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
brand: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择打印机品牌',
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
printNum: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择打印数量',
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// kitchenPrintMode: [
|
||||||
|
// {
|
||||||
|
// required: true,
|
||||||
|
// message: '请选择打印模式',
|
||||||
|
// trigger: 'change'
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
}
|
||||||
|
|
||||||
|
function dialogClosed() {
|
||||||
|
formRef.value.resetFields()
|
||||||
|
form.value = { ...obj }
|
||||||
|
}
|
||||||
|
|
||||||
|
const formDivRef = ref(null)
|
||||||
|
async function dialogOpen() {
|
||||||
|
await nextTick()
|
||||||
|
if (formDivRef.value) {
|
||||||
|
// console.log('开始滚动到顶部')
|
||||||
|
formDivRef.value.scrollTop = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打印类型切换
|
||||||
|
function printTypeChange(e, index, scope) {
|
||||||
|
if (index == 1 && printTypeList.value[index].values.length == 0) {
|
||||||
|
form.value.categoryList = []
|
||||||
|
}
|
||||||
|
|
||||||
|
let arr = []
|
||||||
|
printTypeList.value.forEach(item => {
|
||||||
|
arr.push(...item.values)
|
||||||
|
})
|
||||||
|
|
||||||
|
form.value.printContentType = arr.join(',')
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitHandle() {
|
||||||
|
console.log('submitHandle===', form.value);
|
||||||
|
formRef.value.validate(async valid => {
|
||||||
|
try {
|
||||||
|
if (valid) {
|
||||||
|
loading.value = true
|
||||||
|
const data = { ...form.value }
|
||||||
|
data.categoryIds = form.value.categoryIds.join(',')
|
||||||
|
if (form.value.id) {
|
||||||
|
await printerApi.edit(data)
|
||||||
|
} else {
|
||||||
|
await printerApi.add(data)
|
||||||
|
}
|
||||||
|
ElMessage.success(form.value.id ? '编辑成功' : '添加成功')
|
||||||
|
visible.value = false
|
||||||
|
|
||||||
|
handleQueryClick();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
loading.value = false
|
||||||
|
}, 300);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更改状态
|
||||||
|
async function statusChange(e, data) {
|
||||||
|
try {
|
||||||
|
await printerApi.edit({
|
||||||
|
id: data.id,
|
||||||
|
status: data.status
|
||||||
|
});
|
||||||
|
handleQueryClick();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
searchRef,
|
searchRef,
|
||||||
@@ -138,27 +400,41 @@ function handdeleteevent(item) {
|
|||||||
}
|
}
|
||||||
// 新增
|
// 新增
|
||||||
async function handleAddClick() {
|
async function handleAddClick() {
|
||||||
addModalRef.value?.setModalVisible();
|
// addModalRef.value?.setModalVisible();
|
||||||
|
visible.value = true
|
||||||
}
|
}
|
||||||
// 编辑
|
// 编辑
|
||||||
async function handleEditClick(row: IObject) {
|
async function handleEditClick(row: IObject) {
|
||||||
editModalRef.value?.handleDisabled(false);
|
form.value = { ...row }
|
||||||
editModalRef.value?.setModalVisible();
|
visible.value = true
|
||||||
// 根据id获取数据进行填充
|
|
||||||
let data = await UserAPI.get(row.id);
|
|
||||||
data.printType = data.printType.split(",");
|
|
||||||
|
|
||||||
if (data.categoryIds) {
|
form.value.categoryIds = form.value.categoryIds.split(',')
|
||||||
data.categoryIdsArr = JSON.parse(data.categoryIds);
|
|
||||||
} else {
|
|
||||||
data.categoryIdsArr = [];
|
|
||||||
}
|
|
||||||
console.log(data.categoryIdsArr);
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
data.classifyPrint = data.classifyPrint * 1;
|
const printContentTypes = row.printContentType.split(',')
|
||||||
|
printTypeList.value.forEach(val => {
|
||||||
|
val.values = _.map(
|
||||||
|
_.filter(val.list, item => printContentTypes.includes(item.value)),
|
||||||
|
'value'
|
||||||
|
);
|
||||||
|
})
|
||||||
|
|
||||||
editModalRef.value?.setFormData(data);
|
// editModalRef.value?.handleDisabled(false);
|
||||||
|
// editModalRef.value?.setModalVisible();
|
||||||
|
// // 根据id获取数据进行填充
|
||||||
|
// let data = await UserAPI.get(row.id);
|
||||||
|
// data.printType = data.printType.split(",");
|
||||||
|
|
||||||
|
// if (data.categoryIds) {
|
||||||
|
// data.categoryIdsArr = JSON.parse(data.categoryIds);
|
||||||
|
// } else {
|
||||||
|
// data.categoryIdsArr = [];
|
||||||
|
// }
|
||||||
|
// console.log(data.categoryIdsArr);
|
||||||
|
// console.log(data);
|
||||||
|
|
||||||
|
// data.classifyPrint = data.classifyPrint * 1;
|
||||||
|
|
||||||
|
// editModalRef.value?.setFormData(data);
|
||||||
}
|
}
|
||||||
// 其他工具栏
|
// 其他工具栏
|
||||||
function handleToolbarClick(name: string) {
|
function handleToolbarClick(name: string) {
|
||||||
|
|||||||
@@ -198,6 +198,12 @@ function handleLogin() {
|
|||||||
userStore
|
userStore
|
||||||
.login(user)
|
.login(user)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
|
|
||||||
|
console.log('login===', res);
|
||||||
|
|
||||||
|
localStorage.setItem('shopStaff', JSON.stringify(res.shopStaff))
|
||||||
|
|
||||||
|
|
||||||
const token = getToken();
|
const token = getToken();
|
||||||
console.log("token", token);
|
console.log("token", token);
|
||||||
$douyin_checkIn({
|
$douyin_checkIn({
|
||||||
|
|||||||
@@ -15,7 +15,11 @@
|
|||||||
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
<template #refundMode="scope">
|
||||||
|
<!-- <el-switch v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
|
||||||
|
@click="isRefundStockChange($event, scope)" /> -->
|
||||||
|
<el-text>{{ returnLabel(scope.row[scope.prop]) }}</el-text>
|
||||||
|
</template>
|
||||||
<template #slotNameimage="scope">
|
<template #slotNameimage="scope">
|
||||||
<el-image v-if="scope.row.pic" :src="scope.row.pic" lazy style="width: 40px; height: 40px" />
|
<el-image v-if="scope.row.pic" :src="scope.row.pic" lazy style="width: 40px; height: 40px" />
|
||||||
<div v-else>无</div>
|
<div v-else>无</div>
|
||||||
@@ -68,6 +72,17 @@ import editModalConfig from "./categoryconfig/edit";
|
|||||||
import searchConfig from "./categoryconfig/search";
|
import searchConfig from "./categoryconfig/search";
|
||||||
import { isSyncStatus, downloadFile } from "@/utils/index";
|
import { isSyncStatus, downloadFile } from "@/utils/index";
|
||||||
|
|
||||||
|
const options = ref([
|
||||||
|
{ label: "退菜退库存", value: 1 },
|
||||||
|
{ label: "仅退菜不退库存", value: 2 },
|
||||||
|
{ label: "每次询问-退菜后弹窗提示,可手动选择", value: 3 },
|
||||||
|
])
|
||||||
|
|
||||||
|
function returnLabel(value: number) {
|
||||||
|
const option = options.value.find((option) => option.value === value);
|
||||||
|
return option ? option.label : "未知";
|
||||||
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
searchRef,
|
searchRef,
|
||||||
contentRef,
|
contentRef,
|
||||||
@@ -106,6 +121,16 @@ async function handleExportClick() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 退菜是否退库存开关切换
|
||||||
|
async function isRefundStockChange(e: any, scope: any) {
|
||||||
|
try {
|
||||||
|
await UserAPI.update(scope.row);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
ElMessage.error("操作失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 新增
|
// 新增
|
||||||
async function handleAddClick() {
|
async function handleAddClick() {
|
||||||
addModalRef.value?.setModalVisible();
|
addModalRef.value?.setModalVisible();
|
||||||
|
|||||||
@@ -77,6 +77,13 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
|||||||
templet: "switch",
|
templet: "switch",
|
||||||
slotName: "status",
|
slotName: "status",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "退菜是否退库存",
|
||||||
|
align: "center",
|
||||||
|
prop: "refundMode",
|
||||||
|
templet: "custom",
|
||||||
|
slotName: "refundMode",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "操作",
|
label: "操作",
|
||||||
align: "center",
|
align: "center",
|
||||||
|
|||||||
@@ -43,8 +43,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #tuikuantuihui="scope">
|
<template #tuikuantuihui="scope">
|
||||||
<el-switch v-if="!scope.row.productId" v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
|
<!-- <el-switch v-if="!scope.row.productId" v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
|
||||||
@click="handleSwitchhaocai(scope.row)"></el-switch>
|
@click="handleSwitchhaocai(scope.row)"></el-switch> -->
|
||||||
|
<el-text>{{ returnLabel(scope.row[scope.prop]) }}</el-text>
|
||||||
</template>
|
</template>
|
||||||
<template #sellOut="scope">
|
<template #sellOut="scope">
|
||||||
<el-switch v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
|
<el-switch v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
|
||||||
@@ -210,6 +211,17 @@ import TableFour from './indexconfig/TableFour.vue'
|
|||||||
|
|
||||||
const myDialogRefRecord = ref(null)
|
const myDialogRefRecord = ref(null)
|
||||||
|
|
||||||
|
const refoundModeOptions = ref([
|
||||||
|
{ label: "退菜退库存", value: 1 },
|
||||||
|
{ label: "仅退菜不退库存", value: 2 },
|
||||||
|
{ label: "每次询问-退菜后弹窗提示,可手动选择", value: 3 },
|
||||||
|
])
|
||||||
|
|
||||||
|
function returnLabel(value: number) {
|
||||||
|
const option = refoundModeOptions.value.find((option) => option.value == value);
|
||||||
|
return option ? option.label : "未知";
|
||||||
|
}
|
||||||
|
|
||||||
let dataAll = reactive({
|
let dataAll = reactive({
|
||||||
dataList: [],
|
dataList: [],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
|
|||||||
{
|
{
|
||||||
label: "退菜是否退库存",
|
label: "退菜是否退库存",
|
||||||
align: "center",
|
align: "center",
|
||||||
prop: "isRefundStock",
|
prop: "refundMode",
|
||||||
templet: "custom",
|
templet: "custom",
|
||||||
slotName: "tuikuantuihui",
|
slotName: "tuikuantuihui",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user