Browse Source

包装信息组件化

master
陈薪名 1 year ago
parent
commit
7880748df3
  1. 125
      src/utils/disposition/tableColumns.ts
  2. 376
      src/views/wms/itempackaging/index.vue

125
src/utils/disposition/tableColumns.ts

@ -284,6 +284,131 @@ export const ItemBasicRules = reactive({
], ],
}) })
/**
* @returns {Array}
*/
export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '物品代码',
field: 'itemCode',
table: {
width: 150
}
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '包装单位',
field: 'stdPackUnit',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '包装数量',
field: 'stdPackQty'
},
{
label: '替代包装单位',
field: 'altPackUnit1',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '替代包装量',
field: 'altPackQty1'
},
{
label: '替代包装单位',
field: 'altPackUnit1',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '替代包装量',
field: 'altPackQty2'
},
{
label: '替代包装单位',
field: 'altPackUnit3',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '替代包装量',
field: 'altPackQty3'
},
{
label: '替代包装单位',
field: 'altPackUnit4',
dictType: DICT_TYPE.PACK_UNIT,
dictClass: 'string'
},
{
label: '替代包装量',
field: 'altPackQty4'
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string'
},
{
label: '生效时间',
field: 'activeTime',
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '失效时间',
field: 'expireTime',
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '创建时间',
field: 'createTime',
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '创建者',
field: 'creator'
},
{
label: '操作',
field: 'action',
isDetail: false,
table: {
width: 150
}
}
]))
/** /**
* @returns {Array} * @returns {Array}
*/ */

376
src/views/wms/itempackaging/index.vue

