Browse Source

YT-1928:补给品发料标签

intex_online20250220
songguoqiang 2 months ago
parent
commit
9bcb0a3bcd
  1. 5
      src/api/wms/location/index.ts
  2. 49
      src/api/wms/supplyLabel/index.ts
  3. 244
      src/views/wms/basicDataManage/labelManage/supplyLabel/index.vue
  4. 245
      src/views/wms/basicDataManage/labelManage/supplyLabel/supplyLabel.data.ts

5
src/api/wms/location/index.ts

@ -199,3 +199,8 @@ export const getLocationListByBusinesstype = async (params) => {
}
// 根据库区类型获取库位列表
export const getLocationListByAreaType = async (params) => {
return await request.get({ url: `/wms/location/getLocationListByAreaType`, params })
}

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

@ -0,0 +1,49 @@
import request from '@/config/axios'
export interface SupplyLabelVO {
id: number
itemCode: string
locationCode: string
uom: string
}
// 查询补给品标签列表
export const getSupplyLabelPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/supply-label/senior', data })
} else {
return await request.get({ url: `/wms/supply-label/page`, params })
}
}
// 查询补给品标签详情
export const getSupplyLabel = async (id: number) => {
return await request.get({ url: `/wms/supply-label/get?id=` + id })
}
// 新增补给品标签
export const createSupplyLabel = async (data: SupplyLabelVO) => {
return await request.post({ url: `/wms/supply-label/create`, data })
}
// 修改补给品标签
export const updateSupplyLabel = async (data: SupplyLabelVO) => {
return await request.put({ url: `/wms/supply-label/update`, data })
}
// 删除补给品标签
export const deleteSupplyLabel = async (id: number) => {
return await request.delete({ url: `/wms/supply-label/delete?id=` + id })
}
// 导出补给品标签 Excel
export const exportSupplyLabel = async (params) => {
return await request.download({ url: `/wms/supply-label/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/supply-label/get-import-template' })
}

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

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="SupplyLabel.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="SupplyLabel.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="SupplyLabelRules"
:formAllSchemas="SupplyLabel.allSchemas"
:apiUpdate="SupplyLabelApi.updateSupplyLabel"
:apiCreate="SupplyLabelApi.createSupplyLabel"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="SupplyLabel.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/supply-label/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { SupplyLabel,SupplyLabelRules } from './supplyLabel.data'
import * as SupplyLabelApi from '@/api/wms/supplyLabel'
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: 'SupplyLabel' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(SupplyLabel.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: SupplyLabelApi.getSupplyLabelPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:supplyLabel:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:supplyLabel:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:supplyLabel: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:supplyLabel:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:supplyLabel: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 =SupplyLabel.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 SupplyLabelApi.createSupplyLabel(data)
message.success(t('common.createSuccess'))
} else {
await SupplyLabelApi.updateSupplyLabel(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, 'basicSupplyLabel')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await SupplyLabelApi.deleteSupplyLabel(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 SupplyLabelApi.exportSupplyLabel(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 SupplyLabelApi.importTemplate()
})
</script>

245
src/views/wms/basicDataManage/labelManage/supplyLabel/supplyLabel.data.ts

@ -0,0 +1,245 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import * as ItempackagingApi from '@/api/wms/itempackage'
import { Itempackaging } from '@/views/wms/basicDataManage/itemManage/itempackage/itempackage.data'
import * as LocationApi from '@/api/wms/location'
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data'
import * as WarehouseApi from '@/api/wms/warehouse'
import { Warehouse } from '@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
import * as ProductionlineApi from '@/api/wms/productionline'
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data'
import * as WorkStationApi from '@/api/wms/workstation'
import { Workstation } from '@/views/wms/basicDataManage/factoryModeling/workstation/workstation.data'
import * as confgiApi from '@/api/infra/config'
// 表单校验
export const SupplyLabelRules = reactive({
itemCode: [required],
locationCode: [required],
})
export const SupplyLabel = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '品番',
field: 'itemCode',
sort: 'custom',
table: {
width: 150,
fixed: 'left'
},
isSearch: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择品番', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
}
}
},
{
label: '背番',
field: 'backNumber',
sort: 'custom',
isSearch: true,
isForm:true,
hiddenSearchHigh:true,
sortTableDefault:1,
table: {
width: 150
},
form:{
componentProps:{
disabled: true,
}
}
},
{
label: '计量单位', // 发料申请 与当前物料计量单位做匹配 : 原PACK_UNIT 修改:UOM
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm: {
disabled: true,
type: 'Select'
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '货架号',
field: 'itemGroup',
sort: 'custom',
table: {
width: 100
} ,
form: {
componentProps: {
disabled: true
}
},
},
{
label: '库位',
field: 'location',
sort: 'custom',
table: {
width: 150
},
isForm:true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择库位代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '库位信息', // 查询弹窗标题
searchAllSchemas: Location.allSchemas, // 查询弹窗所需类
searchPage: LocationApi.getLocationListByAreaType, // 查询弹窗所需分页方法
searchCondition: [{
key:'areaType',
value:'BS',
isMainValue: false
},{
key: 'available',
value: 'TRUE',
isMainValue: false
},
]
}
},
isSearch: true
},
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// isSearch:true,
// isForm: false,
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
// search: {
// value: 'TRUE',
// },
// form: {
// component: 'Switch',
// value: 'TRUE',
// componentProps: {
// inactiveValue: 'FALSE',
// activeValue: 'TRUE'
// }
// },
// table: {
// width: 110
// }
// },
{
label: '创建时间',
field: 'createTime',
isForm: false,
table: {
width: 180
},
formatter: dateFormatter,
detail: {
dateFormat : 'YYYY-MM-DD HH:mm:ss'
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '创建者',
field: 'creator',
table: {
width: 130
},
isForm: false,
isTable: true
},
{
label: '最后更新时间',
field: 'updateTime',
sort: 'custom',
isDetail: true,
isForm: false,
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '最后更新者',
field: 'updater',
isDetail: true,
isForm: false,
isTable: true,
table: {
width: 150
}
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 180,
fixed: 'right'
}
}
]))
Loading…
Cancel
Save