addBookDrawer.vue 39 KB

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