12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133 |
- <template>
- <!-- 新增 预装箱单-成衣-->
- <div id="addAdvancePacking">
- <a-drawer
- :title="(editDecide == 'add')?'新增预装箱单-成衣':'编辑预装箱单-成衣'"
- width="89%"
- placement="right"
- :closable="true"
- :visible="visible"
- @close="handleCancel"
- >
- <!-- 主表信息 填写 -->
- <a-card :bordered="true">
- <div class="table-page-search-wrapper">
- <!-- :rules="validatorRules" -->
- <a-form-model layout="inline" ref="form" :model="addAdpacking">
- <a-row :gutter="24">
- <a-col :md="6" :sm="8">
- <a-form-model-item label="单据号" prop="documentNo">
- {{addAdpacking.documentNo | ellipsis}}
- <!-- <a-input placeholder="自动生成" v-model="addAdpacking.orderNumber" readOnly></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="订单号" prop="orderNumber">
- {{addAdpacking.orderNumber | ellipsis}}
- <!-- <a-input placeholder="自动生成" v-model="addAdpacking.orderNumber" readOnly></a-input> -->
- </a-form-model-item>
- </a-col>
- <!-- <a-col :md="6" :sm="8">
- <a-form-model-item label="集装箱代号" prop="containerCode">
- {{addAdpacking.containerCode | ellipsis}}
- </a-form-model-item>
- </a-col> -->
- <a-col :md="6" :sm="8">
- <a-form-model-item label="集装箱号" prop="containerNumber">
- {{addAdpacking.containerNumber | ellipsis}}
- <!-- <a-input placeholder="请输入集装箱号" v-model="addAdpacking.containerNumber" readOnly></a-input> -->
- </a-form-model-item>
- </a-col>
- <!-- <a-col :md="6" :sm="8">
- <a-form-model-item label="预发货日期" prop="u8Remarks">
- <j-date placeholder="请选择预发货日期" v-model="addAdpacking.preDeliveryDate" style="width:100%"></j-date>
- </a-form-model-item>
- </a-col> -->
- <a-col :md="6" :sm="8">
- <a-form-model-item label="u8备注" prop="u8Remarks">
- <a-input placeholder="请输入u8备注" v-model="addAdpacking.u8Remarks"></a-input>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="款号" prop="itemNumber">
- {{addAdpacking.itemNumber | ellipsis}}
- <!-- <a-input placeholder="选择子表自动生成" v-model="addAdpacking.itemNumber"></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="中文品名" prop="productName">
- {{addAdpacking.productName | ellipsis}}
- <!-- <a-input placeholder="选择子表自动生成" v-model="addAdpacking.productName"></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="英文品名" prop="productName">
- {{addAdpacking.englishProductName | ellipsis}}
- <!-- <a-input placeholder="选择子表自动生成" v-model="addAdpacking.englishProductName"></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="尺码范围" prop="sizeRange">
- {{addAdpacking.sizeRange | ellipsis}}
- <!-- <a-input placeholder="选择子表自动生成" v-model="addAdpacking.sizeRange" readOnly></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="客户" prop="customer">
- {{addAdpacking.customer | ellipsis }}
- <!-- <a-input placeholder="选择子表自动生成" v-model="addAdpacking.customer"></a-input> -->
- </a-form-model-item>
- </a-col>
-
- <!-- <a-col :md="6" :sm="8">
- <a-form-model-item label="成衣工厂" prop="garmentFactory">
- <a-input placeholder="选择子表自动生成" v-model="addAdpacking.garmentFactory"></a-input>
- </a-form-model-item>
- </a-col> -->
- <a-col :md="6" :sm="8">
- <a-form-model-item label="总箱数" prop="totalBoxes">
- {{addAdpacking.totalBoxes | ellipsis }}
- <!-- <a-input placeholder="自动生成" v-model="addAdpacking.totalBoxes" readOnly></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="总净重" prop="totalNetWeight">
- {{addAdpacking.totalNetWeight | ellipsis}}
- <!-- <a-input placeholder="自动生成" v-model="addAdpacking.totalNetWeight" readOnly></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="总毛重" prop="totalGrossWeight">
- {{addAdpacking.totalGrossWeight | ellipsis}}
- <!-- <a-input placeholder="自动生成" v-model="addAdpacking.totalGrossWeight" readOnly></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="总体积" prop="totalVolume">
- {{addAdpacking.totalVolume | ellipsis}}
- <!-- <a-input placeholder="自动生成" v-model="addAdpacking.totalVolume" readOnly></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="总价" prop="totalPrice">
- {{addAdpacking.totalPrice | ellipsis}}
- <!-- <a-input placeholder="自动生成" v-model="addAdpacking.totalPrice" readOnly></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="总件数" prop="totalNumber">
- {{addAdpacking.total | ellipsis}}
- <!-- <a-input placeholder="自动生成" v-model="addAdpacking.total" readOnly></a-input> -->
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-form-model>
- </div>
- </a-card>
- <!-- 参照发运明细 増行-->
- <a-card :bordered="false" style="margin:10px 0 60px 0;">
- <div class="table-operator">
- <a-button type="primary" @click="referShipmentDetails" icon="ordered-list">参照出运明细</a-button>
- </div>
- <a-spin :spinning="confirmLoading">
- <a-form-model ref="formRef" :rules="validatorRules">
- <a-table
- bordered
- :row-key="record => record.id"
- :columns="columns"
- :data-source="addAdpacking.syPreAssembledPackingListItemList"
- :loading="loading"
- :pagination="ipagination"
- :scroll="{ x: 1500,y: 350 }"
- @change="handleTableChange"
- >
- <!-- 自定义表头 -->
- <span slot="startingBoxNumberTitle" class="form-table-heard">
- 起始箱号
- </span>
- <span slot="endCaseNumberTitle" class="form-table-heard">
- 结束箱号
- </span>
- <span slot="netWeightTitle" class="form-table-heard">
- 净重/箱
- </span>
- <span slot="grossWeightTitle" class="form-table-heard">
- 毛重/箱
- </span>
- <span slot="outerBoxLengthTitle" class="form-table-heard">
- 外箱长度
- </span>
- <span slot="outerBoxWidthTitle" class="form-table-heard">
- 外箱宽度
- </span>
- <span slot="outerBoxHeightTitle" class="form-table-heard">
- 外箱高度
- </span>
- <!-- itemCode -->
- <template slot="itemCode" slot-scope="text, record, index">
- <a-form-model-item prop="itemCode" :rules="rules.itemCode">
- <a-input style="width:100%" type="text" v-model="record.itemCode" />
- </a-form-model-item>
- </template>
- <!-- prepackSku -->
- <template slot="prepackSku" slot-scope="text, record, index">
- <a-form-model-item prop="prepackSku" :rules="rules.prepackSku">
- <a-input style="width:100%" type="text" v-model="record.prepackSku" />
- </a-form-model-item>
- </template>
- <!-- 起始箱号 -->
- <template slot="startingBoxNumber" slot-scope="text, record, index">
- <a-form-model-item prop="startingBoxNumber" :rules="rules.startingBoxNumber">
- <a-input style="width:100%" type="text" v-model="record.startingBoxNumber" @change="handleValueChange(record)"/>
- </a-form-model-item>
- </template>
- <!-- 结束箱号 -->
- <template slot="endCaseNumber" slot-scope="text, record, index">
- <a-form-model-item prop="endCaseNumber" :rules="rules.endCaseNumber">
- <a-input style="width:100%" type="text" v-model="record.endCaseNumber" @change="handleValueChange(record)"/>
- </a-form-model-item>
- </template>
- <!-- 单价 -->
- <template slot="unitPrice" slot-scope="text, record, index">
- <a-form-model-item prop="unitPrice" :rules="rules.unitPrice">
- <a-input style="width:100%" type="text" v-model="record.unitPrice" @change="handleValueChange(record)"/>
- </a-form-model-item>
- </template>
-
- <!-- 颜色 -->
- <template slot="colour" slot-scope="text, record, index">
- <a-form-model-item prop="colour" :rules="rules.colour">
- <a-input style="width:100%" type="text" v-model="record.colour" />
- </a-form-model-item>
- </template>
- <!-- 净重 -->
- <template slot="netWeight" slot-scope="text, record, index">
- <a-form-model-item prop="netWeight" :rules="rules.netWeight">
- <a-input style="width:100%" type="text" v-model="record.netWeight" @change="handleValueChange(record)"/>
- </a-form-model-item>
- </template>
- <!-- 毛重 -->
- <template slot="grossWeight" slot-scope="text, record, index">
- <a-form-model-item prop="grossWeight" :rules="rules.grossWeight">
- <a-input style="width:100%" type="text" v-model="record.grossWeight" @change="handleValueChange(record)"/>
- </a-form-model-item>
- </template>
- <!-- 外箱长度 -->
- <template slot="outerBoxLength" slot-scope="text, record, index">
- <a-form-model-item prop="outerBoxLength" :rules="rules.outerBoxLength">
- <a-input style="width:100%" type="text" v-model="record.outerBoxLength" @change="handleValueChange(record)"/>
- </a-form-model-item>
- </template>
- <!-- 外箱宽度 -->
- <template slot="outerBoxWidth" slot-scope="text, record, index">
- <a-form-model-item prop="outerBoxWidth" :rules="rules.outerBoxWidth">
- <a-input style="width:100%" type="text" v-model="record.outerBoxWidth" @change="handleValueChange(record)" />
- </a-form-model-item>
- </template>
- <!-- 外箱高度 -->
- <template slot="outerBoxHeight" slot-scope="text, record, index">
- <a-form-model-item prop="outerBoxHeight" :rules="rules.outerBoxHeight">
- <a-input style="width:100%" type="text" v-model="record.outerBoxHeight" @change="handleValueChange(record)" />
- </a-form-model-item>
- </template>
- <!-- 净净重 -->
- <template slot="netWeightToo" slot-scope="text, record, index">
- <a-form-model-item prop="netWeightToo" :rules="rules.netWeightToo">
- <a-input style="width:100%" type="text" v-model="record.netWeightToo" @change="handleValueChange(record)"/>
- </a-form-model-item>
- </template>
- <!-- 尺码字段 -->
- <template v-for="i in inputName" :slot="i" slot-scope="text, record, index">
- <a-form-model-item prop="i" :rules="rules.i" :key="i">
- <a-input style="width:100%" type="text" v-model="record[i]" @change="handleValueChange(record)"/>
- </a-form-model-item>
- </template>
-
- <!-- 操作 -->
- <span slot="action" slot-scope="text, record,index">
- <a @click="copy(record)">复制</a>
- <a-divider type="vertical"/>
- <a-popconfirm title="确定删除吗?" @confirm="handleDelete(props,index)">
- <a>删除</a>
- </a-popconfirm>
- </span>
- </a-table>
-
- <!--
- 子表 ipagination :rules="validatorRules"
- <a-spin :spinning="confirmLoading">
- <a-form-model ref="formRef">
- <j-vxe-table
- ref="vTable"
- toolbar
- row-number
- row-selection
- drag-sort
- keep-source
- :height="350"
- :loading="loading"
- :dataSource="addAdpacking.syPreAssembledPackingListItemList"
- :columns="columns"
- :alwaysEdit=true
- :bordered=true
- :scroll="{ x: 1500 }"
- style="margin-top: 5px;"
- :toolbarConfig="toolbarConfig"
- @valueChange="handleValueChange"
- > -->
- <!-- 起始箱号 -->
- <!-- <template v-slot:startingBoxNumber="record" >
- <a-input v-model="record.startingBoxNumber" style="border-color: red;"></a-input>
- </template> -->
- <!-- 结束箱号 -->
- <!-- <template v-slot:endCaseNumber="record" >
- <a-input v-model="record.endCaseNumber" style="border-color: red;"></a-input>
- </template> -->
- <!-- 净重/箱 -->
- <!-- <template v-slot:netWeight="record" >
- <a-input v-model="record.netWeight" style="border-color: red;"></a-input>
- </template> -->
- <!-- 毛重/箱 -->
- <!-- <template v-slot:grossWeight="record" >
- <a-input v-model="record.grossWeight" style="border-color: red;"></a-input>
- </template> -->
- <!-- 外箱长度 -->
- <!-- <template v-slot:outerBoxLength="record" >
- <a-input v-model="record.outerBoxLength" style="border-color: red;"></a-input>
- </template> -->
- <!-- 外箱高度 -->
- <!-- <template v-slot:outerBoxHeight="record" >
- <a-input v-model="record.outerBoxHeight" style="border-color: red;"></a-input>
- </template> -->
- <!-- 外箱宽度 -->
- <!-- <template v-slot:outerBoxWidth="record" >
- <a-input v-model="record.outerBoxWidth" style="border-color: red;"></a-input>
- </template>
- <template v-slot:action="props">
- <a @click="copy(props)">复制</a>
- <a-divider type="vertical"/>
- <a-popconfirm title="确定删除吗?" @confirm="handleDelete(props)">
- <a>删除</a>
- </a-popconfirm>
- </template>
- <template v-slot:toolbarSuffix>
- <a-button type="primary" @click="referShipmentDetails" icon="ordered-list">参照出运明细</a-button>
- </template>
- </j-vxe-table> -->
- </a-form-model>
- </a-spin>
- </a-card>
- <!-- 页面底部提交取消 -->
- <div
- :style="{
- position: 'absolute',
- right: 0,
- bottom: 0,
- width: '100%',
- borderTop: '1px solid #e9e9e9',
- padding: '10px 16px',
- background: '#fff',
- textAlign: 'right',
- zIndex: 999
- }"
- >
- <a-popconfirm title="确定放弃编辑?" @confirm="handleCancel" okText="确定" cancelText="取消">
- <a-button :style="{ marginRight: '8px' }">取消</a-button>
- </a-popconfirm>
- <a-button type="primary" @click="myHandSave" :disabled="btnLoading" >
- 保存
- </a-button>
- <!-- <a-button type="primary" :disabled="btnLoading" @click="myHandSubmit" style="margin-left: 8px">
- 保存并提交
- </a-button> -->
- </div>
- </a-drawer>
- <!-- 参照发运明细弹框 -->
- <referShipmentDetails-modal
- ref="referShipmentDetailsModal"
- @bao="getSon"
- @ok="modalFormOk"
- ></referShipmentDetails-modal>
- </div>
- </template>
- <script>
- import { JeecgListMixin } from '@/mixins/JeecgListMixin'
- import JEllipsis from '@/components/jeecg/JEllipsis'
- import moment from 'moment'
- import ReferShipmentDetailsModal from '@views/advance-packingList/referShipmentDetailsModal.vue'
- import { addAdvPac, editById } from '@api/document/advance-packingList.js'
- import { queryShippingDetails } from '@api/document/advance-packingList.js'
- import { JVXETypes } from '@/components/jeecg/JVxeTable'
- import { pushIfNotExist, randomNumber, randomUUID } from '@/utils/util'
- import { getDotConfig, getDotValidExpress } from '@/utils/myutil'
- export default {
- name: 'AddAdvancePacking', // 新增预装箱单
- mixins: [JeecgListMixin],
- components: { JEllipsis, moment, ReferShipmentDetailsModal }, // 参照发运明细弹框
- data() {
- let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
- return {
- toolbarConfig: {
- // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
- btn: []
- },
- btnLoading:false,//按钮等待状态
- inputName:[],
- // 表头
- columns: [
- {
- title: '账套',
- dataIndex: 'acSetNo',
- width: 80,
- // fixed: 'left',
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- title: '成衣工厂',
- dataIndex: 'garmentFactory',
- width: 100,
- // fixed: 'left',
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- title: 'HOD',
- dataIndex: 'hod',
- width: 110,
- // fixed: 'left',
- className: 'replacecolor',
- customRender: text => {
- return moment(text).format('YYYY-MM-DD')
- },
- ellipsis: true,
- },
- {
- title: 'STYLE NO.',
- dataIndex: 'styleNo',
- width: 110,
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- title: 'PO NO.',
- dataIndex: 'poNo',
- width: 110,
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- title: 'ITEM NO./SKU NO./UPC NO./PACKS CODE',
- dataIndex: 'itemCode',
- ellipsis: true,
- scopedSlots: { customRender: 'itemCode' },
- width: 340,
- className: 'replacecolor'
- },
- {
- title: '分销点/DC/LABEL',
- dataIndex: 'distributionPoint',
- width: 180,
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- title: 'PREPACK SKU',
- dataIndex: 'prepackSku',
- width: 140,
- className: 'replacecolor',
- insertAfter:true,
- scopedSlots: { customRender: 'prepackSku' },
- },
- {
- // title: '起始箱号',
- dataIndex: 'startingBoxNumber',
- width: 120,
- className: 'replacecolor',
- scopedSlots: { customRender: 'startingBoxNumber' },
- slots:{title:'startingBoxNumberTitle'}
- },
- {
- // title: '结束箱号',
- dataIndex: 'endCaseNumber',
- width: 140,
- className: 'replacecolor',
- scopedSlots: { customRender: 'endCaseNumber' },
- slots:{title:'endCaseNumberTitle'}
- },
- {
- title: '颜色(中英文)',
- dataIndex: 'colour',
- width: 120,
- className: 'replacecolor',
- scopedSlots: { customRender: 'replacecolor' },
- },
- {
- title: '配码--根据U8订单来显示',
- dataIndex: 'withCode',
- width: 200,
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- title: '计划尺码数量',
- dataIndex: 'planSize',
- width: 200,
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- title: '计划装箱数量',
- dataIndex: 'planQuantity',
- width: 120,
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- title: '件数/箱',
- dataIndex: 'piecesBox',
- width: 90,
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- title: '箱数',
- dataIndex: 'boxNumber',
- width: 80,
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- title: '总件数',
- dataIndex: 'total',
- width: 90,
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- // title: '净重/箱',
- dataIndex: 'netWeight',
- width: 120,
- className: 'replacecolor',
- scopedSlots: { customRender: 'netWeight' },
- slots:{title:'netWeightTitle'}
- },
- {
- title: '总净重',
- dataIndex: 'totalNetWeight',
- width: 100,
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- // title: '毛重/箱',
- dataIndex: 'grossWeight',
- width: 120,
- className: 'replacecolor',
- scopedSlots: { customRender: 'grossWeight' },
- slots:{title:'grossWeightTitle'}
- },
- {
- title: '总毛重',
- dataIndex: 'totalGrossWeight',
- width: 100,
- className: 'replacecolor',
- ellipsis: true,
- },
- {
- // title: '外箱长度',
- dataIndex: 'outerBoxLength',
- width: 120,
- className: 'replacecolor',
- scopedSlots: { customRender: 'outerBoxLength' },
- slots:{title:'outerBoxLengthTitle'}
- },
- {
- // title: '外箱宽度',
- dataIndex: 'outerBoxWidth',
- width: 140,
- className: 'replacecolor',
- scopedSlots: { customRender: 'outerBoxWidth' },
- slots:{title:'outerBoxWidthTitle'}
- },
- {
- // title: '外箱高度',
- dataIndex: 'outerBoxHeight',
- className: 'replacecolor',
- width: 140,
- scopedSlots: { customRender: 'outerBoxHeight' },
- slots:{title:'outerBoxHeightTitle'}
- },
- {
- title: '总体积',
- dataIndex: 'totalVolume',
- className: 'replacecolor',
- width: 90,
- ellipsis: true,
-
- },
- // {
- // title: '净净重',
- // dataIndex: 'netWeightToo',
- // width: 120,
- // className: 'replacecolor',
- // scopedSlots: { customRender: 'netWeightToo' },
- // },
- {
- title: '单价',
- dataIndex: 'unitPrice',
- width: 120,
- className: 'replacecolor',
- scopedSlots: { customRender: 'unitPrice' },
- ellipsis: true,
- },
- {
- title: '总价',
- dataIndex: 'totalPrice',
- width: 90,
- className: 'replacecolor',
- ellipsis: true,
- // validateRules: [{ required: true, message: '${title}不能为空' },
- // {pattern: /^\d+(\.\d{1,2})?$/, message: '小数点位数不能超过2位' }],
- },
- {
- title: '备注',
- dataIndex: 'memo',
- width: 120,
- className: 'replacecolor',
- ellipsis: true,
- // validateRules: [{ required: true, message: '${title}不能为空' },
- // {pattern: /^\d+(\.\d{1,2})?$/, message: '小数点位数不能超过2位' }],
- },
- {
- title: '操作',
- dataIndex: 'action',
- className: 'replacecolor',
- fixed: 'right',
- width: 140,
- align: 'center',
- scopedSlots: { customRender: 'action' },
- }
- ],
- row:{},
- loading: false, // 表格加载
- visible: false,
- editDecide: 'add',
- dateFormat: 'YYYY-MM-DD',
- addAdpacking: {
- syPreAssembledPackingListItemList:[]
- }, //主表信息
- confirmLoading: false,
- msgFormSon: 'test', // 子组件传来数据的变量
- // state: '0', // 单据状态初始未【仅保存】
- // pushState: '0' // 推送状态初始未【仅保存】
- // 待确定还有哪些必填信息 ----------------------------
- validatorRules: {
- // orderNumber: [{ required: true, message: '订单号不能为空', trigger: 'blur' }],
- // styleNum: [{ required: true, message: '款号不能为空', trigger: 'blur' }],
- // name: [{ required: true, message: '品名不能为空', trigger: 'blur' }]
- },
- sizeFields:[], // 尺码字段
- dotConfig:{}, // 小数点配置
- judge : 0 ,
- }
- },
- // 接收父组件查询方法
- props: {
- fatherList: {
- type: Function,
- default: null
- }
- },
- methods: {
- getSon(val) {
-
- // console.log('勾选发运明细数据', val)
- // for (var i in val) {
- // val[i]['orderQuantity'] = val[i].quantity
- // val[i]['orderRemainingQuantity'] = val[i].surplusNum
- // val[i]['salesUnitPrice'] = val[i].unitPriceIncludingTax
- // val[i]['customerOrder'] = val[i].customerOrderNumber
- // val[i]['shipmentQuantity'] = val[i].surplusNum //订单剩余数量 赋值给发货数量
- // }
- this.addAdpacking.syPreAssembledPackingListItemList = [];
- this.setHeadCalField();
- var selectData = val[0];
- queryShippingDetails({id:selectData.id,groupId:selectData.groupId}).then(res => {
- if (res.success) {
-
- // 放在前面,有小数位数设置
- this.setHeadData(val[0], res.result);
- this.loadSizeTables(res.result.sizeTables);
- var changedData = this.changeData(val[0], res.result);
- this.addAdpacking.syPreAssembledPackingListItemList.push(changedData);
- }else{
- this.$message.error("获取发运明细详情失败");
- }
- })
- },
- loadSizeTables(sizeTable){
- var newColums = this.columns.filter(item=>{
- return item.isSize != true;
- });
- this.sizeFields = [];
- this.inputName = []
- if (sizeTable != null){
- var i=0;
- // 找到插入位置点
- for (; i<newColums.length;i++){
- if (newColums[i].insertAfter){
- break;
- }
- }
- // 插入数据
- for (var j=0;j<sizeTable.length;j++){
- this.sizeFields.push('size-'+sizeTable[j].size);
- var validExpress = getDotValidExpress(this.dotConfig.quantity);
- var field = {
- title: sizeTable[j].size,
- dataIndex: 'size-'+sizeTable[j].size,
- width: 80,
- isSize:true,
- validateRules: [validExpress],
- scopedSlots: { customRender: 'size-'+sizeTable[j].size },
- };
- this.inputName.push('size-'+sizeTable[j].size)
-
- newColums.splice(i+1+j,0,field);
- }
- }
-
- this.columns = newColums;
- },
- // 参照发运明细
- referShipmentDetails() {
- // console.log('打开参照发运明细')
- this.$refs.referShipmentDetailsModal.referShipDetModVis = true
- this.$refs.referShipmentDetailsModal.getShipData()
- },
- myHandSave(){
- this.addAdpacking.status=0;
- this.saveAdd();
- },
- async myHandSubmit(){
- this.addAdpacking.status=1;
- this.saveAdd();
- },
- // 保存
- async saveAdd() {
- var newObj = this.addAdpacking;
- if (this.sizeFields.length == 0){
- this.$message.error('当前记录没有尺码字段,无法保存');
- return;
- }
- // if (newObj.totalBoxes == 0){
- // this.$message.error('总箱数为0,无法保存');
- // return;
- // }
- await this.JudgeVluabled()
- //尺码赋值
- for(var i =0;i<newObj.syPreAssembledPackingListItemList.length;i++){
- var dataTable = newObj.syPreAssembledPackingListItemList[i]
- for (var j=0; j<dataTable.sizeTables.length; j++){
- var sizeTable = dataTable.sizeTables[j];
- var field = 'size-'+sizeTable.size;
- dataTable.sizeTables[j].proportion = dataTable[field];
- }
- }
- // 日期格式转换
- if (newObj.preDeliveryDate != "" && newObj.preDeliveryDate != undefined){
- newObj.preDeliveryDate = newObj.preDeliveryDate+" 00:00:00";
- }
- // 推送状态、状态赋默认值。新增状态赋值
- if (newObj.id == undefined || newObj.id == ""){
- newObj.push_status = 0;
- }
- if(this.judge == 0){
- if(this.editDecide === 'edit'){
- this.btnLoading = true
- editById(newObj).then(res => {
- if (res.success) {
- if(newObj.status == '1'){
- this.$message.success('编辑并提交成功')
- }else {
- this.$message.success('编辑成功')
- }
- this.close()
- this.btnLoading = false
- //清空信息
- newObj = {syPreAssembledPackingListItemList:[]};
- this.row = res.result
- this.fatherList() // 调用父组件 查询方法
- // this.msgFormSon = {} 清空子表信息
- }else{
- this.$message.error(res.message)
- this.btnLoading = false
- }
- })
- }else {
- addAdvPac(newObj).then(res => {
- this.btnLoading = true
- if (res.success) {
- if(newObj.status == '1'){
- this.$message.success('新增并提交成功')
- }else {
- this.$message.success('新增成功')
- }
- this.close()
- this.btnLoading = false
- //清空信息
- newObj = {syPreAssembledPackingListItemList:[]};
- this.row = res.result
- this.fatherList() // 调用父组件 查询方法
- // this.msgFormSon = {} 清空子表信息
- }else{
- this.$message.error(res.message)
- this.btnLoading = false
- }
- })
- }
- }
-
-
-
- // const that = this
- // // 触发表单验证
- // this.$refs.form.validate(valid => {
- // if (valid) {
- // that.confirmLoading = true
- // }
- // })
- },
- JudgeVluabled(){
- this.judge = 0
- for (var i=0; i<this.addAdpacking.syPreAssembledPackingListItemList.length;i++){
- var tableRow = this.addAdpacking.syPreAssembledPackingListItemList[i];
- tableRow = JSON.parse(JSON.stringify(tableRow))
- var allSizeSum = this.getAllSizeSum(tableRow);
- if (allSizeSum == 0){
- this.$message.error('第'+(i+1)+'行所有尺码数量为0,无法保存');
- this.judge += 1
- return;
- }
- if(Number(tableRow.startingBoxNumber) > Number(tableRow.endCaseNumber)) {
- this.$message.error('第'+(i+1)+'行起始箱号大于结束箱号,无法保存');
- this.judge += 1
- return;
- }
- //是否未填
- var required = [
- {key:'startingBoxNumber',value:'起始箱号'},
- {key:'endCaseNumber',value:'结束箱号'},
- {key:'netWeight',value:'净重/箱'},
- {key:'grossWeight',value:'毛重/箱'},
- {key:'outerBoxLength',value:'外箱长度'},
- {key:'outerBoxHeight',value:'外箱高度'},
- {key:'outerBoxWidth',value:'外箱宽度'},
- // {key:'netWeightToo',value:'净净重'},
- ]
- for(var j=0 ; j<required.length;j++){
- if(tableRow[required[j].key] == null || tableRow[required[j].key] == "" || tableRow[required[j].key] == undefined){
- this.$message.error('第'+(i+1)+'行'+required[j].value+'无值,无法保存');
- this.judge+=1
- return
- }
- }
-
- //是否为整
- var integer = [
- {key:'startingBoxNumber',value:'起始箱号'},
- {key:'endCaseNumber',value:'结束箱号'},
- {key:'piecesBox',value:'件数/箱'},
- ]
- for(var v=0 ; v<integer.length;v++){
- if(!Number.isInteger(Number(tableRow[integer[v].key]))){
- this.$message.error('第'+(i+1)+'行'+integer[v].value+'不为整数,无法保存');
- this.judge+=1
- return
- }
- }
- //判断小数位数
- var Several = [
- {key:'netWeight',value:'净重/箱'},
- {key:'grossWeight',value:'毛重/箱'},
- // {key:'netWeightToo',value:'净净重'}
- ]
- for(var s=0 ; s<Several.length;s++){
- console.log(tableRow[Several[s].key])
-
- var position =(tableRow[Several[s].key]==0 || !tableRow[Several[s].key])?0:tableRow[Several[s].key].toString().indexOf('.') + 1; //小数点的位置
-
- var digit =(tableRow[Several[s].key]==0 || !tableRow[Several[s].key])?0: tableRow[Several[s].key].toString().length - position; //小数的位值
- if(digit > 2 && position!==0 ){
- this.$message.error('第'+(i+1)+'行'+Several[s].value+'小数超过两位,无法保存');
- this.judge+=1
- return
- }
- }
- }
-
- },
- // 设置表头信息
- setHeadData(referData, mData){
- var itemData = {};
- if (mData.syPreAssembledPackingListItemList != null && mData.syPreAssembledPackingListItemList.size>0){
- itemData = mData.syPreAssembledPackingListItemList[0];
- }
- // 设置件数小数位数
- this.dotConfig = getDotConfig(itemData.masterMetering);
- this.addAdpacking.syDeclarationElementsId = mData.syDeclarationElementsId;
- this.addAdpacking.elementsId = mData.elementsId
- this.addAdpacking.itemNumber = referData.itemNumber;
- // this.addAdpacking.productName = referData.chineseName;
- this.addAdpacking.productName = mData.productName;
- this.addAdpacking.englishProductName = mData.englishProductName;
- this.addAdpacking.u8Remarks = mData.u8Remarks;
- this.addAdpacking.sizeRange = "";
- if (mData.sizeTables != null){
- if (mData.sizeTables.length == 1){
- this.addAdpacking.sizeRange = mData.sizeTables[0].size;
- }else if (mData.sizeTables.length>1){
- this.addAdpacking.sizeRange = mData.sizeTables[0].size + " ~ " + mData.sizeTables[mData.sizeTables.length-1].size;
- }
- }
- this.addAdpacking.customer = mData.customer;
- this.addAdpacking.ompoId = mData.ompoId
- this.addAdpacking.salesman = mData.salesman
- this.addAdpacking.customerAbbreviation = mData.customerAbbreviation
- this.addAdpacking.spurOrSubOrder = mData.spurOrSubOrder
- this.addAdpacking.garmentFactory = mData.garmentFactory;
- this.addAdpacking.orderNumber = mData.orderNumber
- },
- // 发运明细详情成预装箱记录:mData-主表记录,itemData-子表记录
- changeData(referData, mData) {
- var itemData = {};
- if (mData.syPreAssembledPackingListItemList != null && mData.syPreAssembledPackingListItemList.length>0){
- itemData = mData.syPreAssembledPackingListItemList[0];
- }
- var addrow = {
- syDeclarationElementsId:itemData.syDeclarationElementsId,
- syDeclarationElementsItemId:itemData.syDeclarationElementsItemId,
- acSetNo: itemData.acSetNo,
- garmentFactory: itemData.garmentFactory,
- hod: itemData.hod,
- styleNo:itemData.styleNo,
- poNo:itemData.poNo,
- itemCode:'',
- distributionPoint:referData.distributionPoint,
- prepackSku: '',
- size:"",
- startingBoxNumber: '',
- endCaseNumber: '',
- colour: itemData.colour,
- withCode: itemData.withCode,
- piecesBox: 0,
- boxNumber: '',
- total: '',
- netWeight: '',
- totalNetWeight: '',
- grossWeight: '',
- totalGrossWeight: '',
- outerBoxLength: '',
- outerBoxWidth: '',
- outerBoxHeight: '',
- totalVolume: '',
- netWeightToo: '',
- unitPrice: itemData.unitPrice,
- totalPrice: '',
- smallPo: referData.smallPo,
- inventoryName:referData.inventoryName,
- spurOrSubOrder:referData.purOrSubOrder,
- factoryUnitPrice:referData.factoryUnitPrice,
- customerAbbreviation:referData.customerAbbreviation,
- sizeTables : itemData.sizeTables,
- planSize : itemData.planSize,
- planQuantity:itemData.planQuantity,
- supplierCode:itemData.supplierCode,
- supplier:itemData.supplier,
- ompoAccount:itemData.ompoAccount,
- ompoId:itemData.ompoId,
- ompoIdItem:itemData.ompoIdItem,
- ymoney:itemData.ymoney,
- customsDeclarationUnitPrice:itemData.customsDeclarationUnitPrice,
- factoryUnitPrice:itemData.factoryUnitPrice
- }
- return addrow;
- },
- // 操作按钮 删除
- handleDelete(record,index) {
- var ret = this.addAdpacking.syPreAssembledPackingListItemList.splice(index, 1);
- this.setHeadCalField();
- return ret;
- },
- // 复制
- copy(record) {
- var newRow = JSON.parse(JSON.stringify(record));
- newRow.isAdd = 1
- this.addAdpacking.syPreAssembledPackingListItemList.push(newRow);
- this.setHeadCalField();
- },
- // 抽屉 取消
- handleCancel() {
- this.close()
- },
- close() {
- this.$emit('close')
- this.visible = false;
- this.btnLoading = false
- this.editDecide = 'add'
- this.addAdpacking = {syPreAssembledPackingListItemList:[]};
- },
- aa() {},
- modalFormOk() {
- this.$refs.referShipmentDetailsModal.referShipmentDetailsModVis = true
- },
- // 表格字段值变动时触发
- handleValueChange(record) {
- if (record.startingBoxNumber != undefined && record.startingBoxNumber != "" &&
- record.endCaseNumber != undefined && record.endCaseNumber != ""){
- record.boxNumber = record.endCaseNumber*1-record.startingBoxNumber*1+1;
- }
- var allSizeSum = this.getAllSizeSum(record);
- record.piecesBox = allSizeSum;
- record.total = (record.piecesBox*record.boxNumber);
- if (record.unitPrice != undefined && record.unitPrice != ""){
- record.totalPrice = (record.unitPrice*record.total).toFixed(2);
- }
- if (record.netWeight != "" && record.netWeight != undefined){
- record.totalNetWeight = (record.netWeight * record.boxNumber).toFixed(2);
- }
- if (record.grossWeight != "" && record.grossWeight != undefined){
- record.totalGrossWeight = (record.grossWeight * record.boxNumber).toFixed(2);
- }
- if (record.outerBoxLength != "" && record.outerBoxLength != undefined &&
- record.outerBoxWidth != "" && record.outerBoxWidth != undefined &&
- record.outerBoxHeight != "" && record.outerBoxHeight != undefined){
- record.totalVolume = ((record.outerBoxLength * record.outerBoxWidth * record.outerBoxHeight * record.boxNumber)/1000000).toFixed(3);
- }
- this.$forceUpdate()
- this.setHeadCalField();
- },
- // 获取不同尺码数量之和
- getAllSizeSum(record){
- var ret = 0;
- for (var i=0; i<this.sizeFields.length; i++){
- if (record[this.sizeFields[i]] != undefined && record[this.sizeFields[i]] != ""){
- ret += record[this.sizeFields[i]]*1;
- }
- }
- return ret;
- },
- // 设置表头计算值,直接设置表头值对象不能刷新,把表头对象换了就可以了
- setHeadCalField(){
- var headData = JSON.parse(JSON.stringify(this.addAdpacking));
- var totalBoxes = 0;
- var totalNetWeight = 0;
- var totalGrossWeight = 0;
- var totalVolume = 0;
- var totalPrice = 0;
- var total = 0;
- for (var i=0; i<headData.syPreAssembledPackingListItemList.length; i++){
- var rowData = headData.syPreAssembledPackingListItemList[i];
- totalBoxes += rowData.boxNumber;
- if (rowData.totalNetWeight != undefined && rowData.totalNetWeight != ""){
- totalNetWeight += rowData.totalNetWeight*1;
- }
- if (rowData.totalGrossWeight != undefined && rowData.totalGrossWeight != ""){
- totalGrossWeight += rowData.totalGrossWeight*1;
- }
- if (rowData.totalVolume != undefined && rowData.totalVolume != ""){
- totalVolume += rowData.totalVolume*1;
- }
- if (rowData.totalPrice != undefined && rowData.totalPrice != ""){
- totalPrice += rowData.totalPrice*1;
- }
- if (rowData.total != undefined && rowData.total != ""){
- total += rowData.total*1;
- }
- }
-
- headData.totalBoxes =Number(totalBoxes).toFixed(0);
- headData.totalNetWeight = Number(totalNetWeight).toFixed(2);
- headData.totalGrossWeight = Number(totalGrossWeight).toFixed(2);
- headData.totalVolume = totalVolume.toFixed(3);
- headData.totalPrice = totalPrice.toFixed(2);
- headData.total = total.toFixed(0)
- this.addAdpacking = headData;
- },
- },
- computed: {},
- mounted() {}
- }
- </script>
- <style lang="less" scoped>
- @import '~@assets/less/common.less';
- /deep/ .ant-table-thead > tr > th {
- text-align: center;
- // font-weight: 700;
- }
- /deep/ .ant-table-tbody {
- text-align: center;
- }
- // /deep/ th.replacecolor {
- // background-color: #ccc;
- // }
- // 抽屉里的card样式
- /deep/ .ant-drawer-content {
- background-color: #f0f2f5;
- }
- /deep/ .ant-drawer-body {
- padding: 10px;
- }
- /deep/.ant-table-row-cell-break-word >.ant-form-item{
- margin-bottom: 0px !important;
- }
- /deep/.ant-table-tbody .ant-table-row td{
- padding-top: 8px !important;
- padding-bottom: 8px !important;
- }
- </style>
|