Browse Source

WMS 需求:HL-5264:仿照备件领用功能再做一个备件退库功能,备件库存凭空进入备件库,给QAD传计划外入库接口

hella_online_20240819
gaojs 3 months ago
parent
commit
12a38b82e1
  1. 23
      src/api/wms/unplannedissueRecordDetail/index.ts
  2. 38
      src/api/wms/unplannedissueRecordMain/index.ts
  3. 25
      src/api/wms/unplannedissueRequestDetail/index.ts
  4. 26
      src/api/wms/unplannedissueRequestMain/index.ts
  5. 44
      src/api/wms/unplannedreceiptRecordDetail/index.ts
  6. 41
      src/api/wms/unplannedreceiptRequestDetail/index.ts
  7. 4
      src/api/wms/unplannedreceiptRequestMain/index.ts
  8. 182
      src/views/wms/inventoryjobManage/sparepartReturn/sparepartReturnRecordMain/index.vue
  9. 879
      src/views/wms/inventoryjobManage/sparepartReturn/sparepartReturnRecordMain/sparepartReturnRecordMain.data.ts
  10. 696
      src/views/wms/inventoryjobManage/sparepartReturn/sparepartReturnRequestMain/index.vue
  11. 1677
      src/views/wms/inventoryjobManage/sparepartReturn/sparepartReturnRequestMain/sparepartReturnRequestMain.data.ts
  12. 2
      src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionRequestMain/index.vue
  13. 1
      src/views/wms/inventoryjobManage/unplannedissue/unplannedissueRecordMain/index.vue
  14. 1
      src/views/wms/inventoryjobManage/unplannedissue/unplannedissueRequestMain/index.vue
  15. 1
      src/views/wms/inventoryjobManage/unplannedreceipt/unplannedreceiptRecordMain/index.vue
  16. 1
      src/views/wms/inventoryjobManage/unplannedreceipt/unplannedreceiptRequestMain/index.vue

23
src/api/wms/unplannedissueRecordDetail/index.ts

@ -38,10 +38,15 @@ export const getUnplannedissueRecordDetailPage = async (params) => {
'action':'==', 'action':'==',
'value':'1' 'value':'1'
} }
if(!data.filters){ const cmdExists = data.filters.some(filter =>
data.filters = [] filter.column === dataTypeCondition.column &&
filter.action === dataTypeCondition.action &&
filter.value === dataTypeCondition.value
);
if (!cmdExists) {
data.filters.push(dataTypeCondition)
} }
data.filters.push(dataTypeCondition)
return await request.post({ url: '/wms/unplannedissue-record-detail/senior', data }) return await request.post({ url: '/wms/unplannedissue-record-detail/senior', data })
} else { } else {
params.detailDataType='1' params.detailDataType='1'
@ -59,7 +64,15 @@ export const getUnplannedissueRecordDetailPageSpare = async (params) => {
'action':'==', 'action':'==',
'value':'2' 'value':'2'
} }
data.filters.push(dataTypeCondition) const cmdExists = data.filters.some(filter =>
filter.column === dataTypeCondition.column &&
filter.action === dataTypeCondition.action &&
filter.value === dataTypeCondition.value
);
if (!cmdExists) {
data.filters.push(dataTypeCondition)
}
return await request.post({ url: '/wms/unplannedissue-record-detail/senior', data }) return await request.post({ url: '/wms/unplannedissue-record-detail/senior', data })
} else { } else {
params.detailDataType='2' params.detailDataType='2'
@ -95,4 +108,4 @@ export const exportUnplannedissueRecordDetail = async (params) => {
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/unplannedissue-record-detail/get-import-template' }) return request.download({ url: '/wms/unplannedissue-record-detail/get-import-template' })
} }

38
src/api/wms/unplannedissueRecordMain/index.ts

