Browse Source

HL-5298维修备件收货、退货、领用申请直接,提交后直接生成记录

hella_online_20240823
zhang_li 3 months ago
parent
commit
ab170c9ee8
  1. 86
      src/api/wms/purchaseMainWms/index.ts
  2. 611
      src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMainWms/index.vue
  3. 969
      src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMainWms/purchaseMain.data.ts

86
src/api/wms/purchaseMainWms/index.ts

@ -0,0 +1,86 @@
import request from '@/config/axios'
export interface PurchaseMainVO {
supplierCode: string
number: string
type: string
status: string
orderDate: Date
dueDate: Date
version: string
taxRate: number
contactName: string
contactPhone: string
contactEmail: string
isConsignment: string
businessType: string
remark: string
createTime: Date
creator: string
updateTime: Date
updater: string
currentStage: number
available: string
}
// 查询采购订单主列表
export const getPurchaseMainPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/wms/purchase-main/seniorWMS', data })
} else {
return await request.get({ url: `/wms/purchase-main/pageWMS`, params })
}
}
// 查询采购订单主详情
export const getPurchaseMain = async (id: number) => {
return await request.get({ url: `/wms/purchase-main/get?id=` + id })
}
// 新增采购订单主
export const createPurchaseMain = async (data: PurchaseMainVO) => {
return await request.post({ url: `/wms/purchase-main/create`, data })
}
// 修改采购订单主
export const updatePurchaseMain = async (data: PurchaseMainVO) => {
return await request.put({ url: `/wms/purchase-main/update`, data })
}
// 删除采购订单主
export const deletePurchaseMain = async (id: number) => {
return await request.delete({ url: `/wms/purchase-main/delete?id=` + id })
}
// 关闭采购订单主
export const closePurchaseMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-main/close?id=` + id })
}
// 打开采购订单主
export const openPurchaseMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-main/open?id=` + id })
}
// 发布采购订单主
export const publishPurchaseMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-main/publish?id=` + id })
}
// 下架采购订单主
export const witPurchaseMain = async (id: number) => {
return await request.post({ url: `/wms/purchase-main/wit?id=` + id })
}
// 导出采购订单主 Excel
export const exportPurchaseMain = async (params) => {
if (params.isSearch) {
const data = {...params}
return await request.downloadPost({ url: `/wms/purchase-main/export-excel-senior`, data })
} else {
return await request.download({ url: `/wms/purchase-main/export-excel`, params })
}
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/purchase-main/get-import-template' })
}

611
src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMainWms/index.vue

@ -0,0 +1,611 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="[...PurchaseMain.allSchemas.searchSchema,...PurchaseDetail.allSchemas.searchSchema]" @search="searchList" @reset="searchList" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :allSchemas="PurchaseMain.allSchemas" :detailAllSchemas="PurchaseDetail.allSchemas" />
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable ref="elTableRef"
:selection="false"
: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">
<!-- <Table ref="elTableRef" :expand="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" >
<template #expand="{ row }">
<TableDetail
:openDetailParams="{
row: row,
}"
:width="expandDetailWidth"
:allSchemas="PurchaseMain.allSchemas"
:detailAllSchemas="PurchaseDetail.allSchemas"
:apiPage="PurchaseDetailApi.getPurchaseDetailPage"
@searchTableSuccessDetail="searchTableSuccessDetail"
/>
</template> -->
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row,$index }">
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm ref="formRef"
@success="getList"
:isOpenSearchTable="true"
fieldTableColumn="itemCode"
:rules="PurchaseMainRules"
:formAllSchemas="PurchaseMain.allSchemas"
:tableAllSchemas="PurchaseDetail.allSchemas"
:tableFormRules="PurchaseDetailRules"
:tableData="tableData"
:apiUpdate="PurchaseMainApi.updatePurchaseMain"
:apiCreate="PurchaseMainApi.createPurchaseMain"
:isBusiness="true"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
:isShowReduceButtonSelection="true"
@tableSelectionDelete="tableSelectionDelete"
@searchTableSuccess="searchTableSuccess"
@clearSearchInput="clearSearchInput"
@submitForm="submitForm"
@onChange="onChangeQty"
@onEnter="onEnter"
/>
<!-- 详情 -->
<Detail ref="detailRef"
:isBasic="false"
:allSchemas="PurchaseMain.allSchemas"
:detailAllSchemas="PurchaseDetail.allSchemas"
:detailAllSchemasRules="PurchaseDetailRules"
:apiCreate="PurchaseDetailApi.createPurchaseDetail"
:apiUpdate="PurchaseDetailApi.updatePurchaseDetail"
:apiPage="PurchaseDetailApi.getPurchaseDetailPage"
:apiDelete="PurchaseDetailApi.deletePurchaseDetail"
:Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail" />
<!-- 导入 -->
<ImportForm
ref="importFormRef"
url="/wms/purchase-main/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
:isShowOut="true"
:updateIsDisable="true"
:coverIsDisable="true"
:mode="2" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { PurchaseMain, PurchaseMainRules, PurchaseDetail, PurchaseDetailRules } from './purchaseMain.data'
import * as PurchaseMainApi from '@/api/wms/purchaseMainWms'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as ItembasicApi from '@/api/wms/itembasic'
import TableDetail from '@/components/TableDetail/src/TableDetail.vue'
import { formatDate } from '@/utils/formatTime'
//
defineOptions({ name: 'PurchaseMain' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref([...PurchaseMain.allSchemas.tableColumns,...PurchaseDetail.allSchemas.tableMainColumns])
console.log('PurchaseMain.allSchemas.searchSchema',PurchaseMain.allSchemas.searchSchema)
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const elTableRef = ref()
//
const expandDetailWidth = ref('')
onMounted(() => {
const width = unref(elTableRef)?.$el.getBoundingClientRect().width
expandDetailWidth.value = width+'px'
})
const clearSearchInput = (formField)=>{
tableData.value = []
}
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(async() => {
if (type == 'tableForm') {
//
if(formField == 'itemCode'){
const repeatCode = [] //
if(tableData.value.length > 0){
tableData.value.forEach((item) => {
const findIndex = val.findIndex(valItem=>valItem['itemCode']==item.itemCode)
if(findIndex > -1){
val.splice(findIndex,1)
repeatCode.push(item.itemCode)
}
})
}
if(repeatCode.length>0){
message.warning(`${t('ts.物料代码')}${repeatCode.join(',')}${t('ts.已经存在')}`);
}
if(val.length>0){
//frm
const setV = {}
if(val[0]['supplierCode']!=formRef.formModel.supplierCode){
tableData.value = [] //
}
setV['contactName']=val[0]['contacts']
setV['contactPhone']=val[0]['phone']
setV['contactEmail']=val[0]['email']
if(formRef.formModel.taxRate==0){
setV['taxRate']=val[0]['taxRate']
}
formRef.setValues(setV)
//
val.forEach(item=>{
const newRow = {...row}
newRow[formField] = item[searchField]
let lineNumber = 1
if(tableData.value.length>0){
lineNumber = 1+(tableData.value[tableData.value.length-1]['lineNumber'])
}
newRow['lineNumber'] = lineNumber
newRow['uom'] = item['supplierUom']
newRow['id'] = item['id']
tableData.value.push(newRow)
})
// const itemCodes = val.map(valItem=>valItem['itemCode'])
// await ItembasicApi.getItembasicPage({
// code: itemCodes.join(',')
// }).then(res => {
// row['uom'] = res.list[0].uom
// })
}
}
} else {
const setV = {}
setV[formField] = val[0][searchField]
if(formField == 'supplierCode'){
tableData.value = [] //
setV['contactName']=val[0]['contacts']
setV['contactPhone']=val[0]['phone']
setV['contactEmail']=val[0]['email']
setV['taxRate']=val[0]['taxRate']
formRef.setValues(setV)
onEnter('supplierCode')
}
}
})
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(async() => {
const setV = {}
if(formField == 'itemCode'){
await ItembasicApi.getItembasicPage({
code: setV['itemCode']
}).then(res => {
setV['uom'] = res.list[0].uom
setV[formField] = val[0][searchField]
})
}
formRef.setValues(setV)
})
}
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
const { tableObject, tableMethods } = useTable({
getListApi: PurchaseDetailApi.getPurchaseDetailPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
// defaultButtons.defaultAddBtn({ hasPermi: 'wms:purchase-main:create' }), //
// defaultButtons.defaultImportBtn({ hasPermi: 'wms:purchase-main:import' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'wms:purchase-main-wms:export' }), //
// defaultButtons.mainListSelectionOrderPubBtn(null), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
searchFormClick({
filters: tableObject.params.filters
})
} else {
getList()
}
} else if (val=='mainOrderSelectionPub'){//
handleSelectionPublish()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = (row,$index) => {
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1
if(findIndex>-1&&findIndex<$index){
return []
}
return [
defaultButtons.mainListOrderCloBtn({ hide: isShowMainButton(row, ['1']),hasPermi: 'wms:purchase-main-wms:close' }), //
defaultButtons.mainListOrderOpeBtn({ hide: isShowMainButton(row, ['3']),hasPermi: 'wms:purchase-main-wms:open' }), //
defaultButtons.mainListOrderPubBtn({ hide: isShowMainButton(row, ['1']),hasPermi: 'wms:purchase-main-wms:publish' }), //
defaultButtons.mainListOrderWitBtn({ hide: isShowMainButton(row, ['2']),hasPermi: 'wms:purchase-main-wms:wit' }), //
// defaultButtons.mainListEditBtn({ hasPermi: 'wms:purchase-main:update', hide: isShowMainButton(row, ['1']) }), //
// defaultButtons.mainListDeleteBtn({ hasPermi: 'wms:purchase-main:delete', hide: isShowMainButton(row, ['1']) }), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
// if (row.available == 'FALSE') return message.warning('')
openForm('update', row)
} else if (val == 'delete') { //
// if (row.available == 'FALSE') return message.warning('')
handleDelete(row.masterId)
} else if (val == 'mainOrderClo') { //
// if (row.available == 'FALSE') return message.warning('')
handleClose(row.masterId)
} else if (val == 'mainOrderOpe') { //
// if (row.available == 'FALSE') return message.warning('')
handleOpen(row.masterId)
} else if (val == 'mainOrderPub') { //
// if (row.available == 'FALSE') return message.warning('')
handlePublish(row.masterId)
} else if (val == 'mainOrderWit') { //
// if (row.available == 'FALSE') return message.warning('')
handleWit(row.masterId)
}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = async (type : string, row ?: number) => {
console.log("【purchaseMain】type类型:",type);
tableData.value = [] //
if(type == 'create'){
PurchaseMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'supplierCode') {
item.componentProps.isSearchList = true
item.componentProps.disabled = true
}
})
}
if(type == 'update'){
PurchaseMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'supplierCode') {
item.componentProps.isSearchList = false
item.componentProps.disabled = true
}
})
}
formRef.value.open(type, row)
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row : any, titleName : any, titleValue : any) => {
if(row.type == 'DISCRETE'){
PurchaseDetail.allSchemas.formSchema.map((item) => {
if (item.field == 'orderQty') {
item.componentProps.disabled = false
}
})
}else{
PurchaseDetail.allSchemas.formSchema.map((item) => {
if (item.field == 'orderQty') {
item.componentProps.disabled = true
}
})
}
detailRef.value.openDetail(row, titleName, titleValue,'order_purchase_main')
}
/** 删除按钮操作 */
const handleDelete = async (id : number) => {
try {
//
await message.delConfirm()
tableObject.loading = true
//
await PurchaseMainApi.deletePurchaseMain(id)
message.success(t('common.delSuccess'))
tableObject.loading = false
//
await getList()
} catch {}finally{
tableObject.loading = false
}
}
/** 关闭按钮操作 */
const handleClose = async (id : number) => {
try {
//
await message.confirm(t('ts.是否关闭所选中数据?'))
tableObject.loading = true
//
await PurchaseMainApi.closePurchaseMain(id)
message.success(t('ts.关闭成功!'))
tableObject.loading = false
//
await getList()
} catch { }finally{
tableObject.loading = false
}
}
/** 打开按钮操作 */
const handleOpen = async (id : number) => {
try {
//
await message.confirm(t('ts.是否打开所选中数据?'))
tableObject.loading = true
//
await PurchaseMainApi.openPurchaseMain(id)
message.success(t('ts.打开成功!'))
tableObject.loading = false
//
await getList()
} catch { }finally{
tableObject.loading = false
}
}
const searchList = (model)=>{
selectionRows.value = []
setSearchParams(model)
}
const selectionRows = ref<any>([])
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 handleSelectionPublish = async ()=>{
//
await message.confirm(t('ts.是否发布所选中数据?'))
tableObject.loading = true
let rows:any = []
selectionRows.value.map(item=>{
rows = [...rows,...item.selectionRows.map(item1=>item1.masterId)]
})
tableObject.loading = true
Promise.all( rows.map(item=>PurchaseMainApi.publishPurchaseMain(item))).then((res) => {
console.log('发布',res)
if(res.every(item=>item==true)){
message.success(t('ts.发布成功!'))
}
}).finally(()=>{
tableObject.loading = false
//
getList()
})
}
/** 发布按钮操作 */
const handlePublish = async (id : number) => {
try {
//
await message.confirm(t('ts.是否发布所选中数据?'))
tableObject.loading = true
//
await PurchaseMainApi.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 PurchaseMainApi.witPurchaseMain(id)
message.success(t('ts.下架成功!'))
tableObject.loading = false
//
await getList()
} catch { }finally{
tableObject.loading = false
}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const excelTitle = ref(route.meta.title)
const data = await PurchaseMainApi.exportPurchaseMain(tableObject.params)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch {
} finally {
exportLoading.value = false
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
PurchaseDetail.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 PurchaseMainApi.createPurchaseMain(data)
message.success(t('common.createSuccess'))
} else {
await PurchaseMainApi.updatePurchaseMain(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({
templateUrl: '',
templateTitle: `${route.meta.title}】导入模版.xlsx`
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
const onChangeQty = (field, cur) => {
if(field == 'type' && cur == 'DISCRETE'){
PurchaseDetail.allSchemas.tableFormColumns.map((item) => {
if (item.field == 'orderQty') {
console.log("AAAAAA",item)
item.tableForm.disabled = false
item.hidden = false
}
})
}
if(field == 'type' && cur == 'SCHEDULE'){
PurchaseDetail.allSchemas.tableFormColumns.map((item) => {
if (item.field == 'orderQty') {
console.log("BBBBB",item)
item.tableForm.disabled = true
item.hidden = true
}
})
}
}
const onEnter = (field)=>{
tableData.value = []
const timer = setTimeout(()=>{
formRef.value.handleAddTable()
if(timer){
clearTimeout(timer)
}
},500)
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await PurchaseMainApi.importTemplate()
})
</script>

969
src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMainWms/purchaseMain.data.ts

@ -0,0 +1,969 @@
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 { validateHanset, validateEmail } from '@/utils/validator'
const { t } = useI18n() // 国际化
/**
* @returns {Array}
*/
export const PurchaseMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
table: {
width: 180,
fixed: 'left'
},
},
{
label: '供应商代码',
field: 'supplierCode',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
form: {
labelMessage: '影响明细中物料代码,需在供应商物料中维护',
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择供应商代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '供应商信息', // 查询弹窗标题
searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类
searchPage: SupplierApi.getSupplierPageSCP, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true
}], // 失去焦点校验参数
}
}
},
{
label: '订单类型',
field: 'type',
dictType: DICT_TYPE.PURCHASE_ORDER_TYPE,
dictClass: 'string',
isTable: true,
isSearch: true,
sort: 'custom',
table: {
width: 150
},
},
{
label: '物料类型',
field: 'type',
dictType: DICT_TYPE.ITEM_TYPE,
dictClass: 'string',
isTable: false,
isForm: false,
isSearch: true,
sort: 'custom',
},
{
label: '状态',
field: 'status',
dictType: DICT_TYPE.PURCHASE_ORDER_STATUS,
dictClass: 'string',
isTable: true,
isForm:false,
isSearch: true,
sortSearchDefault:1000,
sort: 'custom',
table: {
width: 150
},
form: {
value: '1',
componentProps: {
disabled: true
}
}
},
{
label: '订单日期',
field: 'orderDate',
isTable: true,
formatter: dateFormatter2,
detail: {
dateFormat: 'YYYY-MM-DD'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
},
value: new Date().getTime()
},
},
{
label: '截止日期',
field: 'dueDate',
isTable: false,
isForm: false,
formatter: dateFormatter2,
detail:{
dateFormat: 'YYYY-MM-DD'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width: '100%'},
type: 'date',
dateFormat: 'YYYY-MM-DD',
valueFormat: 'x',
}
},
},
{
label: '税率',
field: 'taxRate',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
style: {width:'100%'},
min: 0,
max: 1,
precision: 6,
}
}
},
{
label: '版本',
field: 'version',
sort: 'custom',
isTable:false,
table: {
width: 150
},
},
{
label: '当前阶段',
field: 'currentStage',
sort: 'custom',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
style: {width:'100%'},
min: 0
}
},
isTableForm: false,
isForm: false,
isTable:false,
},
{
label: '是否寄存订单',
field: 'isConsignment',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: false,
sort: 'custom',
table: {
width: 150
},
isForm:false,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: false,
sort: 'custom',
table: {
width: 150
},
isForm:false,
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
disabled: true
}
},
},
{
label: '联系人姓名',
field: 'contactName',
sort: 'custom',
isTable:false,
table: {
width: 150
},
},
{
label: '联系人电话',
field: 'contactPhone',
sort: 'custom',
isTable:false,
table: {
width: 150
},
},
{
label: '联系人电子邮件',
field: 'contactEmail',
sort: 'custom',
isTable:false,
table: {
width: 150
},
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom',
table: {
width: 150
},
isForm: false,
isTable: false,
form: {
value: 'PurchaseReceipt',
componentProps: {
disabled: true
}
}
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
isForm: false,
isTable:false,
table: {
width: 150
},
},
{
label: '创建时间',
field: 'createTime',
isTable:true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
isForm: false,
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
},
{
label: '最后更新者',
field: 'updater',
sort: 'custom',
isForm: false,
isTable:false,
table: {
width: 150
},
},
{
label: '最后更新时间',
field: 'updateTime',
isTable: false,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
isForm: false,
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
},
{
label: '备注',
field: 'remark',
isTable: false,
table: {
width: 150
},
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 200,
fixed: 'right'
}
}
]))
//表单校验
export const PurchaseMainRules = reactive({
supplierCode: [
{ required: true, message: '请输入供应商代码', trigger: 'change' }
],
type: [
{ required: true, message: '请选择订单类型', trigger: 'change' }
],
status: [
{ required: true, message: '请选择状态', trigger: 'change' }
],
orderDate: [
{ required: true, message: '请输入订单日期', trigger: 'change' }
],
taxRate: [
{ required: true, message: '请输入税率', trigger: 'blur' }
],
version: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
contactName: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
contactPhone: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validateHanset, message: '请输入正确的手机号', trigger: 'blur'}
],
contactEmail: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' },
{ validator:validateEmail, message: '请输入正确的邮箱格式', trigger: 'blur'}
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
})
/**
* @returns {Array}
*/
export const PurchaseDetail = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '单据号',
field: 'number',
isTableForm: false,
hiddenInMain:true,
table: {
width: 180
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '行号',
field: 'lineNumber',
table: {
width: 150
},
tableForm:{
disabled:true,
isSearchList: true, // 开启查询弹窗
}
},
{
label: '物料代码',
field: 'itemCode',
isSearch: true,
table: {
width: 150
},
tableForm:{
disabled:true,
multiple:true,//多选
isInpuFocusShow: true,
searchListPlaceholder: '请选择供应商物料',
searchField: 'itemCode',
searchTitle: '供应商物料信息',
searchAllSchemas: Supplieritem.allSchemas,
searchPage: SupplieritemApi.selectItembasicTypeToSupplieritem,
searchCondition: [{
key:'supplierCode',
value:'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
verificationPage: SupplieritemApi.getSupplierItemListByCodes, // tableForm下方输入框校验失去焦点之后是否正确的方法
isShowTableFormSearch: true, //tableForm下方是否出现输入框
isRepeat: true,//tableForm下方输入框是否可以重复添加该条数据
// 失去焦点校验参数
verificationParams: [{
key: 'itemCode',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true,
}]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true,
searchListPlaceholder: '请选择供应商物料',
searchField: 'itemCode',
searchTitle: '供应商物料信息',
searchAllSchemas: Supplieritem.allSchemas,
searchPage: SupplieritemApi.selectItembasicTypeToSupplieritem,
searchCondition: [{
key:'supplierCode',
value:'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}],
// 失去焦点校验参数
verificationParams: [{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: 'true',
isFormModel: true,
}]
}
}
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
isTableForm:true,
form:{
componentProps: {
disabled:true
}
},
tableForm:{
disabled: true,
type:'Select',
},
table: {
width: 150
},
},
{
label: '订单数量',
field: 'orderQty',
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
disabled:false,
min: 1,
precision: 6
}
},
tableForm: {
disabled:false,
hidden:false,
type: 'InputNumber',
min: 1,
precision: 6
},
},
// {
// label: 'ERP库位',
// field: 'erpLocationCode',
// dictType : DICT_TYPE.ERP_LOCATION,
// dictClass: 'string',
// table: {
// width: 150
// },
// hiddenInMain:true,
// isTableForm: false,
// isForm: false,
// },
{
label: '项目代码',
field: 'projectCode',
table: {
width: 150
},
hiddenInMain:true,
isTableForm: false,
isForm: false,
},
{
label: '包装数量',
field: 'packQty',
hiddenInMain:true,
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false,
},
{
label: '包装规格',
hiddenInMain:true,
field: 'packUnit',
// dictType: DICT_TYPE.PACK_UNIT,
// dictClass: 'string',
isTable: true,
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '供应商计量数量',
field: 'supplierQty',
hiddenInMain:true,
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false,
},
{
label: '供应商计量单位',
field: 'supplierUom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isTable: true,
hiddenInMain:true,
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
{
label: '转换率',
field: 'convertRate',
form: {
component: 'InputNumber',
componentProps: {
min: 0
}
},
hiddenInMain:true,
table: {
width: 150
},
isTableForm: false,
isForm: false,
},
// {
// label: t('ts.已计划数量'),
// field: 'plannedQty',
// table: {
// width: 150
// },
// hiddenInMain:true,
// form: {
// component: 'InputNumber',
// componentProps: {
// min: 1,
// precision: 6
// },
// value: 1
// },
// isTableForm: false,
// isForm: false,
// },
{
label: t('ts.已发货数量'),
field: 'shippedQty',
table: {
width: 150
},
hiddenInMain:true,
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
},
value: 1
},
isTableForm: false,
isForm: false,
},
{
label: t('ts.已收货数量'),
field: 'receivedQty',
table: {
width: 150
},
hiddenInMain:true,
form: {
component: 'InputNumber',
value: 0,
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: t('ts.已退货数量'),
field: 'returnedQty',
table: {
width: 150
},
hiddenInMain:true,
form: {
component: 'InputNumber',
value: 0,
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: t('ts.已上架数量'),
field: 'putawayQty',
table: {
width: 150
},
hiddenInMain:true,
form: {
component: 'InputNumber',
value: 1,
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: t('ts.单价'),
field: 'singlePrice',
table: {
width: 150
},
hiddenInMain:true,
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: '金额',
field: 'amount',
table: {
width: 150
},
hiddenInMain:true,
form: {
component: 'InputNumber',
componentProps: {
min: 1,
precision: 6
}
},
isTableForm: false,
isForm: false
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
table: {
width: 150
},
hiddenInMain:true,
tableForm:{
type:'Select',
default: 'TRUE',
inactiveValue: 'FALSE',
activeValue: 'TRUE'
},
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
}
},
{
label: '超收百分比',
field: 'overReceivingPercent',
table: {
width: 150
},
hiddenInMain:true,
form: {
component: 'InputNumber',
componentProps: {
min: 0
}
},
isTable:false,
isTableForm:false,
tableForm: {
type: 'InputNumber',
min: 0
}
},
{
label: '创建者',
field: 'creator',
isTableForm: false,
table: {
width: 150
},
hiddenInMain:true,
isForm: false,
},
{
label: '创建时间',
field: 'createTime',
isTable: true,
isTableForm: false,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 180
},
hiddenInMain:true,
isForm: false,
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '最后更新者',
field: 'updater',
isTableForm: false,
table: {
width: 150
},
hiddenInMain:true,
isForm: false,
// form: {
// component: 'DatePicker',
// componentProps: {
// style: {width:'100%'},
// type: 'datetime',
// dateFormat: 'YYYY-MM-DD HH:mm:ss',
// valueFormat: 'x',
// }
// }
},
{
label: '最后更新时间',
field: 'updateTime',
isTableForm: false,
isTable: true,
hiddenInMain:true,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
table: {
width: 150
},
isForm: false,
form: {
component: 'DatePicker',
componentProps: {
style: {width:'100%'},
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
}
},
{
label: '备注',
hiddenInMain:true,
field: 'remark',
table: {
width: 150
},
},
{
label: '操作',
hiddenInMain:true,
field: 'action',
isDetail: false,
isForm: false ,
table: {
width: 150,
fixed: 'right'
},
isTableForm:false,
}
]))
//表单校验
export const PurchaseDetailRules = reactive({
lineNumber: [
{ required: true, message: '请输入行号', trigger: 'blur' },
// { max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
packQty: [
{ required: true, message: '请输入包装数量', trigger: 'blur' }
],
packUnit: [
{ required: true, message: '请选择包装规格', trigger: 'change' }
],
convertRate: [
{ required: true, message: '请输入转换率', trigger: 'blur' }
],
taxRate: [
{ required: true, message: '请输入税率', trigger: 'blur' }
],
shippedQty: [
{ required: true, message: '请输入已发货数量', trigger: 'blur' }
],
receivedQty: [
{ required: true, message: '请输入已收货数量', trigger: 'blur' }
],
returnedQty: [
{ required: true, message: '请输入已退货数量', trigger: 'blur' }
],
putawayQty: [
{ required: true, message: '请输入已上架数量', trigger: 'blur' }
],
overReceivingPercent: [
{ required: true, message: '请输入超收百分比', trigger: 'blur' }
],
orderQty: [
{ required: true, message: '请输入订单数量', trigger: 'blur' }
],
// uom: [
// { required: true, message: '请选择计量单位', trigger: 'change' }
// ],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
nuumber: [
{ required: true, message: '请输入单据号', trigger: 'blur' }
],
itemCode: [
{ required: true, message: '请选择物料代码', trigger: 'change' }
],
remark: [
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
})
Loading…
Cancel
Save