zhang_li
3 months ago
3 changed files with 1666 additions and 0 deletions
@ -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' }) |
|||
} |
@ -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> |
@ -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…
Reference in new issue