Browse Source

标签页面修改

master
李胜楠 1 year ago
parent
commit
ab0b3507c5
  1. 56
      src/api/wms/barbasic/index.ts
  2. 19
      src/api/wms/barcode/index.ts
  3. 63
      src/api/wms/labeltype/index.ts
  4. 4
      src/utils/dict.ts
  5. 101
      src/views/wms/basicDataManage/labelManage/barbasic/barbasic.data.ts
  6. 231
      src/views/wms/basicDataManage/labelManage/barbasic/index.vue
  7. 34
      src/views/wms/basicDataManage/labelManage/barcode/barcode.data.ts
  8. 81
      src/views/wms/basicDataManage/labelManage/barcode/index.vue
  9. 244
      src/views/wms/basicDataManage/labelManage/labeltype/index.vue
  10. 154
      src/views/wms/basicDataManage/labelManage/labeltype/labeltype.data.ts

56
src/api/wms/barbasic/index.ts

@ -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' })
}

19
src/api/wms/barcode/index.ts

@ -13,7 +13,8 @@ export interface BarcodeVO {
encyptMethod: string
masterId: number
trimEnd: string
isEncypt: string
isEncypt: string,
labelType: string,
}
// 查询条码片段列表
@ -21,38 +22,38 @@ export const getBarcodePage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/barcode/senior', data })
return await request.post({ url: '/label/barcode/senior', data })
} else {
return await request.get({ url: `/wms/barcode/page`, params })
return await request.get({ url: `/label/barcode/page`, params })
}
}
// 查询条码片段详情
export const getBarcode = async (id: number) => {
return await request.get({ url: `/wms/barcode/get?id=` + id })
return await request.get({ url: `/label/barcode/get?id=` + id })
}
// 新增条码片段
export const createBarcode = async (data: BarcodeVO) => {
return await request.post({ url: `/wms/barcode/create`, data })
return await request.post({ url: `/label/barcode/create`, data })
}
// 修改条码片段
export const updateBarcode = async (data: BarcodeVO) => {
return await request.put({ url: `/wms/barcode/update`, data })
return await request.put({ url: `/label/barcode/update`, data })
}
// 删除条码片段
export const deleteBarcode = async (id: number) => {
return await request.delete({ url: `/wms/barcode/delete?id=` + id })
return await request.delete({ url: `/label/barcode/delete?id=` + id })
}
// 导出条码片段 Excel
export const exportBarcode = async (params) => {
return await request.download({ url: `/wms/barcode/export-excel`, params })
return await request.download({ url: `/label/barcode/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/barcode/get-import-template' })
return request.download({ url: '/label/barcode/get-import-template' })
}

63
src/api/wms/labeltype/index.ts

@ -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' })
}

4
src/utils/dict.ts

@ -266,5 +266,7 @@ export enum DICT_TYPE {
DATA_TYPE = 'data_type', // 数据类型
PACK_UNIT = 'pack_unit', // 包装单位
DETAIL_STATUS = 'detail_status', // 明细状态
TRANSFER_MODE = 'transfer_mode' // 运输方式
TRANSFER_MODE = 'transfer_mode', // 运输方式
LABEL_TYPE = 'label_type', // 标签类型
LABEL_STATUS = 'label_status' // 标签状态
}

101
src/views/wms/basicDataManage/labelManage/barbasic/barbasic.data.ts

@ -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'
// }
// }
]))

231
src/views/wms/basicDataManage/labelManage/barbasic/index.vue

@ -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>

34
src/views/wms/basicDataManage/labelManage/barcode/barcode.data.ts

@ -12,17 +12,29 @@ export const BarcodeRules = reactive({
})
export const Barcode = useCrudSchemas(reactive<CrudSchema[]>([
// {
// label: 'id',
// field: 'id',
// sort: 'custom',
// isForm: false,
// },
{
label: 'id',
field: 'id',
label: '代码',
field: 'code',
sort: 'custom',
isForm: false,
isSearch: true,
table: {
fixed: 'left'
}
},
{
label: '代码',
field: 'code',
label: '标签类型',
field: 'labelType',
sort: 'custom',
dictType: DICT_TYPE.LABEL_TYPE,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '名称',
@ -54,7 +66,7 @@ export const Barcode = useCrudSchemas(reactive<CrudSchema[]>([
form: {
component: 'InputNumber',
componentProps: {
min: 0
min: 0,
},
value: 0
},
@ -95,6 +107,16 @@ export const Barcode = useCrudSchemas(reactive<CrudSchema[]>([
label: '是否加密',
field: 'isEncypt',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '操作',

81
src/views/wms/basicDataManage/labelManage/barcode/index.vue

@ -8,7 +8,7 @@
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
:route-name="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="Barcode.allSchemas"
@ -41,13 +41,11 @@
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="getList"
@success="formsSuccess"
:rules="BarcodeRules"
:formAllSchemas="Barcode.allSchemas"
:searchTableParams="searchTableParams"
:apiUpdate="BarcodeApi.updateBom"
:apiCreate="BarcodeApi.createBom"
@searchTableSuccess="searchTableSuccess"
:apiUpdate="BarcodeApi.updateBarcode"
:apiCreate="BarcodeApi.createBarcode"
:isBusiness="false"
/>
@ -60,45 +58,31 @@
<script setup lang="ts">
import download from '@/utils/download'
import { Barcode,BarcodeRules } from './barcode.data'
import * as BarcodeApi from '@/api/wms/barcode'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import { Barcode, BarcodeRules } from './barcode.data'
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: 'Barcode' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(Barcode.allSchemas.tableColumns)
console.log(tableColumns.value);
//
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const searchTableParams = ref([
//{
// formField: 'productItemCode',
// searchTableTitle: '',
// searchTableAllSchemas: Itembasic.allSchemas,
// searchTablePage: ItembasicApi.getItembasicPage
//}
])
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
)
}
const { tableObject, tableMethods } = useTable({
getListApi: BarcodeApi.getBarcodePage //
})
@ -109,10 +93,10 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:barcode:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'wms:barcode:import'}), //
// defaultButtons.defaultExportBtn({hasPermi:'wms:barcode:export'}), //
defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultImportBtn({hasPermi:'wms:barcode:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:barcode:export'}), //
defaultButtons.defaultFreshBtn(null),//
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
@ -141,18 +125,15 @@ const buttonBaseClick = (val, item) => {
}
// -
const butttondata = (row) => {
return [
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:barcode:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:barcode:delete'}), //
]
}
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
// const res = await BarcodeApi.getItempackaging(row.id)
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
@ -161,14 +142,27 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm =async (type: string, row?: number) => {
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
if (formType === 'create') {
await BarcodeApi.createBarcode(data)
message.success(t('common.createSuccess'))
} else {
await BarcodeApi.updateBarcode(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)
detailRef.value.openDetail(row, titleName, titleValue, 'basicBarcode')
}
/** 删除按钮操作 */
@ -192,7 +186,7 @@ const handleExport = async () => {
await message.exportConfirm()
//
exportLoading.value = true
const data = await BarcodeApi.exportBarcode(setSearchParams)
const data = await BarcodeApi.exportBarcode(tableObject.params)
download.excel(data, '条码片段.xlsx')
} catch {
} finally {
@ -211,7 +205,6 @@ const importTemplateData = reactive({
templateUrl: '',
templateTitle: '条码片段导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
@ -227,7 +220,7 @@ const searchFormClick = (searchData) => {
}
/** 初始化 **/
onMounted(async () => {
onMounted(async() => {
getList()
importTemplateData.templateUrl = await BarcodeApi.importTemplate()
})

244
src/views/wms/basicDataManage/labelManage/labeltype/index.vue

@ -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>

154
src/views/wms/basicDataManage/labelManage/labeltype/labeltype.data.ts

@ -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…
Cancel
Save