Browse Source

Merge branch 'master_hella_20240701' into master_hella

hella_online_20240829
陈薪名 5 months ago
parent
commit
d95c279e4d
  1. 68
      src/api/wms/demandforecastingDetail/index.ts
  2. 20
      src/api/wms/demandforecastingMain/index.ts
  3. 11
      src/api/wms/itempackage/index.ts
  4. 21
      src/api/wms/packageunit/index.ts
  5. 11
      src/api/wms/purchasePlanDetail/index.ts
  6. 19
      src/api/wms/purchasePlanMain/index.ts
  7. 65
      src/api/wms/supplierCycle/index.ts
  8. 9
      src/api/wms/supplierdeliverRequestDetail/index.ts
  9. 11
      src/api/wms/supplieritem/index.ts
  10. 15
      src/components/BasicForm/src/BasicForm.vue
  11. 1
      src/components/Detail/src/Detail.vue
  12. 146
      src/components/Search/src/Search.vue
  13. 58
      src/components/SearchTable/src/SearchTable.vue
  14. 2
      src/components/Table/src/Table.vue
  15. 51
      src/components/TableForm/src/TableForm.vue
  16. 15
      src/locales/en-US.ts
  17. 14
      src/locales/zh-CN.ts
  18. 9
      src/store/modules/permission.ts
  19. 1
      src/utils/dict.ts
  20. 32
      src/utils/disposition/defaultButtons.ts
  21. 6
      src/views/wms/basicDataManage/itemManage/itempackage/index.vue
  22. 2
      src/views/wms/basicDataManage/itemManage/itempackage/itempackage.data.ts
  23. 30
      src/views/wms/basicDataManage/itemManage/packageunit/index.vue
  24. 342
      src/views/wms/basicDataManage/itemManage/packageunit/packageunit.data.ts
  25. 276
      src/views/wms/basicDataManage/supplierManage/supplierCycle/index.vue
  26. 160
      src/views/wms/basicDataManage/supplierManage/supplierCycle/supplierCycle.data.ts
  27. 22
      src/views/wms/basicDataManage/supplierManage/supplieritem/index.vue
  28. 19
      src/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data.ts
  29. 16
      src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/productionreturnRequestMainNo.data.ts
  30. 2
      src/views/wms/issueManage/repleinsh/repleinshRequestMain/index.vue
  31. 13
      src/views/wms/issueManage/repleinsh/repleinshRequestMain/repleinshRequestMain.data.ts
  32. 456
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/demandforecastingMain.data.ts
  33. 398
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue
  34. 399
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingSupplierMain/demandforecastingMain.data.ts
  35. 285
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingSupplierMain/index.vue
  36. 205
      src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue
  37. 321
      src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/purchasePlanMain.data.ts
  38. 633
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue
  39. 509
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/labelForm.vue
  40. 90
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverBasicForm.vue
  41. 3089
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

68
src/api/wms/demandforecastingDetail/index.ts

@ -1,4 +1,6 @@
import request from '@/config/axios' import request from '@/config/axios'
import { isString } from '@/utils/is'
import dayjs from 'dayjs'
export interface DemandforecastingDetailVO { export interface DemandforecastingDetailVO {
predictTimeType: string predictTimeType: string
@ -15,6 +17,57 @@ export interface DemandforecastingDetailVO {
available: string available: string
} }
// 要货预测-列表和头部请求参数
const getPageParams = (params)=>{
// 到货日期
if(params.dueDate&&params.dueDate.length>0){
if(isString(params.dueDate[0])){
params.startDate = params.dueDate[0]
}else{
params.startDate = params.dueDate[0].format('YYYY-MM-DD')
}
}
if(params.dueDate&&params.dueDate.length>1){
if(isString(params.dueDate[1])){
params.endDate = params.dueDate[1]
}else{
params.endDate = params.dueDate[1].format('YYYY-MM-DD')
}
}
params.dueDate = ''
//计划员
if(params.planerId&&params.planerId.length>0){
params.planers = params.planerId.join(',')
}
params.planerId = ''
// 供应商代码
if(params.supplierCode&&params.supplierCode.length>0){
let keyValue = params.supplierCode.split(' ')
keyValue.forEach(item=>{item = item.trim()})
params.supplierCodes = keyValue.join(',')
}
params.supplierCode = ''
// 物料代码
if(params.itemCode&&params.itemCode.length>0){
let keyValue = params.itemCode.split(' ')
keyValue.forEach(item=>{item = item.trim()})
params.itemCodes = keyValue.join(',')
}
params.itemCode = ''
// 版本号
if(params.version&&params.version.length>0){
let keyValue = params.version.split(' ')
keyValue.forEach(item=>{item = item.trim()})
params.versions = keyValue.join(',')
}
params.version = ''
return params
}
// 查询要货预测子列表 // 查询要货预测子列表
export const getDemandforecastingDetailPage = async (params) => { export const getDemandforecastingDetailPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
@ -22,6 +75,8 @@ export const getDemandforecastingDetailPage = async (params) => {
const data = {...params} const data = {...params}
return await request.post({ url: '/wms/demandforecasting-detail/senior', data }) return await request.post({ url: '/wms/demandforecasting-detail/senior', data })
} else { } else {
params = getPageParams(params)
console.log('params',params)
return await request.get({ url: `/wms/demandforecasting-detail/page`, params }) return await request.get({ url: `/wms/demandforecasting-detail/page`, params })
} }
} }
@ -50,3 +105,16 @@ export const deleteDemandforecastingDetail = async (id: number) => {
export const exportDemandforecastingDetail = async (params) => { export const exportDemandforecastingDetail = async (params) => {
return await request.download({ url: `/wms/demandforecasting-detail/export-excel`, params }) return await request.download({ url: `/wms/demandforecasting-detail/export-excel`, params })
} }
// 查询要货预测主列表
export const getPageTableHead = async (params) => {
params = getPageParams(params)
console.log('params',params)
return await request.get({ url: `/wms/demandforecasting-detail/queryPageTableHead`, params })
}
// 查询版本号
export const queryVersion = async (data) => {
return await request.post({ url: `/wms/demandforecasting-detail/queryVersion`, data })
}

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

@ -81,3 +81,23 @@ export const exportDemandforecastingMain = async (params) => {
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/demandforecasting-main/get-import-template' }) return request.download({ url: '/wms/demandforecasting-main/get-import-template' })
} }
// 计划员
export const queryUserPlanerList = async () => {
return await request.post({ url: `/wms/demandforecasting-main/queryUserPlanerList`,data:{} })
}
// 供应商代码
export const querySupplierList = async (data) => {
return await request.post({ url: `/wms/demandforecasting-main/querySupplierList`,data })
}
// 是否已读接口
export const updateIsRead = async (data) => {
return await request.post({ url: `/wms/demandforecasting-main/updateIsRead`,data })
}

11
src/api/wms/itempackage/index.ts

@ -29,7 +29,16 @@ export const getItempackagingPage = async (params) => {
return await request.get({ url: `/wms/itempackage/page`, params }) return await request.get({ url: `/wms/itempackage/page`, params })
} }
} }
// 查询物料包装信息树形列表
export const getItempackagingPageTree = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/itempackage/seniorTree', data })
} else {
return await request.get({ url: `/wms/itempackage/pageTree`, params })
}
}
// 查询物料包装信息 列表--供应商发货申请 // 查询物料包装信息 列表--供应商发货申请
export const getItempackagingPageBySupplierdeliver = async (params) => { export const getItempackagingPageBySupplierdeliver = async (params) => {
if (params.isSearch) { if (params.isSearch) {

21
src/api/wms/packageunit/index.ts

@ -33,7 +33,26 @@ export const getPackageunitPage = async (params) => {
return await request.get({ url: `/wms/packageunit/page`, params }) return await request.get({ url: `/wms/packageunit/page`, params })
} }
} }
// 查询物品包装规格信息 列表树状图
export const getPackageunitPageTree = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/packageunit/seniorTree', data })
} else {
return await request.get({ url: `/wms/packageunit/pageTree`, params })
}
}
// 查询物品父级包装规格信息
export const getPackageunitPageParent = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/packageunit/seniorParent', data })
} else {
return await request.get({ url: `/wms/packageunit/pageParent`, params })
}
}
// 查询物品包装规格信息 详情 // 查询物品包装规格信息 详情
export const getPackageunit = async (id: number) => { export const getPackageunit = async (id: number) => {
return await request.get({ url: `/wms/packageunit/get?id=` + id }) return await request.get({ url: `/wms/packageunit/get?id=` + id })

11
src/api/wms/purchasePlanDetail/index.ts

@ -15,7 +15,17 @@ export interface PurchasePlanDetailVO {
updater: string updater: string
available: string available: string
} }
// 要货预测-列表和头部请求参数
const getPageParams = (params)=>{
console.log('params.status',params.status)
// 状态
if(params.status&&params.status.length>0){
params.statuss = params.status.join(',')
}
params.status = ''
return params
}
// 查询要货计划子列表 // 查询要货计划子列表
export const getPurchasePlanDetailPage = async (params) => { export const getPurchasePlanDetailPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
@ -23,6 +33,7 @@ export const getPurchasePlanDetailPage = async (params) => {
const data = {...params} const data = {...params}
return await request.post({ url: '/wms/purchase-plan-detail/senior', data }) return await request.post({ url: '/wms/purchase-plan-detail/senior', data })
} else { } else {
params = getPageParams(params)
return await request.get({ url: `/wms/purchase-plan-detail/page`, params }) return await request.get({ url: `/wms/purchase-plan-detail/page`, params })
} }
} }

19
src/api/wms/purchasePlanMain/index.ts

@ -85,7 +85,24 @@ export const exportPurchasePlanMain = async (params) => {
return await request.download({ url: `/wms/purchase-plan-main/export-excel`, params }) return await request.download({ url: `/wms/purchase-plan-main/export-excel`, params })
} }
} }
// 导出明细要货计划主 Excel
export const exportDetailsPurchasePlanMain = async (params) => {
if (params.isSearch) {
const data = {...params}
return await request.downloadPost({ url: `/wms/purchase-plan-main/export-excel-senior`, data })
} else {
return await request.download({ url: `/wms/purchase-plan-main/export-excel-detail`, params })
}
}
// 导出要货计划二维表 Excel
export const exportTablePurchasePlanMain = async (params) => {
// if (params.isSearch) {
// const data = {...params}
// return await request.downloadPost({ url: `/wms/purchase-plan-main/export-excel-senior`, data })
// } else {
return await request.download({ url: `/wms/purchase-plan-main/export-excel`, params })
//}
}
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/wms/purchase-plan-main/get-import-template' }) return request.download({ url: '/wms/purchase-plan-main/get-import-template' })

65
src/api/wms/supplierCycle/index.ts

