addBookDrawer.vue 37 KB

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