addBookDrawer.vue 31 KB

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