Browse Source

基础数据table及查询项

master
陈薪名 12 months ago
parent
commit
e6afd53598
  1. 244
      src/utils/disposition/tableColumns.ts
  2. 184
      src/views/wms/itembasic/index.vue

244
src/utils/disposition/tableColumns.ts

@ -1,27 +1,231 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
/**
* @returns {Array}
*/
export const ItemBasic = [{
label: "物料代码",
prop: "code",
fixed: "left",
type: "name",
export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '代码',
field: 'code',
table: {
width: 150
}
},
{ label: "物料名称", prop: "name", },
{ type: "filter", label: "状态", prop: "status", filters: "itemStatus", },
{ label: "有效值", prop: "validity", },
{ label: "项目", prop: "project", },
{ type: "filter", label: "有效期", prop: "validityUnit", filters: "validityUnit", },
{ type: "filter", label: "ABC类", prop: 'abcClass', filters: "abcClass", },
{ type: "filter", label: "制造件", prop: 'canMake', filters: "whetherOrNot", },
{ type: "filter", label: "采购件", prop: 'canBuy', filters: "whetherOrNot", },
{ label: "产品类", prop: 'productLine', },
{ label: "E-LEVEL等级", prop: 'elevel', },
{ type: "filter", label: "是否虚拟物料", prop: "isPhantom", filters: "whetherOrNot" },
{ type: "filter", label: "是否是下线结算件", prop: "isOfflineSettlement", filters: "whetherOrNot" },
{ label: "特性", prop: 'characteristic' },
{ label: "管理类型", prop: 'remark' },
]
{
label: '名称',
field: 'name',
table: {
width: 150
}
},
{
label: '描述1',
field: 'desc1',
table: {
width: 150
}
},
{
label: '描述2',
field: 'desc2',
table: {
width: 150
}
},
{
label: '状态',
field: 'status',
dictType: DICT_TYPE.ITEM_STATUS,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '替代计量单位',
field: 'altUom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '是否标包',
field: 'isStdPack',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '可采购',
field: 'enableBuy',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '可制造',
field: 'enableMake',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '可委外加工',
field: 'enableOutsourcing',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '回收件',
field: 'isRecycled',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '虚零件',
field: 'isPhantom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: 'ABC类',
field: 'abcClass',
dictType: DICT_TYPE.ABC_CLASS,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '类型',
field: 'type',
dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '种类',
field: 'category',
dictType: DICT_TYPE.ITEM_CATEGORY,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '分组',
field: 'itemGroup',
dictType: DICT_TYPE.ITEM_GROUP,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '颜色',
field: 'color',
dictType: DICT_TYPE.ITEM_COLOR,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
label: '配置',
field: 'configuration',
dictType: DICT_TYPE.ITEM_CONFIGURATION,
dictClass: 'string',
isSearch: true,
isTable: true
},
{ label: '项目', field: 'project' },
{
label: '质量等级',
field: 'eqLevel',
dictType: DICT_TYPE.EQ_LEVEL,
dictClass: 'string',
isSearch: true,
isTable: true
},
{ label: '有效天数', field: 'validityDays' },
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: true,
isTable: true
},
{
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: 'remark', isTable: false },
{ label: '创建者ID', field: 'creator', isTable: false },
{
label: '操作',
field: 'action',
isDetail: false,
table: {
width: 150
}
}
]))
// 表单校验
export const ItemBasicRules = reactive({
mail: [
{ required: true, message: 'profile.rules.mail', trigger: 'blur' },
{
type: 'email',
message: 'profile.rules.truemail',
trigger: ['blur', 'change']
}
],
username: [required],
password: [required],
host: [required],
port: [required],
sslEnable: [required]
})
/**
* @returns {Array}
*/

184
src/views/wms/itembasic/index.vue

