12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025 |
- <template>
- <!-- 新增托书 -->
- <div id="addBookDrawer">
- <a-drawer
- :title="(defaultMethod == 'add')?'新增托书':'编辑托书'"
- 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"
- >
- <!-- 自定义表头 -->
- <span slot="containerNumberTitle" class="form-table-heard">
- 集装箱号
- </span>
- <!-- 集装箱代号 输入框 -->
- <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>
- <template slot="option" slot-scope="text, record, index">
- <a-button type="primary" @click="adsCNY">增行</a-button>
- <a-divider type="vertical" />
- <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="deleteCNY(index)">
- <a-button type="danger" >删除</a-button>
- </a-popconfirm>
- </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="USDoption" slot-scope="text, record, index">
- <a-button type="primary" @click="adsUSD">增行</a-button>
- <a-divider type="vertical" />
- <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="deleteUSD(index)">
- <a-button type="danger" >删除</a-button>
- </a-popconfirm>
- </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,Dictionaries} 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: 'volume',
- 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' },
- slots:{title:'containerNumberTitle'},
- 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'
- },
- {
- title: '操作',
- dataIndex: 'option',
- width: 60,
- scopedSlots: { customRender: 'option' },
- className: 'replacecolor'
- }
- ],
- rmbList: [{}],
- USDColumns: [
- {
- title: '货代',
- dataIndex: 'freightForwarder',
- scopedSlots: { customRender: 'USDfreighForward' },
- width: 60,
- className: 'replacecolor'
- },
- {
- title: '金额',
- dataIndex: 'amount',
- scopedSlots: { customRender: 'USDmoney' },
- width: 60,
- className: 'replacecolor'
- },
- {
- title: '项目列',
- dataIndex: 'itemColumn',
- width: 60,
- scopedSlots: { customRender: 'USDProjectList' },
- className: 'replacecolor'
- },
- {
- title: '操作',
- dataIndex: 'option',
- width: 60,
- scopedSlots: { customRender: 'USDoption' },
- className: 'replacecolor'
- }
- ],
- usdList: [{}],
- loading: false, // 表格加载
- addBook: {},
- arrOption:[],
- 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() {
- this.getOption()
- },
- methods: {
- //获取经营单位数据字典
- getOption(){
- Dictionaries({code:'test-200'}).then(res => {
- this.arrOption = res
- })
- },
- //托书号转化大写
- 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)
- item.volume = item.totalVolume
- //参照面料时,单价许计算 金额/净重
- if(item.readyFabric == '面料'){
- item.price = (item.totalPrice/item.netWeight).toFixed(4)
- }
- })
- // var subList = this.convertReferToSub(data);
- this.addBookData = this.addBookData.concat(data);
- this.addBook.termsOfDeliveryvalue = 'FOB'
- this.addBook.exchangeEarningsValue = 'T/T'
- this.addBook.exportPort='NINGBO'
- 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,
- }
- var duty=''
- this.arrOption.map(item=>{
- var value = item.value.split('+')
- if(value[0] == this.addBook.unitInOperation){
- duty =value[2]
- }
- })
- this.addBook.dutyParagraph = duty
- }
- 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,
- vol = 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;
- }
- if (rowData.volume != undefined && rowData.volume != ""){
- vol += rowData.volume*1;
- }
- }
- headData.totalVolume = parseFloat(vol.toFixed(4));
- containerNumberArr = [...new Set(containerNumberArr)]
- readyFabricArr = [...new Set(readyFabricArr)]
- if(readyFabricArr.length == 1 && readyFabricArr[0] == '面料'){
- headData.totalVolume = (containerNumberArr.length)*68;
- }
- headData.money = parseFloat(moneyAll.toFixed(2));
- 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.volume
- 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() // 刷新托书列表
- },
- adsCNY(){
- var newObj ={
- freightForwarder :'',
- amount:'',
- option:''
- }
- this.rmbList.push(newObj)
- },
- adsUSD(){
- var newObj ={
- freightForwarder :'',
- amount:'',
- option:''
- }
- this.usdList.push(newObj)
- },
- deleteCNY(index){
- this.rmbList.splice(index, 1);
- },
- deleteUSD(index){
- this.usdList.splice(index, 1);
- },
- 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;
- }
- /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>
|