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