Browse Source

采购索赔申请 代码上传

intex_online20241111
YEJIAXING-PC\lenovo 1 month ago
parent
commit
509da05ff1
  1. 4
      src/api/wms/purchaseClaimRequestDetail/index.ts
  2. 15
      src/api/wms/purchaseClaimRequestMain/index.ts
  3. 1
      src/utils/dict.ts
  4. 390
      src/views/wms/supplierManage/purchaseClaim/purchaseClaimRequest/PurchaseClaimRequestMain.data.ts
  5. 304
      src/views/wms/supplierManage/purchaseClaim/purchaseClaimRequest/index.vue

4
src/api/wms/purchaseClaimRequestDetail/index.ts

@ -4,9 +4,9 @@ export const getPurchaseClaimRequestDetailPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/purchase-claim-request-detai/senior', data })
return await request.post({ url: '/wms/purchaseClaim-request-detail/senior', data })
} else {
return await request.get({ url: `/wms/purchase-claim-request-detai/page`, params })
return await request.get({ url: `/wms/purchaseClaim-request-detail/page`, params })
}
}

15
src/api/wms/purchaseClaimRequestMain/index.ts

@ -44,6 +44,21 @@ export const deletePurchaseClaimRequestMain = async (id: number) => {
return await request.delete({ url: `/wms/purchaseClaim-request-main/delete?id=` + id })
}
// 提交审批采购索赔
export const subPurchaseClaimRequestMain = async (id: number) => {
return await request.delete({ url: `/wms/purchaseClaim-request-main/subPurchaseClaimRequestMain?id=` + id })
}
// 审批通过采购索赔
export const agreePurchaseClaimRequestMain = async (id: number) => {
return await request.delete({ url: `/wms/purchaseClaim-request-main/agreePurchaseClaimRequestMain?id=` + id })
}
// 审批驳回采购索赔
export const rejectPurchaseClaimRequestMain = async (id: number) => {
return await request.delete({ url: `/wms/purchaseClaim-request-main/rejectPurchaseClaimRequestMain?id=` + id })
}
// 导出采购索赔主 Excel
export const exportPurchaseClaimRequestMain = async (params) => {
return await request.download({ url: `/wms/purchaseClaim-request-main/export-excel`, params })

1
src/utils/dict.ts

@ -347,6 +347,7 @@ export enum DICT_TYPE {
SUPPLIERINVOICE_REQUEST_STATUS = 'supplierinvoice_request_status', //发票申请状态
SUPPLIERINVOICE_STATUS = 'supplierinvoice_status', //待开票审核状态
PURCHASECLAIM_REQUEST_STATUS = 'purchaseClaim_request_status', //采购索赔状态
INVOICE_REQUEST_STATUS = 'invoice_request_status', //待开票申请状态
// ========== system - 消息通知优化 - ==========

390
src/views/wms/supplierManage/purchaseClaim/purchaseClaimRequest/PurchaseClaimRequestMain.data.ts

@ -1,16 +1,21 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as ItembasicApi from "@/api/wms/itembasic";
import {
CustomerStatementMain,
} from '../../../deliversettlementManage/moldAllocation/customerStatement/customerStatementMain.data'
import * as CustomerStatementMainApi from '@/api/wms/customerStatementMain'
Supplieritem
} from "@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data";
import * as SupplieritemApi from "@/api/wms/supplieritem";
// 表单校验
export const PurchaseClaimRequestMainRules = reactive({
beforeTaxAmount: [required],
taxRate: [required],
taxAmount: [required],
adTaxAmount: [required],
supplierCode: [
{ required: true, message: '请选择供应商代码', trigger: 'blur' }
],
supplierName: [
{ required: true, message: '请输入供应商名称', trigger: 'blur' }
],
})
export const PurchaseClaimRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
@ -20,144 +25,126 @@ export const PurchaseClaimRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
isSearch: true,
isForm: false,
table: {
width: 150
},
},
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: true,
isForm: false,
// 0:新增1:已发布2已作废
},
{
label: '客户对账单',
field: 'customerStatementNumber',
label: '供应商代码',
field: 'supplierCode',
sort: 'custom',
table: {
width: 150
},
isSearch: true,
form: {
componentProps: {
enterSearch: true,
// labelMessage: '信息提示说明!!!',
componentProps: {    
enterSearch:true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择客户对账单', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段
searchTitle: '客户对账单信息', // 查询弹窗标题
searchAllSchemas: CustomerStatementMain.allSchemas, // 查询弹窗所需类
searchPage: CustomerStatementMainApi.getCustomerStatementMainPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPageSCP, // 查询弹窗所需分页方法
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true
}], // 失去焦点校验参数
}
}
},
{
label: '客户代码',
field: 'customer',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
disabled: true
}
}
label: '供应商名称',
field: 'supplierName',
isDetail: true,
table: {
width: 180
},
},
{
label: '客户名称',
field: 'customerName',
label: '索赔时间',
field: 'invoiceTime',
sort: 'custom',
formatter: dateFormatter,
table: {
width: 110
},
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
form: {
component: 'DatePicker',
componentProps: {
disabled: true
type: 'datetime',
valueFormat: 'x'
}
}
},
},
{
label: '未税金额',
field: 'beforeTaxAmount',
label: '供应商发票申请单号',
field: 'supplierinvoiceNumber',
sort: 'custom',
isSearch: true,
isForm:false,
form: {
componentProps: {
disabled: true
}
}
},
table: {
width: 180
},
},
{
label: '税率(%)',
field: 'taxRate',
dictType: DICT_TYPE.TAX_RATE_DICT,
label: '状态',
field: 'status',
dictType: DICT_TYPE.PURCHASECLAIM_REQUEST_STATUS,
dictClass: 'string',
sortTableDefault: 3,
isTable: true,
isForm:false,
sort: 'custom',
table: {
width: 150
},
},
{
label: '税额',
field: 'taxAmount',
sort: 'custom',
form: {
componentProps: {
disabled: true
}
}
},
{
label: '价税合计金额',
field: 'adTaxAmount',
sort: 'custom',
isSearch: true,
form: {
value: '1',
componentProps: {
disabled: true
}
}
},
{
label: '金税票号',
field: 'goldenTaxInvoiceNumber',
sort: 'custom',
},
{
label: '开票日期',
field: 'invoiceTime',
sort: 'custom',
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
isForm:false,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '备注',
field: 'remark',
sort: 'custom',
},
{
label: '是否可用默认TRUE',
field: 'available',
sort: 'custom',
isTable: false,
isForm: false
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
@ -166,7 +153,15 @@ export const PurchaseClaimRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
isForm: false,
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
isForm:false,
table: {
width: 150
},
},
{
label: '操作',
@ -180,108 +175,149 @@ export const PurchaseClaimRequestMain = useCrudSchemas(reactive<CrudSchema[]>([
]))
// 表单校验
export const PurchaseClaimRequestDetailRules = reactive({
beforeTaxAmount: [required],
taxRate: [required],
taxAmount: [required],
adTaxAmount: [required],
itemCode: [
{ required: true, message: '请输入物料代码', trigger: 'blur' }
],
claimQty: [
{ required: true, message: '请输入索赔数量', trigger: 'blur' }
],
claimAmount: [
{ required: true, message: '请输入索赔金额', trigger: 'blur' }
],
})
export const PurchaseClaimRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '品番',
field: 'number',
label: '物料代码',
field: 'itemCode',
sort: 'custom',
isSearch: true,
isForm: false,
tableForm: {
disabled: true
}
},
{
label: '品号',
field: 'articleNumber',
sort: 'custom',
isSearch: true,
isForm: false,
// 0:新增1:已发布2已作废
},
{
label: '数量',
field: 'qty',
sort: 'custom',
isSearch: true,
isSearch: false,
table: {
width: 150
},
tableForm:{
multiple:false,//多选
isInpuFocusShow: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码',// 输入框占位文本
searchField: 'itemCode', // 查询弹窗赋值字段
searchTitle: '供应商物料信息', // 查询弹窗标题
searchAllSchemas: Supplieritem.allSchemas, // 查询弹窗所需类
searchPage: SupplieritemApi.getSupplieritemPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
action: '==',
isSearch: true,
isMainValue: false
},{
key: 'supplierCode',
value: 'supplierCode',
action: '==',
message: '供应商代码不能为空!',
isFormModel:true, // filters中添加筛选的数据--取于formModel
required:true, // 前置添加必有,和isFormModel结合使用
isSearch: true,
isMainValue: false
}],
verificationPage: ItembasicApi.getItemListByCodes, // tableForm下方输入框校验失去焦点之后是否正确的方法
isShowTableFormSearch: false, //tableForm下方是否出现输入框
verificationParams: [{
key: 'itemCode',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true,
}], // 失去焦点校验参数
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
disabled:true,
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择客户对账单', // 输入框占位文本
searchField: '', // 查询弹窗赋值字段
searchTitle: '客户对账单信息', // 查询弹窗标题
searchAllSchemas: CustomerStatementMain.allSchemas, // 查询弹窗所需类
searchPage: CustomerStatementMainApi.getCustomerStatementMainPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
{
label: '销售单价',
field: 'price',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
disabled: true
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'itemCode', // 查询弹窗赋值字段
searchTitle: '供应商物料信息', // 查询弹窗标题
searchAllSchemas: Supplieritem.allSchemas, // 查询弹窗所需类
searchPage: SupplieritemApi.getSupplieritemPage, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
},{
key: 'supplierCode',
value: 'supplierCode',
message: '供应商代码不能为空!',
isMainValue:true
}
],
verificationParams: [
{
key: 'itemCode',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true
}
] // 失去焦点校验参数
}
}
},
{
label: '模具分摊单价',
field: 'allocationPrice',
label: '物料名称',
field: 'itemName',
sort: 'custom',
form: {
componentProps: {
disabled: true
}
}
table: {
width: 150
},
},
{
label: '合计单价',
field: 'beforeTaxAmount',
label: '计量单位',
field: 'uom',
sort: 'custom',
form: {
componentProps: {
disabled: true
}
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: false,
isTable: true,
table: {
width: 110
},
tableForm: {
type: 'Select'
}
},
{
label: '未税金额',
field: 'taxRate',
label: '索赔数量',
field: 'claimQty',
sort: 'custom',
},
{
label: '税额',
field: 'taxAmount',
sort: 'custom',
form: {
componentProps: {
disabled: true
}
isSearch: false,
isTable: true,
table: {
width: 110
},
tableForm: {
type: 'InputNumber',
min: 0,
precision: 0
}
},
{
label: '含税金额',
field: 'adTaxAmount',
label: '索赔金额',
field: 'claimAmount',
sort: 'custom',
form: {
componentProps: {
disabled: true
}
isSearch: false,
isTable: true,
table: {
width: 110
},
tableForm: {
type: 'InputNumber',
min: 0,
precision: 5
}
},
]))