@ -24,42 +24,6 @@ export interface UnplannedissueRecordMainVO {
available: string available: string
} }
// 查询计划外出库记录主列表
export const getUnplannedissueRecordMainPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
const dataTypeCondition = {
'column':'dataType',
'action':'==',
'value':'1'
}
data.filters.push(dataTypeCondition)
return await request.post({ url: '/wms/unplannedissue-record-main/senior', data })
} else {
params.dataType='1'
return await request.get({ url: `/wms/unplannedissue-record-main/page`, params })
}
}
// 查询计划外出库记录主列表
export const getUnplannedissueRecordMainPageSpare = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
const dataTypeCondition = {
'column':'dataType',
'action':'==',
'value':'2'
}
data.filters.push(dataTypeCondition)
return await request.post({ url: '/wms/unplannedissue-record-main/senior', data })
} else {
params.dataType='2'
return await request.get({ url: `/wms/unplannedissue-record-main/page`, params })
}
}
// 查询计划外出库记录主详情 // 查询计划外出库记录主详情
export const getUnplannedissueRecordMain = async (id: number) => { export const getUnplannedissueRecordMain = async (id: number) => {
return await request.get({ url: `/wms/unplannedissue-record-main/get?id=` + id }) return await request.get({ url: `/wms/unplannedissue-record-main/get?id=` + id })
@ -94,4 +58,4 @@ export const exportUnplannedissueRecordMain = async (params) => {
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/unplannedissue-record-main/get-import-template' }) return request.download({ url: '/wms/unplannedissue-record-main/get-import-template' })
} }

25
src/api/wms/unplannedissueRequestDetail/index.ts

@ -33,10 +33,15 @@ export const getUnplannedissueRequestDetailPage = async (params) => {
'action':'==', 'action':'==',
'value':'1' 'value':'1'
} }
if(!data.filters){ const cmdExists = data.filters.some(filter =>
data.filters = []; filter.column === dataTypeCondition.column &&
filter.action === dataTypeCondition.action &&
filter.value === dataTypeCondition.value
);
if (!cmdExists) {
data.filters.push(dataTypeCondition)
} }
data.filters.push(dataTypeCondition)
return await request.post({ url: '/wms/unplannedissue-request-detail/senior', data }) return await request.post({ url: '/wms/unplannedissue-request-detail/senior', data })
} else { } else {
params.detailDataType='1' params.detailDataType='1'
@ -44,7 +49,7 @@ export const getUnplannedissueRequestDetailPage = async (params) => {
} }
} }
// 查询计划外出库申请子列表 // 查询备件领用列表
export const getUnplannedissueRequestDetailPageSpare = async (params) => { export const getUnplannedissueRequestDetailPageSpare = async (params) => {
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
@ -54,7 +59,15 @@ export const getUnplannedissueRequestDetailPageSpare = async (params) => {
'action':'==', 'action':'==',
'value':'2' 'value':'2'
} }
data.filters.push(dataTypeCondition) const cmdExists = data.filters.some(filter =>
filter.column === dataTypeCondition.column &&
filter.action === dataTypeCondition.action &&
filter.value === dataTypeCondition.value
);
if (!cmdExists) {
data.filters.push(dataTypeCondition)
}
return await request.post({ url: '/wms/unplannedissue-request-detail/senior', data }) return await request.post({ url: '/wms/unplannedissue-request-detail/senior', data })
} else { } else {
params.detailDataType='2' params.detailDataType='2'
@ -90,4 +103,4 @@ export const exportUnplannedissueRequestDetail = async (params) => {
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/unplannedissue-request-detail/get-import-template' }) return request.download({ url: '/wms/unplannedissue-request-detail/get-import-template' })
} }

26
src/api/wms/unplannedissueRequestMain/index.ts

@ -32,7 +32,15 @@ export const getUnplannedissueRequestMainPage = async (params) => {
'action':'==', 'action':'==',
'value':'1' 'value':'1'
} }
data.filters.push(dataTypeCondition) const cmdExists = data.filters.some(filter =>
filter.column === dataTypeCondition.column &&
filter.action === dataTypeCondition.action &&
filter.value === dataTypeCondition.value
);
if (!cmdExists) {
data.filters.push(dataTypeCondition)
}
return await request.post({ url: '/wms/unplannedissue-request-main/senior', data }) return await request.post({ url: '/wms/unplannedissue-request-main/senior', data })
} else { } else {
params.dataType='1' params.dataType='1'
@ -70,13 +78,13 @@ export const exportUnplannedissueRequestMain = async (params) => {
} }
} }
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/unplannedissue-request-main/get-import-template' }) return request.download({ url: '/wms/unplannedissue-request-main/get-import-template' })
} }
// 关闭-计划外出库申请 // 关闭-计划外出库申请
export const closeUnplannedissueRequestMain = async (id) => { export const closeUnplannedissueRequestMain = async (id) => {
return await request.put({ url: `/wms/unplannedissue-request-main/close?id=` + id }) return await request.put({ url: `/wms/unplannedissue-request-main/close?id=` + id })
@ -114,14 +122,22 @@ export const getUnplannedissueRequestMainPageSpare = async (params) => {
delete params.isSearch delete params.isSearch
const data = {...params} const data = {...params}
const dataTypeCondition = { const dataTypeCondition = {
'column':'dataType', 'column':'detailDataType',
'action':'==', 'action':'==',
'value':'2' 'value':'2'
} }
data.filters.push(dataTypeCondition) const cmdExists = data.filters.some(filter =>
filter.column === dataTypeCondition.column &&
filter.action === dataTypeCondition.action &&
filter.value === dataTypeCondition.value
);
if (!cmdExists) {
data.filters.push(dataTypeCondition)
}
return await request.post({ url: '/wms/unplannedissue-request-main/senior', data }) return await request.post({ url: '/wms/unplannedissue-request-main/senior', data })
} else { } else {
params.dataType='2' params.detailDataType='2'
return await request.get({ url: `/wms/unplannedissue-request-main/page`, params }) return await request.get({ url: `/wms/unplannedissue-request-main/page`, params })
} }
} }

