addBookDrawer.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008
  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} 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. defaultMethod : 'add',
  571. confirmLoading: false,
  572. visible: false,
  573. dateFormat: 'YYYY-MM-DD',
  574. validatorRules: {
  575. shippingOrderDate:[{required: true, message: '托书日期不能为空!'}],
  576. shippingOrderNumber:[{required: true, message: '托书号不能为空!'}],
  577. consignee:[{required: true, message: '收货人不能为空!'}],
  578. unitInOperation:[{required: true, message: '经营单位不能为空!'}],
  579. // unitInOperationAddress:[{required: true, message: '经营单位地址不能为空!'}],
  580. tradeCountry:[{required: true, message: '贸易国别不能为空!'}],
  581. arriveInCountry:[{required: true, message: '运抵国别不能为空!'}],
  582. exportPort:[{required: true, message: '出口口岸不能为空!'}],
  583. destinationPort:[{required: true, message: '目的港不能为空!'}],
  584. }
  585. }
  586. },
  587. created() {},
  588. methods: {
  589. //托书号转化大写
  590. convertUppercase(val){
  591. this.addBook.shippingOrderNumber = val.toUpperCase()
  592. },
  593. // 参照装箱单
  594. referPackingList(data) {
  595. console.log('打开参照装箱单')
  596. if(data === '0'){
  597. this.$refs.packingListModal.packingListModVis = true
  598. this.$refs.packingListModal.queryParam.tailoringOrFabric = data
  599. this.$refs.packingListModal.getPackingList()
  600. if(this.addBookData.length !== 0){
  601. this.$refs.packingListModal.fatherList = this.addBookData
  602. }
  603. }else {
  604. this.$refs.packingListModalFabrics.packingListModalFabrics = true
  605. this.$refs.packingListModalFabrics.queryParam.tailoringOrFabric = data
  606. this.$refs.packingListModalFabrics.getPackingList()
  607. if(this.addBookData.length !== 0){
  608. this.$refs.packingListModal.fatherList = this.addBookData
  609. }
  610. }
  611. },
  612. referCallback(data,text){
  613. data.map(item=>{
  614. item.readyFabric=item.readyFabric
  615. item.tailoringFabricItemId=item.itemId
  616. item.tailoringFabricId=item.id
  617. item.clientAbbreviation = item.customerAbbreviation
  618. item.styleNumber = item.itemNumber
  619. item.boxNumber = item.planQuantity
  620. item.netWeight = (Number(item.netWeight)).toFixed(2)
  621. item.grossWeight = (Number(item.grossWeight)).toFixed(2)
  622. item.number = (Number(item.number)).toFixed(2)
  623. item.volume = item.totalVolume
  624. //参照面料时,单价许计算 金额/净重
  625. // if(item.readyFabric == '面料'){
  626. // item.price = (item.totalPrice/item.netWeight).toFixed(2)
  627. // }
  628. })
  629. // var subList = this.convertReferToSub(data);
  630. this.addBookData = this.addBookData.concat(data);
  631. this.addBook.termsOfDeliveryvalue = 'FOB'
  632. this.addBook.exchangeEarningsValue = 'T/T'
  633. this.addBook.exportPort='NINGBO'
  634. var dd = moment(new Date()).format('YYYY-MM-DD')
  635. this.$set( this.addBook,'shippingOrderDate',dd)
  636. //参照成衣是表头数据默认值
  637. if(text == '成衣'){
  638. var transitionData = data[0]
  639. this.addBook = {
  640. shippingOrderNumber:transitionData.depositaryReceiptNo,
  641. shippingOrderDate:transitionData.shippingOrderDate,
  642. unitInOperation:transitionData.unitInOperation,
  643. unitInOperationAddress:transitionData.unitInOperationAddress,
  644. latestDateOfShipment:transitionData.latestDateOfShipment,
  645. theFinalShippingDate:transitionData.theFinalShippingDate,
  646. tradeCountry:transitionData.tradeCountry,
  647. arriveInCountry:transitionData.arriveInCountry,
  648. consignee:transitionData.consignee,
  649. consigneeAddress:transitionData.consigneeAddress,
  650. notifyParty:transitionData.notifyParty,
  651. notifyPartyAddress:transitionData.notifyPartyAddress,
  652. exportPort:transitionData.exportPort,
  653. destinationPort:transitionData.destinationPort,
  654. exchangeEarningsValue:transitionData.exchangeEarningsValue,
  655. termsOfDeliveryvalue:transitionData.termsOfDeliveryvalue,
  656. }
  657. }
  658. this.setHeadCalField()
  659. },
  660. // 参照数据转换成子表
  661. // convertReferToSub(dataList){
  662. // var ret = [];
  663. // for (var i=0; i<dataList.length; i++){
  664. // var data = dataList[i];
  665. // var sub = {
  666. // documentNo:data.documentNo,
  667. // createBy:data.createBy,
  668. // };
  669. // ret.push(sub);
  670. // }
  671. // return ret;
  672. // },
  673. // 増行
  674. // handleAddColumn() {
  675. // console.log('増行')
  676. // const addrow = {
  677. // englishName: '',
  678. // styleNum: '',
  679. // smallPoNum: '',
  680. // quantity: '',
  681. // boxedNum: '',
  682. // roughWeigh: '',
  683. // suttle: '',
  684. // volume: '',
  685. // distributionPoint: '',
  686. // containerCode: '',
  687. // containerNo: '',
  688. // price: '',
  689. // preShipmentDate: '',
  690. // salesman: '',
  691. // operatingDepartment: '',
  692. // purchaseAboardOrderNum: '',
  693. // purchaseAboardFactory: '',
  694. // operation: ''
  695. // }
  696. // this.addBookData.push(addrow)
  697. // },
  698. // 收货人下拉框
  699. consigneeSelectChange(value){
  700. if(value !=null && value !='' &&value != 'undefined'){
  701. var valueArr = value.split("+")
  702. this.addBook.consignee = valueArr[0];
  703. if (valueArr.length == 4){
  704. this.addBook.consigneeAddress = valueArr[1];
  705. this.addBook.notifyParty = valueArr[2];
  706. this.addBook.notifyPartyAddress = valueArr[3];
  707. }else{
  708. this.$message.error('收货信息维护有问题,请检查!')
  709. }
  710. }else{
  711. this.addBook.consigneeAddress = '';
  712. this.addBook.notifyParty = '';
  713. this.addBook.notifyPartyAddress = '';
  714. }
  715. },
  716. unitInOperationChange(val){
  717. if(val !=null && val !='' &&val != 'undefined'){
  718. var valueArr = val.split("+")
  719. this.addBook.unitInOperation = valueArr[0]
  720. this.addBook.unitInOperationAddress = valueArr[3]
  721. this.addBook.customsCode = valueArr[1]
  722. this.addBook.dutyParagraph = valueArr[2]
  723. }else {
  724. this.addBook.unitInOperation = ''
  725. this.addBook.unitInOperationAddress = ''
  726. this.addBook.customsCode = ''
  727. this.addBook.dutyParagraph = ''
  728. }
  729. },
  730. // 设置表头计算值,直接设置表头值对象不能刷新,把表头对象换了就可以了
  731. setHeadCalField(){
  732. var containerNumberArr = [],
  733. readyFabricArr = []
  734. var headData = JSON.parse(JSON.stringify(this.addBook));
  735. var moneyAll = 0,
  736. vol = 0
  737. for (var i=0; i<this.addBookData.length; i++){
  738. var rowData = this.addBookData[i];
  739. if(rowData.readyFabric == '面料'){
  740. containerNumberArr.push(rowData.containerNumber)
  741. readyFabricArr.push(rowData.readyFabric)
  742. }
  743. if (rowData.totalPrice != undefined && rowData.totalPrice != ""){
  744. moneyAll += rowData.totalPrice*1;
  745. }
  746. if (rowData.volume != undefined && rowData.volume != ""){
  747. vol += rowData.volume*1;
  748. }
  749. }
  750. headData.totalVolume = parseFloat(vol.toFixed(4));
  751. containerNumberArr = [...new Set(containerNumberArr)]
  752. readyFabricArr = [...new Set(readyFabricArr)]
  753. if(readyFabricArr.length == 1 && readyFabricArr[0] == '面料'){
  754. headData.totalVolume = (containerNumberArr.length)*68;
  755. }
  756. headData.money = parseFloat(moneyAll.toFixed(2));
  757. this.addBook = headData;
  758. },
  759. //集装箱号修改
  760. changeContainerNumber(){
  761. this.setHeadCalField()
  762. },
  763. // // 新增托书 子表合计
  764. // addBookFooterShow(data) {
  765. // console.log('新增托书 子表 ----合计行')
  766. // console.log('data', data)
  767. // return (
  768. // <a-table
  769. // rowKey={Math.random}
  770. // bordered={false}
  771. // pagination={false}
  772. // columns={this.addBookColumns}
  773. // dataSource={this.addBookFooterDataSource || []}
  774. // showHeader={false}
  775. // ></a-table>
  776. // )
  777. // },
  778. // 操作 删除
  779. handleDelete(index) {
  780. this.addBookData.splice(index, 1);
  781. this.setHeadCalField()
  782. },
  783. // 抽屉 取消
  784. handleCancel() {
  785. console.log('点击抽屉取消')
  786. this.close()
  787. },
  788. // 抽屉 提交
  789. submitAdd() {
  790. console.log('保存新增、刷新托书')
  791. const that = this
  792. // 触发表单验证
  793. this.$refs.form.validate(valid => {
  794. if (valid) {
  795. // that.confirmLoading = true
  796. var newObj = this.addBook
  797. newObj.rmbList = this.rmbList
  798. newObj.usdList = this.usdList
  799. newObj.syShippingOrderItemList = this.addBookData
  800. for(var i =0;i<newObj.syShippingOrderItemList.length;i++){
  801. var row = newObj.syShippingOrderItemList[i]
  802. // if(row.containerCode === '' || !row.containerCode){
  803. // this.$message.error('第'+(i+1)+'行集装箱代号未填,无法保存!');
  804. // return
  805. // }
  806. if(row.containerNumber === '' || !row.containerNumber){
  807. this.$message.error('第'+(i+1)+'行集装箱号未填,无法保存!');
  808. return
  809. }
  810. }
  811. if(this.defaultMethod === 'add'){
  812. addPackingList(newObj).then(res => {
  813. if (res.success) {
  814. this.$message.success('添加成功')
  815. this.$emit('back')
  816. this.close()
  817. }else {
  818. this.$message.error(res.message);
  819. }
  820. })
  821. }else {
  822. newObj.syShippingOrderItemList.map(item =>{
  823. item.smailPo = item.smallPo
  824. item.styleNumber = item.itemNumber
  825. // item.volume = item.volume
  826. item.unitPrice = item.price
  827. })
  828. editPackingList(newObj).then(res => {
  829. if (res.success) {
  830. this.$message.success('编辑成功')
  831. this.$emit('back')
  832. this.close()
  833. }else {
  834. this.$message.error(res.message);
  835. }
  836. })
  837. }
  838. }
  839. })
  840. // this.getShipmentList() // 刷新托书列表
  841. },
  842. adsCNY(){
  843. var newObj ={
  844. freightForwarder :'',
  845. amount:'',
  846. option:''
  847. }
  848. this.rmbList.push(newObj)
  849. },
  850. adsUSD(){
  851. var newObj ={
  852. freightForwarder :'',
  853. amount:'',
  854. option:''
  855. }
  856. this.usdList.push(newObj)
  857. },
  858. deleteCNY(index){
  859. this.rmbList.splice(index, 1);
  860. },
  861. deleteUSD(index){
  862. this.usdList.splice(index, 1);
  863. },
  864. close() {
  865. this.addBook ={}
  866. this.addBookData =[]
  867. this.rmbList = [{}]
  868. this.usdList = [{}]
  869. this.visible = false
  870. this.defaultMethod = 'add'
  871. this.$refs.form.resetFields()
  872. },
  873. // ------------------------------------------
  874. modalFormOk() {},
  875. aa() {}
  876. // // 分页、排序、筛选变化时触发
  877. // handleTableChange(pagination, filters, sorter) {
  878. // // console.log('当前页信息>>>>',pagination)
  879. // this.queryParam.pageNo = pagination.current
  880. // this.getAnnList()
  881. // }
  882. },
  883. // 出现滚动条,合计栏跟随 table 滚动
  884. watch: {
  885. // dataSource(val) {
  886. // console.log(val)
  887. // // 同步表与footer滚动
  888. // let dom = this.$refs.TableInfo.$el.querySelectorAll('.ant-table-body')[0]
  889. // dom.addEventListener(
  890. // 'scroll',
  891. // () => {
  892. // this.$refs.TableInfo.$el.querySelectorAll('.ant-table-body')[1].scrollLeft = dom.scrollLeft
  893. // console.log('走到这')
  894. // },
  895. // true
  896. // )
  897. // }
  898. },
  899. // 构建合计数据 --合计
  900. // TODO:合计行 有滚动待解决
  901. computed: {
  902. // addBookFooterDataSource() {
  903. // // 新增托书 子表 合计
  904. // const total = Object.assign({}, this.addBookData[0])
  905. // for (const attr in total) {
  906. // total[attr] = '合计'
  907. // break
  908. // }
  909. // return [total]
  910. // }
  911. },
  912. mounted() {}
  913. }
  914. </script>
  915. <style lang="less" scoped>
  916. @import '~@assets/less/common.less';
  917. @import '~@assets/less/overwriter.less';
  918. /deep/ .ant-table-thead > tr > th {
  919. text-align: center;
  920. // font-weight: 700;
  921. }
  922. /deep/ .ant-table-tbody {
  923. text-align: center;
  924. }
  925. // /deep/ th.replacecolor {
  926. // background-color: #ccc;
  927. // }
  928. // 抽屉里的card样式
  929. /deep/ .ant-drawer-content {
  930. background-color: #f0f2f5;
  931. }
  932. /deep/ .ant-drawer-body {
  933. padding: 10px;
  934. }
  935. /deep/ .ant-table-footer .ant-table.body {
  936. // overflow: hidden !important;
  937. }
  938. /deep/ .ant-table.ant-table-bordered .ant-table-footer {
  939. border: none;
  940. padding: 0;
  941. }
  942. /deep/.ant-table-row-cell-break-word >.ant-form-item{
  943. margin-bottom: 0px !important;
  944. }
  945. /deep/.ant-table-tbody .ant-table-row td{
  946. padding-top: 8px !important;
  947. padding-bottom: 8px !important;
  948. }
  949. </style>