|
|
@ -1,18 +1,22 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="CountConfig.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search |
|
|
|
:schema="CountConfig.allSchemas.searchSchema" |
|
|
|
@search="setSearchParams" |
|
|
|
@reset="setSearchParams" |
|
|
|
/> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="CountConfig.allSchemas" |
|
|
|
/> |
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="CountConfig.allSchemas" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
@ -27,13 +31,13 @@ |
|
|
|
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> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
@ -47,6 +51,7 @@ |
|
|
|
:apiUpdate="CountConfigApi.updateCountConfig" |
|
|
|
:apiCreate="CountConfigApi.createCountConfig" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
@clearSearchInput="clearSearchInput" |
|
|
|
:isBusiness="false" |
|
|
|
/> |
|
|
|
|
|
|
@ -54,11 +59,12 @@ |
|
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="CountConfig.allSchemas" /> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" |
|
|
|
url="/wms/count-config/import" |
|
|
|
:importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" |
|
|
|
:updateIsDisable="true" |
|
|
|
<ImportForm |
|
|
|
ref="importFormRef" |
|
|
|
url="/wms/count-config/import" |
|
|
|
:importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" |
|
|
|
:updateIsDisable="true" |
|
|
|
:appendIsDisable="true" |
|
|
|
:mode="3" |
|
|
|
/> |
|
|
@ -66,7 +72,7 @@ |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { CountConfig,CountConfigRules } from './countConfig.data' |
|
|
|
import { CountConfig, CountConfigRules } from './countConfig.data' |
|
|
|
import * as CountConfigApi from '@/api/wms/countConfig' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
@ -90,13 +96,13 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) => |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
if (formField == 'itemCode') { |
|
|
|
setV['itemName'] = val[0].name |
|
|
|
setV['desc1'] = val[0].backNumber |
|
|
|
setV['uom'] = val[0].uom |
|
|
|
setV['packUnit'] = val[0].defaultPackUnit |
|
|
|
setV['packQty'] = val[0].defaultPackQty |
|
|
|
|
|
|
|
} |
|
|
|
setV['itemName'] = val[0].name |
|
|
|
setV['desc1'] = val[0].backNumber |
|
|
|
setV['uom'] = val[0].uom |
|
|
|
setV['packUnit'] = val[0].defaultPackUnit |
|
|
|
setV['packQty'] = val[0].defaultPackQty |
|
|
|
setV['conversionRate'] = val[0].convertRate |
|
|
|
} |
|
|
|
formRef.setValues(setV) |
|
|
|
}) |
|
|
|
} |
|
|
@ -115,12 +121,12 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn({hasPermi:'wms:count-config:create'}), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({hasPermi:'wms:count-config:import'}), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'wms:count-config:export'}), // 导出 |
|
|
|
defaultButtons.defaultAddBtn({ hasPermi: 'wms:count-config:create' }), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({ hasPermi: 'wms:count-config:import' }), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({ hasPermi: 'wms:count-config:export' }), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
|
// { |
|
|
|
// label: '自定义扩展按钮', |
|
|
|
// name: 'zdy', |
|
|
@ -133,16 +139,22 @@ 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) |
|
|
|
} |
|
|
|
} |
|
|
@ -150,14 +162,16 @@ const buttonBaseClick = (val, item) => { |
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = [ |
|
|
|
defaultButtons.mainListEditBtn(), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn(), // 删除 |
|
|
|
defaultButtons.mainListDeleteBtn() // 删除 |
|
|
|
] |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { // 编辑 |
|
|
|
if (val == 'edit') { |
|
|
|
// 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
} else if (val == 'delete') { |
|
|
|
// 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
} |
|
|
|
} |
|
|
@ -165,16 +179,16 @@ const buttonTableClick = async (val, row) => { |
|
|
|
/** 添加/修改操作 */ |
|
|
|
const basicFormRef = ref() |
|
|
|
const openForm = (type: string, row?: any) => { |
|
|
|
if(type=='create'){ |
|
|
|
CountConfig.allSchemas.formSchema.forEach(item =>{ |
|
|
|
if(item.field == "itemCode"){ |
|
|
|
if (type == 'create') { |
|
|
|
CountConfig.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'itemCode') { |
|
|
|
item.componentProps.isSearchList = true |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
}) |
|
|
|
} else if(type=='update'){ |
|
|
|
CountConfig.allSchemas.formSchema.forEach(item =>{ |
|
|
|
if(item.field == "itemCode"){ |
|
|
|
} else if (type == 'update') { |
|
|
|
CountConfig.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'itemCode') { |
|
|
|
item.componentProps.isSearchList = false |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
@ -184,18 +198,18 @@ const openForm = (type: string, row?: any) => { |
|
|
|
} |
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
|
var isHave =CountConfig.allSchemas.formSchema.some(function (item) { |
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
|
}); |
|
|
|
if(isHave){ |
|
|
|
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|
|
|
const formsSuccess = async (formType, data) => { |
|
|
|
var isHave = CountConfig.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; |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if(data.activeTime==0)data.activeTime = null; |
|
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
|
if (data.activeTime == 0) data.activeTime = null |
|
|
|
if (data.expireTime == 0) data.expireTime = null |
|
|
|
if (formType === 'create') { |
|
|
|
await CountConfigApi.createCountConfig(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
@ -257,6 +271,21 @@ const importSuccess = () => { |
|
|
|
getList() |
|
|
|
} |
|
|
|
|
|
|
|
const clearSearchInput = (formField) => { |
|
|
|
if (formField == 'itemCode') { |
|
|
|
//车间 |
|
|
|
basicFormRef.value.formRef.setValues({ |
|
|
|
itemName: '', |
|
|
|
desc1: '', |
|
|
|
uom: '', |
|
|
|
packUnit: '', |
|
|
|
packQty: '', |
|
|
|
conversionRate: 1 |
|
|
|
}) |
|
|
|
// tableData.value = [] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 筛选提交 |
|
|
|
const searchFormClick = (searchData) => { |
|
|
|
tableObject.params = { |
|
|
@ -271,5 +300,4 @@ onMounted(async () => { |
|
|
|
getList() |
|
|
|
importTemplateData.templateUrl = await CountConfigApi.importTemplate() |
|
|
|
}) |
|
|
|
|
|
|
|
</script> |
|
|
|