addBookDrawer.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941
  1. <template>
  2. <!-- 新增托书 -->
  3. <div id="addBookDrawer">
  4. <a-drawer
  5. title="新增托书"
  6. width="89%"
  7. placement="right"
  8. :closable="true"
  9. :visible="visible"
  10. @close="handleCancel">
  11. <!-- 主表信息 填写 为什么原先图部分回显??-->
  12. <a-card :bordered="true">
  13. <div class="table-page-search-wrapper">
  14. <a-form-model layout="inline" ref="form" :model="addBook" :rules="validatorRules">
  15. <a-row :gutter="24">
  16. <a-col :md="6" :sm="8">
  17. <a-form-model-item label="托书号" prop="shippingOrderNumber">
  18. <a-input placeholder="请输入托书号" v-model="addBook.shippingOrderNumber" @blur="convertUppercase(addBook.shippingOrderNumber)"></a-input>
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :md="6" :sm="8">
  22. <a-form-model-item label="托书日期" prop="shippingOrderDate">
  23. <a-date-picker
  24. placeholder="请选择托书日期"
  25. style="width:100%;"
  26. :format="dateFormat"
  27. v-model="addBook.shippingOrderDate"
  28. />
  29. </a-form-model-item>
  30. </a-col>
  31. <!-- <a-col :md="6" :sm="8">
  32. <a-form-model-item label="外销发票号码" prop="exportInvoiceNo">
  33. <a-input placeholder="请输入外销发票号码" v-model="addBook.exportInvoiceNo"></a-input>
  34. </a-form-model-item>
  35. </a-col> -->
  36. <a-col :md="6" :sm="8">
  37. <a-form-model-item label="经营单位" prop="unitInOperation">
  38. <!-- <a-input placeholder="请输入经营单位" v-model="addBook.unitInOperation"></a-input> -->
  39. <j-search-select-tag
  40. placeholder="请选择收货人"
  41. v-model="addBook.unitInOperation"
  42. @change="unitInOperationChange"
  43. dict="test-200">
  44. </j-search-select-tag>
  45. </a-form-model-item>
  46. </a-col>
  47. <a-col :md="6" :sm="8">
  48. <a-form-model-item label="经营单位地址" prop="unitInOperationAddress">
  49. <a-input placeholder="根据经营单位自动带出" v-model="addBook.unitInOperationAddress"></a-input>
  50. </a-form-model-item>
  51. </a-col>
  52. <!-- <a-col :md="6" :sm="8">
  53. <a-form-model-item label="海关代码" prop="customsCode">
  54. <a-input placeholder="根据经营单位自动带出" v-model="addBook.customsCode"></a-input>
  55. </a-form-model-item>
  56. </a-col>
  57. <a-col :md="6" :sm="8">
  58. <a-form-model-item label="税号" prop="dutyParagraph">
  59. <a-input placeholder="根据经营单位自动带出" v-model="addBook.dutyParagraph"></a-input>
  60. </a-form-model-item>
  61. </a-col> -->
  62. <a-col :md="6" :sm="8">
  63. <a-form-model-item label="进仓/装柜日期" prop="latestDateOfShipment">
  64. <a-date-picker
  65. placeholder="请选择进仓/装柜日期"
  66. style="width:100%;"
  67. :format="dateFormat"
  68. v-model="addBook.latestDateOfShipment"
  69. />
  70. </a-form-model-item>
  71. </a-col>
  72. <a-col :md="6" :sm="8">
  73. <a-form-model-item label="最终船期" prop="theFinalShippingDate">
  74. <a-date-picker
  75. placeholder="请选择最终船期"
  76. style="width:100%;"
  77. :format="dateFormat"
  78. v-model="addBook.theFinalShippingDate"
  79. />
  80. </a-form-model-item>
  81. </a-col>
  82. <a-col :md="6" :sm="8">
  83. <a-form-model-item label="贸易国别" prop="tradeCountry">
  84. <j-search-select-tag
  85. placeholder="请选择贸易国别"
  86. v-model="addBook.tradeCountry"
  87. dict="trade_country">
  88. </j-search-select-tag>
  89. <!-- <a-input placeholder="请输入贸易国别" v-model="addBook.tradeCountry"></a-input> -->
  90. </a-form-model-item>
  91. </a-col>
  92. <a-col :md="6" :sm="8">
  93. <a-form-model-item label="运抵国别" prop="arriveInCountry">
  94. <j-search-select-tag
  95. placeholder="请选择运抵国别"
  96. v-model="addBook.arriveInCountry"
  97. dict="country_of_arrival">
  98. </j-search-select-tag>
  99. <!-- <a-input placeholder="请输入运抵国别" v-model="addBook.arriveInCountry"></a-input> -->
  100. </a-form-model-item>
  101. </a-col>
  102. <a-col :md="6" :sm="8">
  103. <a-form-model-item label="收货人" prop="consignee">
  104. <!-- <j-dict-select-tag
  105. style="width:100%;margin-bottom: 10px;" v-model="addBook.consignee"
  106. dictCode="sys_dict_item,item_text,description,dict_id in(select id from sys_dict where dict_code='receiving_goods_info')"
  107. @change="consigneeSelectChange"/> -->
  108. <j-search-select-tag
  109. placeholder="请选择收货人"
  110. v-model="addBook.consignee"
  111. @change="consigneeSelectChange"
  112. dict="receiving_goods_info">
  113. </j-search-select-tag>
  114. </a-form-model-item>
  115. </a-col>
  116. <a-col :md="6" :sm="8">
  117. <a-form-model-item label="收货人地址" prop="consigneeAddress">
  118. <a-input placeholder="根据收货人自动带出" v-model="addBook.consigneeAddress" ></a-input>
  119. </a-form-model-item>
  120. </a-col>
  121. <a-col :md="6" :sm="8">
  122. <a-form-model-item label="通知方" prop="notifyParty">
  123. <a-input placeholder="根据收货人自动带出" v-model="addBook.notifyParty" ></a-input>
  124. </a-form-model-item>
  125. </a-col>
  126. <a-col :md="6" :sm="8">
  127. <a-form-model-item label="通知方地址" prop="notifyPartyAddress">
  128. <a-input placeholder="根据收货人自动带出" v-model="addBook.notifyPartyAddress" ></a-input>
  129. </a-form-model-item>
  130. </a-col>
  131. <a-col :md="6" :sm="8">
  132. <a-form-model-item label="出口口岸" prop="exportPort">
  133. <j-search-select-tag
  134. placeholder="请选择出口口岸"
  135. v-model="addBook.exportPort"
  136. dict="export_port">
  137. </j-search-select-tag>
  138. <!-- <a-input placeholder="请输入出口口岸" v-model="addBook.exportPort"></a-input> -->
  139. </a-form-model-item>
  140. </a-col>
  141. <a-col :md="6" :sm="8">
  142. <a-form-model-item label="目的港" prop="destinationPort">
  143. <j-search-select-tag
  144. placeholder="请选择目的港"
  145. v-model="addBook.destinationPort"
  146. dict="port_of_destination">
  147. </j-search-select-tag>
  148. <!-- <a-input placeholder="请输入目的港" v-model="addBook.destinationPort"></a-input> -->
  149. </a-form-model-item>
  150. </a-col>
  151. <a-col :md="6" :sm="8">
  152. <a-form-model-item label="收汇方式" prop="exchangeEarningsValue">
  153. <j-search-select-tag
  154. placeholder="请选择收汇方式"
  155. v-model="addBook.exchangeEarningsValue"
  156. dict="collection_method">
  157. </j-search-select-tag>
  158. <!-- <a-input placeholder="请输入收汇方式" v-model="addBook.exchangeEarningsValue"></a-input> -->
  159. </a-form-model-item>
  160. </a-col>
  161. <a-col :md="6" :sm="8">
  162. <a-form-model-item label="成交方式" prop="termsOfDeliveryvalue">
  163. <j-search-select-tag
  164. placeholder="请选择成交方式"
  165. v-model="addBook.termsOfDeliveryvalue"
  166. dict="transaction_method"
  167. change>
  168. </j-search-select-tag>
  169. <!-- <a-input placeholder="请输入成交方式" v-model="addBook.termsOfDeliveryvalue"></a-input> -->
  170. </a-form-model-item>
  171. </a-col>
  172. <a-col :md="6" :sm="8">
  173. <a-form-model-item label="金额" prop="money">
  174. <a-input placeholder="请输入金额" v-model="addBook.money"></a-input>
  175. </a-form-model-item>
  176. </a-col>
  177. <a-col :md="6" :sm="8">
  178. <a-form-model-item label="运输方式" prop="typeOfShipping">
  179. <j-search-select-tag
  180. placeholder="请选择运输方式"
  181. v-model="addBook.typeOfShipping"
  182. dict="test0902001">
  183. </j-search-select-tag>
  184. </a-form-model-item>
  185. </a-col>
  186. <a-col :md="6" :sm="8">
  187. <a-form-model-item label="体积" prop="totalVolume">
  188. <a-input placeholder="请输入体积" v-model="addBook.totalVolume" readOnly></a-input>
  189. </a-form-model-item>
  190. </a-col>
  191. <!-- <a-col :md="6" :sm="8">
  192. <a-form-model-item label="人民币" prop="cny">
  193. <a-input placeholder="请输入人民币" v-model="addBook.cny"></a-input>
  194. </a-form-model-item>
  195. </a-col>
  196. <a-col :md="6" :sm="8">
  197. <a-form-model-item label="美元" prop="usd">
  198. <a-input placeholder="请输入美元" v-model="addBook.usd"></a-input>
  199. </a-form-model-item>
  200. </a-col> -->
  201. </a-row>
  202. </a-form-model>
  203. </div>
  204. </a-card>
  205. <!--操作按钮区域 参照装箱单 増行-->
  206. <a-card :bordered="true" style="margin:10px 0 40px 0;">
  207. <div class="table-operator">
  208. <a-button type="primary" @click="referPackingList('0')" icon="ordered-list">参照装箱单-成衣</a-button>
  209. <a-button type="primary" @click="referPackingList('1')" icon="ordered-list">参照装箱单-面料</a-button>
  210. <!-- <a-button type="primary" @click="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button> -->
  211. </div>
  212. <!-- 子表-->
  213. <a-spin :spinning="confirmLoading">
  214. <a-form-model ref="formRef" :rules="validatorRules">
  215. <a-table
  216. bordered
  217. :row-key="record => record.id"
  218. :columns="addBookColumns"
  219. :data-source="addBookData"
  220. :loading="loading"
  221. :pagination="ipagination"
  222. :scroll="{ x: 1500,y: 350 }"
  223. @change="handleTableChange"
  224. >
  225. <!-- 集装箱代号 输入框 -->
  226. <template slot="containerCode" slot-scope="text, record, index">
  227. <a-form-model-item prop="containerCode" :rules="rules.containerCode" >
  228. <a-input style="width:100%" type="text" v-model="record.containerCode" />
  229. </a-form-model-item>
  230. </template>
  231. <!-- 集装箱号 输入框-->
  232. <template slot="containerNumber" slot-scope="text, record, index">
  233. <a-form-model-item prop="containerNumber" :rules="rules.containerNumber">
  234. <a-input style="width:100%" type="text" v-model="record.containerNumber" @blur="changeContainerNumber"/>
  235. </a-form-model-item>
  236. </template>
  237. <!-- 操作 -->
  238. <span slot="operationSlot" slot-scope="text, record,index">
  239. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(index)">
  240. <a href="javascript:void(0);" style="color:red;">删除</a>
  241. </a-popconfirm>
  242. </span>
  243. </a-table>
  244. </a-form-model>
  245. <!-- 人民币、美金 -->
  246. <a-row style="margin:60px 0;">
  247. <div class="purchase-order-table" style="width:48%;marginRight:4%;float:left;">
  248. <h6 class="table-title">人民币</h6>
  249. <a-table
  250. :row-key="record => record.id"
  251. :loading="loading"
  252. :columns="CNYColumns"
  253. :data-source="rmbList"
  254. :scroll="{ y: 200 }"
  255. bordered
  256. :pagination="false"
  257. >
  258. <template slot="CNYfreighForward" slot-scope="text, record, index">
  259. <a-form-model-item prop="CNYfreighForward" :rules="rules.CNYfreighForward" >
  260. <a-input placeholder="请输入货代" v-model="record.freightForwarder" />
  261. </a-form-model-item>
  262. </template>
  263. <template slot="CNYmoney" slot-scope="text, record, index">
  264. <a-form-model-item prop="CNYmoney" :rules="rules.CNYmoney" >
  265. <a-input placeholder="请输入金额" v-model="record.amount" />
  266. </a-form-model-item>
  267. </template>
  268. <!-- CNY项目列 -->
  269. <template slot="CNYProjectList" slot-scope="text, record, index">
  270. <a-form-model-item prop="CNYProjectList" :rules="rules.CNYProjectList">
  271. <a-select v-model="record.itemColumn" style="width:100%" placeholder="请输入项目列">
  272. <a-select-option value="1">项目列1</a-select-option>
  273. <a-select-option value="2">项目列2</a-select-option>
  274. </a-select>
  275. </a-form-model-item>
  276. </template>
  277. </a-table>
  278. </div>
  279. <div class="purchase-order-table" style="width:48%;float:right;">
  280. <h6 class="table-title">美金</h6>
  281. <a-table
  282. :row-key="record => record.id"
  283. :loading="loading"
  284. :columns="USDColumns"
  285. :data-source="usdList"
  286. :scroll="{ y: 200 }"
  287. bordered
  288. :pagination="false"
  289. >
  290. <template slot="USDfreighForward" slot-scope="text, record, index">
  291. <a-form-model-item prop="USDfreighForward" :rules="rules.USDfreighForward" >
  292. <a-input placeholder="请输入货代" v-model="record.freightForwarder" />
  293. </a-form-model-item>
  294. </template>
  295. <template slot="USDmoney" slot-scope="text, record, index">
  296. <a-form-model-item prop="USDmoney" :rules="rules.USDmoney" >
  297. <a-input placeholder="请输入金额" v-model="record.amount" />
  298. </a-form-model-item>
  299. </template>
  300. <!-- USD项目列 -->
  301. <template slot="USDProjectList" slot-scope="text, record, index">
  302. <a-form-model-item prop="USDProjectList" :rules="rules.USDProjectList">
  303. <a-select v-model="record.itemColumn" style="width:100%">
  304. <a-select-option value="1">项目列1</a-select-option>
  305. <a-select-option value="2">项目列2</a-select-option>
  306. </a-select>
  307. </a-form-model-item>
  308. </template>
  309. </a-table>
  310. </div>
  311. </a-row>
  312. </a-spin>
  313. </a-card>
  314. <!-- 页面底部保存取消 -->
  315. <div
  316. :style="{
  317. position: 'absolute',
  318. right: 0,
  319. bottom: 0,
  320. width: '100%',
  321. borderTop: '1px solid #e9e9e9',
  322. padding: '10px 16px',
  323. background: '#fff',
  324. textAlign: 'right',
  325. zIndex: 999
  326. }"
  327. >
  328. <a-popconfirm title="确定放弃新增?" @confirm="handleCancel" okText="确定" cancelText="取消">
  329. <a-button :style="{ marginRight: '8px' }">取消</a-button>
  330. </a-popconfirm>
  331. <a-button type="primary" @click="submitAdd">
  332. 保存
  333. </a-button>
  334. </div>
  335. </a-drawer>
  336. <!-- 参照装箱单 -->
  337. <packingList-modal ref="packingListModal" :father="aa" @ok="modalFormOk" @callback="referCallback"></packingList-modal>
  338. <packing-list-modal-fabrics ref="packingListModalFabrics" :father="aa" @ok="modalFormOk" @callback="referCallback"></packing-list-modal-fabrics>
  339. </div>
  340. </template>
  341. <script>
  342. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  343. import JEllipsis from '@/components/jeecg/JEllipsis'
  344. import moment from 'moment'
  345. import {addPackingList,editPackingList} from '@api/document/book.js'
  346. import packingListModal from '@views/book/packingListModal.vue'
  347. import packingListModalFabrics from '@views/book/packingListModalFabrics.vue'
  348. export default {
  349. name: 'AddBookDrawer', // 新增 托书
  350. mixins: [JeecgListMixin],
  351. components: { packingListModal, JEllipsis, moment,packingListModalFabrics }, // 参照装箱单 弹框
  352. data() {
  353. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  354. return {
  355. // 表头
  356. addBookColumns: [
  357. // {
  358. // title: '单据号',
  359. // dataIndex: 'documentNo',
  360. // width: 120,
  361. // ellipsis: true,
  362. // fixed: 'left',
  363. // className: 'replacecolor'
  364. // },
  365. {
  366. title: '款号',
  367. dataIndex: 'itemNumber',
  368. width: 120,
  369. ellipsis: true,
  370. className: 'replacecolor'
  371. },
  372. {
  373. title: '小po',
  374. dataIndex: 'smallPo',
  375. width: 120,
  376. ellipsis: true,
  377. className: 'replacecolor'
  378. },
  379. {
  380. title: '数量',
  381. dataIndex: 'number',
  382. width: 120,
  383. ellipsis: true,
  384. className: 'replacecolor'
  385. },
  386. {
  387. title: '箱数',
  388. dataIndex: 'boxNumber',
  389. width: 160,
  390. ellipsis: true,
  391. className: 'replacecolor'
  392. },
  393. {
  394. title: '毛重',
  395. dataIndex: 'grossWeight',
  396. width: 120,
  397. ellipsis: true,
  398. className: 'replacecolor'
  399. },
  400. {
  401. title: '净重',
  402. dataIndex: 'netWeight',
  403. width: 120,
  404. ellipsis: true,
  405. // scopedSlots: { customRender: 'containerCode' },
  406. className: 'replacecolor'
  407. },
  408. {
  409. title: '体积',
  410. dataIndex: 'totalVolume',
  411. width: 120,
  412. ellipsis: true,
  413. // scopedSlots: { customRender: 'containerNo' },
  414. // className: 'replacecolor'
  415. },
  416. {
  417. title: '分销点',
  418. dataIndex: 'distributionPoint',
  419. width: 120,
  420. ellipsis: true,
  421. className: 'replacecolor'
  422. },
  423. {
  424. title: '集装箱号',
  425. dataIndex: 'containerNumber',
  426. ellipsis: true,
  427. scopedSlots: { customRender: 'containerNumber' },
  428. width: 120,
  429. // fixed: 'left',
  430. className: 'replacecolor'
  431. },
  432. // {
  433. // title: '集装箱代号',
  434. // dataIndex: 'containerCode',
  435. // scopedSlots: { customRender: 'containerCode' },
  436. // width: 120,
  437. // ellipsis: true,
  438. // className: 'replacecolor'
  439. // },
  440. {
  441. title: '单价',
  442. dataIndex: 'price',
  443. width: 120,
  444. ellipsis: true,
  445. className: 'replacecolor'
  446. },
  447. {
  448. title: '金额',
  449. dataIndex: 'totalPrice',
  450. width: 120,
  451. ellipsis: true,
  452. className: 'replacecolor'
  453. },
  454. {
  455. title: '制单人',
  456. dataIndex: 'createBy',
  457. width: 120,
  458. ellipsis: true,
  459. // fixed: 'left',
  460. className: 'replacecolor'
  461. },
  462. {
  463. title: '采购/委外订单号',
  464. dataIndex: 'purOrSubOrder',
  465. width: 160,
  466. ellipsis: true,
  467. className: 'replacecolor'
  468. },
  469. {
  470. title: '英文名称',
  471. dataIndex: 'englishProductName',
  472. width: 160,
  473. ellipsis: true,
  474. className: 'replacecolor'
  475. },
  476. {
  477. title: '操作',
  478. dataIndex: 'operation',
  479. ellipsis: true,
  480. scopedSlots: { customRender: 'operationSlot' },
  481. width: 160,
  482. fixed: 'right',
  483. className: 'replacecolor'
  484. }
  485. ],
  486. addBookData: [],
  487. CNYColumns: [
  488. {
  489. title: '货代',
  490. dataIndex: 'freightForwarder',
  491. scopedSlots: { customRender: 'CNYfreighForward' },
  492. width: 60,
  493. className: 'replacecolor'
  494. },
  495. {
  496. title: '金额',
  497. dataIndex: 'amount',
  498. scopedSlots: { customRender: 'CNYmoney' },
  499. width: 60,
  500. className: 'replacecolor'
  501. },
  502. {
  503. title: '项目列',
  504. dataIndex: 'itemColumn',
  505. width: 60,
  506. scopedSlots: { customRender: 'CNYProjectList' },
  507. className: 'replacecolor'
  508. }
  509. ],
  510. rmbList: [{}],
  511. USDColumns: [
  512. {
  513. title: '货代',
  514. dataIndex: 'freightForwarder',
  515. scopedSlots: { customRender: 'USDfreighForward' },
  516. width: 20,
  517. className: 'replacecolor'
  518. },
  519. {
  520. title: '金额',
  521. dataIndex: 'amount',
  522. scopedSlots: { customRender: 'USDmoney' },
  523. width: 20,
  524. className: 'replacecolor'
  525. },
  526. {
  527. title: '项目列',
  528. dataIndex: 'itemColumn',
  529. width: 90,
  530. scopedSlots: { customRender: 'USDProjectList' },
  531. className: 'replacecolor'
  532. }
  533. ],
  534. usdList: [{}],
  535. loading: false, // 表格加载
  536. addBook: {},
  537. defaultMethod : 'add',
  538. confirmLoading: false,
  539. visible: false,
  540. dateFormat: 'YYYY-MM-DD',
  541. validatorRules: {
  542. shippingOrderDate:[{required: true, message: '托书日期不能为空!'}],
  543. shippingOrderNumber:[{required: true, message: '托书号不能为空!'}],
  544. consignee:[{required: true, message: '收货人不能为空!'}],
  545. unitInOperation:[{required: true, message: '经营单位不能为空!'}],
  546. // unitInOperationAddress:[{required: true, message: '经营单位地址不能为空!'}],
  547. tradeCountry:[{required: true, message: '贸易国别不能为空!'}],
  548. arriveInCountry:[{required: true, message: '运抵国别不能为空!'}],
  549. exportPort:[{required: true, message: '出口口岸不能为空!'}],
  550. destinationPort:[{required: true, message: '目的港不能为空!'}],
  551. }
  552. }
  553. },
  554. created() {},
  555. methods: {
  556. //托书号转化大写
  557. convertUppercase(val){
  558. this.addBook.shippingOrderNumber = val.toUpperCase()
  559. },
  560. // 参照装箱单
  561. referPackingList(data) {
  562. console.log('打开参照装箱单')
  563. if(data === '0'){
  564. this.$refs.packingListModal.packingListModVis = true
  565. this.$refs.packingListModal.queryParam.tailoringOrFabric = data
  566. this.$refs.packingListModal.getPackingList()
  567. if(this.addBookData.length !== 0){
  568. this.$refs.packingListModal.fatherList = this.addBookData
  569. }
  570. }else {
  571. this.$refs.packingListModalFabrics.packingListModalFabrics = true
  572. this.$refs.packingListModalFabrics.queryParam.tailoringOrFabric = data
  573. this.$refs.packingListModalFabrics.getPackingList()
  574. if(this.addBookData.length !== 0){
  575. this.$refs.packingListModal.fatherList = this.addBookData
  576. }
  577. }
  578. },
  579. referCallback(data,text){
  580. data.map(item=>{
  581. item.readyFabric=item.readyFabric
  582. item.tailoringFabricItemId=item.itemId
  583. item.tailoringFabricId=item.id
  584. item.clientAbbreviation = item.customerAbbreviation
  585. item.styleNumber = item.itemNumber
  586. item.boxNumber = item.planQuantity
  587. item.netWeight = (Number(item.netWeight)).toFixed(2)
  588. item.grossWeight = (Number(item.grossWeight)).toFixed(2)
  589. item.number = (Number(item.number)).toFixed(2)
  590. //参照面料时,单价许计算 金额/净重
  591. if(item.readyFabric == '面料'){
  592. item.price = (item.totalPrice/item.netWeight).toFixed(2)
  593. }
  594. })
  595. // var subList = this.convertReferToSub(data);
  596. this.addBookData = this.addBookData.concat(data);
  597. this.addBook.termsOfDeliveryvalue = 'FOB'
  598. this.addBook.exchangeEarningsValue = 'T/T'
  599. this.addBook.exportPort='宁波'
  600. var dd = moment(new Date()).format('YYYY-MM-DD')
  601. this.$set( this.addBook,'shippingOrderDate',dd)
  602. //参照成衣是表头数据默认值
  603. if(text == '成衣'){
  604. var transitionData = data[0]
  605. this.addBook = {
  606. shippingOrderNumber:transitionData.depositaryReceiptNo,
  607. shippingOrderDate:transitionData.shippingOrderDate,
  608. unitInOperation:transitionData.unitInOperation,
  609. unitInOperationAddress:transitionData.unitInOperationAddress,
  610. latestDateOfShipment:transitionData.latestDateOfShipment,
  611. theFinalShippingDate:transitionData.theFinalShippingDate,
  612. tradeCountry:transitionData.tradeCountry,
  613. arriveInCountry:transitionData.arriveInCountry,
  614. consignee:transitionData.consignee,
  615. consigneeAddress:transitionData.consigneeAddress,
  616. notifyParty:transitionData.notifyParty,
  617. notifyPartyAddress:transitionData.notifyPartyAddress,
  618. exportPort:transitionData.exportPort,
  619. destinationPort:transitionData.destinationPort,
  620. exchangeEarningsValue:transitionData.exchangeEarningsValue,
  621. termsOfDeliveryvalue:transitionData.termsOfDeliveryvalue,
  622. totalVolume:transitionData.totalVolume,
  623. }
  624. }
  625. this.setHeadCalField()
  626. },
  627. // 参照数据转换成子表
  628. // convertReferToSub(dataList){
  629. // var ret = [];
  630. // for (var i=0; i<dataList.length; i++){
  631. // var data = dataList[i];
  632. // var sub = {
  633. // documentNo:data.documentNo,
  634. // createBy:data.createBy,
  635. // };
  636. // ret.push(sub);
  637. // }
  638. // return ret;
  639. // },
  640. // 増行
  641. // handleAddColumn() {
  642. // console.log('増行')
  643. // const addrow = {
  644. // englishName: '',
  645. // styleNum: '',
  646. // smallPoNum: '',
  647. // quantity: '',
  648. // boxedNum: '',
  649. // roughWeigh: '',
  650. // suttle: '',
  651. // volume: '',
  652. // distributionPoint: '',
  653. // containerCode: '',
  654. // containerNo: '',
  655. // price: '',
  656. // preShipmentDate: '',
  657. // salesman: '',
  658. // operatingDepartment: '',
  659. // purchaseAboardOrderNum: '',
  660. // purchaseAboardFactory: '',
  661. // operation: ''
  662. // }
  663. // this.addBookData.push(addrow)
  664. // },
  665. // 收货人下拉框
  666. consigneeSelectChange(value){
  667. if(value !=null && value !='' &&value != 'undefined'){
  668. var valueArr = value.split("+")
  669. this.addBook.consignee = valueArr[0];
  670. if (valueArr.length == 4){
  671. this.addBook.consigneeAddress = valueArr[1];
  672. this.addBook.notifyParty = valueArr[2];
  673. this.addBook.notifyPartyAddress = valueArr[3];
  674. }else{
  675. this.$message.error('收货信息维护有问题,请检查!')
  676. }
  677. }else{
  678. this.addBook.consigneeAddress = '';
  679. this.addBook.notifyParty = '';
  680. this.addBook.notifyPartyAddress = '';
  681. }
  682. },
  683. unitInOperationChange(val){
  684. if(val !=null && val !='' &&val != 'undefined'){
  685. var valueArr = val.split("+")
  686. this.addBook.unitInOperation = valueArr[0]
  687. this.addBook.unitInOperationAddress = valueArr[3]
  688. this.addBook.customsCode = valueArr[1]
  689. this.addBook.dutyParagraph = valueArr[2]
  690. }else {
  691. this.addBook.unitInOperation = ''
  692. this.addBook.unitInOperationAddress = ''
  693. this.addBook.customsCode = ''
  694. this.addBook.dutyParagraph = ''
  695. }
  696. },
  697. // 设置表头计算值,直接设置表头值对象不能刷新,把表头对象换了就可以了
  698. setHeadCalField(){
  699. var containerNumberArr = [],
  700. readyFabricArr = []
  701. var headData = JSON.parse(JSON.stringify(this.addBook));
  702. var moneyAll = 0;
  703. for (var i=0; i<this.addBookData.length; i++){
  704. var rowData = this.addBookData[i];
  705. if(rowData.readyFabric == '面料'){
  706. containerNumberArr.push(rowData.containerNumber)
  707. readyFabricArr.push(rowData.readyFabric)
  708. }
  709. if (rowData.totalPrice != undefined && rowData.totalPrice != ""){
  710. moneyAll += rowData.totalPrice*1;
  711. }
  712. }
  713. containerNumberArr = [...new Set(containerNumberArr)]
  714. readyFabricArr = [...new Set(readyFabricArr)]
  715. if(readyFabricArr.length == 1 && readyFabricArr[0] == '面料'){
  716. headData.totalVolume = (containerNumberArr.length)*68;
  717. }
  718. headData.money = moneyAll;
  719. this.addBook = headData;
  720. },
  721. //集装箱号修改
  722. changeContainerNumber(){
  723. this.setHeadCalField()
  724. },
  725. // // 新增托书 子表合计
  726. // addBookFooterShow(data) {
  727. // console.log('新增托书 子表 ----合计行')
  728. // console.log('data', data)
  729. // return (
  730. // <a-table
  731. // rowKey={Math.random}
  732. // bordered={false}
  733. // pagination={false}
  734. // columns={this.addBookColumns}
  735. // dataSource={this.addBookFooterDataSource || []}
  736. // showHeader={false}
  737. // ></a-table>
  738. // )
  739. // },
  740. // 操作 删除
  741. handleDelete(index) {
  742. this.addBookData.splice(index, 1);
  743. this.setHeadCalField()
  744. },
  745. // 抽屉 取消
  746. handleCancel() {
  747. console.log('点击抽屉取消')
  748. this.close()
  749. },
  750. // 抽屉 提交
  751. submitAdd() {
  752. console.log('保存新增、刷新托书')
  753. const that = this
  754. // 触发表单验证
  755. this.$refs.form.validate(valid => {
  756. if (valid) {
  757. // that.confirmLoading = true
  758. var newObj = this.addBook
  759. newObj.rmbList = this.rmbList
  760. newObj.usdList = this.usdList
  761. newObj.syShippingOrderItemList = this.addBookData
  762. for(var i =0;i<newObj.syShippingOrderItemList.length;i++){
  763. var row = newObj.syShippingOrderItemList[i]
  764. // if(row.containerCode === '' || !row.containerCode){
  765. // this.$message.error('第'+(i+1)+'行集装箱代号未填,无法保存!');
  766. // return
  767. // }
  768. if(row.containerNumber === '' || !row.containerNumber){
  769. this.$message.error('第'+(i+1)+'行集装箱号未填,无法保存!');
  770. return
  771. }
  772. }
  773. if(this.defaultMethod === 'add'){
  774. addPackingList(newObj).then(res => {
  775. if (res.success) {
  776. this.$message.success('添加成功')
  777. this.$emit('back')
  778. this.close()
  779. }else {
  780. this.$message.error(res.message);
  781. }
  782. })
  783. }else {
  784. newObj.syShippingOrderItemList.map(item =>{
  785. item.smailPo = item.smallPo
  786. item.styleNumber = item.itemNumber
  787. item.volume = item.totalVolume
  788. item.unitPrice = item.price
  789. })
  790. editPackingList(newObj).then(res => {
  791. if (res.success) {
  792. this.$message.success('编辑成功')
  793. this.$emit('back')
  794. this.close()
  795. }else {
  796. this.$message.error(res.message);
  797. }
  798. })
  799. }
  800. }
  801. })
  802. // this.getShipmentList() // 刷新托书列表
  803. },
  804. close() {
  805. this.addBook ={}
  806. this.addBookData =[]
  807. this.rmbList = [{}]
  808. this.usdList = [{}]
  809. this.visible = false
  810. this.defaultMethod = 'add'
  811. this.$refs.form.resetFields()
  812. },
  813. // ------------------------------------------
  814. modalFormOk() {},
  815. aa() {}
  816. // // 分页、排序、筛选变化时触发
  817. // handleTableChange(pagination, filters, sorter) {
  818. // // console.log('当前页信息>>>>',pagination)
  819. // this.queryParam.pageNo = pagination.current
  820. // this.getAnnList()
  821. // }
  822. },
  823. // 出现滚动条,合计栏跟随 table 滚动
  824. watch: {
  825. // dataSource(val) {
  826. // console.log(val)
  827. // // 同步表与footer滚动
  828. // let dom = this.$refs.TableInfo.$el.querySelectorAll('.ant-table-body')[0]
  829. // dom.addEventListener(
  830. // 'scroll',
  831. // () => {
  832. // this.$refs.TableInfo.$el.querySelectorAll('.ant-table-body')[1].scrollLeft = dom.scrollLeft
  833. // console.log('走到这')
  834. // },
  835. // true
  836. // )
  837. // }
  838. },
  839. // 构建合计数据 --合计
  840. // TODO:合计行 有滚动待解决
  841. computed: {
  842. // addBookFooterDataSource() {
  843. // // 新增托书 子表 合计
  844. // const total = Object.assign({}, this.addBookData[0])
  845. // for (const attr in total) {
  846. // total[attr] = '合计'
  847. // break
  848. // }
  849. // return [total]
  850. // }
  851. },
  852. mounted() {}
  853. }
  854. </script>
  855. <style lang="less" scoped>
  856. @import '~@assets/less/common.less';
  857. @import '~@assets/less/overwriter.less';
  858. /deep/ .ant-table-thead > tr > th {
  859. text-align: center;
  860. // font-weight: 700;
  861. }
  862. /deep/ .ant-table-tbody {
  863. text-align: center;
  864. }
  865. // /deep/ th.replacecolor {
  866. // background-color: #ccc;
  867. // }
  868. // 抽屉里的card样式
  869. /deep/ .ant-drawer-content {
  870. background-color: #f0f2f5;
  871. }
  872. /deep/ .ant-drawer-body {
  873. padding: 10px;
  874. }
  875. /deep/ .ant-table-footer .ant-table.body {
  876. // overflow: hidden !important;
  877. }
  878. /deep/ .ant-table.ant-table-bordered .ant-table-footer {
  879. border: none;
  880. padding: 0;
  881. }
  882. </style>