|
|
<template> <div class="customer-css" > <!-- 查询时间和产品 --> <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;" > <el-row> <el-col :span="24" style=""> <el-form-item > <span style="cursor: pointer" slot="label" @click="getBaseList(520)"><a href="#">供应商编码</a></span> <el-input v-model="searchData.supplierNo" style="width: 130px"></el-input> </el-form-item> <el-form-item :label="'供应商名称:'"> <el-input v-model="searchData.supplierName" style="width: 130px"></el-input> </el-form-item> <el-form-item :label="'是否在用:'"> <el-select v-model="searchData.active" style="width: 130px"> <el-option label="Y" value="Y"></el-option> <el-option label="N" value="N"></el-option> </el-select> </el-form-item> <el-form-item :label="'活跃状态:'"> <el-select v-model="searchData.status" style="width: 130px"> <el-option label="Active" value="Active"></el-option> <el-option label="Inactive" value="Inactive"></el-option> </el-select> </el-form-item> <el-form-item> <span style="cursor: pointer" slot="label" @click="getBaseList(530, 'mainPlanner')"><a href="#">Planner</a></span> <el-input v-model="searchData.planner" clearable readonly style="width: 130px"></el-input> </el-form-item> <el-form-item :label="' '" > <el-button class="customer-bun-min" type="primary" @click="getMainData" style="">查询</el-button> <el-button @click="addSupplier()" type="primary" style="margin-left: 2px">新增</el-button><!-- <el-button @click="handleTestCurrentLoginSite" type="primary" style="margin-left: 2px">测试</el-button>--> <el-button @click="exportExcel()" type="primary" style="margin-left: 2px">{{'导出'}}</el-button> </el-form-item> </el-col> </el-row> </el-form>
<el-table :height="height" :data="mainDataList" border ref="mainTable" highlight-current-row @row-click="changeData" v-loading="dataListLoading" style="margin-top: 0px; width: 100%;"> <el-table-column v-for="(item,index) in columnArray1" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden"> <span v-if="item.columnProp === 'paymentTermDesc'"> {{ scope.row.paymentTermDesc || scope.row.paymentTerm }} </span> <span v-else-if="item.columnProp === 'deliveryTermDesc'"> {{ scope.row.deliveryTermDesc || scope.row.deliveryTerm }} </span> <span v-else-if="item.columnProp === 'status'" :class="getStatusClass(scope.row.status)"> {{ scope.row.status }} </span> <span v-else-if="item.columnProp === 'handlingCharge'"> {{ formatSupplierNumberDisplay(scope.row[item.columnProp]) }} </span> <span v-else-if="item.columnProp === 'defaultOriginPort'"> {{ portNameByCode(scope.row.defaultOriginPort) }} </span> <span v-else>{{ scope.row[item.columnProp] }}</span> </span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 100px"/></span> </template> </el-table-column> <!-- 操作列 --> <el-table-column fixed="right" header-align="center" align="center" width="160" label="操作"> <template slot-scope="scope"> <el-link style="cursor: pointer" @click="editSupplier(scope.row)">编辑 |</el-link> <el-link style="cursor: pointer" @click="deleteSupplier(scope.row)">删除</el-link> </template> </el-table-column> </el-table> <!-- 分页插件 --> <el-pagination style="margin-top: 0px" @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex" :page-sizes="[20, 50, 100, 200, 500]" :page-size="pageSize" :total="totalPage" layout="total, sizes, prev, pager, next, jumper"> </el-pagination>
<el-tabs v-model="activeName" style="margin-top: 0px; width: 99%;" @tab-click="tabClick" class="customer-tab" type="border-card">
<!-- <el-tab-pane label="Share" name="share" style="">--><!-- <share ref="share"></share>--><!-- </el-tab-pane>--> <el-tab-pane label="地址" name="AddressTab" style=""> <AddressTab ref="AddressTab"></AddressTab> </el-tab-pane> <el-tab-pane label="等级变更记录" name="groupChangeList" style=""> <el-table :height="height" :data="supplierGroupRequestList" border ref="table3" highlight-current-row v-loading="dataListLoading" style="margin-top: 0px; width: 100%;"> <!-- <el-table-column--> <!-- fixed="left"--> <!-- header-align="center"--> <!-- align="center"--> <!-- width="220"--> <!-- :label="'操作'">--> <!-- <template slot-scope="scope">--> <!-- </template>--> <!-- </el-table-column>--> <el-table-column v-for="(item,index) in columnArray3" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> </el-table> </el-tab-pane>
<el-tab-pane label="供应商合同" name="contract" style=""> <contract ref="contract"></contract> </el-tab-pane> <el-tab-pane label="供应商文档" name="documents" style=""> <documents ref="documents"></documents> </el-tab-pane> </el-tabs>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
<!-- 供应商编辑对话框 --> <el-dialog :visible.sync="supplierDialogVisible" width="600px" top="3vh" :close-on-click-modal="false" v-drag class="supplier-dialog"> <template slot="title"> <span class="el-dialog__title">{{ isAdd ? '新增供应商' : '编辑供应商' }}</span> <!-- SRM0006:有权限者在标题栏看到“修改ShortOffice”复选框,勾选后解锁输入框 - rqrq --> <el-checkbox v-if="!isAdd && hasShortOfficeEditPermission" v-model="shortOfficeEditable" style="margin-left: 12px">修改ShortOffice</el-checkbox> </template> <div class="dialog-content"> <el-form :model="currentSupplier" :rules="supplierRules" ref="supplierForm" label-position="top" class="supplier-form"> <div class="form-section"> <el-row :gutter="24"> <el-col :span="6"> <el-form-item label="供应商编码" prop="supplierNo"> <el-input v-model="currentSupplier.supplierNo" disabled></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="ShortOffice" prop="cShortOffice"> <el-input v-model="currentSupplier.cShortOffice" :disabled="!isAdd && !shortOfficeEditable"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="ShortNpc" > <el-input v-model="currentSupplier.cShortNpc" ></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="是否在用"> <el-select v-model="currentSupplier.active" placeholder="是否在用" style="width: 100%"> <el-option label="Y" value="Y"></el-option> <el-option label="N" value="N"></el-option> </el-select> </el-form-item> </el-col> </el-row> <el-row :gutter="24"> <el-col :span="12"> <el-form-item label="供应商名称" prop="supplierName"> <el-input v-model="currentSupplier.supplierName"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="活跃状态" prop="status"> <el-select v-model="currentSupplier.status" placeholder="请选择" style="width: 100%"> <el-option label="Active" value="Active"></el-option> <el-option label="Inactive" value="Inactive"></el-option> </el-select> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="供应商等级"> <sys-dict-select v-model="currentSupplier.supplierGroup" dict-type="supplier_group" placeholder="请选择" width="100%" /> </el-form-item> </el-col> </el-row> <el-row :gutter="24"><!-- <el-col :span="6">--><!-- <el-form-item label="供应商等级">--><!-- <el-input v-model="currentSupplier.abc"></el-input>--><!-- </el-form-item>--><!-- </el-col>--> <el-col :span="6"> <el-form-item> <span style="cursor: pointer" slot="label" @click="getBaseList(529, 'buyer')"><a href="#">采购员</a></span> <el-input v-model="currentSupplier.buyer" readonly style="width: 130px"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item> <span style="cursor: pointer" slot="label" @click="getBaseList(528, 'sourcingStaff')"><a href="#">Sourcing专员</a></span> <el-input v-model="currentSupplier.sourcingStaff" readonly style="width: 130px"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item prop="planner"> <span style="cursor: pointer" slot="label" @click="getBaseList(530, 'planner')"><a href="#">Planner</a></span> <el-input v-model="currentSupplier.planner" readonly style="width: 130px"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="供应商文档清单模板" prop="supplierDocType"> <el-select v-model="currentSupplier.supplierDocType" placeholder="请选择" filterable style="width: 100%"> <el-option v-for="item in supplierDocTypeOptions" :key="item" :label="item" :value="item"> </el-option> </el-select> </el-form-item> </el-col> </el-row> </div>
<div class="form-section"> <el-row :gutter="24"> <el-col :span="6"> <el-form-item> <span style="cursor: pointer" slot="label" @click="getBaseList(522)"><a href="#">税率编号</a></span> <el-input v-model="currentSupplier.taxCode" style="width: 130px"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item> <span style="cursor: pointer" slot="label" @click="getBaseList(523)"><a href="#">付款条款</a></span> <el-input v-model="currentSupplier.paymentTerm" style="width: 130px"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item> <span style="cursor: pointer" slot="label" @click="getBaseList(524)"><a href="#">交货条款</a></span> <el-input v-model="currentSupplier.deliveryTerm" style="width: 130px"></el-input> </el-form-item> </el-col> <el-col :span="6"> <!-- 最低出货金额改为字典选择,保存 sys_dict_data.dict_value;空表示未配置 - rqrq --> <el-form-item label="最低出货金额"> <sys-dict-select v-model="currentSupplier.minShipAccount" dict-type="min_ship_account" placeholder="请选择" width="100%" /> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="小单费"> <el-input v-model="currentSupplier.handlingCharge" type="number"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="始发港"> <el-select v-model="currentSupplier.defaultOriginPort" clearable filterable placeholder="请选择始发港" style="width: 100%"> <el-option v-for="p in originPortOptions" :key="p.portCode" :label="p.portName" :value="p.portCode"> </el-option> </el-select> </el-form-item> </el-col> </el-row> </div> <div class="form-section"> <el-row :gutter="24"> <el-col :span="6"> <el-form-item > <span style="cursor: pointer" slot="label" @click="getBaseList(513)"><a herf="#">货币</a></span> <el-input v-model="currentSupplier.currency" style="width: 130px"></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="银行名称"> <el-input v-model="currentSupplier.bankName"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="银行账号"> <el-input v-model="currentSupplier.bankAccount"></el-input> </el-form-item> </el-col> </el-row> </div> <div class="form-section"> <el-row :gutter="24"> <el-col :span="6"> <el-form-item label="联系人"> <el-input v-model="currentSupplier.contact"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="联系人电话"> <el-input v-model="currentSupplier.phoneNo"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="联系人电话2"> <el-input v-model="currentSupplier.phoneNo2"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="联系人电话3"> <el-input v-model="currentSupplier.phoneNo3"></el-input> </el-form-item> </el-col> </el-row> </div>
<div class="form-section"> <el-row :gutter="24"> <el-col :span="12"> <el-form-item label="邮箱"> <el-input v-model="currentSupplier.email"></el-input> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="邮箱2"> <el-input v-model="currentSupplier.email2"></el-input> </el-form-item> </el-col> </el-row> </div>
<div class="form-section"> <el-row :gutter="24"> <el-col :span="6"> <el-form-item label="传真号"> <el-input v-model="currentSupplier.faxNo"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="其他联系方式1"> <el-input v-model="currentSupplier.otherContact1"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="其他联系方式2"> <el-input v-model="currentSupplier.otherContact2"></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="其他联系方式3"> <el-input v-model="currentSupplier.otherContact3"></el-input> </el-form-item> </el-col>
</el-row> </div>
<div class="form-section"> <el-row :gutter="24"> <el-col :span="24"> <el-form-item label="地址"> <el-input v-model="currentSupplier.address"></el-input> </el-form-item> </el-col> </el-row> </div> <div class="form-section"> <el-row :gutter="24"> <el-col :span="24"> <el-form-item label="备注"> <el-input v-model="currentSupplier.memo" type="textarea" :rows="2" resize="none" ></el-input> </el-form-item> </el-col> </el-row> </div> </el-form> </div> <div slot="footer" class="dialog-footer" style="margin-top: 20px"> <el-button type="primary" @click="saveSupplier()">保存</el-button> <el-button @click="supplierDialogVisible = false">取消</el-button> </div> </el-dialog>
</div></template>
<script>/* 组件 */
import { searchSupplierGroupRequestList, searchSrmSupplierList, createSrmSupplier, generateSupplierNo, updateSrmSupplier, deleteSrmSupplier, listSupplierDocTypeBySite, testCurrentLoginSite} from '@/api/srm/srmSupplier.js'import excel from '@/utils/excel-util.js'import { getPermissionValue } from '@/api/sys/specialSecurity.js'import { searchPortList } from '@/api/port/portInfo.js'import Chooselist from '@/views/modules/common/Chooselist_eam'import SysDictSelect from '@/components/dict/SysDictSelect.vue'import contract from './com_srmSupplier_Contract'import share from './com_srmSupplier_share'import documents from './com_srmSupplier_DocumentDefinition'import AddressTab from './com_srmSupplier_Address'export default { data () { return { functionId: this.$route.meta.menuId, height: 200, currentRow: {}, searchData: { supplierNo: '', supplierName: '', active: '', status: '', currency:'', taxCode:'', paymentTerm:'', deliveryTerm:'', planner: '', site: this.$store.state.user.site, page: 1, limit: 10 }, pageIndex: 1, pageSize: 50, totalPage: 0, tagNo: '', currentFieldType: '', // 当前字段类型('buyer' / 'sourcingStaff' / 'planner' / 'mainPlanner')
mainDataList: [], supplierGroupRequestList: [], supplierDocTypeOptions: [], // 始发港下拉选项(来源 port_Info,is_departure_port='Y')
originPortOptions: [], dataListLoading: false, activeName: 'AddressTab', columnArray1: [ { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1SupplierNo', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'supplierNo', headerAlign: 'center', align: 'center', columnLabel: '供应商编码', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1SupplierName', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'supplierName', headerAlign: 'center', align: 'left', columnLabel: '供应商名称', columnWidth: '300', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1SupplierGroup', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'groupDesc', headerAlign: 'center', align: 'center', columnLabel: '供应商等级', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1SupplierGroup', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'status', headerAlign: 'center', align: 'center', columnLabel: '活跃状态', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1ShortOffice', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'cShortOffice', headerAlign: 'center', align: 'center', columnLabel: 'ShortOffice', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1ShortNpc', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'cShortNpc', headerAlign: 'center', align: 'center', columnLabel: 'ShortNpc', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1ProductionLeadTime', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'productionLeadTime', headerAlign: 'center', align: 'center', columnLabel: 'PRODUCTION LEAD TIME', columnWidth: '160', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1DefaultOriginPort', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'defaultOriginPort', headerAlign: 'center', align: 'center', columnLabel: '默认始发港', columnWidth: '120', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1SupplierDocType', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'supplierDocType', headerAlign: 'center', align: 'center', columnLabel: '供应商文档清单模板', columnWidth: '150', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1Buyer', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'buyer', headerAlign: 'center', align: 'left', columnLabel: '采购员', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1SourcingStaff', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'sourcingStaff', headerAlign: 'center', align: 'left', columnLabel: 'Sourcing专员', columnWidth: '120', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1Planner', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'planner', headerAlign: 'center', align: 'left', columnLabel: 'Planner', columnWidth: '120', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1Tax', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'taxCode', headerAlign: 'center', align: 'center', columnLabel: '税率编号', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1TaxDesc', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'taxDesc', headerAlign: 'center', align: 'left', columnLabel: '税率说明', columnWidth: '120', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1SupplierTaxRate', headerAlign: 'center', align: 'center', columnLabel: '税率文本', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1PaymentTerm', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'paymentTermDesc', headerAlign: 'center', align: 'center', columnLabel: '付款条款', columnWidth: '120', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1DeliveryTerm', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'deliveryTermDesc', headerAlign: 'center', align: 'center', columnLabel: '交货条款', columnWidth: '120', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1MinShipAccount', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'minShipAccount', headerAlign: 'center', align: 'center', columnLabel: '最低出货金额', columnWidth: '120', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1HandlingCharge', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'handlingCharge', headerAlign: 'center', align: 'center', columnLabel: '小单费', columnWidth: '120', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1Currency', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'currency', headerAlign: 'center', align: 'center', columnLabel: '货币', columnWidth: '80', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1Contact', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'contact', headerAlign: 'center', align: 'left', columnLabel: '联系人', columnWidth: '150', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1PhoneNo', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'phoneNo', headerAlign: 'center', align: 'left', columnLabel: '联系人电话', columnWidth: '150', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1PhoneNo2', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'phoneNo2', headerAlign: 'center', align: 'left', columnLabel: '联系人电话2', columnWidth: '150', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1PhoneNo3', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'phoneNo3', headerAlign: 'center', align: 'left', columnLabel: '联系人电话3', columnWidth: '150', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1Email', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'email', headerAlign: 'center', align: 'left', columnLabel: '邮箱', columnWidth: '150', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1Email2', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'email2', headerAlign: 'center', align: 'left', columnLabel: '邮箱2', columnWidth: '150', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1FaxNo', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'faxNo', headerAlign: 'center', align: 'left', columnLabel: '传真号', columnWidth: '150', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1OtherContact1', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'otherContact1', headerAlign: 'center', align: 'left', columnLabel: '其他联系方式1', columnWidth: '150', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1OtherContact2', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'otherContact2', headerAlign: 'center', align: 'left', columnLabel: '其他联系方式2', columnWidth: '150', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1OtherContact3', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'otherContact3', headerAlign: 'center', align: 'left', columnLabel: '其他联系方式3', columnWidth: '150', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1Address', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'address', headerAlign: 'center', align: 'left', columnLabel: '地址', columnWidth: '250', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1BankName', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'bankName', headerAlign: 'center', align: 'left', columnLabel: '银行名称', columnWidth: '150', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1BankAccount', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'bankAccount', headerAlign: 'center', align: 'left', columnLabel: '银行账号', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1TaxNo', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'taxNo', headerAlign: 'center', align: 'left', columnLabel: '纳税人识别号', columnWidth: '140', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1Memo', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'memo', headerAlign: 'center', align: 'left', columnLabel: '备注', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1CreateDate', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'createDate', headerAlign: 'center', align: 'left', columnLabel: '创建日期', columnWidth: '120', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1UpdateDate', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'updateDate', headerAlign: 'center', align: 'left', columnLabel: '更新日期', columnWidth: '120', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1CreateBy', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'createBy', headerAlign: 'center', align: 'left', columnLabel: '创建者', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1UpdateBy', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'updateBy', headerAlign: 'center', align: 'left', columnLabel: '更新者', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table1Active', tableId: '811001Table1', tableName: '供应商信息', columnProp: 'active', headerAlign: 'center', align: 'center', columnLabel: '是否在用', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false } ], columnArray3: [ { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table3RequestNo', tableId: '811001Table3', tableName: '供应商等级变更记录', columnProp: 'requestNo', headerAlign: 'center', align: 'left', columnLabel: '请求编号', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table3RequestDate', tableId: '811001Table3', tableName: '供应商等级变更记录', columnProp: 'requestDate', headerAlign: 'center', align: 'left', columnLabel: '请求日期', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table3OldSupplierGroup', tableId: '811001Table3', tableName: '供应商等级变更记录', columnProp: 'oldSupplierGroup', headerAlign: 'center', align: 'left', columnLabel: '旧供应商等级', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table3NewSupplierGroup', tableId: '811001Table3', tableName: '供应商等级变更记录', columnProp: 'newSupplierGroup', headerAlign: 'center', align: 'left', columnLabel: '新供应商等级', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table3Reason', tableId: '811001Table3', tableName: '供应商等级变更记录', columnProp: 'reason', headerAlign: 'center', align: 'left', columnLabel: '原因', columnWidth: '200', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table3Status', tableId: '811001Table3', tableName: '供应商等级变更记录', columnProp: 'status', headerAlign: 'center', align: 'left', columnLabel: '是否在用', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false }, { userId: this.$store.state.user.name, functionId: this.functionId, serialNumber: '811001Table3RequestBy', tableId: '811001Table3', tableName: '供应商等级变更记录', columnProp: 'requestBy', headerAlign: 'center', align: 'left', columnLabel: '请求者', columnWidth: '100', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: false } ], exportName: '供应商信息' + this.dayjs().format('YYYYMMDDHHmmss'), // 供应商对话框相关
supplierDialogVisible: false, isAdd: true, // SRM0006 特殊权限:是否允许修改已创建供应商的 ShortOffice - rqrq
hasShortOfficeEditPermission: false, // 编辑弹窗内 ShortOffice 是否已解锁(每次打开默认锁定)- rqrq
shortOfficeEditable: false, currentSupplier: { cShortOffice: '', cShortNpc: '', supplierNo: '', supplierName: '', supplierDocType: '', active: 'Y', supplierGroup:'', abc: '', sourcingStaff: '', currency:'', taxCode:'', paymentTerm:'', deliveryTerm:'', minShipAccount: '', handlingCharge: 0, contract:'', phoneNo: '', phoneNo2:'', phoneNo3:'', email: '', email2:'', faxNo: '', otherContact1:'', otherContact2:'', otherContact3:'', bankName:'', bankAccount:'', address: '', createDate: '', createBy: '', updateDate: '', updateBy: '', memo:'', planner: '', defaultOriginPort: '', site: this.$store.state.user.site, }, supplierRules: { supplierNo: [ { required: true, message: ' ', trigger: 'blur' } ], cShortOffice: [ { required: true, message: '请输入ShortOffice', trigger: 'blur' } ], supplierName: [ { required: true, message: ' ', trigger: 'blur' } ], supplierDocType: [ { required: true, message: '请选择供应商文档清单模板', trigger: ['blur', 'change'] } ], planner: [ { required: true, message: '请选择Planner', trigger: ['blur', 'change'] } ] } } }, /* 组件 */ components: { Chooselist, SysDictSelect, contract, documents, share, AddressTab },
mounted () { this.$nextTick(() => { this.height = (window.innerHeight - 220) / 2 this.loadMainOrReminder() this.checkShortOfficePermission() }) }, watch: { '$route.query.docExpireSupplierIds'(val, oldVal) { if (val === oldVal) return if (this._suppressDocExpireRouteWatch) { this._suppressDocExpireRouteWatch = false return } this.loadMainOrReminder() } }, methods: { getStatusClass (status) { return { 'status-active': status === 'Active', 'status-inactive': status === 'Inactive' } }, // 查询 SRM0006 特殊权限:是否允许修改已创建供应商的 ShortOffice - rqrq
checkShortOfficePermission () { const username = this.$store.state.user.name || '' if (!username) { this.hasShortOfficeEditPermission = false return } getPermissionValue(username, 'SRM0006').then(({ data }) => { if (data && data.code === 0) { this.hasShortOfficeEditPermission = String(data.value).trim() === 'Y' } else { this.hasShortOfficeEditPermission = false } }).catch(error => { console.error('查询修改ShortOffice权限失败:', error) this.hasShortOfficeEditPermission = false }) }, // 加载始发港下拉选项(port_Info 中 is_departure_port='Y')
loadOriginPortOptions () { searchPortList({ isDeparturePort: 'Y' }).then(({ data }) => { if (data && data.code === 0) { this.originPortOptions = Array.isArray(data.rows) ? data.rows : [] } else { this.originPortOptions = [] } }).catch(() => { this.originPortOptions = [] }) }, // 始发港保存的是港口编码,列表/展示时映射为港口名称;无匹配则回退原值
portNameByCode (code) { if (code === null || code === undefined || code === '') { return '' } const hit = this.originPortOptions.find(p => p.portCode === code) return hit ? hit.portName : code }, /** * 查询列表小单费去尾零。 * 业务意图:handling_charge 按“去尾零”展示,整数显示为 1 而不是 1.000。 * 最低出货金额已改为字典字符串,列表直接显示字段值,不走本方法。 * 边界:空值显示空;非数字原样返回。 */ formatSupplierNumberDisplay (value) { if (value === null || value === undefined || value === '') { return '' } const num = Number(value) if (!Number.isFinite(num)) { return String(value) } return String(num) }, loadMainOrReminder () { const raw = this.$route.query.docExpireSupplierIds if (raw !== undefined && raw !== null && String(raw).trim() !== '') { const ids = String(raw).split(',').map(s => parseInt(s.trim(), 10)).filter(n => !isNaN(n)) if (ids.length) { this.$set(this.searchData, 'supplierIdList', ids) this.pageIndex = 1 this.getMainData({ clearReminderIdFilterAfter: true }) return } } this.getMainData() }, getBaseList (val, type) { this.tagNo = val this.currentFieldType = type // 保存当前字段类型
this.$nextTick(() => { let strVal = '' let conSql = '' if (val === 520) { strVal = this.searchData.supplierNo || '' } if (val === 513){ strVal = this.currentSupplier.currency } if (val === 522){ strVal = this.currentSupplier.taxCode } if (val === 523){ strVal = this.currentSupplier.paymentTerm } if (val === 524){ strVal = this.currentSupplier.deliveryTerm } if (val === 529 && type === 'buyer'){ strVal = this.currentSupplier.buyer || '' // 防止 Druid 拦截 where 1=1
conSql = " and username <> '' " } if (val === 528 && type === 'sourcingStaff'){ strVal = this.currentSupplier.sourcingStaff || '' // 防止 Druid 拦截 where 1=1
conSql = " and username <> '' " } if (val === 530 && type === 'planner'){ strVal = this.currentSupplier.planner || '' // 防止 Druid 拦截 where 1=1;角色过滤由 tagNo=530 的 SQLCode 承担
conSql = " and username <> '' " } if (val === 530 && type === 'mainPlanner') { strVal = this.searchData.planner || '' // 防止 Druid 拦截 where 1=1;角色过滤由 tagNo=530 的 SQLCode 承担
conSql = " and username <> '' " }
console.log('getBaseList调用:', { val, type, strVal, conSql }) this.$refs.baseList.init(val, strVal, conSql) }) },
/* 列表方法的回调 */ getBaseData (val) { console.log('Chooselist返回的数据:', val, 'tagNo:', this.tagNo) if (this.tagNo === 520) { // 供应商编码字段 - SQL返回: supplier_no, supplier_name
const supplierNoVal = val.supplier_no || '' this.searchData.supplierNo = supplierNoVal console.log('供应商编码赋值:', supplierNoVal) } if(this.tagNo == 513){ // 货币字段
const currencyVal = val.Currency || val.currency || val.CurrencyID || val.currency_id || '' this.currentSupplier.currency = currencyVal console.log('货币赋值:', currencyVal) } if (this.tagNo === 522) { // 税率编号字段 - SQL返回: tax_code, tax_desc
const taxCodeVal = val.tax_code || val.TaxCode || val.taxCode || '' this.currentSupplier.taxCode = taxCodeVal console.log('税率编号赋值:', taxCodeVal) } if (this.tagNo === 523) { // 付款条款字段 - SQL返回: payment_term_id, payment_term
const paymentTermVal = val.payment_term_id || val.PaymentTermID || val.paymentTermID || '' this.currentSupplier.paymentTerm = paymentTermVal console.log('付款条款赋值:', paymentTermVal) } if (this.tagNo === 524) { // 交货条款字段 - SQL返回: delivery_term_id, delivery_term
const deliveryTermVal = val.delivery_term_id || val.DeliveryTermID || val.deliveryTermID || '' this.currentSupplier.deliveryTerm = deliveryTermVal console.log('交货条款赋值:', deliveryTermVal) } if (this.tagNo === 529 && this.currentFieldType === 'buyer') { this.currentSupplier.buyer = val.UserName console.log('采购员赋值:', this.currentSupplier.buyer) } if (this.tagNo === 528 && this.currentFieldType === 'sourcingStaff') { this.currentSupplier.sourcingStaff = val.UserName console.log('Sourcing专员赋值:', this.currentSupplier.sourcingStaff) } if (this.tagNo === 530 && this.currentFieldType === 'planner') { this.currentSupplier.planner = val.UserName || val.userName || val.username || '' console.log('Planner赋值:', this.currentSupplier.planner) } if (this.tagNo === 530 && this.currentFieldType === 'mainPlanner') { this.searchData.planner = val.User_display || val.user_display || val.userDisplay || val.UserName || val.userName || val.username || '' console.log('Planner查询赋值:', this.searchData.planner) } }, // 加载供应商文档类型下拉 - rqrq
loadSupplierDocTypeOptions () { const site = (this.currentSupplier.site || this.$store.state.user.site || '').trim() if (!site) { this.supplierDocTypeOptions = [] return } listSupplierDocTypeBySite({ site }).then(({ data }) => { if (data && data.code === 0) { const rows = Array.isArray(data.rows) ? data.rows : [] const options = rows .map(item => typeof item === 'string' ? item : (item.supplierDocType || item.supplier_doc_type || '')) .filter(item => item && String(item).trim() !== '') this.supplierDocTypeOptions = Array.from(new Set(options)) const currentType = this.currentSupplier.supplierDocType if (currentType && this.supplierDocTypeOptions.indexOf(currentType) === -1) { this.supplierDocTypeOptions.unshift(currentType) } // 新增弹窗打开时,供应商文档清单模板默认选中第一条
if (this.isAdd && !this.currentSupplier.supplierDocType && this.supplierDocTypeOptions.length > 0) { this.currentSupplier.supplierDocType = this.supplierDocTypeOptions[0] } } else { this.supplierDocTypeOptions = [] this.$message.error((data && data.msg) || '加载供应商文档清单失败') } }).catch(() => { this.supplierDocTypeOptions = [] this.$message.error('加载供应商文档清单失败') }) }, getMainData (opts) { const clearReminderIdFilterAfter = opts && opts.clearReminderIdFilterAfter === true this.searchData.limit = this.pageSize this.searchData.page = this.pageIndex searchSrmSupplierList(this.searchData).then(({data}) => { if (data.code === 0) { this.mainDataList = data.page.list this.pageIndex = data.page.currPage this.pageSize = data.page.pageSize this.totalPage = data.page.totalCount this.$nextTick(() => { if (this.$refs.mainTable) { this.$refs.mainTable.clearSelection() }
}) if (clearReminderIdFilterAfter) { this.activeName = 'documents' } //判断是否全部存在数据
if (this.mainDataList.length > 0) { //设置选中行
this.$refs.mainTable.setCurrentRow(this.mainDataList[0]) this.changeData(this.mainDataList[0])
}else { this.changeData(null) } if (clearReminderIdFilterAfter) { this.$delete(this.searchData, 'supplierIdList') const q = Object.assign({}, this.$route.query) delete q.docExpireSupplierIds this._suppressDocExpireRouteWatch = true this.$router.replace({ name: this.$route.name, query: q, params: this.$route.params }) } } this.dataListLoading = false }) }, tabClick (tab, event) { this.refreshCurrentTabTable() }, // 每页数
sizeChangeHandle (val) { this.pageSize = val this.pageIndex = 1 this.getMainData() },
// 当前页
currentChangeHandle (val) { this.pageIndex = val this.getMainData() }, changeData (row) { this.currentRow = JSON.parse(JSON.stringify(row)) this.refreshCurrentTabTable() }, refreshCurrentTabTable () { const hasCurrentSupplier = !!(this.currentRow && this.currentRow.site && this.currentRow.supplierNo)
if (!hasCurrentSupplier) { // 主记录为空时清空所有子页签数据,避免传空条件查出全量 - rqrq
this.supplierGroupRequestList = [] if (this.$refs.contract && Array.isArray(this.$refs.contract.dataList)) { this.$refs.contract.dataList = [] } if (this.$refs.documents && Array.isArray(this.$refs.documents.dataList)) { this.$refs.documents.dataList = [] } if (this.$refs.documents && Array.isArray(this.$refs.documents.extraProjectDocumentList)) { this.$refs.documents.extraProjectDocumentList = [] } if (this.$refs.documents && Array.isArray(this.$refs.documents.fileList2)) { this.$refs.documents.fileList2 = [] } if (this.$refs.AddressTab && Array.isArray(this.$refs.AddressTab.dataList)) { this.$refs.AddressTab.dataList = [] } if (this.$refs.share && Array.isArray(this.$refs.share.dataList)) { this.$refs.share.dataList = [] } return }
if (this.activeName === 'share') { this.refreshShareTable() } if (this.activeName === 'groupChangeList') { let inData = { site: this.currentRow.site, supplierNo: this.currentRow.supplierNo } searchSupplierGroupRequestList(inData).then(({data}) => { // 区分请求成功和失败的状况
if (data && data.code == 0) { this.supplierGroupRequestList = data.rows } else { this.supplierGroupRequestList = [] } }) } if (this.activeName === 'contract') { this.refreshContractTable() } if (this.activeName === 'documents') { this.refreshDocumentsTable() } if (this.activeName === 'AddressTab') { this.refreshAddressTable() } }, /** * 主表导出。 * 复用当前查询条件,单独传 page=1、limit=-1 一次取全部,不改写列表当前分页状态。 * site 以前端查询条件为准,漏传时回落到当前登录 site。 */ async exportExcel () { const params = Object.assign({}, this.searchData, { page: 1, limit: -1, site: this.searchData.site || this.$store.state.user.site }) excel.exportTable({ url: '/srmSupplier/searchSrmSupplierList', columnMapping: this.columnArray1, // 可以直接用table,不需要的列就剔除
mergeSetting: [], // 需要合并的列
params: params, fileName: this.exportName + '.xlsx', rowFetcher: res => res.data, columnFormatter: [], dropColumns: []// 需要剔除的列,例如dropColumns: ["netWeight"],即剔除净重列
}) }, refreshContractTable () { let inData = { site: this.currentRow.site, supplierNo: this.currentRow.supplierNo, supplierName: this.currentRow.supplierName, height: Number(this.height) - 20 } this.$refs.contract.init(inData) }, refreshDocumentsTable () { let inData = { site: this.currentRow.site, objectNo: this.currentRow.supplierNo, supplierNo: this.currentRow.supplierNo, supplierName: this.currentRow.supplierName, supplierDocType: this.currentRow.supplierDocType, objectType: 'supplier', height: Number(this.height) - 20 }
this.$refs.documents.init(inData) }, refreshAddressTable () { let inData = { supplierId: this.currentRow.supplierNo, // 使用实际的供应商编码作为supplierId
site: this.currentRow.site, supplierNo: this.currentRow.supplierNo, height: Number(this.height) - 20 } this.$nextTick(() => { const addressComp = this.$refs.AddressTab if (addressComp && typeof addressComp.init === 'function') { addressComp.init(inData) } }) }, refreshShareTable() { let inData = { site: this.currentRow.site, supplierNo: this.currentRow.supplierNo, supplierName: this.currentRow.supplierName, height: Number(this.height) - 20 } this.$refs.share.init(inData) }, // 新增供应商
addSupplier() { this.isAdd = true this.shortOfficeEditable = false this.currentSupplier = { supplierNo: '', supplierName: '', supplierDocType: '', active: 'Y', status: 'Active', supplierGroup: '', abc: '', buyer: '', sourcingStaff: '', currency:'', taxCode:'', paymentTerm:'', deliveryTerm:'', minShipAccount: '', handlingCharge: 0, contract:'', phoneNo: '', phoneNo2:'', phoneNo3:'', email: '', email2:'', faxNo: '', otherContact1:'', otherContact2:'', otherContact3:'', bankName:'', bankAccount:'', address: '', createDate: '', createBy: '', updateDate: '', updateBy: '', memo:'', planner: '', defaultOriginPort: '', site: this.$store.state.user.site, } this.loadSupplierDocTypeOptions() this.supplierDialogVisible = true // 新增时默认生成下一个 SP+数字 供应商编码 - 由后端按现有最大序号自增
generateSupplierNo().then(({ data }) => { if (data && data.code === 0) { this.currentSupplier.supplierNo = data.supplierNo || '' } else { this.$message.error((data && data.msg) || '生成供应商编码失败') } }).catch(() => { this.$message.error('生成供应商编码失败') }) }, // 编辑供应商
editSupplier() { if (!this.currentRow) { this.$message.warning('请选择一个供应商修改') return } this.isAdd = false this.shortOfficeEditable = false this.currentSupplier = { ...this.currentRow, // 列表展示使用 user_display,编辑回填需恢复为账号
buyer: this.currentRow.buyerAccount || this.currentRow.buyer || '', sourcingStaff: this.currentRow.sourcingStaffAccount || this.currentRow.sourcingStaff || '', planner: this.currentRow.plannerAccount || this.currentRow.planner || '', // 最低出货金额为字典值,空串表示未选;小单费空值按 0 回填 - rqrq
minShipAccount: this.currentRow.minShipAccount === null || this.currentRow.minShipAccount === undefined ? '' : this.currentRow.minShipAccount, handlingCharge: this.currentRow.handlingCharge === null || this.currentRow.handlingCharge === undefined || this.currentRow.handlingCharge === '' ? 0 : this.currentRow.handlingCharge } this.loadSupplierDocTypeOptions() this.supplierDialogVisible = true }, // 保存供应商
saveSupplier() { this.$refs.supplierForm.validate((valid) => { if (valid) { const apiCall = this.isAdd ? createSrmSupplier(this.currentSupplier) : updateSrmSupplier(this.currentSupplier)
apiCall.then(({data}) => { if (data && data.code === 0) { this.$message.success(this.isAdd ? '新增供应商成功' : '修改供应商成功') this.supplierDialogVisible = false this.getMainData() // 重新加载数据
} else { this.$message.error(data.msg || '操作失败') } }).catch(error => { this.$message.error('操作失败: ' + error.message) }) } else { this.$message.warning('请填写必填字段') } }) },
// 删除供应商
deleteSupplier(row) { this.$confirm('你确定删除该供应商?', '确认删除', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => { deleteSrmSupplier(row.id).then(({data}) => { if (data && data.code === 0) { this.$message.success('供应商删除成功') this.getMainData() // 重新加载数据
} else { this.$message.error(data.msg || '删除失败') } }).catch(error => { this.$message.error('删除失败: ' + error.message) }) }) }, handleTestCurrentLoginSite () { testCurrentLoginSite({}).then(({ data }) => { if (data && data.code === 0) { const site = data.site || '' this.$message.success(`当前登录工厂(site): ${site || '(空)'}`) return } this.$message.error((data && data.msg) || '获取当前登录工厂失败') }).catch((error) => { this.$message.error('获取当前登录工厂失败: ' + error.message) }) } }, created() { // 查询报表的类型
this.getMainData() this.loadOriginPortOptions() }
}</script>
<!--当前页面的标签样式--><style scoped lang="scss">
/deep/ .customer-tab .el-tabs__content { padding: 5px !important;}
/* 供应商对话框整体样式 */.supplier-dialog { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;}
.supplier-dialog .el-dialog { margin-top: 5vh !important; margin-bottom: 5vh !important;}
.supplier-dialog .el-dialog__header { padding: 20px 25px 15px 25px; border-bottom: 1px solid #E4E7ED;}
.supplier-dialog .el-dialog__body { padding: 25px 25px 25px 25px; max-height: 75vh; overflow-y: auto; min-height: 400px;}
.dialog-content { width: 100%;}
/* 供应商表单样式 */.supplier-form { width: 100%;}
.supplier-form .el-form-item { margin-bottom: 1px;}
.supplier-form .el-form-item__label { font-weight: 500; color: #303133; line-height: 32px; padding-right: 12px;}
.supplier-form .el-form-item__content { line-height: normal;}
/* 表单分组样式 */.form-section { margin-bottom: 5px;}
.form-section:last-child { margin-bottom: 5px;}
/* 输入框样式 */.supplier-form .el-input,.supplier-form .el-textarea,.supplier-form .el-date-editor { width: 100%;}
/* 文本域样式优化 */.supplier-form .el-textarea__inner { resize: none; font-family: inherit; line-height: 1.5;}
/* 对话框底部按钮居中 */.dialog-footer-center { text-align: center; padding: 15px 0 5px 0; border-top: 1px solid #E4E7ED; margin-top: 15px;}
.dialog-footer-center .el-button { margin: 0 10px; min-width: 90px; height: 36px; padding: 0 20px; font-size: 14px;}
/* 响应式调整 */@media (max-width: 1200px) { .supplier-dialog { width: 95% !important; }
.supplier-dialog .el-dialog__body { padding: 20px 20px 15px 20px; }}
@media (max-width: 768px) { .supplier-form .el-col { margin-bottom: 20px; }
.form-section { margin-bottom: 35px; }
.supplier-form .el-form-item__label { line-height: 28px; height: 28px; }}
.status-active { color: #ff0000;}
.status-inactive { color: #67c23a;}</style>
|