Browse Source

YT-170:客户对账单重新比对、确认对比结果、作废接口方法以及按钮回显逻辑

syhx
宋国强 4 months ago
parent
commit
e52a5182c4
  1. 20
      src/api/wms/customerStatementMain/index.ts
  2. 12
      src/utils/disposition/defaultButtons.ts
  3. 26
      src/views/wms/deliversettlementManage/customerStatement/customerStatement/customerStatementMain.data.ts
  4. 203
      src/views/wms/deliversettlementManage/customerStatement/customerStatement/index.vue

20
src/api/wms/customerStatementMain/index.ts

@ -65,4 +65,24 @@ export const importTemplate = () => {
// 导入客户对账单前校验是否有相同客户代码和年月的数据存在
export const verifyDataExist = async (yearsMonthStr: String,customerCode:String) => {
return await request.get({ url: `/wms/customer-statement-main/verifyDataExist?yearsMonthStr=` + yearsMonthStr+'&customerCode='+customerCode })
}
// 客户对账单重新比对
export const recontrast = async (id: number) => {
return await request.get({ url: `/wms/customer-statement-main/recontrast?id=` + id})
}
// 客户对账单确认比对结果
export const confirmationContrast = async (id: number) => {
return await request.get({ url: `/wms/customer-statement-main/confirmationContrast?id=` + id})
}
// 客户对账单废除数据
export const nodeAbrogate = async (id: number) => {
return await request.get({ url: `/wms/customer-statement-main/nodeAbrogate?id=` + id})
}
// 客户对账单退回操作
export const sendBack = async (id: number) => {
return await request.get({ url: `/wms/customer-statement-main/sendBack?id=` + id})
}

12
src/utils/disposition/defaultButtons.ts

@ -1404,6 +1404,18 @@ export function outBtn(option: any) {
hasPermi: ''
})
}
// 主列表-退回
export function mainSendBackBtn(option: any) {
return __defaultBtnOption(option, {
label: t(`ts.退回`).replace('ts.', ''),
name: 'sendBack',
hide: false,
type: 'warning',
color: '',
link: true, // 文本展现按钮
hasPermi: ''
})
}
// 默认按钮规则
function __defaultBtnOption(option: any, specific: any) {
return {

26
src/views/wms/deliversettlementManage/customerStatement/customerStatement/customerStatementMain.data.ts

@ -23,7 +23,7 @@ export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true,
},
{
label: '客户代码',
label: '客户编号',
field: 'customerCode',
sort: 'custom',
isSearch: true,
@ -43,7 +43,7 @@ export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
@ -72,6 +72,7 @@ export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '重新比对更新时间',
field: 'comparisonTime',
sort: 'custom',
isTable:false,
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -85,6 +86,7 @@ export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '发布时间',
field: 'publishTime',
sort: 'custom',
isTable:false,
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -98,6 +100,7 @@ export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '已分摊时间',
field: 'shareTime',
sort: 'custom',
isTable:false,
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -111,6 +114,7 @@ export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '待开票时间',
field: 'beInvoicedTime',
sort: 'custom',
isTable:false,
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -124,6 +128,7 @@ export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '开票中时间',
field: 'invoicedTime',
sort: 'custom',
isTable:false,
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -137,6 +142,7 @@ export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '已开票时间',
field: 'issuedInvoicedTime',
sort: 'custom',
isTable:false,
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -150,6 +156,7 @@ export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '已作废时间',
field: 'abrogateTime',
sort: 'custom',
isTable:false,
formatter: dateFormatter,
form: {
component: 'DatePicker',
@ -160,16 +167,21 @@ export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([
},
},
{
label: '版本号',
field: 'versionNumber',
label: '操作人',
field: 'creator',
sort: 'custom',
},
{
label: '备注',
field: 'remark',
label: '版本号',
field: 'versionNumber',
sort: 'custom',
},
// {
// label: '备注',
// field: 'remark',
// sort: 'custom',
// },
// {
// label: '是否可用默认TRUE',
// field: 'available',
// sort: 'custom',
@ -205,7 +217,7 @@ export const CustomerStatementMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'action',
isForm: false,
table: {
width: 150,
width: 300,
fixed: 'right'
}
}

203
src/views/wms/deliversettlementManage/customerStatement/customerStatement/index.vue

@ -1,67 +1,51 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="CustomerStatementMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search :schema="CustomerStatementMain.allSchemas.searchSchema" @search="setSearchParams"
@reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="CustomerStatementMain.allSchemas"
/>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
:allSchemas="CustomerStatementMain.allSchemas" />
<!-- 列表 -->
<ContentWrap>
<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 #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
<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 }">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @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"
@success="formsSuccess"
:rules="CustomerStatementMainRules"
:formAllSchemas="CustomerStatementMain.allSchemas"
:apiUpdate="CustomerStatementMainApi.updateCustomerStatementMain"
:apiCreate="CustomerStatementMainApi.createCustomerStatementMain"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="CustomerStatementMainRules"
:formAllSchemas="CustomerStatementMain.allSchemas" :apiUpdate="CustomerStatementMainApi.updateCustomerStatementMain"
:apiCreate="CustomerStatementMainApi.createCustomerStatementMain" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" />
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="CustomerStatementMain.allSchemas" />
<!-- 导入 -->
<!-- <ImportForm ref="importFormRef" url="/wms/customer-statement-main/import" :importTemplateData="importTemplateData" @success="importSuccess" /> -->
<ImportCustomerStatementForm ref="importFormRef" url="/wms/customer-statement-main/import" :importTemplateData="importTemplateData" @success="importSuccess" />
<ImportCustomerStatementForm ref="importFormRef" url="/wms/customer-statement-main/import"
:importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { CustomerStatementMain,CustomerStatementMainRules } from './customerStatementMain.data'
import { CustomerStatementDetail,CustomerStatementDetailRules } from './customerStatementDetail.data'
import { CustomerStatementMain, CustomerStatementMainRules } from './customerStatementMain.data'
import { CustomerStatementDetail, CustomerStatementDetailRules } from './customerStatementDetail.data'
import * as CustomerStatementMainApi from '@/api/wms/customerStatementMain'
import * as CustomerStatementDetailApi from '@/api/wms/customerStatementDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -137,16 +121,61 @@ const buttonBaseClick = (val, item) => {
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:customerStatementMain:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:customerStatementMain:delete'}), //
]
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.mainListEditBtn({hasPermi:'wms:customerStatementMain:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:customerStatementMain:delete'}), //
{
label: t('重新比对'),
name: 'rematch',
hide: isShowMainButton(row, ['2']),
type: 'primary',
icon: '',
color: '',
hasPermi: '',
link: true //
},
{
label: t('确认对比结果'),
name: 'confirmationContrast',
hide: isShowMainButton(row, ['2']),
type: 'primary',
icon: '',
color: '',
hasPermi: '',
link: true //
},
defaultButtons.mainSendBackBtn({ hide: isShowMainButton(row, ['3','4','5']) }), // 退
//defaultButtons.mainListCancelBtn({ hide: isShowMainButton(row, ['2','3','4','5']), hasPermi: 'wms:purchase-plan-main:update' }), //
defaultButtons.mainListCancelBtn({ hide: isShowMainButton(row, ['2','3','4','5'])}), //
{
label: t('导入'),
name: 'import',
hide: isShowMainButton(row, ['3','4']),
type: 'warning',
color: '',
hasPermi: '',
link: true //
},
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
if (val == 'rematch') { //
tapRematch(row.id);
} else if (val == 'confirmationContrast') { //
tapConfirmationContrast(row.id)
}else if (val == 'sendBack') { // 退
tapSendBack(row.id)
}else if (val == 'cancel') { //
tapCancel(row.id)
}else if (val == 'import') { //
handleDelete(row.id)
}
}
@ -158,18 +187,18 @@ const openForm = (type: string, row?: any) => {
}
// form
const formsSuccess = async (formType,data) => {
var isHave =CustomerStatementMain.allSchemas.formSchema.some(function (item) {
const formsSuccess = async (formType, data) => {
var isHave = CustomerStatementMain.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.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 (data.activeTime == 0) data.activeTime = null;
if (data.expireTime == 0) data.expireTime = null;
if (formType === 'create') {
await CustomerStatementMainApi.createCustomerStatementMain(data)
message.success(t('common.createSuccess'))
@ -197,7 +226,7 @@ const handleDelete = async (id: number) => {
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
} catch { }
}
/** 导出按钮操作 */
@ -245,5 +274,73 @@ onMounted(async () => {
getList()
importTemplateData.templateUrl = await CustomerStatementMainApi.importTemplate()
})
//
const tapRematch = async (id:number) => {
try {
//
await message.confirm('是否重新比对')
await CustomerStatementMainApi.recontrast(id);
//
//exportLoading.value = true
} catch {
} finally {
//
await getList()
}
}
//
const tapConfirmationContrast = async (id:number) => {
try {
await message.confirm('是否确认对比结果')
await CustomerStatementMainApi.confirmationContrast(id);
//
//exportLoading.value = true
} catch {
} finally {
//
await getList()
}
}
//退
const tapSendBack = async (id:number) => {
try {
await message.confirm('是否退回')
await CustomerStatementMainApi.sendBack(id);
//
//exportLoading.value = true
} catch {
} finally {
//
await getList()
}
}
//
const tapCancel = async (id:number) => {
try {
await message.confirm('是否作废')
await CustomerStatementMainApi.nodeAbrogate(id);
//
//exportLoading.value = true
} catch {
} finally {
//
await getList()
}
}
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
</script>

Loading…
Cancel
Save