Browse Source

BUG修改

master_hella_20240701
parent
commit
b7c654d15b
  1. 256
      src/views/wms/purchasereceiptManage/purchasereturn/purchasereturnRequestMain/index.vue
  2. 423
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

256
src/views/wms/purchasereceiptManage/purchasereturn/purchasereturnRequestMain/index.vue

@ -2,7 +2,10 @@
<ContentWrap>
<!-- 搜索工作栏 -->
<Search
:schema="[...PurchasereturnRequestMain.allSchemas.searchSchema,...PurchasereturnRequestDetail.allSchemas.searchSchema]"
:schema="[
...PurchasereturnRequestMain.allSchemas.searchSchema,
...PurchasereturnRequestDetail.allSchemas.searchSchema
]"
@search="setSearchParams"
@reset="setSearchParams"
/>
@ -21,7 +24,8 @@
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable
<Table
v-clientTable
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
@ -37,9 +41,9 @@
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row,$index }">
<template #action="{ row, $index }">
<ButtonBase
:Butttondata="butttondata(row,$index)"
:Butttondata="butttondata(row, $index)"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
@ -87,8 +91,8 @@
:detailValidate="detailValidate"
/>
<!-- 创建标签 -->
<BasicForm
<!-- 创建标签 -->
<BasicForm
ref="formLabelRef"
@success="getList"
:tableAllSchemas="PurchasereReturnRequestDetailLabel.allSchemas"
@ -101,7 +105,7 @@
@searchTableSuccess="searchTableSuccessLabel"
/>
<!-- 标签打印 -->
<SearchTable style="width:905px" ref="showLabelRef" @searchTableSuccess="showLabelSuccess" />
<SearchTable style="width: 905px" ref="showLabelRef" @searchTableSuccess="showLabelSuccess" />
<!-- 导入 -->
<ImportForm
ref="importFormRef"
@ -129,9 +133,7 @@ import * as PurchasereturnRequestMainApi from '@/api/wms/purchasereturnRequestMa
import * as PurchasereturnRequestDetailApi from '@/api/wms/purchasereturnRequestDetail'
import * as PurchasereceiptRecordDetailApi from '@/api/wms/purchasereceiptRecordDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import {
SupplierdeliverRequestPackage
} from '../../supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data'
import { SupplierdeliverRequestPackage } from '../../supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data'
import * as PackageApi from '@/api/wms/package'
import { getAccessToken } from '@/utils/auth'
import * as BalanceApi from '@/api/wms/balance'
@ -142,11 +144,14 @@ defineOptions({ name: 'PurchasereturnRequestMain' })
const message = useMessage() //
const { t } = useI18n() //
const genLabelId = ref(); //ID
const genLabelId = ref() //ID
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref([...PurchasereturnRequestMain.allSchemas.tableColumns,...PurchasereturnRequestDetail.allSchemas.tableMainColumns])
const tableColumns = ref([
...PurchasereturnRequestMain.allSchemas.tableColumns,
...PurchasereturnRequestDetail.allSchemas.tableMainColumns
])
const isShowButton = ref(true)
@ -154,16 +159,25 @@ const isShowButton = ref(true)
const updataTableColumns = (val) => {
tableColumns.value = val
}
const onEnter = async (field,value)=>{
console.log(field,value)
if('supplierCode'==field){
const onEnter = async (field, value) => {
console.log(field, value)
if ('supplierCode' == field) {
//
formRef.value.opensearchTable('purchaseReceiptRecordNumber', 'number', '采购收货记录', PurchasereceiptRecordMain1.allSchemas, PurchasereceiptRecordDetailApi.getPurchasereceiptRecordDetailPageReturn,[{
formRef.value.opensearchTable(
'purchaseReceiptRecordNumber',
'number',
'采购收货记录',
PurchasereceiptRecordMain1.allSchemas,
PurchasereceiptRecordDetailApi.getPurchasereceiptRecordDetailPageReturn,
[
{
key: 'supplierCode',
value: 'supplierCode',
isMainValue: true
}])
}else if('purchaseReceiptRecordNumber' == field){
}
]
)
} else if ('purchaseReceiptRecordNumber' == field) {
//
}
}
@ -171,22 +185,22 @@ const onEnter = async (field,value)=>{
//
const isCreateLabel = ref(false)
const formLabelRef = ref()
const { tableObject: detatableData, tableMethods: detatableMethods } =useTable({
const { tableObject: detatableData, tableMethods: detatableMethods } = useTable({
getListApi: PurchasereturnRequestDetailApi.getPurchasereturnRequestDetailPage
})
const { getList:getDetailList } = detatableMethods
const { getList: getDetailList } = detatableMethods
//
const submitFormLabel = async (formType, submitData) => {
let data = {...submitData}
if(data.masterId){
let data = { ...submitData }
if (data.masterId) {
data.id = data.masterId
}
try {
console.log("formType==",formType)
console.log("data==",data)
console.log('formType==', formType)
console.log('data==', data)
data.subList = detatableData.tableList
console.log("detatableData",detatableData)
console.log('detatableData', detatableData)
await message.confirm(t('ts.是否为此数据生成标签?'))
await PurchasereturnRequestMainApi.genLabel(data) //genLabelId.value
isCreateLabel.value = true
@ -212,16 +226,15 @@ const searchTableSuccessLabel = (formField, searchField, val, formRef, type, row
}
//
const searchTableSuccess = async(formField, searchField, val, formRef, type, row) => {
console.log('searchTableSuccess',formField, searchField, val, formRef, type, row)
console.log('searchTableSuccess123',val)
nextTick( async () => {
const searchTableSuccess = async (formField, searchField, val, formRef, type, row) => {
console.log('searchTableSuccess', formField, searchField, val, formRef, type, row)
console.log('searchTableSuccess123', val)
nextTick(async () => {
if (type == 'tableForm') {
//
row[formField] = val[0][searchField]
if(formField=='purchaseReceiptRecordNumber'){//--
if (formField == 'purchaseReceiptRecordNumber') {
//--
row['supplierCode'] = val[0]['supplierCode']
row['poNumber'] = val[0]['poNumber']
row['poLine'] = val[0]['poLine']
@ -257,14 +270,14 @@ const searchTableSuccess = async(formField, searchField, val, formRef, type, row
row['singlePrice'] = val[0]['singlePrice']
row['amount'] = val[0]['amount']
row['projectCode'] = val[0]['projectCode']
}else if(formField == 'itemCode'){
} else if (formField == 'itemCode') {
row['batch'] = val[0]['toBatch']
row['containerNumber'] = val[0]['toContainerNumber']
row['containerNumber'] = val[0]['containerNumber']
row['containerNumber'] = val[0]['containerNumber']
// row['fromLocationCode'] = val[0]['fromLocationCode']
row['toLocationCode'] = val[0]['toLocationCode']
}else if(formField=='fromLocationCode'){
} else if (formField == 'fromLocationCode') {
// let params = {
// itemCode: row.itemCode,
// batch: row.batch,
@ -273,12 +286,12 @@ const searchTableSuccess = async(formField, searchField, val, formRef, type, row
// let aa = await BalanceApi.getSumByConditions(params);
// console.log('23423423',aa);
// row['inventoryBalance'] = aa//
}else if(formField=='packingNumber'){
row['inventoryBalance'] = val[0]['qty']//
} else if (formField == 'packingNumber') {
row['inventoryBalance'] = val[0]['qty'] //
}
} else {
const setV = {}
if(formField == 'purchaseReceiptRecordNumber'){
if (formField == 'purchaseReceiptRecordNumber') {
// isShowButton.value = false
setV[formField] = val[0][searchField]
setV['purchaseReceiptRecordNumber'] = val[0]['number']
@ -289,7 +302,8 @@ const searchTableSuccess = async(formField, searchField, val, formRef, type, row
// PurchasereceiptRecordDetailApi.getPurchasereceiptRecordDetailList({
PurchasereceiptRecordDetailApi.getPurchasereceiptRecordDetailListToRepeat({
masterId: val[0]['masterId']
}).then((res) => {
})
.then((res) => {
if (res) tableData.value = res
tableData.value.forEach((item) => {
item.batch = item.toBatch
@ -331,11 +345,12 @@ const searchTableSuccess = async(formField, searchField, val, formRef, type, row
item.tableForm.isInpuFocusShow = false
}
})
}).catch((err) => {
})
.catch((err) => {
console.log(err)
})
}
if(formField == 'supplierCode'){
if (formField == 'supplierCode') {
// isShowButton.value = true
setV['supplierCode'] = val[0]['code']
// setV['purchaseReceiptRecordNumber'] = ''
@ -349,7 +364,7 @@ const searchTableSuccess = async(formField, searchField, val, formRef, type, row
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
if(formField == 'poLine' || formField == 'itemCode'){
if (formField == 'poLine' || formField == 'itemCode') {
console.log(val)
setV['poLine'] = val[0]['poLine']
setV['poNumber'] = val[0]['poNumber']
@ -387,7 +402,7 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
setV['amount'] = val[0]['amount']
setV['projectCode'] = val[0]['projectCode']
if(formField == 'itemCode'){
if (formField == 'itemCode') {
setV['batch'] = val[0]['toBatch']
setV['containerNumber'] = val[0]['toContainerNumber']
setV['containerNumber'] = val[0]['containerNumber']
@ -395,7 +410,7 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
// setV['fromLocationCode'] = val[0]['fromLocationCode']
// setV['toLocationCode'] = val[0]['toLocationCode']
}
}else {
} else {
setV[formField] = val[0][searchField]
}
formRef.setValues(setV)
@ -439,7 +454,7 @@ const buttonBaseClick = (val, item) => {
handleExport()
} else if (val == 'refresh') {
//
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
if (tableObject.params.filters && tableObject.params.filters.length > 0) {
searchFormClick({
filters: tableObject.params.filters
})
@ -464,9 +479,11 @@ const isShowMainButton = (row, val) => {
}
// -
const butttondata = (row,$index) => {
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1
if(findIndex>-1&&findIndex<$index){
const butttondata = (row, $index) => {
const findIndex = row['masterId']
? tableObject.tableList.findIndex((item) => item['masterId'] == row['masterId'])
: -1
if (findIndex > -1 && findIndex < $index) {
return []
}
return [
@ -497,7 +514,7 @@ const butttondata = (row,$index) => {
defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['1']),
hasPermi: 'wms:purchasereceipt-request-main:update'
}), //
}) //
// {
// label: '',
// name: 'ssbq',
@ -535,14 +552,14 @@ const buttonTableClick = async (val, row) => {
} else if (val == 'edit') {
//
openForm('update', row)
} else if(val == 'ssbq'){
} else if (val == 'ssbq') {
//
detatableData.params = {
masterId:row.masterId
masterId: row.masterId
}
genLabelId.value = row.masterId
await getDetailList()
formLabelRef.value.open('create', row, null,'createLabel')// createLabel
formLabelRef.value.open('create', row, null, 'createLabel') // createLabel
} else if (val == 'point') {
//
labelPrint(row)
@ -555,25 +572,25 @@ const openForm = async (type: string, row?: number) => {
originTableData.value = [] //
tableData.value = [] //
isShowButton.value = true
if(type == 'create'){
if (type == 'create') {
PurchasereturnRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'supplierCode') {
item.componentProps.disabled = true
item.componentProps.isSearchList = true
}
if(item.field == 'purchaseReceiptRecordNumber'){
if (item.field == 'purchaseReceiptRecordNumber') {
item.componentProps.disabled = true
item.componentProps.isSearchList = true
}
})
}
if(type == 'update'){
if (type == 'update') {
PurchasereturnRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'supplierCode') {
item.componentProps.disabled = true
item.componentProps.isSearchList = false
}
if(item.field == 'purchaseReceiptRecordNumber'){
if (item.field == 'purchaseReceiptRecordNumber') {
item.componentProps.disabled = true
item.componentProps.isSearchList = false
}
@ -588,11 +605,16 @@ const { wsCache } = useCache()
const detailRef = ref()
const purchaseReceiptRecordNumberRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
purchaseReceiptRecordNumberRef.value = row.purchaseReceiptRecordNumber;
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name
purchaseReceiptRecordNumberRef.value = row.purchaseReceiptRecordNumber
const departmentCode = wsCache
.get(CACHE_KEY.DEPT)
.find((account) => account.id == row.departmentCode)?.name
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode))
PurchasereturnRequestDetail.allSchemas.tableColumns = PurchasereturnRequestDetail.allSchemas.tableColumns.filter(item=>item.field!='inventoryBalance')
detailRef.value.openDetail(row, titleName, titleValue,'requestPurchasereturnMain')
PurchasereturnRequestDetail.allSchemas.tableColumns =
PurchasereturnRequestDetail.allSchemas.tableColumns.filter(
(item) => item.field != 'inventoryBalance'
)
detailRef.value.openDetail(row, titleName, titleValue, 'requestPurchasereturnMain')
}
/** 关闭按钮操作 */
@ -603,7 +625,8 @@ const handleClose = async (id: number) => {
await PurchasereturnRequestMainApi.closePurchasereturnRequestMain(id)
message.success(t('common.closeSuccess'))
await getList()
} catch {}finally{
} catch {
} finally {
tableObject.loading = false
}
}
@ -616,7 +639,8 @@ const handleReAdd = async (id: number) => {
await PurchasereturnRequestMainApi.reAddPurchasereturnRequestMain(id)
message.success(t('common.reAddSuccess'))
await getList()
} catch {}finally{
} catch {
} finally {
tableObject.loading = false
}
}
@ -629,7 +653,8 @@ const handleAgree = async (id: number) => {
await PurchasereturnRequestMainApi.agreePurchasereturnRequestMain(id)
message.success(t('common.agreeSuccess'))
await getList()
} catch {}finally{
} catch {
} finally {
tableObject.loading = false
}
}
@ -642,7 +667,8 @@ const handleRefused = async (id: number) => {
await PurchasereturnRequestMainApi.refusedPurchasereturnRequestMain(id)
message.success(t('common.refusedSuccess'))
await getList()
} catch {}finally{
} catch {
} finally {
tableObject.loading = false
}
}
@ -655,7 +681,8 @@ const handleHandle = async (id: number) => {
await PurchasereturnRequestMainApi.handlePurchasereturnRequestMain(id)
message.success(t('common.handleSuccess'))
await getList()
} catch {}finally{
} catch {
} finally {
tableObject.loading = false
}
}
@ -680,7 +707,9 @@ const handleExport = async () => {
await message.exportConfirm()
//
exportLoading.value = true
const data = await PurchasereturnRequestMainApi.exportPurchasereturnRequestMain(tableObject.params)
const data = await PurchasereturnRequestMainApi.exportPurchasereturnRequestMain(
tableObject.params
)
download.excel(data, '采购退货申请主.xlsx')
} catch {
} finally {
@ -698,13 +727,13 @@ PurchasereturnRequestDetail.allSchemas.tableFormColumns.forEach((item) => {
const tableData = ref([])
const originTableData = ref([])
const searchTableRef = ref()
//
const handleAddTable = () => {
const subTableDFata = originTableData.value.filter(item=> !tableData.value.find(item1=>item1.id == item.id))
if(subTableDFata.length==0){
const subTableDFata = originTableData.value.filter(
(item) => !tableData.value.find((item1) => item1.id == item.id)
)
if (subTableDFata.length == 0) {
message.warning('暂无可选择数据!')
return
}
@ -718,7 +747,7 @@ const handleAddTable = () => {
loading: false,
//
pageSize: subTableDFata.length,
params:null,
params: null,
//
sort: {
order: '', //
@ -728,7 +757,7 @@ const handleAddTable = () => {
total: subTableDFata.length,
//
tableList: subTableDFata,
currentRow:null
currentRow: null
}
const tableColumns = PurchasereturnRequestDetail.allSchemas.tableFormColumns
@ -736,7 +765,7 @@ const handleAddTable = () => {
item.width = item.table?.width || 150
})
searchTableRef.value.openData("采购收货记录单号",tableObject,{tableColumns},true)
searchTableRef.value.openData('采购收货记录单号', tableObject, { tableColumns }, true)
// searchTableRef.value.open(
// ('',
// // _searchTableAllSchemas,
@ -750,7 +779,6 @@ const handleAddTable = () => {
// )
// )
// console.log(subTableDFata)
// const {tableObject, tableMethods } = useTable({
// getListApi: getPage.value //
@ -799,12 +827,12 @@ const handleAddTable = () => {
}
const searchTableSuccess1 = (formField, searchField, val, formRef, type, row) => {
console.log(val)
tableData.value = [...tableData.value,...val]
tableData.value = [...tableData.value, ...val]
}
//
const handleDeleteTable = (item, index, formRef) => {
let itemIndex = tableData.value.indexOf(item)
if(itemIndex>-1){
if (itemIndex > -1) {
tableData.value.splice(itemIndex, 1)
}
if (tableData.value.length == 0) {
@ -814,11 +842,10 @@ const handleDeleteTable = (item, index, formRef) => {
item.componentProps.disabled = false
}
})
}
}
const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item))
tableData.value = tableData.value.filter((item) => !selection.includes(item))
if (tableData.value.length == 0) {
isShowButton.value = true
PurchasereturnRequestMain.allSchemas.formSchema.forEach((item) => {
@ -837,31 +864,31 @@ const tableSelectionDelete = (selection) => {
//
const submitForm = async (formType, submitData) => {
let data = {...submitData}
if(data.masterId){
let data = { ...submitData }
if (data.masterId) {
data.id = data.masterId
}
console.log('submitForm',tableData.value)
console.log('submitForm', tableData.value)
// if(tableData.value.find(item=>Number(item.returnedQty)>Number(item.receiptQty))){
// message.warning("退")
// return;
// }
if(tableData.value.find(item=>Number(item.qty)>Number(item.inventoryBalance))){
message.warning("退货数量不能大于库存余额")
return;
if (tableData.value.find((item) => Number(item.qty) > Number(item.inventoryBalance))) {
message.warning('退货数量不能大于库存余额')
return
}
data.subList = tableData.value //
try {
if (formType === 'create') {
let flag = false;
let flag = false
data.subList.forEach((item) => {
if(item.qty == 0){
message.warning("数量不能为0")
flag = true;
return;
if (item.qty == 0) {
message.warning('数量不能为0')
flag = true
return
}
})
if(flag){
if (flag) {
formRef.value.formLoading = false
return
}
@ -881,14 +908,14 @@ const submitForm = async (formType, submitData) => {
// /
const detailValidate = (data) => {
let tag = false;
if(data.qty <= 0){
let tag = false
if (data.qty <= 0) {
message.warning('数量必须大于0')
tag = false;
return tag;
}else {
tag = true;
return tag;
tag = false
return tag
} else {
tag = true
return tag
}
}
@ -918,26 +945,26 @@ const searchFormClick = (searchData) => {
getList() //
}
const detailOpenForm = (type, row) =>{
console.log("type",type);
console.log("row",row);
console.log("AAAAAA",purchaseReceiptRecordNumberRef.value);
const detailOpenForm = (type, row) => {
console.log('type', type)
console.log('row', row)
console.log('AAAAAA', purchaseReceiptRecordNumberRef.value)
PurchasereturnRequestDetail.allSchemas.tableFormColumns.map((item) => {
if(purchaseReceiptRecordNumberRef.value == ''){
if (purchaseReceiptRecordNumberRef.value == '') {
if (item.field == 'itemCode') {
item.form.componentProps.disabled = true
item.form.componentProps.isSearchList = true
}
if(item.field == 'poLine'){
if (item.field == 'poLine') {
item.form.componentProps.disabled = true
item.form.componentProps.isSearchList = false
}
}else{
} else {
if (item.field == 'itemCode') {
item.form.componentProps.disabled = true
item.form.componentProps.isSearchList = false
}
if(item.field == 'poLine'){
if (item.field == 'poLine') {
item.form.componentProps.disabled = true
item.form.componentProps.isSearchList = true
}
@ -945,7 +972,6 @@ const detailOpenForm = (type, row) =>{
})
}
const BASE_URL = getJmreportBaseUrl()
const src = ref(BASE_URL + '/jmreport/view/922729953438072832?token=' + getAccessToken())
@ -953,35 +979,37 @@ const src = ref(BASE_URL + '/jmreport/view/922729953438072832?token=' + getAcces
const showLabelRef = ref()
const labelPrint = async (row) => {
tableObject.loading = true
const defaultParams = {'moduleName':'purchasereturn','recordNumber':row.number}
const {tableObject:tableObjectPrint ,tableMethods} = useTable({
const defaultParams = { moduleName: 'purchasereturn', recordNumber: row.number }
const { tableObject: tableObjectPrint, tableMethods } = useTable({
defaultParams,
getListApi: PackageApi.getLabelDetailPage //
})
//
const { getList:getListPrint } = tableMethods
const { getList: getListPrint } = tableMethods
getListPrint()
tableObject.loading = false
const tableColumns = SupplierdeliverRequestPackage.allSchemas.tableFormColumns
tableColumns.forEach((item) => {
item.width = item.table?.width || 150
})
showLabelRef.value.openData("标签信息",tableObjectPrint,{tableColumns},true)
showLabelRef.value.openData('标签信息', tableObjectPrint, { tableColumns }, true)
}
// ---
const showLabelSuccess = async (formField, searchField, val, formRef, type, row) => {
console.log('批量打印',val)
console.log('批量打印', val)
if(val.length == 0){
message.warning("请先选择要打印的数据!")
if (val.length == 0) {
message.warning('请先选择要打印的数据!')
return
}
await PackageApi.batchPrintingLable(val.map(item1=>item1.number).join(',')).then(res => {
await PackageApi.batchPrintingLable(val.map((item1) => item1.number).join(','))
.then((res) => {
console.log(res)
window.open(src.value + '&asn_number=' + res)
}).catch(err => {
})
.catch((err) => {
console.log(err)
message.error('创建标签失败')
})

423
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

File diff suppressed because it is too large
Loading…
Cancel
Save