Browse Source

客户端与打印机名称关系

hella_online_20240829
陈薪名 4 months ago
parent
commit
689d3ee0cb
  1. 49
      src/api/wms/printClientPrinter/index.ts
  2. 244
      src/views/report/printClientPrinter/index.vue
  3. 43
      src/views/report/printClientPrinter/printClientPrinter.data.ts

49
src/api/wms/printClientPrinter/index.ts

@ -0,0 +1,49 @@
import request from '@/config/axios'
export interface PrintClientPrinterVO {
id: number
clientCode: string
printerName: string
remark: string
}
// 查询打印服务客户端与打印机名称关系列表
export const getPrintClientPrinterPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/print-client-printer/senior', data })
} else {
return await request.get({ url: `/wms/print-client-printer/page`, params })
}
}
// 查询打印服务客户端与打印机名称关系详情
export const getPrintClientPrinter = async (id: number) => {
return await request.get({ url: `/wms/print-client-printer/get?id=` + id })
}
// 新增打印服务客户端与打印机名称关系
export const createPrintClientPrinter = async (data: PrintClientPrinterVO) => {
return await request.post({ url: `/wms/print-client-printer/create`, data })
}
// 修改打印服务客户端与打印机名称关系
export const updatePrintClientPrinter = async (data: PrintClientPrinterVO) => {
return await request.put({ url: `/wms/print-client-printer/update`, data })
}
// 删除打印服务客户端与打印机名称关系
export const deletePrintClientPrinter = async (id: number) => {
return await request.delete({ url: `/wms/print-client-printer/delete?id=` + id })
}
// 导出打印服务客户端与打印机名称关系 Excel
export const exportPrintClientPrinter = async (params) => {
return await request.download({ url: `/wms/print-client-printer/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/print-client-printer/get-import-template' })
}

244
src/views/report/printClientPrinter/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="PrintClientPrinter.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="PrintClientPrinter.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="PrintClientPrinterRules"
:formAllSchemas="PrintClientPrinter.allSchemas"
:apiUpdate="PrintClientPrinterApi.updatePrintClientPrinter"
:apiCreate="PrintClientPrinterApi.createPrintClientPrinter"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="PrintClientPrinter.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/print-client-printer/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { PrintClientPrinter,PrintClientPrinterRules } from './printClientPrinter.data'
import * as PrintClientPrinterApi from '@/api/wms/printClientPrinter'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'PrintClientPrinter' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(PrintClientPrinter.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: PrintClientPrinterApi.getPrintClientPrinterPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:printClientPrinter:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:printClientPrinter:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:printClientPrinter:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:printClientPrinter:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:printClientPrinter:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =PrintClientPrinter.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await PrintClientPrinterApi.createPrintClientPrinter(data)
message.success(t('common.createSuccess'))
} else {
await PrintClientPrinterApi.updatePrintClientPrinter(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicPrintClientPrinter')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await PrintClientPrinterApi.deletePrintClientPrinter(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await PrintClientPrinterApi.exportPrintClientPrinter(tableObject.params)
download.excel(data, '打印服务客户端与打印机名称关系.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '打印服务客户端与打印机名称关系导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await PrintClientPrinterApi.importTemplate()
})
</script>

43
src/views/report/printClientPrinter/printClientPrinter.data.ts

@ -0,0 +1,43 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
// 表单校验
export const PrintClientPrinterRules = reactive({
clientCode: [required],
printerName: [required],
})
export const PrintClientPrinter = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isForm: false,
},
{
label: '客户端代码',
field: 'clientCode',
sort: 'custom',
isSearch: true,
},
{
label: '打印机名称',
field: 'printerName',
sort: 'custom',
isSearch: true,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
Loading…
Cancel
Save