零件采购订单计划
This commit is contained in:
parent
2db6477093
commit
8665c29089
@ -0,0 +1,22 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export interface MaterialPlanVO {
|
||||||
|
id: number
|
||||||
|
projectMaterialPlanNo: string
|
||||||
|
projectId: number
|
||||||
|
projectPlanId: number
|
||||||
|
submitUserId: number
|
||||||
|
submitTime: Date
|
||||||
|
auditor: number
|
||||||
|
auditTime: Date
|
||||||
|
status: number
|
||||||
|
description: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询零件采购订单计划分页
|
||||||
|
export const getPartPage = async (params) => {
|
||||||
|
return await request.get({ url: `/heli/material-plan/getPartPage`, params })
|
||||||
|
}
|
@ -1,185 +1,142 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card class="hl-card">
|
<el-card class="hl-card">
|
||||||
<template #header>
|
<template #header>
|
||||||
<span>物料采购</span>
|
<span>零件采购订单计划</span>
|
||||||
</template>
|
</template>
|
||||||
<ContentWrap class="borderxx">
|
<ContentWrap class="borderxx">
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="158px">
|
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="120px">
|
||||||
<el-form-item label="项目名称" prop="projectName">
|
<el-form-item label="项目名称" prop="projectName">
|
||||||
<el-input
|
<el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
||||||
v-model="queryParams.projectName" placeholder="项目名称" clearable @keyup.enter="handleQuery"
|
|
||||||
class="!w-240px" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="子项目名称" prop="subProjectName">
|
<el-form-item label="子项目名称" prop="projectSubName">
|
||||||
<el-input
|
<el-input v-model="queryParams.projectSubName" placeholder="请输入子项目名称" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
||||||
v-model="queryParams.subProjectName" placeholder="子项目名称" clearable @keyup.enter="handleQuery"
|
|
||||||
class="!w-240px" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="零件名称" prop="partName">
|
<el-form-item label="零件名称" prop="materialName">
|
||||||
<el-input
|
<el-input v-model="queryParams.materialName" placeholder="请输入零件名称" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
||||||
v-model="queryParams.partName" placeholder="零件名称" clearable @keyup.enter="handleQuery"
|
|
||||||
class="!w-240px" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="项目编码" prop="projectNum">
|
<el-form-item label="项目编码" prop="projectCode">
|
||||||
<el-input
|
<el-input v-model="queryParams.projectCode" placeholder="请输入项目编号" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
||||||
v-model="queryParams.projectNum" placeholder="项目编码" clearable @keyup.enter="handleQuery"
|
|
||||||
class="!w-240px" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="采购状态" prop="status">
|
<el-form-item label="采购状态" prop="status">
|
||||||
<el-select v-model="queryParams.status" placeholder="下拉选择" clearable class="!w-240px">
|
<el-select v-model="queryParams.status" placeholder="请选择采购状态" clearable class="!w-240px">
|
||||||
<el-option
|
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.PART_PURCHASE_STATUS)" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
v-for="dict in getIntDictOptions(DICT_TYPE.PART_PURCHASE_STATUS)" :key="dict.value"
|
|
||||||
:label="dict.label" :value="dict.value" />
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item style="margin-left:50px">
|
<el-form-item label="责任人" prop="ownerName">
|
||||||
|
<el-input v-model="queryParams.ownerName" placeholder="请输入责任人" clearable @keyup.enter="handleQuery" class="!w-240px"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="供应商名称" prop="supplierName">
|
||||||
|
<el-input v-model="queryParams.supplierName" placeholder="请输入供应商" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item style="margin-left:30px">
|
||||||
<el-button @click="handleQuery" type="primary">
|
<el-button @click="handleQuery" type="primary">
|
||||||
<Icon icon="ep:search" class="mr-5px" /> 搜索
|
<Icon icon="ep:search" class="mr-5px" /> 搜索
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="resetQuery">
|
<el-button @click="resetQuery">
|
||||||
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" plain @click="openForm('create')" v-hasPermi="['heli:purchase-order:create']">
|
|
||||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
@click="handleExportDetail"
|
||||||
|
:loading="exportLoading"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- <el-button type="success" plain @click="handleExportWithTax()" v-hasPermi="['heli:purchase-order:create']">
|
|
||||||
<Icon icon="ep:upload" class="mr-5px" /> 乘税率导出
|
|
||||||
</el-button>
|
|
||||||
<el-button type="success" plain @click="handleExport()" v-hasPermi="['heli:purchase-order:create']">
|
|
||||||
<Icon icon="ep:upload" class="mr-5px" /> 直接导出
|
|
||||||
</el-button> -->
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<el-card class="hl-card-info">
|
||||||
<el-table
|
<template #header>
|
||||||
v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" class="hl-table"
|
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">采购单明细</span>
|
||||||
@selection-change="handleSelectionChange" @row-click="clickRow" selection>
|
<el-button style="margin-left: 20px" @click="singleSubmissions()" type="success" size="large">批量订单生成</el-button>
|
||||||
<el-table-column type="selection" fixed width="60" />
|
<el-button style="margin-left: 20px" @click="withdraw()" type="danger" size="large">撤回</el-button>
|
||||||
<el-table-column fixed label="序号" type="index" align="center" width="60" />
|
</template>
|
||||||
<el-table-column label="采购单号" align="center" prop="projectName" fixed min-width="190">
|
<el-row>
|
||||||
<template #default="scope">
|
<el-col>
|
||||||
<el-button link type="primary" @click="openForm('detail', scope.row.id)">
|
<el-card class="hl-incard">
|
||||||
{{ scope.row.projectName }}
|
<el-form ref="multipleTable" :model="list" v-loading="formLoading" label-width="0" >
|
||||||
</el-button>
|
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" class="hl-table" @selection-change="handleSelectionChange">
|
||||||
</template>
|
<el-table-column type="selection" width="55" />
|
||||||
</el-table-column>
|
<el-table-column fixed label="序号" align="center" type="index" width="60" />
|
||||||
<el-table-column
|
<el-table-column label="子项目编码" align="center" prop="projectSubCode" min-width="180" />
|
||||||
label="单据日期" align="center" prop="createTime" :formatter="dateFormatter" min-width="180px"
|
<el-table-column label="零件名称" align="center" prop="boomName" min-width="180" />
|
||||||
fixed>
|
<el-table-column label="材质" align="center" prop="composition" min-width="120" />
|
||||||
<template #default="scope">
|
<el-table-column label="采购数量" align="center" prop="purchaseAmount" min-width="120" />
|
||||||
{{
|
<el-table-column label="计划到货日期" align="center" prop="arriveTime" min-width="120" />
|
||||||
formatDate(scope.row.createTime, 'YYYY-MM-DD')
|
<el-table-column label="供应商" align="center" prop="supplierName" min-width="180" />
|
||||||
}}
|
<el-table-column label="技术要求" align="center" prop="description" min-width="180" />
|
||||||
</template>
|
<el-table-column label="理论重量" align="center" prop="theWeight" min-width="100" />
|
||||||
</el-table-column>
|
<el-table-column label="价格" align="center" prop="estimatedPrice" min-width="100" />
|
||||||
<el-table-column label="供应商" align="center" min-width="180" prop="partName" fixed />
|
<el-table-column label="订单状态" align="center" prop="orderStatus" min-width="100" />
|
||||||
<el-table-column label="采购单类型" align="center" prop="purchaseType" min-width="210">
|
<el-table-column label="采购订单号" align="center" prop="purchaseNo" min-width="180" />
|
||||||
<template #default="scope">
|
<el-table-column label="责任人" align="center" prop="duEmpId" min-width="100" />
|
||||||
<dict-tag :type="DICT_TYPE.HELI_PROJECT_PURCHASE_ORDER_TYPE" :value="scope.row.purchaseType" />
|
<el-table-column label="操作" align="center" fixed="right" min-width="120">
|
||||||
</template>
|
<template #default="scope">
|
||||||
</el-table-column>
|
<el-button link type="primary" @click="singleSubmission(scope.row)">
|
||||||
<el-table-column label="物料需求计划单号" align="center" prop="materialPlanNo" min-width="220" />
|
订单生成
|
||||||
<el-table-column label="采购物类型" align="center" prop="goodsType" min-width="180">
|
</el-button>
|
||||||
<template #default="scope">
|
</template>
|
||||||
<dict-tag :type="DICT_TYPE.HELI_PROJECT_PURCHASE_GOODS_TYPE" :value="scope.row.goodsType" />
|
</el-table-column>
|
||||||
</template>
|
</el-table>
|
||||||
</el-table-column>
|
<!-- 分页 -->
|
||||||
<el-table-column label="采购合同号" align="center" prop="contractNo" min-width="180" />
|
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
<el-table-column label="结算币种" align="center" prop="currencyType" min-width="180">
|
</el-form>
|
||||||
<template #default="scope">
|
</el-card>
|
||||||
<dict-tag :type="DICT_TYPE.HELI_CURRENCY" :value="scope.row.currencyType" />
|
</el-col>
|
||||||
</template>
|
</el-row>
|
||||||
</el-table-column>
|
</el-card>
|
||||||
<el-table-column label="暂估价金额(元)" align="center" prop="estimatedPrice" min-width="180" />
|
<div class="hl-footer text-center">
|
||||||
<el-table-column label="实际价金额(元)" align="center" prop="actualPrice" min-width="180" />
|
|
||||||
<el-table-column label="税率" align="center" prop="taxRatio" />
|
|
||||||
<el-table-column label="备注" align="center" prop="description" />
|
|
||||||
<el-table-column label="收货状态" align="center" prop="receivingStatus" fixed="right" min-width="180">
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :type="DICT_TYPE.HELI_PURCHASE_RECEIVING_STATUS" :value="scope.row.receivingStatus" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="单据状态" align="center" prop="status" fixed="right" min-width="180">
|
|
||||||
<template #default="scope">
|
|
||||||
<dict-tag :type="DICT_TYPE.HELI_PURCHASE_ORDER_STATUS" :value="scope.row.status" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="right" fixed="right" min-width="200">
|
|
||||||
<template #header>
|
|
||||||
<span style="margin-right: 30%">操作</span>
|
|
||||||
</template>
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button
|
|
||||||
link type="primary" @click="openForm('edit', scope.row.id)"
|
|
||||||
v-if="scope.row.status == 1 || scope.row.status == 4">
|
|
||||||
编辑
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
link type="primary" @click="editReceivingStatus(scope.row.id)"
|
|
||||||
v-if="scope.row.status == 3 && scope.row.receivingStatus != 3">
|
|
||||||
完成收货
|
|
||||||
</el-button>
|
|
||||||
<el-button link type="primary" @click="openForm('detail', scope.row.id)">
|
|
||||||
查看详情
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<!-- 分页 -->
|
|
||||||
<Pagination
|
|
||||||
:total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList" />
|
|
||||||
</ContentWrap>
|
|
||||||
|
|
||||||
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
import { dateFormatter, formatDate } from '@/utils/formatTime'
|
|
||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
import * as PurchaseOrderApi from '@/api/heli/purchaseorder'
|
import { useCommonStateWithOut } from '@/store/modules/common'
|
||||||
import PurchaseOrderForm from './PurchaseOrderForm.vue'
|
import UserSelect from "@/views/heli/materialplan/userSelectNew.vue";
|
||||||
import { ElTable } from 'element-plus'
|
import {inject, ref} from "vue";
|
||||||
|
import * as MaterialPlanApi from "@/api/heli/materialplan";
|
||||||
defineOptions({ name: 'PurchaseOrder' })
|
import * as PartPurchaseOrderApi from "@/api/heli/partpurchaseorder";
|
||||||
|
import {ElTable} from "element-plus";
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
|
||||||
|
defineOptions({ name: 'standard' })
|
||||||
|
const reload: any = inject('reload')
|
||||||
|
const commonStore = useCommonStateWithOut()
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const multipleTable = ref<InstanceType<typeof ElTable>>()
|
||||||
|
const multipleSelection = ref([])
|
||||||
const loading = ref(true) // 列表的加载中
|
const loading = ref(true) // 列表的加载中
|
||||||
const list = ref([]) // 列表的数据
|
const list = ref([]) // 列表的数据
|
||||||
const total = ref(0) // 列表的总页数
|
const total = ref(0) // 列表的总页数
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
id: undefined,
|
code: undefined,
|
||||||
ids: undefined,
|
planCode: undefined,
|
||||||
|
projectCode: undefined,
|
||||||
|
projectSubCode: undefined,
|
||||||
|
customerName: undefined,
|
||||||
projectName: undefined,
|
projectName: undefined,
|
||||||
subProjectName: undefined,
|
projectSubName: undefined,
|
||||||
partName: undefined,
|
version: undefined,
|
||||||
projectNum: undefined,
|
bomStatus: undefined,
|
||||||
supplierId: undefined,
|
remark: undefined,
|
||||||
contractNo: undefined,
|
status: 0,
|
||||||
purchaseType: undefined,
|
createTime: [],
|
||||||
projectMaterialPlanId: undefined,
|
ownerName:undefined,
|
||||||
goodsType: undefined,
|
materialName:undefined,
|
||||||
currencyType: undefined,
|
projectMaterialPlanNo:undefined,
|
||||||
taxRatio: undefined,
|
supplierName:undefined,
|
||||||
estimatedPrice: undefined,
|
|
||||||
actualPrice: undefined,
|
|
||||||
status: undefined,
|
|
||||||
submitUserId: undefined,
|
|
||||||
submitTime: [],
|
|
||||||
auditor: undefined,
|
|
||||||
auditTime: [],
|
|
||||||
description: undefined,
|
|
||||||
creator: undefined,
|
|
||||||
createTime: undefined
|
|
||||||
})
|
})
|
||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const exportLoading = ref(false) // 导出的加载中
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
@ -188,137 +145,132 @@ const exportLoading = ref(false) // 导出的加载中
|
|||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
queryParams.ids = undefined
|
const data = await PartPurchaseOrderApi.getPartPage(queryParams)
|
||||||
const data = await PurchaseOrderApi.getPurchaseOrderPage(queryParams)
|
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExportDetail = async () => {
|
||||||
|
try {
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await MaterialPlanApi.exportPart(queryParams)
|
||||||
|
download.excel(data, '零件物料需求计划.xlsx')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSelectionChange = (val) => {
|
||||||
|
// multipleTable.value.clearSelection()
|
||||||
|
multipleTable.value=val
|
||||||
|
|
||||||
|
}
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
queryParams.pageNo = 1
|
queryParams.pageNo = 1
|
||||||
if (queryParams.createTime !== "Invalid Date" && queryParams.createTime !== "") {
|
|
||||||
queryParams.createTime = formatDate(queryParams.createTime, 'YYYY-MM-DD')
|
|
||||||
}
|
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
const handleSelectedUser = (currentIndex, newValue: any) => {
|
||||||
|
list.value[currentIndex].duEmpId = newValue?.id
|
||||||
|
}
|
||||||
|
const singleSubmission= (val) =>{
|
||||||
|
multipleTable.value=[]
|
||||||
|
multipleTable.value.push(val)
|
||||||
|
submitForm();
|
||||||
|
}
|
||||||
|
const singleSubmissions=()=>{
|
||||||
|
submitForm();
|
||||||
|
}
|
||||||
|
const submitForm = async () => {
|
||||||
|
try {
|
||||||
|
console.log("开始提交"); // 调试点1:确认函数是否触发
|
||||||
|
|
||||||
|
const list = multipleTable.value|| []; // 安全获取数据
|
||||||
|
console.log("明细数据:", list);
|
||||||
|
console.log(list.length)
|
||||||
|
// 1. 检查空数据
|
||||||
|
if (!list || list.length==null) {
|
||||||
|
message.error("提交明细不能为空,请确认");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 检查子项目一致性
|
||||||
|
const firstProjectSubId = list[0].projectSubId;
|
||||||
|
if (list.some(item => item.projectSubId !== firstProjectSubId)) {
|
||||||
|
message.error("零件明细不属于同一个子项目,请确认");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 校验每个零件
|
||||||
|
for (const item of list) {
|
||||||
|
if (item.projectMaterialPlanNo) {
|
||||||
|
message.error(`工序${item.procedureName}中零件 ${item.materialName} 已生成物料需求计划,请确认`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!item.boomArriveDate) { // 注意:原代码是 boomArriveDate,确保拼写正确
|
||||||
|
message.error(`工序${item.procedureName}中零件 ${item.materialName} 要求完成日期为空,请确认`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!item.duEmpId) {
|
||||||
|
message.error(`工序${item.procedureName}中零件 ${item.materialName} 责任人为空,请确认`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 添加加载状态(Element Plus 兼容处理)
|
||||||
|
formLoading.value = true;
|
||||||
|
|
||||||
|
// 5. 提交数据(添加超时处理)
|
||||||
|
const res = await Promise.race([
|
||||||
|
MaterialPlanApi.submitForm(list),
|
||||||
|
new Promise((_, reject) =>
|
||||||
|
setTimeout(() => reject(new Error("请求超时")), 30000)
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
|
||||||
|
message.success("提交成功");
|
||||||
|
getList(); // 确保刷新完成
|
||||||
|
emit('success');
|
||||||
|
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error("提交失败:", error);
|
||||||
|
message.error(`操作失败: ${error.message || "未知错误"}`);
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const withdraw = async () => {
|
||||||
|
if (queryParams.projectMaterialPlanNo==null){
|
||||||
|
message.error("物料需求单号为空,不允许撤回")
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
await MaterialPlanApi.withdraw(queryParams.projectMaterialPlanNo)
|
||||||
|
message.success("撤回成功")
|
||||||
|
// 发送操作成功的事件
|
||||||
|
getList()
|
||||||
|
emit('success')
|
||||||
|
|
||||||
|
}
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
queryFormRef.value.resetFields()
|
queryFormRef.value.resetFields()
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
const multipleTable: any = ref<InstanceType<typeof ElTable>>()
|
|
||||||
const multipleSelection: any = ref([])
|
|
||||||
|
|
||||||
const handleSelectionChange = (val: PurchaseOrderApi.PurchaseOrderVO[]) => {
|
|
||||||
multipleSelection.value = val
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const clickRow = (row: any) => {
|
|
||||||
if (multipleTable.value) { // 检查 multipleTable 是否已初始化
|
|
||||||
if (row) {
|
|
||||||
multipleTable.value.toggleRowSelection(row, undefined);
|
|
||||||
} else {
|
|
||||||
multipleTable.value.clearSelection();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.error("multipleTable is not initialized."); // 添加错误日志
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// const clickRow = (row: any) => {
|
|
||||||
// if (row) {
|
|
||||||
// multipleTable.value!.toggleRowSelection(row, undefined)
|
|
||||||
// } else {
|
|
||||||
// multipleTable.value!.clearSelection()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/** 添加/修改操作 */
|
|
||||||
const openForm = (type: string, id?: number) => {
|
|
||||||
switch (type) {
|
|
||||||
case 'create':
|
|
||||||
router.push({ path: '/purchase/purchaseorderadd', query: { id: id } })
|
|
||||||
break
|
|
||||||
case 'edit':
|
|
||||||
router.push({ path: '/purchase/purchaseorderedit', query: { id: id } })
|
|
||||||
break
|
|
||||||
case 'detail':
|
|
||||||
router.push({ path: '/purchase/purchaseorderdetail', query: { id: id } })
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 修改收货状态按钮操作 */
|
|
||||||
const editReceivingStatus = async (id: number) => {
|
|
||||||
try {
|
|
||||||
// 提示用户是否保存入库信息
|
|
||||||
await message.confirm('确认完成收货?')
|
|
||||||
// 发起修改
|
|
||||||
await PurchaseOrderApi.updateReceivingStatus(id)
|
|
||||||
message.success(t('common.updateSuccess'))
|
|
||||||
// 刷新列表
|
|
||||||
await getList()
|
|
||||||
} catch { }
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
const handleDelete = async (id: number) => {
|
|
||||||
try {
|
|
||||||
// 删除的二次确认
|
|
||||||
await message.delConfirm()
|
|
||||||
// 发起删除
|
|
||||||
await PurchaseOrderApi.deletePurchaseOrder(id)
|
|
||||||
message.success(t('common.delSuccess'))
|
|
||||||
// 刷新列表
|
|
||||||
await getList()
|
|
||||||
} catch { }
|
|
||||||
}
|
|
||||||
|
|
||||||
const getIds = async () => {
|
|
||||||
queryParams.ids = []
|
|
||||||
multipleSelection.value.forEach(item => {
|
|
||||||
queryParams.ids.push(item.id)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
const handleExport = async () => {
|
|
||||||
try {
|
|
||||||
// 导出的二次确认
|
|
||||||
await message.exportConfirm()
|
|
||||||
// 发起导出
|
|
||||||
exportLoading.value = true
|
|
||||||
await getIds()
|
|
||||||
const data = await PurchaseOrderApi.exportPurchaseOrder(queryParams)
|
|
||||||
download.excel(data, '采购订单(直接导出).xls')
|
|
||||||
} catch {
|
|
||||||
} finally {
|
|
||||||
exportLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const handleExportWithTax = async () => {
|
|
||||||
try {
|
|
||||||
// 导出的二次确认
|
|
||||||
await message.exportConfirm()
|
|
||||||
// 发起导出
|
|
||||||
exportLoading.value = true
|
|
||||||
await getIds()
|
|
||||||
const data = await PurchaseOrderApi.exportPurchaseOrderWithTax(queryParams)
|
|
||||||
download.excel(data, '采购订单(乘税率导出).xls')
|
|
||||||
} catch {
|
|
||||||
} finally {
|
|
||||||
exportLoading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(async () => {
|
onMounted(() => {
|
||||||
await getList()
|
getList()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
<style>
|
||||||
|
/* 占位样式 */
|
||||||
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user