| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123 |
- <template>
- <div class="ele-body">
- <el-card shadow="never" v-loading="loading">
- <div class="switch">
- <div class="switch_left">
- <ul>
- <li
- v-for="item in tabOptions"
- :key="item.key"
- :class="{ active: activeComp == item.key }"
- @click="activeComp = item.key"
- style="height: 42px; line-height: 38px"
- >
- <el-badge :value="toDoReminder[item.reminder] || 0" class="item">
- {{ item.name }}
- </el-badge>
- </li>
- </ul>
- </div>
- </div>
- <div class="main" style="padding: 0 10px">
- <div v-if="activeComp == 'saleorder'">
- <div class="ele-border-lighter form-content" v-loading="loading">
- <search-table ref="searchTableRef" @search="reload"></search-table>
- <div class="table-container">
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- height="calc(100vh - 365px)"
- style="margin-bottom: 10px"
- full-height="calc(100vh - 116px)"
- tool-class="ele-toolbar-form"
- :selection.sync="selection"
- :page-size="20"
- @columns-change="handleColumnChange"
- :cache-key="cacheKeyUrl"
- show-summary
- :summary-method="getSummaries"
- @header-dragend="handleHeaderDragend"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="openEditNew('add', {})"
- >
- 新建
- </el-button>
- <el-button
- size="small"
- type="danger"
- el-icon-delete
- class="ele-btn-icon"
- @click="allDelBtn"
- :disabled="selection?.length === 0"
- >
- 批量删除
- </el-button>
- <el-button
- type="primary"
- size="small"
- icon="el-icon-upload2"
- @click="uploadFile"
- >导入</el-button
- >
- <exportButton
- fileName="采购订单"
- apiUrl="/eom/purchaseorder/export"
- :params="params"
- ></exportButton>
- <el-dropdown
- trigger="click"
- :disabled="selection?.length === 0"
- >
- <el-button
- type="primary"
- class="el-icon-printer"
- size="small"
- >
- 打印<i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item
- @click.native="handlePrint('printPurchaseOrderRef')"
- >采购订单</el-dropdown-item
- >
- </el-dropdown-menu>
- </el-dropdown>
- </template>
- <!-- 查看详情列 -->
- <template v-slot:relationName="{ row }">
- <el-link
- type="primary"
- :underline="false"
- @click="opencontractDetail(row)"
- >
- {{ row.relationName }}
- </el-link>
- </template>
- <template v-slot:orderNo="{ row }">
- <el-link
- type="primary"
- :underline="false"
- @click="openorderDetail(row)"
- >
- {{ row.orderNo }}
- </el-link>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-tooltip
- content="已关联来源单据,不能复制"
- :disabled="!isCannotCopy(row)"
- >
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-document-copy"
- :disabled="isCannotCopy(row)"
- @click="openEditNew('copy', row)"
- >
- 复制
- </el-link>
- </el-tooltip>
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- v-if="
- (isNeed_process_is_close &&
- [0, 3].includes(row.orderStatus)) ||
- !isNeed_process_is_close
- "
- @click="openEditNew('edit', row)"
- >
- 修改
- </el-link>
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-plus"
- @click="saleOrderSubmit(row)"
- v-if="
- isNeed_process_is_close &&
- [0, 3].includes(row.orderStatus)
- "
- >
- 提交
- </el-link>
- <el-popconfirm
- class="ele-action"
- title="确定要删除此信息吗?"
- v-if="
- (isNeed_process_is_close &&
- [0, 3].includes(row.orderStatus)) ||
- !isNeed_process_is_close
- "
- @confirm="remove([row.id])"
- >
- <template v-slot:reference>
- <el-link
- type="danger"
- :underline="false"
- icon="el-icon-delete"
- >
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-plus"
- @click="handleCommand('outsourceSend', row)"
- v-if="
- ['3', '4', '5', '6', '8', '9', '10'].includes(
- row.sourceType
- ) &&
- [2].includes(row.orderStatus) &&
- row.progress < 200
- "
- >
- 委外发货单
- </el-link>
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-plus"
- @click="handleCommand('invoice', row)"
- v-if="
- !['3', '4', '5', '6', '8', '9', '10'].includes(
- row.sourceType
- ) &&
- [2].includes(row.orderStatus) &&
- row.progress < 200 &&
- row.isShowReceiptButton == 1
- "
- >
- 收货单
- </el-link>
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-plus"
- v-if="
- row.allowDifference == 1 &&
- $hasPermission('eom:purchaseorder:adjustment')
- "
- @click="handleCommand('adjustment', row)"
- >
- 冲差
- </el-link>
- <!-- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-plus"
- @click="handleCommand('invoiceManage', row)"
- v-if="!row.hasInvoiceApply && [2].includes(row.orderStatus)"
- >
- 新增发票
- </el-link> -->
- <el-link
- v-if="$hasPermission('eom:purchaseorder:rowExport')"
- type="primary"
- :underline="false"
- icon="el-icon-download"
- @click="exportRowInfo(row)"
- >
- 导出
- </el-link>
- <el-link
- type="primary"
- :underline="false"
- @click="finish('single', row)"
- v-if="[2].includes(row.orderStatus) && row.progress != 1000"
- >
- 完结
- </el-link>
- </template>
- </ele-pro-table>
- </div>
- </div>
- </div>
- <div v-if="activeComp == 'outsourceSend'">
- <outSourceSend @getToDoReminder="getToDoReminder"></outSourceSend>
- </div>
- <div v-if="activeComp == 'invoice'">
- <invoice
- @getToDoReminder="getToDoReminder"
- ref="invoiceRef"
- ></invoice>
- </div>
- <div v-if="activeComp == 'invoiceConfirm'">
- <invoiceConfirm @getToDoReminder="getToDoReminder"></invoiceConfirm>
- </div>
- <div v-if="activeComp == 'returnorder'" class="returnorder">
- <return-goods @getToDoReminder="getToDoReminder"></return-goods>
- </div>
- <div v-if="activeComp == 'exceptionList'">
- <exceptionList :relationType="'2,5'" @getToDoReminder="getToDoReminder">
- </exceptionList>
- </div>
- <div v-if="activeComp == 'accountstatement'">
- <accountstatement
- ref="accountStatementRef"
- @getToDoReminder="getToDoReminder"
- ></accountstatement>
- </div>
- <!-- 对账池:与销售订单模块复用同一组件,靠 sourceType 区分采购/销售 -->
- <div v-if="activeComp == 'accountPool'">
- <account-pool
- :sourceType="2"
- @getToDoReminder="getToDoReminder"
- @goto-statement-edit="handleGotoStatementEdit"
- ></account-pool>
- </div>
- <div v-if="activeComp == 'adjustmentNote'">
- <adjustmentNote
- :sourceType="2"
- @getToDoReminder="getToDoReminder"
- ></adjustmentNote>
- </div>
- </div>
- </el-card>
- <add-dialog
- ref="addDialogRef"
- @done="reload"
- :isRequired="isRequired"
- ></add-dialog>
- <addDialogNew
- ref="addDialogNewRef"
- @done="reload"
- :isRequired="isRequired"
- ></addDialogNew>
- <add-invoice-dialog
- ref="invoiceDialogRef"
- @done="reload"
- ></add-invoice-dialog>
- <add-return-goods-dialog
- ref="addReturnGoodsRef"
- @done="reload"
- ></add-return-goods-dialog>
- <contractr-detail ref="contractDetailRef"></contractr-detail>
- <detail-dialog ref="contactDetailDialogRef"></detail-dialog>
- <purchasingDetail ref="purchasingDetailRef"></purchasingDetail>
- <purchasePlanDetail ref="purchasePlanDetailRef"></purchasePlanDetail>
- <inquiryDetail ref="inquiryDetailRef"></inquiryDetail>
- <addOutSourceSend
- ref="addOrEditDialogRef"
- :add-or-edit-dialog-flag.sync="addOrEditDialogFlag"
- v-if="addOrEditDialogFlag"
- @done="reload"
- ></addOutSourceSend>
- <!-- 多选删除弹窗 -->
- <pop-modal
- :visible.sync="delVisible"
- content="是否确定删除?"
- @done="commitBtn"
- />
- <process-submit-dialog
- :isNotNeedProcess="true"
- api-fun-name="purchaseorderStatusAPI"
- :isCloseRefresh="false"
- :processSubmitDialogFlag.sync="processSubmitDialogFlag"
- v-if="processSubmitDialogFlag"
- ref="processSubmitDialogRef"
- @reload="reload"
- ></process-submit-dialog>
- <addInvoiceManage
- :add-or-edit-dialog-flag.sync="addOrEditDialogFlag1"
- ref="addOrEditDialogRef"
- v-if="addOrEditDialogFlag1"
- @reload="reload"
- ></addInvoiceManage>
- <importDialog
- ref="importDialogRef"
- @success="reload"
- :fileUrl="'/eom/purchaseorder/importTemplate'"
- :isWeb="false"
- fileName="采购订单导入模板"
- apiUrl="/eom/purchaseorder/importFile"
- />
- <printPurchaseOrder
- ref="printPurchaseOrderRef"
- :groupName="groupName"
- ></printPurchaseOrder>
- <add-adjust-dialog
- v-if="addAdjustDialogFlag"
- :sourceType="2"
- :addAdjustDialogFlag.sync="addAdjustDialogFlag"
- ref="addAdjustDialogRef"
- @done="reload"
- ></add-adjust-dialog>
- </div>
- </template>
- <script>
- import searchTable from './components/searchTable.vue';
- import addDialog from './components/addDialog.vue';
- import addDialogNew from './components/addDialogNew.vue';
- import invoice from './invoice/index.vue';
- import invoiceConfirm from './invoiceConfirm/index.vue';
- import detailDialog from './components/detailDialog.vue';
- import contractrDetail from '@/views/contractManage/contractBook/components/detailDialog.vue';
- import purchasingDetail from '@/views/purchasingManage/purchaseNeedManage/components/detailDialog.vue';
- import purchasePlanDetail from '@/views/purchasingManage/purchasePlanManage/components/detailDialog.vue';
- import inquiryDetail from '@/views/purchasingManage/inquiryManage/components/detailDialog.vue';
- import addInvoiceDialog from '@/views/purchasingManage/purchaseOrder/invoice/components/addInvoiceDialog';
- import addReturnGoodsDialog from '@/views/purchasingManage/purchaseOrder/returnGoods/components/addReturnGoodsDialog';
- import addOutSourceSend from '@/views/purchasingManage/purchaseOrder/outSourceSend/components/addOrEditDialog';
- import popModal from '@/components/pop-modal';
- import accountstatement from './accountstatement/index.vue';
- import accountPool from '@/views/saleManage/saleOrder/accountPool/index.vue';
- import returnGoods from './returnGoods/index.vue';
- import addInvoiceManage from '@/views/financialManage/invoiceManage/components/addOrEditDialog.vue';
- import outSourceSend from './outSourceSend/index';
- import {
- getTableList,
- deleteInformation,
- getExport,
- batchCompleted,
- getpurchaseorderDetail
- } from '@/api/purchasingManage/purchaseOrder';
- import dictMixins from '@/mixins/dictMixins';
- import { purchaseOrderProgressStatusEnum, reviewStatus } from '@/enum/dict';
- import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
- import tabMixins from '@/mixins/tableColumnsMixin';
- import importDialog from '@/components/upload/import-dialog.vue';
- import exportButton from '@/components/upload/exportButton.vue';
- import { parameterGetByCode } from '@/api/main/index.js';
- import exceptionList from '@/views/saleManage/saleOrder/exceptionManagement/exceptionList/index.vue';
- import { getToDoReminder } from '@/api/common/index';
- import { exportTable } from '@/api/system/file/index.js';
- import printPurchaseOrder from '@/views/purchasingManage/purchaseOrder/invoice/components/print-PurchaseOrder.vue';
- import { enterprisePage } from '@/api/contractManage/contractBook';
- import { getSummaries } from '@/utils/util.js';
- // import addAdjustDialog from './adjustmentNote/components/addAdjustDialog.vue'
- import addAdjustDialog from '@/views/saleManage/saleOrder/adjustmentNote/components/addAdjustDialog.vue';
- import adjustmentNote from '@/views/saleManage/saleOrder/adjustmentNote/index.vue';
- export default {
- mixins: [dictMixins, tabMixins],
- components: {
- processSubmitDialog,
- exportButton,
- searchTable,
- returnGoods,
- accountstatement,
- accountPool,
- popModal,
- contractrDetail,
- addReturnGoodsDialog,
- addInvoiceDialog,
- invoice,
- addDialog,
- detailDialog,
- outSourceSend,
- addOutSourceSend,
- addInvoiceManage,
- importDialog,
- invoiceConfirm,
- exceptionList,
- purchasingDetail,
- purchasePlanDetail,
- inquiryDetail,
- printPurchaseOrder,
- addDialogNew,
- addAdjustDialog,
- adjustmentNote
- },
- data() {
- return {
- activeComp: 'saleorder',
- tabOptions: [
- { key: 'saleorder', name: '采购订单', reminder: 'purchaseOrderNum' },
- {
- key: 'outsourceSend',
- name: '委外发货单',
- reminder: 'outsourcingDeliveryNoteNum'
- },
- { key: 'invoice', name: '收货单', reminder: 'receiptNum' },
- {
- key: 'invoiceConfirm',
- name: '收货确认单',
- reminder: 'receiptConfirmationFormNum'
- },
- {
- key: 'exceptionList',
- name: '异常列表',
- reminder: 'purchaseExceptionListNum'
- },
- {
- key: 'returnorder',
- name: '退货单',
- reminder: 'purchaseReturnOrderNum'
- },
- {
- key: 'accountPool',
- name: '对账池',
- reminder: 'purchaseAccountStatementPoolNum'
- },
- {
- key: 'accountstatement',
- name: '对账单',
- reminder: 'purchaseStatementAccountNum'
- },
- {
- key: 'adjustmentNote',
- name: '冲差单',
- reminder: 'punchSlipForPurchaseOrderNum'
- }
- ],
- selection: [], //单选中集合
- delVisible: false, //批量删除弹框状态
- loading: false, // 加载状态
- processSubmitDialogFlag: false,
- addOrEditDialogFlag: false,
- addOrEditDialogFlag1: false,
- params: {},
- addAdjustDialogFlag: false, //冲差状态
- groupName: '',
- columns: [
- {
- width: 45,
- type: 'selection',
- columnKey: 'selection',
- align: 'center'
- },
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'orderNo',
- label: '订单编码',
- align: 'center',
- sortable: true,
- slot: 'orderNo',
- showOverflowTooltip: true,
- minWidth: 200,
- fixed: 'left'
- },
- {
- prop: 'sourceTypeName',
- label: '订单类型',
- align: 'center',
- sortable: true,
- showOverflowTooltip: true,
- minWidth: 200,
- fixed: 'left'
- },
- {
- prop: 'progress',
- label: '订单进度',
- align: 'center',
- showOverflowTooltip: true,
- formatter: (_row, _column, cellValue) => {
- return purchaseOrderProgressStatusEnum.find(
- (val) => val.value == _row.progress
- )?.label;
- },
- minWidth: 120
- },
- {
- prop: 'relationType',
- label: '来源单据类型',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150,
- formatter: (_row, _column, cellValue) => {
- return _row.relationType == 1
- ? '采购需求单'
- : _row.relationType == 2
- ? '采购计划单'
- : _row.relationType == 3
- ? '采购核价单'
- : _row.relationType == 4
- ? '采购合同'
- : '';
- }
- },
- {
- prop: 'relationName',
- label: '来源单据',
- align: 'center',
- slot: 'relationName',
- showOverflowTooltip: true,
- minWidth: 250
- },
- // {
- // prop: 'deliveryDate',
- // label: '交货日期',
- // align: 'center',
- // showOverflowTooltip: true,
- // minWidth: 200
- // },
- // {
- // prop: 'purchaseTypeName',
- // label: '采购订单类型',
- // align: 'center',
- // showOverflowTooltip: true,
- // minWidth: 140
- // },
- {
- prop: 'partaName',
- label: '采购方名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- prop: 'partaLinkName',
- label: '采购方联系人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 130
- },
- {
- prop: 'partaTel',
- label: '采购方联系电话',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 130
- },
- {
- prop: 'productNames',
- label: '名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- prop: 'productCodes',
- label: '编码',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'batchNos',
- label: '批次号',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'productCount',
- label: '数量',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'inboundCount',
- label: '收货数量',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'partbName',
- label: '供应商名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 250
- },
- {
- prop: 'partbLinkName',
- label: '供应商联系人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120
- },
- {
- prop: 'partbTel',
- label: '供应商联系电话',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 130
- },
- {
- prop: 'isInspection',
- label: '是否来料检',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 130,
- formatter: (_row, _column, cellValue) => {
- return cellValue == 1 ? '是' : '否';
- }
- },
- {
- prop: 'payAmount',
- label: '金额(元)',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 140
- },
- {
- prop: 'createUserName',
- label: '创建人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 170
- },
- {
- prop: 'createTime',
- label: '创建时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 170
- },
- {
- prop: 'orderStatus',
- label: '审核状态',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100,
- formatter: (_row, _column, cellValue) => {
- return reviewStatus[_row.orderStatus];
- }
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 340,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true,
- fixed: 'right'
- }
- ],
- cacheKeyUrl: 'eos-5f2ac512-purchaseOrder-saleorder',
- isRequired: true,
- timeR: null,
- toDoReminder: {},
- // 首页看板下钻预置的筛选条件(drillStart/drillEnd/drillStatus 落成本页接口入参)
- drillParams: {}
- };
- },
- computed: {},
- created() {
- // 先快照下钻参数:下方 isView 分支会清理地址栏,之后仍要用原始值
- const drillQuery = { ...this.$route.query };
- this.requestDict('客户状态');
- parameterGetByCode({
- code: 'order_person_info'
- }).then((res) => {
- if (res.value) {
- this.isRequired = res.value === '1';
- }
- });
- this.getToDoReminder();
- this.timeR = setInterval(() => {
- this.getToDoReminder();
- }, 60000);
- if (this.$route.query.isView) {
- this.activeComp = this.$route.query.activeComp;
- this.$nextTick(() => {
- if (this.activeComp == 'invoice') {
- this.$refs.invoiceRef.openorderDetail(
- {
- id: this.$route.query.id
- },
- 'receiveNo'
- );
- }
- const url = new URL(window.location.href);
- url.search = ''; // 清空查询参数
- window.history.pushState({}, '', url.href);
- });
- }
- this.applyDrillQuery(drillQuery);
- },
- mounted() {
- // 首页看板下钻:把日期/审核状态回填到搜索表单控件(只写值不查询,首屏查询仍由 datasource 里的 drillParams 完成一次)
- const query = this.$route.query;
- if (query.drill !== '1' || !this.$refs.searchTableRef) {
- return;
- }
- const start = query.drillStart ? `${query.drillStart} 00:00:00` : '';
- const end = query.drillEnd ? `${query.drillEnd} 23:59:59` : '';
- if (start && end) {
- this.$refs.searchTableRef.setDrillDate([start, end]);
- }
- if (query.drillStatus === 'APPROVED') {
- this.$refs.searchTableRef.setDrillStatus(2);
- }
- },
- beforeDestroy() {
- clearInterval(this.timeR);
- },
- methods: {
- /**
- * 对账池发起对账成功后跳转【对账单-修改】:
- * 先切到「对账单」页签,再让对账单列表打开该单的修改弹窗。
- * 对账单这里用的是 v-if(没有 keep-alive),切页签会重建组件,必须等 DOM 更新后再取 ref 调用
- */
- handleGotoStatementEdit(row) {
- this.activeComp = 'accountstatement';
- this.$nextTick(() => {
- this.$refs.accountStatementRef &&
- this.$refs.accountStatementRef.openEditById(row.id);
- });
- },
- getSummaries(param) {
- return getSummaries(
- param,
- ['productCount', 'inboundCount', 'payAmount'],
- ' '
- );
- },
- getToDoReminder() {
- getToDoReminder().then((res) => {
- this.toDoReminder = res;
- });
- },
- //更多菜单
- handleCommand(command, row) {
- console.log(command, row);
- if (command === 'invoice') {
- this.$refs.invoiceDialogRef.open('add', {}, row.id);
- }
- if (command === 'returnOrder') {
- this.$refs.addReturnGoodsRef.open('add', {});
- }
- if (command === 'outsourceSend') {
- this.addOrEditDialogFlag = true;
- this.$nextTick(() => {
- this.$refs.addOrEditDialogRef.open('add', {}, row.id);
- });
- }
- if (command === 'invoiceManage') {
- this.addOrEditDialogFlag1 = true;
- this.$nextTick(() => {
- this.$refs.addOrEditDialogRef.createInvoice1(row, 2, 3);
- });
- }
- // 冲差
- if (command === 'adjustment') {
- console.log(row);
- this.addAdjustDialogFlag = true;
- this.$nextTick(() => {
- this.$refs.addAdjustDialogRef.open('add', row);
- });
- }
- },
- //点击左边分类
- handleNodeClick(data, node) {
- // this.curNodeData = data;
- this.reload({ categoryId: data.id });
- },
- /**
- * 首页看板下钻:drill=1 时按看板档位预置筛选并查询一次,随后清掉 drill* 参数,避免刷新重复应用。
- * 日期落到后端 PurchaseOrderPagePO.createTimeStart/createTimeEnd,状态落到 orderStatus;
- * 无 drill 参数时本方法直接返回,页面原有默认查询不受影响。
- */
- applyDrillQuery(query) {
- if (!query || query.drill !== '1') {
- return;
- }
- const drillParams = {};
- if (query.drillStart && query.drillEnd) {
- // 与页内「创建时间」筛选一致:yyyy-MM-dd HH:mm:ss,区间含首尾当天
- drillParams.createTimeStart = `${query.drillStart} 00:00:00`;
- drillParams.createTimeEnd = `${query.drillEnd} 23:59:59`;
- }
- // APPROVED(审核通过/已审核) → orderStatus=2(见 @/enum/dict reviewStatus);
- // 其他看板状态(如 INVOICED 已开票)本列表没有对应筛选字段,忽略状态只应用日期区间
- if (query.drillStatus === 'APPROVED') {
- drillParams.orderStatus = 2;
- }
- this.drillParams = drillParams;
- if (query.drillTip) {
- this.$message.info(query.drillTip);
- }
- // 与上面 isView 分支一致的清理方式:只改地址栏,不触发路由跳转
- const url = new URL(window.location.href);
- url.search = '';
- window.history.pushState({}, '', url.href);
- },
- /* 表格数据源 */
- datasource({ page, limit, where, order }) {
- // 首页看板下钻的预置筛选:页内手动筛选优先,其余用下钻值兜底
- const drillWhere = {};
- Object.keys(this.drillParams).forEach((key) => {
- if (
- !where ||
- where[key] === undefined ||
- where[key] === null ||
- where[key] === ''
- ) {
- drillWhere[key] = this.drillParams[key];
- }
- });
- this.params = {
- pageNum: page,
- size: limit,
- ...where,
- ...drillWhere
- };
- return getTableList(this.params);
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ page: 1, where });
- },
- //新增编辑
- openEdit(type, row) {
- this.$refs.addDialogRef.open(type, row, row.id);
- this.$refs.addDialogRef.$refs.form &&
- this.$refs.addDialogRef.$refs.form.clearValidate();
- },
- //新增编辑新
- openEditNew(type, row) {
- this.$refs.addDialogNewRef.open(type, row, row.id);
- this.$refs.addDialogNewRef.$refs.form &&
- this.$refs.addDialogNewRef.$refs.form.clearValidate();
- },
- //是否不可复制(来源单据类型/来源单据有值,或已关联采购计划/合同)
- isCannotCopy(row) {
- return (
- !!row.purchasePlanId ||
- !!row.contractId ||
- !!row.relationType ||
- !!row.relationId ||
- !!row.relationCode ||
- !!row.relationName
- );
- },
- uploadFile() {
- this.$refs.importDialogRef.open();
- },
- //打印采购订单
- handlePrint(ref) {
- if (this.selection.length > 1)
- return this.$message.warning('暂不支持批量打印,请选择一条');
- // let flag = this.selection.some((item) => [2].includes(item.reviewStatus));
- // if (!flag)
- // return this.$message.warning('抱歉需要已审核的发货单才能打印,请检查');
- enterprisePage({
- pageNum: 1,
- size: 200
- }).then((res) => {
- console.log(res.list);
- if (res.list?.length > 0) {
- this.groupName = res.list[0].name;
- }
- });
- this.$refs[ref].open(this.selection[0].id);
- },
- //批量删除
- allDelBtn() {
- if (this.selection.length === 0) return;
- let flag = this.selection.some((item) =>
- [1, 2].includes(item.orderStatus)
- );
- if (flag)
- return this.$message.warning(
- '抱歉已审核、审核中的数据不能删除,请检查'
- );
- this.delVisible = true;
- },
- //删除接口
- remove(delData) {
- deleteInformation(delData).then((res) => {
- this.$message.success('删除成功!');
- this.reload();
- });
- },
- //删除弹框确定
- commitBtn() {
- const dataId = this.selection.map((v) => v.id);
- this.remove(dataId);
- },
- finish(type, row) {
- if (type == 'single') {
- batchCompleted([row.id])
- .then((res) => {
- this.$message.success(res.message);
- this.reload();
- })
- .catch((err) => {});
- }
- },
- //查看详情
- openorderDetail(row) {
- this.$refs.contactDetailDialogRef.open(row);
- },
- /**
- * 提交前必填校验:与修改弹窗(addDialogNew)基本信息里的必填项保持一致。
- * 委外销售订单自动生成的采购订单里这些信息常常是空的,直接提交会带着空值进审批,
- * 所以先在列表侧拦一道。
- * 列表列已带出这些字段,能取到值就不再请求接口;只有当字段在列表返回里不存在
- * (undefined,例如接口未返回)时,才请求详情接口兜底校验。
- */
- async validateRequiredFieldsBeforeSubmit(row) {
- const requiredFields = [
- { prop: 'partaName', label: '采购方名称' },
- { prop: 'partaLinkName', label: '采购方联系人' },
- { prop: 'partaTel', label: '采购方电话' },
- { prop: 'partbName', label: '供应商名称' },
- { prop: 'partbLinkName', label: '供应商联系人' },
- { prop: 'partbTel', label: '供应商联系电话' }
- ];
- const isEmpty = (val) =>
- val === undefined || val === null || String(val).trim() === '';
- // 列表未返回的字段视为“未知”,需要请求详情确认(空字符串属于已知的空值,直接判定缺失)
- const needDetail = requiredFields.some(
- (item) => row[item.prop] === undefined
- );
- let target = row;
- if (needDetail) {
- try {
- target = (await getpurchaseorderDetail(row.id)) || {};
- } catch (e) {
- this.$message.error('获取采购订单详情失败,无法校验必填信息');
- return false;
- }
- }
- const missing = requiredFields
- .filter((item) => isEmpty(target[item.prop]))
- .map((item) => item.label);
- if (missing.length) {
- this.$message.warning(
- `提交前请先完善必填信息:${missing.join('、')}`
- );
- return false;
- }
- return true;
- },
- async saleOrderSubmit(res) {
- const valid = await this.validateRequiredFieldsBeforeSubmit(res);
- if (!valid) {
- return;
- }
- this.processSubmitDialogFlag = true;
- this.$nextTick(() => {
- let params = {
- businessId: res.id,
- businessKey: 'purchase_order_approve',
- formCreateUserId: res.createUserId,
- variables: {
- businessCode: res.orderNo,
- businessName: res.partaName,
- businessType: res.sourceTypeName
- }
- };
- this.$refs.processSubmitDialogRef.init(params);
- });
- },
- //查看合同详情
- opencontractDetail(row) {
- let data = {
- id: row.relationId
- };
- if (row.relationType == 1) {
- this.$refs.purchasingDetailRef.open(data);
- }
- if (row.relationType == 2) {
- this.$refs.purchasePlanDetailRef.open(data);
- }
- if (row.relationType == 3) {
- this.$refs.inquiryDetailRef.open(data);
- }
- if (row.relationType == 4) {
- this.$refs.contractDetailRef.open(data);
- }
- },
- // 导出
- exportRowInfo(row) {
- console.log(row);
- getExport(row.id);
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- :deep .el-card__body {
- padding: 0;
- }
- :deep(.el-link--inner) {
- margin-left: 0px !important;
- }
- .sys-organization-list {
- height: calc(100vh - 264px);
- box-sizing: border-box;
- border-width: 1px;
- border-style: solid;
- overflow: auto;
- }
- .sys-organization-list :deep(.el-tree-node__content) {
- height: 40px;
- & > .el-tree-node__expand-icon {
- margin-left: 10px;
- }
- }
- .switch_left ul .active {
- border-top: 4px solid var(--color-primary);
- color: var(--color-primary-5);
- }
- .switch {
- padding-bottom: 20px;
- }
- .el-dropdown-link {
- cursor: pointer;
- color: var(--color-primary-5);
- }
- .el-icon-arrow-down {
- font-size: 12px;
- }
- :deep(.el-badge__content.is-fixed) {
- top: 4px;
- }
- </style>
|