gaojs
3 months ago
16 changed files with 3586 additions and 55 deletions
@ -0,0 +1,182 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="[...UnplannedreceiptRecordMain.allSchemas.searchSchema,...UnplannedreceiptRecordDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="UnplannedreceiptRecordMain.allSchemas" |
|||
:detailAllSchemas="UnplannedreceiptRecordDetail.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 }"> |
|||
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="formRef" |
|||
@success="getList" |
|||
:rules="UnplannedreceiptRecordMainRules" |
|||
:formAllSchemas="UnplannedreceiptRecordMain.allSchemas" |
|||
:tableAllSchemas="UnplannedreceiptRecordDetail.allSchemas" |
|||
:tableFormRules="UnplannedreceiptRecordDetailRules" |
|||
:isBusiness="true" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail |
|||
ref="detailRef" |
|||
:isBasic="false" |
|||
:allSchemas="UnplannedreceiptRecordMain.allSchemas" |
|||
:detailAllSchemas="UnplannedreceiptRecordDetail.allSchemas" |
|||
:detailAllSchemasRules="UnplannedreceiptRecordDetailRules" |
|||
:apiPage="UnplannedreceiptRecordDetailApi.getUnplannedreceiptRecordDetailPageSpare" |
|||
/> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { UnplannedreceiptRecordMain,UnplannedreceiptRecordMainRules,UnplannedreceiptRecordDetail,UnplannedreceiptRecordDetailRules } from './sparepartReturnRecordMain.data' |
|||
import * as UnplannedreceiptRecordMainApi from '@/api/wms/unplannedreceiptRecordMain' |
|||
import * as UnplannedreceiptRecordDetailApi from '@/api/wms/unplannedreceiptRecordDetail' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|||
import { formatDate } from '@/utils/formatTime' |
|||
// 调拨入库记录主 |
|||
defineOptions({ name: 'UnplannedreceiptRecordMain' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref([...UnplannedreceiptRecordMain.allSchemas.tableColumns,...UnplannedreceiptRecordDetail.allSchemas.tableMainColumns]) |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: UnplannedreceiptRecordDetailApi.getUnplannedreceiptRecordDetailPageSpare // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultExportBtn({hasPermi:'wms:unplannedreceipt-record-main:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
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 { // 其他按钮 |
|||
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 [] |
|||
} |
|||
return [] |
|||
} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, 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,'recordUnplannedreceiptMain') |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const excelTitle = ref(route.meta.title) |
|||
tableObject.params.detailDataType = 2 |
|||
const data = await UnplannedreceiptRecordMainApi.exportUnplannedreceiptRecordMain(tableObject.params) |
|||
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
}) |
|||
</script> |
@ -0,0 +1,879 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime' |
|||
import { TableColumn } from '@/types/table' |
|||
|
|||
|
|||
import { QadCostcentre } from '@/views/wms/basicDataManage/subject/qadCostcentre/qadCostcentre.data' |
|||
import * as QadCostcentreApi from '@/api/wms/qadCostcentre/index' |
|||
|
|||
import { QadProject } from '@/views/wms/basicDataManage/subject/qadProject/qadProject.data' |
|||
import * as QadProjectApi from '@/api/wms/qadProject' |
|||
|
|||
import * as SubjectAccountApi from '@/api/wms/subjectAccount' |
|||
import { SubjectAccount } from '@/views/wms/basicDataManage/subject/subjectAccount/subjectAccount.data' |
|||
|
|||
/** |
|||
* @returns {Array} 计划外入库记录主表 |
|||
*/ |
|||
export const UnplannedreceiptRecordMain = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '单据号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180, |
|||
fixed: 'left' |
|||
}, |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '申请单号', |
|||
field: 'requestNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '任务单号', |
|||
field: 'jobNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '申请时间', |
|||
field: 'requestTime', |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x', |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '截止时间', |
|||
field: 'dueTime', |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x', |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '执行时间', |
|||
field: 'executeTime', |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x', |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '生效日期', |
|||
field: 'activeDate', |
|||
formatter: dateFormatter2, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
style: {width: '100%'}, |
|||
type: 'date', |
|||
dateFormat: 'YYYY-MM-DD', |
|||
valueFormat: 'x', |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '成本中心代码', |
|||
field: 'costCenterCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
tableForm: { |
|||
isInpuFocusShow: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择成本中心代码', |
|||
searchField: 'costcentreCode', |
|||
searchTitle: '成本中心代码', |
|||
searchAllSchemas: QadCostcentre.allSchemas, |
|||
searchPage: QadCostcentreApi.getQadCostcentrePage |
|||
}, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择成本中心代码', // 输入框占位文本
|
|||
searchField: 'costcentreCode', // 查询弹窗赋值字段
|
|||
searchTitle: '成本中心代码', // 查询弹窗标题
|
|||
searchAllSchemas: QadCostcentre.allSchemas, // 查询弹窗所需类
|
|||
searchPage: QadCostcentreApi.getQadCostcentrePage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '成本中心类型', |
|||
field: 'costCenterType', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
componentProps: { |
|||
disabled: true |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '领用原因代码', |
|||
field: 'reasonCodeRequisition', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
tableForm: { |
|||
isInpuFocusShow: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择成领用原因代码', |
|||
searchField: 'code', |
|||
searchTitle: '领用原因代码', |
|||
searchAllSchemas: SubjectAccount.allSchemas, |
|||
searchPage: SubjectAccountApi.getSubjectAccountPage, |
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
},{ |
|||
key: 'costcentreType', |
|||
value: 'costCenterType', |
|||
message: '成本中心类型不能为空!', |
|||
isMainValue: true |
|||
}] |
|||
}, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择成本中心代码', // 输入框占位文本
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '领用原因代码', // 查询弹窗标题
|
|||
searchAllSchemas: SubjectAccount.allSchemas, // 查询弹窗所需类
|
|||
searchPage: SubjectAccountApi.getSubjectAccountPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
},{ |
|||
key: 'costcentreType', |
|||
value: 'costCenterType', |
|||
message: '成本中心类型不能为空!', |
|||
isMainValue: true |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '项目代码', |
|||
field: 'projectCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
tableForm: { |
|||
isInpuFocusShow: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择QAD项目信息', |
|||
searchField: 'projectCode', |
|||
searchTitle: '领用原因代码', |
|||
searchAllSchemas: QadProject.allSchemas, |
|||
searchPage: QadProjectApi.getQadProjectPage |
|||
}, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '请选择QAD项目信息', // 输入框占位文本
|
|||
searchField: 'projectCode', // 查询弹窗赋值字段
|
|||
searchTitle: '领用原因代码', // 查询弹窗标题
|
|||
searchAllSchemas: QadProject.allSchemas, // 查询弹窗所需类
|
|||
searchPage: QadProjectApi.getQadProjectPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '工作中心', |
|||
field: 'workCenter', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '到仓库代码', |
|||
field: 'toWarehouseCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '到库区类型范围', |
|||
field: 'toAreaTypes', |
|||
dictType: DICT_TYPE.AREA_TYPE, |
|||
dictClass: 'string', |
|||
isTable: true, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
// {
|
|||
// label: '到库区代码范围',
|
|||
// field: 'toAreaCodes',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
{ |
|||
label: '领用代码', |
|||
field: 'usageCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isForm: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '领用描述', |
|||
field: 'usageDescription', |
|||
sort: 'custom', |
|||
isTable:false, |
|||
isForm:false, |
|||
isTableForm:false, |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '出库事务类型', |
|||
field: 'outTransactionType', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '入库事务类型', |
|||
field: 'inTransactionType', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '业务类型', |
|||
field: 'businessType', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '部门', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '接口类型', |
|||
field: 'interfaceType', |
|||
dictType: DICT_TYPE.INTERFACE_TYPE, |
|||
dictClass: 'string', |
|||
isTable: true, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remarkMain', |
|||
isTable:false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
formatter: dateFormatter, |
|||
isTable:false, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
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: 'creator', |
|||
sort: 'custom', |
|||
isTable:false, |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '最后更新时间', |
|||
field: 'updateTime', |
|||
sort: 'custom', |
|||
isDetail: true, |
|||
isForm: false, |
|||
isTable: false, |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
style: {width:'100%'}, |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x', |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '最后更新者', |
|||
field: 'updater', |
|||
isDetail: true, |
|||
isForm: false, |
|||
isTable: false, |
|||
table: { |
|||
width: 150 |
|||
} |
|||
}, |
|||
// {
|
|||
// 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' |
|||
} |
|||
} |
|||
}, |
|||
])) |
|||
|
|||
//表单校验
|
|||
export const UnplannedreceiptRecordMainRules = reactive({ |
|||
requestNumber: [ |
|||
{ required: true, message: '请选择申请单号', trigger: 'change' } |
|||
], |
|||
toWarehouseCode: [ |
|||
{ required: true, message: '请选择到仓库代码', trigger: 'change' } |
|||
], |
|||
toAreaTypes: [ |
|||
{ required: true, message: '请选择到库区类型范围', trigger: 'change' } |
|||
], |
|||
toAreaCodes: [ |
|||
{ required: true, message: '请选择到库区代码范围', trigger: 'change' } |
|||
], |
|||
outTransaction: [ |
|||
{ required: true, message: '请输入出库事务类型', trigger: 'blur' } |
|||
], |
|||
inTransaction: [ |
|||
{ required: true, message: '请输入入库事务类型', trigger: 'blur' } |
|||
], |
|||
executeTime: [ |
|||
{ required: true, message: '请输入执行时间', trigger: 'change' } |
|||
], |
|||
activeDate: [ |
|||
{ required: true, message: '请输入生效日期', trigger: 'change' } |
|||
], |
|||
available: [ |
|||
{ required: true, message: '请输入是否可用', trigger: 'blur' } |
|||
], |
|||
departmentCode: [ |
|||
{ required: true, message: '请输入部门', trigger: 'blur' } |
|||
], |
|||
interfaceType: [ |
|||
{ required: true, message: '请选择接口类型', trigger: 'change' } |
|||
], |
|||
number: [ |
|||
{ required: true, message: '请输入单据号', trigger: 'blur' } |
|||
], |
|||
businessType: [ |
|||
{ required: true, message: '请输入业务类型', trigger: 'blur' } |
|||
], |
|||
createTime: [ |
|||
{ required: true, message: '请输入创建时间', trigger: 'blur' } |
|||
], |
|||
creator: [ |
|||
{ required: true, message: '请输入创建者', trigger: 'blur' } |
|||
], |
|||
}) |
|||
|
|||
/** |
|||
* @returns {Array} 计划外入库记录子表 |
|||
*/ |
|||
export const UnplannedreceiptRecordDetail = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '单据号', |
|||
field: 'number', |
|||
sort: 'custom', |
|||
hiddenInMain:true, |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '物料代码', |
|||
field: 'itemCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '物料名称', |
|||
field: 'itemName', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '物料描述1', |
|||
field: 'itemDesc1', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '物料描述2', |
|||
field: 'itemDesc2', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '批次', |
|||
field: 'batch', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '包装号', |
|||
field: 'packingNumber', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
// {
|
|||
// label: '器具号',
|
|||
// field: 'containerNumber',
|
|||
// isTable:false,
|
|||
// isForm:false,
|
|||
// isTableForm: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 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '单价', |
|||
field: 'singlePrice', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'InputNumber', |
|||
} |
|||
}, |
|||
{ |
|||
label: '金额', |
|||
field: 'amount', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
component: 'InputNumber', |
|||
} |
|||
}, |
|||
{ |
|||
label: '到库位代码', |
|||
field: 'toLocationCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '库存状态', |
|||
field: 'inventoryStatus', |
|||
dictType: DICT_TYPE.INVENTORY_STATUS, |
|||
dictClass: 'string', |
|||
isTable: true, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '到货日期', |
|||
field: 'arriveDate', |
|||
formatter: dateFormatter2, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
style: {width: '100%'}, |
|||
type: 'date', |
|||
dateFormat: 'YYYY-MM-DD', |
|||
valueFormat: 'x', |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '生产日期', |
|||
field: 'produceDate', |
|||
formatter: dateFormatter2, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
style: {width: '100%'}, |
|||
type: 'date', |
|||
dateFormat: 'YYYY-MM-DD', |
|||
valueFormat: 'x', |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '过期日期', |
|||
field: 'expireDate', |
|||
formatter: dateFormatter2, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
style: {width: '100%'}, |
|||
type: 'date', |
|||
dateFormat: 'YYYY-MM-DD', |
|||
valueFormat: 'x', |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '到库位组代码', |
|||
field: 'toLocationGroupCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '到库区代码', |
|||
field: 'toAreaCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '成本中心代码', |
|||
field: 'costcentreCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '科目代码', |
|||
field: 'qadProjectCode', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '原因', |
|||
field: 'reason', |
|||
dictType: DICT_TYPE.UNPLANNED_RECEIPT_REASON, |
|||
dictClass: 'string', |
|||
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { |
|||
return cellValue |
|||
}, |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
form: { |
|||
componentProps: { |
|||
filterable: true |
|||
} |
|||
}, |
|||
tableForm: { |
|||
type: 'Select', |
|||
filterable: true |
|||
} |
|||
}, |
|||
{ |
|||
label: '货主代码', |
|||
field: 'ownerCode', |
|||
sort: 'custom', |
|||
isTable:false, |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '项目代码', |
|||
field: 'projectCode', |
|||
sort: 'custom', |
|||
isTable:false, |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '接口类型', |
|||
field: 'interfaceType', |
|||
dictType: DICT_TYPE.INTERFACE_TYPE, |
|||
dictClass: 'string', |
|||
isTable: false, |
|||
isForm:false, |
|||
isTableForm:false, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
// {
|
|||
// label: '任务明细ID',
|
|||
// field: 'jobDetailId',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
formatter: dateFormatter, |
|||
detail: { |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
|||
}, |
|||
sort: 'custom', |
|||
table: { |
|||
width: 180 |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
valueFormat: 'x', |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '创建者', |
|||
field: 'creator', |
|||
sort: 'custom', |
|||
table: { |
|||
width: 150 |
|||
}, |
|||
}, |
|||
// {
|
|||
// label: '代码',
|
|||
// field: 'code',
|
|||
// sort: 'custom',
|
|||
// table: {
|
|||
// width: 150
|
|||
// },
|
|||
// },
|
|||
])) |
|||
|
|||
//表单校验
|
|||
export const UnplannedreceiptRecordDetailRules = reactive({ |
|||
packingNumber: [ |
|||
{ required: true, message: '请选择包装号', trigger: 'change' } |
|||
], |
|||
batch: [ |
|||
{ required: true, message: '请输入批次', trigger: 'blur' } |
|||
], |
|||
inventoryStatus: [ |
|||
{ required: true, message: '请选择库存状态', trigger: 'change' } |
|||
], |
|||
toLocationCode: [ |
|||
{ required: true, message: '请选择到库位代码', trigger: 'change' } |
|||
], |
|||
toLocationGroupCode: [ |
|||
{ required: true, message: '请选择到库位组代码', trigger: 'change' } |
|||
], |
|||
toAreaCode: [ |
|||
{ required: true, message: '请选择到库区代码', trigger: 'change' } |
|||
], |
|||
arriveDate: [ |
|||
{ required: true, message: '请输入到货日期', trigger: 'change' } |
|||
], |
|||
produceDate: [ |
|||
{ required: true, message: '请选择生产日期', trigger: 'change' } |
|||
], |
|||
expireDate: [ |
|||
{ required: true, message: '请选择过期日期', trigger: 'change' } |
|||
] |
|||
}) |
@ -0,0 +1,696 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="[...UnplannedreceiptRequestMain.allSchemas.searchSchema,...UnplannedreceiptRequestDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="UnplannedreceiptRequestMain.allSchemas" |
|||
:detailAllSchemas="UnplannedreceiptRequestDetail.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 }"> |
|||
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicForm |
|||
ref="formRef" |
|||
:isOpenSearchTable="true" |
|||
fieldTableColumn="itemCode" |
|||
@success="getList" |
|||
:rules="UnplannedreceiptRequestMainRules" |
|||
:formAllSchemas="UnplannedreceiptRequestMain.allSchemas" |
|||
:tableAllSchemas="UnplannedreceiptRequestDetail.allSchemas" |
|||
:tableFormRules="UnplannedreceiptRequestDetailRules" |
|||
:tableData="tableData" |
|||
:apiUpdate="UnplannedreceiptRequestMainApi.updateUnplannedreceiptRequestMain" |
|||
:apiCreate="UnplannedreceiptRequestMainApi.createUnplannedreceiptRequestMain" |
|||
:isBusiness="true" |
|||
@handleAddTable="handleAddTable" |
|||
@handleDeleteTable="handleDeleteTable" |
|||
:isShowReduceButtonSelection="true" |
|||
@tableSelectionDelete="tableSelectionDelete" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
@submitForm="submitForm" |
|||
@inputNumberChange="inputNumberChange" |
|||
@tableFormSelectOnBlur="tableFormSelectOnBlur"> |
|||
<template v-slot="{row}"> |
|||
<el-date-picker v-bind:modelValue="row['validityDays']?addDay(row['produceDate'],row['validityDays']):''" format="YYYY-MM-DD" |
|||
:clearable="true" |
|||
style="width: 100%" |
|||
:disabled="true" |
|||
:placeholder="t('ts.选择日期')"/> |
|||
</template> |
|||
</BasicForm> |
|||
|
|||
<!-- 详情 --> |
|||
<!-- :apiCreate="UnplannedreceiptRequestDetailApi.createUnplannedreceiptRequestDetail" --> |
|||
<!-- :apiUpdate="UnplannedreceiptRequestDetailApi.updateUnplannedreceiptRequestDetail" --> |
|||
<Detail |
|||
ref="detailRef" |
|||
:isBasic="false" |
|||
:allSchemas="UnplannedreceiptRequestMain.allSchemas" |
|||
:detailAllSchemas="UnplannedreceiptRequestDetail.allSchemas" |
|||
:detailAllSchemasRules="UnplannedreceiptRequestDetailRules" |
|||
:apiCreate="UnplannedreceiptRequestDetailApi.createUnplannedreceiptRequestDetail" |
|||
:apiUpdate="UnplannedreceiptRequestDetailApi.updateUnplannedreceiptRequestDetail" |
|||
:apiPage="UnplannedreceiptRequestDetailApi.getUnplannedreceiptRequestDetailPageSpare" |
|||
:apiDelete="UnplannedreceiptRequestDetailApi.deleteUnplannedreceiptRequestDetail" |
|||
:Echo="Echo" |
|||
@searchTableSuccessDetail="searchTableSuccessDetail" |
|||
:detailValidate="detailValidate" |
|||
@onBlur="onBlur" |
|||
/> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/wms/unplannedreceipt-request-main/import" :importTemplateData="importTemplateData" |
|||
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import dayjs from 'dayjs' |
|||
import { addDay } from '@/utils/formatTime' |
|||
import download from '@/utils/download' |
|||
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|||
import { |
|||
UnplannedreceiptRequestMain, |
|||
UnplannedreceiptRequestMainRules, |
|||
UnplannedreceiptRequestDetail, |
|||
UnplannedreceiptRequestDetailRules, UnplannedreceiptRequestDetailLabel |
|||
} from './sparepartReturnRequestMain.data' |
|||
import * as UnplannedreceiptRequestMainApi from '@/api/wms/unplannedreceiptRequestMain' |
|||
import * as UnplannedreceiptRequestDetailApi from '@/api/wms/unplannedreceiptRequestDetail' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import * as ItembasicApi from "@/api/wms/itembasic"; |
|||
import { formatTime } from '@/utils/index' |
|||
import { formatDate } from '@/utils/formatTime' |
|||
import {handleSparepartReturnRequestMain} from "@/api/wms/unplannedreceiptRequestMain"; |
|||
|
|||
// 计划外入库申请 |
|||
defineOptions({ name: 'UnplannedreceiptRequestMain' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref([...UnplannedreceiptRequestMain.allSchemas.tableColumns,...UnplannedreceiptRequestDetail.allSchemas.tableMainColumns]) |
|||
|
|||
const { tableObject: detatableData, tableMethods: detatableMethods } =useTable({ |
|||
getListApi: UnplannedreceiptRequestDetailApi.getUnplannedreceiptRequestDetailPageCreateLabel |
|||
}) |
|||
const { getList:getDetailList } = detatableMethods |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|||
nextTick(async () => { |
|||
console.log('searchTableSuccess',formField, searchField, val, formRef, type, row ) |
|||
if (type == 'tableForm') { |
|||
// 明细查询页赋值 |
|||
if(formField == 'toLocationCode'){ |
|||
row['toLocationCode'] = val[0]['code'] |
|||
} else if(formField == 'itemCode'){ |
|||
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['itemCode']==item['code'])) |
|||
if(itemCodes.length>0){ |
|||
itemCodes = itemCodes.map(item=>(item['code'])) |
|||
message.warning(`物料${itemCodes.join(',')}已经存在`) |
|||
} |
|||
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode'])) |
|||
if(val.length==0){ |
|||
return |
|||
} |
|||
const enableBuy = val[0]['enableBuy'] |
|||
let newVal = val.filter(item=>item.enableBuy==enableBuy) |
|||
if(newVal.length<val.length){ |
|||
message.warning('不能同时选择可制造和可采购的物料') |
|||
} |
|||
newVal = newVal.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['code'])) |
|||
newVal.forEach(item=>{ |
|||
let tfk = JSON.parse(JSON.stringify(tableFormKeys)) |
|||
tfk.batch = formatTime(new Date(), 'yyyyMMdd') |
|||
//生产日期 到货日期 默认当天 |
|||
tfk['produceDate'] = dayjs().valueOf() |
|||
tfk['arriveDate'] = dayjs().valueOf() |
|||
tfk['itemCode'] = item['code'] |
|||
tfk['uom'] = item['uom'] |
|||
tfk['validityDays'] = item['validityDays'] |
|||
tableData.value.push(tfk) |
|||
}) |
|||
} else if(formField === 'costcentreCode'){ |
|||
row['costcentreCode'] = val[0]['costcentreCode'] |
|||
} else if(formField === 'qadProjectCode'){ |
|||
row['qadProjectCode'] = val[0]['projectCode'] |
|||
}else { |
|||
row[formField] = val[0][searchField] |
|||
} |
|||
} else { |
|||
const setV = {} |
|||
if(formField === 'usageDescription'){ |
|||
setV['usageDescription'] = val[0]['usageDescription'] |
|||
setV['usageCode'] = val[0]['code'] |
|||
} |
|||
if(formField === 'costCenterCode'){ |
|||
setV['costcentreCode'] = val[0]['costcentreCode'] |
|||
setV['costCenterType'] = val[0]['costcentreType'] |
|||
} |
|||
if(formField === 'reasonCodeRequisition'){ |
|||
setV['reasonCodeRequisition'] = val[0]['code'] |
|||
} |
|||
if(formField === 'projectCode'){ |
|||
setV['projectCode'] = val[0]['projectCode'] |
|||
} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
} |
|||
}) |
|||
} |
|||
const handleDetailSubmitForm = async (formType, data) => { |
|||
let mydata = {...data} |
|||
mydata['expireDate'] = data['expireDate'].valueOf() |
|||
if (formType === 'create') { |
|||
await UnplannedreceiptRequestDetailApi.createUnplannedreceiptRequestDetail(data) |
|||
message.success(t('common.createSuccess')) |
|||
|
|||
} else { |
|||
await UnplannedreceiptRequestDetailApi.updateUnplannedreceiptRequestDetail(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
detailRef.value.submitUpdateList() |
|||
|
|||
} |
|||
// 查询页面返回——详情 |
|||
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
if(formField == 'toLocationCode'){ |
|||
setV['toLocationCode'] = val[0]['code'] |
|||
} |
|||
if(formField == 'itemCode'){ |
|||
setV['itemCode'] = val[0]['code'] |
|||
setV['uom'] = val[0]['uom'] |
|||
setV['validityDays'] = val[0]['validityDays'] |
|||
setV['expireDate'] = val[0]['validityDays']?addDay(val[0]['produceDate'],val[0]['validityDays']).valueOf():'' |
|||
setV['batch'] = formatTime(new Date(), 'yyyyMMdd') //生产日期 到货日期 默认当天 |
|||
setV['produceDate'] = dayjs().valueOf() |
|||
setV['arriveDate'] = dayjs().valueOf() |
|||
|
|||
} |
|||
if(formField === 'costcentreCode'){ |
|||
setV['costcentreCode'] = val[0]['costcentreCode'] |
|||
} |
|||
if(formField === 'qadProjectCode'){ |
|||
setV['qadProjectCode'] = val[0]['projectCode'] |
|||
} |
|||
formRef.setValues(setV) |
|||
}) |
|||
} |
|||
|
|||
const Echo = [] |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: UnplannedreceiptRequestDetailApi.getUnplannedreceiptRequestDetailPageSpare // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'wms:unplannedreceipt-request-main:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'wms:unplannedreceipt-request-main:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'wms:unplannedreceipt-request-main:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
// { |
|||
// label: '自定义扩展按钮', |
|||
// name: 'zdy', |
|||
// hide: false, |
|||
// type: 'primary', |
|||
// icon: 'Select', |
|||
// color: '' |
|||
// }, |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} 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() |
|||
} |
|||
} 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) => { |
|||
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
|||
if(findIndex>-1&&findIndex<$index){ |
|||
return [] |
|||
} |
|||
return [ |
|||
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3','4','6']),hasPermi:'wms:unplannedreceipt-request-main:close'}), // 关闭 |
|||
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['5']),hasPermi:'wms:unplannedreceipt-request-main:reAdd'}), // 重新添加 |
|||
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:unplannedreceipt-request-main:submit'}), // 提交审批 |
|||
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:unplannedreceipt-request-main:refused'}), // 驳回 |
|||
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:unplannedreceipt-request-main:agree'}), // 审批通过 |
|||
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:unplannedreceipt-request-main:handle'}), // 处理 |
|||
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:unplannedreceipt-request-main:update'}), // 编辑 |
|||
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:unplannedreceipt-request-main:delete'}), // 删除 |
|||
] |
|||
} |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
console.log("val",val) |
|||
if (val == 'mainClose') { // 关闭 |
|||
console.log('列表-操作按钮事件-关闭') |
|||
handleClose(row.masterId) |
|||
} else if (val == 'mainReAdd') { // 重新添加 |
|||
console.log('列表-操作按钮事件-重新添加') |
|||
handleReAdd(row.masterId) |
|||
} else if (val == 'mainSubmit') { // 提交审批 |
|||
console.log('列表-操作按钮事件-提交审批') |
|||
handleSubmit(row.masterId) |
|||
} else if (val == 'mainTurnDown') { // 驳回 |
|||
console.log('列表-操作按钮事件-驳回') |
|||
handleRefused(row.masterId) |
|||
} else if (val == 'mainApprove') { // 审批通过 |
|||
console.log('列表-操作按钮事件-审批通过') |
|||
handleAgree(row.masterId) |
|||
} else if (val == 'mainHandle') { // 处理 |
|||
console.log('列表-操作按钮事件-处理') |
|||
handleHandle(row.masterId) |
|||
} else if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.masterId) |
|||
} |
|||
} |
|||
|
|||
/** 关闭按钮操作 */ |
|||
const handleClose = async (id: number) => { |
|||
await message.confirm(t('common.confirmColse')) |
|||
tableObject.loading = true |
|||
try{ |
|||
await UnplannedreceiptRequestMainApi.closeUnplannedreceiptRequestMain(id) |
|||
message.success(t('common.closeSuccess')) |
|||
tableObject.loading = false |
|||
buttonBaseClick('refresh',null) |
|||
}catch{ |
|||
tableObject.loading = false |
|||
} |
|||
} |
|||
|
|||
/** 重新添加按钮操作 */ |
|||
const handleReAdd = async (id: number) => { |
|||
await message.confirm(t('common.confirmReAdd')) |
|||
tableObject.loading = true |
|||
try{ |
|||
await UnplannedreceiptRequestMainApi.reAddUnplannedreceiptRequestMain(id) |
|||
message.success(t('common.reAddSuccess')) |
|||
tableObject.loading = false |
|||
buttonBaseClick('refresh',null) |
|||
}catch{ |
|||
tableObject.loading = false |
|||
} |
|||
} |
|||
|
|||
/** 提交按钮操作 */ |
|||
const handleSubmit = async (id: number) => { |
|||
await message.confirm(t('common.confirmSubmit')) |
|||
tableObject.loading = true |
|||
try{ |
|||
await UnplannedreceiptRequestMainApi.submitUnplannedreceiptRequestMain(id) |
|||
message.success(t('common.submitSuccess')) |
|||
tableObject.loading = false |
|||
buttonBaseClick('refresh',null) |
|||
}catch{ |
|||
tableObject.loading = false |
|||
} |
|||
} |
|||
|
|||
/** 审批驳回按钮操作 */ |
|||
const handleRefused = async (id: number) => { |
|||
await message.confirm(t('common.confirmRefused')) |
|||
tableObject.loading = true |
|||
try{ |
|||
await UnplannedreceiptRequestMainApi.refusedUnplannedreceiptRequestMain(id) |
|||
message.success(t('common.refusedSuccess')) |
|||
tableObject.loading = false |
|||
buttonBaseClick('refresh',null) |
|||
}catch{ |
|||
tableObject.loading = false |
|||
} |
|||
} |
|||
|
|||
/** 审批通过按钮操作 */ |
|||
const handleAgree = async (id: number) => { |
|||
await message.confirm(t('common.confirmAgree')) |
|||
tableObject.loading = true |
|||
try{ |
|||
await UnplannedreceiptRequestMainApi.agreeUnplannedreceiptRequestMain(id) |
|||
message.success(t('common.agreeSuccess')) |
|||
tableObject.loading = false |
|||
buttonBaseClick('refresh',null) |
|||
}catch{ |
|||
tableObject.loading = false |
|||
} |
|||
} |
|||
|
|||
/** 处理按钮操作 */ |
|||
const handleHandle = async (id: number) => { |
|||
await message.confirm(t('common.confirmHandle')) |
|||
tableObject.loading = true |
|||
try { |
|||
await UnplannedreceiptRequestMainApi.handleSparepartReturnRequestMain(id) |
|||
message.success(t('common.handleSuccess')) |
|||
buttonBaseClick('refresh',null) |
|||
} finally { |
|||
tableObject.loading = false |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const formRef = ref() |
|||
const openForm =async (type: string, row?: number) => { |
|||
UnplannedreceiptRequestMain.allSchemas.formSchema.forEach((item) => { |
|||
if(type == "update"){ |
|||
if (item.field == 'costCenterCode') { |
|||
//成本中心代码 |
|||
item.componentProps.isSearchList = false |
|||
item.componentProps.disabled = true |
|||
} |
|||
if (item.field == 'reasonCodeRequisition') { |
|||
//领用原因代码 |
|||
item.componentProps.isSearchList = false |
|||
item.componentProps.disabled = true |
|||
} |
|||
if (item.field == 'toWarehouseCode') { |
|||
//到仓库代码 |
|||
item.componentProps.isSearchList = false |
|||
item.componentProps.disabled = true |
|||
} |
|||
|
|||
|
|||
}else{ |
|||
if (item.field == 'costCenterCode') { |
|||
//成本中心代码 |
|||
item.componentProps.isSearchList = true |
|||
item.componentProps.disabled = false |
|||
} |
|||
if (item.field == 'reasonCodeRequisition') { |
|||
//领用原因代码 |
|||
item.componentProps.isSearchList = true |
|||
item.componentProps.disabled = false |
|||
} |
|||
if (item.field == 'toWarehouseCode') { |
|||
//到仓库代码 |
|||
item.componentProps.isSearchList = true |
|||
item.componentProps.disabled = false |
|||
} |
|||
} |
|||
}) |
|||
|
|||
tableData.value = [] // 重置明细数据 |
|||
formRef.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,'requestUnplannedreceiptMain') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
tableObject.loading = true |
|||
// 发起删除 |
|||
await UnplannedreceiptRequestMainApi.deleteUnplannedreceiptRequestMain(id) |
|||
message.success(t('common.delSuccess')) |
|||
tableObject.loading = false |
|||
// 刷新列表 |
|||
buttonBaseClick('refresh',null) |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const excelTitle = ref(route.meta.title) |
|||
tableObject.params.detailDataType = 2 |
|||
const data = await UnplannedreceiptRequestMainApi.exportUnplannedreceiptRequestMain(tableObject.params) |
|||
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* tableForm方法 |
|||
*/ |
|||
const tableFormKeys = {} |
|||
UnplannedreceiptRequestDetail.allSchemas.tableFormColumns.forEach(item => { |
|||
tableFormKeys[item.field] = item.default ? item.default : '' |
|||
}) |
|||
const tableData = ref([]) |
|||
|
|||
// 添加明细 |
|||
const handleAddTable = () => { |
|||
let tfk = JSON.parse(JSON.stringify(tableFormKeys)) |
|||
tfk.batch = formatTime(new Date(), 'yyyyMMdd') |
|||
//生产日期 到货日期 默认当天 |
|||
tfk['produceDate'] = dayjs().valueOf() |
|||
tfk['arriveDate'] = dayjs().valueOf() |
|||
tableData.value.push(tfk) |
|||
} |
|||
// 删除明细 |
|||
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, submitData) => { |
|||
|
|||
let data = {...submitData} |
|||
if(data.masterId){ |
|||
data.id = data.masterId |
|||
} |
|||
data.subList = tableData.value // 拼接子表数据参数 |
|||
data.subList.forEach(row=>{ |
|||
row['expireDate'] = row['validityDays']?addDay(row['produceDate'],row['validityDays']).valueOf():'' |
|||
}) |
|||
try { |
|||
if (formType === 'create') { |
|||
console.log("【计划外入库子列表】",data.subList) |
|||
if(data.subList.length == 0){ |
|||
message.warning("请添加子列表数据") |
|||
return; |
|||
} |
|||
let flag = false; |
|||
data.subList.forEach((item) => { |
|||
if(item.qty == 0){ |
|||
message.warning("数量不能为0") |
|||
flag = true; |
|||
return; |
|||
} |
|||
}) |
|||
if(flag){ |
|||
return |
|||
} |
|||
data.dataType='2' |
|||
formRef.value.formLoading = true |
|||
await UnplannedreceiptRequestMainApi.createUnplannedreceiptRequestMain(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
data.dataType='2' |
|||
formRef.value.formLoading = true |
|||
await UnplannedreceiptRequestMainApi.updateUnplannedreceiptRequestMain(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
formRef.value.dialogVisible = false |
|||
// 刷新当前列表 |
|||
if (formType === 'create') { |
|||
getList() |
|||
}else{ |
|||
buttonBaseClick('refresh',null) |
|||
} |
|||
} finally { |
|||
formRef.value.formLoading = false |
|||
} |
|||
} |
|||
|
|||
// 子表新增/编辑校验 |
|||
const detailValidate = (data) => { |
|||
let tag = false; |
|||
if(data.qty <= 0){ |
|||
message.warning('数量必须大于0') |
|||
tag = false; |
|||
return tag; |
|||
}else { |
|||
tag = true; |
|||
return tag; |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
|
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: `【${route.meta.title}】导入模版.xlsx` |
|||
}) |
|||
|
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
const inputNumberChange = (field, index, row, val) => { |
|||
if(field == 'qty' || field == 'singlePrice'){ |
|||
row.amount = row.qty * row.singlePrice |
|||
} |
|||
} |
|||
|
|||
|
|||
let validityDays = 0 |
|||
const detailOpenForm = (type, row)=>{ |
|||
console.log('detailOpenForm',row) |
|||
if(type=='update'){ |
|||
//有效期 |
|||
ItembasicApi.getItembasicPage({ |
|||
code:row.itemCode |
|||
}).then((res)=>{ |
|||
res.list.forEach((item,index)=>{ |
|||
const findItem = tableData.value.find(item1=>item1['itemCode']==row['code']) |
|||
if(findItem){ |
|||
validityDays = findItem['expireTime'] |
|||
} |
|||
}) |
|||
detailRef.value.formRef.formRef.formModel.expireDate = addDay(detailRef.value.formRef.formRef.formModel.produceDate,validityDays).valueOf() |
|||
}) |
|||
}else{ |
|||
validityDays = 0 |
|||
} |
|||
|
|||
} |
|||
const qtyOnChange = (field,val) =>{ |
|||
console.log('qtyOnChange',field,val) |
|||
console.log(detailRef.value.formRef.formRef.formModel) |
|||
if(field=='produceDate'){ |
|||
if(detailRef.value.formRef.formRef.formModel.validityDays){ |
|||
detailRef.value.formRef.formRef.formModel.expireDate = addDay(detailRef.value.formRef.formRef.formModel.produceDate,detailRef.value.formRef.formRef.formModel.validityDays).valueOf() |
|||
}else{ |
|||
detailRef.value.formRef.formRef.formModel.expireDate = addDay(detailRef.value.formRef.formRef.formModel.produceDate,validityDays).valueOf() |
|||
} |
|||
} |
|||
if(field == 'qty' || field == 'singlePrice'){ |
|||
detailRef.value.formRef.formRef.formModel.amount = detailRef.value.formRef.formRef.formModel.qty * detailRef.value.formRef.formRef.formModel.singlePrice |
|||
} |
|||
} |
|||
|
|||
const onBlur = (field, e) => { |
|||
if (field == 'reason') { |
|||
detailRef.value.formRef.formRef.formModel[field] = e.target.value |
|||
} |
|||
} |
|||
|
|||
const tableFormSelectOnBlur = (field, val, row, index) => { |
|||
if (field == 'reason') { |
|||
tableData.value[index][field] = val.target.value |
|||
} |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await UnplannedreceiptRequestMainApi.importTemplate() |
|||
}) |
|||
</script> |
File diff suppressed because it is too large
Loading…
Reference in new issue