@ -1,7 +1,8 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
<Search :schema="ItemBasic.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<!-- <el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
@ -363,128 +364,26 @@
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</el-form> -->
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="代码" align="center" prop="code" width="150px" />
<el-table-column label="名称" align="center" prop="name" width="150px" />
<el-table-column label="描述1" align="center" prop="desc1" width="150px" />
<el-table-column label="描述2" align="center" prop="desc2" width="150px" />
<el-table-column label="状态" align="center" prop="status" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ITEM_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="计量单位" align="center" prop="uom" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.UOM" :value="scope.row.uom" />
</template>
</el-table-column>
<el-table-column label="替代计量单位" align="center" prop="altUom" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.UOM" :value="scope.row.altUom" />
</template>
</el-table-column>
<el-table-column label="是否标包" align="center" prop="isStdPack" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.isStdPack" />
</template>
</el-table-column>
<el-table-column label="可采购" align="center" prop="enableBuy" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.enableBuy" />
</template>
</el-table-column>
<el-table-column label="可制造" align="center" prop="enableMake" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.enableMake" />
</template>
</el-table-column>
<el-table-column label="可委外加工" align="center" prop="enableOutsourcing" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.enableOutsourcing" />
</template>
</el-table-column>
<el-table-column label="回收件" align="center" prop="isRecycled" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.isRecycled" />
</template>
</el-table-column>
<el-table-column label="虚零件" align="center" prop="isPhantom" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRUE_FALSE" :value="scope.row.isPhantom" />
</template>
</el-table-column>
<el-table-column label="ABC类" align="center" prop="abcClass" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ABC_CLASS" :value="scope.row.abcClass" />
</template>
</el-table-column>
<el-table-column label="类型" align="center" prop="type" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ITEM_TYPE" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="种类" align="center" prop="category" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ITEM_CATEGORY" :value="scope.row.category" />
</template>
</el-table-column>
<el-table-column label="分组" align="center" prop="itemGroup" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ITEM_GROUP" :value="scope.row.itemGroup" />
</template>
</el-table-column>
<el-table-column label="颜色" align="center" prop="color" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ITEM_COLOR" :value="scope.row.color" />
</template>
</el-table-column>
<el-table-column label="配置" align="center" prop="configuration" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ITEM_CONFIGURATION" :value="scope.row.configuration" />
</template>
</el-table-column>
<el-table-column label="项目" align="center" prop="project" width="150px" />
<el-table-column label="质量等级" align="center" prop="eqLevel" width="150px">
<template #default="scope">
<dict-tag :type="DICT_TYPE.EQ_LEVEL" :value="scope.row.eqLevel" />
</template>
</el-table-column>
<el-table-column label="有效天数" align="center" prop="validityDays" width="150px" />
<el-table-column label="是否可用" align="center" prop="available" width="150px" />
<el-table-column
label="生效时间"
align="center"
prop="activeTime"
:formatter="dateFormatter"
width="150px"
/>
<el-table-column
label="失效时间"
align="center"
prop="expireTime"
:formatter="dateFormatter"
width="150px"
/>
<el-table-column label="备注" align="center" prop="remark" width="150px" />
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="150px"
/>
<el-table-column label="创建者ID" align="center" prop="creator" width="150px" />
<el-table-column label="操作" align="center" width="150px">
<template #default="scope">
<Table
:columns="ItemBasic.allSchemas.tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
>
<template #action="{ row }">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
@click="openForm('update', row.id)"
v-hasPermi="['wms:itembasic:update']"
>
编辑
@ -492,21 +391,13 @@
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
@click="handleDelete(row.id)"
v-hasPermi="['wms:itembasic:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
@ -514,20 +405,26 @@
</template>
<script setup lang="ts">
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as ItembasicApi from '@/api/wms/itembasic'
import ItembasicForm from './ItembasicForm.vue'
import { ItemBasic } from '@/utils/disposition/tableColumns'
// tableObject
// tableMethods
// https://doc.iocoder.cn/vue3/crud-schema/
const { tableObject, tableMethods } = useTable({
getListApi: ItembasicApi.getItembasicPage //
})
//
const { getList, setSearchParams } = tableMethods
defineOptions({ name: 'Itembasic' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const total = ref(0) //
const list = ref([]) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
@ -560,33 +457,8 @@ const queryParams = reactive({
createTime: [],
creator: null
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await ItembasicApi.getItembasicPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()

Loading…
Cancel
Save