44
src/api/wms/unplannedreceiptRecordDetail/index.ts

@ -37,8 +37,50 @@ export const getUnplannedreceiptRecordDetailPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = {...params} const data = {...params}
const dataTypeCondition = {
'column':'detailDataType',
'action':'==',
'value':'1'
}
const cmdExists = data.filters.some(filter =>
filter.column === dataTypeCondition.column &&
filter.action === dataTypeCondition.action &&
filter.value === dataTypeCondition.value
);
if (!cmdExists) {
data.filters.push(dataTypeCondition)
}
return await request.post({ url: '/wms/unplannedreceipt-record-detail/senior', data }) return await request.post({ url: '/wms/unplannedreceipt-record-detail/senior', data })
} else { } else {
params.detailDataType='1'
return await request.get({ url: `/wms/unplannedreceipt-record-detail/page`, params })
}
}
// 查询备件退库记录子列表
export const getUnplannedreceiptRecordDetailPageSpare = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
const dataTypeCondition = {
'column':'detailDataType',
'action':'==',
'value':'2'
}
const cmdExists = data.filters.some(filter =>
filter.column === dataTypeCondition.column &&
filter.action === dataTypeCondition.action &&
filter.value === dataTypeCondition.value
);
if (!cmdExists) {
data.filters.push(dataTypeCondition)
}
return await request.post({ url: '/wms/unplannedreceipt-record-detail/senior', data })
} else {
params.detailDataType='2'
return await request.get({ url: `/wms/unplannedreceipt-record-detail/page`, params }) return await request.get({ url: `/wms/unplannedreceipt-record-detail/page`, params })
} }
} }
@ -71,4 +113,4 @@ export const exportUnplannedreceiptRecordDetail = async (params) => {
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/unplannedreceipt-record-detail/get-import-template' }) return request.download({ url: '/wms/unplannedreceipt-record-detail/get-import-template' })
} }

41
src/api/wms/unplannedreceiptRequestDetail/index.ts

@ -32,8 +32,49 @@ export const getUnplannedreceiptRequestDetailPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
delete params.isSearch delete params.isSearch
const data = {...params} const data = {...params}
const dataTypeCondition = {
'column':'detailDataType',
'action':'==',
'value':'1'
}
const cmdExists = data.filters.some(filter =>
filter.column === dataTypeCondition.column &&
filter.action === dataTypeCondition.action &&
filter.value === dataTypeCondition.value
);
if (!cmdExists) {
data.filters.push(dataTypeCondition)
}
return await request.post({ url: '/wms/unplannedreceipt-request-detail/senior', data })
} else {
params.detailDataType='1'
return await request.get({ url: `/wms/unplannedreceipt-request-detail/page`, params })
}
}
// 查询维修备件退库列表
export const getUnplannedreceiptRequestDetailPageSpare = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
const dataTypeCondition = {
'column':'detailDataType',
'action':'==',
'value':'2'
}
const cmdExists = data.filters.some(filter =>
filter.column === dataTypeCondition.column &&
filter.action === dataTypeCondition.action &&
filter.value === dataTypeCondition.value
);
if (!cmdExists) {
data.filters.push(dataTypeCondition)
}
return await request.post({ url: '/wms/unplannedreceipt-request-detail/senior', data }) return await request.post({ url: '/wms/unplannedreceipt-request-detail/senior', data })
} else { } else {
params.detailDataType='2'
return await request.get({ url: `/wms/unplannedreceipt-request-detail/page`, params }) return await request.get({ url: `/wms/unplannedreceipt-request-detail/page`, params })
} }
} }

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

