Browse Source

采购索赔页面显示问题

intex_online20241111
zhang_li 1 month ago
parent
commit
701aa5c47d
  1. 250
      src/views/wms/supplierManage/purchaseClaim/purchaseClaimRequest/index.vue
  2. 117
      src/views/wms/supplierManage/purchaseClaim/purchaseClaimRequest/invoicingcalendar.data.ts
  3. 332
      src/views/wms/supplierManage/purchaseClaim/purchaseClaimRequest/purchaseClaimRequestMain.data.ts

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

@ -1,7 +1,7 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="PurchaseClaimRequestMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search :schema="Invoicingcalendar.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
@ -11,12 +11,12 @@
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="PurchaseClaimRequestMain.allSchemas"
:allSchemas="Invoicingcalendar.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
@ -27,71 +27,48 @@
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>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row,$index }">
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
@success="getList"
:rules="PurchaseClaimRequestMainRules"
:formAllSchemas="PurchaseClaimRequestMain.allSchemas"
:tableAllSchemas="PurchaseClaimRequestDetail.allSchemas"
:tableFormRules="PurchaseClaimRequestDetailRules"
:tableData="tableData"
:apiUpdate="PurchaseClaimRequestMainApi.updatePurchaseClaimRequestMain"
:apiCreate="PurchaseClaimRequestMainApi.createPurchaseClaimRequestMain"
:isBusiness="true"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
:isShowReduceButtonSelection="true"
@tableSelectionDelete="tableSelectionDelete"
ref="basicFormRef"
@success="formsSuccess"
:rules="InvoicingcalendarRules"
:formAllSchemas="Invoicingcalendar.allSchemas"
:apiUpdate="InvoicingcalendarApi.updateInvoicingcalendar"
:apiCreate="InvoicingcalendarApi.createInvoicingcalendar"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="PurchaseClaimRequestMain.allSchemas"
:detailAllSchemas="PurchaseClaimRequestDetail.allSchemas"
:detailAllSchemasRules="PurchaseClaimRequestDetailRules"
:apiCreate="PurchaseClaimRequestDetailApi.createPurchaseClaimRequestDetail"
:apiUpdate="PurchaseClaimRequestDetailApi.updatePurchaseClaimRequestDetail"
:apiPage="PurchaseClaimRequestDetailApi.getPurchaseClaimRequestDetailPage"
:apiDelete="PurchaseClaimRequestDetailApi.deletePurchaseClaimRequestDetail"
fromeWhere="purchaseClaimRequest"
:detailButtonIsShowAdd="false"
:Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail"
/>
<Detail ref="detailRef" :isBasic="true" :allSchemas="Invoicingcalendar.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/purchaseClaim-request-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" />
<ImportForm ref="importFormRef" url="/wms/invoicingcalendar/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { PurchaseClaimRequestMain,PurchaseClaimRequestMainRules,PurchaseClaimRequestDetail,PurchaseClaimRequestDetailRules } from './purchaseClaimRequestMain.data'
import * as PurchaseClaimRequestMainApi from '@/api/wms/purchaseClaimRequestMain'
import * as PurchaseClaimRequestDetailApi from '@/api/wms/purchaseClaimRequestDetail'
import { Invoicingcalendar,InvoicingcalendarRules } from './invoicingcalendar.data'
import * as InvoicingcalendarApi from '@/api/wms/invoicingcalendar'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import { formatDate } from '@/utils/formatTime'
import { usePageLoading } from '@/hooks/web/usePageLoading'
const { loadStart, loadDone } = usePageLoading()
//
defineOptions({ name: 'PurchaseClaimRequest' })
defineOptions({ name: 'Invoicingcalendar' })
const message = useMessage() //
const { t } = useI18n() //
@ -99,28 +76,10 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(PurchaseClaimRequestMain.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const tableColumns = ref(Invoicingcalendar.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick(() => {
if (type == 'tableForm') {
//
row[formField] = val[0][searchField]
} else {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
@ -128,12 +87,13 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
})
}
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: PurchaseClaimRequestMainApi.getPurchaseClaimRequestMainPage //
getListApi: InvoicingcalendarApi.getInvoicingcalendarPage //
})
//
@ -141,9 +101,9 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:countadjust-request-main:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:countadjust-request-main:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:countadjust-request-main:export'}), //
defaultButtons.defaultAddBtn({hasPermi:'wms:invoicingcalendar:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:invoicingcalendar:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:invoicingcalendar:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -166,62 +126,70 @@ const buttonBaseClick = (val, item) => {
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
searchFormClick({
filters: tableObject.params.filters
})
} else {
getList()
}
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
//
const isShowMainButton = (row,val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = (row,$index) => {
return [
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3','4','6']),hasPermi:'wms:countadjust-request-main:close'}), //
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['5']),hasPermi:'wms:countadjust-request-main:reAdd'}), //
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:countadjust-request-main:submit'}), //
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:countadjust-request-main:refused'}), //
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:countadjust-request-main:agree'}), //
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:countadjust-request-main:handle'}), //
]
}
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:invoicingcalendar:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:invoicingcalendar:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm =async (type: string, row?: number) => {
tableData.value = [] //
formRef.value.open(type, row)
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =Invoicingcalendar.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;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
if(data.beginDay > data.endDay){
message.error('开始日期要小于截止日期')
return;
}
await InvoicingcalendarApi.createInvoicingcalendar(data)
message.success(t('common.createSuccess'))
} else {
if(data.beginDay > data.endDay){
message.error('开始日期要小于截止日期')
return;
}
await InvoicingcalendarApi.updateInvoicingcalendar(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
//
const { wsCache } = useCache()
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode))
detailRef.value.openDetail(row, titleName, titleValue,"requestCountadjustMain")
detailRef.value.openDetail(row, titleName, titleValue, 'basicInvoicingcalendar')
}
/** 删除按钮操作 */
@ -229,15 +197,12 @@ const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
tableObject.loading = true
//
await PurchaseClaimRequestMainApi.deletePurchaseClaimRequestMain(id)
await InvoicingcalendarApi.deleteInvoicingcalendar(id)
message.success(t('common.delSuccess'))
//
buttonBaseClick('refresh',null)
} finally {
tableObject.loading = false
}
await getList()
} catch {}
}
/** 导出按钮操作 */
@ -248,73 +213,24 @@ const handleExport = async () => {
//
loadStart()
const excelTitle = ref(route.meta.title)
const data = await PurchaseClaimRequestMainApi.exportPurchaseClaimRequestMain(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
const data = await InvoicingcalendarApi.exportInvoicingcalendar(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch {
} finally {
loadDone()
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
PurchaseClaimRequestDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
const handleDeleteTable = (item, index) => {
let itemIndex = tableData.value.indexOf(item)
if(itemIndex>-1){
tableData.value.splice(itemIndex, 1)
}
}
const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item))
}
//
const submitForm = async (formType, data) => {
data.subList = tableData.value //
formRef.value.formLoading = true
try {
if (formType === 'create') {
await PurchaseClaimRequestMainApi.createPurchaseClaimRequestMain(data)
message.success(t('common.createSuccess'))
} else {
await PurchaseClaimRequestMainApi.updatePurchaseClaimRequestMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
if (formType === 'create') {
getList()
}else{
buttonBaseClick('refresh',null)
}
} finally {
formRef.value.formLoading = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: `${route.meta.title}】导入模版.xlsx`
})
//
const importSuccess = () => {
getList()
@ -332,5 +248,7 @@ const searchFormClick = (searchData) => {
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await InvoicingcalendarApi.importTemplate()
})
</script>

117
src/views/wms/supplierManage/purchaseClaim/purchaseClaimRequest/invoicingcalendar.data.ts

@ -0,0 +1,117 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import { fa } from 'element-plus/es/locale'
// 表单校验
export const InvoicingcalendarRules = reactive({
beginDay: [required],
endDay: [required],
concurrencyStamp: [required],
})
export const Invoicingcalendar = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isForm: false,
isTable: false
},
{
label: '开始日期',
field: 'beginDay',
sort: 'custom',
dictType: DICT_TYPE.SYSTEM_DAY,
dictClass: 'string',
},
{
label: '结束日期',
field: 'endDay',
sort: 'custom',
dictType: DICT_TYPE.SYSTEM_DAY,
dictClass: 'string',
},
{
label: '描述',
field: 'descriiption',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '备注',
field: 'remark',
sort: 'custom',
},
{
label: '扩展属性',
field: 'extraProperties',
sort: 'custom',
isTable: false,
isForm:false,
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isTable: false,
isForm:false,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isTable: false,
isForm:false,
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
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,
isTable: true,
},
{
label: '创建人',
field: 'creator',
sort: 'custom',
isTable: true,
isForm:false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

332
src/views/wms/supplierManage/purchaseClaim/purchaseClaimRequest/purchaseClaimRequestMain.data.ts

@ -1,332 +0,0 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { TableColumn } from '@/types/table'
import { dateFormatter } from '@/utils/formatTime'
import * as getRequestsettingApi from '@/api/wms/requestsetting/index'
const { t } = useI18n() // 国际化
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
const queryParams = {
pageSize:10,
pageNo:1,
code:'PurchaseClaimRequest'
}
const data = await getRequestsettingApi.getRequestsettingPage(queryParams)
const requestsettingData =data?.list[0]||{}
// 获取当前操作人的部门
import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore()
const userDept = userStore.userSelfInfo.dept
// id 转str 否则form回显匹配不到
userDept.id = userDept.id.toString()
const userDeptArray:any = [userDept]
/**
* @returns {Array}
*/
export const PurchaseClaimRequestMain = useCrudSchemas(<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '供应商代码',
field: 'supplierCode',
sort: 'custom',
isSearch: true,
},
{
label: '索赔时间',
field: 'claimTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
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: {
type: 'datetime',
valueFormat: 'x'
}
},
},
//0:新增1:已关闭2:审批中3:审批驳回4:审批通过5:开票中6:已完成
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: true,
form: {
component: 'Radio'
},
},
{
label: '供应商发票申请单号',
field: 'supplierinvoiceNumber',
sort: 'custom',
isSearch: true,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: true,
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isForm: false,
isSearch: true,
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')]
},
},
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
isForm: false
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 300,
fixed: 'right'
},
}
]))
//表单校验
export const PurchaseClaimRequestMainRules = reactive({
// requestNumber: [
// { required: true, message: '请选择申请单号', trigger: 'change' }
// ],
departmentCode: [
{ required: true, message: '请输入部门', trigger: 'blur' }
],
autoCommit: [
{ required: true, message: '请选择是否自动提交', trigger: 'change' }
],
autoAgree: [
{ required: true, message: '请选择是否自动通过', trigger: 'change' }
],
autoExecute: [
{ required: true, message: '请选择是否自动执行', trigger: 'change' }
],
directCreateRecord: [
{ required: true, message: '请选择是否跳过任务直接生成记录', trigger: 'change' }
],
// businessType: [
// { required: true, message: '请输入业务类型', trigger: 'blur' }
// ],
})
/**
* @returns {Array}
*/
export const PurchaseClaimRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 180
},
isTableForm: false,
form: {
componentProps: {
disabled: true
}
}
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
},
{
label: '物料名称',
field: 'itemName',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '计量单位',
field: 'uom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
sort: 'custom',
table: {
width: 150
},
tableForm: {
type: 'Select'
}
},
{
label: '索赔数量',
field: 'claimQty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
tableForm: {
type: 'InputNumber',
min: 1,
precision: 6
}
},
{
label: '索赔金额',
field: 'claimAmount',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
tableForm: {
type: 'InputNumber',
min: 1,
precision: 6
}
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isTableForm: false,
isForm: false
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false ,
isTable:false,
table: {
width: 150,
fixed: 'right'
},
isTableForm:false,
}
]))
//表单校验
export const PurchaseClaimRequestDetailRules = reactive({
countDetailNumber: [
{ required: true, message: '请输入盘点明细号', trigger: 'blur' }
],
packingNumber: [
{ required: true, message: '请选择包装号', trigger: 'change' }
],
batch: [
{ required: true, message: '请输入批次', trigger: 'blur' }
],
locationCode: [
{ required: true, message: '请选择库位代码', trigger: 'change' }
],
inventoryStatus: [
{ required: true, message: '请选择库存状态', trigger: 'change' }
],
inventoryQty: [
{ required: true, message: '请输入库存数量', trigger: 'blur' }
],
countQty: [
{ required: true, message: '请输入盘点数量', trigger: 'blur' }
],
adjustQty: [
{ required: true, message: '请输入调整数量', trigger: 'blur' }
],
// number: [
// { required: true, message: '请输入单据号', trigger: 'blur' }
// ],
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' }
],
})
Loading…
Cancel
Save