@ -0,0 +1,65 @@
import request from '@/config/axios'
export interface SupplierCycleVO {
id: number
supplierCode: string
monday: string
tuesday: string
wednesday: string
thursday: string
friday: string
saturday: string
sunday: string
version: string
remark: string
extraProperties: string
siteId: string
beginTime: Date
endTime: Date
available: string
status: string
concurrencyStamp: string
ruleUserId: number
departmentCode: string
}
// 查询要货预测周期列表
export const getSupplierCyclePage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/supplier-cycle/senior', data })
} else {
return await request.get({ url: `/wms/supplier-cycle/page`, params })
}
}
// 查询要货预测周期详情
export const getSupplierCycle = async (id: number) => {
return await request.get({ url: `/wms/supplier-cycle/get?id=` + id })
}
// 新增要货预测周期
export const createSupplierCycle = async (data: SupplierCycleVO) => {
return await request.post({ url: `/wms/supplier-cycle/create`, data })
}
// 修改要货预测周期
export const updateSupplierCycle = async (data: SupplierCycleVO) => {
return await request.put({ url: `/wms/supplier-cycle/update`, data })
}
// 删除要货预测周期
export const deleteSupplierCycle = async (id: number) => {
return await request.delete({ url: `/wms/supplier-cycle/delete?id=` + id })
}
// 导出要货预测周期 Excel
export const exportSupplierCycle = async (params) => {
return await request.download({ url: `/wms/supplier-cycle/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/supplier-cycle/get-import-template' })
}

9
src/api/wms/supplierdeliverRequestDetail/index.ts

@ -43,7 +43,14 @@ export const getSupplierdeliverRequestDetailPage = async (params) => {
return await request.get({ url: `/wms/supplierdeliver-request-detail/page`, params }) return await request.get({ url: `/wms/supplierdeliver-request-detail/page`, params })
} }
} }
// 查询供应商发货申请子列表
export const getGenerateLabelList = async (params) => {
return await request.get({ url: `/wms/supplierdeliver-request-detail/generateLabelList`, params })
}
// 查询托规格列表
export const getGenerateLabelParentList = async (params) => {
return await request.get({ url: `/wms/supplierdeliver-request-detail/generateLabelParentList`, params })
}
// 查询供应商发货申请子详情 // 查询供应商发货申请子详情
export const getSupplierdeliverRequestDetail = async (id: number) => { export const getSupplierdeliverRequestDetail = async (id: number) => {
return await request.get({ url: `/wms/supplierdeliver-request-detail/get?id=` + id }) return await request.get({ url: `/wms/supplierdeliver-request-detail/get?id=` + id })

11
src/api/wms/supplieritem/index.ts

@ -51,16 +51,27 @@ export const getSupplieritem = async (id: number) => {
export const createSupplieritem = async (data: SupplieritemVO) => { export const createSupplieritem = async (data: SupplieritemVO) => {
return await request.post({ url: `/wms/supplieritem/create`, data }) return await request.post({ url: `/wms/supplieritem/create`, data })
} }
export const createSupplieritemSCP = async (data: SupplieritemVO) => {
return await request.post({ url: `/wms/supplieritem/createSCP`, data })
}
// 修改供应商物料 // 修改供应商物料
export const updateSupplieritem = async (data: SupplieritemVO) => { export const updateSupplieritem = async (data: SupplieritemVO) => {
return await request.put({ url: `/wms/supplieritem/update`, data }) return await request.put({ url: `/wms/supplieritem/update`, data })
} }
// 修改供应商物料
export const updateSupplieritemSCP = async (data: SupplieritemVO) => {
return await request.put({ url: `/wms/supplieritem/updateSCP`, data })
}
// 删除供应商物料 // 删除供应商物料
export const deleteSupplieritem = async (id: number) => { export const deleteSupplieritem = async (id: number) => {
return await request.delete({ url: `/wms/supplieritem/delete?id=` + id }) return await request.delete({ url: `/wms/supplieritem/delete?id=` + id })
} }
export const deleteSupplieritemSCP = async (id: number) => {
return await request.delete({ url: `/wms/supplieritem/deleteSCP?id=` + id })
}
// 导出供应商物料 Excel // 导出供应商物料 Excel
export const exportSupplieritem = async (params) => { export const exportSupplieritem = async (params) => {

15
src/components/BasicForm/src/BasicForm.vue

@ -102,6 +102,7 @@
@clearInput='clearInput' @clearInput='clearInput'
@batchAdd="batchAdd" @batchAdd="batchAdd"
:routeName="routeName" :routeName="routeName"
@visibleChange='visibleChange'
> >
<template v-slot="{row}"> <template v-slot="{row}">
<slot :row="row"></slot> <slot :row="row"></slot>
@ -127,7 +128,11 @@
</template> </template>
</Dialog> </Dialog>
<SearchTable ref="searchTableRef" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess" /> <SearchTable ref="searchTableRef" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess" >
<template v-for="name in Object.keys($slots)" :key="name" #[name]>
<slot :name="name"></slot>
</template>
</SearchTable>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { SearchTable } from '@/components/SearchTable' import { SearchTable } from '@/components/SearchTable'
@ -688,8 +693,12 @@ const emit = defineEmits([
'footButtonClick', 'footButtonClick',
'clearSearchInput', 'clearSearchInput',
'clearInput', 'clearInput',
'sumFormDataHandle' 'sumFormDataHandle',
'visibleChange'
]) ])
const visibleChange = (field, val, row, index) => {
emit('visibleChange',field, val, row, index)
}
// //
const formSelectChange = (field, val, row) => { const formSelectChange = (field, val, row) => {
emit('formSelectChange', field, val, row) emit('formSelectChange', field, val, row)
@ -837,7 +846,7 @@ const buttonOperationClick = (row, label, index)=> {
} }
defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading ,handleAddTable,changeDialogWidth}) // open defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading ,handleAddTable,changeDialogWidth,searchTableRef,tableFormRef}) // open
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

1
src/components/Detail/src/Detail.vue

@ -662,6 +662,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
detailLoading.value = true detailLoading.value = true
try { try {
detailData.value = row detailData.value = row
searchTableFormModel.value = {...searchTableFormModel.value,...row}
getRemarkList() getRemarkList()
getFileList() getFileList()
getAnnexFileList(row) getAnnexFileList(row)

146
src/components/Search/src/Search.vue

@ -9,6 +9,7 @@ import { FormSchema } from '@/types/form'
import { useCache } from '@/hooks/web/useCache' import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache() const { wsCache } = useCache()
const message = useMessage() //
defineOptions({ name: 'Search' }) defineOptions({ name: 'Search' })
@ -40,10 +41,26 @@ const props = defineProps({
model: { model: {
type: Object as PropType<Recordable>, type: Object as PropType<Recordable>,
default: () => ({}) default: () => ({})
},
//
detailData: {
type: Object,
required: true,
default: null
},
hiddenFilterBtnFields:{
type: Array,
required: false,
default: []
},
showSearchTableQueryFields:{
type: Array,
required: false,
default: []
} }
}) })
const emit = defineEmits(['search', 'reset','onInput']) const emit = defineEmits(['search', 'reset','onInput','onChange','searchTableSuccess'])
const visible = ref(true) const visible = ref(true)
@ -91,7 +108,125 @@ const { register, elFormRef, methods } = useForm({
const onInput = (field,value) => { const onInput = (field,value) => {
emit('onInput', field,value) emit('onInput', field,value)
} }
const onChange = (field, value)=>{
emit('onChange', field,value)
}
const searchTableRef = ref()
const opensearchTable = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row,
isConcatDetailSchemas=false,
searchDetailSchemas: any
) => {
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
//
let filters: any[] = []
for (var i=0; i< searchCondition.length; i++ ) {
// searchCondition.forEach((item) => {
// row
if (searchCondition[i].isMainValue) {
let keyValue = formRef.value.formModel[searchCondition[i].value]
? formRef.value.formModel[searchCondition[i].value]
: props.detailData
? props.detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
if(searchCondition[i].isCSV&&keyValue){
//
if(Array.isArray(keyValue)){
keyValue = keyValue.join(',')
}else{
keyValue = keyValue.split(' ')
keyValue.forEach(item=>{item = item.trim()})
keyValue = keyValue.join(',')
}
console.log('keyValue',keyValue)
}
_searchCondition[searchCondition[i].key] = keyValue
if(searchCondition[i].required){
//
let isNull = false
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) {
isNull = true
}
if (isNull) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
}
}else if(searchCondition[i].isTableRowValue){
if(searchCondition[i].required){
if (row[searchCondition[i].value] == '' ||row[searchCondition[i].value] == undefined) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
}
row[searchCondition[i].value]
//table
_searchCondition[searchCondition[i].key] = row[searchCondition[i].value]
} else {
//
if (searchCondition[i].isSearch) {
if (searchCondition[i].isFormModel) {
//formModel
if(searchCondition[i].required){
if (formRef.value.formModel[searchCondition[i].value] == '' ||formRef.value.formModel[searchCondition[i].value] == undefined) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
}
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: formRef.value.formModel[searchCondition[i].value]
})
}else{
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: searchCondition[i].value
})
}
} else {
_searchCondition[searchCondition[i].key] = searchCondition[i].value
}
}
}
if (filters.length > 0) {
_searchCondition.isSearch = true
_searchCondition.filters = filters
}
}
const _searchTableTitle = searchTitle
const _searchTableAllSchemas = searchAllSchemas
const _searchTablePage = searchPage
searchTableRef.value.open(
_searchTableTitle,
_searchTableAllSchemas,
_searchTablePage,
formField,
searchField,
multiple,
type,
row,
_searchCondition,
undefined,
isConcatDetailSchemas,
searchDetailSchemas
)
}
const formRef = ref() const formRef = ref()
const setFormValues = (formData)=>{ const setFormValues = (formData)=>{
formRef.value.setValues(formData) formRef.value.setValues(formData)
@ -124,6 +259,11 @@ const setVisible = () => {
unref(elFormRef)?.resetFields() unref(elFormRef)?.resetFields()
visible.value = !unref(visible) visible.value = !unref(visible)
} }
//
// val row
const searchTableSuccess = (formField, searchField, val, type, row) => {
emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
}
const Search = ref() const Search = ref()
onMounted(() => {}) onMounted(() => {})
defineExpose({setFormValues}) // open defineExpose({setFormValues}) // open
@ -143,6 +283,8 @@ defineExpose({setFormValues}) // 提供 open 方法,用于打开弹窗
hide-required-asterisk hide-required-asterisk
@register="register" @register="register"
@onInput="onInput" @onInput="onInput"
@opensearchTable="opensearchTable"
@onChange="onChange"
> >
<template #action> <template #action>
<div v-if="layout === 'inline'"> <div v-if="layout === 'inline'">
@ -188,6 +330,8 @@ defineExpose({setFormValues}) // 提供 open 方法,用于打开弹窗
<slot name="actionMore"></slot> <slot name="actionMore"></slot>
</div> </div>
</template> </template>
<SearchTable ref="searchTableRef" :hiddenFilterBtnFields="hiddenFilterBtnFields" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess" />
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.search ::v-deep(.el-form-item) { .search ::v-deep(.el-form-item) {

58
src/components/SearchTable/src/SearchTable.vue

@ -1,6 +1,7 @@
<template> <template>
<Dialog :title="dialogTitle" v-model="searchDialogVisible" :width="dialogWidth"> <Dialog :title="dialogTitle" v-model="searchDialogVisible" :width="dialogWidth">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<slot :name="'searchQuery'+formFieldRef"></slot>
<ContentWrap v-if="searchQuery"> <ContentWrap v-if="searchQuery">
<Search :schema="searchSchema" @search="setSearchParamsRef" @reset="setSearchParamsRef" /> <Search :schema="searchSchema" @search="setSearchParamsRef" @reset="setSearchParamsRef" />
</ContentWrap> </ContentWrap>
@ -51,7 +52,12 @@ const props = defineProps({
type: Array, type: Array,
required: false, required: false,
default: [] default: []
} },
hiddenFilterBtnFields:{
type: Array,
required: false,
default: []
},
}) })
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
@ -94,7 +100,8 @@ const allSchemasRef = ref()
const searchConditionRef = ref() const searchConditionRef = ref()
const searchTableSelectionsList = ref() // const searchTableSelectionsList = ref() //
const searchQuery = ref(false) const searchQuery = ref(false)
const openData = (titleName: any, tableObject: any, allSchemas: any, multiple: any) => { const hiddenFilterBtn = ref(false)
const openData = (titleName: any, tableObject:any ,allSchemas: any,multiple: any) => {
dialogWidth.value = '80%' dialogWidth.value = '80%'
multipleBol.value = multiple multipleBol.value = multiple
HeadButttondata.value = multiple HeadButttondata.value = multiple
@ -114,36 +121,24 @@ const openData = (titleName: any, tableObject: any, allSchemas: any, multiple: a
searchSchema.value = allSchemas.searchSchema searchSchema.value = allSchemas.searchSchema
tableColumns.value = allSchemas.tableColumns tableColumns.value = allSchemas.tableColumns
} }
const open = ( const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any,multiple: any, type: any, row: any, searchCondition:any , isCountRequestRe:any,isConcatDetailSchemas=false,detailSchemas: any, searchTableSelections:any) => {
titleName: any, searchQuery.value = props.showSearchTableQueryFields.find(item=>item==formField)?true:false
allSchemas: any, hiddenFilterBtn.value = props.hiddenFilterBtnFields.find(item=>item==formField)?true:false
getApiPage: any,
formField: any,
searchField: any,
multiple: any,
type: any,
row: any,
searchCondition: any,
isCountRequestRe: any,
isConcatDetailSchemas = false,
detailSchemas: any,
searchTableSelections: any
) => {
searchQuery.value = props.showSearchTableQueryFields.find((item) => item == formField)
? true
: false
dialogWidth.value = '80%' dialogWidth.value = '80%'
multipleBol.value = multiple multipleBol.value = multiple
HeadButttondata.value = multiple
? [ const filterBtns = hiddenFilterBtn.value?[]:[defaultButtons.defaultFilterBtn(null)]
defaultButtons.defaultWhenPageBtn(null), //
defaultButtons.defaultUnselectPageBtn(null), // HeadButttondata.value = multiple?[
// defaultButtons.defaultDeselectAllBtn(null), // defaultButtons.defaultWhenPageBtn(null), //
defaultButtons.defaultFilterBtn(null) // defaultButtons.defaultUnselectPageBtn(null), //
] // defaultButtons.defaultDeselectAllBtn(null), //
: [ ...filterBtns, //
defaultButtons.defaultFilterBtn(null) // ]:
] [
...filterBtns, //
]
searchDialogVisible.value = true searchDialogVisible.value = true
formFieldRef.value = formField formFieldRef.value = formField
searchFieldRef.value = searchField searchFieldRef.value = searchField
@ -241,7 +236,8 @@ const buttonBaseClick = (val, item) => {
} }
} }
defineExpose({ open, openData, hiddenFilterButton, changeDialogWidth }) // open
defineExpose({ open,openData,hiddenFilterButton ,changeDialogWidth,searchFormClick}) // open
// Table ref // Table ref
const searchTableRef = ref() const searchTableRef = ref()

2
src/components/Table/src/Table.vue

@ -62,6 +62,7 @@ export default defineComponent({
}, },
searchTableSelectionsList:[],// searchTableSelectionsList:[],//
selectionColor: propTypes.bool.def(false), selectionColor: propTypes.bool.def(false),
rowKey: propTypes.string.def(''),
}, },
emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort','getSelectionRows','rowClick'], emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort','getSelectionRows','rowClick'],
setup(props, { attrs, slots, emit, expose }) { setup(props, { attrs, slots, emit, expose }) {
@ -401,6 +402,7 @@ export default defineComponent({
onSelect-all={selectAll} onSelect-all={selectAll}
onSelection-change={selectionChange} onSelection-change={selectionChange}
onSort-change={sortChange} onSort-change={sortChange}
row-key={unref(getProps).rowKey}
onRow-click={rowClick} onRow-click={rowClick}
{...unref(getBindValue)} {...unref(getBindValue)}
> >

51
src/components/TableForm/src/TableForm.vue

@ -92,6 +92,7 @@
:disabled="disabledInput(headerItem, row)" :disabled="disabledInput(headerItem, row)"
style="flex: 1" style="flex: 1"
@blur="inputStringBlur(headerItem, row[headerItem.field], row, index)" @blur="inputStringBlur(headerItem, row[headerItem.field], row, index)"
@clear='clearInput(headerItem.field, row, index)'
/> />
<Icon <Icon
icon="ep:circle-close" icon="ep:circle-close"
@ -164,12 +165,13 @@
:placeholder="headerItem?.tableForm?.placeholder || '请选择' + headerItem.label" :placeholder="headerItem?.tableForm?.placeholder || '请选择' + headerItem.label"
@change="formSelectChange(headerItem.field, $event, row)" @change="formSelectChange(headerItem.field, $event, row)"
@blur="tableFormSelectOnBlur(headerItem.field, $event, row, $index)" @blur="tableFormSelectOnBlur(headerItem.field, $event, row, $index)"
@visible-change="visibleChange(headerItem.field, $event, row, $index)"
> >
<el-option <el-option
v-for="op in initSelectOptions(headerItem)" v-for="op in initSelectOptions(headerItem,row)"
:label="t(`ts.${op.label}`).replace('ts.', '')" :label="t(`ts.${initLabel(headerItem,op)}`).replace('ts.', '')"
:value="op.value" :value="initValue(headerItem,op)"
:key="op.value" :key="initValue(headerItem,op)"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -196,7 +198,7 @@
@blur="tableFormSelectOnBlur(headerItem.field, $event, row, $index)" @blur="tableFormSelectOnBlur(headerItem.field, $event, row, $index)"
> >
<el-option-group <el-option-group
v-for="group in initSelectOptions(headerItem)" v-for="group in initSelectOptions(headerItem,row)"
:key="group.type" :key="group.type"
:label="t(`ts.${group.name}`).replace('ts.', '')" :label="t(`ts.${group.name}`).replace('ts.', '')"
> >
@ -302,7 +304,7 @@
:id="headerItem?.tableForm?.id" :id="headerItem?.tableForm?.id"
> >
<el-radio <el-radio
v-for="(item, index) in initSelectOptions(headerItem)" v-for="(item, index) in initSelectOptions(headerItem,row)"
:key="index" :key="index"
:label="t(`ts.${item.value}`).replace('ts.', '')" :label="t(`ts.${item.value}`).replace('ts.', '')"
:size="headerItem?.tableForm?.size" :size="headerItem?.tableForm?.size"
@ -326,7 +328,7 @@
:fill="headerItem?.tableForm?.fill" :fill="headerItem?.tableForm?.fill"
> >
<el-checkbox <el-checkbox
v-for="(item, index) in initSelectOptions(headerItem)" v-for="(item, index) in initSelectOptions(headerItem,row)"
:key="index" :key="index"
:label="t(`ts.${item.value}`).replace('ts.', '')" :label="t(`ts.${item.value}`).replace('ts.', '')"
:disabled="itemIsDisabled(headerItem, row)" :disabled="itemIsDisabled(headerItem, row)"
@ -505,6 +507,7 @@ const emit = defineEmits([
'tableSelectionDelete', 'tableSelectionDelete',
'extendedButtonsClick', 'extendedButtonsClick',
'formSelectChange', 'formSelectChange',
'inputNumberChange',
'tableSortChange', 'tableSortChange',
'selectCallback', 'selectCallback',
'handleTableSelect', 'handleTableSelect',
@ -516,11 +519,16 @@ const emit = defineEmits([
'tableFormSelectOnBlur', 'tableFormSelectOnBlur',
'formFormDateChange', 'formFormDateChange',
'clearInput', 'clearInput',
'batchAdd' 'batchAdd',
'visibleChange'
]) ])
// | type = radio | type = select // | type = radio | type = select
const initSelectOptions = (item) => { const initSelectOptions = (headerItem,row) => {
return item.dictType ? getStrDictOptions(item.dictType) : item.tableForm.initOptions if(row[headerItem.field+'InitOptions']){
return row[headerItem.field+'InitOptions']
}else{
return headerItem.dictType ? getStrDictOptions(headerItem.dictType) : headerItem.tableForm.initOptions
}
} }
// //
const formSelectChange = (field, val, row) => { const formSelectChange = (field, val, row) => {
@ -605,7 +613,6 @@ const TableBaseForm_Ref = ref()
*/ */
const validateForm = () => { const validateForm = () => {
console.log(TableBaseForm_Ref.value)
let _lists = TableBaseForm_Ref.value?.map((v) => v.validate()) let _lists = TableBaseForm_Ref.value?.map((v) => v.validate())
if(!_lists ||_lists.length == 0){ if(!_lists ||_lists.length == 0){
return false return false
@ -647,7 +654,9 @@ const clearInput = (field, row, index) => {
const buttonOperationClick = (row, label, index) => { const buttonOperationClick = (row, label, index) => {
emit('buttonOperationClick', row, label, index) emit('buttonOperationClick', row, label, index)
} }
const visibleChange = (field, val, row, index) => {
emit('visibleChange',field, val, row, index)
}
const currentPage = ref(1) const currentPage = ref(1)
const pageSize = ref(10) const pageSize = ref(10)
const showTableData = () => { const showTableData = () => {
@ -661,9 +670,7 @@ const showTableData = () => {
} }
} }
const keyWord = ref('') const keyWord = ref('')
console.log(9999, props.tableFields)
const batchAdd = () => { const batchAdd = () => {
console.log(keyWord.value)
let field = '' let field = ''
const itemCodeFields = props.tableFields.find((item) => item.field == 'itemCode') const itemCodeFields = props.tableFields.find((item) => item.field == 'itemCode')
const supplierFields = props.tableFields.find((item) => item.field == 'supplierCode') const supplierFields = props.tableFields.find((item) => item.field == 'supplierCode')
@ -674,7 +681,6 @@ const batchAdd = () => {
field = supplierFields.field field = supplierFields.field
} }
} }
console.log(field)
emit('batchAdd', keyWord.value) emit('batchAdd', keyWord.value)
} }
const disabledInput = (headerItem, row) => { const disabledInput = (headerItem, row) => {
@ -693,7 +699,20 @@ const disabledInput = (headerItem, row) => {
) )
} }
} }
const initLabel=(headerItem,op)=>{
if(headerItem?.tableForm?.labelField){
return op[headerItem?.tableForm?.labelField]
}else{
return op.label
}
}
const initValue=(headerItem,op)=>{
if(headerItem?.tableForm?.valueField){
return op[headerItem?.tableForm?.valueField]
}else{
return op.value
}
}
// setup // setup
defineExpose({ defineExpose({
TableBaseComponents_Ref, TableBaseComponents_Ref,

15
src/locales/en-US.ts

@ -1140,7 +1140,20 @@ export default {
'重新生成标签会删除上次生成的标签,是否确认继续?':'Regenerating labels will delete the last generated label. Are you sure you want to continue?', '重新生成标签会删除上次生成的标签,是否确认继续?':'Regenerating labels will delete the last generated label. Are you sure you want to continue?',
'确 认':'Confirm', '确 认':'Confirm',
:'Please enter the reason for rejection', :'Please enter the reason for rejection',
:'View details' :'View details',
:'All read',
'申请发货数量不能大于 计划数量 - 已发货数量':'The requested quantity cannot be greater than the planned quantity - the quantity shipped',
:'Oversend is not allowed',
:'The total quantity exceeds the planned quantity',
:'Exporting two-dimensional tables',
:'Detailed requisition plan',
:'Two dimensional requisition schedule',
'要货预测-计划员':'Demand forecast-Planner',
'要货预测-供应商':'Demand forecast-Supplier',
:'All',
:'Planner',
}, },

14
src/locales/zh-CN.ts

@ -1140,7 +1140,19 @@ export default {
'重新生成标签会删除上次生成的标签,是否确认继续?':'重新生成标签会删除上次生成的标签,是否确认继续?', '重新生成标签会删除上次生成的标签,是否确认继续?':'重新生成标签会删除上次生成的标签,是否确认继续?',
'确 认':'确 认', '确 认':'确 认',
:'请输入拒收原因', :'请输入拒收原因',
:'查看明细' :'查看明细',
:'全部已读',
'申请发货数量不能大于 计划数量 - 已发货数量':'申请发货数量不能大于 计划数量 - 已发货数量',
:'不允许超发',
:'总数量超出计划数量',
:'导出二维表',
:'要货计划明细',
:'要货计划二维表',
'要货预测-计划员':'要货预测-计划员',
'要货预测-供应商':'要货预测-供应商',
:'全选',
:'计划员',
}, },
} }

9
src/store/modules/permission.ts

@ -4,6 +4,7 @@ import { cloneDeep } from 'lodash-es'
import remainingRouter from '@/router/modules/remaining' import remainingRouter from '@/router/modules/remaining'
import { flatMultiLevelRoutes, generateRoute } from '@/utils/routerHelper' import { flatMultiLevelRoutes, generateRoute } from '@/utils/routerHelper'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { getTenantId } from '@/utils/auth'
const { wsCache } = useCache() const { wsCache } = useCache()
@ -33,11 +34,19 @@ export const usePermissionStore = defineStore('permission', {
actions: { actions: {
async generateRoutes(): Promise<unknown> { async generateRoutes(): Promise<unknown> {
return new Promise<void>(async (resolve) => { return new Promise<void>(async (resolve) => {
let names =[{"text":"长春1379","value":1},{"text":"成都1397","value":2},{"text":"长春2379","value":3}]
let tenant = names.find(item=>item.value == getTenantId())
// 获得菜单列表,它在登录的时候,setUserInfoAction 方法中已经进行获取 // 获得菜单列表,它在登录的时候,setUserInfoAction 方法中已经进行获取
let res: AppCustomRouteRecordRaw[] = [] let res: AppCustomRouteRecordRaw[] = []
if (wsCache.get(CACHE_KEY.ROLE_ROUTERS)) { if (wsCache.get(CACHE_KEY.ROLE_ROUTERS)) {
res = wsCache.get(CACHE_KEY.ROLE_ROUTERS) as AppCustomRouteRecordRaw[] res = wsCache.get(CACHE_KEY.ROLE_ROUTERS) as AppCustomRouteRecordRaw[]
res.forEach(item=>{
if(item.name == '富维海拉供应商系统'&&tenant){
item.name = item.name + tenant['text']
}
})
} }
console.log('菜单res',res)
const routerMap: AppRouteRecordRaw[] = generateRoute(res) const routerMap: AppRouteRecordRaw[] = generateRoute(res)
// 动态路由,404一定要放到最后面 // 动态路由,404一定要放到最后面
this.addRouters = routerMap.concat([ this.addRouters = routerMap.concat([

1
src/utils/dict.ts

@ -188,6 +188,7 @@ export enum DICT_TYPE {
UOM = 'uom', // 计量单位 UOM = 'uom', // 计量单位
ABC_CLASS = 'abc_class', // ABC类 ABC_CLASS = 'abc_class', // ABC类
TRUE_FALSE = 'true_false', // 是否 TRUE_FALSE = 'true_false', // 是否
ALLOWOVERSHIPMENT = 'allow_over_shipment',//是否允许超发
FALSE_OR_TRUE = 'false_or_true', // 是否2 FALSE_OR_TRUE = 'false_or_true', // 是否2
ITEM_GROUP = 'item_group', // 物料分组 ITEM_GROUP = 'item_group', // 物料分组
ITEM_CATEGORY = 'Item_category', // 物料种类 ITEM_CATEGORY = 'Item_category', // 物料种类

32
src/utils/disposition/defaultButtons.ts

@ -44,6 +44,31 @@ export function defaultExportBtn(option: any) {
hasPermi: '' hasPermi: ''
}) })
} }
// 导出明细按钮
export function defaultExportDetailsBtn(option: any) {
return __defaultBtnOption(option, {
label: t(`ts.导出明细`).replace('ts.', ''),
name: 'export-details',
hide: false,
type: 'success',
icon: 'ep:download',
color: '',
hasPermi: ''
})
}
// 导出明细按钮
export function defaultExportTableBtn(option: any) {
return __defaultBtnOption(option, {
label: t(`ts.导出二维表`).replace('ts.', ''),
name: 'export-table',
hide: false,
type: 'success',
icon: 'ep:download',
color: '',
hasPermi: ''
})
}
// 字段设置 // 字段设置
// export function defaultFieldSettingBtn(option:any) { // export function defaultFieldSettingBtn(option:any) {
@ -236,17 +261,16 @@ export function formStagingBtn(option: any) {
hasPermi: '' hasPermi: ''
}) })
} }
// form表单-下一步按钮 // form表单-下一步按钮
export function formNextStepBtn(option: any) { export function formNextStepBtn(option:any) {
return __defaultBtnOption(option, { return __defaultBtnOption(option,{
label: t(`ts.下一步`).replace('ts.', ''), label: t(`ts.下一步`).replace('ts.', ''),
name: 'nextStep', name: 'nextStep',
hide: false, hide: false,
type: 'primary', type: 'primary',
icon: 'ep:select', icon: 'ep:select',
color: '', color: '',
float: 'right', float:'right',
hasPermi: '' hasPermi: ''
}) })
} }

6
src/views/wms/basicDataManage/itemManage/itempackage/index.vue

@ -30,6 +30,7 @@
v-model:pageSize="tableObject.pageSize" v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
rowKey="id"
> >
<template #itemCode="{ row }"> <template #itemCode="{ row }">
<el-button type="primary" link @click="openDetail(row, '物料代码', row.itemCode)"> <el-button type="primary" link @click="openDetail(row, '物料代码', row.itemCode)">
@ -97,7 +98,7 @@ const updataTableColumns = (val) => {
} }
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: ItempackagingApi.getItempackagingPage // getListApi: ItempackagingApi.getItempackagingPageTree //
}) })
// //
@ -337,8 +338,7 @@ const searchFormClick = (searchData) => {
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() await getList()
importTemplateData.templateUrl = await ItempackagingApi.importTemplate() importTemplateData.templateUrl = await ItempackagingApi.importTemplate()
}) })
</script> </script>
@/api/wms/itempackage

2
src/views/wms/basicDataManage/itemManage/itempackage/itempackage.data.ts

@ -17,7 +17,7 @@ export const Itempackaging = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
table: { table: {
width: 150, width: 180,
fixed: 'left' fixed: 'left'
}, },
form: { form: {

30
src/views/wms/basicDataManage/itemManage/packageunit/index.vue

@ -26,6 +26,7 @@
v-model:pageSize="tableObject.pageSize" v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
rowKey="id"
> >
<template #code="{row}"> <template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> <el-button type="primary" link @click="openDetail(row, '代码', row.code)">
@ -33,7 +34,7 @@
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -79,6 +80,10 @@ const tableColumns = ref(Packageunit.allSchemas.tableColumns)
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(() => {
// if(val[0].parentCode){
// message.error('')
// return
// }
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
formRef.setValues(setV) formRef.setValues(setV)
@ -91,7 +96,7 @@ const updataTableColumns = (val) => {
} }
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: PackageunitApi.getPackageunitPage // getListApi: PackageunitApi.getPackageunitPageTree //
}) })
// //
@ -132,10 +137,23 @@ const buttonBaseClick = (val, item) => {
} }
// - // -
const butttondata = [ const butttondata = (row,$index) => {
defaultButtons.mainListEditBtn({hasPermi:'wms:packageunit:update'}), // const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1
defaultButtons.mainListDeleteBtn({hasPermi:'wms:packageunit:delete'}), // if(findIndex>-1&&findIndex<$index){
] return []
}
return [
defaultButtons.mainListEditBtn({hasPermi:'wms:packageunit:update',hide:isShowButton(row)}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:packageunit:delete'}), //
]
}
const isShowButton =(row)=>{
if(row.children&&row.children.length>0){
return true
}else{
return false
}
}
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {

342
src/views/wms/basicDataManage/itemManage/packageunit/packageunit.data.ts

@ -3,6 +3,316 @@ import { dateFormatter } from '@/utils/formatTime'
import { fa } from 'element-plus/es/locale' import { fa } from 'element-plus/es/locale'
import * as PackageunitApi from '@/api/wms/packageunit' import * as PackageunitApi from '@/api/wms/packageunit'
import { Select } from '@element-plus/icons-vue/dist/types' import { Select } from '@element-plus/icons-vue/dist/types'
export const Packageunit1 = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '包装代码',
field: 'code',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
},
{
label: '包装名称',
field: 'name',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
},
{
label: '包装类型',
field: 'type',
dictType: DICT_TYPE.PACK_UNIT_TYPE,
dictClass: 'string',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
},
{
label: '长',
field: 'length',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '宽',
field: 'width',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '高',
field: 'height',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '重量',
field: 'weight',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '单位',
field: 'unit',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: false,
table: {
width: 150
},
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
table: {
width: 150
},
},
{
label: '包装描述',
field: 'desc',
sort: 'custom',
isSearch: false,
table: {
width: 150
},
},
{
label: '是否重复使用',
field: 'reuse',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
table: {
width: 150
},
},
{
label: '是否管理包装库存',
field: 'manageBalance',
sort: 'custom',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isSearch: false,
form: {
component: 'Switch',
value: 'FALSE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
table: {
width: 180
},
},
{
label: '生效时间',
field: 'activeTime',
sort: 'custom',
table: {
width: 180
},
formatter: dateFormatter,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '失效时间',
field: 'expireTime',
sort: 'custom',
table: {
width: 180
},
formatter: dateFormatter,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
table: {
width: 180
},
formatter: dateFormatter,
isForm: false,
},
{
label: '创建者',
field: 'creator',
isForm: false,
isTable: true
},
{
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: 'remark',
sort: 'custom',
table: {
width: 150
},
},
{
label: '删除时间',
field: 'deletionTime',
sort: 'custom',
isForm: false,
isTable: false,
isDetail: false,
table: {
width: 180
},
formatter: dateFormatter,
form: {
component: 'DatePicker',
componentProps: {
type: 'datetime',
valueFormat: 'x'
}
},
},
{
label: '删除者',
field: 'deleterId',
sort: 'custom',
isDetail: false,
isForm: false,
isTable: false,
table: {
width: 150
},
},
{
label: '扩展属性',
field: 'extraProperties',
sort: 'custom',
isForm: false,
isDetail: false,
isTable: false,
table: {
width: 150
},
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isForm: false,
isDetail: false,
isTable: false,
table: {
width: 150
},
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '地点',
field: 'siteId',
sort: 'custom',
isForm: false,
isDetail: false,
isTable: false,
table: {
width: 150
},
},
{
label: '操作',
field: 'action',
isForm: false,
isDetail: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
export const Packageunit = useCrudSchemas(reactive<CrudSchema[]>([ export const Packageunit = useCrudSchemas(reactive<CrudSchema[]>([
{ {
@ -13,15 +323,31 @@ export const Packageunit = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150 width: 150
}, },
},{
label: '父包装代码',
field: 'parentCode',
sort: 'custom',
isTable:false,
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择父包装代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '包装规格信息', // 查询弹窗标题
searchAllSchemas: Packageunit1.allSchemas, // 查询弹窗所需类
searchPage: PackageunitApi.getPackageunitPageParent, // 查询弹窗所需分页方法
searchCondition:[{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
}, },
// {
// label: '父包装代码',
// field: 'parentCode',
// sort: 'custom',
// table: {
// width: 150
// },
// },
{ {
label: '包装名称', label: '包装名称',
field: 'name', field: 'name',

276
src/views/wms/basicDataManage/supplierManage/supplierCycle/index.vue

@ -0,0 +1,276 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="SupplierCycle.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="SupplierCycle.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #monday="{row}">
<Icon :size="16" v-show="row.monday==1" icon="ep:check" />
</template>
<template #tuesday="{row}">
<Icon :size="16" v-show="row.tuesday==1" icon="ep:check" />
</template>
<template #wednesday="{row}">
<Icon :size="16" v-show="row.wednesday==1" icon="ep:check" />
</template>
<template #thursday="{row}">
<Icon :size="16" v-show="row.thursday==1" icon="ep:check" />
</template>
<template #friday="{row}">
<Icon :size="16" v-show="row.friday==1" icon="ep:check" />
</template>
<template #saturday="{row}">
<Icon :size="16" v-show="row.saturday==1" icon="ep:check" />
</template>
<template #sunday="{row}">
<Icon :size="16" v-show="row.sunday==1" icon="ep:check" />
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="SupplierCycleRules"
:formAllSchemas="SupplierCycle.allSchemas"
:apiUpdate="SupplierCycleApi.updateSupplierCycle"
:apiCreate="SupplierCycleApi.createSupplierCycle"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="SupplierCycle.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/supplier-cycle/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { SupplierCycle,SupplierCycleRules } from './supplierCycle.data'
import * as SupplierCycleApi from '@/api/wms/supplierCycle'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
//
defineOptions({ name: 'SupplierCycle' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(SupplierCycle.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: SupplierCycleApi.getSupplierCyclePage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:supplier-cycle:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:supplier-cycle:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:supplier-cycle: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') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:supplier-cycle:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:supplier-cycle:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
if('update'==type){
let cycle = []
let week = ['monday','tuesday','wednesday','thursday','friday','saturday','sunday']
week.forEach(item=>{
if(row[item]==1){
cycle.push(item)
}
})
row.cycle = cycle
}
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,submitData) => {
let data = {...submitData}
let cycle = data.cycle
cycle.forEach(item=>{
data[item] = 1
})
delete data.cycle
console.log('formsSuccess',formType,data)
var isHave =SupplierCycle.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await SupplierCycleApi.createSupplierCycle(data)
message.success(t('common.createSuccess'))
} else {
await SupplierCycleApi.updateSupplierCycle(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicSupplierCycle')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await SupplierCycleApi.deleteSupplierCycle(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await SupplierCycleApi.exportSupplierCycle(tableObject.params)
download.excel(data, '要货预测周期.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '要货预测周期导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await SupplierCycleApi.importTemplate()
})
</script>

160
src/views/wms/basicDataManage/supplierManage/supplierCycle/supplierCycle.data.ts

@ -0,0 +1,160 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
// 表单校验
export const SupplierCycle = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isForm: false,
isTable:false,
},
{
label: '供应商代码',
field: 'supplierCode',
sort: 'custom',
isSearch: true,
form: {
componentProps: {
enterSearch:true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPageSCP, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
search: {
componentProps: {
enterSearch:true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPageSCP, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
{
label: '星期一',
field: 'monday',
sort: 'custom',
isForm:false,
},
{
label: '星期二',
field: 'tuesday',
sort: 'custom',
isForm:false,
},
{
label: '星期三',
field: 'wednesday',
sort: 'custom',
isForm:false,
},
{
label: '星期四',
field: 'thursday',
sort: 'custom',
isForm:false,
},
{
label: '星期五',
field: 'friday',
sort: 'custom',
isForm:false,
},
{
label: '星期六',
field: 'saturday',
sort: 'custom',
isForm:false,
},
{
label: '星期日',
field: 'sunday',
sort: 'custom',
isForm:false,
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
isSearch: false,
sort: 'custom',
table: {
width: 150
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '同步周期',
field: 'cycle',
isForm:true,
isDetail: false,
sort: 'custom',
isTable:false,
form: {
value:[],
component:'Checkbox',
componentProps: {
options: [
{label:'星期一',value:'monday'},
{label:'星期二',value:'tuesday'},
{label:'星期三',value:'wednesday'},
{label:'星期四',value:'thursday'},
{label:'星期五',value:'friday'},
{label:'星期六',value:'saturday'},
{label:'星期日',value:'sunday'}
]
},
}
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
export const SupplierCycleRules = reactive({
supplierCode: [
{ required: true, message: '供应商代码不能为空', trigger: 'blur' },
],
})

22
src/views/wms/basicDataManage/supplierManage/supplieritem/index.vue

@ -44,8 +44,8 @@
@success="formsSuccess" @success="formsSuccess"
:rules="SupplieritemRules" :rules="SupplieritemRules"
:formAllSchemas="Supplieritem.allSchemas" :formAllSchemas="Supplieritem.allSchemas"
:apiUpdate="SupplieritemApi.updateSupplieritem" :apiUpdate="routeName.includes('SCP')?SupplieritemApi.updateSupplieritemSCP:SupplieritemApi.updateSupplieritem"
:apiCreate="SupplieritemApi.createSupplieritem" :apiCreate="routeName.includes('SCP')?SupplieritemApi.createSupplieritemSCP:SupplieritemApi.createSupplieritem"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" :isBusiness="false"
/> />
@ -189,10 +189,18 @@ const formsSuccess = async (formType,data) => {
if(data.activeTime==0)data.activeTime = null; if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null; if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') { if (formType === 'create') {
await SupplieritemApi.createSupplieritem(data) if(routeName.value.includes('SCP')){
await SupplieritemApi.createSupplieritemSCP(data)
}else{
await SupplieritemApi.createSupplieritem(data)
}
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await SupplieritemApi.updateSupplieritem(data) if(routeName.value.includes('SCP')){
await SupplieritemApi.updateSupplieritemSCP(data)
}else{
await SupplieritemApi.updateSupplieritem(data)
}
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
basicFormRef.value.dialogVisible = false basicFormRef.value.dialogVisible = false
@ -221,7 +229,11 @@ const handleDelete = async (id: number) => {
await message.delConfirm() await message.delConfirm()
tableObject.loading = true tableObject.loading = true
// //
await SupplieritemApi.deleteSupplieritem(id) if(routeName.value.includes('SCP')){
await SupplieritemApi.deleteSupplieritemSCP(id)
}else{
await SupplieritemApi.deleteSupplieritem(id)
}
tableObject.loading = false tableObject.loading = false
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //

19
src/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data.ts

@ -94,6 +94,25 @@ export const Supplieritem = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
} }
}, },
{
label: '是否允许超发',
field: 'allowOverShipment',
dictType: DICT_TYPE.ALLOWOVERSHIPMENT,
dictClass: 'string',
isSearch: true,
isTable: true,
sort: 'custom',
form: {
component: 'Switch',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
table: {
width: 150
}
},
{ {
label: '转换率', label: '转换率',
field: 'convertRate', field: 'convertRate',

16
src/views/wms/issueManage/productionreturn/productionreturnRequestMainNo/productionreturnRequestMainNo.data.ts

@ -166,16 +166,20 @@ export const ProductionreturnRequestDetail = useCrudSchemas(reactive<CrudSchema[
searchAllSchemas: Balance.allSchemas, // 查询弹窗所需类 searchAllSchemas: Balance.allSchemas, // 查询弹窗所需类
searchPage: BalanceApi.getBalancePage, // 查询弹窗所需分页方法 searchPage: BalanceApi.getBalancePage, // 查询弹窗所需分页方法
searchCondition:[ searchCondition:[
// { {
// key: 'locationCode', key: 'locationCode',
// value: 'fromLocationCode', value: 'fromLocationCode',
// message: '请填写从库位代码!', message: '请填写从库位代码!',
// isMainValue: true isMainValue: true
// }, },
{ {
key: 'inventoryStatus', key: 'inventoryStatus',
value: 'OK', value: 'OK',
isMainValue: false isMainValue: false
},{
key: 'businessType',
value: 'ReturnToHold', // 隔离退料
isMainValue: false
}] }]
}, },
}, },

2
src/views/wms/issueManage/repleinsh/repleinshRequestMain/index.vue

@ -217,7 +217,7 @@ const butttondata = (row,$index) => {
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']), hasPermi:'wms:repleinsh-request-main:submit'}), // defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']), hasPermi:'wms:repleinsh-request-main:submit'}), //
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']), hasPermi:'wms:repleinsh-request-main:refused'}), // defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']), hasPermi:'wms:repleinsh-request-main:refused'}), //
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']), hasPermi:'wms:repleinsh-request-main:handle'}), // defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']), hasPermi:'wms:repleinsh-request-main:handle'}), //
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']), hasPermi:'wms:repleinsh-request-main:update'}), // defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3','7']), hasPermi:'wms:repleinsh-request-main:update'}), //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:repleinsh-request-main:update'}), // defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:repleinsh-request-main:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:repleinsh-request-main:delete'}), // // defaultButtons.mainListDeleteBtn({hasPermi:'wms:repleinsh-request-main:delete'}), //
] ]

13
src/views/wms/issueManage/repleinsh/repleinshRequestMain/repleinshRequestMain.data.ts

@ -861,6 +861,19 @@ export const RepleinshRequestDetail = useCrudSchemas(reactive<CrudSchema[]>([
isTable:false, isTable:false,
isForm: false isForm: false
}, },
{
label: '未执行任务数量',
field: 'unexecutedQty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
},
isTableForm:false,
hiddenInMain:true,
},
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',

456
src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/demandforecastingMain.data.ts

@ -1,235 +1,276 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime' import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
import * as SupplierApi from '@/api/wms/supplier' import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as SupplieritemApi from '@/api/wms/supplieritem' import * as SupplieritemApi from '@/api/wms/supplieritem'
import { Supplier} from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data' import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data'
import * as ItembasicApi from '@/api/wms/itembasic'
import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data";
import * as PurchaseMainApi from '@/api/wms/purchaseMain' import * as PurchaseMainApi from '@/api/wms/purchaseMain'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail' import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
import { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data' import { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data'
import * as DemandforecastingMainApi from '@/api/wms/demandforecastingMain'
import * as DemandforecastingDetailApi from '@/api/wms/demandforecastingDetail'
import dayjs from 'dayjs'
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
let planerList = []
try {
planerList = await DemandforecastingMainApi.queryUserPlanerList()
if(planerList.length>0){
planerList.unshift({
planerId:'ALL',
planerNickname:t('ts.全选'),
planerUsername:t('ts.全选'),
})
}
console.log('planerList',planerList)
} catch (error) {
}
/** /**
* @returns {Array} * @returns {Array}
*/ */
export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([ Supplieritem.allSchemas.searchSchema = Supplieritem.allSchemas.searchSchema.filter(item=>item.field!="allowOverShipment")
export const Supplier1 = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '单据号', label: '用户名称',
field: 'number', field: 'userName',
sort: 'custom', sort: 'custom',
table: { isSearch:true,
width: 200,
fixed: 'left' },
}, {
isForm: false, label: '用户昵称',
isSearch: true, field: 'nickName',
sort: 'custom',
}, },
{ {
label: '供应商代码', label: '供应商代码',
field: 'supplierCode', field: 'supplierCode',
isSearch:true,
sort: 'custom', sort: 'custom',
table: {
width: 150
},
isSearch: true,
form: {
labelMessage: '影响明细中物料代码,需在供应商物料中维护',
componentProps: {
enterSearch:true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPageSCP, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
}, },
{ {
label: '版本号', label: '供应商名称',
field: 'version', field: 'supplierName',
sort: 'custom', sort: 'custom',
table: {
width: 150
},
}, },
{ {
label: '发布时间', label: '创建时间',
field: 'publishTime', field: 'createTime',
formatter: dateFormatter, formatter: dateFormatter,
detail: { detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss' dateFormat: 'YYYY-MM-DD HH:mm:ss'
}, },
sort: 'custom', sort: 'custom',
table: {
width: 180 }
}, ]))
form: { export const Version = useCrudSchemas(reactive<CrudSchema[]>([
component: 'DatePicker', {
componentProps: { label: '供应商代码',
style: { width: '100%' }, field: 'supplerCodes',
type: 'datetime', sort: 'custom',
dateFormat: 'YYYY-MM-DD HH:mm:ss', isSearch:true,
valueFormat: 'x',
}
},
isForm: false,
}, },
{ {
label: '开始时间', label: '订单号',
field: 'beginTime', field: 'poNumber',
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom', sort: 'custom',
table: { isSearch:true,
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isForm: false,
}, },
{ {
label: '结束时间', label: '订单行',
field: 'endTime', field: 'poLine',
isTable: true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom', sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isForm: false,
}, },
{ {
label: '业务类型', label: '物料代码',
field: 'businessType', field: 'itemCode',
isSearch:true,
sort: 'custom',
},
{
label: '子表版本',
field: 'detailVersion',
sort: 'custom',
}
]))
export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '计划员',
field: 'planerId',
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
}, },
isTable:false, isTable:false,
isForm: false, isForm: false,
form: { isSearch:true,
value: 'PurchasePrediction', search:{
component:'Select',
value:planerList.length>1?[planerList[1]['planerId']]:[],
componentProps: { componentProps: {
disabled: true showAll:true,// 备用做全选
multiple:true,
emptyValues:[null, undefined],
valueOnClear:null,
options:planerList.length>0?planerList.map(item=>({
label:item.planerUsername,
value:item.planerId
})):[]
} }
} },
}, },
{ {
label: '状态', label: '供应商代码',
field: 'status', field: 'supplierCode',
dictType: DICT_TYPE.PURCHASE_ORDER_STATUS,
dictClass: 'string',
isTable: true,
isForm:false,
isSearch: true,
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150,
}, },
form: { isSearch: true,
value: '1', search: {
componentProps: { componentProps: {
disabled: true dialogWidth:'700px',//搜索出来弹窗的宽度
multiple: true,
enterSearch:true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'supplierCode', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier1.allSchemas, // 查询弹窗所需类
searchPage: DemandforecastingMainApi.querySupplierList, // 查询弹窗所需分页方法
searchCondition: [{
key: 'planers',
value: 'planerId',
message: '请选择计划员!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
} }
} }
}, },
{ {
label: '备注', label: '订单号',
field: 'remark', field: 'poNumber',
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
}, },
isTable: false,
}, },
{ {
label: '创建时间', label: '订单行',
field: 'createTime', field: 'poLine',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom', sort: 'custom',
table: { table: {
width: 180 width: 150
}, }
isTable:false,
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isForm: false,
}, },
{ {
label: '创建者', label: '物料代码',
field: 'creator', field: 'itemCode',
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
}, },
isTable:false, isSearch:true,
isTable:true,
isForm: false, isForm: false,
search: {
// labelMessage: '信息提示说明!!!',
componentProps: {
multiple: true,
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'itemCode', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Supplieritem.allSchemas, // 查询弹窗所需类
searchPage: SupplieritemApi.getSupplieritemPageSCP, // 查询弹窗所需分页方法
searchCondition: [{
key: 'supplierCodes',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
}, },
{ {
label: '是否可用', label: '版本号',
field: 'available', field: 'version',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
}, },
form: { isSearch:true,
component: 'Switch', search: {
value: 'TRUE', // labelMessage: '信息提示说明!!!',
componentProps: { componentProps: {
inactiveValue: 'FALSE', multiple: true,
activeValue: 'TRUE' enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择版本号', // 输入框占位文本
searchField: 'detailVersion', // 查询弹窗赋值字段
searchTitle: '版本号', // 查询弹窗标题
searchAllSchemas: Version.allSchemas, // 查询弹窗所需类
searchPage: DemandforecastingDetailApi.queryVersion, // 查询弹窗所需分页方法
searchCondition: [{
key: 'supplierCodes',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'itemCodes',
value: 'itemCode',
message: '请填写物料代码!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
} }
}, }
}, },
{ {
label: '操作', label: '到货日期',
field: 'action', field: 'dueDate',
isDetail: false, formatter: dateFormatter,
isForm: false, sort: 'custom',
table: { table: {
width: 300, width: 150
fixed: 'right' },
isSearch:true,
isTable:false,
isForm: false,
search: {
component: 'DatePicker',
value: [dayjs(), dayjs().subtract(-3,'month')],
componentProps: {
valueFormat: 'YYYY-MM-DD',
type: 'daterange',
defaultTime: [new Date('1 '), new Date('1 ')]
}
}, },
} }
])) ]))
@ -275,7 +316,7 @@ export const DemandforecastingDetail = useCrudSchemas(reactive<CrudSchema[]>([
dictType: DICT_TYPE.PREDICT_TIME_TYPE, dictType: DICT_TYPE.PREDICT_TIME_TYPE,
sort: 'custom', sort: 'custom',
dictClass: 'string', dictClass: 'string',
isTable: true, isTable: false,
table: { table: {
width: 150 width: 150
}, },
@ -294,6 +335,7 @@ export const DemandforecastingDetail = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 180 width: 180
}, },
isTable:false,
form: { form: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@ -309,117 +351,7 @@ export const DemandforecastingDetail = useCrudSchemas(reactive<CrudSchema[]>([
valueFormat: 'x', valueFormat: 'x',
} }
}, },
{
label: '订单号',
field: 'poNumber',
sort: 'custom',
table: {
width: 150
},
tableForm: {
isInpuFocusShow: true,
searchListPlaceholder: '请选择订单号',
searchField: 'number',
searchTitle: '采购订单信息',
searchAllSchemas: PurchaseMain.allSchemas,
searchPage: PurchaseMainApi.getPurchaseMainPage,
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}, {
key: 'supplierCode',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
}
, {
key: 'status',
value: 2,
isMainValue: false
}
]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true,
searchListPlaceholder: '请选择订单号',
searchField: 'number',
searchTitle: '采购订单信息',
searchAllSchemas: PurchaseMain.allSchemas,
searchPage: PurchaseMainApi.getPurchaseMainPage,
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
{
label: '订单行',
field: 'poLine',
sort: 'custom',
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true,
searchListPlaceholder: '请选择订单行',
searchField: 'lineNumber',
searchTitle: '采购订单信息',
searchAllSchemas: PurchaseDetail.allSchemas,
searchPage: PurchaseDetailApi.getPurchaseDetailPage,
searchCondition: [{
key: 'number',
value: 'poNumber',
message: '请填写订单号!',
isMainValue: true
}, {
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
tableForm: {
isInpuFocusShow: true,
searchListPlaceholder: '请选择订单行',
searchField: 'lineNumber',
searchTitle: '采购订单信息',
searchAllSchemas: PurchaseDetail.allSchemas,
searchPage: PurchaseDetailApi.getPurchaseDetailPage,
searchCondition: [{
key: 'number',
value: 'poNumber',
message: '请填写订单号!',
isMainValue: true
}, {
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true
}
},
{ {
label: '计量单位', label: '计量单位',
field: 'uom', field: 'uom',

398
src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue

@ -1,19 +1,18 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="[...DemandforecastingMain.allSchemas.searchSchema,...DemandforecastingDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> <Search ref="seachRef" :showSearchTableQueryFields="['supplierCode','itemCode','version']" :hiddenFilterBtnFields="['supplierCode','itemCode','version']" :schema="DemandforecastingMain.allSchemas.searchSchema" @search="searchClick" @reset="searchClick" @searchTableSuccess="searchQueryTableSuccess" @onChange="onSearchChange"/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead
:HeadButttondata="HeadButttondata" :HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick" @button-base-click="buttonBaseClick"
:routeName="routeName" :routeName="routeName"
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="DemandforecastingMain.allSchemas" :allSchemas="DemandforecastingMain.allSchemas"
:detailAllSchemas="DemandforecastingDetail.allSchemas" />
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
@ -28,58 +27,13 @@
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
> >
<template #number="{row}"> <template v-for="name in tableObjectHead.tableList" :key="name" #[name]="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> <span :class="{'success-text':row['planType_F'].indexOf(name)>-1}">{{ row[name] }}</span>
<span>{{ row.number }}</span> </template>
</el-button>
</template>
<template #action="{ row,$index }">
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
@success="getList"
:rules="DemandforecastingMainRules"
:formAllSchemas="DemandforecastingMain.allSchemas"
:tableAllSchemas="DemandforecastingDetail.allSchemas"
:tableFormRules="DemandforecastingDetailRules"
:tableData="tableData"
:apiUpdate="DemandforecastingMainApi.updateDemandforecastingMain"
:apiCreate="DemandforecastingMainApi.createDemandforecastingMain"
:isBusiness="true"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
:isShowReduceButtonSelection="true"
@tableSelectionDelete="tableSelectionDelete"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="DemandforecastingMain.allSchemas"
:detailAllSchemas="DemandforecastingDetail.allSchemas"
:detailAllSchemasRules="DemandforecastingDetailRules"
:apiCreate="DemandforecastingDetailApi.createDemandforecastingDetail"
:apiUpdate="DemandforecastingDetailApi.updateDemandforecastingDetail"
:apiPage="DemandforecastingDetailApi.getDemandforecastingDetailPage"
:apiDelete="DemandforecastingDetailApi.deleteDemandforecastingDetail"
:Echo="Echo"
:detailButtonIsShowAdd="false"
:detailButtonIsShowEdit="false"
:detailButtonIsShowDelete="false"
@searchTableSuccessDetail="searchTableSuccessDetail"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/demandforecasting-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -98,45 +52,68 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref([...DemandforecastingMain.allSchemas.tableColumns,...DemandforecastingDetail.allSchemas.tableMainColumns]) const orginTableColumns = ref(DemandforecastingMain.allSchemas.tableColumns)
const tableColumns = ref(DemandforecastingMain.allSchemas.tableColumns)
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val orginTableColumns.value = val
} }
// //
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { const searchQueryTableSuccess = (formField, searchField, val, formRef, type, row ) => {
console.log('searchQueryTableSuccess',formField, searchField, val, formRef, type, row )
nextTick(() => { nextTick(() => {
if (type == 'tableForm') { const setV = {}
// if(formField == 'supplierCode'||formField == 'itemCode'||formField == 'version'){
row[formField] = val[0][searchField] //
if (formField == 'poLine') { let list = []
row['itemCode'] = val[0]['itemCode'] val.forEach(item=>{
row['uom'] = val[0]['uom'] list.push(item[searchField])
row['available'] = val[0]['available'] })
} setV[formField] = list.join(' ')
} else { formRef.setValues(setV)
const setV = {} }else{
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
formRef.setValues(setV) formRef.setValues(setV)
} }
}) })
} }
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
setV['itemCode'] = val[0]['code']
formRef.setValues(setV)
})
}
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
const { tableObject:tableObjectHead, tableMethods:tableMethodsHead } = useTable({
getListApi: DemandforecastingDetailApi.getPageTableHead //
})
//
const { getList:getListHead, setSearchParams:setSearchParamsHead } = tableMethodsHead
watch(()=>tableObjectHead.tableList,()=>{
updateDateTableColumns()
},{deep:true})
const updateDateTableColumns = ()=>{
console.log('tableObjectHead',tableObjectHead)
let dateColumns = []
if(tableObjectHead.tableList.length>10){
tableObjectHead.tableList.forEach(item=>{
dateColumns.push({
width:120,
field: item,
label: item
})
})
}else{
tableObjectHead.tableList.forEach(item=>{
dateColumns.push({
field: item,
label: item
})
})
}
tableColumns.value = [...orginTableColumns.value,...dateColumns]
console.log('tableColumns',tableColumns.value)
}
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: DemandforecastingDetailApi.getDemandforecastingDetailPage // getListApi: DemandforecastingDetailApi.getDemandforecastingDetailPage //
}) })
@ -146,29 +123,15 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:demandforecasting-main:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:demandforecasting-main:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:demandforecasting-main:export'}), // defaultButtons.defaultExportBtn({hasPermi:'wms:demandforecasting-main:export'}), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
] ]
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = async (val, item) => {
if (val == 'add') { // if (val == 'export') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
@ -176,7 +139,10 @@ const buttonBaseClick = (val, item) => {
filters: tableObject.params.filters filters: tableObject.params.filters
}) })
} else { } else {
await getListHead()
// updateDateTableColumns()
getList() getList()
} }
} else if (val == 'filtrate') { // } else if (val == 'filtrate') { //
} else { // } else { //
@ -184,148 +150,30 @@ const buttonBaseClick = (val, 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.mainListOrderCloBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListOrderOpeBtn({ hide: isShowMainButton(row, ['3']) }), //
defaultButtons.mainListOrderPubBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListOrderWitBtn({ hide: isShowMainButton(row, ['2']) }), //
defaultButtons.mainListEditBtn({ hasPermi: 'wms:demandforecasting-main:update', hide: isShowMainButton(row, ['1']) }), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainOrderClo') { //
handleClose(row.masterId)
} else if (val == 'mainOrderOpe') { //
handleOpen(row.masterId)
} else if (val == 'mainOrderPub') { //
handlePublish(row.masterId)
} else if (val == 'mainOrderWit') { //
handleWit(row.masterId)
} else if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.masterId)
}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm =async (type: string, row?: number) => {
tableData.value = [] //
formRef.value.open(type, row)
}
/** 关闭按钮操作 */ const seachRef = ref()
const handleClose = async (id : number) => { const onSearchChange = (field, value)=>{
try { if(field=='planerId'){
// if(value.length>0){
await message.confirm(t('ts.是否关闭所选中数据?')) if(value[value.length-1]=='ALL'){
tableObject.loading = true //
// seachRef.value.setFormValues({
await DemandforecastingMainApi.closePurchaseMain(id) planerId:['ALL']
message.success(t('ts.关闭成功!')) })
tableObject.loading = false }else{
// seachRef.value.setFormValues({
await getList() planerId:value.filter(item=>item!='ALL')
} catch { }finally{ })
tableObject.loading = false }
}
}
/** 打开按钮操作 */
const handleOpen = async (id : number) => {
try {
//
await message.confirm(t('ts.是否打开所选中数据?'))
tableObject.loading = true
//
await DemandforecastingMainApi.openPurchaseMain(id)
message.success(t('ts.打开成功!'))
tableObject.loading = false
//
await getList()
} catch { }finally{
tableObject.loading = false
}
}
/** 发布按钮操作 */
const handlePublish = async (id : number) => {
try {
//
await message.confirm(t('ts.是否发布所选中数据?'))
tableObject.loading = true
//
await DemandforecastingMainApi.publishPurchaseMain(id)
message.success(t('ts.发布成功!'))
tableObject.loading = false
//
await getList()
} catch { }finally{
tableObject.loading = false
}
}
/** 下架按钮操作 */
const handleWit = async (id : number) => {
try {
//
await message.confirm(t('ts.是否下架所选中数据?'))
tableObject.loading = true
//
await DemandforecastingMainApi.witPurchaseMain(id)
message.success(t('ts.下架成功!'))
tableObject.loading = false
//
await getList()
} catch { }finally{
tableObject.loading = false
} }
} }
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue,'planDemandforecastingMain')
} }
const searchClick = async (data)=>{
/** 删除按钮操作 */ console.log('searchClick',data)
const handleDelete = async (id: number) => { await setSearchParamsHead(data)
try { // updateDateTableColumns()
// setSearchParams(data)
await message.delConfirm()
tableObject.loading = true
//
await DemandforecastingMainApi.deleteDemandforecastingMain(id)
message.success(t('common.delSuccess'))
tableObject.loading = false
//
await getList()
} catch {}finally{
tableObject.loading = false
}
} }
/** 导出按钮操作 */ /** 导出按钮操作 */
const exportLoading = ref(false) // const exportLoading = ref(false) //
const handleExport = async () => { const handleExport = async () => {
@ -342,60 +190,6 @@ const handleExport = async () => {
} }
} }
/**
* tableForm方法
*/
const tableFormKeys = {}
DemandforecastingDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
//
const handleDeleteTable = (item, index) => {
let itemIndex = tableData.value.indexOf(item)
if(itemIndex>-1){
tableData.value.splice(itemIndex, 1)
}
}
const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item))
}
//
const submitForm = async (formType, submitData) => {
let data = {...submitData}
if(data.masterId){
data.id = data.masterId
}
data.subList = tableData.value //
try {
if (formType === 'create') {
await DemandforecastingMainApi.createDemandforecastingMain(data)
message.success(t('common.createSuccess'))
} else {
data.id = data.masterId
await DemandforecastingMainApi.updateDemandforecastingMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
// //
const importTemplateData = reactive({ const importTemplateData = reactive({
@ -403,11 +197,6 @@ const importTemplateData = reactive({
templateTitle: `${t('ts.要货预测主导入模版')}.xlsx` templateTitle: `${t('ts.要货预测主导入模版')}.xlsx`
}) })
//
const importSuccess = () => {
getList()
}
// //
const searchFormClick = (searchData) => { const searchFormClick = (searchData) => {
tableObject.params = { tableObject.params = {
@ -419,7 +208,20 @@ const searchFormClick = (searchData) => {
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
try {
await getListHead()
} catch (error) {
}
// updateDateTableColumns()
getList() getList()
importTemplateData.templateUrl = await DemandforecastingMainApi.importTemplate() importTemplateData.templateUrl = await DemandforecastingMainApi.importTemplate()
}) })
</script> </script>
<style lang="scss" scoped>
.success-text{
color:var(--el-color-success);
font-weight:700;
}
</style>

399
src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingSupplierMain/demandforecastingMain.data.ts

@ -0,0 +1,399 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter,dateFormatter2 } from '@/utils/formatTime'
import * as SupplierApi from '@/api/wms/supplier'
import { Supplier} from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as SupplieritemApi from '@/api/wms/supplieritem'
import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data'
import * as ItembasicApi from '@/api/wms/itembasic'
import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data";
import * as PurchaseMainApi from '@/api/wms/purchaseMain'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
import { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data'
import * as DemandforecastingMainApi from '@/api/wms/demandforecastingMain'
import * as DemandforecastingDetailApi from '@/api/wms/demandforecastingDetail'
import dayjs from 'dayjs'
const { t } = useI18n() // 国际化
/**
* @returns {Array}
*/
Supplieritem.allSchemas.searchSchema = Supplieritem.allSchemas.searchSchema.filter(item=>item.field!="allowOverShipment")
export const Version = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '供应商代码',
field: 'supplerCodes',
sort: 'custom',
isSearch:true,
},
{
label: '订单号',
field: 'poNumber',
sort: 'custom',
isSearch:true,
},
{
label: '订单行',
field: 'poLine',
sort: 'custom',
},
{
label: '物料代码',
field: 'itemCode',
isSearch:true,
sort: 'custom',
},
{
label: '子表版本',
field: 'detailVersion',
sort: 'custom',
}
]))
export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '是否已读',
field: 'isRead',
sort: 'custom',
table: {
width: 150
},
},
{
label: '订单号',
field: 'poNumber',
sort: 'custom',
table: {
width: 150
},
},
{
label: '订单行',
field: 'poLine',
sort: 'custom',
table: {
width: 150
}
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
isSearch:true,
isTable:true,
isForm: false,
search: {
// labelMessage: '信息提示说明!!!',
componentProps: {
multiple: true,
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'itemCode', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Supplieritem.allSchemas, // 查询弹窗所需类
searchPage: SupplieritemApi.getSupplieritemPageSCP, // 查询弹窗所需分页方法
searchCondition: [{
key: 'supplierCodes',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
{
label: '版本号',
field: 'version',
sort: 'custom',
table: {
width: 150
},
isSearch:true,
search: {
// labelMessage: '信息提示说明!!!',
componentProps: {
multiple: true,
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择版本号', // 输入框占位文本
searchField: 'detailVersion', // 查询弹窗赋值字段
searchTitle: '版本号', // 查询弹窗标题
searchAllSchemas: Version.allSchemas, // 查询弹窗所需类
searchPage: DemandforecastingDetailApi.queryVersion, // 查询弹窗所需分页方法
searchCondition: [{
key: 'supplierCodes',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'itemCodes',
value: 'itemCode',
message: '请填写物料代码!',
isMainValue: true,
isCSV:true,//是否用逗号分隔参数
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
{
label: '到货日期',
field: 'dueDate',
formatter: dateFormatter,
sort: 'custom',
table: {
width: 150
},
isSearch:true,
isTable:false,
isForm: false,
search: {
value: [dayjs(), dayjs().subtract(-3,'month')],
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD',
type: 'daterange',
defaultTime: [new Date('1 '), new Date('1 ')]
}
},
}
]))
//表单校验
export const DemandforecastingMainRules = reactive({
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
supplierCode: [
{ required: true, message: '请选择供应商代码', trigger: 'change' }
],
version: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
})
/**
* @returns {Array}
*/
export const DemandforecastingDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
table: {
width: 180
},
isTableForm: false,
hiddenInMain:true,
form: {
componentProps: {
disbaled: true
}
}
},
{
label: '预测时间类型',
field: 'predictTimeType',
dictType: DICT_TYPE.PREDICT_TIME_TYPE,
sort: 'custom',
dictClass: 'string',
isTable: false,
table: {
width: 150
},
tableForm: {
type: 'Select'
}
},
{
label: '预测日期',
field: 'predictTime',
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
sort: 'custom',
table: {
width: 180
},
isTable:false,
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
tableForm: {
type: 'FormDate',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
table: {
width: 150
},
tableForm: {
type: 'Select',
disabled: true
}
},
{
label: '计划数量',
field: 'planQty',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
tableForm: {
type: 'InputNumber',
min: 1,
precision: 6
}
},
{
label: '备注',
field: 'remark',
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: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isTableForm: false,
isForm: false,
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '最后更新时间',
field: 'updateTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isTableForm: false,
isForm: false,
},
{
label: '最后更新者',
field: 'updater',
sort: 'custom',
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '操作',
hiddenInMain:true,
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 150,
fixed: 'right'
},
isTableForm: false,
}
]))
//表单校验
export const DemandforecastingDetailRules = reactive({
predictTimeType: [
{ required: true, message: '请选择预测时间类型', trigger: 'change' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
predictTime: [
{ required: true, message: '请输入预测时间', trigger: 'change' }
],
planQty: [
{ required: true, message: '请输入计划数量', trigger: 'blur' }
],
uom: [
{ required: true, message: '请选择计量单位', trigger: 'change' }
],
number: [
{ required: true, message: '请输入单据号', trigger: 'blur' }
],
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
poLine: [{required:true, message: '请选择订单行', trigger: 'blur'}]
})

285
src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingSupplierMain/index.vue

@ -0,0 +1,285 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :showSearchTableQueryFields="['supplierCode','itemCode','version']" :hiddenFilterBtnFields="['supplierCode','itemCode','version']" :schema="DemandforecastingMain.allSchemas.searchSchema" @search="searchClick" @reset="searchClick" @searchTableSuccess="searchQueryTableSuccess"/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DemandforecastingMain.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table ref="tableRef" v-clientTable
:selection="true"
: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"
@getSelectionRows="getSelectionRows"
>
<template #isRead="{row}" >
<el-button v-show="row.isRead!=2" :type="row.isRead==1?'info':'primary'" link @click="readHandle(row,false)">
<span>{{ row.isRead==1?'已读':'未读' }}</span>
</el-button>
</template>
<template v-for="name in tableObjectHead.tableList" :key="name" #[name]="{row}">
<span :class="{'success-text':row['planType_F'].indexOf(name)>-1}">{{ row[name] }}</span>
</template>
</Table>
</ContentWrap>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { DemandforecastingMain,DemandforecastingMainRules,DemandforecastingDetail,DemandforecastingDetailRules } from './demandforecastingMain.data'
import * as DemandforecastingMainApi from '@/api/wms/demandforecastingMain'
import * as DemandforecastingDetailApi from '@/api/wms/demandforecastingDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
//
defineOptions({ name: 'DemandforecastingMain' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const orginTableColumns = ref(DemandforecastingMain.allSchemas.tableColumns)
const tableColumns = ref(DemandforecastingMain.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
orginTableColumns.value = val
}
//
const searchQueryTableSuccess = (formField, searchField, val, formRef, type, row ) => {
console.log('searchQueryTableSuccess',formField, searchField, val, formRef, type, row )
nextTick(() => {
const setV = {}
if(formField == 'supplierCode'||formField == 'itemCode'||formField == 'version'){
//
let list = []
val.forEach(item=>{
list.push(item[searchField])
})
setV[formField] = list.join(' ')
formRef.setValues(setV)
}else{
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
})
}
const { tableObject:tableObjectHead, tableMethods:tableMethodsHead } = useTable({
getListApi: DemandforecastingDetailApi.getPageTableHead //
})
//
const { getList:getListHead, setSearchParams:setSearchParamsHead } = tableMethodsHead
watch(()=>tableObjectHead.tableList,()=>{
updateDateTableColumns()
},{deep:true})
const updateDateTableColumns = ()=>{
console.log('tableObjectHead',tableObjectHead)
let dateColumns = []
if(tableObjectHead.tableList.length>10){
tableObjectHead.tableList.forEach(item=>{
dateColumns.push({
width:120,
field: item,
label: item
})
})
}else{
tableObjectHead.tableList.forEach(item=>{
dateColumns.push({
field: item,
label: item
})
})
}
tableColumns.value = [...orginTableColumns.value,...dateColumns]
console.log('tableColumns',tableColumns.value)
}
const { tableObject, tableMethods } = useTable({
getListApi: DemandforecastingDetailApi.getDemandforecastingDetailPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultExportBtn({hasPermi:'wms:demandforecasting-main:export'}), //
defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
{
label: t('ts.全部已读'),
name: 'read',
hide: false,
type: 'primary',
// icon: 'ep:operation',
color: '',
float:'left',
link: false, //
hasPermi: ''
}
]
//
const buttonBaseClick = async (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 {
await getListHead()
// updateDateTableColumns()
getList()
}
} else if (val == 'filtrate') { //
} else if (val == 'read') { //
readHandle(null,true)
} else { //
console.log('其他按钮', item)
}
}
const searchClick = async (data)=>{
console.log('searchClick',data)
await setSearchParamsHead(data)
// updateDateTableColumns()
setSearchParams(data)
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await DemandforecastingMainApi.exportDemandforecastingMain(tableObject.params)
download.excel(data, `${t('ts.要货预测主')}.xlsx`)
} catch {
} finally {
exportLoading.value = false
}
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: `${t('ts.要货预测主导入模版')}.xlsx`
})
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
const selectionRows = ref<any>([])
const tableRef = ref()
const getSelectionRows = (currentPage,currentPageSelectionRows) => {
console.log("getSelectionRows",currentPage,currentPageSelectionRows)
const currentRows = selectionRows.value.find(item=>item.currentPage==currentPage)
if(currentRows){
currentRows.selectionRows = currentPageSelectionRows
}else{
selectionRows.value.push({
currentPage,
selectionRows:currentPageSelectionRows
})
}
}
const readHandle = (row,isAll)=>{
let rows:any = []
if(isAll){
//
if(selectionRows.value==0){
return
}
selectionRows.value.forEach(item=>{
let itemSelectionRows = item.selectionRows.filter(item1=>item1.isRead==0)
console.log('itemSelectionRows',itemSelectionRows)
rows = [...rows,...itemSelectionRows.map(item1=>item1.mainId)]
})
console.log('selectionRows',selectionRows)
console.log('全部已读',rows.join(','))
}else{
//
if(row.isRead==1){
return
}
rows = [row.mainId]
console.log('已读',rows.join(','))
}
let getLoading = ElLoading.service({
lock: true,
text: 'loading...',
background: 'rgba(0, 0, 0, 0.7)'
})
DemandforecastingMainApi.updateIsRead({isReadMainIds:rows.join(',')}).then(res => {
console.log('res',res);
getLoading?.close()
getList()
if(isAll){
selectionRows.value = []
}
}).catch(err => {
console.log(err)
getLoading?.close()
})
}
/** 初始化 **/
onMounted(async () => {
await getListHead()
// updateDateTableColumns()
getList()
importTemplateData.templateUrl = await DemandforecastingMainApi.importTemplate()
})
</script>
<style lang="scss" scoped>
.success-text{
color:var(--el-color-success);
font-weight:700;
}
</style>

205
src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="[...PurchasePlanMain.allSchemas.searchSchema,...PurchasePlanDetail.allSchemas.searchSchema]" @search="searchList" @reset="searchList" /> <Search ref="seachRef" :schema="[...PurchasePlanMain.allSchemas.searchSchema,...PurchasePlanDetail.allSchemas.searchSchema]" @search="searchList" @reset="searchList" @searchTableSuccess="searchQueryTableSuccess" @onChange="onSearchChange"/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
@ -22,9 +22,9 @@
v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
@getSelectionRows="getSelectionRows"> @getSelectionRows="getSelectionRows">
<template #number="{row}"> <template #supplierCode="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> <el-button type="primary" link @click="openDetail(row, '供应商代码', row.supplierCode)">
<span>{{ row.number }}</span> <span>{{ row.supplierCode }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row,$index }"> <template #action="{ row,$index }">
@ -45,13 +45,16 @@
:apiUpdate="PurchasePlanMainApi.updatePurchasePlanMain" :apiUpdate="PurchasePlanMainApi.updatePurchasePlanMain"
:apiCreate="PurchasePlanMainApi.createPurchasePlanMain" :apiCreate="PurchasePlanMainApi.createPurchasePlanMain"
:isBusiness="true" :isBusiness="true"
:isShowReduceButtonSelection="false"
:isShowReduceButton="false"
:isShowButton="false"
@handleAddTable="handleAddTable" @handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable" @handleDeleteTable="handleDeleteTable"
:isShowReduceButtonSelection="true"
@tableSelectionDelete="tableSelectionDelete" @tableSelectionDelete="tableSelectionDelete"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
@submitForm="submitForm" @submitForm="submitForm"
@onEnter="onEnter"/> @onEnter="onEnter"
@onBlur="onEnter"/>
<!-- 详情 --> <!-- 详情 -->
<!-- 隐藏子表编辑和删除是因为要货计划以后是接口发过来的而且我们的计划数量是放入到采购订单已计划数量里无法再次编辑数量--> <!-- 隐藏子表编辑和删除是因为要货计划以后是接口发过来的而且我们的计划数量是放入到采购订单已计划数量里无法再次编辑数量-->
@ -67,8 +70,13 @@
:apiDelete="PurchasePlanDetailApi.deletePurchasePlanDetail" :apiDelete="PurchasePlanDetailApi.deletePurchasePlanDetail"
@searchTableSuccessDetail="searchTableSuccessDetail" @searchTableSuccessDetail="searchTableSuccessDetail"
:detailValidate="detailValidate" :detailValidate="detailValidate"
:detailButtonIsShowDelete="false" :detailButtonIsShowAddStatusArray="['1','3','4','5','6']"
:detailButtonIsShowEdit="false" :detailButtonIsShowEdit="true"
:detailButtonIsShowDelete="true"
:detailButtonIsShowAdd="true"
:isOpenSearchTable="true"
fieldTableColumn="poLine"
/> />
<!-- 导入 --> <!-- 导入 -->
@ -91,6 +99,7 @@
import supplierdeliverBasicForm from '../supplierdeliverRequestMain/supplierdeliverBasicForm.vue' import supplierdeliverBasicForm from '../supplierdeliverRequestMain/supplierdeliverBasicForm.vue'
import * as PurchaseMainApi from '@/api/wms/purchaseMain' import * as PurchaseMainApi from '@/api/wms/purchaseMain'
import { PurchaseMain } from '../purchaseMain/purchaseMain.data' import { PurchaseMain } from '../purchaseMain/purchaseMain.data'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
// //
defineOptions({ name: 'PurchasePlanMain' }) defineOptions({ name: 'PurchasePlanMain' })
@ -106,6 +115,31 @@
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val tableColumns.value = val
} }
const seachRef = ref()
const onSearchChange = (field, value)=>{
if(field=='status'){
if(value.length>0){
if(value[value.length-1]==''){
//
seachRef.value.setFormValues({
status:['']
})
}else{
seachRef.value.setFormValues({
status:value.filter(item=>item!='')
})
}
}
}
}
const searchQueryTableSuccess = (formField, searchField, val, formRef, type, row ) => {
console.log('searchQueryTableSuccess',formField, searchField, val, formRef, type, row )
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
// //
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
@ -149,14 +183,18 @@
if(formField == 'supplierCode'){ if(formField == 'supplierCode'){
setV['supplierCode'] = val[0]['code'] setV['supplierCode'] = val[0]['code']
await PurchasePlanMainApi.queryPurchasePlan(val[0]['code']).then(res => { await PurchasePlanMainApi.queryPurchasePlan(val[0]['code']).then(res => {
let beginTime = res.beginTime
var ms = beginTime.substring(0, 2) // let beginTime = res.beginTime
var me = beginTime.substring(3) // var ms = beginTime.substring(0, 2)
setV['beginTime'] = new Date(2024, 1, 1, Number(ms), Number(me)) // var me = beginTime.substring(3)
let endTime = res.endTime // setV['beginTime'] = new Date(2024, 1, 1, Number(ms), Number(me))
var ms = endTime.substring(0, 2) // let endTime = res.endTime
var me = endTime.substring(3) // var ms = endTime.substring(0, 2)
setV['endTime'] = new Date(2024, 1, 1, Number(ms), Number(me)) // var me = endTime.substring(3)
// setV['endTime'] = new Date(2024, 1, 1, Number(ms), Number(me))
setV['timeWindow'] = res.timeWindow
setV['beginTime'] = res.beginTime
setV['endTime'] = res.endTime
setV['contacts'] = res.contacts setV['contacts'] = res.contacts
setV['phone'] = res.phone setV['phone'] = res.phone
}) })
@ -169,6 +207,10 @@
setV['planQty'] = val[0]['orderQty']-val[0]['plannedQty'] setV['planQty'] = val[0]['orderQty']-val[0]['plannedQty']
setV['available'] = val[0]['available'] setV['available'] = val[0]['available']
} }
if(formField == 'poNumber') {
//
setV['type'] = val[0]['type']
}
formRef.setValues(setV) formRef.setValues(setV)
console.log('formModel',formRef.formModel) console.log('formModel',formRef.formModel)
if(formField == 'poNumber') { if(formField == 'poNumber') {
@ -182,7 +224,7 @@
const getSearchTableData = async (number,formField,searchField)=>{ const getSearchTableData = async (number,formField,searchField)=>{
const {tableObject ,tableMethods} = useTable({ const {tableObject ,tableMethods} = useTable({
defaultParams:{number}, defaultParams:{number,available:'TRUE'},
getListApi: PurchaseDetailApi.getPurchaseDetailPagePoNumber // getListApi: PurchaseDetailApi.getPurchaseDetailPagePoNumber //
}) })
tableObject.pageSize = 500 tableObject.pageSize = 500
@ -250,7 +292,9 @@ const getSearchTableData = async (number,formField,searchField)=>{
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({ hasPermi: 'wms:purchase-plan-main:create' }), // defaultButtons.defaultAddBtn({ hasPermi: 'wms:purchase-plan-main:create' }), //
defaultButtons.defaultImportBtn({ hasPermi: 'wms:purchase-plan-main:import' }), // defaultButtons.defaultImportBtn({ hasPermi: 'wms:purchase-plan-main:import' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'wms:purchase-plan-main:export' }), // // defaultButtons.defaultExportBtn({ hasPermi: 'wms:purchase-plan-main:export' }), //
defaultButtons.defaultExportDetailsBtn({ hasPermi: 'wms:purchase-plan-main:export' }), //
defaultButtons.defaultExportTableBtn({ hasPermi: 'wms:purchase-plan-main:export' }), //
// defaultButtons.mainListSelectionOrderPubBtn(null), // // defaultButtons.mainListSelectionOrderPubBtn(null), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
@ -274,6 +318,10 @@ const getSearchTableData = async (number,formField,searchField)=>{
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') { //
handleExport() handleExport()
} else if (val == 'export-details') { //
handleExportDetails()
} else if (val == 'export-table') { //
handleExportTable()
} else if (val == 'refresh') { // } else if (val == 'refresh') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
searchFormClick({ searchFormClick({
@ -306,14 +354,14 @@ const getSearchTableData = async (number,formField,searchField)=>{
return [] return []
} }
return [ return [
defaultButtons.mainListPurchasePlanOpeBtn({ hide: isShowMainButton(row, ['2']) }), // // defaultButtons.mainListPurchasePlanOpeBtn({ hide: isShowMainButton(row, ['2']) }), //
defaultButtons.mainListPurchasePlanCloBtn({ hide: isShowMainButton(row, ['1']) }), // defaultButtons.mainListPurchasePlanCloBtn({ hide: !(row.status!=6&&row.status!=2&&row.type=='SCHEDULE') }), //
defaultButtons.mainListPurchasePlanPubBtn({ hide: isShowMainButton(row, ['1']) }), // defaultButtons.mainListPurchasePlanPubBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListPurchasePlanAccBtn({ hide: isShowMainButton(row, ['3']) }), // defaultButtons.mainListPurchasePlanAccBtn({ hide: isShowMainButton(row, ['3']) }), //
defaultButtons.mainListPurchasePlanRejBtn({ hide: isShowMainButton(row, ['3']) }), // defaultButtons.mainListPurchasePlanRejBtn({ hide: isShowMainButton(row, ['3']) }), //
defaultButtons.mainListPurchasePlanWitBtn({ hide: isShowMainButton(row, ['3']) }), // defaultButtons.mainListPurchasePlanWitBtn({ hide: isShowMainButton(row, ['3']) }), //
defaultButtons.mainListPurchasePlanModBtn({ hide: isShowMainButton(row, ['5']) }), // defaultButtons.mainListPurchasePlanModBtn({ hide: isShowMainButton(row, ['5']) }), //
// defaultButtons.mainListEditBtn({ hide: isShowMainButton(row, ['1']), hasPermi: 'wms:purchase-plan-main:update' }), // defaultButtons.mainListEditBtn({ hide: !isShowMainButton(row, ['2']), hasPermi: 'wms:purchase-plan-main:update' }), //
// defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchase-plan-main:delete'}), // // defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:purchase-plan-main:delete'}), //
{ {
label: t('ts.创建供应商发货申请'), label: t('ts.创建供应商发货申请'),
@ -352,12 +400,14 @@ const getSearchTableData = async (number,formField,searchField)=>{
} else if (val == 'supplierdeliver') { // } else if (val == 'supplierdeliver') { //
supplierdeliverFormRef.value.openFormByCreate({ supplierdeliverFormRef.value.openFormByCreate({
number:row.number, // number:row.number, //
poNumber:row.poNumber, //
supplierCode:row.supplierCode, // supplierCode:row.supplierCode, //
endTime:row.endTime, // endTime:row.endTime, //
deliveryDate:row.deliveryDate // deliveryDate:row.deliveryDate //
}) })
} }
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
const openForm = async (type : string, row ?: number) => { const openForm = async (type : string, row ?: number) => {
@ -365,7 +415,22 @@ const getSearchTableData = async (number,formField,searchField)=>{
formRef.value.open(type, row) formRef.value.open(type, row)
if('create'==type){ if('create'==type){
nextTick(async () => { nextTick(async () => {
formRef.value.formRef.setValues({deliveryDate:dayjs().format('YYYY-MM-DD')}) formRef.value.formRef.setValues({deliveryDate:dayjs().valueOf()})
})
PurchasePlanMain.allSchemas.formSchema.forEach((item) => {
//
if(item.field == 'supplierCode'){
item.componentProps.disabled = false
item.componentProps.isSearchList = true
}
})
}else{
PurchasePlanMain.allSchemas.formSchema.forEach((item) => {
//
if(item.field == 'supplierCode'){
item.componentProps.disabled = true
item.componentProps.isSearchList = false
}
}) })
} }
} }
@ -569,6 +634,33 @@ const handleSelectionPublish = async ()=>{
} }
} }
const handleExportDetails = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await PurchasePlanMainApi.exportDetailsPurchasePlanMain(tableObject.params)
download.excel(data, `${t('ts.要货计划明细')}.xlsx`)
} catch {
} finally {
exportLoading.value = false
}
}
const handleExportTable = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await PurchasePlanMainApi.exportTablePurchasePlanMain(tableObject.params)
download.excel(data, `${t('ts.要货计划二维表')}.xlsx`)
} catch {
} finally {
exportLoading.value = false
}
}
/** /**
* tableForm方法 * tableForm方法
*/ */
@ -624,47 +716,48 @@ const handleSelectionPublish = async ()=>{
data.subList = [] data.subList = []
let flag = false let flag = false
for (let item of tableData.value) { for (let item of tableData.value) {
await PurchaseDetailApi.getPurchaseDetailPageCheckData({ if(item.planQty>0){
number: item.poNumber, data.subList.push(item) //
lineNumber: item.poLine, }
}).then(res => { // await PurchaseDetailApi.getPurchaseDetailPageCheckData({
console.log("【要货计划】-每条数据结果",item) // number: item.poNumber,
if(res.list[0].type == 'DISCRETE'){// // lineNumber: item.poLine,
if (item.planQty > res.list[0].orderQty - res.list[0].plannedQty) { // }).then(res => {
flag = true; // console.log("-",item)
message.error(t('ts.要货计划数量不得大于订单数量-已计划数量')) // if(res.list[0].type == 'DISCRETE'){//
return // if (item.planQty > res.list[0].orderQty - res.list[0].plannedQty) {
}else{ // flag = true;
data.subList.push(item) // // message.error(t('ts.-'))
} // return
}else{ // }else{
data.subList.push(item) // // data.subList.push(item) //
} // }
}) // }else{
// data.subList.push(item) //
// }
// })
} }
if(flag){ if(flag){
formRef.value.formLoading = false formRef.value.formLoading = false
return; return;
} }
if (data.subList.length == tableData.value.length) { try {
try { if (formType === 'create') {
if (formType === 'create') { if(data.subList.length == 0){
if(data.subList.length == 0){ message.error(t('ts.子列表数量不能空'))
message.error(t('ts.子列表数量不能空')) return
return
}
await PurchasePlanMainApi.createPurchasePlanMain(data)
message.success(t('common.createSuccess'))
} else {
await PurchasePlanMainApi.updatePurchasePlanMain(data)
message.success(t('common.updateSuccess'))
} }
formRef.value.dialogVisible = false await PurchasePlanMainApi.createPurchasePlanMain(data)
// message.success(t('common.createSuccess'))
getList() } else {
} finally { await PurchasePlanMainApi.updatePurchasePlanMain(data)
formRef.value.formLoading = false message.success(t('common.updateSuccess'))
} }
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
} }
formRef.value.formLoading = false formRef.value.formLoading = false
} }

321
src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/purchasePlanMain.data.ts

@ -6,31 +6,25 @@ import * as PurchaseMainApi from '@/api/wms/purchaseMain'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail' import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
import { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data' import { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data'
import {getPurchaseDetailPagePoNumber} from "@/api/wms/purchaseDetail"; import {getPurchaseDetailPagePoNumber} from "@/api/wms/purchaseDetail";
import * as ItembasicApi from '@/api/wms/itembasic'
import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data";
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
/** /**
* @returns {Array} * @returns {Array}
*/ */
export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
isForm: false,
table: {
width: 180,
fixed: 'left'
},
isSearch: true
},
{ {
label: '供应商代码', label: '供应商代码',
field: 'supplierCode', field: 'supplierCode',
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150,
fixed: 'left'
}, },
isSearch: true, isSearch: true,
sortTableDefault:1,
sortSearchDefault:1,
form: { form: {
labelMessage: '影响明细中物料代码,需在供应商物料中维护', labelMessage: '影响明细中物料代码,需在供应商物料中维护',
componentProps: { componentProps: {
@ -47,8 +41,59 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
isMainValue: false isMainValue: false
}] }]
} }
},
search: {
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPageSCP, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
} }
}, },
//仅是主列表页面的筛选搜索条件
{
label: '送达日期',
field: 'deliveryDate',
sort: 'custom',
isDetail:false,
isTable: false,
isForm:false,
isTableForm:false,
isSearch:true,
sortSearchDefault:3,
formatter: dateFormatter,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'datetimerange',
defaultTime: [new Date('1 '), new Date('1 ')]
}
},
},
{
label: '要货计划单号',
field: 'number',
sort: 'custom',
isForm: false,
table: {
width: 180,
},
sortTableDefault:8,
sortSearchDefault:4,
isSearch: true
},
{ {
label: '采购订单', label: '采购订单',
field: 'poNumber', field: 'poNumber',
@ -64,10 +109,14 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearchList: true, isSearchList: true,
searchListPlaceholder: '请选择采购订单', searchListPlaceholder: '请选择采购订单',
searchField: 'number', searchField: 'number',
searchTitle: '采购订单信息', searchTitle: '采购订单信息3',
searchAllSchemas: PurchaseMain.allSchemas, searchAllSchemas: PurchaseMain.allSchemas,
searchPage: PurchaseMainApi.getPurchaseMainPage, searchPage: PurchaseMainApi.getPurchaseMainPage,
searchCondition: [{ searchCondition: [{
key: 'type',
value: 'SCHEDULE',
isMainValue: false
},{
key: 'available', key: 'available',
value: 'TRUE', value: 'TRUE',
isMainValue: false isMainValue: false
@ -85,72 +134,71 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
{ {
label: '收货人', label: '送达日期',
field: 'contacts', field: 'deliveryDate',
isTable:false,
table: { table: {
width: 150 width: 180
}, },
formatter: dateFormatter,
sortTableDefault:2,
form: { form: {
component: 'DatePicker',
componentProps: { componentProps: {
disabled: false style: {width: '100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
} }
} },
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
}, },
{ {
label: '联系电话', label: '采购订单类型',
field: 'phone', field: 'type',
isTable:false, sort: 'custom',
dictType: DICT_TYPE.PURCHASE_ORDER_TYPE,
dictClass: 'string',
isTable: true,
isForm:true,
table: { table: {
width: 150 width: 150
}, },
form: { form: {
// labelMessage: '信息提示说明!!!',
componentProps: { componentProps: {
disabled: false disabled: true
} }
} }
}, },
//仅是主列表页面的筛选搜索条件
{ {
label: '送达日期', label: '收货人',
field: 'deliveryDate', field: 'contacts',
sort: 'custom', isTable:false,
isDetail:false, table: {
isTable: false, width: 150
isForm:false, },
isTableForm:false, form: {
isSearch:true,
formatter: dateFormatter,
search: {
component: 'DatePicker',
componentProps: { componentProps: {
valueFormat: 'YYYY-MM-DD', disabled: false
type: 'daterange',
defaultTime: [new Date('1 '), new Date('1 ')]
} }
}, }
}, },
{ {
label: '送达日期', label: '联系电话',
field: 'deliveryDate', field: 'phone',
isTable:false,
table: { table: {
width: 150 width: 150
}, },
sortTableDefault:1000,
formatter: dateFormatter2,
form: { form: {
component: 'DatePicker',
componentProps: { componentProps: {
style: {width: '100%'}, disabled: false
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
} }
}, }
detail: {
dateFormat: 'YYYY-MM-DD'
},
}, },
{ {
label: '时间窗口', label: '时间窗口',
field: 'timeWindow', field: 'timeWindow',
@ -167,7 +215,9 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150 width: 150
}, },
sortTableDefault:1001, isTable:false,
isForm:false,
isDetail:false,
form:{ form:{
component:"TimePicker", component:"TimePicker",
componentProps: { componentProps: {
@ -182,7 +232,9 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150 width: 150
}, },
sortTableDefault:1002, isTable:false,
isForm:false,
isDetail:false,
form:{ form:{
component:"TimePicker", component:"TimePicker",
componentProps: { componentProps: {
@ -234,10 +286,18 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
dictClass: 'string', dictClass: 'string',
isTable: true, isTable: true,
isForm:false, isForm:false,
isSearch: false, isSearch: true,
table: { table: {
width: 150 width: 150
}, },
sortTableDefault:13,
sortSearchDefault:6,
search:{
value:[],
componentProps: {
multiple:true
}
},
form: { form: {
value: '1', value: '1',
componentProps: { componentProps: {
@ -379,6 +439,8 @@ export const PurchasePlanMain = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
}, },
isTable: false, isTable: false,
isForm:false,
isDetail:false,
}, },
{ {
label: '操作', label: '操作',
@ -425,7 +487,7 @@ export const PurchasePlanMainRules = reactive({
*/ */
export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '单号', label: '要货计划单号',
field: 'number', field: 'number',
sort: 'custom', sort: 'custom',
isTableForm: false, isTableForm: false,
@ -443,9 +505,40 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
label: '采购订单号', label: '采购订单号',
field: 'poNumber', field: 'poNumber',
isSearch:true, isSearch:true,
isTable:false, isTable:true,
sortTableDefault:9,
sortSearchDefault:2,
isForm:false, isForm:false,
isTableForm:false isTableForm:false,
table: {
width: 150
},
search: {
// labelMessage: '信息提示说明!!!',
componentProps: {
dialogWidth:'1085px',//搜索出来弹窗的宽度
isSearchList: true,
searchListPlaceholder: '请选择采购订单',
searchField: 'number',
searchTitle: '采购订单信息5',
searchAllSchemas: PurchaseMain.allSchemas,
searchPage: PurchaseMainApi.getPurchaseMainPage,
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
},{
key: 'supplierCode',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
},{
key: 'status',
value: 2,
isMainValue: false
}]
}
}
}, },
{ {
label: '订单号', label: '订单号',
@ -454,12 +547,14 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 180 width: 180
}, },
hiddenInMain:true,
isTableForm:false,
tableForm: { tableForm: {
disabled: true, disabled: true,
isInpuFocusShow: false, isInpuFocusShow: false,
searchListPlaceholder: '请选择订单号', searchListPlaceholder: '请选择订单号',
searchField: 'number', searchField: 'number',
searchTitle: '采购订单信息', searchTitle: '采购订单信息4',
searchAllSchemas: PurchaseMain.allSchemas, searchAllSchemas: PurchaseMain.allSchemas,
searchPage: PurchaseMainApi.getPurchaseMainPage, searchPage: PurchaseMainApi.getPurchaseMainPage,
searchCondition: [{ searchCondition: [{
@ -481,10 +576,11 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
form: { form: {
// labelMessage: '信息提示说明!!!', // labelMessage: '信息提示说明!!!',
componentProps: { componentProps: {
isSearchList: true, disabled: true,
isSearchList: false,
searchListPlaceholder: '请选择订单号', searchListPlaceholder: '请选择订单号',
searchField: 'number', searchField: 'number',
searchTitle: '采购订单信息', searchTitle: '采购订单信息6',
searchAllSchemas: PurchaseMain.allSchemas, searchAllSchemas: PurchaseMain.allSchemas,
searchPage: PurchaseMainApi.getPurchaseMainPage, searchPage: PurchaseMainApi.getPurchaseMainPage,
searchCondition: [{ searchCondition: [{
@ -504,6 +600,26 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
}, },
{
label: '计划数量',
field: 'planQty',
sort: 'custom',
table: {
width: 150
},
tableForm: {
type: 'InputNumber',
precision: 6
},
sortTableDefault:4,
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 6
}
}
},
{ {
label: '订单行', label: '订单行',
field: 'poLine', field: 'poLine',
@ -511,13 +627,15 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150 width: 150
}, },
sortTableDefault:10,
form: { form: {
// labelMessage: '信息提示说明!!!', // labelMessage: '信息提示说明!!!',
componentProps: { componentProps: {
isSearchList: true, disabled: true,
isSearchList: false,
searchListPlaceholder: '请选择订单行', searchListPlaceholder: '请选择订单行',
searchField: 'lineNumber', searchField: 'lineNumber',
searchTitle: '采购订单信息', searchTitle: '采购订单信息2',
searchAllSchemas: PurchaseDetail.allSchemas, searchAllSchemas: PurchaseDetail.allSchemas,
searchPage: PurchaseDetailApi.getPurchaseDetailPagePoNumber, searchPage: PurchaseDetailApi.getPurchaseDetailPagePoNumber,
searchCondition: [{ searchCondition: [{
@ -538,7 +656,7 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
isInpuFocusShow: false, isInpuFocusShow: false,
searchListPlaceholder: '请选择订单行', searchListPlaceholder: '请选择订单行',
searchField: 'lineNumber', searchField: 'lineNumber',
searchTitle: '采购订单信息', searchTitle: '采购订单信息1',
searchAllSchemas: PurchaseDetail.allSchemas, searchAllSchemas: PurchaseDetail.allSchemas,
searchPage: PurchaseDetailApi.getPurchaseDetailPagePoNumber, searchPage: PurchaseDetailApi.getPurchaseDetailPagePoNumber,
searchCondition: [{ searchCondition: [{
@ -560,6 +678,8 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150 width: 150
}, },
sortTableDefault:3,
sortSearchDefault:5,
isSearch:true, isSearch:true,
form: { form: {
componentProps: { componentProps: {
@ -568,6 +688,29 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
}, },
tableForm: { tableForm: {
disabled: true disabled: true
},
search: {
// labelMessage: '信息提示说明!!!',
componentProps: {
multiple: true,
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'supplierCode',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true,
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
} }
}, },
{ {
@ -582,40 +725,45 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
disabled: true disabled: true
} }
}, },
sortTableDefault:11,
tableForm: { tableForm: {
disabled: true disabled: true
} }
}, },
{ {
label: '计划数量', label: '已发货数量',
field: 'planQty', field: 'shippedQty',
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
}, },
tableForm: { isTableForm: false,
type: 'InputNumber', isForm: false,
precision: 6 sortTableDefault:5,
},
{
label: '已收货数量',
field: 'receivedQty',
sort: 'custom',
table: {
width: 150
}, },
form: { isTableForm: false,
component: 'InputNumber', isForm: false,
componentProps: { sortTableDefault:6,
precision: 6
}
}
}, },
{ {
label: '已发货数量', label: '在途数量',
field: 'shippedQty', field: 'notReceiveQty',
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
}, },
isTableForm: false, isTableForm: false,
isForm: false, isForm: false,
hiddenInMain:true, sortTableDefault:7,
}, },
{ {
label: '计量单位', label: '计量单位',
@ -627,6 +775,12 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 150 width: 150
}, },
sortTableDefault:12,
form: {
componentProps: {
disabled: true
}
},
tableForm: { tableForm: {
type: 'Select', type: 'Select',
disabled:true, disabled:true,
@ -638,6 +792,8 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
dictType: DICT_TYPE.TRUE_FALSE, dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', dictClass: 'string',
isTable: true, isTable: true,
isTableForm:false,
isForm:false,
hiddenInMain:true, hiddenInMain:true,
sort: 'custom', sort: 'custom',
table: { table: {
@ -697,6 +853,7 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
field: 'remark', field: 'remark',
sort: 'custom', sort: 'custom',
hiddenInMain:true, hiddenInMain:true,
isTableForm:false,
table: { table: {
width: 150 width: 150
}, },
@ -717,10 +874,10 @@ export const PurchasePlanDetail = useCrudSchemas(reactive<CrudSchema[]>([
const validatePlanQty = (rule, value, callback) => { const validatePlanQty = (rule, value, callback) => {
console.log('validatePlanQty',value) console.log('validatePlanQty',value)
const numReg = /^[\d]+$/ const numReg = /^[\d]+$/
if (numReg.test(value)&&value>0) { if (numReg.test(value)&&value>=0) {
callback() callback()
} else { } else {
callback(new Error('计划数量不能0')) callback(new Error('计划数量不能小于0'))
} }
} }
//表单校验 //表单校验
@ -736,7 +893,7 @@ export const PurchasePlanDetailRules = reactive({
], ],
planQty: [ planQty: [
{ required: true, message: '请输入计划数量', trigger: 'blur' }, { required: true, message: '请输入计划数量', trigger: 'blur' },
{ validator:validatePlanQty, message: '计划数量不能0', trigger: 'blur'} { validator:validatePlanQty, message: '计划数量不能小于0', trigger: 'blur'}
], ],
remark: [ remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } { max: 50, message: '不得超过50个字符', trigger: 'blur' }

633
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue

File diff suppressed because it is too large

509
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/labelForm.vue

@ -0,0 +1,509 @@
<template>
<el-dialog v-model="dialogTableVisible" title="标签" width="1100">
<el-table
:data="showTableData()"
border
row-key="id"
style="width: 1050px; max-height: 70vh; overflow-y: auto"
v-if="tableData.length > 0 && dialogTableVisible == true"
v-loading="isLoading"
>
<el-table-column type="expand" width="50">
<template #default="scope">
<div
style="margin-left: 400px; margin-top: -8px; margin-bottom: -8px"
v-if="scope.row.secondPackUnit && scope.row.secondPackQty"
>
<el-table
:data="scope.row.packageList"
border
style="width: 550px"
row-key="id"
:row-class-name="getRowClass"
>
<el-table-column type="expand" width="50">
<template #default="scope1">
<div style="margin-left: 150px; margin-top: -8px; margin-bottom: -8px">
<el-table :data="scope1.row.children" border style="width: 300px" row-key="id">
<el-table-column label="箱行号" width="100" prop="xPoNumber" align="center" />
<el-table-column label="数量" width="100" prop="qtyTwo" align="center">
<template #default="scope2">
<el-input
v-model="scope2.row.qtyTwo"
@blur="blurTwo(scope.row, scope1.row, scope2.row)"
/>
</template>
</el-table-column>
<el-table-column label="添加箱" width="100" prop="add" align="center">
<template #header>
<el-button
type="primary"
link
@click="addX(scope.row, scope.$index, scope1.row, scope1.$index, 1)"
>添加箱</el-button
>
</template>
<template #default="scope2">
<el-button
type="warning"
link
@click="
removeX(
scope.row,
scope.$index,
scope1.row,
scope1.$index,
scope2.row,
scope2.$index,
1
)
"
>移出</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</template>
</el-table-column>
<el-table-column label="托行号" width="100" prop="tPoNumber" align="center" />
<el-table-column label="箱个数" width="100" prop="xNumber" align="center">
<template #default="scope1">
<el-input v-model="scope1.row.xNumber" @blur="blurOne(scope.row, scope1.row)" />
</template>
</el-table-column>
<el-table-column label="数量" width="100" prop="qtyOne" align="center" />
<el-table-column label="操作" width="100" prop="action" align="center">
<template #default="scope1">
<el-button
type="warning"
link
@click="removeT(scope.row, scope.$index, scope1.row, scope1.$index)"
>移出</el-button
>
</template>
</el-table-column>
<el-table-column label="添加托" width="100" prop="add" align="center">
<template #header>
<el-button type="primary" link @click="addT(scope.row)">添加托</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div style="margin-left: 550px; margin-top: -8px; margin-bottom: -8px" v-else>
<div v-for="(item, index) in scope.row.packageList" :key="index">
<el-table :data="item.children" border style="width: 300px" row-key="id">
<el-table-column label="箱行号" width="100" prop="xPoNumber" align="center" />
<el-table-column label="数量" width="100" prop="qtyOne" align="center">
<template #default="scope1">
<el-input
v-model="scope1.row.qtyTwo"
@blur="blurThree(scope.row, item, scope1.row)"
/>
</template>
</el-table-column>
<el-table-column label="添加箱" width="100" prop="add" align="center">
<template #header>
<el-button
type="primary"
link
@click="addX(scope.row, scope.$index, item, index)"
>添加箱</el-button
>
</template>
<template #default="scope1">
<el-button
type="warning"
link
@click="removeX(scope.row, scope.$index, item, index)"
>移出</el-button
>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="物料代码" width="150" prop="itemCode" align="center" />
<el-table-column label="批次" width="150" prop="batch" align="center" />
<el-table-column label="数量" width="100" prop="qty" align="center" />
<el-table-column label="计量单位" width="100" prop="uom" align="center" />
<el-table-column label="托个数" width="100" prop="allTuoQty" align="center" />
<el-table-column label="托规格" width="100" prop="secondPackUnit" align="center" />
<el-table-column label="托数量" width="100" prop="secondPackQty" align="center" />
<el-table-column label="箱规格" width="100" prop="packUnit" align="center" />
<el-table-column label="箱数量" width="100" prop="packQty" align="center" />
</el-table>
<el-pagination
v-show="tableData.length > 10"
style="margin-top: 10px"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:small="true"
:background="false"
layout="total, prev, pager, next, jumper"
:total="tableData.length"
/>
<template #footer>
<slot name="foorter"></slot>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
</template>
</el-dialog>
</template>
<script setup lang="ts">
import * as defaultButtons from '@/utils/disposition/defaultButtons'
const message = useMessage() //
const { t } = useI18n() //
const props = defineProps({
//
tableAllSchemas: {
type: Array,
required: true,
default: null
}
})
const dialogTableVisible = ref(false)
const defaultExpandAll = ref(false)
const tableData = ref([])
const isLoading = ref(false)
const oneId = ref(0) //id
const twoId = ref(0) //id
const openLabel =async (tableList) => {
dialogTableVisible.value = true
tableData.value = tableList
defaultExpandAll.value = false
await intData()
}
const currentPage = ref(1)
const pageSize = ref(10)
const showTableData = () => {
if (tableData.value.length > 10) {
return tableData.value.slice(
(currentPage.value - 1) * pageSize.value,
currentPage.value * pageSize.value
)
} else {
return tableData.value
}
}
const intData =async () => {
tableData.value.forEach((row) => {
if (row.secondPackUnit && row.secondPackQty) {
// %
row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.secondPackQty))
} else {
// %
row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.packQty))
}
expandChange(row)
})
}
const expandChange = (row: any, expandedRows: any[]) => {
//
if (row.secondPackUnit && row.secondPackQty) {
//
row.lastNumber = parseFloat(row.qty) % parseFloat(row.secondPackQty)
// /
row.otherNumber = parseFloat(row.secondPackQty) / parseFloat(row.packQty)
// %
row.allTuoQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.secondPackQty))
row.packageList = []
//
for (let i = 0; i < row.allTuoQty; i++) {
oneId.value++
//
row.packageList[i] = {
id: oneId.value,
tPoNumber: i + 1,
xNumber: '',
qtyOne: '',
isTuo: 1 //
}
//
if (row.lastNumber) {
//
if (i == row.allTuoQty - 1) {
row.packageList[i].xNumber = Math.ceil(row.lastNumber / parseFloat(row.packQty))
row.packageList[i].qtyOne = row.lastNumber
} else {
//
row.packageList[i].xNumber = row.otherNumber
row.packageList[i].qtyOne = row.secondPackQty
}
} else {
// ,
row.packageList[i].xNumber = row.otherNumber
row.packageList[i].qtyOne = row.secondPackQty
}
}
//
if (row.packUnit && row.packQty) {
row.packageList.forEach((cur, key) => {
cur.children = []
//
cur.xLastNumber = parseFloat(cur.qtyOne) % parseFloat(row.packQty)
// cur.xiangNumber = Math.ceil(parseFloat(cur.qtyOne) / parseFloat(item.secondPackQty))
for (let j = 0; j < cur.xNumber; j++) {
twoId.value++
cur.children[j] = {
id: twoId.value,
xPoNumber: j + 1
}
//
if (cur.xLastNumber) {
//
if (j == cur.xNumber - 1) {
cur.children[j].qtyTwo = cur.xLastNumber
} else {
//
cur.children[j].qtyTwo = row.packQty
}
} else {
// ,
cur.children[j].qtyTwo = row.packQty
}
}
})
}
} else {
// %
row.allXiangQty = Math.ceil(parseFloat(row.qty) / parseFloat(row.packQty))
row.packageList = []
row.allTuoQty = 1
//
for (let i = 0; i < row.allTuoQty; i++) {
oneId.value++
//
row.packageList[i] = {
id: oneId.value,
xPoNumber: i + 1,
qtyOne: row.qty,
isTuo: 0 //
}
}
row.packageList.forEach((cur) => {
cur.children = []
for (let j = 0; j < row.allXiangQty; j++) {
twoId.value++
cur.children[j] = {
id: twoId.value,
xPoNumber: j + 1
}
//
cur.lastNumber = parseFloat(row.qty) % parseFloat(row.packQty)
//
if (cur.lastNumber) {
//
if (j == row.allXiangQty - 1) {
cur.children[j].qtyTwo = cur.lastNumber
} else {
//
cur.children[j].qtyTwo = row.packQty
}
} else {
// ,
cur.children[j].qtyTwo = row.packQty
}
}
})
}
}
/** 弹窗按钮 */
let Butttondata: any = []
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
/** 按钮事件 */
const buttonBaseClick = (val) => {
//
if (val == 'save') {
submitForm()
}
//
else if (val == 'close') {
dialogTableVisible.value = false
}
}
//
const submitForm = () => {
let arr = tableData.value.map((item) => {
item.allNumber = 0
//
item.packageList.forEach((cur) => {
item.allNumber += parseFloat(cur.qtyOne) || 0
})
if (item.allNumber == parseFloat(item.qty)) {
return true
} else {
return false
}
})
const isBol = arr.some((item) => item == false)
if (isBol) {
message.warning('当前添加的数量与总数量不一致')
return
}
emit('submitForm', tableData.value)
}
//
const addT = (oneRow) => {
oneId.value++
oneRow.packageList.push({
id: oneId.value,
tPoNumber: oneRow?.packageList?.length>0?oneRow.packageList[oneRow.packageList.length - 1]?.tPoNumber + 1 :1, //1
xNumber: '',
qtyOne: ''
})
oneRow.allTuoQty = oneRow.packageList.length
}
//
const removeT = (oneRow, oneIndex, twoRow, twoIndex) => {
oneRow.packageList.splice(twoIndex, 1)
oneRow.allTuoQty = oneRow.packageList.length
}
//
const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => {
twoId.value++
//
if (type == 1) {
//
twoRow.children.push({
id: twoId.value,
xPoNumber: twoRow?.children?.length>0? twoRow?.children[twoRow.children.length - 1]?.xPoNumber + 1 :1,
qtyOne: ''
})
twoRow.xNumber = twoRow.children.length
} else {
//
twoRow.children.push({
id: twoId.value,
xPoNumber:twoRow.children.length>0? twoRow.children[twoRow.children.length - 1].xPoNumber + 1:1,
qtyTwo: ''
})
oneRow.allTuoQty = twoRow.children.length
}
}
//
const removeX = (oneRow, oneIndex, twoRow, twoIndex, threeRow, threeIndex, type) => {
//
if (type == 1) {
//
twoRow.children.splice(threeIndex, 1)
let num = 0
twoRow.children.forEach((item) => {
num += parseFloat(item.qtyTwo) || 0
})
twoRow.qtyOne = num
twoRow.xNumber = twoRow.children.length
} else {
twoRow.children.splice(twoIndex, 1)
oneRow.allTuoQty = twoRow.children.length
}
}
//
const getRowClass = (row) => {
if (!row.row.children || row.row.children.length == 0) {
return 'row-expand-cover'
}
}
//
const blurOne = (oneRow, twoRow) => {
if (!twoRow.xNumber) {
twoRow.qtyOne = ''
}
if (parseFloat(twoRow.xNumber) > parseFloat(oneRow.otherNumber)) {
message.warning('每托箱个数最多' + oneRow.otherNumber + '箱')
twoRow.xNumber = oneRow.otherNumber
twoRow.children = []
twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.packQty)
}
twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.packQty)
let num = 0
oneRow.packageList.forEach((item) => {
num += parseFloat(item.xNumber) || 0
})
if (num > oneRow.allPackQty) {
message.warning('总箱数不可以大于' + oneRow.allPackQty)
twoRow.xNumber = ''
twoRow.qtyOne = ''
return
}
//
//
if (oneRow.packUnit && oneRow.packQty) {
oneRow.packageList.forEach((cur, key) => {
cur.children = []
//
cur.xLastNumber = parseFloat(cur.xNumber) % parseFloat(oneRow.packQty)
for (let j = 0; j < cur.xNumber; j++) {
twoId.value++
//
if (cur.xLastNumber) {
//
if (j == cur.xNumbery - 1) {
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qtyTwo: cur.xLastNumber
})
} else {
//
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qtyTwo: oneRow.packQty
})
}
} else {
// ,
cur.children.push({
id: twoId.value,
xPoNumber: j + 1,
qtyTwo: oneRow.packQty
})
}
}
})
}
}
//
const blurTwo = (oneRow, twoRow, threeRow) => {
if (parseFloat(threeRow.qtyTwo) > parseFloat(oneRow.packQty)) {
message.warning('数量最多为' + oneRow.packQty)
threeRow.qtyTwo = oneRow.packQty
return
}
let num = 0
twoRow.children.forEach((item) => {
num += parseFloat(item.qtyTwo) || 0
})
twoRow.qtyOne = num
}
//
const blurThree = (oneRow, twoRow, thereeRow) => {
if (parseFloat(thereeRow.qtyTwo) > parseFloat(oneRow.packQty)) {
message.warning('每箱个数最多' + oneRow.packQty)
thereeRow.qtyTwo = oneRow.packQty
}
let num = 0
twoRow.children.forEach((item) => {
num += parseFloat(item.qtyTwo) || 0
})
twoRow.qtyOne = num
}
//
const emit = defineEmits(['submitForm'])
defineExpose({ openLabel, dialogTableVisible, isLoading }) // open
</script>
<style lang="scss" scoped>
::v-deep .row-expand-cover td .el-table__expand-icon {
visibility: hidden;
}
</style>

90
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverBasicForm.vue

@ -21,6 +21,7 @@
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
@submitForm="submitForm" @submitForm="submitForm"
@formFormDateChange="formFormDateChange" @formFormDateChange="formFormDateChange"
@inputNumberChange="inputNumberChange"
@onEnter="onEnter" @onEnter="onEnter"
> >
@ -40,6 +41,7 @@ import {
SupplierdeliverRequestDetail, SupplierdeliverRequestDetail,
SupplierdeliverRequestDetailRules, SupplierdeliverRequestDetailRules,
} from './supplierdeliverRequestMain.data' } from './supplierdeliverRequestMain.data'
import dayjs from 'dayjs'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as SupplierdeliverRequestMainApi from '@/api/wms/supplierdeliverRequestMain' import * as SupplierdeliverRequestMainApi from '@/api/wms/supplierdeliverRequestMain'
import * as PurchasePlanDetailApi from '@/api/wms/purchasePlanDetail' import * as PurchasePlanDetailApi from '@/api/wms/purchasePlanDetail'
@ -97,10 +99,11 @@ const openFormByCreate = async ( data ) => {
const setV = {} const setV = {}
// //
setV['supplierCode'] = data['supplierCode'] // setV['supplierCode'] = data['supplierCode'] //
setV['poNumber'] = data['poNumber'] //
setV['ppNumber'] = data['number'] // setV['ppNumber'] = data['number'] //
searchPage: SupplierApi.getSupplierPage searchPage: SupplierApi.getSupplierPage
//-- //--
getSearchTableData(data['number'],'ppNumber','number') getSearchTableData(data['number'],'ppNumber','number',0)
// //
let beginTime = data['endTime'] let beginTime = data['endTime']
@ -108,6 +111,7 @@ const openFormByCreate = async ( data ) => {
let deliveryDate = formatDate(data['deliveryDate'],'YYYY-MM-DD') let deliveryDate = formatDate(data['deliveryDate'],'YYYY-MM-DD')
planArriveTimeStr.value = deliveryDate + ' '+ beginTime+":00" planArriveTimeStr.value = deliveryDate + ' '+ beginTime+":00"
setV['planArriveTime']= new Date(planArriveTimeStr.value).valueOf(); setV['planArriveTime']= new Date(planArriveTimeStr.value).valueOf();
setV['arriveTime']= new Date(planArriveTimeStr.value).valueOf();
} }
formRef.value.open('create', null) formRef.value.open('create', null)
@ -129,7 +133,7 @@ const openFormByCreate = async ( data ) => {
formRef.value.formRef.setValues(setV) formRef.value.formRef.setValues(setV)
}) })
} }
const openForm = async (type: string, row?: number) => { const openForm = async (type: string, row?: number, defaultSupplierCode?: string) => {
if(type == "update"){ if(type == "update"){
SupplierdeliverRequestMain.allSchemas.formSchema.forEach((item) => { SupplierdeliverRequestMain.allSchemas.formSchema.forEach((item) => {
if(item.field == 'supplierCode'){ if(item.field == 'supplierCode'){
@ -151,6 +155,7 @@ const openForm = async (type: string, row?: number) => {
SupplierdeliverRequestMain.allSchemas.formSchema.forEach((item) => { SupplierdeliverRequestMain.allSchemas.formSchema.forEach((item) => {
if(item.field == 'supplierCode'){ if(item.field == 'supplierCode'){
item.componentProps.isSearchList = true item.componentProps.isSearchList = true
item.value = defaultSupplierCode
} }
if(item.field == 'ppNumber'){ if(item.field == 'ppNumber'){
item.componentProps.isSearchList = true item.componentProps.isSearchList = true
@ -183,18 +188,29 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
// row['orderQty'] = val[0]['orderQty'] // row['orderQty'] = val[0]['orderQty']
// row['uom'] = val[0]['uom'] // row['uom'] = val[0]['uom']
// } // }
//-- //--
const itemCodes = [] const itemCodes = []
val.forEach(item=>{ val.forEach(item=>{
const newRow = {...row} const newRow = {...row}
newRow.id = dayjs().valueOf()
newRow[formField] = item[searchField] newRow[formField] = item[searchField]
newRow['allowOverShipment'] = item['allowOverShipment'] //
newRow['poNumber'] = item['poNumber'] newRow['poNumber'] = item['poNumber']
newRow['itemCode'] = item['itemCode'] newRow['itemCode'] = item['itemCode']
newRow['poLine'] = item['poLine'] newRow['poLine'] = item['poLine']
newRow['orderQty'] = item['orderQty'] newRow['orderQty'] = item['orderQty']
newRow['uom'] = item['uom'] newRow['uom'] = item['uom']
newRow['id'] = item['id'] newRow['id'] = item['id']
if(tableData.value.find(item1=>item1['itemCode'] == item['itemCode']&&item1['poLine'] == item['poLine']&&item1['poNumber'] == item['poNumber'])) return newRow['planQty'] = item['planQty']
newRow['shippedQty'] = item['shippedQty']
newRow['qty'] = item['planQty'] - item['shippedQty']
newRow['produceDate'] = dayjs().valueOf() //
let produceDateStr = formatDate(newRow['produceDate'],'YYYYMMDD');
newRow['batch'] = produceDateStr
newRow['supplierBatch'] = produceDateStr
newRow.expireDate = item['expireTime']?addDay(newRow['produceDate'],item['expireTime']).valueOf():dayjs('2099-12-31').valueOf()
// if(tableData.value.find(item1=>item1['itemCode'] == item['itemCode']&&item1['poLine'] == item['poLine']&&item1['poNumber'] == item['poNumber'])) return
itemCodes.push(item['itemCode']) itemCodes.push(item['itemCode'])
tableData.value.push(newRow) tableData.value.push(newRow)
@ -216,7 +232,9 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
if(formField == 'ppNumber'){ if(formField == 'ppNumber'){
//-- //--
getSearchTableData(val[0]['number'],formField,searchField)
setV['poNumber'] = val[0]['poNumber'] //
getSearchTableData(val[0]['number'],formField,searchField,0)
// //
@ -225,6 +243,7 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
let deliveryDate = formatDate(val[0]['deliveryDate'],'YYYY-MM-DD') let deliveryDate = formatDate(val[0]['deliveryDate'],'YYYY-MM-DD')
planArriveTimeStr.value = deliveryDate + ' '+ beginTime+":00" planArriveTimeStr.value = deliveryDate + ' '+ beginTime+":00"
setV['planArriveTime']= new Date(planArriveTimeStr.value).valueOf(); setV['planArriveTime']= new Date(planArriveTimeStr.value).valueOf();
setV['arriveTime']= new Date(planArriveTimeStr.value).valueOf();
} }
// //
tableData.value = [] tableData.value = []
@ -239,9 +258,9 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row) =>
}) })
} }
const getSearchTableData = async (number,formField,searchField)=>{ const getSearchTableData = async (number,formField,searchField,isAll)=>{
const {tableObject ,tableMethods} = useTable({ const {tableObject ,tableMethods} = useTable({
defaultParams:{number}, defaultParams:{number,flag:1,isAll},
getListApi: PurchasePlanDetailApi.getPurchasePlanDetailPage // getListApi: PurchasePlanDetailApi.getPurchasePlanDetailPage //
}) })
tableObject.pageSize = 500 tableObject.pageSize = 500
@ -257,11 +276,21 @@ const getSearchTableData = async (number,formField,searchField)=>{
tableObject.tableList.forEach(row=>{ tableObject.tableList.forEach(row=>{
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...row})) const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...row}))
newRow[formField] = row[searchField] newRow[formField] = row[searchField]
newRow['allowOverShipment'] = row['allowOverShipment'] //
newRow['poNumber'] = row['poNumber'] newRow['poNumber'] = row['poNumber']
newRow['itemCode'] = row['itemCode'] newRow['itemCode'] = row['itemCode']
newRow['poLine'] = row['poLine'] newRow['poLine'] = row['poLine']
newRow['orderQty'] = row['orderQty'] newRow['orderQty'] = row['orderQty']
newRow['uom'] = row['uom'] newRow['uom'] = row['uom']
newRow['planQty'] = row['planQty']
newRow['shippedQty'] = row['shippedQty']
newRow['qty'] = row['planQty'] - row['shippedQty']
newRow['produceDate'] = dayjs().valueOf() //
let produceDateStr = formatDate(newRow['produceDate'],'YYYYMMDD');
newRow['batch'] = produceDateStr
newRow['supplierBatch'] = produceDateStr
newRow.expireDate = row['expireTime']?addDay(newRow['produceDate'],row['expireTime']).valueOf():dayjs('2099-12-31').valueOf()
tableData.value.push(newRow) tableData.value.push(newRow)
itemCodes.push(row['itemCode']) itemCodes.push(row['itemCode'])
}) })
@ -298,6 +327,33 @@ const submitForm = async (formType, submitData) => {
formRef.value.formLoading = false formRef.value.formLoading = false
return return
} }
// 2.2. -
let itemCodes = []
let itemCodeSum = []
data.subList.forEach(item=>{
if(item['allowOverShipment']!='TRUE'){
let qtyDefault = item['planQty'] - item['shippedQty']
if(item['qty']>qtyDefault){
itemCodes.push(item['itemCode'])
}
if(!itemCodeSum.includes(item['itemCode'])){
let planQty = item['planQty'] //
let sumQty = data.subList.filter(item1=>item1['itemCode']==item['itemCode']).reduce((prev, item1) => prev + item1['qty'],0)
if(sumQty>planQty){
itemCodeSum.push(item['itemCode'])
}
}
}
})
if(itemCodes.length>0){
message.error(`${itemCodes.join(',')}${t('ts.不允许超发')}`)
return
}
if(itemCodeSum.length>0){
message.error(`${itemCodeSum.join(',')}${t('ts.总数量超出计划数量')}`)
return
}
try { try {
if (formType === 'create') { if (formType === 'create') {
let planArriveStr = formatDate(data.planArriveTime); let planArriveStr = formatDate(data.planArriveTime);
@ -335,11 +391,31 @@ const submitForm = async (formType, submitData) => {
formRef.value.formLoading = false formRef.value.formLoading = false
} }
} }
const inputNumberChange = (field, val,row, index) => {
if(field=='qty'){
if(row['allowOverShipment']!='TRUE'){
let qtyDefault = row['planQty'] - row['shippedQty']
if(row['qty']>qtyDefault){
message.error(`${row['itemCode']}${t('ts.不允许超发')}`)
}
let planQty = row['planQty'] //
let sumQty = tableData.value.filter(item1=>item1['itemCode']==row['itemCode']).reduce((prev, item1) => prev + item1['qty'],0)
if(sumQty>planQty){
message.error(`${row['itemCode']}${t('ts.总数量超出计划数量')}`)
}
}
}
console.log('inputNumberChange',field, val,row, index)
}
const formFormDateChange = (field, val,row, index) => { const formFormDateChange = (field, val,row, index) => {
console.log('formFormDateChange',field, val,row, index)
if(field == 'produceDate'){ if(field == 'produceDate'){
let produceDateStr = formatDate(val,'YYYYMMDD'); let produceDateStr = formatDate(val,'YYYYMMDD');
row.batch = produceDateStr row.batch = produceDateStr
row.supplierBatch = produceDateStr row.supplierBatch = produceDateStr
row.expireDate = row['expireTime']?addDay(row['produceDate'],row['expireTime']).valueOf():dayjs('2099-12-31').valueOf()
} }
} }
// //

3089
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/supplierdeliverRequestMain.data.ts

File diff suppressed because it is too large
Loading…
Cancel
Save