123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941 |
- <template>
- <!-- 新增托书 -->
- <div id="addBookDrawer">
- <a-drawer
- title="新增托书"
- width="89%"
- placement="right"
- :closable="true"
- :visible="visible"
- @close="handleCancel">
- <!-- 主表信息 填写 为什么原先图部分回显??-->
- <a-card :bordered="true">
- <div class="table-page-search-wrapper">
- <a-form-model layout="inline" ref="form" :model="addBook" :rules="validatorRules">
- <a-row :gutter="24">
- <a-col :md="6" :sm="8">
- <a-form-model-item label="托书号" prop="shippingOrderNumber">
- <a-input placeholder="请输入托书号" v-model="addBook.shippingOrderNumber" @blur="convertUppercase(addBook.shippingOrderNumber)"></a-input>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="托书日期" prop="shippingOrderDate">
- <a-date-picker
- placeholder="请选择托书日期"
- style="width:100%;"
- :format="dateFormat"
- v-model="addBook.shippingOrderDate"
- />
- </a-form-model-item>
- </a-col>
-
- <!-- <a-col :md="6" :sm="8">
- <a-form-model-item label="外销发票号码" prop="exportInvoiceNo">
- <a-input placeholder="请输入外销发票号码" v-model="addBook.exportInvoiceNo"></a-input>
- </a-form-model-item>
- </a-col> -->
- <a-col :md="6" :sm="8">
- <a-form-model-item label="经营单位" prop="unitInOperation">
- <!-- <a-input placeholder="请输入经营单位" v-model="addBook.unitInOperation"></a-input> -->
- <j-search-select-tag
- placeholder="请选择收货人"
- v-model="addBook.unitInOperation"
- @change="unitInOperationChange"
- dict="test-200">
- </j-search-select-tag>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="经营单位地址" prop="unitInOperationAddress">
- <a-input placeholder="根据经营单位自动带出" v-model="addBook.unitInOperationAddress"></a-input>
- </a-form-model-item>
- </a-col>
- <!-- <a-col :md="6" :sm="8">
- <a-form-model-item label="海关代码" prop="customsCode">
- <a-input placeholder="根据经营单位自动带出" v-model="addBook.customsCode"></a-input>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="税号" prop="dutyParagraph">
- <a-input placeholder="根据经营单位自动带出" v-model="addBook.dutyParagraph"></a-input>
- </a-form-model-item>
- </a-col> -->
- <a-col :md="6" :sm="8">
- <a-form-model-item label="进仓/装柜日期" prop="latestDateOfShipment">
- <a-date-picker
- placeholder="请选择进仓/装柜日期"
- style="width:100%;"
- :format="dateFormat"
- v-model="addBook.latestDateOfShipment"
- />
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="最终船期" prop="theFinalShippingDate">
- <a-date-picker
- placeholder="请选择最终船期"
- style="width:100%;"
- :format="dateFormat"
- v-model="addBook.theFinalShippingDate"
- />
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="贸易国别" prop="tradeCountry">
- <j-search-select-tag
- placeholder="请选择贸易国别"
- v-model="addBook.tradeCountry"
- dict="trade_country">
- </j-search-select-tag>
- <!-- <a-input placeholder="请输入贸易国别" v-model="addBook.tradeCountry"></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="运抵国别" prop="arriveInCountry">
- <j-search-select-tag
- placeholder="请选择运抵国别"
- v-model="addBook.arriveInCountry"
- dict="country_of_arrival">
- </j-search-select-tag>
- <!-- <a-input placeholder="请输入运抵国别" v-model="addBook.arriveInCountry"></a-input> -->
- </a-form-model-item>
- </a-col>
-
-
- <a-col :md="6" :sm="8">
- <a-form-model-item label="收货人" prop="consignee">
- <!-- <j-dict-select-tag
- style="width:100%;margin-bottom: 10px;" v-model="addBook.consignee"
- dictCode="sys_dict_item,item_text,description,dict_id in(select id from sys_dict where dict_code='receiving_goods_info')"
- @change="consigneeSelectChange"/> -->
- <j-search-select-tag
- placeholder="请选择收货人"
- v-model="addBook.consignee"
- @change="consigneeSelectChange"
- dict="receiving_goods_info">
- </j-search-select-tag>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="收货人地址" prop="consigneeAddress">
- <a-input placeholder="根据收货人自动带出" v-model="addBook.consigneeAddress" ></a-input>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="通知方" prop="notifyParty">
- <a-input placeholder="根据收货人自动带出" v-model="addBook.notifyParty" ></a-input>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="通知方地址" prop="notifyPartyAddress">
- <a-input placeholder="根据收货人自动带出" v-model="addBook.notifyPartyAddress" ></a-input>
- </a-form-model-item>
- </a-col>
-
- <a-col :md="6" :sm="8">
- <a-form-model-item label="出口口岸" prop="exportPort">
- <j-search-select-tag
- placeholder="请选择出口口岸"
- v-model="addBook.exportPort"
- dict="export_port">
- </j-search-select-tag>
- <!-- <a-input placeholder="请输入出口口岸" v-model="addBook.exportPort"></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="目的港" prop="destinationPort">
- <j-search-select-tag
- placeholder="请选择目的港"
- v-model="addBook.destinationPort"
- dict="port_of_destination">
- </j-search-select-tag>
- <!-- <a-input placeholder="请输入目的港" v-model="addBook.destinationPort"></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="收汇方式" prop="exchangeEarningsValue">
- <j-search-select-tag
- placeholder="请选择收汇方式"
- v-model="addBook.exchangeEarningsValue"
- dict="collection_method">
- </j-search-select-tag>
- <!-- <a-input placeholder="请输入收汇方式" v-model="addBook.exchangeEarningsValue"></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="成交方式" prop="termsOfDeliveryvalue">
- <j-search-select-tag
- placeholder="请选择成交方式"
- v-model="addBook.termsOfDeliveryvalue"
- dict="transaction_method"
- change>
- </j-search-select-tag>
- <!-- <a-input placeholder="请输入成交方式" v-model="addBook.termsOfDeliveryvalue"></a-input> -->
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="金额" prop="money">
- <a-input placeholder="请输入金额" v-model="addBook.money"></a-input>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="运输方式" prop="typeOfShipping">
- <j-search-select-tag
- placeholder="请选择运输方式"
- v-model="addBook.typeOfShipping"
- dict="test0902001">
- </j-search-select-tag>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="体积" prop="totalVolume">
- <a-input placeholder="请输入体积" v-model="addBook.totalVolume" readOnly></a-input>
- </a-form-model-item>
- </a-col>
-
- <!-- <a-col :md="6" :sm="8">
- <a-form-model-item label="人民币" prop="cny">
- <a-input placeholder="请输入人民币" v-model="addBook.cny"></a-input>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="美元" prop="usd">
- <a-input placeholder="请输入美元" v-model="addBook.usd"></a-input>
- </a-form-model-item>
- </a-col> -->
- </a-row>
- </a-form-model>
- </div>
- </a-card>
- <!--操作按钮区域 参照装箱单 増行-->
- <a-card :bordered="true" style="margin:10px 0 40px 0;">
- <div class="table-operator">
- <a-button type="primary" @click="referPackingList('0')" icon="ordered-list">参照装箱单-成衣</a-button>
- <a-button type="primary" @click="referPackingList('1')" icon="ordered-list">参照装箱单-面料</a-button>
- <!-- <a-button type="primary" @click="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button> -->
- </div>
- <!-- 子表-->
- <a-spin :spinning="confirmLoading">
- <a-form-model ref="formRef" :rules="validatorRules">
- <a-table
- bordered
- :row-key="record => record.id"
- :columns="addBookColumns"
- :data-source="addBookData"
- :loading="loading"
- :pagination="ipagination"
- :scroll="{ x: 1500,y: 350 }"
- @change="handleTableChange"
- >
- <!-- 集装箱代号 输入框 -->
- <template slot="containerCode" slot-scope="text, record, index">
- <a-form-model-item prop="containerCode" :rules="rules.containerCode" >
- <a-input style="width:100%" type="text" v-model="record.containerCode" />
- </a-form-model-item>
- </template>
- <!-- 集装箱号 输入框-->
- <template slot="containerNumber" slot-scope="text, record, index">
- <a-form-model-item prop="containerNumber" :rules="rules.containerNumber">
- <a-input style="width:100%" type="text" v-model="record.containerNumber" @blur="changeContainerNumber"/>
- </a-form-model-item>
- </template>
- <!-- 操作 -->
- <span slot="operationSlot" slot-scope="text, record,index">
- <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(index)">
- <a href="javascript:void(0);" style="color:red;">删除</a>
- </a-popconfirm>
- </span>
- </a-table>
- </a-form-model>
- <!-- 人民币、美金 -->
- <a-row style="margin:60px 0;">
- <div class="purchase-order-table" style="width:48%;marginRight:4%;float:left;">
- <h6 class="table-title">人民币</h6>
- <a-table
- :row-key="record => record.id"
- :loading="loading"
- :columns="CNYColumns"
- :data-source="rmbList"
- :scroll="{ y: 200 }"
- bordered
- :pagination="false"
- >
- <template slot="CNYfreighForward" slot-scope="text, record, index">
- <a-form-model-item prop="CNYfreighForward" :rules="rules.CNYfreighForward" >
- <a-input placeholder="请输入货代" v-model="record.freightForwarder" />
- </a-form-model-item>
- </template>
- <template slot="CNYmoney" slot-scope="text, record, index">
- <a-form-model-item prop="CNYmoney" :rules="rules.CNYmoney" >
- <a-input placeholder="请输入金额" v-model="record.amount" />
- </a-form-model-item>
- </template>
- <!-- CNY项目列 -->
- <template slot="CNYProjectList" slot-scope="text, record, index">
- <a-form-model-item prop="CNYProjectList" :rules="rules.CNYProjectList">
- <a-select v-model="record.itemColumn" style="width:100%" placeholder="请输入项目列">
- <a-select-option value="1">项目列1</a-select-option>
- <a-select-option value="2">项目列2</a-select-option>
- </a-select>
- </a-form-model-item>
- </template>
- </a-table>
- </div>
- <div class="purchase-order-table" style="width:48%;float:right;">
- <h6 class="table-title">美金</h6>
- <a-table
- :row-key="record => record.id"
- :loading="loading"
- :columns="USDColumns"
- :data-source="usdList"
- :scroll="{ y: 200 }"
- bordered
- :pagination="false"
- >
- <template slot="USDfreighForward" slot-scope="text, record, index">
- <a-form-model-item prop="USDfreighForward" :rules="rules.USDfreighForward" >
- <a-input placeholder="请输入货代" v-model="record.freightForwarder" />
- </a-form-model-item>
- </template>
- <template slot="USDmoney" slot-scope="text, record, index">
- <a-form-model-item prop="USDmoney" :rules="rules.USDmoney" >
- <a-input placeholder="请输入金额" v-model="record.amount" />
- </a-form-model-item>
- </template>
- <!-- USD项目列 -->
- <template slot="USDProjectList" slot-scope="text, record, index">
- <a-form-model-item prop="USDProjectList" :rules="rules.USDProjectList">
- <a-select v-model="record.itemColumn" style="width:100%">
- <a-select-option value="1">项目列1</a-select-option>
- <a-select-option value="2">项目列2</a-select-option>
- </a-select>
- </a-form-model-item>
- </template>
- </a-table>
- </div>
- </a-row>
- </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="submitAdd">
- 保存
- </a-button>
- </div>
- </a-drawer>
- <!-- 参照装箱单 -->
- <packingList-modal ref="packingListModal" :father="aa" @ok="modalFormOk" @callback="referCallback"></packingList-modal>
- <packing-list-modal-fabrics ref="packingListModalFabrics" :father="aa" @ok="modalFormOk" @callback="referCallback"></packing-list-modal-fabrics>
- </div>
- </template>
- <script>
- import { JeecgListMixin } from '@/mixins/JeecgListMixin'
- import JEllipsis from '@/components/jeecg/JEllipsis'
- import moment from 'moment'
- import {addPackingList,editPackingList} from '@api/document/book.js'
- import packingListModal from '@views/book/packingListModal.vue'
- import packingListModalFabrics from '@views/book/packingListModalFabrics.vue'
- export default {
- name: 'AddBookDrawer', // 新增 托书
- mixins: [JeecgListMixin],
- components: { packingListModal, JEllipsis, moment,packingListModalFabrics }, // 参照装箱单 弹框
- data() {
- let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
- return {
- // 表头
- addBookColumns: [
- // {
- // title: '单据号',
- // dataIndex: 'documentNo',
- // width: 120,
- // ellipsis: true,
- // fixed: 'left',
- // className: 'replacecolor'
- // },
-
- {
- title: '款号',
- dataIndex: 'itemNumber',
- width: 120,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '小po',
- dataIndex: 'smallPo',
- width: 120,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '数量',
- dataIndex: 'number',
- width: 120,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '箱数',
- dataIndex: 'boxNumber',
- width: 160,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '毛重',
- dataIndex: 'grossWeight',
- width: 120,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '净重',
- dataIndex: 'netWeight',
- width: 120,
- ellipsis: true,
- // scopedSlots: { customRender: 'containerCode' },
- className: 'replacecolor'
- },
- {
- title: '体积',
- dataIndex: 'totalVolume',
- width: 120,
- ellipsis: true,
- // scopedSlots: { customRender: 'containerNo' },
- // className: 'replacecolor'
- },
- {
- title: '分销点',
- dataIndex: 'distributionPoint',
- width: 120,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '集装箱号',
- dataIndex: 'containerNumber',
- ellipsis: true,
- scopedSlots: { customRender: 'containerNumber' },
- width: 120,
- // fixed: 'left',
- className: 'replacecolor'
- },
- // {
- // title: '集装箱代号',
- // dataIndex: 'containerCode',
- // scopedSlots: { customRender: 'containerCode' },
- // width: 120,
- // ellipsis: true,
- // className: 'replacecolor'
- // },
- {
- title: '单价',
- dataIndex: 'price',
- width: 120,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '金额',
- dataIndex: 'totalPrice',
- width: 120,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '制单人',
- dataIndex: 'createBy',
- width: 120,
- ellipsis: true,
- // fixed: 'left',
- className: 'replacecolor'
- },
- {
- title: '采购/委外订单号',
- dataIndex: 'purOrSubOrder',
- width: 160,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '英文名称',
- dataIndex: 'englishProductName',
- width: 160,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '操作',
- dataIndex: 'operation',
- ellipsis: true,
- scopedSlots: { customRender: 'operationSlot' },
- width: 160,
- fixed: 'right',
- className: 'replacecolor'
- }
- ],
- addBookData: [],
- CNYColumns: [
- {
- title: '货代',
- dataIndex: 'freightForwarder',
- scopedSlots: { customRender: 'CNYfreighForward' },
- width: 60,
- className: 'replacecolor'
- },
- {
- title: '金额',
- dataIndex: 'amount',
- scopedSlots: { customRender: 'CNYmoney' },
- width: 60,
- className: 'replacecolor'
- },
- {
- title: '项目列',
- dataIndex: 'itemColumn',
- width: 60,
- scopedSlots: { customRender: 'CNYProjectList' },
- className: 'replacecolor'
- }
- ],
- rmbList: [{}],
- USDColumns: [
- {
- title: '货代',
- dataIndex: 'freightForwarder',
- scopedSlots: { customRender: 'USDfreighForward' },
- width: 20,
- className: 'replacecolor'
- },
- {
- title: '金额',
- dataIndex: 'amount',
- scopedSlots: { customRender: 'USDmoney' },
- width: 20,
- className: 'replacecolor'
- },
- {
- title: '项目列',
- dataIndex: 'itemColumn',
- width: 90,
- scopedSlots: { customRender: 'USDProjectList' },
- className: 'replacecolor'
- }
- ],
- usdList: [{}],
- loading: false, // 表格加载
- addBook: {},
- defaultMethod : 'add',
- confirmLoading: false,
- visible: false,
- dateFormat: 'YYYY-MM-DD',
- validatorRules: {
- shippingOrderDate:[{required: true, message: '托书日期不能为空!'}],
- shippingOrderNumber:[{required: true, message: '托书号不能为空!'}],
- consignee:[{required: true, message: '收货人不能为空!'}],
- unitInOperation:[{required: true, message: '经营单位不能为空!'}],
- // unitInOperationAddress:[{required: true, message: '经营单位地址不能为空!'}],
- tradeCountry:[{required: true, message: '贸易国别不能为空!'}],
- arriveInCountry:[{required: true, message: '运抵国别不能为空!'}],
- exportPort:[{required: true, message: '出口口岸不能为空!'}],
- destinationPort:[{required: true, message: '目的港不能为空!'}],
- }
- }
- },
- created() {},
- methods: {
- //托书号转化大写
- convertUppercase(val){
- this.addBook.shippingOrderNumber = val.toUpperCase()
- },
- // 参照装箱单
- referPackingList(data) {
- console.log('打开参照装箱单')
- if(data === '0'){
- this.$refs.packingListModal.packingListModVis = true
- this.$refs.packingListModal.queryParam.tailoringOrFabric = data
- this.$refs.packingListModal.getPackingList()
- if(this.addBookData.length !== 0){
- this.$refs.packingListModal.fatherList = this.addBookData
- }
- }else {
- this.$refs.packingListModalFabrics.packingListModalFabrics = true
- this.$refs.packingListModalFabrics.queryParam.tailoringOrFabric = data
- this.$refs.packingListModalFabrics.getPackingList()
- if(this.addBookData.length !== 0){
- this.$refs.packingListModal.fatherList = this.addBookData
- }
- }
- },
- referCallback(data,text){
- data.map(item=>{
- item.readyFabric=item.readyFabric
- item.tailoringFabricItemId=item.itemId
- item.tailoringFabricId=item.id
- item.clientAbbreviation = item.customerAbbreviation
- item.styleNumber = item.itemNumber
- item.boxNumber = item.planQuantity
- item.netWeight = (Number(item.netWeight)).toFixed(2)
- item.grossWeight = (Number(item.grossWeight)).toFixed(2)
- item.number = (Number(item.number)).toFixed(2)
- //参照面料时,单价许计算 金额/净重
- if(item.readyFabric == '面料'){
- item.price = (item.totalPrice/item.netWeight).toFixed(2)
- }
- })
- // var subList = this.convertReferToSub(data);
- this.addBookData = this.addBookData.concat(data);
- this.addBook.termsOfDeliveryvalue = 'FOB'
- this.addBook.exchangeEarningsValue = 'T/T'
- this.addBook.exportPort='宁波'
- var dd = moment(new Date()).format('YYYY-MM-DD')
- this.$set( this.addBook,'shippingOrderDate',dd)
- //参照成衣是表头数据默认值
- if(text == '成衣'){
- var transitionData = data[0]
- this.addBook = {
- shippingOrderNumber:transitionData.depositaryReceiptNo,
- shippingOrderDate:transitionData.shippingOrderDate,
- unitInOperation:transitionData.unitInOperation,
- unitInOperationAddress:transitionData.unitInOperationAddress,
- latestDateOfShipment:transitionData.latestDateOfShipment,
- theFinalShippingDate:transitionData.theFinalShippingDate,
- tradeCountry:transitionData.tradeCountry,
- arriveInCountry:transitionData.arriveInCountry,
- consignee:transitionData.consignee,
- consigneeAddress:transitionData.consigneeAddress,
- notifyParty:transitionData.notifyParty,
- notifyPartyAddress:transitionData.notifyPartyAddress,
- exportPort:transitionData.exportPort,
- destinationPort:transitionData.destinationPort,
- exchangeEarningsValue:transitionData.exchangeEarningsValue,
- termsOfDeliveryvalue:transitionData.termsOfDeliveryvalue,
- totalVolume:transitionData.totalVolume,
- }
- }
- this.setHeadCalField()
- },
- // 参照数据转换成子表
- // convertReferToSub(dataList){
- // var ret = [];
- // for (var i=0; i<dataList.length; i++){
- // var data = dataList[i];
- // var sub = {
-
- // documentNo:data.documentNo,
- // createBy:data.createBy,
- // };
- // ret.push(sub);
- // }
- // return ret;
- // },
- // 増行
- // handleAddColumn() {
- // console.log('増行')
- // const addrow = {
- // englishName: '',
- // styleNum: '',
- // smallPoNum: '',
- // quantity: '',
- // boxedNum: '',
- // roughWeigh: '',
- // suttle: '',
- // volume: '',
- // distributionPoint: '',
- // containerCode: '',
- // containerNo: '',
- // price: '',
- // preShipmentDate: '',
- // salesman: '',
- // operatingDepartment: '',
- // purchaseAboardOrderNum: '',
- // purchaseAboardFactory: '',
- // operation: ''
- // }
- // this.addBookData.push(addrow)
- // },
- // 收货人下拉框
- consigneeSelectChange(value){
- if(value !=null && value !='' &&value != 'undefined'){
- var valueArr = value.split("+")
- this.addBook.consignee = valueArr[0];
- if (valueArr.length == 4){
- this.addBook.consigneeAddress = valueArr[1];
- this.addBook.notifyParty = valueArr[2];
- this.addBook.notifyPartyAddress = valueArr[3];
- }else{
- this.$message.error('收货信息维护有问题,请检查!')
- }
- }else{
- this.addBook.consigneeAddress = '';
- this.addBook.notifyParty = '';
- this.addBook.notifyPartyAddress = '';
- }
- },
- unitInOperationChange(val){
- if(val !=null && val !='' &&val != 'undefined'){
- var valueArr = val.split("+")
- this.addBook.unitInOperation = valueArr[0]
- this.addBook.unitInOperationAddress = valueArr[3]
- this.addBook.customsCode = valueArr[1]
- this.addBook.dutyParagraph = valueArr[2]
- }else {
- this.addBook.unitInOperation = ''
- this.addBook.unitInOperationAddress = ''
- this.addBook.customsCode = ''
- this.addBook.dutyParagraph = ''
- }
-
-
- },
- // 设置表头计算值,直接设置表头值对象不能刷新,把表头对象换了就可以了
- setHeadCalField(){
- var containerNumberArr = [],
- readyFabricArr = []
- var headData = JSON.parse(JSON.stringify(this.addBook));
- var moneyAll = 0;
- for (var i=0; i<this.addBookData.length; i++){
- var rowData = this.addBookData[i];
- if(rowData.readyFabric == '面料'){
- containerNumberArr.push(rowData.containerNumber)
- readyFabricArr.push(rowData.readyFabric)
- }
-
- if (rowData.totalPrice != undefined && rowData.totalPrice != ""){
- moneyAll += rowData.totalPrice*1;
- }
- }
- containerNumberArr = [...new Set(containerNumberArr)]
- readyFabricArr = [...new Set(readyFabricArr)]
- if(readyFabricArr.length == 1 && readyFabricArr[0] == '面料'){
- headData.totalVolume = (containerNumberArr.length)*68;
- }
- headData.money = moneyAll;
- this.addBook = headData;
- },
- //集装箱号修改
- changeContainerNumber(){
- this.setHeadCalField()
- },
- // // 新增托书 子表合计
- // addBookFooterShow(data) {
- // console.log('新增托书 子表 ----合计行')
- // console.log('data', data)
- // return (
- // <a-table
- // rowKey={Math.random}
- // bordered={false}
- // pagination={false}
- // columns={this.addBookColumns}
- // dataSource={this.addBookFooterDataSource || []}
- // showHeader={false}
- // ></a-table>
- // )
- // },
- // 操作 删除
- handleDelete(index) {
- this.addBookData.splice(index, 1);
- this.setHeadCalField()
- },
- // 抽屉 取消
- handleCancel() {
- console.log('点击抽屉取消')
- this.close()
- },
- // 抽屉 提交
- submitAdd() {
- console.log('保存新增、刷新托书')
- const that = this
- // 触发表单验证
- this.$refs.form.validate(valid => {
- if (valid) {
- // that.confirmLoading = true
- var newObj = this.addBook
- newObj.rmbList = this.rmbList
- newObj.usdList = this.usdList
- newObj.syShippingOrderItemList = this.addBookData
- for(var i =0;i<newObj.syShippingOrderItemList.length;i++){
- var row = newObj.syShippingOrderItemList[i]
- // if(row.containerCode === '' || !row.containerCode){
- // this.$message.error('第'+(i+1)+'行集装箱代号未填,无法保存!');
- // return
- // }
- if(row.containerNumber === '' || !row.containerNumber){
- this.$message.error('第'+(i+1)+'行集装箱号未填,无法保存!');
- return
- }
- }
- if(this.defaultMethod === 'add'){
- addPackingList(newObj).then(res => {
- if (res.success) {
- this.$message.success('添加成功')
- this.$emit('back')
- this.close()
- }else {
- this.$message.error(res.message);
- }
- })
- }else {
- newObj.syShippingOrderItemList.map(item =>{
- item.smailPo = item.smallPo
- item.styleNumber = item.itemNumber
- item.volume = item.totalVolume
- item.unitPrice = item.price
- })
- editPackingList(newObj).then(res => {
- if (res.success) {
- this.$message.success('编辑成功')
- this.$emit('back')
- this.close()
- }else {
- this.$message.error(res.message);
- }
- })
- }
-
- }
- })
- // this.getShipmentList() // 刷新托书列表
- },
- close() {
- this.addBook ={}
- this.addBookData =[]
- this.rmbList = [{}]
- this.usdList = [{}]
- this.visible = false
- this.defaultMethod = 'add'
- this.$refs.form.resetFields()
- },
- // ------------------------------------------
- modalFormOk() {},
- aa() {}
- // // 分页、排序、筛选变化时触发
- // handleTableChange(pagination, filters, sorter) {
- // // console.log('当前页信息>>>>',pagination)
- // this.queryParam.pageNo = pagination.current
- // this.getAnnList()
- // }
- },
- // 出现滚动条,合计栏跟随 table 滚动
- watch: {
- // dataSource(val) {
- // console.log(val)
- // // 同步表与footer滚动
- // let dom = this.$refs.TableInfo.$el.querySelectorAll('.ant-table-body')[0]
- // dom.addEventListener(
- // 'scroll',
- // () => {
- // this.$refs.TableInfo.$el.querySelectorAll('.ant-table-body')[1].scrollLeft = dom.scrollLeft
- // console.log('走到这')
- // },
- // true
- // )
- // }
- },
- // 构建合计数据 --合计
- // TODO:合计行 有滚动待解决
- computed: {
- // addBookFooterDataSource() {
- // // 新增托书 子表 合计
- // const total = Object.assign({}, this.addBookData[0])
- // for (const attr in total) {
- // total[attr] = '合计'
- // break
- // }
- // return [total]
- // }
- },
- mounted() {}
- }
- </script>
- <style lang="less" scoped>
- @import '~@assets/less/common.less';
- @import '~@assets/less/overwriter.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-footer .ant-table.body {
- // overflow: hidden !important;
- }
- /deep/ .ant-table.ant-table-bordered .ant-table-footer {
- border: none;
- padding: 0;
- }
- </style>
|