addBookDrawer.vue 34 KB

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