|
|
@ -1,48 +1,35 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="[...RelegateRequestMain.allSchemas.searchSchema,...RelegateRequestDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search :schema="[...RelegateRequestMain.allSchemas.searchSchema, ...RelegateRequestDetail.allSchemas.searchSchema]" |
|
|
|
@search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="RelegateRequestMain.allSchemas" |
|
|
|
:detailAllSchemas="RelegateRequestDetail.allSchemas" |
|
|
|
/> |
|
|
|
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" |
|
|
|
:allSchemas="RelegateRequestMain.allSchemas" :detailAllSchemas="RelegateRequestDetail.allSchemas" /> |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
|
<Table |
|
|
|
:columns="tableColumns" |
|
|
|
:data="tableObject.tableList" |
|
|
|
:loading="tableObject.loading" |
|
|
|
:pagination="{ |
|
|
|
<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 #number="{row}"> |
|
|
|
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort"> |
|
|
|
<template #number="{ row }"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> |
|
|
|
<span>{{ row.number }}</span> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
<template #action="{ row,$index }"> |
|
|
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
<template #action="{ row, $index }"> |
|
|
|
<ButtonBase :Butttondata="butttondata(row, $index)" @button-base-click="buttonTableClick($event, row)" /> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm |
|
|
|
ref="basicFormRef" |
|
|
|
:isOpenSearchTable="true" |
|
|
|
<BasicForm ref="basicFormRef" |
|
|
|
:isOpenSearchTable="false" |
|
|
|
fieldTableColumn="itemCode" |
|
|
|
@success="getList" |
|
|
|
:rules="RelegateRequestMainRules" |
|
|
@ -52,18 +39,15 @@ |
|
|
|
:tableData="tableData" |
|
|
|
:apiUpdate="RelegateRequestMainApi.updateRelegateRequestMain" |
|
|
|
:apiCreate="RelegateRequestMainApi.createRelegateRequestMain" |
|
|
|
:isBusiness="true" |
|
|
|
fromeWhere="RelegateRequestMain" |
|
|
|
:isBusiness="true" fromeWhere="RelegateRequestMain" |
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
@submitForm="submitForm" |
|
|
|
:isShowButton = isShowButton |
|
|
|
/> |
|
|
|
:isShowButton=isShowButton /> |
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
|
<Detail |
|
|
|
ref="detailRef" |
|
|
|
<Detail ref="detailRef" |
|
|
|
:isBasic="true" |
|
|
|
:allSchemas="RelegateRequestMain.allSchemas" |
|
|
|
:detailAllSchemas="RelegateRequestDetail.allSchemas" |
|
|
@ -75,16 +59,16 @@ |
|
|
|
fromeWhere="RelegateRequestMain" |
|
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
|
|
|
:detailButtonIsShowAdd="trueFalse" |
|
|
|
:detailButtonIsShowDelete="trueFalse" |
|
|
|
/> |
|
|
|
:detailButtonIsShowDelete="trueFalse" /> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/wms/relegate-request-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|
|
|
<ImportForm ref="importFormRef" url="/wms/relegate-request-main/import" :importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" /> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { RelegateRequestMain,RelegateRequestMainRules,RelegateRequestDetail,RelegateRequestDetailRules } from './relegateRequestMain.data' |
|
|
|
import { RelegateRequestMain, RelegateRequestMainRules, RelegateRequestDetail, RelegateRequestDetailRules } from './relegateRequestMain.data' |
|
|
|
import * as RelegateRequestMainApi from '@/api/wms/relegateRequestMain' |
|
|
|
import * as RelegateRequestDetailApi from '@/api/wms/relegateRequestDetail' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
@ -99,34 +83,100 @@ const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
const businessType = 'relegate' |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref([...RelegateRequestMain.allSchemas.tableColumns,...RelegateRequestDetail.allSchemas.tableMainColumns]) |
|
|
|
const tableColumns = ref([...RelegateRequestMain.allSchemas.tableColumns, ...RelegateRequestDetail.allSchemas.tableMainColumns]) |
|
|
|
const isShowButton = ref(true) |
|
|
|
//定义 展示子表数据时是否显示新增/修改/删除按钮 |
|
|
|
const trueFalse = ref(false) |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|
|
|
nextTick(() => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
if (formField == 'itemCode') { |
|
|
|
row['itemCode'] = val[0]['itemCode'] |
|
|
|
row['uom'] = val[0]['uom'] |
|
|
|
row['qty'] = val[0]['qty'] |
|
|
|
row['fromBatch'] = val[0]['batch'] |
|
|
|
row['fromPackingNumber'] = val[0]['packingNumber'] |
|
|
|
row['toBatch'] = val[0]['batch'] |
|
|
|
row['toPackingNumber'] = val[0]['packingNumber'] |
|
|
|
row['fromLocationCode'] = val[0]['locationCode'] |
|
|
|
row['fromInventoryStatus'] = val[0]['inventoryStatus'] |
|
|
|
} else if (formField == 'downItemCode') { |
|
|
|
row['downItemCode'] = val[0]['code'] |
|
|
|
} else if (formField == 'toLocationCode') { |
|
|
|
row['toLocationCode'] = val[0]['code'] |
|
|
|
} else { |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
} |
|
|
|
} else { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
if (formField == 'fromWarehouseCode') { |
|
|
|
setV['fromWarehouseCode'] = val[0]['code'] |
|
|
|
} |
|
|
|
formRef.setValues(setV) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 查询页面返回——详情 |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
if(formField == 'itemCode') { |
|
|
|
setV['itemCode'] = val[0]['itemCode'] |
|
|
|
setV['uom'] = val[0]['customerUom'] |
|
|
|
}else { |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
} |
|
|
|
formRef.setValues(setV) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 修改 tableform 属性 |
|
|
|
RelegateRequestDetail.allSchemas.tableFormColumns.map(item => { |
|
|
|
if (item.field == 'itemCode') { |
|
|
|
item.tableForm.searchCondition = [ |
|
|
|
{ |
|
|
|
key: 'businessType', |
|
|
|
value: businessType, |
|
|
|
isMainValue: false |
|
|
|
} |
|
|
|
] |
|
|
|
item.form.componentProps.searchCondition = [ |
|
|
|
{ |
|
|
|
key: 'businessType', |
|
|
|
value: businessType, |
|
|
|
isMainValue: false |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
if (item.field == "toLocationCode") { |
|
|
|
item.tableForm.searchCondition = [ |
|
|
|
{ |
|
|
|
key: 'businessType', |
|
|
|
value: businessType, |
|
|
|
isMainValue: false |
|
|
|
}] |
|
|
|
item.form.componentProps.searchCondition = [ |
|
|
|
{ |
|
|
|
key: 'businessType', |
|
|
|
value: businessType, |
|
|
|
isMainValue: false |
|
|
|
}] |
|
|
|
item.tableForm.searchCondition = [ |
|
|
|
{ |
|
|
|
key: 'businessType', |
|
|
|
value: businessType, |
|
|
|
isMainValue: false |
|
|
|
}] |
|
|
|
item.form.componentProps.searchCondition = [ |
|
|
|
{ |
|
|
|
key: 'businessType', |
|
|
|
value: businessType, |
|
|
|
isMainValue: false |
|
|
|
}] |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
@ -141,9 +191,9 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn({hasPermi:'wms:relegate-request-main:create'}), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({hasPermi:'wms:relegate-request-main:import'}), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'wms:relegate-request-main:export'}), // 导出 |
|
|
|
defaultButtons.defaultAddBtn({ hasPermi: 'wms:relegate-request-main:create' }), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({ hasPermi: 'wms:relegate-request-main:import' }), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({ hasPermi: 'wms:relegate-request-main:export' }), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
@ -174,7 +224,7 @@ const buttonBaseClick = (val, item) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 根据状态返回该按钮是否显示 |
|
|
|
const isShowMainButton = (row,val) => { |
|
|
|
const isShowMainButton = (row, val) => { |
|
|
|
if (val.indexOf(row.status) > -1) { |
|
|
|
return false |
|
|
|
} else { |
|
|
@ -183,15 +233,15 @@ const isShowMainButton = (row,val) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = (row,$index) => { |
|
|
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
|
|
|
if(findIndex>0&&findIndex<$index){ |
|
|
|
const butttondata = (row, $index) => { |
|
|
|
const findIndex = row['masterId'] ? tableObject.tableList.findIndex(item => item['masterId'] == row['masterId']) : -1 |
|
|
|
if (findIndex > 0 && findIndex < $index) { |
|
|
|
return [] |
|
|
|
} |
|
|
|
return [ |
|
|
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:relegate-request-main:update'}), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:relegate-request-main:delete'}), // 删除 |
|
|
|
] |
|
|
|
defaultButtons.mainListEditBtn({ hide: isShowMainButton(row, ['1']), hasPermi: 'wms:relegate-request-main:update' }), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn({ hasPermi: 'wms:relegate-request-main:delete' }), // 删除 |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
@ -211,31 +261,31 @@ const openForm = (type: string, row?: any) => { |
|
|
|
//为true表示子表数据中存在数量为0的数据 |
|
|
|
const flag = ref(false) |
|
|
|
// form表单提交 |
|
|
|
const submitForm = async (formType,data) => { |
|
|
|
const submitForm = async (formType, data) => { |
|
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
|
let isExist = false |
|
|
|
tableData.value.forEach(item => { |
|
|
|
let rs = tableData.value.filter(filterItem => (filterItem.itemCode == item.itemCode)) |
|
|
|
if(rs.length > 1) isExist = true |
|
|
|
if (rs.length > 1) isExist = true |
|
|
|
}) |
|
|
|
if (isExist) { |
|
|
|
basicFormRef.value.formLoading = false |
|
|
|
return message.warning('物料代码重复') |
|
|
|
} |
|
|
|
data.subList.forEach(obj => { |
|
|
|
if(obj.qty == 0){ |
|
|
|
if (obj.qty == 0) { |
|
|
|
message.warning(`数量不能为0!`) |
|
|
|
flag.value = true |
|
|
|
return; |
|
|
|
} |
|
|
|
}) |
|
|
|
if(flag.value){ |
|
|
|
if (flag.value) { |
|
|
|
basicFormRef.value.formLoading = false |
|
|
|
return |
|
|
|
} |
|
|
|
try { |
|
|
|
if (formType === 'create') { |
|
|
|
if(tableData.value.length <= 0){ |
|
|
|
if (tableData.value.length <= 0) { |
|
|
|
message.warning(`子表明细不能为空!`) |
|
|
|
flag.value = true |
|
|
|
basicFormRef.value.formLoading = false |
|
|
@ -249,7 +299,7 @@ const submitForm = async (formType,data) => { |
|
|
|
} |
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
getList() |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
basicFormRef.value.formLoading = false |
|
|
|
} |
|
|
|
} |
|
|
@ -270,7 +320,7 @@ const handleDelete = async (id: number) => { |
|
|
|
message.success(t('common.delSuccess')) |
|
|
|
// 刷新列表 |
|
|
|
await getList() |
|
|
|
} catch {} |
|
|
|
} catch { } |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|