detailsBookDrawer.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. <template>
  2. <!-- 新增托书 -->
  3. <div id="addBookDrawer">
  4. <a-drawer
  5. title="详情"
  6. width="89%"
  7. placement="right"
  8. :closable="true"
  9. :visible="visible"
  10. @close="handleCancel">
  11. <!-- 主表信息 填写 为什么原先图部分回显??-->
  12. <a-card :bordered="true">
  13. <div class="table-page-search-wrapper">
  14. <a-form-model layout="inline" ref="form" :model="addBook" :rules="validatorRules">
  15. <a-row :gutter="24">
  16. <a-col :md="6" :sm="8">
  17. <a-form-model-item label="托书日期" prop="shippingOrderDate">
  18. {{addBook.shippingOrderDate}}
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :md="6" :sm="8">
  22. <a-form-model-item label="托书号" prop="shippingOrderNumber">
  23. {{addBook.shippingOrderNumber}}
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :md="6" :sm="8">
  27. <a-form-model-item label="经营单位" prop="unitInOperation">
  28. {{addBook.unitInOperation}}
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :md="6" :sm="8">
  32. <a-form-model-item label="经营单位地址" prop="unitInOperationAddress">
  33. {{addBook.unitInOperationAddress | ellipsis}}
  34. </a-form-model-item>
  35. </a-col>
  36. <a-col :md="6" :sm="8">
  37. <a-form-model-item label="装运期限" prop="latestDateOfShipment">
  38. {{addBook.latestDateOfShipment}}
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :md="6" :sm="8">
  42. <a-form-model-item label="最终船期" prop="theFinalShippingDate">
  43. {{addBook.theFinalShippingDate}}
  44. </a-form-model-item>
  45. </a-col>
  46. <a-col :md="6" :sm="8">
  47. <a-form-model-item label="运抵国别" prop="arriveInCountry">
  48. {{addBook.arriveInCountry}}
  49. <!-- <a-input placeholder="请输入运抵国别" v-model="addBook.arriveInCountry"></a-input> -->
  50. </a-form-model-item>
  51. </a-col>
  52. <a-col :md="6" :sm="8">
  53. <a-form-model-item label="贸易国别" prop="tradeCountry">
  54. {{addBook.tradeCountry}}
  55. <!-- <a-input placeholder="请输入贸易国别" v-model="addBook.tradeCountry"></a-input> -->
  56. </a-form-model-item>
  57. </a-col>
  58. <a-col :md="6" :sm="8">
  59. <a-form-model-item label="收货人" prop="consignee">
  60. {{addBook.consignee | ellipsis}}
  61. </a-form-model-item>
  62. </a-col>
  63. <a-col :md="6" :sm="8">
  64. <a-form-model-item label="收货人地址" prop="consigneeAddress">
  65. {{addBook.consigneeAddress | ellipsis}}
  66. </a-form-model-item>
  67. </a-col>
  68. <a-col :md="6" :sm="8">
  69. <a-form-model-item label="通知方" prop="notifyParty">
  70. {{addBook.notifyParty}}
  71. </a-form-model-item>
  72. </a-col>
  73. <a-col :md="6" :sm="8">
  74. <a-form-model-item label="通知方地址" prop="notifyPartyAddress">
  75. {{addBook.notifyPartyAddress}}
  76. </a-form-model-item>
  77. </a-col>
  78. <a-col :md="6" :sm="8">
  79. <a-form-model-item label="出口口岸" prop="exportPort">
  80. {{addBook.exportPort}}
  81. </a-form-model-item>
  82. </a-col>
  83. <a-col :md="6" :sm="8">
  84. <a-form-model-item label="目的港" prop="destinationPort">
  85. {{addBook.destinationPort}}
  86. <!-- <a-input placeholder="请输入目的港" v-model="addBook.destinationPort"></a-input> -->
  87. </a-form-model-item>
  88. </a-col>
  89. <a-col :md="6" :sm="8">
  90. <a-form-model-item label="收汇方式" prop="exchangeEarningsValue">
  91. {{addBook.exchangeEarningsValue}}
  92. <!-- <a-input placeholder="请输入收汇方式" v-model="addBook.exchangeEarningsValue"></a-input> -->
  93. </a-form-model-item>
  94. </a-col>
  95. <a-col :md="6" :sm="8">
  96. <a-form-model-item label="成交方式" prop="termsOfDeliveryvalue">
  97. {{addBook.termsOfDeliveryvalue}}
  98. <!-- <a-input placeholder="请输入成交方式" v-model="addBook.termsOfDeliveryvalue"></a-input> -->
  99. </a-form-model-item>
  100. </a-col>
  101. <!-- <a-col :md="6" :sm="8">
  102. <a-form-model-item label="金额" prop="money">
  103. {{addBook.money}}
  104. </a-form-model-item>
  105. </a-col> -->
  106. <!-- <a-col :md="6" :sm="8">
  107. <a-form-model-item label="人民币" prop="cny">
  108. {{addBook.cny}}
  109. </a-form-model-item>
  110. </a-col>
  111. <a-col :md="6" :sm="8">
  112. <a-form-model-item label="美元" prop="usd">
  113. {{addBook.usd}}
  114. </a-form-model-item>
  115. </a-col> -->
  116. </a-row>
  117. </a-form-model>
  118. </div>
  119. </a-card>
  120. <!--操作按钮区域 参照装箱单 増行-->
  121. <a-card :bordered="true" style="margin:10px 0 40px 0;">
  122. <!-- 子表-->
  123. <a-spin :spinning="confirmLoading">
  124. <a-form-model ref="formRef" :rules="validatorRules">
  125. <a-table
  126. bordered
  127. :row-key="record => record.id"
  128. :columns="addBookColumns"
  129. :data-source="addBookData"
  130. :loading="loading"
  131. :pagination="false"
  132. :scroll="{ x: 1500,y: 350 }"
  133. @change="handleTableChange"
  134. >
  135. </a-table>
  136. <div class="amount">
  137. <span class="all">总数量:{{ allMount.toFixed(2) }}</span>
  138. <span class="all">总箱数:{{ allBox.toFixed(2) }}</span>
  139. <span class="all">总毛重:{{ allGross.toFixed(2) }}</span>
  140. <span class="all">总净重:{{ allNet.toFixed(2) }}</span>
  141. <span class="all">总金额:{{ allMoney.toFixed(2) }}</span>
  142. <span class="all">总体积:{{ allVloum.toFixed(3) }}</span>
  143. </div>
  144. </a-form-model>
  145. <!-- 人民币、美金 -->
  146. <a-row style="margin:60px 0;">
  147. <div class="purchase-order-table" style="width:48%;marginRight:4%;float:left;">
  148. <h6 class="table-title">人民币</h6>
  149. <a-table
  150. :row-key="record => record.id"
  151. :loading="loading"
  152. :columns="CNYColumns"
  153. :scroll="{ y: 200 }"
  154. :data-source="rmbList"
  155. bordered
  156. :pagination="false"
  157. >
  158. <template slot="CNYfreighForward" slot-scope="text, record, index">
  159. <a-form-model-item prop="CNYfreighForward" :rules="rules.CNYfreighForward" >
  160. <a-input placeholder="请输入货代" v-model="record.freightForwarder" />
  161. </a-form-model-item>
  162. </template>
  163. <template slot="CNYmoney" slot-scope="text, record, index">
  164. <a-form-model-item prop="CNYmoney" :rules="rules.CNYmoney" >
  165. <a-input placeholder="请输入金额" v-model="record.amount" />
  166. </a-form-model-item>
  167. </template>
  168. <!-- CNY项目列 -->
  169. <template slot="CNYProjectList" slot-scope="text, record, index">
  170. <a-form-model-item prop="CNYProjectList" :rules="rules.CNYProjectList">
  171. <a-select v-model="record.itemColumn" style="width:100%" placeholder="请输入项目列" >
  172. <a-select-option value="1">项目列1</a-select-option>
  173. <a-select-option value="2">项目列2</a-select-option>
  174. </a-select>
  175. </a-form-model-item>
  176. </template>
  177. </a-table>
  178. </div>
  179. <div class="purchase-order-table" style="width:48%;float:right;">
  180. <h6 class="table-title">美金</h6>
  181. <a-table
  182. :row-key="record => record.id"
  183. :loading="loading"
  184. :columns="USDColumns"
  185. :data-source="usdList"
  186. :scroll="{ y: 200 }"
  187. bordered
  188. :pagination="false"
  189. >
  190. <template slot="USDfreighForward" slot-scope="text, record, index">
  191. <a-form-model-item prop="USDfreighForward" :rules="rules.USDfreighForward" >
  192. <a-input placeholder="请输入货代" v-model="record.freightForwarder" />
  193. </a-form-model-item>
  194. </template>
  195. <template slot="USDmoney" slot-scope="text, record, index">
  196. <a-form-model-item prop="USDmoney" :rules="rules.USDmoney" >
  197. <a-input placeholder="请输入金额" v-model="record.amount" />
  198. </a-form-model-item>
  199. </template>
  200. <!-- USD项目列 -->
  201. <template slot="USDProjectList" slot-scope="text, record, index">
  202. <a-form-model-item prop="USDProjectList" :rules="rules.USDProjectList">
  203. <a-select v-model="record.itemColumn" style="width:100%" >
  204. <a-select-option value="1">项目列1</a-select-option>
  205. <a-select-option value="2">项目列2</a-select-option>
  206. </a-select>
  207. </a-form-model-item>
  208. </template>
  209. </a-table>
  210. </div>
  211. </a-row>
  212. <a-row :gutter="24">
  213. <a-col :span="12">
  214. <a-form-model-item label="推送成功单据" prop="accessory">
  215. <ul v-for="(item, index) in timeMesage" :key="index" >
  216. <li>{{ item }} </li>
  217. </ul>
  218. </a-form-model-item>
  219. </a-col>
  220. <a-col :span="12">
  221. <a-form-model-item label="失败信息" prop="accessory">
  222. <span>{{ addBook.failMesage }}</span>
  223. </a-form-model-item>
  224. </a-col>
  225. </a-row>
  226. </a-spin>
  227. </a-card>
  228. <!-- 页面底部保存取消 -->
  229. <div
  230. :style="{
  231. position: 'absolute',
  232. right: 0,
  233. bottom: 0,
  234. width: '100%',
  235. borderTop: '1px solid #e9e9e9',
  236. padding: '10px 16px',
  237. background: '#fff',
  238. textAlign: 'right',
  239. zIndex: 999
  240. }"
  241. >
  242. <!-- <a-button :style="{ marginRight: '8px' }" @click="handleCancel">关闭</a-button>
  243. <a-button type="primary" :style="{ marginRight: '8px' }" @click="editMoney" :disabled="disabled">保存</a-button> -->
  244. </div>
  245. </a-drawer>
  246. </div>
  247. </template>
  248. <script>
  249. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  250. import JEllipsis from '@/components/jeecg/JEllipsis'
  251. import moment from 'moment'
  252. import {editMoney} from '@api/document/book.js'
  253. export default {
  254. name: 'AddBookDrawer', // 新增 托书
  255. mixins: [JeecgListMixin],
  256. components: { JEllipsis, moment }, // 参照装箱单 弹框
  257. data() {
  258. let ellipsis = (v, l = 15) => <j-ellipsis value={v} length={l} />
  259. return {
  260. disabled:true,
  261. timeMesage:[],
  262. // 表头
  263. addBookColumns: [
  264. {
  265. title: '款号',
  266. dataIndex: 'styleNumber',
  267. width: 120,
  268. ellipsis: true,
  269. className: 'replacecolor'
  270. },
  271. {
  272. title: '小po',
  273. dataIndex: 'smailPo',
  274. width: 120,
  275. ellipsis: true,
  276. className: 'replacecolor'
  277. },
  278. {
  279. title: '数量',
  280. dataIndex: 'number',
  281. width: 100,
  282. ellipsis: true,
  283. className: 'replacecolor'
  284. },
  285. {
  286. title: '箱数',
  287. dataIndex: 'boxNumber',
  288. width: 100,
  289. ellipsis: true,
  290. className: 'replacecolor'
  291. },
  292. {
  293. title: '毛重',
  294. dataIndex: 'grossWeight',
  295. width: 100,
  296. ellipsis: true,
  297. className: 'replacecolor'
  298. },
  299. {
  300. title: '净重',
  301. dataIndex: 'netWeight',
  302. width: 100,
  303. ellipsis: true,
  304. // scopedSlots: { customRender: 'containerCode' },
  305. className: 'replacecolor'
  306. },
  307. {
  308. title: '体积',
  309. dataIndex: 'volume',
  310. width: 100,
  311. ellipsis: true,
  312. // scopedSlots: { customRender: 'containerNo' },
  313. // className: 'replacecolor'
  314. },
  315. {
  316. title: '分销点',
  317. dataIndex: 'distributionPoint',
  318. width: 100,
  319. ellipsis: true,
  320. className: 'replacecolor'
  321. },
  322. {
  323. title: '集装箱号',
  324. dataIndex: 'containerNumber',
  325. ellipsis: true,
  326. scopedSlots: { customRender: 'containerNumber' },
  327. width: 100,
  328. // fixed: 'left',
  329. className: 'replacecolor'
  330. },
  331. // {
  332. // title: '集装箱代号',
  333. // dataIndex: 'containerCode',
  334. // scopedSlots: { customRender: 'containerCode' },
  335. // width: 120,
  336. // ellipsis: true,
  337. // className: 'replacecolor'
  338. // },
  339. {
  340. title: '单价',
  341. dataIndex: 'unitPrice',
  342. width: 100,
  343. ellipsis: true,
  344. className: 'replacecolor'
  345. },
  346. {
  347. title: '金额',
  348. dataIndex: 'totalPrice',
  349. width: 100,
  350. ellipsis: true,
  351. className: 'replacecolor'
  352. },
  353. {
  354. title: '净价总金额',
  355. dataIndex: 'totalNetPrice',
  356. width: 120,
  357. ellipsis: true,
  358. className: 'replacecolor'
  359. },
  360. {
  361. title: '制单人',
  362. dataIndex: 'createBy',
  363. width: 120,
  364. ellipsis: true,
  365. // fixed: 'left',
  366. className: 'replacecolor'
  367. },
  368. {
  369. title: '采购/委外订单号',
  370. dataIndex: 'purOrSubOrder',
  371. width: 160,
  372. ellipsis: true,
  373. className: 'replacecolor'
  374. },
  375. {
  376. title: '英文名称',
  377. dataIndex: 'englishName',
  378. width: 160,
  379. ellipsis: true,
  380. className: 'replacecolor'
  381. },
  382. {
  383. title: '业务员',
  384. dataIndex: 'salesman',
  385. width: 160,
  386. ellipsis: true,
  387. className: 'replacecolor'
  388. },
  389. ],
  390. addBookData: [],
  391. CNYColumns: [
  392. {
  393. title: '货代',
  394. dataIndex: 'freightForwarderName',
  395. width: 60,
  396. className: 'replacecolor',
  397. //scopedSlots: { customRender: 'CNYfreighForward' },
  398. },
  399. {
  400. title: '金额',
  401. dataIndex: 'amount',
  402. width: 60,
  403. className: 'replacecolor',
  404. //scopedSlots: { customRender: 'CNYmoney' },
  405. },
  406. {
  407. title: '项目列',
  408. dataIndex: 'itemColumnName',
  409. // scopedSlots: { customRender: 'CNYProjectList' },
  410. width: 60,
  411. className: 'replacecolor'
  412. }
  413. ],
  414. rmbList: [{}],
  415. USDColumns: [
  416. {
  417. title: '货代',
  418. dataIndex: 'freightForwarderName',
  419. // scopedSlots: { customRender: 'USDfreighForward' },
  420. width: 60,
  421. className: 'replacecolor'
  422. },
  423. {
  424. title: '金额',
  425. dataIndex: 'amount',
  426. //scopedSlots: { customRender: 'USDmoney' },
  427. width: 60,
  428. className: 'replacecolor'
  429. },
  430. {
  431. title: '项目列',
  432. dataIndex: 'itemColumnName',
  433. width: 60,
  434. //scopedSlots: { customRender: 'USDProjectList' },
  435. className: 'replacecolor'
  436. }
  437. ],
  438. usdList: [{}],
  439. loading: false, // 表格加载
  440. addBook: {},
  441. confirmLoading: false,
  442. visible: false,
  443. dateFormat: 'YYYY-MM-DD',
  444. allMount:0,
  445. allGross:0,
  446. allNet:0,
  447. allMoney:0,
  448. allVloum:0,
  449. allBox:0,
  450. validatorRules: {
  451. shippingOrderDate:[{required: true, message: '托书日期不能为空!'}],
  452. consignee:[{required: true, message: '收货人不能为空!'}],
  453. shippingOrderNumber:[{required: true, message: '预托书号不能为空!'}],
  454. }
  455. }
  456. },
  457. created() {},
  458. watch: {
  459. addBookData(val) {
  460. this.allGross = 0
  461. this.allMoney = 0
  462. this.allMount = 0
  463. this.allNet = 0
  464. this.allBox = 0
  465. val.map(item=>{
  466. this.allGross+=Number(item.grossWeight)
  467. this.allMoney+=Number(item.totalPrice)
  468. this.allMount+=Number(item.number)
  469. this.allNet+=Number(item.netWeight)
  470. this.allBox += Number(item.boxNumber)
  471. })
  472. this.getTotalVolumn()
  473. }
  474. },
  475. filters: {
  476. //文字数超出时,超出部分使用...
  477. ellipsis(value) {
  478. if (!value) return ''
  479. if (value.length > 20) {
  480. return value.slice(0, 30) + '...'
  481. }
  482. return value
  483. }
  484. },
  485. methods: {
  486. // // 新增托书 子表合计
  487. // addBookFooterShow(data) {
  488. // console.log('新增托书 子表 ----合计行')
  489. // console.log('data', data)
  490. // return (
  491. // <a-table
  492. // rowKey={Math.random}
  493. // bordered={false}
  494. // pagination={false}
  495. // columns={this.addBookColumns}
  496. // dataSource={this.addBookFooterDataSource || []}
  497. // showHeader={false}
  498. // ></a-table>
  499. // )
  500. // },
  501. getTotalVolumn(){
  502. this.allVloum = 0
  503. var containerNumberArr = [],
  504. readyFabricArr = []
  505. // var headData = JSON.parse(JSON.stringify(this.addBook));
  506. var vol = 0
  507. for (var i=0; i<this.addBookData.length; i++){
  508. var rowData = this.addBookData[i];
  509. if(rowData.readyFabric == '面料'){
  510. containerNumberArr.push(rowData.containerNumber)
  511. readyFabricArr.push(rowData.readyFabric)
  512. }
  513. if (rowData.volume != undefined && rowData.volume != ""){
  514. vol += rowData.volume*1;
  515. }
  516. }
  517. var totalVolume = parseFloat(vol.toFixed(4));
  518. containerNumberArr = [...new Set(containerNumberArr)]
  519. readyFabricArr = [...new Set(readyFabricArr)]
  520. if(readyFabricArr.length == 1 && readyFabricArr[0] == '面料'){
  521. totalVolume = (containerNumberArr.length)*68;
  522. }
  523. this.allVloum = totalVolume
  524. },
  525. // 抽屉 取消
  526. handleCancel() {
  527. console.log('点击抽屉取消')
  528. this.close()
  529. },
  530. editMoney(){
  531. var param = {
  532. id:this.addBook.id
  533. }
  534. param.rmbList = this.rmbList
  535. param.usdList = this.usdList
  536. editMoney(param).then(res => {
  537. if (res.success) {
  538. this.$message.success('修改成功')
  539. this.close()
  540. }else {
  541. this.$message.error(res.message);
  542. }
  543. })
  544. },
  545. close() {
  546. this.$emit('close')
  547. this.addBook ={}
  548. this.addBookData =[]
  549. this.rmbList = []
  550. this.usdList = []
  551. this.visible = false
  552. },
  553. },
  554. mounted() {}
  555. }
  556. </script>
  557. <style lang="less" scoped>
  558. @import '~@assets/less/common.less';
  559. @import '~@assets/less/overwriter.less';
  560. /deep/ .ant-table-thead > tr > th {
  561. text-align: center;
  562. // font-weight: 700;
  563. }
  564. /deep/ .ant-table-tbody {
  565. text-align: center;
  566. }
  567. // /deep/ th.replacecolor {
  568. // background-color: #ccc;
  569. // }
  570. // 抽屉里的card样式
  571. /deep/ .ant-drawer-content {
  572. background-color: #f0f2f5;
  573. }
  574. /deep/ .ant-drawer-body {
  575. padding: 10px;
  576. }
  577. /deep/ .ant-table-footer .ant-table.body {
  578. // overflow: hidden !important;
  579. }
  580. /deep/ .ant-table.ant-table-bordered .ant-table-footer {
  581. border: none;
  582. padding: 0;
  583. }
  584. // /deep/.ant-form{
  585. // position: relative;
  586. // }
  587. .amount{
  588. // position:absolute;
  589. // bottom: 2%;
  590. width: 50%;
  591. }
  592. .all{
  593. margin-right: 4%;
  594. }
  595. </style>