李胜楠
1 year ago
10 changed files with 942 additions and 75 deletions
@ -0,0 +1,56 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface BarbasicVO { |
||||
|
id: number |
||||
|
number: string |
||||
|
type: string |
||||
|
template: string |
||||
|
status: string |
||||
|
relateNumber: string |
||||
|
barcodeString: string |
||||
|
printTimes: number |
||||
|
lastPrintTime: string |
||||
|
lastPrintUserId: string |
||||
|
lastPrintUserName: string |
||||
|
} |
||||
|
|
||||
|
// 查询条码实体基类列表
|
||||
|
export const getBarbasicPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/barbasic/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/barbasic/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询条码实体基类详情
|
||||
|
export const getBarbasic = async (id: number) => { |
||||
|
return await request.get({ url: `/wms/barbasic/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增条码实体基类
|
||||
|
export const createBarbasic = async (data: BarbasicVO) => { |
||||
|
return await request.post({ url: `/wms/barbasic/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改条码实体基类
|
||||
|
export const updateBarbasic = async (data: BarbasicVO) => { |
||||
|
return await request.put({ url: `/wms/barbasic/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除条码实体基类
|
||||
|
export const deleteBarbasic = async (id: number) => { |
||||
|
return await request.delete({ url: `/wms/barbasic/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出条码实体基类 Excel
|
||||
|
export const exportBarbasic = async (params) => { |
||||
|
return await request.download({ url: `/wms/barbasic/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/wms/barbasic/get-import-template' }) |
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface LabeltypeVO { |
||||
|
id: number |
||||
|
labelType: string |
||||
|
description: string |
||||
|
dataProtocol: string |
||||
|
splitMehod: string |
||||
|
header: string |
||||
|
version: string |
||||
|
separators: string |
||||
|
validateMethod: string |
||||
|
validateNumber: number |
||||
|
encyptEthod: string |
||||
|
compressMethod: string |
||||
|
templateName: string |
||||
|
templateFile: string |
||||
|
barcodeSegments: string |
||||
|
labelCode: string |
||||
|
isEncypt: string |
||||
|
isCompress: string |
||||
|
} |
||||
|
|
||||
|
// 查询标签定义列表
|
||||
|
export const getLabeltypePage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/wms/labeltype/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/wms/labeltype/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询标签定义详情
|
||||
|
export const getLabeltype = async (id: number) => { |
||||
|
return await request.get({ url: `/wms/labeltype/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增标签定义
|
||||
|
export const createLabeltype = async (data: LabeltypeVO) => { |
||||
|
return await request.post({ url: `/wms/labeltype/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改标签定义
|
||||
|
export const updateLabeltype = async (data: LabeltypeVO) => { |
||||
|
return await request.put({ url: `/wms/labeltype/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除标签定义
|
||||
|
export const deleteLabeltype = async (id: number) => { |
||||
|
return await request.delete({ url: `/wms/labeltype/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出标签定义 Excel
|
||||
|
export const exportLabeltype = async (params) => { |
||||
|
return await request.download({ url: `/wms/labeltype/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/wms/labeltype/get-import-template' }) |
||||
|
} |
@ -0,0 +1,101 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const BarbasicRules = reactive({ |
||||
|
number: [required], |
||||
|
type: [required], |
||||
|
template: [required], |
||||
|
status: [required], |
||||
|
barcodeString: [required], |
||||
|
printTimes: [required], |
||||
|
}) |
||||
|
|
||||
|
export const Barbasic = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '标签号', |
||||
|
field: 'number', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
fixed: 'left' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '标签类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
dictType: DICT_TYPE.LABEL_TYPE, |
||||
|
dictClass: 'string' |
||||
|
}, |
||||
|
{ |
||||
|
label: '标签模板', |
||||
|
field: 'template', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '标签状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
dictType: DICT_TYPE.LABEL_STATUS, |
||||
|
dictClass: 'string' |
||||
|
}, |
||||
|
{ |
||||
|
label: '关联号', |
||||
|
field: 'relateNumber', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '标签条码字符串', |
||||
|
field: 'barcodeString', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '打印次数', |
||||
|
field: 'printTimes', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 0 |
||||
|
}, |
||||
|
value: 0 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后打印时间', |
||||
|
field: 'lastPrintTime', |
||||
|
sort: 'custom', |
||||
|
formatter: dateFormatter, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后打印人ID', |
||||
|
field: 'lastPrintUserId', |
||||
|
sort: 'custom' |
||||
|
}, |
||||
|
{ |
||||
|
label: '最后打印人用户名', |
||||
|
field: 'lastPrintUserName', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
// {
|
||||
|
// label: '操作',
|
||||
|
// field: 'action',
|
||||
|
// isForm: false,
|
||||
|
// table: {
|
||||
|
// width: 150,
|
||||
|
// fixed: 'right'
|
||||
|
// }
|
||||
|
// }
|
||||
|
])) |
@ -0,0 +1,231 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Barbasic.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Barbasic.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 #number="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '标签号', row.number)"> |
||||
|
<span>{{ row.number }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="getList" |
||||
|
:rules="BarbasicRules" |
||||
|
:formAllSchemas="Barbasic.allSchemas" |
||||
|
:searchTableParams="searchTableParams" |
||||
|
:apiUpdate="BarbasicApi.updateBarbasic" |
||||
|
:apiCreate="BarbasicApi.createBarbasic" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Barbasic.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/barbasic/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { Barbasic,BarbasicRules } from './barbasic.data' |
||||
|
import * as BarbasicApi from '@/api/wms/barbasic' |
||||
|
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: 'Barbasic' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Barbasic.allSchemas.tableColumns) |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 查询列表页面参数设置 |
||||
|
const searchTableParams = ref([ |
||||
|
//{ |
||||
|
// formField: 'productItemCode', |
||||
|
// searchTableTitle: '物料信息', |
||||
|
// searchTableAllSchemas: Itembasic.allSchemas, |
||||
|
// searchTablePage: ItembasicApi.getItembasicPage |
||||
|
//} |
||||
|
]) |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: BarbasicApi.getBarbasicPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
// defaultButtons.defaultAddBtn({hasPermi:'wms:barbasic:create'}), // 新增 |
||||
|
// defaultButtons.defaultImportBtn({hasPermi:'wms:barbasic:import'}), // 导入 |
||||
|
// defaultButtons.defaultExportBtn({hasPermi:'wms:barbasic: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:barbasic:update'}), // 编辑 |
||||
|
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:barbasic: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) |
||||
|
} |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicBarbasic') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await BarbasicApi.deleteBarbasic(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 BarbasicApi.exportBarbasic(setSearchParams) |
||||
|
download.excel(data, '条码实体基类.xls') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 导入 */ |
||||
|
const importFormRef = ref() |
||||
|
const handleImport = () => { |
||||
|
importFormRef.value.open() |
||||
|
} |
||||
|
// 导入附件弹窗所需的参数 |
||||
|
const importTemplateData = reactive({ |
||||
|
templateUrl: '', |
||||
|
templateTitle: '条码实体基类导入模版.xls' |
||||
|
}) |
||||
|
// 导入成功之后 |
||||
|
const importSuccess = () => { |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 筛选提交 |
||||
|
const searchFormClick = (searchData) => { |
||||
|
tableObject.params = { |
||||
|
isSearch: true, |
||||
|
filters: searchData.filters |
||||
|
} |
||||
|
getList() // 刷新当前列表 |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(async () => { |
||||
|
getList() |
||||
|
importTemplateData.templateUrl = await BarbasicApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,244 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Labeltype.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Labeltype.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 #labelCode="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '标签代码', row.labelCode)"> |
||||
|
<span>{{ row.labelCode }}</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="LabeltypeRules" |
||||
|
:formAllSchemas="Labeltype.allSchemas" |
||||
|
:searchTableParams="searchTableParams" |
||||
|
:apiUpdate="LabeltypeApi.updateLabeltype" |
||||
|
:apiCreate="LabeltypeApi.createLabeltype" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Labeltype.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/wms/labeltype/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { Labeltype,LabeltypeRules } from './labeltype.data' |
||||
|
import * as LabeltypeApi from '@/api/wms/labeltype' |
||||
|
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: 'Labeltype' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Labeltype.allSchemas.tableColumns) |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
// 查询列表页面参数设置 |
||||
|
const searchTableParams = ref([ |
||||
|
//{ |
||||
|
// formField: 'productItemCode', |
||||
|
// searchTableTitle: '物料信息', |
||||
|
// searchTableAllSchemas: Itembasic.allSchemas, |
||||
|
// searchTablePage: ItembasicApi.getItembasicPage |
||||
|
//} |
||||
|
]) |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: LabeltypeApi.getLabeltypePage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn(null), // 新增 |
||||
|
// defaultButtons.defaultImportBtn({hasPermi:'wms:labeltype:import'}), // 导入 |
||||
|
// defaultButtons.defaultExportBtn(null), // 导出 |
||||
|
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(null), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn(null), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
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) => { |
||||
|
if (formType === 'create') { |
||||
|
await LabeltypeApi.createLabeltype(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await LabeltypeApi.updateLabeltype(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
basicFormRef.value.dialogVisible = false |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick(() => { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicLabeltype') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await LabeltypeApi.deleteLabeltype(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 LabeltypeApi.exportLabeltype(setSearchParams) |
||||
|
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 LabeltypeApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,154 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const LabeltypeRules = reactive({ |
||||
|
labelType: [required], |
||||
|
dataProtocol: [required], |
||||
|
splitMehod: [required], |
||||
|
validateMethod: [required], |
||||
|
templateName: [required], |
||||
|
labelCode: [required], |
||||
|
isEncypt: [required], |
||||
|
isCompress: [required], |
||||
|
}) |
||||
|
|
||||
|
export const Labeltype = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
// {
|
||||
|
// label: 'id',
|
||||
|
// field: 'id',
|
||||
|
// sort: 'custom',
|
||||
|
// isForm: false,
|
||||
|
// },
|
||||
|
{ |
||||
|
label: '标签代码', |
||||
|
field: 'labelCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'left' |
||||
|
}, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '标签类型', |
||||
|
field: 'labelType', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.LABEL_TYPE, |
||||
|
dictClass:'string', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '描述', |
||||
|
field: 'description', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width:100 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '数据协议', |
||||
|
field: 'dataProtocol', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '拆分方法', |
||||
|
field: 'splitMehod', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '数据头', |
||||
|
field: 'header', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '版本号', |
||||
|
field: 'version', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '分隔符', |
||||
|
field: 'separators', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '校验方法', |
||||
|
field: 'validateMethod', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '校验数', |
||||
|
field: 'validateNumber', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 0 |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '加密方法', |
||||
|
field: 'encyptEthod', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '压缩方法', |
||||
|
field: 'compressMethod', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '模板名称', |
||||
|
field: 'templateName', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '模板文件', |
||||
|
field: 'templateFile', |
||||
|
sort: 'custom', |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否加密', |
||||
|
field: 'isEncypt', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否压缩', |
||||
|
field: 'isCompress', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
Loading…
Reference in new issue