@ -1,243 +1,47 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form <Search :schema="Itempackaging.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
class="-mb-15px" </ContentWrap>
:model="queryParams"
ref="queryFormRef" <!-- 列表头部 -->
:inline="true" <TableHead
label-width="68px" :HeadButttondata="HeadButttondata"
@buttonBaseClick="buttonBaseClick"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="Itempackaging.allSchemas.tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
> >
<el-form-item label="物品代码" prop="itemCode"> <template #action="{ row }">
<el-input
v-model="queryParams.itemCode"
placeholder="请输入物品代码"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="计量单位" prop="uom">
<el-select v-model="queryParams.uom" placeholder="请选择计量单位" clearable class="!w-240px">
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.UOM)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="包装单位" prop="stdPackUnit">
<el-select
v-model="queryParams.stdPackUnit"
placeholder="请选择包装单位"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.PACK_UNIT)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="包装数量" prop="stdPackQty">
<el-input
v-model="queryParams.stdPackQty"
placeholder="请输入包装数量"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="替代包装单位" prop="altPackUnit1">
<el-select
v-model="queryParams.altPackUnit1"
placeholder="请选择替代包装单位"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.PACK_UNIT)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="替代包装量" prop="altPackQty1">
<el-input
v-model="queryParams.altPackQty1"
placeholder="请输入替代包装量"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="替代包装单位" prop="altPackUnit2">
<el-select
v-model="queryParams.altPackUnit2"
placeholder="请选择替代包装单位"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.PACK_UNIT)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="替代包装量" prop="altPackQty2">
<el-input
v-model="queryParams.altPackQty2"
placeholder="请输入替代包装量"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="替代包装单位" prop="altPackUnit3">
<el-select
v-model="queryParams.altPackUnit3"
placeholder="请选择替代包装单位"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.PACK_UNIT)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="替代包装量" prop="altPackQty3">
<el-input
v-model="queryParams.altPackQty3"
placeholder="请输入替代包装量"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="替代包装单位" prop="altPackUnit4">
<el-select
v-model="queryParams.altPackUnit4"
placeholder="请选择替代包装单位"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.PACK_UNIT)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="替代包装量" prop="altPackQty4">
<el-input
v-model="queryParams.altPackQty4"
placeholder="请输入替代包装量"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="是否可用" prop="available">
<el-select
v-model="queryParams.available"
placeholder="请选择是否可用"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="生效时间" prop="activeTime">
<el-date-picker
v-model="queryParams.activeTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="失效时间" prop="expireTime">
<el-date-picker
v-model="queryParams.expireTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="queryParams.remark"
placeholder="请输入备注"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="创建者ID" prop="creator">
<el-input
v-model="queryParams.creator"
placeholder="请输入创建者ID"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button type="info" plain @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button type="info" plain @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button <el-button
link
type="primary" type="primary"
@click="openForm('create')" @click="openForm('update', row.id)"
v-hasPermi="['wms:itempackaging:create']" v-hasPermi="['wms:itembasic:update']"
> >
<Icon icon="ep:plus" class="mr-5px" /> 新增 编辑
</el-button> </el-button>
<el-button <el-button
type="success" link
@click="handleExport" type="danger"
:loading="exportLoading" @click="handleDelete(row.id)"
v-hasPermi="['wms:itempackaging:export']" v-hasPermi="['wms:itembasic:delete']"
> >
<Icon icon="ep:download" class="mr-5px" /> 导出 删除
</el-button> </el-button>
</el-form-item> </template>
</el-form> </Table>
</ContentWrap> <!-- <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="物品代码" align="center" prop="itemCode" width="150px" /> <el-table-column label="物品代码" align="center" prop="itemCode" width="150px" />
<el-table-column label="计量单位" align="center" prop="uom" width="150px"> <el-table-column label="计量单位" align="center" prop="uom" width="150px">
<template #default="scope"> <template #default="scope">
@ -322,14 +126,14 @@
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table> -->
<!-- 分页 --> <!-- 分页 -->
<Pagination <!-- <Pagination
:total="total" :total="total"
v-model:page="queryParams.pageNo" v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize" v-model:limit="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> /> -->
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
@ -337,68 +141,71 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import * as ItempackagingApi from '@/api/wms/itempackaging' import * as ItempackagingApi from '@/api/wms/itempackaging'
import ItempackagingForm from './ItempackagingForm.vue' import ItempackagingForm from './ItempackagingForm.vue'
import { Itempackaging } from '@/utils/disposition/tableColumns'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
defineOptions({ name: 'Itempackaging' }) defineOptions({ name: 'Itempackaging' })
const message = useMessage() // const { tableObject, tableMethods } = useTable({
const { t } = useI18n() // getListApi: ItempackagingApi.getItempackagingPage //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
itemCode: null,
uom: null,
stdPackUnit: null,
stdPackQty: null,
altPackUnit1: null,
altPackQty1: null,
altPackUnit2: null,
altPackQty2: null,
altPackUnit3: null,
altPackQty3: null,
altPackUnit4: null,
altPackQty4: null,
available: null,
activeTime: [],
expireTime: [],
remark: null,
createTime: [],
creator: null
}) })
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */ //
const getList = async () => { const { getList, setSearchParams } = tableMethods
loading.value = true
try { //
const data = await ItempackagingApi.getItempackagingPage(queryParams) const HeadButttondata = [
list.value = data.list defaultButtons.defaultAddBtn(null), //
total.value = data.total defaultButtons.defaultImportBtn(null), //
} finally { defaultButtons.defaultExportBtn(null), //
loading.value = false // defaultButtons.defaultFilterBtn(), //
defaultButtons.defaultFreshBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
//
if (val == 'add') {
console.log(417, item)
}
//
else if (val == 'import') {
}
//
else if (val == 'export') {
handleExport()
}
//
else if (val == 'refresh') {
getList()
}
//
else if (val == 'filtrate') {
}
//
else {
}
} }
}
/** 搜索按钮操作 */ const message = useMessage() //
const handleQuery = () => { const { t } = useI18n() //
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
@ -420,13 +227,14 @@ const handleDelete = async (id: number) => {
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => { const handleExport = async () => {
try { try {
// //
await message.exportConfirm() await message.exportConfirm()
// //
exportLoading.value = true exportLoading.value = true
const data = await ItempackagingApi.exportItempackaging(queryParams) const data = await ItempackagingApi.exportItempackaging(setSearchParams)
download.excel(data, '物品包装信息 .xls') download.excel(data, '物品包装信息 .xls')
} catch { } catch {
} finally { } finally {

Loading…
Cancel
Save