addBookDrawer.vue 32 KB

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