|
|
@ -1,18 +1,22 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="Businesstype.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search |
|
|
|
:schema="Businesstype.allSchemas.searchSchema" |
|
|
|
@search="setSearchParams" |
|
|
|
@reset="setSearchParams" |
|
|
|
/> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:route-name="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="Businesstype.allSchemas" |
|
|
|
/> |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:route-name="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="Businesstype.allSchemas" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
@ -27,28 +31,58 @@ |
|
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort" |
|
|
|
> |
|
|
|
<template #code="{row}"> |
|
|
|
<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)" /> |
|
|
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" /> |
|
|
|
</template> |
|
|
|
<template #itemTypes="{row}"> |
|
|
|
<span>{{ strFor(row.itemTypes,DICT_TYPE.ITEM_TYPE)}}</span> |
|
|
|
<template #itemTypes="{ row }"> |
|
|
|
<el-tag v-for="tag in row.itemTypes" :key="tag" :disable-transitions="true" class="mr-5px"> |
|
|
|
{{ getDictLabel(DICT_TYPE.ITEM_TYPE, tag) }} |
|
|
|
</el-tag> |
|
|
|
</template> |
|
|
|
<template #outLocationTypes="{row}"> |
|
|
|
<span>{{ strFor(row.outLocationTypes,DICT_TYPE.LOCATION_TYPE)}}</span> |
|
|
|
<template #outLocationTypes="{ row }"> |
|
|
|
<el-tag |
|
|
|
v-for="tag in row.outLocationTypes" |
|
|
|
:key="tag" |
|
|
|
:disable-transitions="true" |
|
|
|
class="mr-5px" |
|
|
|
> |
|
|
|
{{ getDictLabel(DICT_TYPE.LOCATION_TYPE, tag) }} |
|
|
|
</el-tag> |
|
|
|
</template> |
|
|
|
<template #inLocationTypes="{row}"> |
|
|
|
<span>{{ strFor(row.inLocationTypes,DICT_TYPE.LOCATION_TYPE)}}</span> |
|
|
|
<template #inLocationTypes="{ row }"> |
|
|
|
<el-tag |
|
|
|
v-for="tag in row.inLocationTypes" |
|
|
|
:key="tag" |
|
|
|
:disable-transitions="true" |
|
|
|
class="mr-5px" |
|
|
|
> |
|
|
|
{{ getDictLabel(DICT_TYPE.LOCATION_TYPE, tag) }} |
|
|
|
</el-tag> |
|
|
|
</template> |
|
|
|
<template #outInventoryStatuses="{row}"> |
|
|
|
<span>{{ strFor(row.outInventoryStatuses,DICT_TYPE.INVENTORY_STATUS)}}</span> |
|
|
|
<template #outInventoryStatuses="{ row }"> |
|
|
|
<el-tag |
|
|
|
v-for="tag in row.outInventoryStatuses" |
|
|
|
:key="tag" |
|
|
|
:disable-transitions="true" |
|
|
|
class="mr-5px" |
|
|
|
> |
|
|
|
{{ getDictLabel(DICT_TYPE.INVENTORY_STATUS, tag) }} |
|
|
|
</el-tag> |
|
|
|
</template> |
|
|
|
<template #inInventoryStatuses="{row}"> |
|
|
|
<span>{{ strFor(row.inInventoryStatuses,DICT_TYPE.INVENTORY_STATUS)}}</span> |
|
|
|
<template #inInventoryStatuses="{ row }"> |
|
|
|
<el-tag |
|
|
|
v-for="tag in row.inInventoryStatuses" |
|
|
|
:key="tag" |
|
|
|
:disable-transitions="true" |
|
|
|
class="mr-5px" |
|
|
|
> |
|
|
|
{{ getDictLabel(DICT_TYPE.INVENTORY_STATUS, tag) }} |
|
|
|
</el-tag> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
@ -69,12 +103,17 @@ |
|
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Businesstype.allSchemas" /> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/wms/businesstype/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|
|
|
<ImportForm |
|
|
|
ref="importFormRef" |
|
|
|
url="/wms/businesstype/import" |
|
|
|
:importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { getDictLabel,DICT_TYPE } from '@/utils/dict' |
|
|
|
import { getDictLabel, DICT_TYPE } from '@/utils/dict' |
|
|
|
import * as BusinesstypeApi from '@/api/wms/businesstype' |
|
|
|
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' |
|
|
|
import { Businesstype, BusinesstypeRules } from './businesstype.data' |
|
|
@ -82,27 +121,11 @@ 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' |
|
|
|
import { Console } from 'console' |
|
|
|
|
|
|
|
// 业务类型 |
|
|
|
defineOptions({ name: 'Businesstype' }) |
|
|
|
|
|
|
|
const strFor = (str,type)=> { |
|
|
|
let stradd = '' |
|
|
|
if(typeof(str)=='string'){ |
|
|
|
str.split(',').forEach(element => { |
|
|
|
let str1=getDictLabel(type,element) |
|
|
|
stradd = stradd+str1+',' |
|
|
|
}) |
|
|
|
return stradd.substring(0,stradd.length-1) |
|
|
|
}else{ |
|
|
|
str.join(',').split(',').forEach(element => { |
|
|
|
let str2=getDictLabel(type,element) |
|
|
|
stradd = stradd+str2+',' |
|
|
|
}) |
|
|
|
return stradd.substring(0,stradd.length-1) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
@ -128,9 +151,9 @@ const HeadButttondata = [ |
|
|
|
// defaultButtons.defaultAddBtn({hasPermi:'wms:businesstype:create'}), // 新增 |
|
|
|
// defaultButtons.defaultImportBtn({hasPermi:'wms:businesstype:import'}), // 导入 |
|
|
|
// defaultButtons.defaultExportBtn({hasPermi:'wms:businesstype:export'}), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null),//刷新 |
|
|
|
defaultButtons.defaultFreshBtn(null), //刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), //筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
|
// { |
|
|
|
// label: '自定义扩展按钮', |
|
|
|
// name: 'zdy', |
|
|
@ -143,37 +166,45 @@ const HeadButttondata = [ |
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'add') { // 新增 |
|
|
|
if (val == 'add') { |
|
|
|
// 新增 |
|
|
|
openForm('create') |
|
|
|
} else if (val == 'import') { // 导入 |
|
|
|
} else if (val == 'import') { |
|
|
|
// 导入 |
|
|
|
handleImport() |
|
|
|
} else if (val == 'export') { // 导出 |
|
|
|
} else if (val == 'export') { |
|
|
|
// 导出 |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
|
} else if (val == 'refresh') { |
|
|
|
// 刷新 |
|
|
|
getList() |
|
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
|
} else { // 其他按钮 |
|
|
|
} else if (val == 'filtrate') { |
|
|
|
// 筛选 |
|
|
|
} else { |
|
|
|
// 其他按钮 |
|
|
|
console.log('其他按钮', item) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = [ |
|
|
|
defaultButtons.mainListEditBtn({hasPermi:'wms:businesstype:update'}), // 编辑 |
|
|
|
defaultButtons.mainListEditBtn({ hasPermi: 'wms:businesstype:update' }) // 编辑 |
|
|
|
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:businesstype:delete'}), // 删除 |
|
|
|
] |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { // 编辑 |
|
|
|
if (val == 'edit') { |
|
|
|
// 编辑 |
|
|
|
// const res = await BusinesstypeApi.getItempackaging(row.id) |
|
|
|
row.itemTypes=row.itemTypes.split(',') |
|
|
|
row.outLocationTypes = row.outLocationTypes.split(',') |
|
|
|
row.inLocationTypes = row.inLocationTypes.split(',') |
|
|
|
row.outInventoryStatuses = row.outInventoryStatuses.split(',') |
|
|
|
row.inInventoryStatuses = row.inInventoryStatuses.split(',') |
|
|
|
// row.itemTypes = row.itemTypes.split(',') |
|
|
|
// row.outLocationTypes = row.outLocationTypes.split(',') |
|
|
|
// row.inLocationTypes = row.inLocationTypes.split(',') |
|
|
|
// row.outInventoryStatuses = row.outInventoryStatuses.split(',') |
|
|
|
// row.inInventoryStatuses = row.inInventoryStatuses.split(',') |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
} else if (val == 'delete') { |
|
|
|
// 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
} |
|
|
|
} |
|
|
@ -181,36 +212,57 @@ const buttonTableClick = async (val, row) => { |
|
|
|
/** 添加/修改操作 */ |
|
|
|
const basicFormRef = ref() |
|
|
|
const openForm = (type: string, row?: any) => { |
|
|
|
console.log(row) |
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
} |
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
|
var isHave =Businesstype.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; |
|
|
|
data.itemTypes = data.itemTypes.join(',') |
|
|
|
data.outLocationTypes = data.outLocationTypes.join(',') |
|
|
|
data.inLocationTypes = data.inLocationTypes.join(',') |
|
|
|
data.outInventoryStatuses = data.outInventoryStatuses.join(',') |
|
|
|
data.inInventoryStatuses = data.inInventoryStatuses.join(',') |
|
|
|
if (formType === 'create') { |
|
|
|
await BusinesstypeApi.createBusinesstype(data) |
|
|
|
const formsSuccess = async (formType, data) => { |
|
|
|
var isHave = Businesstype.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 |
|
|
|
data.itemTypes = data.itemTypes.join(',') |
|
|
|
data.outLocationTypes = data.outLocationTypes.join(',') |
|
|
|
data.inLocationTypes = data.inLocationTypes.join(',') |
|
|
|
data.outInventoryStatuses = data.outInventoryStatuses.join(',') |
|
|
|
data.inInventoryStatuses = data.inInventoryStatuses.join(',') |
|
|
|
if (formType === 'create') { |
|
|
|
await BusinesstypeApi.createBusinesstype(data) |
|
|
|
.then(() => { |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
|
await BusinesstypeApi.updateBusinesstype(data) |
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
getList() |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
data.itemTypes = data.itemTypes.split(',') |
|
|
|
data.outLocationTypes = data.outLocationTypes.split(',') |
|
|
|
data.inLocationTypes = data.inLocationTypes.split(',') |
|
|
|
data.outInventoryStatuses = data.outInventoryStatuses.split(',') |
|
|
|
data.inInventoryStatuses = data.inInventoryStatuses.split(',') |
|
|
|
}) |
|
|
|
} else { |
|
|
|
await BusinesstypeApi.updateBusinesstype(data) |
|
|
|
.then(() => { |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
} |
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
getList() |
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
getList() |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
data.itemTypes = data.itemTypes.split(',') |
|
|
|
data.outLocationTypes = data.outLocationTypes.split(',') |
|
|
|
data.inLocationTypes = data.inLocationTypes.split(',') |
|
|
|
data.outInventoryStatuses = data.outInventoryStatuses.split(',') |
|
|
|
data.inInventoryStatuses = data.inInventoryStatuses.split(',') |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
@ -282,8 +334,16 @@ const searchFormClick = (searchData) => { |
|
|
|
} |
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async() => { |
|
|
|
getList() |
|
|
|
onMounted(async () => { |
|
|
|
await getList() |
|
|
|
tableObject.tableList.forEach((item) => { |
|
|
|
item.itemTypes = item.itemTypes.split(',') |
|
|
|
item.outLocationTypes = item.outLocationTypes.split(',') |
|
|
|
item.inLocationTypes = item.inLocationTypes.split(',') |
|
|
|
item.outInventoryStatuses = item.outInventoryStatuses.split(',') |
|
|
|
item.inInventoryStatuses = item.inInventoryStatuses.split(',') |
|
|
|
}) |
|
|
|
console.log(tableObject.tableList) |
|
|
|
importTemplateData.templateUrl = await BusinesstypeApi.importTemplate() |
|
|
|
}) |
|
|
|
</script> |
|
|
|