304
src/views/wms/supplierManage/purchaseClaim/purchaseClaimRequest/index.vue

@ -1,21 +1,29 @@
<template>
<ContentWrap>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="[...PurchaseClaimRequestMain.allSchemas.searchSchema,...PurchaseClaimRequestDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="PurchaseClaimRequestMain.allSchemas"
:detailAllSchemas="PurchaseClaimRequestDetail.allSchemas"
<Search
:schema="[
...PurchaseClaimRequestMain.allSchemas.searchSchema,
...PurchaseClaimRequestDetail.allSchemas.searchSchema
]"
@search="setSearchParams"
@reset="setSearchParams"
/>
<!-- 列表 -->
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="PurchaseClaimRequestMain.allSchemas"
:detailAllSchemas="PurchaseClaimRequestDetail.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable
<Table
v-clientTable
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
@ -26,20 +34,23 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #number="{row}">
<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="formRef"
:isOpenSearchTable="true"
:isOpenSearchTable="false"
fieldTableColumn="itemCode"
:rules="PurchaseClaimRequestMainRules"
:formAllSchemas="PurchaseClaimRequestMain.allSchemas"
@ -69,16 +80,28 @@
:apiDelete="PurchaseClaimRequestDetailApi.deletePurchaseClaimRequestDetail"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/deliver-plan-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" :extend= "businessType"/>
<ImportForm
ref="importFormRef"
url="/wms/deliver-plan-main/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
:updateIsDisable="true"
:coverIsDisable="true"
:mode="2"
:extend="businessType"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { PurchaseClaimRequestMain,PurchaseClaimRequestMainRules,PurchaseClaimRequestDetailRules,PurchaseClaimRequestDetail} from './PurchaseClaimRequestMain.data'
import {
PurchaseClaimRequestMain,
PurchaseClaimRequestMainRules,
PurchaseClaimRequestDetailRules,
PurchaseClaimRequestDetail
} from './PurchaseClaimRequestMain.data'
import * as PurchaseClaimRequestMainApi from '@/api/wms/PurchaseClaimRequestMain'
import * as PurchaseClaimRequestDetailApi from '@/api/wms/purchaseClaimRequestDetail'
import * as CustomerStatementDetailApi from '@/api/wms/customerStatementDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { formatDate } from '@/utils/formatTime'
import { usePageLoading } from '@/hooks/web/usePageLoading'
@ -91,9 +114,12 @@ const route = useRoute() // 路由信息
const routeName = ref()
routeName.value = route.name
const businessType = ref()
const tableColumns = ref([...PurchaseClaimRequestMain.allSchemas.tableColumns,...PurchaseClaimRequestDetail.allSchemas.tableMainColumns])
const tableColumns = ref([
...PurchaseClaimRequestMain.allSchemas.tableColumns,
...PurchaseClaimRequestDetail.allSchemas.tableMainColumns
])
const { tableObject, tableMethods } = useTable({
getListApi: PurchaseClaimRequestMainApi.getPurchaseClaimRequestMainPage //
getListApi: PurchaseClaimRequestDetailApi.getPurchaseClaimRequestDetailPage //
})
//
@ -105,57 +131,51 @@ const tableData = ref([])
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(async () => {
if (type == 'tableForm') {
if(formField == 'itemCode') {
if(formField == 'itemCode'){
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['itemCode']==item['itemCode']))
if(itemCodes.length>0){
itemCodes = itemCodes.map(item=>(item['itemCode']))
message.warning(`物料${itemCodes.join(',')}已经存在`)
}
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']))
if(val.length==0) return
val.forEach(item=>{
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item}))
row[formField] = item[searchField]
newRow['uom'] = item['customerUom']
newRow['id'] = item['id']
.push(newRow)
})
}else{
row[formField] = val[0][searchField]
}
// if(formField == 'itemCode') {
// row['uom'] = val[0]['customerUom']
// }
//
} else {
const setV = {}
if(formField == 'customerStatementNumber') {
//
setV['customer'] = val[0]['customerCode']
setV['customerName'] = val[0]['customerName']
CustomerStatementDetailApi.getCustomerStatementDetailPage({
pageNo:1,
pageNSize: 100,
masterId:val[0]['id']
}).then((res) => {
console.log(55,res)
tableData.value = res.list && res.list.length > 0 ?res.list : []
})
// tableData.value = []
if(val.length==0){
return
}
let newVal = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']))
newVal.forEach(item=>{
let tfk = JSON.parse(JSON.stringify(tableFormKeys))
tfk['itemCode'] = item['itemCode']
tfk['itemName'] = item['itemName']
tfk['uom'] = item['supplierUom']
tableData.value.push(tfk)
})
}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
const setV = {}
if(formField === 'supplierCode'){
setV['supplierCode'] = val[0]['code']
setV['supplierName'] = val[0]['name']
tableData.value = []
}
formRef.setValues(setV)
// else {
// //
// if (formField == 'supplierCode') {
// setV['supplierName'] = val[0].name
// }
// setV[formField] = val[0][searchField]
// formRef.setValues(setV)
// }
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
@ -170,12 +190,12 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:`wms:${routeName.value}:create` }), //
defaultButtons.defaultImportBtn({hasPermi:`wms:${routeName.value}:import` }), //
defaultButtons.defaultExportBtn({hasPermi:`wms:${routeName.value}:export` }), //
defaultButtons.defaultAddBtn({ hasPermi: `wms:purchaseClaimRequest:create` }), //
defaultButtons.defaultImportBtn({ hasPermi: `wms:purchaseClaimRequest:import` }), //
defaultButtons.defaultExportBtn({ hasPermi: `wms:purchaseClaimRequest:export` }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -187,27 +207,33 @@ 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') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
} else if (val == 'refresh') {
//
if (tableObject.params.filters && tableObject.params.filters.length > 0) {
searchFormClick({
filters: tableObject.params.filters
})
} else {
getList()
}
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
//
const isShowMainButton = (row,val) => {
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
@ -215,42 +241,78 @@ 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 [
defaultButtons.mainListPlanOpeBtn({hide:isShowMainButton(row,['5']),hasPermi:`wms:${routeName.value}:open`}), //
defaultButtons.mainListPlanCloBtn({hide:isShowMainButton(row,['1','2','3','4']),hasPermi:`wms:${routeName.value}:close`}), //
defaultButtons.mainListPlanSubBtn({hide:isShowMainButton(row,['1']),hasPermi:`wms:${routeName.value}:submit`}), //
defaultButtons.mainListPlanTurBtn({hide:isShowMainButton(row,['2']),hasPermi:`wms:${routeName.value}:reject`}), //
defaultButtons.mainListPlanAppBtn({hide:isShowMainButton(row,['2']),hasPermi:`wms:${routeName.value}:agree`}), //
defaultButtons.mainListPlanPubBtn({hide:isShowMainButton(row,['3']),hasPermi:`wms:${routeName.value}:publish`}), //
defaultButtons.mainListPlanResBtn({hide:isShowMainButton(row,['4']),hasPermi:`wms:${routeName.value}:resetting`}), //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:`wms:${routeName.value}:update`}), //
defaultButtons.mainListPlanSubBtn({
hide: isShowMainButton(row, ['0']),
hasPermi: `wms:purchaseClaimRequest:sub`
}), //
defaultButtons.mainListPlanTurBtn({
hide: isShowMainButton(row, ['3']),
hasPermi: `wms:purchaseClaimRequest:reject`
}), //
defaultButtons.mainListPlanAppBtn({
hide: isShowMainButton(row, ['3']),
hasPermi: `wms:purchaseClaimRequest:agree`
}), //
defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['0']),
hasPermi: `wms:purchaseClaimRequest:update`
}) //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
} else if (val == 'delete') {
//
handleSub(row.id)
}
else if (val == 'delete') {
//
handleDelete(row.masterId)
}
}
/** 提交审批按钮操作 */
const handleSub = async (id: number) => {
try {
//
await message.confirm(t('ts.是否提交审批所选中数据?'))
tableObject.loading = true
//
await PurchaseClaimRequestMainApi.subPurchaseClaimRequestMain(id)
message.success(t('ts.提交审批成功!'))
tableObject.loading = false
//
await getList()
} catch {
} finally {
tableObject.loading = false
}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm =async (type: string, row?: number) => {
const openForm = async (type: string, row?: number) => {
tableData.value = [] //
formRef.value.open(type, row)
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue,'planDeliverMain')
detailRef.value.openDetail(row, titleName, titleValue, 'planDeliverMain')
}
/** 删除按钮操作 */
@ -264,7 +326,7 @@ const handleDelete = async (id: number) => {
tableObject.loading = false
message.success(t('common.delSuccess'))
//
buttonBaseClick('refresh',null)
buttonBaseClick('refresh', null)
} catch {}
}
/** 导出按钮操作 */
@ -275,7 +337,9 @@ const handleExport = async () => {
//
loadStart()
const excelTitle = ref(route.meta.title)
const data = await PurchaseClaimRequestMainApi.exportPurchaseClaimRequestMain(tableObject.params)
const data = await PurchaseClaimRequestMainApi.exportPurchaseClaimRequestMain(
tableObject.params
)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch {
} finally {
@ -284,10 +348,10 @@ const handleExport = async () => {
}
/**
* tableForm方法
*/
* tableForm方法
*/
const tableFormKeys = {}
PurchaseClaimRequestDetail.allSchemas.tableFormColumns.forEach(item => {
PurchaseClaimRequestDetail.allSchemas.tableFormColumns.forEach((item) => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
@ -298,61 +362,53 @@ const handleAddTable = () => {
//
const handleDeleteTable = (item, index) => {
let itemIndex = tableData.value.indexOf(item)
if(itemIndex>-1){
if (itemIndex > -1) {
tableData.value.splice(itemIndex, 1)
}
}
const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item))
tableData.value = tableData.value.filter((item) => !selection.includes(item))
}
//true0
const flag = ref(false)
//
const submitForm = async (formType, submitData) => {
let data = {...submitData}
if(data.masterId){
let data = { ...submitData }
if (data.masterId) {
data.id = data.masterId
}
data.subList = tableData.value //
data.subList.forEach(item=>{
data.subList.forEach((item) => {
item.toWarehouseCode = data.toWarehouseCode
item.toLocationCode = data.toLocationCode
})
data.businessType = businessType.value
//
let isExist = false
tableData.value.forEach(item => {
let rs = tableData.value.filter(filterItem => (filterItem.itemCode == item.itemCode))
if(rs.length > 1) isExist = true
//
let isExist = false
tableData.value.forEach((item) => {
let rs = tableData.value.filter((filterItem) => filterItem.itemCode == item.itemCode)
if (rs.length > 1) isExist = true
})
if (isExist) {
formRef.value.formLoading = false
return message.warning('物料代码重复')
}
data.subList.forEach(obj => {
if(obj.qty == 0){
message.error(`数量不能为0!`)
data.subList.forEach((obj) => {
if (obj.claimQty == 0) {
message.error(`索赔数量不能为0!`)
flag.value = true
return
}
if (obj.claimAmount == 0) {
message.error(`索赔金额不能为0!`)
flag.value = true
return;
return
}
})
if(flag.value){
if (flag.value) {
return
}
var isHave =PurchaseClaimRequestMain.allSchemas.formSchema.some(function (item) {
return item.field === 'beginTime' || item.field === 'endTime';
});
if(isHave){
if(data.beginTime && data.endTime && data.beginTime >=data.expireTime){
message.error('结束时间要大于开始时间')
return;
}
}
console.log(data.beginTime)
if(!data.beginTime)data.beginTime = null;
if(!data.planDate)data.planDate = null;
if(!data.endTime)data.endTime = null;
formRef.value.formLoading = true
try {
if (formType === 'create') {
@ -366,8 +422,8 @@ const submitForm = async (formType, submitData) => {
//
if (formType === 'create') {
getList()
}else{
buttonBaseClick('refresh',null)
} else {
buttonBaseClick('refresh', null)
}
} finally {
formRef.value.formLoading = false

Loading…
Cancel
Save