@ -96,3 +96,7 @@ export const agreeUnplannedreceiptRequestMain = async (id) => {
export const handleUnplannedreceiptRequestMain = async (id) => { export const handleUnplannedreceiptRequestMain = async (id) => {
return await request.put({ url: `/wms/unplannedreceipt-request-main/handle?id=` + id }) return await request.put({ url: `/wms/unplannedreceipt-request-main/handle?id=` + id })
} }
export const handleSparepartReturnRequestMain = async (id) => {
return await request.put({ url: `/wms/unplannedreceipt-request-main/handleBack?id=` + id })
}

182
src/views/wms/inventoryjobManage/sparepartReturn/sparepartReturnRecordMain/index.vue

@ -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>

879
src/views/wms/inventoryjobManage/sparepartReturn/sparepartReturnRecordMain/sparepartReturnRecordMain.data.ts

@ -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' }
]
})

696
src/views/wms/inventoryjobManage/sparepartReturn/sparepartReturnRequestMain/index.vue

@ -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>

1677
src/views/wms/inventoryjobManage/sparepartReturn/sparepartReturnRequestMain/sparepartReturnRequestMain.data.ts

File diff suppressed because it is too large

2
src/views/wms/inventoryjobManage/sparepartsrequisition/sparepartsrequisitionRequestMain/index.vue

@ -401,8 +401,8 @@ const handleExport = async () => {
await message.exportConfirm() await message.exportConfirm()
// //
exportLoading.value = true exportLoading.value = true
tableObject.params.detailDataType = 2
const excelTitle = ref(route.meta.title) const excelTitle = ref(route.meta.title)
tableObject.params.detailDataType = 2
const data = await UnplannedissueRequestMainApi.exportUnplannedissueRequestMain(tableObject.params) const data = await UnplannedissueRequestMainApi.exportUnplannedissueRequestMain(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch { } catch {

1
src/views/wms/inventoryjobManage/unplannedissue/unplannedissueRecordMain/index.vue

@ -157,6 +157,7 @@ const handleExport = async () => {
// //
exportLoading.value = true exportLoading.value = true
const excelTitle = ref(route.meta.title) const excelTitle = ref(route.meta.title)
tableObject.params.detailDataType = 1
const data = await UnplannedissueRecordMainApi.exportUnplannedissueRecordMain(tableObject.params) const data = await UnplannedissueRecordMainApi.exportUnplannedissueRecordMain(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch { } catch {

1
src/views/wms/inventoryjobManage/unplannedissue/unplannedissueRequestMain/index.vue

@ -439,6 +439,7 @@ const handleExport = async () => {
// //
exportLoading.value = true exportLoading.value = true
const excelTitle = ref(route.meta.title) const excelTitle = ref(route.meta.title)
tableObject.params.detailDataType = 1
const data = await UnplannedissueRequestMainApi.exportUnplannedissueRequestMain(tableObject.params) const data = await UnplannedissueRequestMainApi.exportUnplannedissueRequestMain(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch { } catch {

1
src/views/wms/inventoryjobManage/unplannedreceipt/unplannedreceiptRecordMain/index.vue

@ -157,6 +157,7 @@ const handleExport = async () => {
// //
exportLoading.value = true exportLoading.value = true
const excelTitle = ref(route.meta.title) const excelTitle = ref(route.meta.title)
tableObject.params.detailDataType = 1
const data = await UnplannedreceiptRecordMainApi.exportUnplannedreceiptRecordMain(tableObject.params) const data = await UnplannedreceiptRecordMainApi.exportUnplannedreceiptRecordMain(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch { } catch {

1
src/views/wms/inventoryjobManage/unplannedreceipt/unplannedreceiptRequestMain/index.vue

@ -668,6 +668,7 @@ const handleExport = async () => {
// //
exportLoading.value = true exportLoading.value = true
const excelTitle = ref(route.meta.title) const excelTitle = ref(route.meta.title)
tableObject.params.detailDataType = 1
const data = await UnplannedreceiptRequestMainApi.exportUnplannedreceiptRequestMain(tableObject.params) const data = await UnplannedreceiptRequestMainApi.exportUnplannedreceiptRequestMain(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch { } catch {

Loading…
Cancel
Save