You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
550 lines
20 KiB
550 lines
20 KiB
<template>
|
|
<ContentWrap>
|
|
<!-- 搜索工作栏 -->
|
|
<Search :schema="SupplierdeliverRequestMain.allSchemas.searchSchema" @search="setSearchParams"
|
|
@reset="setSearchParams" />
|
|
</ContentWrap>
|
|
|
|
<!-- 列表头部 -->
|
|
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName"
|
|
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick"
|
|
:allSchemas="SupplierdeliverRequestMain.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 #number="{ row }">
|
|
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
|
|
<span>{{ row.number }}</span>
|
|
</el-button>
|
|
</template>
|
|
<template #action="{ row }">
|
|
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event, row)" />
|
|
</template>
|
|
</Table>
|
|
</ContentWrap>
|
|
|
|
<!-- 表单弹窗:添加/修改 -->
|
|
<BasicForm ref="formRef" @success="getList" :rules="SupplierdeliverRequestMainRules"
|
|
:formAllSchemas="SupplierdeliverRequestMain.allSchemas" :tableAllSchemas="SupplierdeliverRequestDetail.allSchemas"
|
|
:tableFormRules="SupplierdeliverRequestDetailRules" :tableData="tableData"
|
|
:apiUpdate="SupplierdeliverRequestMainApi.updateSupplierdeliverRequestMain"
|
|
:apiCreate="SupplierdeliverRequestMainApi.createSupplierdeliverRequestMain" :isBusiness="true"
|
|
@handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable" @searchTableSuccess="searchTableSuccess"
|
|
@submitForm="submitForm" />
|
|
|
|
<!-- 详情 -->
|
|
<Detail ref="detailRef" :isBasic="false" :allSchemas="SupplierdeliverRequestMain.allSchemas"
|
|
:detailAllSchemas="SupplierdeliverRequestDetail.allSchemas"
|
|
:detailAllSchemasRules="SupplierdeliverRequestDetailRules"
|
|
:apiCreate="SupplierdeliverRequestDetailApi.createSupplierdeliverRequestDetail"
|
|
:apiUpdate="SupplierdeliverRequestDetailApi.updateSupplierdeliverRequestDetail"
|
|
:apiPage="SupplierdeliverRequestDetailApi.getSupplierdeliverRequestDetailPage"
|
|
:apiDelete="SupplierdeliverRequestDetailApi.deleteSupplierdeliverRequestDetail" :Echo="Echo"
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" />
|
|
|
|
<!-- 导入 -->
|
|
<ImportForm ref="importFormRef" url="/wms/supplierdeliver-request-main/import"
|
|
:importTemplateData="importTemplateData" @success="importSuccess" :updateIsDisable="true" :coverIsDisable="true"
|
|
:mode="2" />
|
|
|
|
<!-- 打印 -->
|
|
<point ref='pointRef' :detailListTableColumns='detailListTableColumns' />
|
|
<!-- <el-dialog v-model="dialogVisible" :title="dialogTitle" width="60%">
|
|
<Table :columns="detailListTableColumns" :data="detatableData.tableList" :loading="detatableData.loading" :pagination="{
|
|
total: detatableData.total
|
|
}" v-model:pageSize="detatableData.pageSize" v-model:currentPage="detatableData.currentPage"
|
|
v-model:sort="detatableData.sort">
|
|
<template #batch="{ row }">
|
|
<el-input v-model="row.batch">{{ row.batch }}</el-input>
|
|
</template>
|
|
</Table>
|
|
<el-button @click="closeDialog">关闭</el-button>
|
|
<el-button @click="genLabel()">生成标签</el-button>
|
|
|
|
<el-button @click="print">打印</el-button>
|
|
</el-dialog> -->
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import download from '@/utils/download'
|
|
import { getAccessToken } from '@/utils/auth'
|
|
import { SupplierdeliverRequestMain, SupplierdeliverRequestMainRules, SupplierdeliverRequestDetail, SupplierdeliverRequestDetailRules } from './supplierdeliverRequestMain.data'
|
|
import * as SupplierdeliverRequestMainApi from '@/api/wms/supplierdeliverRequestMain'
|
|
import * as SupplierdeliverRequestDetailApi from '@/api/wms/supplierdeliverRequestDetail'
|
|
import * as PurchasePlanDetailApi from '@/api/wms/purchasePlanDetail'
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons'
|
|
import point from '@/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/point.vue'
|
|
// import * as PackageApi from '@/api/wms/package'
|
|
// import * as BarbasicApi from '@/api/wms/barbasic'
|
|
|
|
// 供应商发货申请
|
|
defineOptions({ name: 'SupplierdeliverRequestMain' })
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
const { t } = useI18n() // 国际化
|
|
|
|
const route = useRoute() // 路由信息
|
|
const routeName = ref()
|
|
routeName.value = route.name
|
|
const tableColumns = ref(SupplierdeliverRequestMain.allSchemas.tableColumns)
|
|
|
|
// 字段设置 更新主列表字段
|
|
const updataTableColumns = (val) => {
|
|
tableColumns.value = val
|
|
}
|
|
|
|
// 查询页面返回
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
|
|
nextTick(() => {
|
|
if (type == 'tableForm') {
|
|
// 明细查询页赋值
|
|
row[formField] = val[0][searchField]
|
|
} else {
|
|
const setV = {}
|
|
setV[formField] = val[0][searchField]
|
|
|
|
if(formField=='ppNumber'){
|
|
// 获取子表数据 getBomDisassemble
|
|
PurchasePlanDetailApi.getPurchasePlanDetailList({
|
|
number: val[0]['number']}).then(res => {
|
|
if (res) tableData.value = res;
|
|
tableData.value.forEach(item=>{
|
|
item.batch = item.toBatch
|
|
item.qty = 1
|
|
})
|
|
}).catch(err => {
|
|
console.log(err)
|
|
})
|
|
}
|
|
formRef.setValues(setV)
|
|
}
|
|
})
|
|
}
|
|
// 查询页面返回——详情
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
|
|
nextTick(() => {
|
|
const setV = {}
|
|
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: SupplierdeliverRequestMainApi.getSupplierdeliverRequestMainPage // 分页接口
|
|
})
|
|
|
|
// 获得表格的各种操作
|
|
const { getList, setSearchParams } = tableMethods
|
|
|
|
// 列表头部按钮
|
|
const HeadButttondata = [
|
|
defaultButtons.defaultAddBtn({ hasPermi: 'wms:supplierdeliver-request-main:create' }), // 新增——需要手动修改下权限
|
|
defaultButtons.defaultImportBtn({ hasPermi: 'wms:supplierdeliver-request-main:import' }), // 导入
|
|
defaultButtons.defaultExportBtn({ hasPermi: 'wms:supplierdeliver-request-main:export' }), // 导出
|
|
defaultButtons.defaultFreshBtn(null), // 刷新
|
|
defaultButtons.defaultFilterBtn(null), // 筛选
|
|
defaultButtons.defaultSetBtn(null), // 设置
|
|
// {
|
|
// label: '自定义扩展按钮',
|
|
// name: 'zdy',
|
|
// hide: false,
|
|
// type: 'primary',
|
|
// icon: 'Select',
|
|
// color: ''
|
|
// },
|
|
]
|
|
|
|
// 头部按钮事件
|
|
const buttonBaseClick = (val, item) => {
|
|
if (val == 'add') { // 新增
|
|
openForm('create')
|
|
} else if (val == 'import') { // 导入
|
|
handleImport()
|
|
} else if (val == 'export') { // 导出
|
|
handleExport()
|
|
} else if (val == 'refresh') { // 刷新
|
|
getList()
|
|
} else if (val == 'filtrate') { // 筛选
|
|
}
|
|
}
|
|
|
|
// 根据状态返回该按钮是否显示
|
|
const isShowMainButton = (row, val) => {
|
|
if (val.indexOf(row.status) > -1) {
|
|
return false
|
|
} else {
|
|
return true
|
|
}
|
|
}
|
|
|
|
// 列表-操作按钮
|
|
const butttondata = (row) => {
|
|
return [
|
|
defaultButtons.mainListPurchasePlanOpeBtn({ hide: isShowMainButton(row, ['5']) }), // 打开
|
|
defaultButtons.mainListPurchasePlanCloBtn({ hide: isShowMainButton(row, ['1', '2', '4']) }), // 关闭
|
|
defaultButtons.mainListPlanSubBtn({ hide: isShowMainButton(row, ['1']) }), // 提交审批
|
|
defaultButtons.mainListPlanAppBtn({ hide: isShowMainButton(row, ['2']) }), // 审批通过
|
|
defaultButtons.mainListPlanTurBtn({ hide: isShowMainButton(row, ['2']) }), // 驳回按钮
|
|
defaultButtons.mainListEditBtn({ hasPermi: 'wms:supplierdeliver-request-main:update' }), // 编辑
|
|
defaultButtons.mainListDeleteBtn({ hasPermi: 'wms:supplierdeliver-request-main:delete' }), // 删除
|
|
defaultButtons.mainListPointBtn(null), // 标签打印
|
|
defaultButtons.mainListDocumentPrintBtn(null), // 单据打印
|
|
// 生成记录
|
|
{
|
|
label: '处理',
|
|
name: 'genRecords',
|
|
hide: isShowMainButton(row, ['3']),
|
|
type: 'primary',
|
|
icon: '',
|
|
color: '',
|
|
hasPermi: '',
|
|
link: true, // 文本展现按钮
|
|
},
|
|
]
|
|
}
|
|
|
|
// 列表-操作按钮事件
|
|
const buttonTableClick = async (val, row) => {
|
|
if (val == 'mainPurPlanOpe') { // 打开
|
|
handleOpe(row.id)
|
|
} else if (val == 'mainPurPlanClo') {// 关闭
|
|
handleClo(row.id)
|
|
} else if (val == 'mainPlanSub') { // 提交审批
|
|
handleSub(row.id)
|
|
} else if (val == 'mainPlanApp') { // 审批通过
|
|
handleApp(row.id)
|
|
} else if (val == 'mainPlanTur') { // 驳回按钮
|
|
handleTur(row.id)
|
|
}else if (val == 'genRecords') { // 处理
|
|
genRecords(row.id)
|
|
}else if (val == 'edit') { // 编辑
|
|
openForm('update', row)
|
|
} else if (val == 'delete') { // 删除
|
|
handleDelete(row.id)
|
|
} else if (val == 'point') { // 标签打印
|
|
handlePoint(row)
|
|
} else if (val == 'documentPrint') { // 单据打印
|
|
handleDocumentPrint(row.id)
|
|
}
|
|
}
|
|
|
|
/** 详情操作 */
|
|
const detailRef = ref()
|
|
const openDetail = (row : any, titleName : any, titleValue : any) => {
|
|
detailRef.value.openDetail(row, titleName, titleValue)
|
|
}
|
|
//添加/修改操作
|
|
const formRef = ref()
|
|
const openForm = async (type: string, row?: number) => {
|
|
tableData.value = [] // 重置明细数据
|
|
formRef.value.open(type, row)
|
|
}
|
|
|
|
/** 删除按钮操作 */
|
|
const handleDelete = async (id : number) => {
|
|
try {
|
|
// 删除的二次确认
|
|
await message.delConfirm()
|
|
// 发起删除
|
|
await SupplierdeliverRequestMainApi.deleteSupplierdeliverRequestMain(id)
|
|
message.success(t('common.delSuccess'))
|
|
// 刷新列表
|
|
await getList()
|
|
} catch { }
|
|
}
|
|
|
|
/** 关闭按钮操作 */
|
|
const handleClo = async (id : number) => {
|
|
try {
|
|
// 关闭的二次确认
|
|
await message.confirm('是否关闭所选中数据?')
|
|
// 发起关闭
|
|
await SupplierdeliverRequestMainApi.cloSupplierdeliverRequestMain(id)
|
|
message.success(t('关闭成功!'))
|
|
// 刷新列表
|
|
await getList()
|
|
} catch { }
|
|
}
|
|
|
|
/** 打开按钮操作 */
|
|
const handleOpe = async (id : number) => {
|
|
try {
|
|
// 打开的二次确认
|
|
await message.confirm('是否打开所选中数据?')
|
|
// 发起打开
|
|
await SupplierdeliverRequestMainApi.opeSupplierdeliverRequestMain(id)
|
|
message.success(t('打开成功!'))
|
|
// 刷新列表
|
|
await getList()
|
|
} catch { }
|
|
}
|
|
|
|
/** 提交审批按钮操作 */
|
|
const handleSub = async (id : number) => {
|
|
try {
|
|
// 提交审批的二次确认
|
|
await message.confirm('是否提交审批所选中数据?')
|
|
// 发起提交审批
|
|
await SupplierdeliverRequestMainApi.subSupplierdeliverRequestMain(id)
|
|
message.success(t('提交审批成功!'))
|
|
// 刷新列表
|
|
await getList()
|
|
} catch { }
|
|
}
|
|
|
|
/** 审批通过按钮操作 */
|
|
const handleApp = async (id : number) => {
|
|
try {
|
|
// 审批通过的二次确认
|
|
await message.confirm('是否审批通过所选中数据?')
|
|
// 发起审批通过
|
|
await SupplierdeliverRequestMainApi.appSupplierdeliverRequestMain(id)
|
|
message.success(t('审批通过成功!'))
|
|
// 刷新列表
|
|
await getList()
|
|
} catch { }
|
|
}
|
|
|
|
/** 驳回按钮操作 */
|
|
const handleTur = async (id : number) => {
|
|
try {
|
|
// 驳回的二次确认
|
|
await message.confirm('是否驳回所选中数据?')
|
|
// 发起驳回
|
|
await SupplierdeliverRequestMainApi.rejSupplierdeliverRequestMain(id)
|
|
message.success(t('驳回成功!'))
|
|
// 刷新列表
|
|
await getList()
|
|
} catch { }
|
|
}
|
|
|
|
/** 处理按钮操作 */
|
|
const genRecords = async (id : number) => {
|
|
try {
|
|
// 处理的二次确认
|
|
await message.confirm('是否处理所选中数据?')
|
|
// 发起处理
|
|
await SupplierdeliverRequestMainApi.genRecordsSupplierdeliverRequestMain(id)
|
|
message.success(t('处理成功!'))
|
|
// 刷新列表
|
|
await getList()
|
|
} catch { }
|
|
}
|
|
|
|
/** 导出按钮操作 */
|
|
const exportLoading = ref(false) // 导出的加载中
|
|
const handleExport = async () => {
|
|
try {
|
|
// 导出的二次确认
|
|
await message.exportConfirm()
|
|
// 发起导出
|
|
exportLoading.value = true
|
|
const data = await SupplierdeliverRequestMainApi.exportSupplierdeliverRequestMain(setSearchParams)
|
|
download.excel(data, '供应商发货申请主.xlsx')
|
|
} catch {
|
|
} finally {
|
|
exportLoading.value = false
|
|
}
|
|
}
|
|
|
|
const detailTableColumns = ref(SupplierdeliverRequestDetail.allSchemas.tableColumns)
|
|
const detailListTableColumns = detailTableColumns.value.filter(item => item.label != '操作' && item.label != '创建者' && item.label != '创建时间' && item.label != '最后更新者' && item.label != '最后更新时间')
|
|
const dialogVisible = ref(false)
|
|
const isShow = ref(false)
|
|
const dialogTitle = ref('')
|
|
const closeDialog = () => {
|
|
dialogVisible.value = false
|
|
isShow.value = false
|
|
}
|
|
|
|
/** 生成标签按钮操作 */
|
|
const genLabel = async () => {
|
|
try {
|
|
// 生成标签的二次确认
|
|
await message.confirm('是否为此数据生成标签?')
|
|
// 发起生成标签
|
|
await SupplierdeliverRequestMainApi.genLabel(genLabelId.value)
|
|
dialogVisible.value = false
|
|
isShow.value = false
|
|
message.success(t('生成标签成功!'))
|
|
// 刷新列表
|
|
await getList()
|
|
} catch { }
|
|
}
|
|
|
|
const BASE_URL = 'http://dev.ccwin-in.com:25110'
|
|
const src = ref(BASE_URL + '/jmreport/view/881303562245316608?token=' + getAccessToken())
|
|
const genLabelId = ref();
|
|
// 标签打印
|
|
const pointRef = ref()
|
|
const handlePoint = async (row) => {
|
|
|
|
pointRef.value.openPoint(row.id)
|
|
// console.log(tableObject.params);
|
|
// dialogVisible.value = true
|
|
// dialogTitle.value = row.number + '单据号'
|
|
// genLabelId.value = row.number
|
|
}
|
|
|
|
const print = async () => {
|
|
//向包装表里插入数据
|
|
// const packageArray:any= ref([])
|
|
// let packageObject = {
|
|
// itemCode: '',
|
|
// itemName: '',
|
|
// itemDesc1: '',
|
|
// itemDesc2: '',
|
|
// batch: '',
|
|
// altBatch: '',
|
|
// produceDate: '',
|
|
// validityDays: '',
|
|
// expireDate: '',
|
|
// uom: '',
|
|
// qty: '',
|
|
// altUom: '',
|
|
// altQty: '',
|
|
// convertRate: '',
|
|
// stdPackQty: '',
|
|
// stdPackUnit: '',
|
|
// toWarehouseCode: '',
|
|
// toDockCode: '',
|
|
// toLocationCode: '',
|
|
// supplierCode: '',
|
|
// supplierItemCode: '',
|
|
// poNumber: '',
|
|
// poLine: '',
|
|
// rpNumber: '',
|
|
// asnNumber: '',
|
|
// }
|
|
// //获取主表数据
|
|
// await SupplierdeliverRequestMainApi.getSupplierdeliverRequestMainPage({
|
|
// number: detatableData.tableList[0].number
|
|
// }).then(res => {
|
|
// detatableData.tableList.forEach(item => {
|
|
// packageObject.itemCode=item.itemCode
|
|
// packageObject.itemName=item.itemName
|
|
// packageObject.itemDesc1=item.itemDesc1
|
|
// packageObject.itemDesc2=item.itemDesc2
|
|
// packageObject.batch=item.batch
|
|
// packageObject.altBatch=item.altBatch
|
|
// packageObject.produceDate=item.produceDate
|
|
// packageObject.expireDate=item.expireDate
|
|
// packageObject.uom=item.uom
|
|
// packageObject.qty=item.qty
|
|
// packageObject.stdPackQty=item.stdPackQty
|
|
// packageObject.stdPackUnit=item.stdPackUnit
|
|
// packageObject.convertRate=item.convertRate
|
|
// packageObject.poNumber=item.poNumber
|
|
// packageObject.poLine=item.poLine
|
|
// packageObject.supplierCode=res.list[0].supplierCode
|
|
// packageObject.rpNumber=res.list[0].ppNumber
|
|
// packageArray.value.push(packageObject)
|
|
// })
|
|
// })
|
|
// const barBasicArray:any =ref([])
|
|
// let barBasicObject = {
|
|
// type: '',
|
|
// template: '',
|
|
// status: '',
|
|
// relateNumber: '',
|
|
// barcodeString: '',
|
|
// printTimes: '',
|
|
// lastPrintTime: '',
|
|
// lastPrintUserId: '',
|
|
// lastPrintUserName: '',
|
|
// }
|
|
// // 获取返回的包装号更新标签表
|
|
// await PackageApi.createPackage(JSON.parse(JSON.stringify(packageArray.value))).then(res => {
|
|
// res.list.forEach(item => {
|
|
// barBasicObject.type = 'PurchaseLabel'
|
|
// barBasicObject.relateNumber = item.number
|
|
// barBasicObject.status = 'NEW'
|
|
// barBasicArray.value.push(barBasicObject)
|
|
// })
|
|
// })
|
|
// await BarbasicApi.createBarbasic(JSON.parse(JSON.stringify(barBasicArray.value)))
|
|
window.open(src.value + '&number=' + detatableData.tableList[0].number)
|
|
}
|
|
|
|
// 单据打印
|
|
const documentSrc = ref(BASE_URL + '/jmreport/view/884680688168280064?token=' + getAccessToken())
|
|
const handleDocumentPrint = async (id) => {
|
|
window.open(documentSrc.value + '&id=' + id)
|
|
}
|
|
|
|
/**
|
|
* tableForm方法
|
|
*/
|
|
const tableFormKeys = {}
|
|
SupplierdeliverRequestDetail.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) => {
|
|
tableData.value.splice(index, 1)
|
|
}
|
|
|
|
// 主子数据 提交
|
|
const submitForm = async (formType, data) => {
|
|
data.subList = tableData.value // 拼接子表数据参数
|
|
try {
|
|
if (formType === 'create') {
|
|
await SupplierdeliverRequestMainApi.createSupplierdeliverRequestMain(data)
|
|
message.success(t('common.createSuccess'))
|
|
} else {
|
|
await SupplierdeliverRequestMainApi.updateSupplierdeliverRequestMain(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: '供应商发货申请主导入模版.xlsx'
|
|
})
|
|
|
|
// 导入成功之后
|
|
const importSuccess = () => {
|
|
getList()
|
|
}
|
|
|
|
// 筛选提交
|
|
const searchFormClick = (searchData) => {
|
|
tableObject.params = {
|
|
isSearch: true,
|
|
filters: searchData.filters
|
|
}
|
|
getList() // 刷新当前列表
|
|
}
|
|
|
|
/** 初始化 **/
|
|
onMounted(async () => {
|
|
getList()
|
|
importTemplateData.templateUrl = await SupplierdeliverRequestMainApi.importTemplate()
})
</script>
|
|
|