123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062 |
- <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-input placeholder="请输入集装箱代号" v-model="addAdpacking.containerCode" readOnly></a-input> -->
- </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"
- >
- <!-- 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="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" :loading="btnLoading" v-preventReClick="2000">
- 保存
- </a-button>
- <a-button type="primary" @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: 120,
- // fixed: 'left',
- className: 'replacecolor'
- },
- {
- title: '成衣工厂',
- dataIndex: 'garmentFactory',
- width: 120,
- // fixed: 'left',
- className: 'replacecolor'
- },
- {
- title: 'HOD',
- dataIndex: 'hod',
- width: 120,
- // fixed: 'left',
- className: 'replacecolor'
- },
- {
- title: 'STYLE NO.',
- dataIndex: 'styleNo',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: 'PO NO.',
- dataIndex: 'poNo',
- width: 120,
- className: 'replacecolor'
- },
- {
- 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',
- },
- {
- title: 'PREPACK SKU',
- dataIndex: 'prepackSku',
- width: 140,
- className: 'replacecolor',
- insertAfter:true,
- scopedSlots: { customRender: 'prepackSku' },
- },
- {
- title: '起始箱号',
- dataIndex: 'startingBoxNumber',
- width: 120,
- className: 'replacecolor',
- scopedSlots: { customRender: 'startingBoxNumber' },
- },
- {
- title: '结束箱号',
- dataIndex: 'endCaseNumber',
- width: 140,
- className: 'replacecolor',
- scopedSlots: { customRender: 'endCaseNumber' },
- },
- {
- title: '颜色(中英文)',
- dataIndex: 'colour',
- width: 140,
- className: 'replacecolor',
- scopedSlots: { customRender: 'replacecolor' },
- },
- {
- title: '配码--根据U8订单来显示',
- dataIndex: 'withCode',
- width: 240,
- className: 'replacecolor',
- },
- {
- title: '计划尺码数量',
- dataIndex: 'planSize',
- width: 240,
- className: 'replacecolor',
- },
- {
- title: '计划装箱数量',
- dataIndex: 'planQuantity',
- width: 240,
- className: 'replacecolor',
- },
- {
- title: '件数/箱',
- dataIndex: 'piecesBox',
- width: 90,
- className: 'replacecolor',
- },
- {
- title: '箱数',
- dataIndex: 'boxNumber',
- width: 140,
- className: 'replacecolor',
- },
- {
- title: '总件数',
- dataIndex: 'total',
- width: 140,
- className: 'replacecolor'
- },
- {
- title: '净重/箱',
- dataIndex: 'netWeight',
- width: 90,
- className: 'replacecolor',
- scopedSlots: { customRender: 'netWeight' },
- },
- {
- title: '总净重',
- dataIndex: 'totalNetWeight',
- width: 140,
- className: 'replacecolor'
- },
- {
- title: '毛重/箱',
- dataIndex: 'grossWeight',
- width: 120,
- className: 'replacecolor',
- scopedSlots: { customRender: 'grossWeight' },
- },
- {
- title: '总毛重',
- dataIndex: 'totalGrossWeight',
- width: 140,
- className: 'replacecolor'
- },
- {
- title: '外箱长度',
- dataIndex: 'outerBoxLength',
- width: 120,
- className: 'replacecolor',
- scopedSlots: { customRender: 'outerBoxLength' },
- },
- {
- title: '外箱宽度',
- dataIndex: 'outerBoxWidth',
- width: 140,
- className: 'replacecolor',
- scopedSlots: { customRender: 'outerBoxWidth' },
- },
- {
- title: '外箱高度',
- dataIndex: 'outerBoxHeight',
- className: 'replacecolor',
- width: 140,
- scopedSlots: { customRender: 'outerBoxHeight' },
- },
- {
- title: '总体积',
- dataIndex: 'totalVolume',
- className: 'replacecolor',
- width: 140,
-
- },
- {
- title: '净净重',
- dataIndex: 'netWeightToo',
- width: 120,
- className: 'replacecolor',
- scopedSlots: { customRender: 'netWeightToo' },
- },
- {
- title: '单价',
- dataIndex: 'unitPrice',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '总价',
- dataIndex: 'totalPrice',
- width: 120,
- className: 'replacecolor'
- // validateRules: [{ required: true, message: '${title}不能为空' },
- // {pattern: /^\d+(\.\d{1,2})?$/, message: '小数点位数不能超过2位' }],
- },
- {
- title: '备注',
- dataIndex: 'memo',
- width: 120,
- className: 'replacecolor'
- // validateRules: [{ required: true, message: '${title}不能为空' },
- // {pattern: /^\d+(\.\d{1,2})?$/, message: '小数点位数不能超过2位' }],
- },
- {
- title: '操作',
- dataIndex: 'action',
- className: 'replacecolor',
- fixed: 'right',
- width: 160,
- 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
- },
- 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'){
- editById(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
- }
- })
- }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(tableRow.startingBoxNumber > 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
- }
- 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 = totalNetWeight;
- headData.totalGrossWeight = totalGrossWeight;
- 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;
- }
- </style>
|