7 changed files with 1052 additions and 5 deletions
@ -0,0 +1,692 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime' |
|||
import * as CustomerApi from '@/api/wms/customer' |
|||
import { Customer } from '../../../basicDataManage/customerManage/customer/customer.data' |
|||
import * as LocationApi from '@/api/wms/location' |
|||
import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' |
|||
|
|||
|
|||
/** |
|||
* @returns {Array} 发货记录主表 |
|||
*/ |
|||
export const DeliverRecordMain = useCrudSchemas( |
|||
reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '单据号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180, |
|||
fixed: 'left' |
|||
}, |
|||
isSearch: true, |
|||
isForm: false, |
|||
}, |
|||
|
|||
{ |
|||
label: '发货类型', |
|||
field: 'businessType', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable: true, |
|||
dictType: DICT_TYPE.DELIVER_METHOD, |
|||
dictClass: 'string', |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '客户代码', |
|||
field: 'customerCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isSearch: true, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '客户月台代码', |
|||
field: 'customerDockCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: true, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '客户订单号', |
|||
field: 'customerOrderNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isSearch: true, |
|||
isTable: true, |
|||
isForm: false, |
|||
search: { |
|||
component: 'Input', |
|||
} |
|||
}, |
|||
{ |
|||
label: '车牌号', |
|||
field: 'vehiclePlateNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '截止时间', |
|||
field: 'dueTime', |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isTable: false, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '从仓库代码', |
|||
field: 'fromWarehouseCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '到仓库代码', |
|||
field: 'toWarehouseCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isTable: false, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
isSearch: false, |
|||
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, |
|||
}, |
|||
{ |
|||
label: '创建者', |
|||
field: 'creator', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
isForm: false, |
|||
}, |
|||
// {
|
|||
// label: '代码',
|
|||
// field: 'code',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
isSearch: false, |
|||
isTable: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'Switch', |
|||
value: 'TRUE', |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE' |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isDetail: false, |
|||
isForm: false, |
|||
table: { |
|||
width: 150, |
|||
fixed: 'right' |
|||
}, |
|||
hiddenInMain: true, |
|||
isTableForm: false, |
|||
} |
|||
|
|||
]) |
|||
) |
|||
|
|||
//表单校验
|
|||
export const DeliverRecordMainRules = reactive({ |
|||
businessType: [ |
|||
{ required: true, message: '请输入发货类型', trigger: 'blur' } |
|||
], |
|||
}) |
|||
|
|||
/** |
|||
* @returns {Array} 发货记录子表 |
|||
*/ |
|||
export const DeliverRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '单据号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isTable: false |
|||
}, |
|||
// {
|
|||
// label: '销售订单号',
|
|||
// field: 'soNumber',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
// {
|
|||
// label: '销售订单行',
|
|||
// field: 'soLine',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
{ |
|||
label: '到库位', |
|||
field: 'toLocationCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '品番', |
|||
field: 'itemCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '品名', |
|||
field: 'itemName', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '背番', |
|||
field: 'itemDesc1', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true |
|||
}, |
|||
{ |
|||
label: '描述', |
|||
field: 'itemDesc2', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true |
|||
}, |
|||
{ |
|||
label: '批次', |
|||
field: 'batch', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '包装号', |
|||
field: 'packingNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
}, |
|||
{ |
|||
label: '父包装号', |
|||
field: 'parentPackingNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
isTable: false, |
|||
}, |
|||
{ |
|||
label: '包装规格', |
|||
field: 'packUnit', |
|||
isSearch: false, |
|||
isTable: false, |
|||
isForm:false, |
|||
isDetail:false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '数量', |
|||
field: 'qty', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'InputNumber', |
|||
} |
|||
}, |
|||
{ |
|||
label: '计量单位', |
|||
field: 'uom', |
|||
dictType: DICT_TYPE.UOM, |
|||
dictClass: 'string', |
|||
isTable: true, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
}, |
|||
{ |
|||
label: '单价', |
|||
field: 'singlePrice', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
} |
|||
}, |
|||
{ |
|||
label: '金额', |
|||
field: 'amount', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
} |
|||
}, |
|||
{ |
|||
label: '在途库库位', |
|||
field: 'onTheWayLocationCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
hiddenInMain: true, |
|||
}, |
|||
{ |
|||
label: '从库位', |
|||
field: 'fromLocationCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
}, |
|||
{ |
|||
label: '从库位组', |
|||
field: 'fromLocationGroupCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
}, |
|||
{ |
|||
label: '到库位组', |
|||
field: 'toLocationGroupCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
}, |
|||
{ |
|||
label: '从库区', |
|||
field: 'fromAreaCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
}, |
|||
{ |
|||
label: '到库区', |
|||
field: 'toAreaCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
hiddenInMain: true, |
|||
}, |
|||
// {
|
|||
// label: '从器具号',
|
|||
// field: 'fromContainerNumber',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// isTable: false,
|
|||
// },
|
|||
// {
|
|||
// label: '到器具号',
|
|||
// field: 'toContainerNumber',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// isTable: false,
|
|||
// },
|
|||
{ |
|||
label: '库存状态', |
|||
field: 'inventoryStatus', |
|||
dictType: DICT_TYPE.INVENTORY_STATUS, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '从货主代码', |
|||
field: 'fromOwnerCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
}, |
|||
{ |
|||
label: '到货主代码', |
|||
field: 'toOwnerCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
}, |
|||
{ |
|||
label: '项目代码', |
|||
field: 'projectCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: false, |
|||
}, |
|||
{ |
|||
label: '接口类型', |
|||
field: 'interfaceType', |
|||
dictType: DICT_TYPE.INTERFACE_TYPE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '创建者', |
|||
field: 'creator', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: true, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isTable: true, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
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: 'updater', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable: true, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '最后更新时间', |
|||
field: 'updateTime', |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isTable: true, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
style: { width: '100%' }, |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
isForm: false |
|||
}, |
|||
// {
|
|||
// label: '任务明细ID',
|
|||
// field: 'jobDetailId',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
// {
|
|||
// label: '代码',
|
|||
// field: 'code',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
])) |
|||
|
|||
//表单校验
|
|||
export const DeliverRecordDetailRules = reactive({ |
|||
// soNumber: [
|
|||
// { required: true, message: '请选择销售订单号', trigger: 'change' }
|
|||
// ],
|
|||
packingNumber: [ |
|||
{ required: true, message: '请选择包装号', trigger: 'change' } |
|||
], |
|||
batch: [ |
|||
{ required: true, message: '请输入批次', trigger: 'blur' } |
|||
], |
|||
inventoryStatus: [ |
|||
{ required: true, message: '请选择库存状态', trigger: 'change' } |
|||
], |
|||
fromLocationCode: [ |
|||
{ required: true, message: '请选择从库位代码', trigger: 'change' } |
|||
], |
|||
fromLocationGroupCode: [ |
|||
{ required: true, message: '请选择从库位组代码', trigger: 'change' } |
|||
], |
|||
fromAreaCode: [ |
|||
{ required: true, message: '请选择从库区代码', trigger: 'change' } |
|||
], |
|||
toLocationCode: [ |
|||
{ required: true, message: '请选择到库位代码', trigger: 'change' } |
|||
], |
|||
toLocationGroupCode: [ |
|||
{ required: true, message: '请选择到库位组代码', trigger: 'change' } |
|||
], |
|||
toAreaCode: [ |
|||
{ required: true, message: '请选择到库区代码', trigger: 'change' } |
|||
], |
|||
number: [ |
|||
{ required: true, message: '请输入单据号', trigger: 'blur' } |
|||
], |
|||
itemCode: [ |
|||
{ required: true, message: '请选择品番', trigger: 'change' } |
|||
], |
|||
createTime: [ |
|||
{ required: true, message: '请输入创建时间', trigger: 'blur' } |
|||
], |
|||
creator: [ |
|||
{ required: true, message: '请输入创建者', trigger: 'blur' } |
|||
], |
|||
}) |
|||
|
|||
|
|||
export const ExtendColumn = useCrudSchemas( |
|||
reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '客户代码', |
|||
field: 'customerCode', |
|||
sort: 'custom', |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
enterSearch: true, |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择客户代码', // 输入框占位文本
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '客户信息', // 查询弹窗标题
|
|||
searchAllSchemas: Customer.allSchemas, // 查询弹窗所需类
|
|||
searchPage: CustomerApi.getCustomerPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [ |
|||
{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}, |
|||
{ |
|||
key: 'type', |
|||
value: 'DEFAULT', |
|||
isMainValue: false |
|||
} |
|||
], |
|||
verificationParams: [ |
|||
{ |
|||
key: 'code', |
|||
action: '==', |
|||
value: '', |
|||
isMainValue: false, |
|||
isSearch: true, |
|||
isFormModel: true |
|||
} |
|||
] // 失去焦点校验参数
|
|||
} |
|||
} |
|||
}, |
|||
|
|||
]) |
|||
) |
|||
|
|||
//表单校验
|
|||
export const ExtendColumnRules = reactive({ |
|||
customerCode: [ |
|||
{ required: true, message: '请选择客户代码', trigger: 'change' } |
|||
], |
|||
}) |
@ -0,0 +1,347 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="[...DeliverRecordMain.allSchemas.searchSchema,...DeliverRecordDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="DeliverRecordMain.allSchemas" |
|||
:detailAllSchemas="DeliverRecordDetail.allSchemas" |
|||
/> |
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table v-clientTable |
|||
: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,$index }"> |
|||
<ButtonBaseMore :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="basicFormRef" |
|||
:rules="DeliverRecordMainRules" |
|||
:formAllSchemas="DeliverRecordMain.allSchemas" |
|||
:isBusiness="true" |
|||
@submitForm="submitForm" |
|||
/> |
|||
<!-- 详情 --> |
|||
<Detail |
|||
ref="detailRef" |
|||
:isBasic="false" |
|||
:allSchemas="DeliverRecordMain.allSchemas" |
|||
:detailAllSchemas="DeliverRecordDetail.allSchemas" |
|||
:detailAllSchemasRules="DeliverRecordDetailRules" |
|||
:apiPage="DeliverRecordDetailApi.getDeliverRecordDetailPage" |
|||
/> |
|||
<!-- 导入 --> |
|||
<ImportFormOnlyAdd |
|||
ref="importFormRef" |
|||
:url="importUrl" |
|||
@success="importSuccess" |
|||
:isShowDownloadBtn="false" |
|||
:formSchema="ExtendColumn.allSchemas.formSchema" |
|||
:rules="ExtendColumnRules" |
|||
:extend="importExtend" |
|||
accept=".xlsx,.xls" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
/> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { getAccessToken } from '@/utils/auth' |
|||
import { DeliverRecordMain,DeliverRecordMainRules,DeliverRecordDetail,DeliverRecordDetailRules, ExtendColumn, ExtendColumnRules } from './deliverRecordMain.data' |
|||
import * as DeliverRecordMainApi from '@/api/wms/deliverRecordMain' |
|||
import * as DeliverRecordDetailApi from '@/api/wms/deliverRecordDetail' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|||
import { getJmreportBaseUrl } from '@/utils/systemParam' |
|||
import { formatDate } from '@/utils/formatTime' |
|||
import { usePageLoading } from '@/hooks/web/usePageLoading' |
|||
|
|||
const { loadStart, loadDone } = usePageLoading() |
|||
// 发货记录主 |
|||
defineOptions({ name: 'DeliverPda' }) |
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const businessType = ref() |
|||
const importFileName = ref() |
|||
const importUrl = ref('') |
|||
const importExtend = ref('') |
|||
|
|||
console.log(99 , routeName.value) |
|||
const tableColumns = ref([...DeliverRecordMain.allSchemas.tableColumns,...DeliverRecordDetail.allSchemas.tableMainColumns]) |
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: DeliverRecordDetailApi.getDeliverRecordDetailPage // 分页接口 |
|||
}) |
|||
|
|||
importUrl.value = '/wms/deliver-record-main/import-customer-pda-shipment' |
|||
// 判断 路由名称 进行条件过滤 |
|||
if (routeName.value == 'ToyotaSupplies') { |
|||
tableObject.params = { |
|||
businessType: 'ToyotaSupplies' |
|||
} |
|||
businessType.value = 'ToyotaSupplies' |
|||
importFileName.value = '丰田补给品发货记录' |
|||
importExtend.value = 'ToyotaSupplies' |
|||
} else if (routeName.value == 'SSProduct') { |
|||
tableObject.params = { |
|||
businessType: 'SSProduct' |
|||
} |
|||
businessType.value = 'SSProduct' |
|||
importFileName.value = 'SS品发货记录' |
|||
importExtend.value = 'SSProduct' |
|||
} else if (routeName.value == 'SkylightCarpet') { |
|||
tableObject.params = { |
|||
businessType: 'SkylightCarpet' |
|||
} |
|||
businessType.value = 'SkylightCarpet' |
|||
importFileName.value = '天井地毯发货记录' |
|||
importExtend.value = 'SkylightCarpet' |
|||
} else if (routeName.value == 'DeliverPda') { |
|||
tableObject.params = { |
|||
businessType: 'DeliverPda' |
|||
} |
|||
businessType.value = 'DeliverPda' |
|||
importFileName.value = '客户PDA发货记录' |
|||
importExtend.value = 'DeliverPda' |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultImportBtn({hasPermi:`wms:${routeName.value}:import`}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'export') { // 导出 |
|||
handleExport() |
|||
} 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 if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮 |
|||
const butttondata = (row,$index) => { |
|||
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
|||
if(findIndex>-1&&findIndex<$index){ |
|||
return [] |
|||
}else{ |
|||
return [ |
|||
// defaultButtons.mainListDocumentPrintBtn(null),// 标签打印 |
|||
defaultButtons.mainListEditBtn(null), // 编辑 |
|||
] |
|||
} |
|||
} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} |
|||
} |
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const tableData = ref([]) |
|||
const openForm = (type: string, row?: any) => { |
|||
tableData.value = [] |
|||
DeliverRecordMain.allSchemas.formSchema.forEach(item=>{ |
|||
if (item.field == 'businessType'){ |
|||
item.componentProps.options = item.componentProps.options.filter(cur=>cur.value == 'SSProduct'||cur.value == 'ToyotaSupplies'||cur.value == 'SkylightCarpet'||cur.value == 'DeliverPda') |
|||
} |
|||
}) |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
// 获取部门 用于详情 部门回显 |
|||
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,'recordDeliverMain') |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
loadStart() |
|||
const excelTitle = ref(route.meta.title) |
|||
const data = await DeliverRecordMainApi.exportDeliverRecordMain(tableObject.params) |
|||
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|||
} catch { |
|||
} finally { |
|||
loadDone() |
|||
} |
|||
} |
|||
|
|||
const BASE_URL = getJmreportBaseUrl() |
|||
const src = ref(BASE_URL + '/jmreport/view/929209659733770240?token=' + getAccessToken()) |
|||
|
|||
// 标签打印 |
|||
const handlePoint = async (row) => { |
|||
window.open(src.value+'&id='+row.masterId) |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params.isSearch = true |
|||
console.log('searchData',searchData.filters); |
|||
if(!searchData.filters){//重置的时候应用 |
|||
searchData.filters = [] |
|||
} |
|||
let filters = [...searchData.filters] |
|||
if (routeName.value == 'ToyotaSupplies') { |
|||
if(!filters.find(item=>item.column=='business_type')){ |
|||
filters = [...filters,{ |
|||
action:'==', |
|||
column:'business_type', |
|||
value:'ToyotaSupplies', |
|||
}] |
|||
} |
|||
} else if (routeName.value == 'SSProduct') { |
|||
if(!filters.find(item=>item.column=='business_type')){ |
|||
filters = [...filters,{ |
|||
action:'==', |
|||
column:'business_type', |
|||
value:'SSProduct', |
|||
}] |
|||
} |
|||
} else if (routeName.value == 'SkylightCarpet') { |
|||
if(!filters.find(item=>item.column=='business_type')){ |
|||
filters = [...filters,{ |
|||
action:'==', |
|||
column:'business_type', |
|||
value:'SkylightCarpet', |
|||
}] |
|||
} |
|||
} else if (routeName.value == 'DeliverPda') { |
|||
if(!filters.find(item=>item.column=='business_type')){ |
|||
filters = [...filters,{ |
|||
action:'==', |
|||
column:'business_type', |
|||
value:'DeliverPda', |
|||
}] |
|||
} |
|||
} |
|||
tableObject.params.filters = filters |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
|
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|||
if(formField == 'customerCode'){ |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
} |
|||
} |
|||
// 主子数据 提交 |
|||
const submitForm = async (formType, submitData) => { |
|||
let data = {...submitData} |
|||
if(data.masterId){ |
|||
data.id = data.masterId |
|||
} |
|||
|
|||
try { |
|||
if (formType === 'create') { |
|||
await DeliverRecordMainApi.createDeliverRecordMain(data) |
|||
message.success(t('common.createSuccess')) |
|||
getList() |
|||
} else { |
|||
await DeliverRecordMainApi.updateDeliverRecordMain(data) |
|||
await DeliverRecordDetailApi.updateDeliverRecordDetailAll(data) |
|||
message.success(t('common.updateSuccess')) |
|||
basicFormRef.value.dialogVisible = false |
|||
buttonBaseClick('refresh',null) |
|||
} |
|||
|
|||
} finally { |
|||
basicFormRef.value.formLoading = false |
|||
} |
|||
} |
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
if (routeName.value == 'ToyotaSupplies') { |
|||
tableObject.params.businessType = 'ToyotaSupplies' |
|||
} else if (routeName.value == 'SSProduct') { |
|||
tableObject.params.businessType = 'SSProduct' |
|||
} else if (routeName.value == 'SkylightCarpet') { |
|||
tableObject.params.businessType = 'SkylightCarpet' |
|||
} else if (routeName.value == 'DeliverPda') { |
|||
tableObject.params.businessType = 'DeliverPda' |
|||
} |
|||
getList() |
|||
}) |
|||
onActivated(() => { |
|||
if (routeName.value == 'ToyotaSupplies') { |
|||
tableObject.params.businessType = 'ToyotaSupplies' |
|||
} else if (routeName.value == 'SSProduct') { |
|||
tableObject.params.businessType = 'SSProduct' |
|||
} else if (routeName.value == 'SkylightCarpet') { |
|||
tableObject.params.businessType = 'SkylightCarpet' |
|||
} else if (routeName.value == 'DeliverPda') { |
|||
tableObject.params.businessType = 'DeliverPda' |
|||
} |
|||
getList() |
|||
}) |
|||
</script> |
Loading…
Reference in new issue