| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343 |
- <template>
- <el-form ref="form">
- <ele-pro-table
- ref="table"
- :needPage="false"
- :columns="columns"
- :datasource="form.datasource"
- row-key="id"
- height="350"
- full-height="calc(100vh - 76px)"
- class="time-form"
- :selection.sync="selection"
- @columns-change="handleColumnChange"
- @header-dragend="handleHeaderDragend"
- @select="handleSelectionChange"
- @select-all="handleSelectionChange"
- :cache-key="cacheKeyUrl"
- @done="handleDone"
- >
- <!-- :show-summary="showSummary"
- :summary-method="getSummaries" -->
- <!-- 原有插槽 -->
- <template v-slot:technicalDrawings="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'datasource.' + scope.$index + '.technicalDrawings'"
- >
- <fileMain
- v-model="scope.row.technicalDrawings"
- type="view"
- lazy-render
- defer-modal
- ></fileMain>
- </el-form-item>
- </template>
- <!-- 编码:该产品存在替代料时给出“替”标识 -->
- <template v-slot:productCode="{ row }">
- <div class="replace-code-cell">
- <span class="code-text" :title="row.productCode">{{
- row.productCode
- }}</span>
- <el-tooltip v-if="hasReplace(row)" placement="top" effect="dark">
- <el-tag type="warning" size="mini" effect="dark">替</el-tag>
- <div slot="content" class="replace-tip">
- <div
- v-for="(item, index) in getReplaceTipLines(row)"
- :key="'tip-' + index"
- >
- {{ item }}
- </div>
- </div>
- </el-tooltip>
- </div>
- </template>
- <template v-slot:customerReqFiles="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'datasource.' + scope.$index + '.customerReqFiles'"
- >
- <fileMain
- v-model="scope.row.customerReqFiles"
- type="view"
- lazy-render
- defer-modal
- ></fileMain>
- </el-form-item>
- </template>
- <template v-slot:industryArtFiles="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'datasource.' + scope.$index + '.industryArtFiles'"
- >
- <fileMain
- v-model="scope.row.industryArtFiles"
- type="view"
- lazy-render
- defer-modal
- ></fileMain>
- </el-form-item>
- </template>
- <template v-slot:otherFiles="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'datasource.' + scope.$index + '.otherFiles'"
- >
- <fileMain
- v-model="scope.row.otherFiles"
- type="view"
- lazy-render
- defer-modal
- ></fileMain>
- </el-form-item>
- </template>
- <template v-slot:customerExpectDeliveryDeadline="scope">
- <div v-if="scope.row.arrivalWay == 1 || !scope.row.arrivalWay">
- {{ scope.row.customerExpectDeliveryDeadline }}
- </div>
- <div v-if="scope.row.arrivalWay == 2">
- <el-link
- type="primary"
- :underline="false"
- @click.native="handleMethod(scope.row)"
- >
- 查看分批时间
- </el-link>
- </div>
- </template>
- <template v-slot:saleCount="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'datasource.' + scope.$index + '.' + countObj.countKey"
- >
- {{ scope.row[countObj.countKey]
- }}{{ scope.row[countObj.unitKey] || scope.row.measuringUnit }}
- </el-form-item>
- </template>
- <template v-slot:modelKey="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'datasource.' + scope.$index + '.modelKey'"
- >
- {{
- scope.row.modelKey
- ? Array.isArray(scope.row.modelKey)
- ? scope.row.modelKey.join(',')
- : scope.row.modelKey
- : ''
- }}
- </el-form-item>
- </template>
- <template v-slot:colorKey="scope">
- <el-form-item
- style="margin-bottom: 20px"
- :prop="'datasource.' + scope.$index + '.colorKey'"
- >
- {{
- scope.row.colorKey
- ? Array.isArray(scope.row.colorKey)
- ? scope.row.colorKey.join(',')
- : scope.row.colorKey
- : ''
- }}
- </el-form-item>
- </template>
- <template v-slot:bomAction="scope">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-document"
- @click.native="openBomDetail(scope.row)"
- >
- BOM详情<span v-if="rowBomCount(scope.row)">({{ rowBomCount(scope.row) }})</span>
- </el-link>
- </template>
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <div class="headbox">
- <div class="pricebox">
- <span class="amount" v-if="showSummary"
- >数量合计:{{ allQuantity }}</span
- >
- <span class="amount" v-if="isAllPrice">总计:{{ allPrice }}元</span>
- <span class="amount" v-if="isDiscountTotalPrice"
- >优惠后总金额:{{ form.discountTotalPrice }}元</span
- >
- </div>
- </div>
- </template>
- </ele-pro-table>
- <timeDialog ref="timeDialogRef" :view="true"></timeDialog>
- </el-form>
- </template>
- <script>
- import dictMixins from '@/mixins/dictMixins';
- import { lbjtList } from '@/enum/dict.js';
- import { contactQueryByCategoryIdsAPI } from '@/api/saleManage/contact';
- import timeDialog from '@/components/timeDialog/index.vue';
- import tabMixins from '@/mixins/tableColumnsMixin';
- import { levelList, pricingWayList, quoteTypeOp } from '@/enum/dict.js';
- import {
- getInventoryTotalAPI,
- buildInventoryTotalQueryKey,
- matchInventoryTotal
- } from '@/api/wms';
- import { getSummaries } from '@/utils/util.js';
- import {
- getAllQuantity,
- getAllPrice,
- getAllDiscountPrice,
- formatPrice
- } from '@/BIZComponents/setProduct.js';
- const dayjs = require('dayjs');
- export default {
- mixins: [dictMixins, tabMixins],
- components: {
- timeDialog
- },
- props: {
- isReelSpecification: {
- type: Boolean,
- default: false
- },
- // 是否显示「操作」列(BOM详情):只有报价单详情传 true,其它单据不受影响
- showBomDetail: {
- default: false,
- type: Boolean
- },
- isDiscountTotalPrice: {
- default: false,
- type: Boolean
- },
- isGuaranteePeriod: {
- default: true,
- type: Boolean
- },
- isDiscount: {
- //折让
- type: Boolean,
- default: true
- },
- isCustomerMark: {
- //客户代号必填
- type: Boolean,
- default: false
- },
- pageName: {
- default: ''
- },
- isChangeCount: {
- //默认计算
- type: Boolean,
- default: true
- },
- contractBookType: {
- //合同类型 1销售 2采购
- type: [String, Number],
- default: 1
- },
- isArrivalWay: {
- //分批到货时间
- type: Boolean,
- default: false
- },
- // 父组件多数不传,必须有非空默认值(空串会让缓存键退化成 'Cols')
- cacheKeyUrl: {
- type: String,
- default: 'eom-BIZComponents-inventoryTableDetails'
- },
- //是否显示订单编码
- isOrderNo: {
- type: Boolean,
- default: false
- },
- //显示库存
- isWms: {
- type: Boolean,
- default: false
- },
- // 替代料信息:{ 产品编码: [{ docNo, replaceCode, replaceName }] }
- // 订单详情等上层场景由父组件聚合下发,用于编码列的“替”标识
- replaceInfoMap: {
- type: Object,
- default: () => ({})
- },
- //
- isAllPrice: {
- type: Boolean,
- default: true
- },
- maxHeight: {
- default: 350
- },
- countObj: {
- type: Object,
- default: () => {
- return {
- countKey: 'saleCount',
- unitKey: 'saleUnit',
- unitIdKey: 'saleUnitId'
- };
- }
- },
- //是否显示生产要求
- isProductionRequirements: {
- type: Boolean,
- default: false
- },
- // 强制隐藏生产要求列:用于后端明细表没有该字段的单据(如报价单)
- isHideProductionRequirements: {
- type: Boolean,
- default: false
- },
- // 是否勾选
- isSelected: {
- type: Boolean,
- default: false
- },
- // 选中的列表返显
- selectedIds: {
- type: Array,
- default: () => {
- return [];
- }
- },
- //是否显示增重重量
- isIncreaseTotalWeight: {
- type: Boolean,
- default: false
- },
- quoteType: {
- type: Number,
- default: 1
- },
- showSummary: {
- type: Boolean,
- default: false
- },
- showSortLine: {
- type: Boolean,
- default: false
- }
- },
- data() {
- return {
- allPrice: 0,
- allQuantity: 0,
- supplierObj: [],
- form: {
- discountTotalPrice: 0,
- datasource: []
- },
- columnsVersion: 1,
- // 新增:存储data中的type值,用于控制新增字段显示
- dataType: null,
- selection: [],
- quoteTypeOp
- };
- },
- computed: {
- columns() {
- console.log(this.quoteType, 'this.quoteType');
- // 触发 mixin 重算 + 应用列宽
- this.columnsVersion;
- // 基础列(新增字段之前的列)
- const baseColumns = [
- {
- width: 45,
- type: 'index',
- columnKey: 'index',
- align: 'center'
- },
- {
- width: 45,
- type: 'selection',
- columnKey: 'selection',
- align: 'center',
- selectable: (row, index) => {
- return !row.sendTotalCount;
- }
- },
- {
- minWidth: 100,
- prop: 'sortCode',
- slot: 'sortCode',
- label: '排序',
- isNone: !this.showSortLine,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- minWidth: 200,
- prop: 'orderNo',
- label: '订单编码',
- showOverflowTooltip: true,
- align: 'center',
- isNone: !this.isOrderNo
- },
- {
- width: 280,
- prop: 'productName',
- label: '名称',
- slot: 'productName',
- headerSlot: 'headerProductName',
- align: 'center'
- },
- {
- width: 150,
- prop: 'productCode',
- label: '编码',
- slot: 'productCode',
- align: 'center'
- },
- {
- width: 200,
- prop: 'productCategoryName',
- label: '类型',
- slot: 'productCategoryName',
- align: 'center'
- },
- {
- width: 120,
- prop: 'specification',
- label: '规格',
- slot: 'specification',
- align: 'center'
- },
- {
- width: 140,
- prop: 'pricingWay',
- label: '计价方式',
- align: 'center',
- fixed: 'left',
- isNone: this.quoteType === 2,
- formatter: (row, column) => {
- return pricingWayList.find((item) => item.id == row.pricingWay)
- ?.name;
- }
- }
- ];
- // 条件显示的新增字段列(仅当quoteType为2时显示)
- const additionalColumns =
- this.quoteType === 2
- ? [
- // 新增字段:厚度
- {
- width: 150,
- prop: 'thickNess',
- label: '厚度',
- slot: 'thickNess',
- formatter: (row, column) => {
- if (row.thickNess) {
- return row.thickNess + ' mm';
- }
- },
- align: 'center'
- },
- // 新增字段:平方数
- {
- width: 150,
- prop: 'squareNumber',
- label: '平方数',
- formatter: (row, column) => {
- if (row.squareNumber) {
- return row.squareNumber + 'm²';
- }
- },
- align: 'center'
- },
- // 新增字段:加工费(未税)
- {
- width: 150,
- prop: 'processingFeeBeforeTax',
- label: '加工费(未税)',
- formatter: (row, column) => {
- if (row.processingFeeBeforeTax) {
- return row.processingFeeBeforeTax + ' 元';
- }
- },
- align: 'center'
- },
- // 新增字段:包装费(未税)
- {
- width: 150,
- prop: 'packagingFeeNotTaxed',
- label: '包装费(未税)',
- formatter: (row, column) => {
- if (row.packagingFeeNotTaxed) {
- return row.packagingFeeNotTaxed + ' 元';
- }
- },
- align: 'center'
- },
- // 新增字段:运输费(未税)
- {
- width: 150,
- prop: 'transportationFeeWithoutTax',
- label: '运输费(未税)',
- formatter: (row, column) => {
- if (row.transportationFeeWithoutTax) {
- return row.transportationFeeWithoutTax + ' 元';
- }
- },
- align: 'center'
- },
- // 新增字段:未税小计
- {
- width: 150,
- prop: 'quotationSubtotalBeforeTax',
- label: '未税小计',
- align: 'center',
- formatter: (row, column) => {
- if (row.quotationSubtotalBeforeTax) {
- return row.quotationSubtotalBeforeTax + ' 元';
- }
- }
- },
- // 新增字段:税率(%)
- {
- width: 150,
- prop: 'extraTax',
- label: '税率(%)',
- align: 'center',
- formatter: (row, column) => {
- return row.extraTax;
- }
- },
- // 新增字段:含税小计
- {
- width: 150,
- prop: 'quotationSubtotalTax',
- label: '含税小计',
- align: 'center',
- formatter: (row, column) => {
- if (row.quotationSubtotalTax) {
- return row.quotationSubtotalTax + ' 元';
- }
- }
- }
- ]
- : [];
- // 剩余列(新增字段之后的列)
- const remainingColumns = [
- {
- width: 200,
- prop: 'customerMark',
- label: this.contractBookType == 1 ? '客户代号' : '供应商代号',
- slot: 'customerMark',
- headerSlot: 'headerCustomerMark',
- isNone: this.quoteType === 2,
- align: 'center'
- },
- {
- minWidth: 240,
- prop: 'taskName',
- label: '工序',
- slot: 'taskName',
- align: 'center'
- },
- {
- minWidth: 160,
- prop: 'productionCodes',
- label: '生产编号',
- isNone: this.quoteType === 2,
- align: 'center'
- },
- {
- minWidth: 280,
- prop: 'productionRequirements',
- label: '生产要求',
- align: 'center',
- isNone:
- this.isHideProductionRequirements ||
- (!this.isProductionRequirements && this.quoteType === 2)
- },
- {
- minWidth: 280,
- prop: 'cuttingLength',
- label: '裁线米段',
- align: 'center',
- slot: 'cuttingLength',
- isNone: this.quoteType === 2
- },
- {
- minWidth: 120,
- prop: 'entrustedEnterpriseId',
- label: '受托企业',
- slot: 'entrustedEnterpriseId',
- isNone: !this.isCustomerMark,
- align: 'center',
- showOverflowTooltip: true,
- formatter: (row, column) => {
- return (
- this.supplierObj[row.productId]?.find(
- (item) => item.id === row.entrustedEnterpriseId
- )?.name || ''
- );
- }
- },
- {
- width: 180,
- prop: 'saleCount',
- label: '数量',
- slot: 'saleCount',
- headerSlot: 'headerTotalCount',
- align: 'center'
- },
- {
- width: 120,
- prop: 'packingSpecification',
- align: 'center',
- label: '包装规格',
- isNone: this.quoteType === 2,
- showOverflowTooltip: true
- },
- {
- width: 150,
- prop: 'totalCount',
- label: '计量数量',
- slot: 'totalCount',
- isNone: this.quoteType === 2,
- headerSlot: 'headerTotalCount',
- formatter: (row, column) => {
- if (row.totalCount) {
- return row.totalCount + ' ' + (row.measuringUnit || '');
- }
- },
- align: 'center'
- },
- {
- width: 120,
- prop: 'warehouseName',
- label: '仓库名称',
- slot: 'warehouseName',
- align: 'center'
- },
- {
- minWidth: 160,
- prop: 'stockCountBase',
- label: '库存数量',
- showOverflowTooltip: true,
- align: 'center',
- isNone: !this.isWms
- },
- {
- minWidth: 160,
- prop: 'availableCountBase',
- label: this.isWms ? '可用数量' : '库存数量',
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- minWidth: 140,
- prop: 'sendTotalCount',
- label: '已发货数量',
- slot: 'sendTotalCount',
- align: 'center',
- isNone: this.pageName != 'send',
- formatter: (row, column) => {
- if (row.sendTotalCount) {
- return row.sendTotalCount + ' ' + (row.measuringUnit || '');
- }
- }
- },
- {
- minWidth: 140,
- prop: 'notSendTotalCount',
- label: '未发货数量',
- slot: 'notSendTotalCount',
- isNone: this.pageName != 'send',
- align: 'center',
- formatter: (row, column) => {
- if (row.notSendTotalCount) {
- return row.notSendTotalCount + ' ' + (row.measuringUnit || '');
- }
- }
- },
- {
- width: 140,
- prop: 'singleWeight',
- label: '单重',
- slot: 'singleWeight',
- headerSlot: 'headerSingleWeight',
- formatter: (row, column) => {
- if (row.singleWeight) {
- return row.singleWeight + ' ' + (row.weightUnit || '');
- }
- },
- align: 'center'
- },
- {
- width: 140,
- prop: 'totalWeight',
- label: '总重',
- slot: 'totalWeight',
- formatter: (row, column) => {
- if (row.totalWeight) {
- return row.totalWeight + ' ' + (row.weightUnit || '');
- }
- },
- align: 'center'
- },
- {
- width: 180,
- prop: 'increaseTotalWeight',
- label: '增重重量',
- isNone: this.quoteType === 2 || !this.isIncreaseTotalWeight,
- formatter: (row, column) => {
- if (row.increaseTotalWeight) {
- return row.increaseTotalWeight + ' ' + (row.weightUnit || '');
- }
- },
- align: 'center'
- },
- {
- width: 160,
- prop: 'goodsPriceType',
- label: '价格类型',
- isNone: this.quoteType === 2,
- formatter: (row, column) => {
- return this.getDictValue('商品价格类型', row.goodsPriceType);
- },
- align: 'center'
- },
- {
- width: 200,
- prop: 'singlePrice',
- label: '单价',
- slot: 'singlePrice',
- isNone: this.quoteType === 2,
- headerSlot: 'headerSinglePrice',
- align: 'center'
- },
- {
- width: 160,
- prop: 'taxRate',
- label: '税率',
- isNone: this.quoteType === 2,
- formatter: (_row, _column, cellValue) => {
- return _row.taxRate ? _row.taxRate + '%' : '';
- },
- align: 'center'
- },
- {
- width: 150,
- prop: 'notaxSinglePrice',
- label: '不含税单价',
- isNone: this.quoteType === 2,
- slot: 'notaxSinglePrice',
- align: 'center'
- },
- {
- width: 140,
- prop: 'quoteWay',
- label: '报价方式',
- align: 'center',
- isNone: !this.isDiscount,
- formatter: (_row, _column, cellValue) => {
- return (
- this.quoteTypeOp.find((item) => item.value == _row.quoteWay)
- ?.label || ''
- );
- }
- },
- {
- width: 140,
- prop: 'discountRatio',
- label: '折让比例',
- align: 'center',
- isNone: !this.isDiscount,
- formatter: (_row, _column, cellValue) => {
- return _row.discountRatio ? _row.discountRatio + '%' : '';
- }
- },
- {
- width: 160,
- prop: 'discountSinglePrice',
- label: '折让单价',
- align: 'center',
- isNone: !this.isDiscount,
- formatter: (_row, _column, cellValue) => {
- return _row.discountSinglePrice
- ? Number(_row.discountSinglePrice).toFixed(2)
- : '';
- }
- },
- {
- width: 120,
- prop: 'totalPrice',
- label: '合计',
- slot: 'totalPrice',
- formatter: (row, column) => {
- if (row.totalPrice) {
- return row.totalPrice + ' 元';
- }
- },
- align: 'center'
- },
- {
- width: 160,
- prop: 'discountTotalPrice',
- label: '折让合计',
- align: 'center',
- isNone: !this.isDiscount,
- formatter: (_row, _column, cellValue) => {
- return _row.discountTotalPrice
- ? Number(_row.discountTotalPrice).toFixed(2)
- : '';
- }
- },
- {
- minWidth: 120,
- prop: 'goodsLevel',
- label: '物品级别',
- isNone: this.quoteType === 2,
- formatter: (_row, _column, cellValue) => {
- return levelList.find((item) => item.value == _row.goodsLevel)
- ?.label;
- },
- align: 'center'
- },
- {
- width: 110,
- prop: 'batchNo',
- label: '批次号',
- slot: 'batchNo',
- isNone: this.quoteType === 2,
- align: 'center'
- },
- {
- width: 150,
- prop: 'reelSpecification',
- label: '盘具',
- isNone: !this.isReelSpecification,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- width: 160,
- prop: 'productBrand',
- label: '牌号',
- slot: 'productBrand',
- isNone: this.quoteType === 2,
- align: 'center'
- },
- {
- width: 120,
- prop: 'modelType',
- label: '型号',
- slot: 'modelType',
- isNone: this.quoteType === 2,
- align: 'center'
- },
- {
- minWidth: 120,
- prop: 'modelKey',
- label: '机型',
- slot: 'modelKey',
- isNone: this.quoteType === 2,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- minWidth: 120,
- prop: 'colorKey',
- slot: 'colorKey',
- showOverflowTooltip: true,
- label: '颜色',
- isNone: this.quoteType === 2,
- align: 'center'
- },
- {
- width: 120,
- prop: 'imgCode',
- align: 'center',
- label: '图号/件号',
- isNone: this.quoteType === 2,
- showOverflowTooltip: true
- },
- {
- prop: 'provenance',
- label: '产地',
- slot: 'provenance',
- align: 'center',
- isNone: this.quoteType === 2,
- minWidth: 200,
- showOverflowTooltip: true,
- formatter: (row, column) => {
- return row.provenance && row.provenance.length
- ? row.provenance
- .map((item) => this.getDictValue('产地', item))
- .join(',')
- : '';
- }
- },
- {
- width: 120,
- prop: 'produceType',
- align: 'center',
- label: '属性类型',
- isNone: this.quoteType === 2,
- showOverflowTooltip: true,
- formatter: (row, column) => {
- if (row.produceType) {
- return row.produceType
- .map((item) => {
- return lbjtList[item];
- })
- .toString();
- }
- }
- },
- {
- width: 160,
- prop: 'arrivalWay',
- label: '到货方式',
- align: 'center',
- isNone: !this.isArrivalWay || this.quoteType === 2,
- formatter: (_row, _column, cellValue) => {
- return _row.arrivalWay == 1
- ? '一次性到货'
- : _row.arrivalWay == 2
- ? '分批到货'
- : '';
- }
- },
- {
- width: 160,
- prop: 'customerExpectDeliveryDeadline',
- label: this.contractBookType == 1 ? '客户期望交期' : '交付日期',
- slot: 'customerExpectDeliveryDeadline',
- align: 'center'
- },
- {
- width: 160,
- prop: 'produceDeliveryDeadline',
- label: '生产交付交期',
- slot: 'produceDeliveryDeadline',
- isNone: this.contractBookType != 1,
- headerSlot: 'headerProduceDeliveryDeadline',
- align: 'center'
- },
- {
- width: 200,
- prop: 'guaranteePeriod',
- label: '有效期',
- isNone: this.quoteType === 2,
- slot: 'guaranteePeriod',
- align: 'center',
- formatter: (_row, _column, cellValue) => {
- return (
- (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
- );
- }
- },
- {
- width: 200,
- prop: 'guaranteePeriodDeadline',
- label: '有效期截止日期',
- isNone: !this.isGuaranteePeriod || this.quoteType === 2,
- slot: 'guaranteePeriodDeadline',
- align: 'center'
- },
- {
- width: 220,
- prop: 'customerReqFiles',
- label: '客户需求',
- slot: 'customerReqFiles',
- isNone: this.quoteType === 2,
- align: 'center'
- },
- {
- width: 100,
- prop: 'density',
- isNone: this.quoteType === 2,
- label: '密度',
- align: 'center'
- },
- {
- width: 150,
- prop: 'productType',
- isNone: this.quoteType === 2,
- label: '生产加工方式',
- align: 'center',
- formatter: (_row, _column, cellValue) => {
- return _row.productType == 2
- ? '加工'
- : _row.productType == 3
- ? '装配'
- : '';
- }
- },
- {
- width: 130,
- prop: 'technicalAnswerName',
- label: '技术答疑人',
- isNone: this.quoteType === 2,
- slot: 'technicalAnswerName',
- align: 'center'
- },
- {
- width: 220,
- prop: 'technicalParams',
- label: '技术参数',
- isNone: this.quoteType === 2,
- slot: 'technicalParams',
- align: 'center'
- },
- {
- width: 240,
- prop: 'technicalDrawings',
- label: '技术图纸',
- slot: 'technicalDrawings',
- align: 'center'
- },
- {
- width: 120,
- prop: 'drawingVersion',
- isNone: this.quoteType === 2,
- label: '图纸版本',
- align: 'center'
- },
- {
- width: 240,
- prop: 'technologyRouteName',
- label: '工艺路线',
- isNone: this.quoteType === 2,
- slot: 'technologyRouteName',
- align: 'center'
- },
- {
- width: 240,
- prop: 'industryArtFiles',
- label: '工艺附件',
- isNone: this.quoteType === 2,
- slot: 'industryArtFiles',
- align: 'center'
- },
- {
- width: 240,
- prop: 'otherFiles',
- label: '其他附件',
- slot: 'otherFiles',
- isNone: this.quoteType === 2,
- align: 'center'
- },
- {
- width: 220,
- prop: 'remark',
- label: '备注',
- slot: 'remark',
- align: 'center'
- }
- ];
- // 合并所有列,统一应用列宽缓存(无缓存时保持默认宽度)
- const mergedColumns = [
- ...baseColumns,
- ...additionalColumns,
- ...remainingColumns
- ].filter((item) => !item.isNone);
- if (this.showBomDetail) {
- mergedColumns.push({
- width: 130,
- columnKey: 'bomAction',
- label: '操作',
- slot: 'bomAction',
- fixed: 'right',
- align: 'center'
- });
- }
- return this.applyColumnWidth(mergedColumns);
- }
- },
- created() {
- this.requestDict('产地');
- this.requestDict('商品价格类型');
- },
- methods: {
- // 取该产品的替代料信息(按产品编码聚合,可能对应多张发货单)
- getReplaceList(row) {
- const map = this.replaceInfoMap || {};
- const list = row && row.productCode ? map[row.productCode] : null;
- return Array.isArray(list) ? list : [];
- },
- // 父组件聚合到了替代关系,或行上直接带 isReplace,都算“有替代料”
- hasReplace(row) {
- return this.getReplaceList(row).length > 0 || row?.isReplace == 1;
- },
- // tooltip 文案:有明细就列出发货单与替代料,否则给通用提示
- getReplaceTipLines(row) {
- const list = this.getReplaceList(row);
- if (list.length) {
- return list.map(
- (item) =>
- `发货单 ${item.docNo || '-'}:由 ${item.replaceCode || '-'}` +
- `${item.replaceName ? '(' + item.replaceName + ')' : ''} 替代`
- );
- }
- return ['该产品存在替代料,发货时以对应发货单的替代料为准'];
- },
- getSummaries(param) {
- return getSummaries(param, ['saleCount'], ' ');
- },
- handleDone() {
- if (this.isSelected) {
- console.log('selectedIds~~~~~', this.selectedIds);
- this.$refs.table.setSelectedRowKeys(this.selectedIds);
- }
- },
- handleSelectionChange(val) {
- console.log(val, 'val');
- this.$emit('selection-change', val);
- },
- async getSupplierObj(productList, queryName) {
- try {
- let categoryIds = productList
- .filter((item) => item[queryName])
- .map((item) => item[queryName]);
- return await contactQueryByCategoryIdsAPI({
- categoryIds,
- isQueryEE: 1
- });
- } catch (e) {
- return Promise.resolve({});
- }
- },
- // 返回列表数据
- getTableValue() {
- let comitDatasource = this.form.datasource;
- if (comitDatasource.length === 0) return [];
- comitDatasource.forEach((v) => {
- if (v.guaranteePeriodUnitCode) {
- v.guaranteePeriodUnitName = this.getDictValue(
- '保质期单位',
- v.guaranteePeriodUnitCode
- );
- }
- v.technicalDrawings = v.technicalDrawings ? v.technicalDrawings : [];
- v.customerReqFiles = v.customerReqFiles || [];
- v.industryArtFiles = v.industryArtFiles || [];
- v.otherFiles = v.otherFiles || [];
- });
- return comitDatasource;
- },
- handleMethod(row) {
- this.$refs.timeDialogDialogRef.open(row);
- },
- /**
- * 取第一个有效金额,全部无效时回退到 fallback。
- * 注意不能直接用 ||,否则接口正常返回的 0 会被当成无效值跳过。
- */
- pickAmount(candidates, fallback) {
- const hit = candidates.find(
- (v) => v !== null && v !== undefined && v !== '' && !isNaN(Number(v))
- );
- const num = Number(hit === undefined ? fallback : hit);
- return isNaN(num) ? 0 : formatPrice(num);
- },
- // 汇总:总计 / 数量合计 / 优惠后总金额
- setAmount(data = {}) {
- this.allQuantity =
- getAllQuantity(this.form.datasource, this.countObj) || 0;
- // 总计:优先用接口返回的总金额,接口未返回时按明细行合计兜底
- this.allPrice = this.pickAmount(
- [data.totalAmount, data.totalPrice, data?.contractVO?.totalPrice],
- getAllPrice(this.form.datasource)
- );
- if (this.isDiscountTotalPrice) {
- // 优惠后总金额:接口未返回时按明细行折让合计兜底,无折让时等于总计
- this.form.discountTotalPrice = this.pickAmount(
- [
- data.payAmount,
- data.discountTotalPrice,
- data?.contractVO?.discountTotalPrice
- ],
- Number(getAllDiscountPrice(this.form.datasource)) ||
- Number(this.allPrice)
- );
- }
- },
- setDeliveryDays() {
- console.log(this.form.datasource, 'this.form.datasource');
- this.form.datasource.forEach((item, i) => {
- let guaranteePeriodUnitName = this.guaranteePeriodUnit(
- item.guaranteePeriodUnitCode
- );
- this.$set(
- this.form.datasource[i],
- 'guaranteePeriodDeadline',
- guaranteePeriodUnitName != 'second'
- ? this.setDay(item.guaranteePeriod, guaranteePeriodUnitName)
- : ''
- );
- });
- },
- guaranteePeriodUnit(code) {
- return code == 3
- ? 'day'
- : code == 4
- ? 'month'
- : code == 5
- ? 'year'
- : 'second';
- },
- setDay(addDay, dateType = 'day') {
- console.log(addDay);
- return dayjs(this.contractStartDate || new Date())
- .add(addDay, dateType)
- .format('YYYY-MM-DD');
- },
- //修改回显
- rowBomCount(row) {
- return row && Array.isArray(row.bomList) ? row.bomList.length : 0;
- },
- // 交给父组件(报价单详情)打开 BOM 详情弹窗
- openBomDetail(row) {
- this.$emit('showBomDetail', row);
- },
- async putTableValue(data) {
- console.log(data, 'data');
- // 存储data中的type值,用于控制新增字段显示
- this.dataType = data.type;
- let productList =
- (data &&
- (data.redressProductList ||
- data.quoteProductList ||
- data.productList ||
- data.detailList)) ||
- [];
- console.log(productList, 'productList~~~~~~');
- if (productList) {
- productList.forEach((item) => {
- // 处理机型/颜色
- if (item.modelKey && typeof item.modelKey === 'string') {
- item.modelKey = item.modelKey;
- }
- if (item.colorKey && typeof item.colorKey === 'string') {
- item.colorKey = item.colorKey;
- }
- });
- this.form.datasource = productList;
- this.setAmount(data);
- if (this.isWms) {
- let codeList = this.form.datasource
- .filter((item) => item.productCode)
- .map((item) => buildInventoryTotalQueryKey(item));
- //获取仓库库存
- let inventoryTotalList = await getInventoryTotalAPI(codeList);
- this.form.datasource
- .filter((item) => item.productCode)
- .forEach((item) => {
- let find =
- inventoryTotalList.find((key) =>
- matchInventoryTotal(item, key)
- ) || {};
- this.form.datasource;
- this.$set(
- item,
- 'stockCountBase',
- find.stockCountBase == null ? 0 : find.stockCountBase
- );
- this.$set(
- item,
- 'availableCountBase',
- find.availableCountBase == null ? 0 : find.availableCountBase
- );
- });
- }
- this.supplierObj = await this.getSupplierObj(
- productList,
- 'productId'
- );
- this.$refs.table && this.$refs.table.reload();
- }
- }
- // 列头拖拽结束 - 保存列宽到本地缓存
- }
- };
- </script>
- <style lang="scss" scoped>
- .replace-code-cell {
- display: flex;
- flex-direction: column;
- align-items: center;
- line-height: 1.5;
- }
- .code-text {
- max-width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .headbox {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .amount {
- font-size: 14px;
- font-weight: bold;
- padding-right: 30px;
- }
- }
- .time-form .el-form-item {
- margin-bottom: 0 !important;
- }
- ::v-deep .period {
- display: flex;
- .borderleftnone {
- .el-input--medium .el-input__inner {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
- }
- }
- .borderrightnone {
- .el-input--medium .el-input__inner {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
- }
- }
- }
- ::v-deep .time-form tbody > tr:hover > td {
- background-color: transparent !important;
- }
- ::v-deep .time-form .el-table tr {
- background-color: #ffffff;
- }
- .pricebox {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- font-weight: bold;
- }
- </style>
|